Links

getWalletTokenHistory

Get all ERC20 tokens (with balances, including zero-value balances) the given wallet address has ever held (supports snapshotting at a specific block number)
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

Field
Type
Description
walletAddress *
string
The address of the wallet
blockNumber
string
Indicate the block height
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

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.
Returns array of historical Token Balance objects.
This API is paginated, response items are ordered descending by:
  • blockNumber
  • transferIndex
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
historicalBalances
array
The array of Token Balance 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
balance
string
Token balance on the specified wallet
firstTransfer
string
Details of the transfer which updated the wallet balance for this token for the first time
fromAddress
string
Address from which the transfer originated
toAddress
array
Destination address for the transfer (multiple allowed)
value
string
Token amount
blockHash
string
The hash of the block
blockNumber
integer
The block height
blockTimestamp
string
The timestamp of the block
transactionHash
string
The hash of the transaction
transactionIndex
integer
The index of the transaction
logIndex
integer
The index of the log
lastTransfer
string
Details 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.
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!
get
https://eth-mainnet.blastapi.io/<project-id>/builder/getWalletTokenHistory?
Parameters
Query
walletAddress*
0x069e5becf53bed3a73c3ebaaeb3deee49fd9fc1da31f9be3b3e34d761cd630ee
Responses
200: OK
Expand for a detailed response example

Curl request example

curl --location 'https://starknet-mainnet.blastapi.io/<project-id>/builder/getWalletTokenHistory?walletAddress=0x069e5becf53bed3a73c3ebaaeb3deee49fd9fc1da31f9be3b3e34d761cd630ee'