⚙️Configuration and Setup
This page will guide you through the configuration and setup process of the TokenSupply app, ensuring a smooth integration with your project. The TokenSupply app is designed to be easily customizable, allowing you to add or modify supported blockchain networks and non-circulating supply addresses as needed.
Prerequisites
Before starting the configuration and setup process, ensure that you have the following installed on your local machine:
Node.js (version 14 or later)
npm or yarn (package manager)
Installation
To begin, clone the TokenSupply app repository or download the source code. Navigate to the root directory of the project and run the following command to install the required dependencies:
or
Configuration
The TokenSupply app can be configured by modifying the src/config.ts
file. This file contains the necessary settings for interacting with various blockchain networks and fetching token supply data.
Configuring Supported Networks
The chainIdToNetworkMap
object in src/config.ts
maps chain IDs to their corresponding network information. To add or modify supported networks, update this object with the relevant network information, such as the network's JSON-RPC URL and name:
Configuring Token Contract Address and API URL
Update the tokenContractAddress
and chainId
variables in src/config.ts
to match the token contract address and chain ID of the token you wish to track:
Also, ensure that the API_URL
variable in src/config.ts
is set to the correct API endpoint for fetching token supply data across multiple networks:
Configuring Non-Circulating Supply Addresses
The nonCirculatingSupplyAddressesConfig
array in src/config.ts
holds the configuration for non-circulating supply addresses. To add or modify non-circulating supply addresses, update this array with the relevant address information, such as the name, address, token contract address, JSON-RPC URL, and chain ID:
Running the TokenSupply App
Once you've finished configuring the TokenSupply app, you can start the server by running the following command from the project's root directory:
or
The server will start listening on the specified port (default is 8080), and you can access the API endpoints via your web browser or by making HTTP requests.
Integrating the TokenSupply App with Your Project
To integrate the TokenSupply app with your project, use the provided API endpoints to fetch token supply data and display it on your website or application.
For example, to display the total supply of tokens across all supported networks, make a request to the /totalSupplyAcrossNetworks
endpoint and display the returned data on your site:
Repeat this process for other endpoints, such as /circulatingSupplyBalance
and /nonCirculatingSupplyBalancesByAddress
, to display additional token supply information as needed.
By following these steps, you can successfully configure, set up, and integrate the TokenSupply app with your project.
Last updated