Fetch all token accounts owned by a wallet, optionally filtered by mint.
HTTP transport.
Wallet public key.
Optional
Token mint to filter by (optional).
RPC options. Include programId to target Token-2022 specifically.
programId
Array of decoded token accounts.
const accounts = await fetchTokenAccountsByOwner(transport, walletPubkey, usdcMint);for (const a of accounts) console.log(`${a.address}: ${a.decoded.amount}`); Copy
const accounts = await fetchTokenAccountsByOwner(transport, walletPubkey, usdcMint);for (const a of accounts) console.log(`${a.address}: ${a.decoded.amount}`);
1.1.0
Fetch all token accounts owned by a wallet, optionally filtered by mint.