Links

erc20_totalSupply

Get total supply information for erc20 contracts.
Through erc20_totalSupply, you can fetch all the total supply in specified erc20 contract, contractAddress is necessary. If you specify the contract address and block number, the API will return the total supply of the token at the block number you enter.
Supported on Ethereum, Optimism, and Arbitrum.

Parameters

Object - An object with the following fields (required):
  • contractAddress(hex string, required) - the contract address for ERC20 token.
  • blockNumber(integer number, optional) - the blockNumber for snapshot query (default latest). BlockVision can not only support users to query the current information, but also support users to query the historical information at any time.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • totalSupply(string) - total Supply information of the erc20 contract. The data returned by BlockVision is the original data of the contract. Divide it by the decimal of the contract to get the "real" data.

Example

Request

curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "erc20_totalSupply",
"params": {
"contractAddress": "0x8C6bf16C273636523C29Db7DB04396143770F6A0",
"blockNumber": 0
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ETH_MAINNET)
// Access the BlockVision FT API
bv.getERC20TotalSupply({
contractAddress: '0x8C6bf16C273636523C29Db7DB04396143770F6A0'
}).then(console.log)

Result

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"totalSupply": "10795329961214869504"
}
}