getWalletTokenAllowances
Efficiently access a comprehensive list of spenders and the corresponding allowances granted by a specified wallet address, including all token contracts or a specific one if desired. Notably, the response is structured to present allowances in a reverse chronological order, with the most recent approvals at the forefront, allowing for efficient tracking and management. This API is paginated, response items are ordered descending by blockNumber and approvalIndex.
How to use getWalletTokenAllowances method ?
Below, you'll find an in-depth guide that provides a comprehensive explanation of how to utilize the getWalletTokenAllowances method effectively using Blast.
Parameters
Field | Type | Description |
---|---|---|
walletAddress * | string | The address of the wallet |
contractAddress | string | The address of the spender |
pageSize | number | 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 |
---|---|---|
walletAddress | string | The address of the wallet |
count | number | 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 name of the token |
spenderAddress | string | The address of the spender |
allowance | string | The amount allowed for spending |
walletBalance | string | The balance of tokens for 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 list of spenders and allowances granted by the given wallet address across all token contracts or a specific one using the getWalletTokenAllowances Builder API method. Developers can use this as a reference for crafting their own requests and parsing the returned data when working with the getWalletTokenAllowances 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!
Curl request example
curl --location 'https://starknet-mainnet.blastapi.io/<project-id>/builder/getWalletTokenAllowances?walletAddress=0x03beccdb0e0e6a622923f4294ef3d4be58afa1e86ee7d65ba87013395df00846'