getTokenAccountBalance | Solana

Solana getTokenAccountBalance method

The Solana getTokenAccountBalance method returns the token balance of an account.

This method provides the token balance of a specific account, which is the amount of tokens the account holds. It is useful for tracking the token balance of an account.

📘

The interactive example is querying on the Solana mainnet the top USDC token account holder, which is Circle.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • accountPubkey — the public key of the account to retrieve the token balance for.
  • commitment — (optional) the level of commitment desired:
    • processed — the node has processed the block and the block may be on a fork.
    • confirmed — the block is confirmed by the cluster as not being on a fork.
    • finalized — the block is finalized by the cluster.

Response

  • value — the token balance of the account:
    • amount — the amount of tokens the account holds.
    • decimals — the number of decimal places the token has.
    • uiAmount — the amount of tokens the account holds, adjusted for decimals.

Use case

A practical use case for getTokenAccountBalance is to track the token balance of an account. This can be useful for wallets or other applications that need to display or make use of this information.

Try the getTokenAccountBalance RPC method yourself

Language
Click Try It! to start a request and see the response here!