Skip to content

Commit

Permalink
Fix img and supply api
Browse files Browse the repository at this point in the history
  • Loading branch information
BoThe1K committed Nov 20, 2023
1 parent 3c3a975 commit 4ff1622
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/web-stratos/src/chain.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"graphqlWs": false,
"votingPowerExponent": 12
},
"previewImage": "https://s3.bigdipper.live/desmos.png",
"previewImage": "https://raw.githubusercontent.com/stratosnet/big-dipper-2.0-cosmos/web-stratos@2.17.2/apps/web-stratos/public/images/stratos_bigdipper.png",
"themes": {
"default": "light",
"themeList": [
Expand Down
14 changes: 11 additions & 3 deletions apps/web-stratos/src/pages/api/circulating-supply.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { ethers } from 'ethers';

import { getMetrics } from '@/screens/home/components/tokenomics/queries';
import { bigToNativeDecimals } from '@/screens/home/components/tokenomics/utils';
import type { NextApiRequest, NextApiResponse } from 'next';

type MetricsData = {
circulation_supply: string;
total_supply: string;
total_mining_supply: string;
total_mined_tokens: string;
};

export default async function handler(req: NextApiRequest, res: NextApiResponse<string>) {
try {
const result: MetricsData = await getMetrics();
res.status(200).send(bigToNativeDecimals(result.circulation_supply));
const total_supply = ethers.utils.parseUnits(result.total_supply, 'wei');
const to_be_mined = ethers.utils
.parseUnits(result.total_mining_supply, 'wei')
.sub(ethers.utils.parseUnits(result.total_mined_tokens, 'wei'));
res.status(200).send(bigToNativeDecimals(total_supply.sub(to_be_mined).toString()));
} catch (err) {
res.status(400).json({ error: 'failed to load data' });
}
Expand Down

0 comments on commit 4ff1622

Please sign in to comment.