totalSupply
of a specific token (e.g., USDT token on Ethereum - 0xdac17f958d2ee523a2206206994597c13d831ec7) over a million blocks.
subgraph.yaml
. This file defines the data sources and how your subgraph interacts with the blockchain. For tracking an ERC20 token’s totalSupply
, your manifest file would be structured as follows:
schema.graphql
) for the total supply might look like this:
mapping.ts
) contains the logic for processing blockchain events. Here’s an example of how you might handle Transfer
events to update the total supply:
<ACCESS_TOKEN>
with your access token from Chainstack Subgraphs hosting. Also before this action you need to add a subgraph via the platform UI.
totalSupply
of a token over a range of blocks, you’ll utilize the Graph QL API provided by The Graph Protocol. This section will guide you through the process of querying your subgraph to retrieve totalSupply
data across a specified block range.
totalSupply
along with the blockNumber
for a range of blocks. The basic structure of such a query would be: