getWalletTokenBalances

Get current ERC20 token balances for a given wallet address (zero-value balances not included)

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 *

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)

FieldTypeDescription

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!

GET https://eth-mainnet.blastapi.io/<project-id>/builder/getWalletTokenAllowances?

Query Parameters

NameTypeDescription

walletAddress*

String

0x069e5becf53bed3a73c3ebaaeb3deee49fd9fc1da31f9be3b3e34d761cd630ee

{
    "walletAddress": "0x069e5becf53bed3a73c3ebaaeb3deee49fd9fc1da31f9be3b3e34d761cd630ee",
    "count": 10,
    "tokenBalances": [
        {
            "contractAddress": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
            "contractDecimals": "18",
            "contractName": "Ether",
            "contractSymbol": "ETH",
            "balance": "22278595196979973"
        },
        {
            "contractAddress": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
            "contractDecimals": "6",
            "contractName": "USD Coin",
            "contractSymbol": "USDC",
            "balance": "1000000"
        },
        {
            "contractAddress": "0x055c3868c743e92c470701799388cb3fb1d922dcec271150d10462c6948e3cf4",
            "contractDecimals": "18",
            "contractName": "STRAK",
            "contractSymbol": "STRAK",
            "balance": "173906988421224650540976"
        },
        {
            "contractAddress": "0x04ee423b1f89f1ac011d6f2f05c1eb35d61594b801122771cce7747718aa416f",
            "contractDecimals": "18",
            "contractName": "BabyCario",
            "contractSymbol": "cro",
            "balance": "55702109907292317779934"
        },
        {
            "contractAddress": "0x0049288ea7d42c4411621e2ef9fdab182f66003b2f2e46845e2d7b75dbd8e6d8",
            "contractDecimals": "18",
            "contractName": "erbi",
            "contractSymbol": "erb ",
            "balance": "100000000000000000010"
        },
        {
            "contractAddress": "0x062fa7afe1ca2992f8d8015385a279f49fad36299754fb1e9866f4f052289376",
            "contractDecimals": "18",
            "contractName": "zkLend Interest-Bearing DAI",
            "contractSymbol": "zDAI",
            "balance": "200297837934995289"
        },
        {
            "contractAddress": "0x041a708cf109737a50baa6cbeb9adf0bf8d97112dc6cc80c7a458cbad35328b0",
            "contractDecimals": "18",
            "contractName": "10kSwap Pair Token",
            "contractSymbol": "LPT",
            "balance": "467930"
        },
        {
            "contractAddress": "0x04d0390b777b424e43839cd1e744799f3de6c176c7e32c1812a41dbd9c19db6a",
            "contractDecimals": "18",
            "contractName": "JediSwap Pair",
            "contractSymbol": "JEDI-P",
            "balance": "8665600008"
        },
        {
            "contractAddress": "0x06a05844a03bb9e744479e3298f54705a35966ab04140d3d8dd797c1f6dc49d0",
            "contractDecimals": "0",
            "contractName": "Game of Life Token",
            "contractSymbol": "GOL",
            "balance": "1"
        },
        {
            "contractAddress": "0x000023c72abdf49dffc85ae3ede714f2168ad384cc67d08524732acea90df325",
            "contractDecimals": "18",
            "contractName": "10kSwap Pair Token",
            "contractSymbol": "LPT",
            "balance": "8400331028"
        }
    ]
}

Curl request example

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

Last updated