On this page

latest contributor to this doc

Last Edit:

@smk762

Task: Account Balance

If you have enabled a coin with task managed activation and are using HD Mode, your funds may be spread across a range of addresses under a specified account index. The methods below will return the combined balance of your account, detailing the balance for each active account address.

API-v2task::account_balance::init

Use the task::account_balance::init method to initialise an account balance request.

ParameterTypeDescription
coinstringTicker of activated coin you want to see addresses and balance for
account_indexstringFor GUIs, this will be zero. In CLI you can use other values if you know what you are doing

ParameterTypeDescription
task_idintegerAn identifying number which is used to query task status.

task::account_balance::init

POST
task::account_balance::init
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::account_balance::init",
  "params": {
    "coin": "COIN_NAME",
    "account_index": 0
  }
}

{
  "mmrpc": "2.0",
  "result": {
    "task_id": 6
  },
  "id": null
}
API-v2task::account_balance::status

Use the task::account_balance::status method to view the status / response of an account balance request.

ParameterTypeDescription
task_idintegerThe identifying number returned when initiating the task.
forget_if_finishedbooleanIf false, will return final response for completed tasks. Optional, defaults to true.

ParameterTypeDescription
current_blockintegerBlock height of the coin being activated
tickerstringTicker of the coin being activated.
wallet_balanceobjectA standard WalletBalanceInfo object. Note: the structure may vary based on the get_balances parameter value in the activation request.

task::account_balance::status

POST
task::account_balance::status
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::account_balance::status",
  "params": {
    "task_id": 3,
    "forget_if_finished": false
  }
}

{
  "mmrpc": "2.0",
  "result": {
    "status": "Ok",
    "details": {
      "account_index": 0,
      "derivation_path": "m/44'/20'/0'",
      "total_balance": {
        "KMD": {
          "spendable": "99.999",
          "unspendable": "0"
        }
      },
      "addresses": [
        {
          "address": "DJdsr4Mhqm1afkbxwBJfwH6236xNh5kJZU",
          "derivation_path": "m/44'/20'/0'/0/0",
          "chain": "External",
          "balance": {
            "KMD": {
              "spendable": "49.999",
              "unspendable": "0"
            }
          }
        },
        {
          "address": "DJdsr4Mhqm1afkbxwBJfwH6236xNh5kJZU",
          "derivation_path": "m/44'/20'/0'/0/1",
          "chain": "External",
          "balance": {
            "KMD": {
              "spendable": "50",
              "unspendable": "0"
            }
          }
        },
        {
          "address": "DJdsr4Mhqm1afkbxwBJfwH6236xNh5kJZU",
          "derivation_path": "m/44'/20'/0'/0/2",
          "chain": "External",
          "balance": {
            "KMD": {
              "spendable": "0",
              "unspendable": "0"
            }
          }
        }
      ]
    }
  },
  "id": null
}
API-v2task::account_balance::cancel

Use the task::account_balance::cancel method to cancel an account balance request.

ParameterTypeDescription
task_idintegerThe identifying number returned when initiating the task.

ParameterTypeDescription
resultstringReturns with value success when successful, otherwise returns the error values below
errorstringDescription of the error
error_pathstringUsed for debugging. A reference to the function in code base which returned the error
error_tracestringUsed for debugging. A trace of lines of code which led to the returned error
error_typestringAn enumerated error identifier to indicate the category of error
error_datastringAdditonal context for the error type

task::account_balance::cancel

POST
task::account_balance::cancel
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "task::account_balance::cancel",
  "params": {
    "task_id": 3,
    "forget_if_finished": false
  }
}

{
  "mmrpc": "2.0",
  "result": "success",
  "id": null
}

{
  "mmrpc": "2.0",
  "error": "Task is finished already",
  "error_path": "init_account_balance.manager",
  "error_trace": "init_account_balance:113] manager:104]",
  "error_type": "TaskFinished",
  "error_data": 2,
  "id": null
}