Language

Choose a language

/build/rpc / assets / registry

getassetbalance

  • workflowissue-an-asset·step 5 of 5Workflow: issue-an-asset · step 5 of 5

getassetbalance ( ["asset_identifier",...] ) Return aggregated wallet balances for assets. Arguments: 1. assets (json array, optional, default=[]) Restrict to the provided assets (asset_id or ticker) [ "asset_identifier", (string) Asset ID (hex) or ticker ... ] Result: [ (json array) { (json object) "asset_id" : "hex", (string) Asset identifier "ticker" : "str", (string, optional) Ticker if known "decimals" : n, (numeric, optional) Display decimals if known "balance" : n, (numeric) Confirmed, unlocked units "balance_decimal" : "str", (string, optional) Formatted balance "pending" : n, (numeric) Units in unconfirmed transactions "locked" : n, (numeric) Units currently locked "utxo_count" : n (numeric) Number of spendable UTXOs }, ... ] Examples: > bitcoin-cli getassetbalance > bitcoin-cli getassetbalance '["GOLD","USD"]'

Signature

getassetbalance(assets?: array) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"getassetbalance","params":["[]"]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
assetsany[]Restrict to the provided assets (asset_id or ticker) [ "asset_identifier", (string) Asset ID (hex) or ticker ... ]

Result

Type:  any

[ (json array) { (json object) "asset_id" : "hex", (string) Asset identifier "ticker" : "str", (string, optional) Ticker if known "decimals" : n, (numeric, optional) Display decimals if known "balance" : n, (numeric) Confirmed, unlocked units "balance_decimal" : "str", (string, optional) Formatted balance "pending" : n, (numeric) Units in unconfirmed transactions "locked" : n, (numeric) Units currently locked "utxo_count" : n (numeric) Number of spendable UTXOs }, ... ]

Source: services/core-node/bcore/src/wallet/rpc/assets.cpp:1369

C++ symbol: getassetbalance