An API for basic info about the any cosmos token supply.
The base route /
returns all info in JSON:
{
"apr": 0.5356138011434268,
"bondedRatio": 0.26138236113619256,
"circulatingSupply": "1035311800.378731",
"communityPool": "4863561.388632",
"denom": "UMEE",
"totalStaked": "2677292310.820958",
"totalSupply": "10242819366.934873"
}
/circulating-supply
: returns circulating supply in plain text/total-supply
: returns total supply in plain text/community-pool
: returns community pool size in plain text/denom
: returns denom in plain text
⚠️ This example for Umee network:
cd $HOME
git clone https://github.com/NodesGuru/supply-info-api.git
cd ~/supply-info-api
cp .env.example .env # you can find working .env for umee network in the umee folder
cd umee
wget https://github.com/umee-network/mainnet/raw/main/genesis.json
cat genesis.json | jq -r '.app_state.auth.accounts[] | select(."@type" | contains ("vesting")) | .base_vesting_account.base_account.address' > vesting_accounts_unformatted
sed -i '$ d' vesting_accounts_unformatted
tr '\n' ',' < vesting_accounts_unformatted > vesting_accounts
sed -i '$ s/.$//' vesting_accounts
sed -i '$ d' ~/supply-info-api/.env
echo "VESTING_ACCOUNTS=$(cat vesting_accounts)" >> ~/supply-info-api/.env
⚠️ Do not forget to install NodeJS and (optional) Yarn
cd ~/supply-info-api
yarn # or npm install
yarn start # or npm run start
Press Ctrl + C
to exit.
echo "[Unit]
Description=Supply Info API
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/supply-info-api
ExecStart=$(which yarn) --cwd $HOME/supply-info-api/ start
Restart=always
RestartSec=1
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target" > $HOME/supply-api-umee.service
sudo mv $HOME/supply-api-umee.service /etc/systemd/system/supply-api-umee.service
sudo systemctl daemon-reload
sudo systemctl enable supply-api-umee
sudo systemctl restart supply-api-umee
journalctl -u supply-api-umee -f -o cat
curl localhost:3000 | jq .
- Get total supply.
- Get community pool.
- Subtract community pool from total supply.
- Iterate through list of vesting amounts for large accounts (like the Dev Fund), and subtract the vesting ammount from total supply.
This yields the circulating supply.
Vesting accounts are provided by an environment variable. See .env.example
for an example.