getTokenAccountBalance RPC Method
Returns the token balance of an SPL Token account.Parameters
string requiredPubkey of Token account to query
- Base-58 encoded string
object optionalConfiguration object containing the following fields:commitment
string optionalThe level of commitment desired when querying state
Result Details
The result is an RpcResponse JSON object withvalue 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