Skip to main content

qn_getWalletTokenBalance (v2) RPC Method

Returns ERC-20 tokens and token balances within a wallet.

Updated on
Nov 2, 2023

qn_getWalletTokenBalance (v2) RPC Method

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

Parameters

array
array
An array with the first element being:
object
The custom object with the following fields:
wallet
string
The wallet address or ENS name 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
blockNumber
integer
The block number you would like to get wallet balances from. If omitted, defaults to latest block
page
integer
The page number you would like returned. The page numbers start at 1 and end at totalPages. If omitted, defaults to the first page (page 1). If the page number requested is higher than totalPages, an empty transfers array will be returned. If the page number requested is less than 1, an invalid params response will be returned
perPage
integer
The maximum amount of tokens to return on each page. You can request up to 100 items per page. If omitted, defaults to 20 items per page

Returns

object
The custom response object, or null if no tokens are found:
address
string
The address we checked for ERC-20 tokens
ensName
string
The ENS name associated with the address we checked
result
An array of objects representing tokens with the following shape:
quantityIn
The total amount of tokens that have been transferred into the wallet
quantityOut
The total amount of tokens that have been transferred out of the wallet
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
nativeTokenBalance
The balance of the native token within the owner's wallet
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
Request
1
curl https://docs-demo.quiknode.pro/ \
2
-X POST \
3
-H "Content-Type: application/json" \
4
--data '{
5
"id":67,
6
"jsonrpc":"2.0",
7
"method":"qn_getWalletTokenBalance",
8
"params": [{
9
"wallet": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
10
}]
11
}'
12
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free