getTokenAllowance

Get the amount of ERC20 tokens which the spender is allowed to withdraw from the owner

Efficiently retrieve the allowance of ERC20 tokens that a spender is permitted to withdraw from an owner's wallet using the "getTokenAllowance" method. This method empowers developers to access detailed information about token allowances, helping them better understand and manage token-related transactions and authorizations.

How to use getTokenAllowance method ?

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

Parameters

Below, you can find the query parameters accepted by the method.

ParameterTypeDescription

contractAddress *

string

The token contract address

ownerAddress *

string

The address of the token owner

spenderAddress *

string

The address of the token spender

Returns

ParameterTypeDescription

allowance

string

The allowance amount

Example Request and Result for getTokenAllowance

In this section, you can find an illustrative example of a request made to retrieve the allowance amount using the getTokenAllowance method. The example demonstrates how to fetch the ERC20 token allowance, providing insight into the allowed withdrawal amount between an owner and a spender. The response showcases the result structure, allowing developers to understand how to parse and utilize the returned data efficiently

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!

Returns the amount of ERC20 tokens the spender is allowed to withdraw from the owner

GET https://starknet-mainnet.blastapi.io/<project_id>/builder/getTokenApprovals

Query Parameters

NameTypeDescription

contractAddress*

String

0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7

ownerAddress*

String

0x0373aa6e162d47f9f0c6304d4580a0fed41552283dbf9936f3606581a5a84f69

spenderAddress*

String

0x057146f6409deb4c9fa12866915dd952aa07c1eb2752e451d7f3b042086bdeb8

{
"allowance":"1000000000"
}
curl -X GET https://starknet-mainnet.blastapi.io/<project_id>/builder/getTokenAllowance?contractAddress=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7&ownerAddress=0x0373aa6e162d47f9f0c6304d4580a0fed41552283dbf9936f3606581a5a84f69&spenderAddress=0x057146f6409deb4c9fa12866915dd952aa07c1eb2752e451d7f3b042086bdeb8 -H 'Content-Type: application/json'

Last updated