Metodo RPC getTokenAccountBalance

Restituisce il saldo token di un account SPL Token.

$ curl https://api.devnet.solana.com -s -X \
> POST -H "Content-Type: application/json" -d '
> {
> "jsonrpc": "2.0",
> "id": 1,
> "method": "getTokenAccountBalance",
> "params": [
> "7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7",
> {
> "commitment": "finalized"
> }
> ]
> }
> '

params

stringrequired

Pubkey dell'account Token da interrogare, come stringa codificata in base-58

objectoptional

Oggetto di configurazione contenente i seguenti campi:

result

Response
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 1114 },
"value": {
"amount": "9864",
"decimals": 2,
"uiAmount": 98.64,
"uiAmountString": "98.64"
}
},
"id": 1
}
object

Il risultato sarà un oggetto JSON contenente:

Per maggiori dettagli sui dati restituiti, la risposta Token Balances Structure da getBlock segue una struttura simile.

Is this page helpful?