📝Usage Examples

In this section, we will provide some examples of how you can use the TokenSupply app to access token supply data for different use cases. These examples will help you understand how to interact with the app and retrieve the desired information using the API endpoints.

1. Fetching Total Supply Across Networks

To fetch the total supply of the token across all supported networks, you can make a GET request to the /totalSupplyAcrossNetworks endpoint.

fetch("http://localhost:8080/totalSupplyAcrossNetworks")
  .then((response) => response.json())
  .then((totalSupplyData) => console.log(totalSupplyData));

This request will return an object containing the total supply for each network and the total supply across all networks.

2. Fetching Non-Circulating Supply Addresses

To fetch the list of non-circulating supply addresses, you can make a GET request to the /nonCirculatingSupplyAddresses endpoint.

fetch("http://localhost:8080/nonCirculatingSupplyAddresses")
  .then((response) => response.json())
  .then((addresses) => console.log(addresses));

This request will return an array of non-circulating supply address configurations, including their name, address, token contract address, JSON-RPC URL, and chain ID.

3. Fetching Non-Circulating Supply Balances By Address

To fetch the non-circulating supply balances for each address, you can make a GET request to the /nonCirculatingSupplyBalancesByAddress endpoint.

fetch("http://localhost:8080/nonCirculatingSupplyBalancesByAddress")
  .then((response) => response.json())
  .then((balances) => console.log(balances));

This request will return an array of non-circulating supply balance objects, including the name, address, and balance for each address.

4. Fetching Total Non-Circulating Supply Balance

To fetch the total non-circulating supply balance, you can make a GET request to the /nonCirculatingSupplyBalance endpoint.

fetch("http://localhost:8080/nonCirculatingSupplyBalance")
  .then((response) => response.text())
  .then((totalBalance) => console.log(totalBalance));

This request will return the total non-circulating supply balance as a string.

5. Fetching Circulating Supply Balance

To fetch the circulating supply balance, you can make a GET request to the /circulatingSupplyBalance endpoint.

fetch("http://localhost:8080/circulatingSupplyBalance")
  .then((response) => response.text())
  .then((circulatingSupply) => console.log(circulatingSupply));

This request will return the circulating supply balance as a string.

These usage examples should provide a clear understanding of how to interact with the TokenSupply app and its API endpoints. You can integrate these requests into your applications or scripts to fetch token supply data as needed.

Last updated