Build more with QuickNode - New pricing plans and a free tier! Read the press release
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.
Supports ERC-20 compliant contracts (on Ethereum mainnet).
Headers:
x-qn-api-version
— (Integer - optional) Provide an optional request header specifying the QuickNode API version you're targeting. Using this header is recommended as it will become mandatory (required) in the future. Current API version is 1
.
Parameters:
wallet — (String) The wallet address to check for ERC-20 tokens.
contracts — (Array of Strings - optional) List of ERC-20 contract addresses to filter wallet balance results on. You may include up to 100 contract addresses per request.
Returns:
owner — The wallet address we checked for tokens.
assets — An array of objects representing tokens with the following shape:
address — The address of the ERC-20 token contract.
amount — The balance of the token within the owner's wallet.
chain — The chain where the contract was deployed.
decimals — The number of decimal places supported by the token contract.
name — The name of the token.
network — The network where the contract was deployed.
symbol — The symbol of the token.
Code Examples:
const ethers = require("ethers"); (async () => { const provider = new ethers.providers.JsonRpcProvider("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/"); provider.connection.headers = { "x-qn-api-version": 1 }; const heads = await provider.send("qn_getWalletTokenBalance", { wallet: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045", }); console.log(heads); })();
# The eth.rb library does not support including additional request headers, so you won't be able to add the x-qn-api-version header. require 'eth' client = Eth::Client.create 'http://sample-endpoint-name.network.quiknode.pro/token-goes-here/' payload = { "id":67, "jsonrpc":"2.0", "method":"qn_getWalletTokenBalance", "params":{ "wallet": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" } } response = client.send(payload.to_json) puts response
curl http://sample-endpoint-name.network.quiknode.pro/token-goes-here/ \ -X POST \ -H "Content-Type: application/json" \ -H "x-qn-api-version: 1" \ --data '{ "id":67, "jsonrpc":"2.0", "method":"qn_getWalletTokenBalance", "params":{ "wallet": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" } }'
from web3 import Web3, HTTPProvider OPTIONS = { 'headers': { 'x-qn-api-version': '1' } } w3 = Web3(HTTPProvider('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/', request_kwargs=OPTIONS)) resp = w3.provider.make_request('qn_getWalletTokenBalance', { "wallet": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" }) print(resp)