We're now supporting Polygon zkEVM!
Learn more here.

Contents

qn_getWalletTokenBalance (v2) RPC Method

The API credit value for this method is 4 . To learn more about API credits and each method's value, visit the API Credits page.

Please note that this RPC method requires the Token and NFT API v2 bundle add-on enabled on your QuickNode endpoint.

Parameters:

  1. array - An array with the first element being:

    object - A custom object with the following fields:

    wallet - string - The wallet address to check for ERC-20 tokens.

    contracts - string - An array with the list of ERC-20 contract addresses to filter wallet balance results on. You may include up to 100 contract addresses per request

Returns:

  1. object - The custom response object, or null if no tokens are found:

    assets - An array of objects representing tokens with the following shape:

    address - The address of the ERC-20 token contract

    name - The name of the token

    decimals - The number of decimal places supported by the token contract

    symbol - The symbol of the token

    totalBalance - The balance of the token within the owner's wallet

    owner - The wallet address we checked for tokens

    totalPages - The total number of results pages available

    pageNumber - The page number of results that was returned with this response

    totalItems - The total number of results

Code Examples:

const ethers = require("ethers");
(async () => {
  const provider = new ethers.providers.JsonRpcProvider("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/");
  const heads = await provider.send("qn_getWalletTokenBalance", [
    {
      wallet: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    },
  ]);
  console.log(heads);
})();
Ready to get started? Create a free account