query_balance

This method allows you to query for the balance of a purse using a PurseIdentifier and StateIdentifier.

This method will use 10 Compute Units.


Reference: Here

Parameters

  1. purse_identifier [object] The identifier to obtain the purse corresponding to the balance query.

  2. state_identifier [object] The state identifier used for the query; if none is passed the tip of the chain will be used.

{
  "method": "query_balance",
  "params": [
    {
      "BlockHash": "057fbfd6678f41d1f9509f14a880082a0e8b27bc6a4aebd43816ac5daa9e9db7"
    },
    {
      "main_purse_under_account_hash": "account-hash-e1431ecb9f20f2a6e6571886b1e2f9dec49ebc6b2d3d640a53530abafba9bfa1"
    }
  ],
  "id": "b62b9eba-4116-4515-841a-b525ce9d934c",
  "jsonrpc": "2.0"
}

Returns

  • api_version - string RPC API version

  • balance - object The balance represented in motes.


{
  "jsonrpc": "2.0",
  "result": {
    "api_version": "1.5.3",
    "balance": "84260885931834771"
  },
  "id": "b62b9eba-4116-4515-841a-b525ce9d934c"
}
curl https://mainnet.casper.validationcloud.io/v1/<YOUR_API_KEY_HERE> \
    -X POST \
    -H "Content-Type: application/json" 
    -d '{"id":1,"jsonrpc":"2.0","method":"query_balance","params":[]}'

Last updated