watch_getTokenBalances
Returns token balances for a specific address given a list of contracts.
This method returns hex encoded values in the
tokenBalance
fields.- 1.
DATA
, 20 Bytes - The address for which token balances will be checked - 2.One of:
- 1.
Array
- A list of contract addresses - 2.The
String
"DEFAULT_TOKENS" - denotes a query for the top 100 tokens by 24 hour volume
Object
- An object with the following fields:address
:DATA
, 20 Bytes - The address for which token balances were checkedtoken_balances
:Array
- returns an array of token balance objects. Each object contains:contractAddress
tokenBalance
error
- One of
tokenBalance
orerror
will be null.
Request example
Curl
Postman
curl https://ethereum.api.watchdata.io/node/jsonrpc?api_key=your_api_key
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"watch_getTokenBalances","params": ["0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be", ["0x607f4c5bb672230e8672085532f7e901544a7375", "0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6", "0x63b992e6246d88f07fc35a056d2c365e6d441a3d", "0x6467882316dc6e206feef05fba6deaa69277f155", "0x647f274b3a7248d6cf51b35f08e7e7fd6edfb271"]],"id":"42"}'
URL: https://ethereum.api.watchdata.io/node/jsonrpc?api_key=your_api_key
RequestType: POST
Body:
{
"jsonrpc":"2.0",
"method":"watch_getTokenBalances",
"params":["0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be", ["0x607f4c5bb672230e8672085532f7e901544a7375", "0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6", "0x63b992e6246d88f07fc35a056d2c365e6d441a3d", "0x6467882316dc6e206feef05fba6deaa69277f155", "0x647f274b3a7248d6cf51b35f08e7e7fd6edfb271"]],
"id":42
}
Result
{
"jsonrpc": "2.0",
"id": 42,
"result": {
"address": "0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be",
"token_balances": [
{
"contractAddress": "0x607f4c5bb672230e8672085532f7e901544a7375",
"tokenBalance": "0x00000000000000000000000000000000000000000000000000003c005f81ab00",
"error": null
}
]
}
}
Last modified 1yr ago