Fetch and decode a single SPL Token account.
Automatically detects Token vs Token-2022 from the on-chain owner and applies the appropriate decoder (including extensions for 2022).
HTTP transport.
Token account public key.
RPC options.
Decoded token account, or null if not found.
null
const acct = await fetchTokenAccount(transport, tokenAccountPubkey);if (acct) console.log(`Balance: ${acct.decoded.amount}, Mint: ${acct.decoded.mint}`); Copy
const acct = await fetchTokenAccount(transport, tokenAccountPubkey);if (acct) console.log(`Balance: ${acct.decoded.amount}, Mint: ${acct.decoded.mint}`);
1.1.0
Fetch and decode a single SPL Token account.
Automatically detects Token vs Token-2022 from the on-chain owner and applies the appropriate decoder (including extensions for 2022).