getTokenAccountBalance RPC Method
Returns the token balance of an SPL Token account.
params
string
required
Pubkey of Token account to query, as base-58 encoded stringobject
optional
Configuration object containing the following fields:
commitment
The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.
result
object
The result will be a JSON object containing:
amount
The raw balance without decimals, a string representation of u64
decimals
Number of base 10 digits to the right of the decimal place
uiAmount
The balance, using mint-prescribed decimals DEPRECATED
uiAmountString
The balance as a string, using mint-prescribed decimals
cURL
curl https://us-seattle.openverse.network/api -s -X \
POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenAccountBalance",
"params": [
"7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7"
]
}
'
Response
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 1114 },
"value": {
"amount": "9864",
"decimals": 2,
"uiAmount": 98.64,
"uiAmountString": "98.64"
}
},
"id": 1
}