Solana CookbookTokens
The token account holds the token balance, which can be retrieved with a single PRC call
import { address, createSolanaRpc } from "@solana/kit";const rpc = createSolanaRpc("http://localhost:8899");const tokenAccountAddress = address("GfVPzUxMDvhFJ1Xs6C9i47XQRSapTd8LHw5grGuTquyQ",);const balance = await rpc.getTokenAccountBalance(tokenAccountAddress).send();console.log(balance);
Console
Click to execute the code.
A token account can only hold one kind of mint. When you specify a token account, you also specific a mint too.
Is this page helpful?