Skip to main content

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

FieldTypeDescription
walletAddress *stringThe address of the wallet
contractAddressarray[string]The address of the contract (multiple allowed)
pageSizeintegerNumber of records to be retrieved on one page
pageKeystringKey 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.

info

Returns array of Token Balance objects.

This API is paginated, response items are ordered descending by:

  • blockNumber
  • transferIndex (transactionIndex, eventIndex)
FieldTypeDescription
walletAddressstringThe address of the wallet
countintegerThe number of allowances
nextPageKeystringKey used to get the next page of results. Must be set to the value of nextPageKey returned in the previous response
allowancesarrayThe array of Allowance objects
contractAddressstringThe token contract address
contractDecimalsstringToken decimals specified in the contract
contractNamestringThe name of the token
contractSymbolsstringThe symbol of the token
spenderAddressstringThe address of the spender
allowancestringThe amount allowed for spending
walletBalancestringThe balance of tokens in the wallet creating the allowance
blockHashstringThe hash of the block
blockTimestampstringThe timestamp of the block
transactionHashstringThe hash of the transaction
transactionIndexintegerThe number of the transaction
logIndexintegerThe 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.

info

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'