Join AWS, Dust Labs & OrangeDAO at QuickPitch. Win $80k — Apply Today.
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.
Parameters:
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:
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
logoURl - The URL address of the token
chain - The chain where the contract was deployed
network - The network where the contract was deployed
amount - 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:
var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); myHeaders.append("x-qn-api-version", "1"); var raw = JSON.stringify({ "id": 67, "jsonrpc": "2.0", "method": "qn_getWalletTokenBalance", "params": { "wallet": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" } }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
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)
import requests import json url = "http://sample-endpoint-name.network.quiknode.pro/token-goes-here/" payload = json.dumps({ "id": 67, "jsonrpc": "2.0", "method": "qn_getWalletTokenBalance", "params": { "wallet": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" } }) headers = { 'Content-Type': 'application/json', 'x-qn-api-version': '1' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
# 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
require "uri" require "json" require "net/http" url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request["x-qn-api-version"] = "1" request.body = JSON.dump({ "id": 67, "jsonrpc": "2.0", "method": "qn_getWalletTokenBalance", "params": { "wallet": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" } }) response = https.request(request) puts response.read_body
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); })();