1

How do you get the owner's public key of an associated token account using web3.js?

On SolScan, it very clearly displays it.

https://solscan.io/account/5StXNPyFF9UugaCodSqcAU6wcUpZSkgPNMHRJYffqL6w

1 Answer 1

2

you can use @solana/spl-token there is a method to pass in a token account ID and then you can check the owner field on it. Here is the code snipper from @solana/spl-token@.2.0

https://github.com/solana-labs/solana-program-library/blob/master/token/js/src/state/account.ts#L85-L103

1
  • Such a brain dead moment for me. Didn't even think to use the spl library. Thank you!
    – a_rubik
    Aug 6, 2022 at 0:20

Your Answer

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

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