eth_getAssetBalance

In addition to the standard Ethereum APIs, Avalanche offers eth_getAssetBalance to retrieve the balance of first class Avalanche Native Tokens on the C-Chain (native AVAX needs eth_getBalance)

Parameters:

address - string - The owner of the asset

blk - string - The block number or hash which to retrieve the balance.

assetID - string - The id of the asset for which the balance is requested.

Returned Value:

result - int - The balance of an asset.

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1388"
}
curl https://mainnet.avalanche.validationcloud.io/v1/<YOUR_API_KEY_HERE>/ext/bc/C/rpc \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
    "jsonrpc": "2.0",
    "method": "eth_getAssetBalance",
    "params": [
        "0x8723e5773847A4Eb5FeEDabD9320802c5c812F46",
        "latest",
        "3RvKBAmQnfYionFXMfW5P8TDZgZiogKbHjM8cjpu16LKAgF5T"
    ],
    "id": 1
}'

Last updated