@minswap/market-cap
TypeScript icon, indicating that this package has built-in type declarations

0.1.13 • Public • Published

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

  1. Create a file in src/tokens with your token's name and export default a function of type SupplyFetcher.
  2. Import the function into src/index.ts and add the corresponding entry in supplyFetchers map with the key being the concatenation of your token's policyID and assetName
  3. 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
  1. Run format: npm run format

Example

  1. MIN token fetcher: src/tokens/min.ts
  2. Add entry to index.ts:
import minFetcher from "./tokens/min";

export const supplyFetchers: Record<string, SupplyFetcher> = {
  "29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e": minFetcher,
  ...
};
  1. Run test:
export BLOCKFROST_PROJECT_ID=<your_blockfrost_key>
ONLY_TEST=29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e npm test

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.13160latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.13160
0.1.121,015
0.1.113
0.1.102
0.1.93
0.1.82
0.1.73
0.1.63
0.1.52
0.1.42
0.1.32
0.1.296
0.1.12
0.1.02
0.0.132
0.0.122
0.0.112
0.0.102
0.0.92
0.0.82
0.0.72
0.0.62
0.0.53
0.0.42
0.0.32
0.0.22

Package Sidebar

Install

npm i @minswap/market-cap

Weekly Downloads

926

Version

0.1.13

License

MIT

Unpacked Size

949 kB

Total Files

8

Last publish

Collaborators

  • 0xj4m35
  • richardminswap
  • tony_minswap
  • long.nguyen.minswap