0.1.12 • Published 1 year ago
@minswap/market-cap v0.1.12
Market Cap
Transparent, accurate and open-sourced circulating supply and market cap calculation for Cardano's native tokens.
Overview
This package doesn't expose market cap by itself, but only circulating supply and total supply.
Market cap = Circulating supply * Market price
Fully-diluted market cap = Total supply * Market price
You can use Blockfrost Adapter to query market price from Minswap.
Install
- NPM:
npm install @minswap/market-cap
- Yarn:
yarn add @minswap/market-cap
Usage
import { supplyFetchers } from "@minswap/market-cap";
const minInfo = await supplyFetchers[
"29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e"
]();
console.log(minInfo);
// { circulating: '240813714.66121483', total: '5000000000' }
How to add my token
- Create a file in
src/tokens
with your token's name and export default a function of typeSupplyFetcher
. - Import the function into
src/index.ts
and add the corresponding entry insupplyFetchers
map with the key being the concatenation of your token's policyID and assetName - Test your function:
# only if you use Blockfrost
export BLOCKFROST_PROJECT_ID=<your_blockfrost_key>
ONLY_TEST=<your_policy_id_concat_with_asset_name> npm test
- Run format:
npm run format
Example
- MIN token fetcher: src/tokens/min.ts
- Add entry to
index.ts
:
import minFetcher from "./tokens/min";
export const supplyFetchers: Record<string, SupplyFetcher> = {
"29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e": minFetcher,
...
};
- Run test:
export BLOCKFROST_PROJECT_ID=<your_blockfrost_key>
ONLY_TEST=29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e npm test
0.1.10
2 years ago
0.1.11
1 year ago
0.1.12
1 year ago
0.1.8
2 years ago
0.1.9
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.2
2 years ago
0.0.12
2 years ago
0.0.13
2 years ago
0.1.0
2 years ago
0.1.1
2 years ago
0.0.11
2 years ago
0.0.10
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago