How to get a Token Account's Balance

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("https://api.mainnet-beta.solana.com");
const tokenAccountAddress = address(
"GfVPzUxMDvhFJ1Xs6C9i47XQRSapTd8LHw5grGuTquyQ"
);
const balance = await rpc.getTokenAccountBalance(tokenAccountAddress).send();
console.log(balance);

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?