This API method helps you to get the BEP20 tokens and the amount held by an account.
Supported on BSC and ETH mainnet only.
Parameters
Account Address
- the address of the accountPage
- the page number in hex formatPageSize
- pageSize is hex encoded and should be less equal than 100 (each page return at most pageSize items)
Returns
tokenAddress
- the address of the tokentokenName
- the name of the tokentokenSymbol
- the symbol of the tokentokenDecimails
- the decimals of the tokentokenBalance
- the balance of the token
API Endpoint
The format of a MegaNode API endpoint is https://{chain}-{network}.nodereal.io/v1/{API-key}
Here is an example:
https://bsc-mainnet.nodereal.io/v1/4c0a1c23661a4e26bcbcwed461e34ea9
For other chains or networks, you could refer to this guidance Find API key & endpoint.
Example
Request
curl https://bsc-mainnet.nodereal.io/v1/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"nr_getTokenHoldings","params":["0x0E34aD56379aceC7F09d815729B70c85adC1Ec99", "0x1","0x12"],"id": 1 }'
Result
{
"id": "1",
"jsonrpc": "2.0",
"result": {
"totalCount": "0x34",
"details": [
{
"tokenAddress": "0xfcb5DF42e06A39E233dc707bb3a80311eFD11576",
"tokenName": "www.METH.co.in",
"tokenSymbol": "METH",
"tokenDecimails": "0x12",
"tokenBalance": "0x0000000000000000000000000000000000000000f"
}
]
}
}