🛠️Utility Functions
In this section, we will go over some of the essential utility functions used in the TokenSupply app. These functions facilitate tasks like fetching token supply data and calculating supply balances.
getTotalSupplyAcrossNetworks
getTotalSupplyAcrossNetworks
is a utility function that retrieves the total token supply across all supported networks. It takes a NetworkConfigurations
object as its input and returns an object containing the total supply as well as a breakdown of the supply for each network.
Example usage:
getNonCirculatingSupplyBalances
getNonCirculatingSupplyBalances
is a utility function that fetches the non-circulating token supply balances for each specified address. It returns an array of NonCirculatingSupplyBalance
objects, each containing the name, address, and token balance for a specific non-circulating supply address.
Example usage:
calculateCirculatingSupply
calculateCirculatingSupply
is a utility function that computes the circulating token supply by subtracting the non-circulating supply from the total token supply. It takes the total supply and non-circulating supply balances as inputs and returns the circulating supply as a BigNumber.
Example usage:
These utility functions provide a foundation for the TokenSupply app, enabling the retrieval and calculation of token supply data. Understanding how these functions work and how they interact with the app's architecture will help you extend and customize the TokenSupply app to suit your specific use case.
Last updated