Skip to main content

getWalletTokenHistory

Retrieve a comprehensive record of all ERC20 tokens ever held by the provided wallet address, including zero-value balances. This functionality supports snapshotting at a specific block number, enabling you to access historical token data. Notably, the response is thoughtfully structured to present balances in a reverse chronological order, with the most recent transfer events displayed first, offering a clear historical perspective.Balances in the response are returned in reverse chronological order of the transfer event that updated them (most recent first).

How to use getWalletTokenHistory method ?

Below, you'll find an in-depth guide that provides a comprehensive explanation of how to utilize the getWalletTokenHistory method effectively using Blast Builder API.

Parameters

FieldTypeDescription
walletAddress *stringThe address of the wallet
blockNumberstringIndicate the block height
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

In this section, you will find a comprehensive list of parameters returned as part of the response. These parameters provide essential information about ERC20 token hostorical balances, transactions, and associated details, enabling you to effectively work with the data retrieved from the API.

info

Returns array of historical Token Balance objects.

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

  • blockNumber
  • transferIndex
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
historicalBalancesarrayThe array of Token Balance objects
contractAddressstringThe token contract address
contractDecimalsstringToken decimals specified in the contract
contractNamestringThe name of the token
contractSymbolsstringThe symbol of the token
balancestringToken balance on the specified wallet
firstTransferstringDetails of the transfer which updated the wallet balance for this token for the first time
fromAddressstringAddress from which the transfer originated
toAddressarrayDestination address for the transfer (multiple allowed)
valuestringToken amount
blockHashstringThe hash of the block
blockNumberintegerThe block height
blockTimestampstringThe timestamp of the block
transactionHashstringThe hash of the transaction
transactionIndexintegerThe index of the transaction
logIndexintegerThe index of the log
lastTransferstringDetails of the latest transfer which updated the wallet balance for this token

Example Request and Result for getWalletTokenHistory

In this section, we provide an illustrative example of a request made using the 'getWalletTokenHistory' API method, along with a detailed breakdown of the resulting data. This example serves as a practical reference to demonstrate how to retrieve token history information, helping you understand and utilize the API effectively.

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://starknet-mainnet.blastapi.io/<project-id>/builder/getWalletTokenHistory?walletAddress=0x069e5becf53bed3a73c3ebaaeb3deee49fd9fc1da31f9be3b3e34d761cd630ee'