Skip to content

Latest commit

 

History

History
60 lines (49 loc) · 1.64 KB

getnep5balances.md

File metadata and controls

60 lines (49 loc) · 1.64 KB

getnep5balances

Return the balance of all NEP-5 assets in the specified address.

You must install the plugin RpcNep5Tracker and LevelDBStore before you can invoke the method.

{
  "jsonrpc": "2.0",
  "method": "getnep5balances",
  "params": [address],
  "id": 1
}

Parameter Description

  • address:The address that you want to query balance.

Example

Request Body:

{
  "jsonrpc": "2.0",
  "method": "getnep5balances",
  "params": ["1aada0032aba1ef6d1f07bbd8bec1d85f5380fb3"],
  "id": 1
}

Response Body:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "balance": [
            {
                "asset_hash": "a48b6e1291ba24211ad11bb90ae2a10bf1fcd5a8",
                "amount": "50000000000",
                "last_updated_block": 251604
            },
            {
                "asset_hash": "1aada0032aba1ef6d1f07bbd8bec1d85f5380fb3",
                "amount": "50000000000",
                "last_updated_block": 251600
            }
        ],
        "address": "AY6eqWjsUFCzsVELG7yG72XDukKvC34p2w"
    }
}

Note:

  • Only when your client synchronizes to the block that the contract was deployed, execution of this API will return the correct value, otherwise execution of the API will result in an error.
  • When the input parameter is a script hash of a non-NEP-5 smart contract, execution of the API will result in an error.
  • Make sure your client has been fully synchronized to the latest block height before using this API, otherwise the balance returned may not be up-to-date.