Git Product home page Git Product logo

coinranking / supplies Goto Github PK

View Code? Open in Web Editor NEW
25.0 7.0 18.0 11.79 MB

Cryptocurrency supply data library in JavaScript (open source) for getting total, circulating and max supplies from block explorers.

Home Page: https://coinranking.com

License: MIT License

JavaScript 100.00%
cryptocurrencies cryptocurrency crypto altcoin bitcoin ethereum coin supplies circulating-supply total-supply

supplies's Introduction

code-style Commitizen friendly npm (scoped) codecov

Supplies ๐Ÿ“ฆ

An open source JavaScript library for getting the cryptocurrency total, circulating and max supply from block explorers.

Getting started

  1. Node.js 12.13 or higher is required
  2. Install using NPM

Installation

Coinranking Supplies is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 12.13 or higher is required.

Installation is done using the npm install command:

npm i @coinranking/supplies

Usage

List all supported drivers

const { drivers } = require('@coinranking/supplies');

console.log(drivers);

List all supported blockchains

const { blockchains } = require('@coinranking/supplies');

console.log(blockchains);

List all drivers that support a specific blockchain

const { selectDriversByBlockchain } = require('@coinranking/supplies');

console.log(selectDriversByBlockchain('Ethereum'));

Get the supply of specific coin

const { Etherscan, Coin } = require('@coinranking/supplies');

const driver = new Etherscan({
  secret: 'freekey',
});

const coin = new Coin({
  // Lets take the Basic Attention Token (BAT) for example.
  // The reference is the unique id for a specific driver;
  // which is a smart contract address in this case.
  name: 'Basic Attention Token',
  symbol: 'BAT',
  reference: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
  // Modifiers are blockchain addresses that get subtracted from the
  // total supply to get the circulating supply.
  modifiers: [
    '0x0000000000000000000000000000000000000000', // Burned address
    '0x0000000000000000000000000000000000000001', // Burned address
    '0x185f19b43d818e10a31be68f445ef8edcb8afb83', // Multisig address
    '0x67fa2c06c9c6d4332f330e14a66bdf1873ef3d2b', // Team Lock up address
    '0x7c31560552170ce96c4a7b018e93cddc19dc61b6', // UGP reserve address
  ],
  // Some drivers like Etherscan require decimals
  decimals: 18,
});

driver
  .getSupply(coin)
  .then((supply) => {
    console.log(supply);
  });

CLI

After installation the supplies command will be available in your terminal. The CLI is available under node ./bin/supplies.js when developing.

Get

Get the supply of a native coin

supplies get <driver name>

Get supply of a specific coin or a token

supplies get <driver name> -r <smart contract address>

Flags

Name Flag Description
Decimals -d, --decimals Some drivers like Etherscan require decimals.
Reference -r, --reference Reference is a unique id for a specific driver; for example a smart contract address.
Blockchain -b, --blockchain Issuance blockchain; the blockchain the coin is issued on. This could be their own blockchain for coins like Bitcoin or Monero. Or for example Ethereum for ERC-20 tokens like Basic Attention Token. Providing the blockchain is required if the driver supports multiple blockchains
Modifiers -m, --modifiers Wallets addresses to subtract from the total supply; for example wallets hold by the foundation or burn addresses. Split the addresses with a comma and without spaces.
Record -R, --record Record the requests and coin, and save them as fixtures. This is for developing purposes.
API Key -k, --key For passing down an API key when the driver requires one. When used in combination with the -r flag the key will be masked in the fixtures.
No cache --nocache Skip using the cache.

Development

Getting started

Install dependencies

npm run install

CLI

The CLI is available under node ./bin/supplies.js when developing

Contributing

Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Conventions

  1. Airbnb JavaScript Style Guide
  2. Conventional commits

Links

Reach out to us

Other

License

MIT

supplies's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar mariannegdg avatar nickpater avatar riccardoparrello avatar sajcics avatar semantic-release-bot avatar wouthoekstra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

supplies's Issues

examples/getSupplyNeo.js returns an error

Hi

(node:817) UnhandledPromiseRejectionWarning: RequestError: Error: getaddrinfo ENOTFOUND seed1.cityofzion.io

error returned on running node examples/getSupplyNeo.js

Screenshot 2022-11-08 at 9 43 36 AM

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.