Skip to main content

gettokensupply


description: >- Get the total supply for the given ERC20 token contract address (supports snapshotting at a specific block number)


getTokenSupply

The getTokenSupply method provides developers with the means to retrieve the total supply of a specific ERC20 token by specifying the contract address. Additionally, this method supports the functionality of snapshotting the total supply at a specific block number,

How to use getTokenSupply method ?

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

Parameters

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

ParameterTypeDescription
contractAddress *stringThe token contract address
blockNumberstringThe block height for which the supply is requested

Returns

Discover an insightful explanation of the returned parameters here, offering a deep understanding of their significance and implications.

ParameterTypeDescription
totalSupplystringThe total token supply for the specified contract

Example Request and Result for getTokenSupply

In this section, you can find an illustrative example of a request made to retrieve the total supply of a specific ERC20 token contract using the getTokenSupply method. The example showcases how to use this method to obtain the total token supply, providing valuable insights into the supply status of the token at a given block height

info

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 total supply for the given ERC20 token contract address

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

Query Parameters

NameTypeDescription
contractAddress*String0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
{
"totalSupply": "51193657555682415100323"
}

Request

curl -X GET https://starknet-mainnet.blastapi.io/<project_id>/builder/getTokenSupply?contractAddress=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 -H 'Content-Type: application/json'

Result

{
"totalSupply": "100207279129169697046687842654"
}