1

enter image description here

Can anyone tell me why it logs nothing when either sol or spl token is deposited to the desired walletAddress? Other methods work perfectly whenever I change onProgramAccountChange to something else. But I want to use this one, since I can't find any other function that will notify me whenever my wallet receives something.

1
  • Btw onAccountChange method works, but only for solana deposits not for spl tokens. Commented Apr 7 at 15:19

1 Answer 1

1

This is a bit confusing, but onProgramAccountChange actually corresponds to programSubscribe https://solana.com/docs/rpc/websocket/programsubscribe, which only tells you when an account owned by the given program address is modified.

In your case, the provided address is a wallet, and not a program, so you won't get any notifications.

3
  • Thank you for your response. What could be a possible solution to this problem? I want to get notified whenever I receive any spl or sol token, even if I've never owned that token before. Commented Apr 13 at 17:29
  • Looks like you already asked about that at solana.stackexchange.com/questions/12693/…, so let's use that question
    – Jon C
    Commented Apr 13 at 18:41
  • I dont know how to do that, can you be more precise, like which method should I use and etc. thanks in advance. Commented Apr 13 at 19:00

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.