Skip to content

Balances

See Balances and holders for how to use them.

HTTP: /balances.

Param Description
account Required
sources Required. Any of direct (the account’s own token balances), native (its NEAR) and rhea (its deposits in Rhea)
tokens Only these tokens’ balances
token_fields These token fields of each token held come along. Native NEAR’s are wrap.near’s

Result:

{
"height": 219969785,
"timestamp_millis": 1792003812629,
"balances": {
"columns": ["token", "source", "balance"],
"rows": [["wrap.near", "direct", "2564083907000000000000"], ["near", "native", "1000000000000000000000000"]]
},
"unknown": [],
"errors": {},
"tokens": { "columns": ["account_id", "symbol"], "rows": [["wrap.near", "wNEAR"]] }
}
  • Balances are in the token’s smallest units. Native NEAR is token near, in yoctoNEAR.
  • unknown: tokens held that this API doesn’t know, without their balances.
  • errors: { "<source>": { "code": "upstream_unavailable", "message": "..." } } for each source that couldn’t be read. The others are there all the same.
  • tokens: a table of the held tokens’ token_fields, only with token_fields.

The first time an account is asked for, its direct balances come from FastNEAR, and are then stored and re-checked against RPC in the background. After that they come from this project’s own indexed balances.

Takes the params of balances.get, and:

Param Description
token_min_change With token_fields: thresholds for them

The result is shaped like balances.get’s. It follows direct and native balances. Each push is:

{ "sub": 1, "height": 219969790, "timestamp_millis": 1792003815000, "balances": { "<token>": "<balance>" }, "set": { ... } }
  • balances: every balance the block changed, after a mint, transfer or burn, gas spent or refunded, or a re-check that corrected it.
  • set: as in tokens.subscribe, for the held tokens’ token_fields, with every field of a token held for the first time.

Rhea deposits aren’t followed, and the result says so with "not_live": ["rhea"]. A connection can follow up to 100 accounts. If the client falls behind, the subscription ends with too_far_behind: subscribe again.