getWalletTokenBalances
Efficiently access current ERC20 token balances for a designated wallet address while excluding zero-value balances from the results. Notably, the response presents balances in reverse chronological order, with the most recent transfer events appearing first, providing you with valuable insights into the wallet's token holdings.
How to use getWalletTokenBalances method ?
Below, you'll find an in-depth guide that provides a comprehensive explanation of how to utilize the getWalletTokenBalances method effectively using Blast Builder API.
Parameters
Field | Type | Description |
---|---|---|
walletAddress * | string | The address of the wallet |
contractAddress | array[string] | The address of the contract (multiple allowed) |
pageSize | integer | Number of records to be retrieved on one page |
pageKey | string | Key used to get the next page of results. Must be set to the value of nextPageKey returned in the previous response |
Returns
Discover an insightful explanation of the returned parameters here, offering a deep understanding of their significance and implications.
Returns array of Token Balance objects.
This API is paginated, response items are ordered descending by:
- blockNumber
- transferIndex (transactionIndex, eventIndex)
Field | Type | Description |
---|---|---|
walletAddress | string | The address of the wallet |
count | integer | The number of allowances |
nextPageKey | string | Key used to get the next page of results. Must be set to the value of nextPageKey returned in the previous response |
allowances | array | The array of Allowance objects |
contractAddress | string | The token contract address |
contractDecimals | string | Token decimals specified in the contract |
contractName | string | The name of the token |
contractSymbols | string | The symbol of the token |
spenderAddress | string | The address of the spender |
allowance | string | The amount allowed for spending |
walletBalance | string | The balance of tokens in the wallet creating the allowance |
blockHash | string | The hash of the block |
blockTimestamp | string | The timestamp of the block |
transactionHash | string | The hash of the transaction |
transactionIndex | integer | The number of the transaction |
logIndex | integer | The index of the log |
Example Request and Result for getWalletTokenAllowances
In this section, we not only provide an illustrative example of a request but also offer a detailed breakdown of the response. This example demonstrates how to retrieve the current ERC20 token balances for a designated wallet address using the getWalletTokenBalances Builder API method. Developers can use this as a reference for crafting their own requests and parsing the returned data when working with the getWalletTokenBalances method.
The example in this section uses a non-existing project id.
Make sure you replace it with your Starknet endpoint when issuing the Builder API calls.
Don't have a project id? Here's a straightforward guide on how to obtain one!
Curl request example
curl --location 'https://eth-mainnet.blastapi.io/<project-id>/builder/getWalletTokenAllowances?walletAddress=0x069e5becf53bed3a73c3ebaaeb3deee49fd9fc1da31f9be3b3e34d761cd630ee'