Query Wallets Balance

Query balance of all wallets can be accessed by the inquiry read-only API code.

Request

VIEW

 GET /v1/sofa/wallets/readonly/walletlist/balances?type=type&start_index=start_index&request_number=request_number

Query Parameters

Field Type Note Description
type int optional, default -1 Specify the wallet type want to query. Supports Vault, Deposit and Withdrawal wallet type. Refer to Wallet Type Definition
start_index int optional, default 0 Specify start index
request_number int optional, default 50, max 100 Request count

Response Body

Field Type Description
wallet_id int64 Wallet ID
wallet_name string Wallet Name
address string Wallet address
currency int64 Registered coin types. Refer to Currency Definition
currency_name string Name of currency
decimals string Decimals of currency
type int Wallet Type. Refer to Wallet Type Definition
token_name string Token name
token_symbol string Token symbol
token_contract_address string Token contract address
token_decimals string Token decimals
error boolean Set to true if the balance query fails
balance string Wallet balance. For token wallet this is the mapped wallet’s balance.
unconfirm_balance string Unconfirmed wallet balance. For token wallet this is the mapped wallet’s unconfirmed balance.
unconfirm_token_balance string Unconfirmed wallet token balance
pool_balance string Wallet pool address balance
pool_unconfirm_token_balance string Wallet Pool address unconfirmed balance
token_id_balances array For ERC1155, ERC721 token wallet

Error Code

HTTP Code Error Code Error Message Description
403 - Forbidden. Invalid wallet ID - No wallet ID found
403 - Forbidden. Header not found - Missing X-API-CODE, X-CHECKSUM header or query param t
403 - Forbidden. Invalid timestamp - The timestamp t is not in the valid time range
403 - Forbidden. Invalid checksum - The request is considered a replay request
403 - Forbidden. Invalid API code - X-API-CODE header contains invalid API code
403 - Invalid API code for wallet {WALLET_ID} - The API code mismatched
403 - Forbidden. Checksum unmatch - X-CHECKSUM header contains wrong checksum
403 - Forbidden. Call too frequently ({THROTTLING_COUNT} calls/minute) - Send requests too frequently
403 385 API Secret not valid - Invalid API code permission

Sample Request

API

/v1/sofa/wallets/readonly/walletlist

Post Body

{
  "total": 2,
  "wallets": [
    {
      "address": "2NAnSkEp6SpUPLsdP3ChvN6K5qPMZyoB3RF",
      "currency": 0,
      "currency_name": "BTC",
      "decimals": "8",
      "type": 2,
      "wallet_id": 101645
    },
    {
      "address": "0x85AfD8F88C0347aFF89AFc6C0749322719396616",
      "currency": 60,
      "currency_name": "ETH",
      "decimals": "18",
      "token_contract_address": "0xdf2ce4af00b10644d00316b3d99e029d82d5d2f3",
      "token_decimals": "18",
      "token_name": "JGB2",
      "token_symbol": "JGB2",
      "type": 0,
      "wallet_id": 118970
    }
  ]
}

Sample cURL Command

curl http://localhost:8889/v1/mock/wallets/readonly/walletlist