Skip to content

Transparent and accurate market cap for Cardano native tokens

License

Notifications You must be signed in to change notification settings

maestro-org/market-cap

This branch is 10 commits ahead of, 116 commits behind minswap/market-cap:main.

Folders and files

NameName
Last commit message
Last commit date
Oct 13, 2023
Sep 21, 2023
Apr 8, 2024
May 17, 2022
Apr 8, 2024
Apr 8, 2024
Dec 3, 2023
May 17, 2022
Apr 27, 2022
Apr 27, 2022
Nov 16, 2022
May 17, 2022
Apr 8, 2024
Apr 27, 2022
Feb 14, 2024
Apr 27, 2022
May 10, 2022
May 10, 2022
Feb 13, 2024
Feb 13, 2024
Apr 27, 2022
Apr 27, 2022

Repository files navigation

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 MAESTRO_API_KEY=<your_maestro_key>
    ONLY_TEST=<your_policy_id_concat_with_asset_name> npm test
  4. 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,
      ...
    };
  3. Run test:

export MAESTRO_API_KEY=<your_maestro_key>
ONLY_TEST=29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e npm test

About

Transparent and accurate market cap for Cardano native tokens

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.3%
  • JavaScript 1.2%
  • Shell 0.5%