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!