Marketplace has launched, further enabling blockchain developers! Learn more

Contents

eth_get_asset_balance RPC method

The eth_get_asset_balance EVM method is only supported on the Avalanche C-Chain.

Parameters:

  1. address - String - The owner of the asset
  2. blk - String - The block number or hash which to retrieve the balance.
  3. assetID - String - The id of the asset for which the balance is requested.

Returns:

  1. Result - Int - The balance of an asset.

Code Examples:

To use the eth_get_asset_balance EVM method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.

const ethers = require("ethers");

(async () => {
  const provider = new ethers.providers.JsonRpcProvider(
    "http://sample-endpoint-name.network.quiknode.pro/token-goes-here/ext/bc/C/rpc"
  );
  const params = [
    "0x8723e5773847A4Eb5FeEDabD9320802c5c812F46",
    "latest",
    "3RvKBAmQnfYionFXMfW5P8TDZgZiogKbHjM8cjpu16LKAgF5T",
  ];
  const result = await provider.send("eth_getAssetBalance", params);
  console.log(result);
})();
Ready to get started? Create a free account