I have a web service in which I'll be generating to my users wallets in SOL and in USDT/USDC. The wallets will be custodial, for deposits, and it has to be this way.
And I need to obtain and parse incoming TXs in SOL and USDT/USDC, via API.
As I've found out, in order be able to see and parse incoming TXs in USDT/USDC, I'll have to create and use the 2 assosiated accounts for USDT/USDC first. In other words, the API endpoint getSignaturesForAddress(...)
, if called with the main - SOL
- address, will only return the TXs sent in SOL, and not the ones send in USDT/USDC.
To parse the TXs for the tokens, getSignaturesForAddress(spl_token_addrr)
requires an address of any of those.
Correct?
If so, how will I resolve all this?
Will I have to generate the main - SOL - account first, for each new wallet, then top it up to pay the rent (0.005 SOL), and only then generate assosiated addresses in USDT/USDC for it?
How to generate an assosiated account in web3.js
?
Otherwise, is there a better and simpler solution?
update 1:
if a user for the very time sends some USDT to the SOL address, thus creating a USDT address by himself, this will work fine. However, how will I check and get the address of, not create it, an assossiated account for USDT by the main SOL one?