API Endpoints

The TokenSupply app exposes several API endpoints to interact with the token supply data. These endpoints are served using an Express.js server and provide an easy way for clients to request and retrieve information about total supply, non-circulating supply, and circulating supply.

In this section, we will discuss each API endpoint and explain its purpose.

/totalSupplyAcrossNetworks

Method: GET

Description: This endpoint returns the total token supply across all supported networks. The response is a JSON object that includes the total token supply and a breakdown of the supply by network.

Example Usage:

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

/totalSupply

Method: GET

Description: This endpoint returns the total token supply across all supported networks as a plain text string.

Example Usage:

fetch('http://localhost:8080/totalSupply')
  .then((response) => response.text())
  .then((totalSupply) => console.log(totalSupply));

/nonCirculatingSupplyAddresses

Method: GET

Description: This endpoint returns a JSON array of non-circulating supply addresses and their configurations.

Example Usage:

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

/nonCirculatingSupplyBalance

Method: GET

Description: This endpoint returns the total non-circulating supply balance as a plain text string. It calculates the sum of all non-circulating supply balances across different addresses.

Example Usage:

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

/circulatingSupplyBalance

Method: GET

Description: This endpoint returns the total circulating supply balance as a plain text string. It calculates the difference between the total supply and the non-circulating supply.

Example Usage:

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

In summary, these API endpoints provide a way to interact with the token supply data for different networks, addresses, and types of supply. By using these endpoints, you can easily access the necessary information for your applications or integrate the TokenSupply app with other tools and platforms.

Last updated