1

Since addresses of token accounts do not necessarily need to be PDAs following a seed pattern that makes it easy to find them again by deriving the PDA using the pattern information, I wonder how tools like the Token Program CLI actually find the correct token account for an owner/mint pair. Are these tools actually fetching through all accounts of type Account owned by the Token Program and compare the fields owner and mint with the search parameter?

1 Answer 1

3

The actual cli function calls the getTokenAccountsByOwner rpc method. The rpc indexes token accounts to allow this function to be easily called.

More generally though the getProgramAccounts can be called to return all accounts owned by a program with given filters.

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.