HTTP Methods
GetTokenAccountBalance
getTokenAccountBalance RPC Method
Returns the token balance of an SPL Token account.
Parameters
string
required
Pubkey of Token account to query
- Base-58 encoded string
object
optional
Configuration object containing the following fields:
commitment string
optional
The level of commitment desired when querying state
Code Sample
Response
Result Details
The result is an RpcResponse JSON object with value
containing:
-
amount: <string>
- Raw token balance without decimals
- String representation of u64 integer
- Represents the full token amount without decimal adjustment
-
decimals: <u8>
- Number of decimal places for the token
- Determines how the raw amount should be displayed
-
uiAmount: <number|null>
DEPRECATED- Balance using mint-prescribed decimals
- Will be deprecated in future versions
-
uiAmountString: <string>
- Balance as a string
- Formatted using mint-prescribed decimal places
Important Notes
- Similar token balance structure as found in getBlock method
- Provides both raw and user-friendly token balance representations
- Decimals help in correct token amount interpretation