0

I'm using hellomoon.io data streaming to know when a new Liquidity Pool is created (on Raydium for any pair that has SOL in it), when one is created I want to check how much liquidity in USD it has. Hellomoon's data stream does not provide how much of each token was given to the LP, so I'm trying to use getTokenAccountBalance for that, however, I'm getting this error:

{"code":-32602,"message":"Invalid param: could not find account","data":null}

But if I take the token account address on Solscan, using the same RPC provided by Hellomoon to communicate with Solana I can see the TA data without issue.

I can't understand what's the issue, maybe in code I'm checking the token account balance too fast after LP creation?

1 Answer 1

3

I'd assume this is due to one of two issues:

  • It takes RPC providers a little bit of time after account creation to index new accounts. You can check if this is the problem for you by using your balance fetching code on an older account and seeing if you get the same error there. To fix it, try waiting a little bit/adding some retry logic after account creation.
  • You're calling getTokenAccountBalance on a non-token account: Tokens are stored in a separate token account in Solana, which is what you have to pass to this function. Solscan does this under the hood automatically, but when writing your own code you have to do this manually. This question specifies how exactly to do this.
2
  • Thank you for your reply. I'm using the "token account" A or B as reported by Hellomoon.io data stream docs.hellomoon.io/docs/lp-creations, it seems that time is of the issue because I can retrieve the information from the RPC manually for the same address that previously gave me problems. I have had put times of 5 seconds and it appears that the issue prevails when testing for new TA, should I extend those wait times?
    – shackra
    Commented Jan 14 at 9:12
  • it seems that retrying/waiting allows the RPC to index the token account.
    – shackra
    Commented Jan 14 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.