Links

getTokenApprovals

Get ERC20 approvals for a given token contract address
The "getTokenApprovals" method provides developers with a powerful tool to retrieve and access all approvals for a specified ERC20 token contract address. These approvals are presented in reverse chronological order, with the most recent approvals appearing first in the response. This documentation section offers comprehensive insights into the usage of the "getTokenApprovals" method, enabling developers to efficiently access and analyze approval events associated with the token contract.

How to use getTokenApprovals method ?

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

Parameters

Below, you can find the query parameters accepted by the method.
Field
Type
Description
contractAddress *
string
The token contract address
fromBlock
string
The block number from which the approvals will be returned
toBlock
string
The block number up to which the approvals will be returned
ownerAddress
string
The address of the approver
spenderAddress
string
The address of the spender
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.
Field
Type
Description
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
count
integer
The number of token approvals
nextPageKey
string
Key to get the next page of results, if more results are available
tokenApprovals
array
The array containing all token approvals
ownerAddress
string
The wallet address of the approver
spenderAddress
string
The address of the spender
value
string
The amount of tokens approved
blockHash
string
The hash of the block in which the transfer transaction was executed
blockNumber
integer
The height of the block in which the transfer transaction was executed
blockTimestamp
string
The timestamp of the block in which the transfer transaction was executed
transactionHash
string
The hash of the token transfer transaction
transactionIndex
integer
The number of the token transfer transaction
logIndex
integer
The index of the transaction log

Example Request and Result for getTokenApprovals

In this section, you'll find an illustrative example of a request made to retrieve token approvals using the getTokenApprovals method. This example showcases how to specify the required parameters and provides insights into the expected result structure. The example request demonstrates how to configure the parameters, including the contract address, owner address, and spender address, to narrow down the approvals you want to retrieve.Developers can refer to this section to understand how to use the method effectively and interpret the returned data.
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://starknet-mainnet.blastapi.io/<project_id>/builder/getTokenApprovals
Returns the ERC20 approvals for a given token contract address
Parameters
Query
contractAddress*
0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
fromBlock
515018
ownerAddress
0x0373aa6e162d47f9f0c6304d4580a0fed41552283dbf9936f3606581a5a84f69
Responses
200: OK
Expand for the detailed view
curl --location 'https://starknet-mainnet.blastapi.io/<project_id>/builder/getTokenApprovals?fromBlock=515018&contractAddress=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7&ownerAddress=0x0373aa6e162d47f9f0c6304d4580a0fed41552283dbf9936f3606581a5a84f69'
​
Last modified 1mo ago