Giter Club home page Giter Club logo

market-cap's Introduction

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

market-cap's People

Contributors

longngn avatar hieupnh avatar thetaphouse avatar twilightduck avatar legionaaa avatar muesliswapteam avatar drmaldy avatar 4tt1l4 avatar aada-finance avatar codybutz avatar deadpxlz avatar austinnegron avatar extramileit avatar luxbg avatar padierfind avatar seanage avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.