├── .eslintignore
├── tests
├── coins
│ ├── Beam.json
│ ├── Btse.json
│ ├── Chia.json
│ ├── Hex.json
│ ├── Kava.json
│ ├── Mina.json
│ ├── Nash.json
│ ├── Near.json
│ ├── Wax.json
│ ├── Akash.json
│ ├── Altura.json
│ ├── Avalanche.json
│ ├── Banano.json
│ ├── Bbscoin.json
│ ├── Bitcoinrh.json
│ ├── Blockmeta.json
│ ├── BlocksEos.json
│ ├── Blockscan.json
│ ├── Boolberry.json
│ ├── CPCoin.json
│ ├── CacheGold.json
│ ├── Cirquity.json
│ ├── Draken.json
│ ├── DunScan.json
│ ├── EasyFi.json
│ ├── Ecomi.json
│ ├── EnergyWeb.json
│ ├── Eosdt.json
│ ├── Filecoin.json
│ ├── Hathor.json
│ ├── Haven.json
│ ├── Hive.json
│ ├── Hybrix.json
│ ├── Idena.json
│ ├── Iridium.json
│ ├── Jiviz.json
│ ├── Modic.json
│ ├── Monerov.json
│ ├── Nimiq.json
│ ├── Oasis.json
│ ├── PrcyCoin.json
│ ├── SiaStats.json
│ ├── Tether.json
│ ├── TzStats.json
│ ├── Vsystem.json
│ ├── Wownero.json
│ ├── XCash.json
│ ├── XinFin.json
│ ├── BitcoinVault.json
│ ├── Blockstack.json
│ ├── CloverFinance.json
│ ├── Cosmostation.json
│ ├── CryptoLocally.json
│ ├── Documentchain.json
│ ├── ElectricCash.json
│ ├── Elrond.json
│ ├── FiscussFyi.json
│ ├── FixNetwork.json
│ ├── MCashChain.json
│ ├── NestProtocol.json
│ ├── NeutrinoDollar.json
│ ├── PaymentCoin.json
│ ├── PhantasmaKCAL.json
│ ├── PhantasmaSOUL.json
│ ├── PirateChain.json
│ ├── PlanetFinance.json
│ ├── ReefFinance.json
│ ├── RyoExplorer.json
│ ├── SteemDollars.json
│ ├── VeChainStats.json
│ ├── DiaEthereumClassic.json
│ ├── HederaHashgraph.json
│ ├── TronMakingMachine.json
│ ├── UnlimitedFiscussFyi.json
│ ├── Celo.json
│ ├── Decred.json
│ ├── Namebase.json
│ ├── Nervos.json
│ ├── Reddcoin.json
│ ├── Steem.json
│ ├── Adamant.json
│ ├── Fdr.json
│ ├── Verge.json
│ ├── Coin4Trade.json
│ ├── QnodeCoin.json
│ ├── ZchainExplorer.json
│ ├── Zilliqa.json
│ ├── Iost.json
│ ├── Agenor.json
│ ├── Bare.json
│ ├── Betller.json
│ ├── Blip.json
│ ├── BuySell.json
│ ├── Checoin.json
│ ├── Helpico.json
│ ├── Prux.json
│ ├── Qtum.json
│ ├── Rapids.json
│ ├── Rito.json
│ ├── Solidus.json
│ ├── Sprint.json
│ ├── Tkm.json
│ ├── Uca.json
│ ├── X42.json
│ ├── Xaya.json
│ ├── Xenios.json
│ ├── _2x2.json
│ ├── BiblePay.json
│ ├── BitGreen.json
│ ├── Bixbcoin.json
│ ├── BridgeLto.json
│ ├── BuyCoinPos.json
│ ├── Deracoin.json
│ ├── DigitalNote.json
│ ├── DogeCash.json
│ ├── Konjungate.json
│ ├── MagpieCoin.json
│ ├── Ontology.json
│ ├── PolisPay.json
│ ├── PostCoin.json
│ ├── Ravencoin.json
│ ├── Sierracoin.json
│ ├── SmartHoldem.json
│ ├── Solana.json
│ ├── Turtle.json
│ ├── VdsCool.json
│ ├── Ether1.json
│ ├── Evrice.json
│ ├── FanaticosCash.json
│ ├── InfiniteBlocks.json
│ ├── MyspesExplorer.json
│ ├── StashExplorer.json
│ ├── Ergon.json
│ ├── BitcoinVirtualGold.json
│ ├── Helium.json
│ ├── Algorand.json
│ ├── Umi.json
│ ├── Web3Eth.json
│ ├── BscScan.json
│ ├── Raicoin.json
│ ├── Polygonscan.json
│ ├── Terra.json
│ ├── Basescan.json
│ ├── ErgoExplorer.json
│ ├── CryptoCore.json
│ ├── BinanceDex.json
│ ├── Waves.json
│ ├── Tronscan.json
│ ├── OmniExplorer.json
│ ├── MillenEos.json
│ ├── NeoScan.json
│ ├── Lisk.json
│ ├── Blockchair.json
│ ├── Subscan.json
│ ├── ChainNemNinja.json
│ ├── Etherscan.json
│ ├── Stellar.json
│ └── CryptoID.json
└── fixtures
│ ├── Monerov.json
│ ├── NestProtocol.json
│ ├── Iridium.json
│ ├── BitcoinVault.json
│ ├── Near.json
│ ├── PaymentCoin.json
│ ├── Ecomi.json
│ ├── Filecoin.json
│ ├── FixNetwork.json
│ ├── Bbscoin.json
│ ├── Wownero.json
│ ├── EasyFi.json
│ ├── Banano.json
│ ├── HederaHashgraph.json
│ ├── Solana.json
│ ├── Polygonscan.json
│ ├── Zilliqa.json
│ ├── Oasis.json
│ ├── Sierracoin.json
│ ├── Blockscan.json
│ ├── ElectricCash.json
│ ├── TronMakingMachine.json
│ ├── Blip.json
│ ├── Checoin.json
│ ├── Helpico.json
│ ├── _2x2.json
│ ├── BuySell.json
│ ├── CryptoLocally.json
│ ├── Konjungate.json
│ ├── FanaticosCash.json
│ ├── Tkm.json
│ ├── Deracoin.json
│ ├── MyspesExplorer.json
│ ├── MagpieCoin.json
│ ├── BitcoinVirtualGold.json
│ ├── InfiniteBlocks.json
│ ├── SiaStats.json
│ ├── Hybrix.json
│ ├── PirateChain.json
│ ├── LitecoinNet.json
│ ├── Sprint.json
│ ├── BiblePay.json
│ ├── Coin4Trade.json
│ ├── Idena.json
│ ├── CacheGold.json
│ ├── Ergon.json
│ └── QnodeCoin.json
├── supplies.gif
├── commitlint.config.js
├── .idea
├── .gitignore
├── codeStyles
│ ├── codeStyleConfig.xml
│ └── Project.xml
├── vcs.xml
├── modules.xml
├── inspectionProfiles
│ └── Project_Default.xml
└── supplies.iml
├── lib
├── util.js
├── cache.js
├── request.js
├── supplies.js
├── drivers
│ ├── cache-gold.js
│ ├── payment-coin.js
│ ├── haven.js
│ ├── blockscan.js
│ ├── reddcoin.js
│ ├── oasis.js
│ ├── bbscoin.js
│ ├── wownero.js
│ ├── ecomi.js
│ ├── bitcoin-vault.js
│ ├── electric-cash.js
│ ├── cirquity.js
│ ├── modic.js
│ ├── unlimited-fiscuss-fyi.js
│ ├── siastats.js
│ ├── iridium.js
│ ├── monerov.js
│ ├── crypto-locally.js
│ ├── fix-network.js
│ ├── reef-finance.js
│ ├── chia.js
│ ├── easy-fi.js
│ ├── nest-protocol.js
│ ├── fiscuss-fyi.js
│ ├── steem-dollars.js
│ ├── clover-finance.js
│ ├── nash.js
│ ├── draken.js
│ ├── moneroblocks.js
│ ├── eosdt.js
│ ├── hathor.js
│ ├── beam.js
│ ├── mina.js
│ ├── near.js
│ ├── tron-making-machine.js
│ ├── namebase.js
│ ├── decred.js
│ ├── piratechain.js
│ ├── mcashchain.js
│ ├── tzstats.js
│ ├── kava.js
│ ├── nervos.js
│ ├── cpcoin.js
│ ├── filecoin.js
│ ├── wax.js
│ ├── jiviz.js
│ ├── banano.js
│ ├── litecoin-net.js
│ ├── tether.js
│ ├── dunscan.js
│ ├── neutrino-dollar.js
│ ├── cosmostation.js
│ ├── blockmeta.js
│ ├── enery-web.js
│ ├── idena.js
│ ├── xin-fin.js
│ ├── planet-finance.js
│ └── avalanche.js
├── throttle.js
└── models
│ └── supply-modifier.js
├── .editorconfig
├── examples
├── getSupplyXrp.js
├── getSupplyXmr.js
├── getSupplyDash.js
├── getSupplyLtc.js
├── getSupplyUsdt.js
├── getSupplyLisk.js
├── getSupplyNeo.js
├── getSupplyEth.js
├── getSupplyStellar.js
├── getSupplyDra.js
├── getSupplyBat.js
└── getSupplyNem.js
├── .gitignore
├── .npmignore
├── CONTRIBUTING.md
├── .github
├── dependabot.yml
└── ISSUE_TEMPLATE
│ ├── supply_integration.md
│ ├── feature_request.md
│ └── bug_report.md
├── .eslintrc
└── LICENSE
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/tests/coins/Beam.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Btse.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Chia.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Hex.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Kava.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Mina.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Nash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Near.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Wax.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Akash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Altura.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Avalanche.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Banano.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Bbscoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Bitcoinrh.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Blockmeta.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/BlocksEos.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Blockscan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Boolberry.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/CPCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/CacheGold.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Cirquity.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Draken.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/DunScan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/EasyFi.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Ecomi.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/EnergyWeb.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Eosdt.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Filecoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Hathor.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Haven.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Hive.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/coins/Hybrix.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Idena.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Iridium.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Jiviz.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Modic.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Monerov.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Nimiq.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Oasis.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/PrcyCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/SiaStats.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Tether.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/TzStats.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Vsystem.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Wownero.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/XCash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/XinFin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/BitcoinVault.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Blockstack.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/CloverFinance.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Cosmostation.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/CryptoLocally.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Documentchain.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/ElectricCash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/Elrond.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
6 |
--------------------------------------------------------------------------------
/tests/coins/FiscussFyi.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/FixNetwork.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/MCashChain.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/NestProtocol.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/NeutrinoDollar.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/PaymentCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/PhantasmaKCAL.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/PhantasmaSOUL.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/PirateChain.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/PlanetFinance.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/ReefFinance.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/RyoExplorer.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/SteemDollars.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/VeChainStats.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/supplies.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coinranking/supplies/HEAD/supplies.gif
--------------------------------------------------------------------------------
/tests/coins/DiaEthereumClassic.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/HederaHashgraph.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/TronMakingMachine.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/tests/coins/UnlimitedFiscussFyi.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | }
5 | ]
--------------------------------------------------------------------------------
/commitlint.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['@commitlint/config-conventional'],
3 | };
4 |
--------------------------------------------------------------------------------
/tests/coins/Celo.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "modifiers": []
7 | }
8 | ]
--------------------------------------------------------------------------------
/tests/coins/Decred.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "modifiers": []
7 | }
8 | ]
--------------------------------------------------------------------------------
/tests/coins/Namebase.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "modifiers": []
7 | }
8 | ]
--------------------------------------------------------------------------------
/tests/coins/Nervos.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "modifiers": []
7 | }
8 | ]
--------------------------------------------------------------------------------
/tests/coins/Reddcoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "modifiers": []
7 | }
8 | ]
--------------------------------------------------------------------------------
/tests/coins/Steem.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "modifiers": []
7 | }
8 | ]
--------------------------------------------------------------------------------
/tests/coins/Adamant.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "U10871854201139692735"
5 | ]
6 | }
7 | ]
--------------------------------------------------------------------------------
/tests/coins/Fdr.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "fcxBcYumkh6mgLVk1th6fCfs5oGfjS8bwZ"
5 | ]
6 | }
7 | ]
--------------------------------------------------------------------------------
/tests/coins/Verge.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "D6NYsdntCHYDv6X6uGzgEChnoQruHBR1De"
5 | ]
6 | }
7 | ]
--------------------------------------------------------------------------------
/tests/coins/Coin4Trade.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "CQ8JdN4px4CfdGbijo7SLkspPKkYGZAsRh"
5 | ]
6 | }
7 | ]
--------------------------------------------------------------------------------
/tests/coins/QnodeCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "9ECoBGxXM3vfaMdne691KGdtHwJQE2MLZB"
5 | ]
6 | }
7 | ]
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 |
--------------------------------------------------------------------------------
/tests/coins/ZchainExplorer.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd"
5 | ]
6 | }
7 | ]
--------------------------------------------------------------------------------
/tests/coins/Zilliqa.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "zil1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq9yf6pz"
5 | ]
6 | }
7 | ]
--------------------------------------------------------------------------------
/lib/util.js:
--------------------------------------------------------------------------------
1 | const promisesMap = (haystack, callback) => Promise.all(haystack.map(callback));
2 |
3 | module.exports = {
4 | promisesMap,
5 | };
6 |
--------------------------------------------------------------------------------
/tests/coins/Iost.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "bigone_pool"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Agenor.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "AbqcNgEwVCxzfDQBVazXhJTKX9vqfGxu9F"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Bare.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "B4WbXbjYRdoGVJw48QGZ86McDFAZ4HkVo1"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Betller.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "BB5oQ3sTJaV6UxYWagbHQ48Q8XD2XhyQZA"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Blip.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "BkDRDwKWkM5Q8Pz2D7cKK3adoxf1p4iyAX"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/BuySell.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "BjZXyE5rz3AxKTtjZPrg9i6AjT8G77K1iX"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Checoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "CRrcKx2kEFJba4ANcgvW8QYya7d3cCy5JP"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Helpico.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "H8WMu99F1S4JbrZwus5dFS1qdbr2PQGRH5"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Prux.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "P9nCSaCcrtzuoPyL6s5oEpwKnEu5cyKrah"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Qtum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "QUFwvRXTnjnWmGVYxaXZoEAmMkKtkth8ND"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Rapids.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "Rkb7wasVcs5Ajg1CfF2SGSKD61yfyim3Ju"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Rito.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "BNBtzXoX7dVfAMG3mquEr5Xbe4BEZ9rHQg"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Solidus.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "SimEHyX1LauaCNoE7KCNiD8JHJzUVWhdKP"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Sprint.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "SjWpsbZbkwkLzGWVze3uDtDvYAF3xWEq8j"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Tkm.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "TSpTntH6vVszfm6sho7euAxAVrBRXVN52a"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Uca.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "USTFxHb6u3CqH2UvzTv1J1zybjG5oy5LZr"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/X42.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "XRh858RsbhAc1zs1r48fLvPNrx7pbpm2da"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Xaya.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "CNhc6WNpX9JK7pLTrtPgmhqx7PDVHDKjPh"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Xenios.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "Xt8rMoBE6oa1spwB1bxSXbiFventfsmdBH"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/_2x2.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "CSwjoJqXdR3Vx4bDtSUMzMfqSQGWoi21v2"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/BiblePay.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "BLsMvLH1PHgrXq74EuhBWrwB9zo6TmKz6T"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/BitGreen.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "GUdTMN6LZb2TfnD3AAYJDTJPXBy76kVuuG"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Bixbcoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "B64Uad18H73ArxHfvDt3Ci9pvrkZqqr3b1"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/BridgeLto.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "3Jq8mnhRquuXCiFUwTLZFVSzmQt3Fu6F7HQ"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/BuyCoinPos.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "BndkQjXtuGKai2Umjaep7z38o4XPvWg5X5"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Deracoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "DU6SxukQDz6hFVLEsSQChrS59vwNQzqSrd"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/DigitalNote.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "dGQNH28uxmhu4HBFvKNW26jnhsig66xm2R"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/DogeCash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "DU5ikPJZRmYnVteJ5NEPJP3DUWQJp8CYtf"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Konjungate.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "KtjjN15DXTHrHYRasZy7bnhVaKRmfsDJBW"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/MagpieCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "Mc9JsFZmJ6qGinCrFZhpdgtuHTbBroqydt"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Ontology.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "AS7MjVEicEsJ4zjEfm2LoKoYoFsmapD7rT"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/PolisPay.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "PMBuMihhTMSBvEVE5DphvePNiJFqugNowL"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/PostCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "PKCryptoLifeDotNetBurnAddrXXXMNDfN"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Ravencoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "RVh6mmdDuCoDULau8PwHaUtp4wtrx1dC4W"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Sierracoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "SbLVyTxtaVfPB1HAXXWg3zxAQiELAda8Nf"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/SmartHoldem.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "SPvhZpt4qEYHLrUDqeHhu1H1qtmkK3xovH"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Solana.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "reference": "kinXdEcpDQeHPEuQnqmUgtYykqKGVFq6CeVX5iAHJq6",
7 | "modifiers": []
8 | }
9 | ]
--------------------------------------------------------------------------------
/tests/coins/Turtle.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "reference": "3HFgaMssup9ssSL139sptsxc2EXLY3Qx5ykY7hf5LD2B",
4 | "modifiers": []
5 | },
6 | {
7 | "modifiers": []
8 | }
9 | ]
--------------------------------------------------------------------------------
/tests/coins/VdsCool.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "VcRJvWUKBeGwfxqDaW5gZurLcLbNgeG13A5"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Ether1.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "0xFBd45D6ED333c4ae16d379ca470690E3F8d0D2a2"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Evrice.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "0x807f0132320e6196f2219a1243bdd47ca8976191"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/FanaticosCash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "FfamQfusb9WfgLU7dEJs6tn8qMYLBvkg8X"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/InfiniteBlocks.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "1JJViUvU1USyPqzMmQ4Yp6FERCyWBLF3UZ"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/MyspesExplorer.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "SfHfjyDKrNeBKekWr43tv5zKaAWa8wiak1"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/StashExplorer.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "Xdy7QWHgEeM8CEpQfezg2n3yBkyQ2mgUYs"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Ergon.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "ergon:qq9n52zdwja0rk4gx8msnpy3hxmc8eu0cy7l86e37z"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/tests/coins/BitcoinVirtualGold.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "bvg1qadyc83ucxp5eja2hxcsatrfw3z8qk7pay8a540"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Helium.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "14sFDcQdZyZmDfbmHziSMoUfS2k5K71BR2Z3egruMYfLMFbQ5y7"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/coins/Algorand.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "SL4FL4VQRLRN24WMOL5FIDFTRHVU6OTC7VB2THQNEIKBQFHQKGIXMIPGHU"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Umi.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "roy1y5jmpknh0jn0u0z4s6qz4jqy58fezawlmeeswkn24qtu20wrmres2wf2ex"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Web3Eth.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "reference": "0x0f5d2fb29fb7d3cfee444a200298f468908cc942",
4 | "modifiers": [
5 | "0x51d903f5bE1337a882E06383a1385f8CaA21fD83"
6 | ]
7 | }
8 | ]
--------------------------------------------------------------------------------
/tests/coins/BscScan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "reference": "0x2170ed0880ac9a755fd29b2688956bd959f933f8",
4 | "modifiers": [
5 | "0x74e4716e431f45807dcf19f284c7aa99f18a4fbc"
6 | ]
7 | }
8 | ]
9 |
--------------------------------------------------------------------------------
/tests/coins/Raicoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "rai_1b5wb8hs5d3u5q8cnesk5xprr4damryn9xmrju7grdrtq6sxpanrwjo4s4r3"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/lib/cache.js:
--------------------------------------------------------------------------------
1 | const NodeCache = require('node-cache');
2 |
3 | const cache = new NodeCache({
4 | useClones: false,
5 | stdTTL: 60,
6 | checkperiod: 120,
7 | });
8 |
9 | module.exports = cache;
10 |
--------------------------------------------------------------------------------
/tests/coins/Polygonscan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "reference": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
7 | "decimals": "6",
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/Terra.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "terra1dp0taj85ruc299rkdvzp4z5pfg6z6swaed74e6"
5 | ]
6 | },
7 | {
8 | "reference": "ANC",
9 | "modifiers": []
10 | }
11 | ]
--------------------------------------------------------------------------------
/tests/coins/Basescan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "reference": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
4 | "decimals": "6",
5 | "modifiers": [
6 | "0x533A97190627f5f8e551a5f9ACEd0974814b494D"
7 | ]
8 | }
9 | ]
--------------------------------------------------------------------------------
/tests/coins/ErgoExplorer.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "88dhgzEuTXaUsySGJMvihy5bNomCkm8dKj8wUfLkiSRYU2dFwW5ycyTHFpZK3SnMBc4DjPfJu2Bk2XYH"
5 | ]
6 | },
7 | {
8 | "modifiers": []
9 | }
10 | ]
--------------------------------------------------------------------------------
/tests/coins/CryptoCore.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "oKziZBx85hhcki6bS4frfYcJejhN96DCQD"
5 | ],
6 | "blockchain": "OneWorldCoin"
7 | },
8 | {
9 | "modifiers": [],
10 | "blockchain": "OneWorldCoin"
11 | }
12 | ]
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | end_of_line = lf
6 | insert_final_newline = true
7 | trim_trailing_whitespace = true
8 | charset = utf-8
9 |
10 | [{*.js,*.json,*.yml}]
11 | indent_size = 2
12 | indent_style = space
--------------------------------------------------------------------------------
/examples/getSupplyXrp.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const drivers = supplies.selectDriversByBlockchain('XRP');
4 |
5 | const driver = new supplies[drivers[0]]();
6 |
7 | driver
8 | .getSupply()
9 | .then((supply) => {
10 | console.log(supply);
11 | });
12 |
--------------------------------------------------------------------------------
/tests/coins/BinanceDex.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "reference": "HNST-3C9",
4 | "modifiers": [
5 | "bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m"
6 | ]
7 | },
8 | {
9 | "modifiers": [
10 | "bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m"
11 | ]
12 | }
13 | ]
--------------------------------------------------------------------------------
/examples/getSupplyXmr.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const drivers = supplies.selectDriversByBlockchain('Monero');
4 |
5 | const driver = new supplies[drivers[0]]();
6 |
7 | driver
8 | .getSupply()
9 | .then((supply) => {
10 | console.log(supply);
11 | });
12 |
--------------------------------------------------------------------------------
/tests/coins/Waves.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "reference": "AR7pPCbysYUuAKgUxqhfibN9GZu62w3tMC2QfcWHuawi",
4 | "modifiers": [
5 | "3PC4s76XbisVZ6ikTCPryxGMVk3PXPAasUR"
6 | ]
7 | },
8 | {
9 | "modifiers": [
10 | "3PC4s76XbisVZ6ikTCPryxGMVk3PXPAasUR"
11 | ]
12 | }
13 | ]
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/getSupplyDash.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const drivers = supplies.selectDriversByBlockchain('Dash');
4 |
5 | const driver = new supplies[drivers[0]]();
6 |
7 | driver
8 | .getSupply({ blockchain: 'Dash' })
9 | .then((supply) => {
10 | console.log(supply);
11 | });
12 |
--------------------------------------------------------------------------------
/tests/coins/Tronscan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": []
4 | },
5 | {
6 | "reference": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
7 | "modifiers": [
8 | "TAUN6FwrnwwmaEqYcckffC7wYmbaS6cBiX"
9 | ]
10 | },
11 | {
12 | "reference": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
13 | "modifiers": [
14 | "TAUN6FwrnwwmaEqYcckffC7wYmbaS6cBiX"
15 | ]
16 | }
17 | ]
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | npm-debug.log*
6 | yarn-debug.log*
7 | yarn-error.log*
8 | .yarn
9 | yarn.lock
10 |
11 | # misc
12 | .DS_Store
13 |
14 | # config
15 | .env
16 | env.yml
17 |
18 | # redis
19 | dump.rdb
20 |
21 | coverage
22 |
23 | CHANGELOG.md
24 | DOCUMENTATION.md
25 | documentation.md
26 |
--------------------------------------------------------------------------------
/examples/getSupplyLtc.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const modifiers = [];
6 |
7 | const drivers = supplies.selectDriversByBlockchain('Litecoin');
8 |
9 | const driver = new supplies[drivers[0]]();
10 |
11 | const coin = new Coin({ modifiers });
12 |
13 | driver
14 | .getSupply(coin)
15 | .then((supply) => {
16 | console.log(supply);
17 | });
18 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | jspm_packages
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 | .yarn
10 |
11 | # misc
12 | .DS_Store
13 |
14 | # config
15 | .env
16 | env.yml
17 |
18 | # tests
19 | coverage
20 |
21 | # gifs
22 | supplies.gif
23 |
24 | # test files
25 | /tests/coins
26 | /tests/fixtures
27 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | 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.
4 |
5 | ## Conventions
6 |
7 | 1. [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript)
8 | 2. [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.4/)
9 |
--------------------------------------------------------------------------------
/lib/request.js:
--------------------------------------------------------------------------------
1 | const cloudscraper = require('cloudscraper');
2 |
3 | const headers = {};
4 |
5 | if (process.env.USER_AGENT) {
6 | // TODO: dont use env, but let Supplies take some options
7 | headers['User-Agent'] = process.env.USER_AGENT;
8 | }
9 |
10 | const request = cloudscraper.defaults({
11 | timeout: 60000,
12 | pool: { maxSockets: 50 },
13 | headers,
14 | json: true,
15 | });
16 |
17 | module.exports = request;
18 |
--------------------------------------------------------------------------------
/tests/coins/OmniExplorer.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Omni",
4 | "symbol": "OMNI",
5 | "modifiers": [
6 | "1NTMakcgVwQpMdGxRQnFKyb3G1FAJysSfz",
7 | "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL"
8 | ]
9 | },
10 | {
11 | "name": "Tether",
12 | "symbol": "USDT",
13 | "reference": "31",
14 | "modifiers": [
15 | "1NTMakcgVwQpMdGxRQnFKyb3G1FAJysSfz",
16 | "3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL"
17 | ]
18 | }
19 | ]
--------------------------------------------------------------------------------
/tests/coins/MillenEos.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "eosio.ramfee",
5 | "eosio.bpay",
6 | "eosio",
7 | "eosio.ram",
8 | "eosio.unregd",
9 | "eosio.vpay",
10 | "eosio.msig",
11 | "eosio.saving",
12 | "eosio.names",
13 | "eosio.token",
14 | "b1"
15 | ]
16 | },
17 | {
18 | "reference": "WAL",
19 | "modifiers": [
20 | "b1",
21 | "fund.wal",
22 | "team.wal"
23 | ]
24 | }
25 | ]
--------------------------------------------------------------------------------
/tests/coins/NeoScan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Neo",
4 | "symbol": "NEO",
5 | "modifiers": [
6 | "Ae2d6qj91YL3LVUMkza7WQsaTYjzjHm4z1",
7 | "AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i",
8 | "ASc3dPwQ9rrKFEUsE5VqFomG8w9aKyi28T"
9 | ]
10 | },
11 | {
12 | "name": "GAS",
13 | "symbol": "GAS",
14 | "reference": "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
15 | "modifiers": [
16 | "Ae2d6qj91YL3LVUMkza7WQsaTYjzjHm4z1"
17 | ]
18 | }
19 | ]
--------------------------------------------------------------------------------
/.idea/supplies.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/getSupplyUsdt.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const drivers = supplies.selectDriversByBlockchain('Omnilayer');
6 |
7 | const driver = new supplies[drivers[0]]();
8 |
9 | const coin = new Coin({
10 | name: 'Tether',
11 | symbol: 'USDT',
12 | reference: '31',
13 | modifiers: [
14 | '1NTMakcgVwQpMdGxRQnFKyb3G1FAJysSfz',
15 | '3MbYQMMmSkC3AgWkj9FMo5LsPTW1zBTwXL',
16 | ],
17 | });
18 |
19 | driver
20 | .getSupply(coin)
21 | .then((supply) => {
22 | console.log(supply);
23 | });
24 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: npm
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 | open-pull-requests-limit: 10
8 | ignore:
9 | - dependency-name: eslint-plugin-jsdoc
10 | versions:
11 | - 31.6.0
12 | - 32.0.0
13 | - 32.1.0
14 | - 32.1.1
15 | - 32.3.1
16 | - dependency-name: eslint
17 | versions:
18 | - 7.24.0
19 | - dependency-name: "@commitlint/config-conventional"
20 | versions:
21 | - 12.0.1
22 | - dependency-name: husky
23 | versions:
24 | - 5.1.0
25 | - 5.1.2
26 |
--------------------------------------------------------------------------------
/examples/getSupplyLisk.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const modifiers = [
6 | '11917631413532719541L',
7 | '14175575863689886451L',
8 | '15434119221255134066L',
9 | '15841793714384967784L',
10 | '5726759782318848681L',
11 | '8201357239823655010L',
12 | ];
13 |
14 | const drivers = supplies.selectDriversByBlockchain('Lisk');
15 |
16 | const driver = new supplies[drivers[0]]();
17 |
18 | const coin = new Coin({ modifiers });
19 |
20 | driver
21 | .getSupply(coin)
22 | .then((supply) => {
23 | console.log(supply);
24 | });
25 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/supply_integration.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Supply integration
3 | about: Provide information create a new driver for getting a supply
4 | title: 'Integration: [driver name]'
5 | labels: supply integration
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Driver name**
11 | Provide the name of the block explorer or service that the supply originated with.
12 |
13 | **Website**
14 | Provide the website link of the driver.
15 |
16 | **API endpoint**
17 | Provide links to API endpoints that will help us get the supplies.
18 |
19 | **API documentation**
20 | Provide a link to the API documentation of the driver.
21 |
--------------------------------------------------------------------------------
/tests/coins/Lisk.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Lisk",
4 | "symbol": "LSK",
5 | "modifiers": [
6 | "11917631413532719541L",
7 | "14175575863689886451L",
8 | "15434119221255134066L",
9 | "15841793714384967784L",
10 | "5726759782318848681L",
11 | "8201357239823655010L"
12 | ]
13 | },
14 | {
15 | "name": "Lisk",
16 | "symbol": "LSK",
17 | "modifiers": [
18 | "11917631413532719541L",
19 | "14175575863689886451L",
20 | "15434119221255134066L",
21 | "15841793714384967784L",
22 | "5726759782318848681L",
23 | "8201357239823655010L"
24 | ]
25 | }
26 | ]
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "airbnb-base",
4 | "plugin:jsdoc/recommended"
5 | ],
6 | "rules": {
7 | "no-console": 0,
8 | "no-param-reassign": 0,
9 | "class-methods-use-this": 0,
10 | "no-underscore-dangle": 0
11 | },
12 | "settings": {
13 | "jsdoc": {
14 | "overrideReplacesDocs": true,
15 | "augmentsExtendsReplacesDocs": true,
16 | "implementsReplacesDocs": true
17 | }
18 | },
19 | "plugins": [
20 | "jsdoc"
21 | ],
22 | "overrides": [
23 | {
24 | "files": [
25 | "**/*.test.js"
26 | ],
27 | "env": {
28 | "jest": true
29 | }
30 | }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/tests/coins/Blockchair.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"
5 | ],
6 | "blockchain": "Litecoin"
7 | },
8 | {
9 | "modifiers": [],
10 | "blockchain": "Litecoin"
11 | },
12 | {
13 | "modifiers": [
14 | "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
15 | ],
16 | "blockchain": "BitcoinCash"
17 | },
18 | {
19 | "modifiers": [],
20 | "blockchain": "BitcoinCash"
21 | },
22 | {
23 | "modifiers": [
24 | "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
25 | ],
26 | "blockchain": "BitcoinSV"
27 | },
28 | {
29 | "modifiers": [],
30 | "blockchain": "BitcoinSV"
31 | }
32 | ]
--------------------------------------------------------------------------------
/examples/getSupplyNeo.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const modifiers = [
6 | 'Ae2d6qj91YL3LVUMkza7WQsaTYjzjHm4z1',
7 | 'AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i',
8 | 'ASc3dPwQ9rrKFEUsE5VqFomG8w9aKyi28T',
9 | ];
10 |
11 | const drivers = supplies.selectDriversByBlockchain('Neo');
12 |
13 | const driver = new supplies[drivers[0]]();
14 |
15 | const coin = new Coin({
16 | name: 'Neo',
17 | symbol: 'NEO',
18 | reference: 'c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b',
19 | modifiers,
20 | });
21 |
22 | driver
23 | .getSupply(coin)
24 | .then((supply) => {
25 | console.log(supply);
26 | });
27 |
--------------------------------------------------------------------------------
/tests/fixtures/Monerov.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.monerov.online:443",
4 | "method": "GET",
5 | "path": "/api/emission_txt2",
6 | "body": "",
7 | "status": 200,
8 | "response": 10961286.291954,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx",
12 | "Date",
13 | "Sun, 23 Aug 2020 08:45:56 GMT",
14 | "Content-Type",
15 | "text/html; charset=utf-8",
16 | "Content-Length",
17 | "15",
18 | "Connection",
19 | "keep-alive"
20 | ],
21 | "responseIsBinary": false
22 | }
23 | ]
--------------------------------------------------------------------------------
/tests/coins/Subscan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "G7UkJAutjbQyZGRiP8z5bBSBPBJ66JbTKAkFDq3cANwENyX"
5 | ],
6 | "blockchain": "Kusama"
7 | },
8 | {
9 | "modifiers": [],
10 | "blockchain": "Kusama"
11 | },
12 | {
13 | "modifiers": [
14 | "14SpfHmfGQ45J2LxUyDpbYCwwA4M7hoDa2nkr4HnTdGRDshU"
15 | ],
16 | "blockchain": "Polkadot"
17 | },
18 | {
19 | "modifiers": [],
20 | "blockchain": "Polkadot"
21 | },
22 | {
23 | "modifiers": [
24 | "34iy7DqUuLwf6vkhzzMq2i8SF2wKd3D5uhvYE8YeJ3CVHgYe"
25 | ],
26 | "blockchain": "Stafi"
27 | },
28 | {
29 | "modifiers": [],
30 | "blockchain": "Stafi"
31 | }
32 | ]
--------------------------------------------------------------------------------
/tests/fixtures/NestProtocol.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://nestprotocol.org:443",
4 | "method": "GET",
5 | "path": "/nestapi/circulation",
6 | "body": "",
7 | "status": 200,
8 | "response": 1664623596,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.1.10",
12 | "Date",
13 | "Mon, 31 Aug 2020 16:38:16 GMT",
14 | "Content-Type",
15 | "application/json;charset=UTF-8",
16 | "Transfer-Encoding",
17 | "chunked",
18 | "Connection",
19 | "keep-alive"
20 | ],
21 | "responseIsBinary": false
22 | }
23 | ]
--------------------------------------------------------------------------------
/examples/getSupplyEth.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const modifiers = [
6 | '0x0000000000000000000000000000000000000000',
7 | '0x0000000000000000000000000000000000000001',
8 | '0x5AbFEc25f74Cd88437631a7731906932776356f9',
9 | '0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb',
10 | '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae',
11 | ];
12 |
13 | const drivers = supplies.selectDriversByBlockchain('Ethereum');
14 |
15 | const driver = new supplies[drivers[0]]({
16 | secret: 'freekey',
17 | });
18 |
19 | const coin = new Coin({ modifiers });
20 |
21 | driver
22 | .getSupply(coin)
23 | .then((supply) => {
24 | console.log(supply);
25 | });
26 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/tests/fixtures/Iridium.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.ird.cash:443",
4 | "method": "GET",
5 | "path": "/issued",
6 | "body": "",
7 | "status": 200,
8 | "response": 23186664.19090296,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx",
12 | "Date",
13 | "Sat, 26 Jun 2021 20:27:24 GMT",
14 | "Content-Type",
15 | "application/json",
16 | "Transfer-Encoding",
17 | "chunked",
18 | "Connection",
19 | "keep-alive",
20 | "Vary",
21 | "Accept-Encoding"
22 | ],
23 | "responseIsBinary": false
24 | }
25 | ]
--------------------------------------------------------------------------------
/lib/supplies.js:
--------------------------------------------------------------------------------
1 | const Coin = require('./models/coin');
2 | const drivers = require('./drivers');
3 |
4 | const names = Object.keys(drivers);
5 |
6 | const blockchains = names
7 | .flatMap((name) => {
8 | const driver = new drivers[name]();
9 | return driver.supports.blockchains;
10 | })
11 | // Distinct
12 | .filter((value, index, self) => self.indexOf(value) === index)
13 | .sort();
14 |
15 | const selectDriversByBlockchain = (blockchain) => names.filter((name) => {
16 | const driver = new drivers[name]();
17 |
18 | return driver.supports.blockchains.includes(blockchain);
19 | });
20 |
21 | module.exports = {
22 | Coin,
23 | ...drivers,
24 | drivers: names,
25 | blockchains,
26 | selectDriversByBlockchain,
27 | };
28 |
--------------------------------------------------------------------------------
/examples/getSupplyStellar.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const drivers = supplies.selectDriversByBlockchain('Stellar');
6 |
7 | const driver = new supplies[drivers[0]]();
8 |
9 | const coin = new Coin({
10 | name: 'Stellar',
11 | symbol: 'XML',
12 | modifiers: [
13 | 'GANOI26P6VAUL4NFVA4FAIOIBOR46NORONBIWUPRIGAMP7T5W5MOY4O6',
14 | 'GAX3BRBNB5WTJ2GNEFFH7A4CZKT2FORYABDDBZR5FIIT3P7FLS2EFOZZ',
15 | 'GB6NVEN5HSUBKMYCE5ZOWSK5K23TBWRUQLZY3KNMXUZ3AQ2ESC4MY4AQ',
16 | 'GDKIJJIKXLOM2NRMPNQZUUYK24ZPVFC6426GZAEP3KUK6KEJLACCWNMX',
17 | 'GDUY7J7A33TQWOSOQGDO776GGLM3UQERL4J3SPT56F6YS4ID7MLDERI4',
18 | ],
19 | });
20 |
21 | driver
22 | .getSupply(coin)
23 | .then((supply) => {
24 | console.log(supply);
25 | });
26 |
--------------------------------------------------------------------------------
/tests/coins/ChainNemNinja.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "NEM",
4 | "symbol": "XEM",
5 | "modifiers": [
6 | "NAFUNDAFO2MHWRR446YHADKR43XQBDJGWFRTMICH",
7 | "NAFUNDBUKIOSTMD4BNXL7ZFE735QHN7A3FBS6CMY",
8 | "NAFUNDCJBFWXJWQZITUJOIW4O3E6YHQYQYSISPVA",
9 | "NAFUNDDWQUHMIKPV2JUH2VNCYEAQX3O7QKHECZUV",
10 | "NAFUNDEULL67VO7WCJBGBHCLCMD5KEH5EI7G5SGR",
11 | "NAFUNDHZWSIV4ARXSGGSFONCGFGYTLCB7VOT53SR",
12 | "NCMARKECQXP3SQZSJPCBKOQWIXRRI7LIS4FTU4VZ",
13 | "NCONTRLFKPO6YVXO5WUIJ4SWSCSKBJIPV456RSCL",
14 | "NCOPERAWEWCD4A34NP5UQCCKEX44MW4SL3QYJYS5",
15 | "NCYZGD-BDTZ42-7NJVPU-JFINWY-PAQBPE-K4OBSS-7MGZ",
16 | "NDEVPOSK4OMR4PRTLYFHX4W5QTOND7TZDT2DTU4Q",
17 | "NDEVPRE5ZWVG2PXSM54BGZBFF525G24UKVOGOZNT"
18 | ]
19 | }
20 | ]
--------------------------------------------------------------------------------
/examples/getSupplyDra.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const drivers = supplies.selectDriversByBlockchain('Stellar');
6 |
7 | const driver = new supplies[drivers[0]]();
8 |
9 | const coin = new Coin({
10 | name: 'Diruna',
11 | symbol: 'DRA',
12 | reference: 'DRA-GCJKSAQECBGSLPQWAU7ME4LVQVZ6IDCNUA5NVTPPCUWZWBN5UBFMXZ53',
13 | modifiers: [
14 | 'GAZEN4A4O46VUYCRMUBVPDQ6YTWF4ZSCE4Y3PKCZ3GSKCKU556NM2U5D',
15 | 'GDKODINGMBMYDQESMBQO6M2G3AGAEEFPPBERILEF4G7INZZFLVJSDJ67',
16 | 'GCVSWYNTAN253YGUSBUJ743BI6VPLUTPFDU42NFVWJ4CCHPWUPZ6BTSF',
17 | 'GCJ25DM72KJ2P5R3AS65V44RANWFIVAWMODA27M53HXN5NMQGUKWMUSV',
18 | ],
19 | });
20 |
21 | driver
22 | .getSupply(coin)
23 | .then((supply) => {
24 | console.log(supply);
25 | });
26 |
--------------------------------------------------------------------------------
/tests/fixtures/BitcoinVault.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://api.bitcoinvault.global:80",
4 | "method": "GET",
5 | "path": "/status",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "hashrate": 4691015716494019000,
10 | "height": 55715,
11 | "total_coin_supply": 9103649.99999976
12 | },
13 | "rawHeaders": [
14 | "Server",
15 | "nginx/1.17.8",
16 | "Date",
17 | "Thu, 29 Oct 2020 13:37:15 GMT",
18 | "Content-Type",
19 | "application/json",
20 | "Content-Length",
21 | "87",
22 | "Connection",
23 | "keep-alive"
24 | ],
25 | "responseIsBinary": false
26 | }
27 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Near.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.near.org:443",
4 | "method": "GET",
5 | "path": "/api/circulating-supply",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "timestamp": 1620604800,
10 | "circulating_supply_in_yoctonear": "372406368000000000000000000000000"
11 | },
12 | "rawHeaders": [
13 | "Content-Type",
14 | "application/json; charset=utf-8",
15 | "Date",
16 | "Mon, 10 May 2021 14:44:07 GMT",
17 | "Etag",
18 | "\"5e-NjbwsE3/5pdqgyL7wf4DLQsT1Lc\"",
19 | "Server",
20 | "Render",
21 | "Vary",
22 | "96"
23 | ],
24 | "responseIsBinary": false
25 | }
26 | ]
--------------------------------------------------------------------------------
/tests/fixtures/PaymentCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://blockexplorer.info:80",
4 | "method": "GET",
5 | "path": "/ajax/blockchain_info.php?method=totalsupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 13366550,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx",
12 | "Date",
13 | "Fri, 26 Mar 2021 18:24:51 GMT",
14 | "Content-Type",
15 | "text/html; charset=UTF-8",
16 | "Content-Length",
17 | "8",
18 | "Connection",
19 | "keep-alive",
20 | "Keep-Alive",
21 | "timeout=60",
22 | "Access-Control-Allow-Origin",
23 | "*"
24 | ],
25 | "responseIsBinary": false
26 | }
27 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Ecomi.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://143.198.76.15:80",
4 | "method": "GET",
5 | "path": "/circulating",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "supply": 188480748973.99683
10 | },
11 | "rawHeaders": [
12 | "Server",
13 | "nginx/1.17.10 (Ubuntu)",
14 | "Date",
15 | "Fri, 21 May 2021 15:46:45 GMT",
16 | "Content-Type",
17 | "application/json; charset=utf-8",
18 | "Content-Length",
19 | "29",
20 | "Connection",
21 | "keep-alive",
22 | "X-Powered-By",
23 | "Express",
24 | "ETag",
25 | "W/\"1d-uLWs0doCSY+Pq7/lRbh7YoCjrLQ\""
26 | ],
27 | "responseIsBinary": false
28 | }
29 | ]
--------------------------------------------------------------------------------
/tests/coins/Etherscan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "symbol": "ETH",
4 | "name": "Ethereum",
5 | "modifiers": [
6 | "0x0000000000000000000000000000000000000000",
7 | "0x0000000000000000000000000000000000000001",
8 | "0x5AbFEc25f74Cd88437631a7731906932776356f9",
9 | "0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb",
10 | "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae"
11 | ]
12 | },
13 | {
14 | "symbol": "BAT",
15 | "name": "Basic Attention Token",
16 | "reference": "0x0d8775f648430679a709e98d2b0cb6250d2887ef",
17 | "modifiers": [
18 | "0x0000000000000000000000000000000000000000",
19 | "0x0000000000000000000000000000000000000001",
20 | "0x185f19b43d818e10a31be68f445ef8edcb8afb83",
21 | "0x67fa2c06c9c6d4332f330e14a66bdf1873ef3d2b",
22 | "0x7c31560552170ce96c4a7b018e93cddc19dc61b6"
23 | ]
24 | }
25 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Filecoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.node.glif.io:443",
4 | "method": "GET",
5 | "path": "/statecirculatingsupply/fil",
6 | "body": "",
7 | "status": 200,
8 | "response": 21832718,
9 | "rawHeaders": [
10 | "Date",
11 | "Mon, 26 Oct 2020 17:52:16 GMT",
12 | "Content-Type",
13 | "application/json",
14 | "Content-Length",
15 | "8",
16 | "Connection",
17 | "keep-alive",
18 | "x-amzn-RequestId",
19 | "6fca51c8-9b80-43eb-b339-03431bb43d50",
20 | "x-amz-apigw-id",
21 | "VB7wfGpKCYcFseQ=",
22 | "X-Amzn-Trace-Id",
23 | "Root=1-5f970ccf-7ed908a367d36a4d5b8e6131;Sampled=0"
24 | ],
25 | "responseIsBinary": false
26 | }
27 | ]
--------------------------------------------------------------------------------
/examples/getSupplyBat.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const drivers = supplies.selectDriversByBlockchain('Ethereum');
6 |
7 | const driver = new supplies[drivers[0]]({
8 | secret: 'freekey',
9 | });
10 |
11 | const coin = new Coin({
12 | name: 'Basic Attention Token',
13 | symbol: 'BAT',
14 | reference: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
15 | modifiers: [
16 | '0x0000000000000000000000000000000000000000', // Burned
17 | '0x0000000000000000000000000000000000000001', // Burned
18 | '0x185f19b43d818e10a31be68f445ef8edcb8afb83', // Multisig
19 | '0x67fa2c06c9c6d4332f330e14a66bdf1873ef3d2b', // Team Lock up
20 | '0x7c31560552170ce96c4a7b018e93cddc19dc61b6', // UGP reserve
21 | ],
22 | decimals: 18,
23 | });
24 |
25 | driver
26 | .getSupply(coin)
27 | .then((supply) => {
28 | console.log(supply);
29 | });
30 |
--------------------------------------------------------------------------------
/tests/fixtures/FixNetwork.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://chain.review:443",
4 | "method": "GET",
5 | "path": "/api/db/fix/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": "7938475671.890871",
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.18.0 (Ubuntu)",
12 | "Date",
13 | "Tue, 01 Jun 2021 17:42:38 GMT",
14 | "Content-Type",
15 | "application/json; charset=utf-8",
16 | "Content-Length",
17 | "19",
18 | "Connection",
19 | "keep-alive",
20 | "X-Powered-By",
21 | "Express",
22 | "Access-Control-Allow-Origin",
23 | "*",
24 | "ETag",
25 | "W/\"13-CfbHm8sAVpG0xmuiVJO7CCaDx+o\""
26 | ],
27 | "responseIsBinary": false
28 | }
29 | ]
--------------------------------------------------------------------------------
/tests/coins/Stellar.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Stellar",
4 | "symbol": "XML",
5 | "modifiers": [
6 | "GANOI26P6VAUL4NFVA4FAIOIBOR46NORONBIWUPRIGAMP7T5W5MOY4O6",
7 | "GAX3BRBNB5WTJ2GNEFFH7A4CZKT2FORYABDDBZR5FIIT3P7FLS2EFOZZ",
8 | "GB6NVEN5HSUBKMYCE5ZOWSK5K23TBWRUQLZY3KNMXUZ3AQ2ESC4MY4AQ",
9 | "GDKIJJIKXLOM2NRMPNQZUUYK24ZPVFC6426GZAEP3KUK6KEJLACCWNMX",
10 | "GDUY7J7A33TQWOSOQGDO776GGLM3UQERL4J3SPT56F6YS4ID7MLDERI4"
11 | ]
12 | },
13 | {
14 | "name": "Diruna",
15 | "symbol": "DRA",
16 | "reference": "DRA-GCJKSAQECBGSLPQWAU7ME4LVQVZ6IDCNUA5NVTPPCUWZWBN5UBFMXZ53",
17 | "modifiers": [
18 | "GAZEN4A4O46VUYCRMUBVPDQ6YTWF4ZSCE4Y3PKCZ3GSKCKU556NM2U5D",
19 | "GDKODINGMBMYDQESMBQO6M2G3AGAEEFPPBERILEF4G7INZZFLVJSDJ67",
20 | "GCVSWYNTAN253YGUSBUJ743BI6VPLUTPFDU42NFVWJ4CCHPWUPZ6BTSF",
21 | "GCJ25DM72KJ2P5R3AS65V44RANWFIVAWMODA27M53HXN5NMQGUKWMUSV"
22 | ]
23 | }
24 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Bbscoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://mine.bbscoin.click:80",
4 | "method": "GET",
5 | "path": "/circulation/bbscoin/precision/",
6 | "body": "",
7 | "status": 200,
8 | "response": 108079202682.11116,
9 | "rawHeaders": [
10 | "Date",
11 | "Mon, 10 May 2021 16:34:44 GMT",
12 | "Server",
13 | "Apache/2.4.46 (Ubuntu)",
14 | "Upgrade",
15 | "h2,h2c",
16 | "Connection",
17 | "Upgrade, close",
18 | "Cache-Control",
19 | "max-age=0, no-cache, no-store, must-revalidate",
20 | "Pragma",
21 | "no-cache",
22 | "Expires",
23 | "Wed, 11 Jan 1984 05:00:00 GMT",
24 | "Content-Length",
25 | "21",
26 | "Content-Type",
27 | "text/plain"
28 | ],
29 | "responseIsBinary": false
30 | }
31 | ]
--------------------------------------------------------------------------------
/examples/getSupplyNem.js:
--------------------------------------------------------------------------------
1 | const supplies = require('..');
2 |
3 | const { Coin } = supplies;
4 |
5 | const modifiers = [
6 | 'NAFUNDAFO2MHWRR446YHADKR43XQBDJGWFRTMICH',
7 | 'NAFUNDBUKIOSTMD4BNXL7ZFE735QHN7A3FBS6CMY',
8 | 'NAFUNDCJBFWXJWQZITUJOIW4O3E6YHQYQYSISPVA',
9 | 'NAFUNDDWQUHMIKPV2JUH2VNCYEAQX3O7QKHECZUV',
10 | 'NAFUNDEULL67VO7WCJBGBHCLCMD5KEH5EI7G5SGR',
11 | 'NAFUNDHZWSIV4ARXSGGSFONCGFGYTLCB7VOT53SR',
12 | 'NCMARKECQXP3SQZSJPCBKOQWIXRRI7LIS4FTU4VZ',
13 | 'NCONTRLFKPO6YVXO5WUIJ4SWSCSKBJIPV456RSCL',
14 | 'NCOPERAWEWCD4A34NP5UQCCKEX44MW4SL3QYJYS5',
15 | 'NCYZGD-BDTZ42-7NJVPU-JFINWY-PAQBPE-K4OBSS-7MGZ',
16 | 'NDEVPOSK4OMR4PRTLYFHX4W5QTOND7TZDT2DTU4Q',
17 | 'NDEVPRE5ZWVG2PXSM54BGZBFF525G24UKVOGOZNT',
18 | ];
19 |
20 | const drivers = supplies.selectDriversByBlockchain('Nem');
21 |
22 | const driver = new supplies[drivers[0]]();
23 |
24 | const coin = new Coin({ modifiers });
25 |
26 | driver
27 | .getSupply(coin)
28 | .then((supply) => {
29 | console.log(supply);
30 | });
31 |
--------------------------------------------------------------------------------
/lib/drivers/cache-gold.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * CacheGold driver. Supports total supply
6 | * for CGT token ow Ethereum blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class CacheGold extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 200, // 5 requests per second
15 | options,
16 | });
17 | }
18 |
19 | /**
20 | * @augments Driver.fetchTotalSupply
21 | * @async
22 | */
23 | async fetchTotalSupply() {
24 | const total = await this.request(
25 | 'https://contract.cache.gold/api/totalSupplyDec',
26 | );
27 | return Number(total);
28 | }
29 |
30 | /**
31 | * @augments Driver.getSupply
32 | * @async
33 | */
34 | async getSupply() {
35 | const total = await this.fetchTotalSupply();
36 |
37 | return new Supply({
38 | total,
39 | });
40 | }
41 | }
42 |
43 | module.exports = CacheGold;
44 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/tests/fixtures/Wownero.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explore.wownero.com:443",
4 | "method": "GET",
5 | "path": "/api/emission",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "data": {
10 | "blk_no": 318559,
11 | "coinbase": 4832896733178538000,
12 | "fee": 1620454628257000
13 | },
14 | "status": "success"
15 | },
16 | "rawHeaders": [
17 | "Server",
18 | "nginx/1.14.0 (Ubuntu)",
19 | "Date",
20 | "Fri, 21 May 2021 16:45:27 GMT",
21 | "Content-Type",
22 | "application/json",
23 | "Content-Length",
24 | "99",
25 | "Connection",
26 | "keep-alive",
27 | "Access-Control-Allow-Origin",
28 | "*",
29 | "Access-Control-Allow-Headers",
30 | "Content-Type"
31 | ],
32 | "responseIsBinary": false
33 | }
34 | ]
--------------------------------------------------------------------------------
/lib/throttle.js:
--------------------------------------------------------------------------------
1 | class Throttle {
2 | constructor(timeout) {
3 | this.running = false;
4 | this.timeout = timeout;
5 | this.queue = [];
6 | }
7 |
8 | static sleep(ms) {
9 | // eslint-disable-next-line no-promise-executor-return
10 | return new Promise((resolve) => setTimeout(resolve, ms));
11 | }
12 |
13 | push() {
14 | return new Promise(async (resolve, reject) => { // eslint-disable-line no-async-promise-executor
15 | try {
16 | this.queue.push({ resolve, reject });
17 |
18 | if (!this.running) {
19 | this.running = true;
20 |
21 | while (this.queue.length > 0) {
22 | const { resolve: itemResolve } = this.queue.shift();
23 |
24 | itemResolve();
25 |
26 | await Throttle.sleep(this.timeout); // eslint-disable-line no-await-in-loop
27 | }
28 |
29 | this.running = false;
30 | }
31 | } catch (e) {
32 | reject(e);
33 | }
34 | });
35 | }
36 | }
37 |
38 | module.exports = Throttle;
39 |
--------------------------------------------------------------------------------
/lib/drivers/payment-coin.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Payment coin driver. Supports total supply
6 | * on own blockchain.
7 | *
8 | * @augments Driver
9 | * @memberof Driver
10 | */
11 | class PaymentCoin extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | total: true,
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * @augments Driver.fetchTotalSupply
24 | * @async
25 | */
26 | async fetchTotalSupply() {
27 | const total = await this.request('http://blockexplorer.info/ajax/blockchain_info.php?method=totalsupply');
28 |
29 | return Number(total);
30 | }
31 |
32 | /**
33 | * @augments Driver.getSupply
34 | */
35 | async getSupply() {
36 | const total = await this.fetchTotalSupply();
37 |
38 | return new Supply({
39 | total,
40 | });
41 | }
42 | }
43 |
44 | module.exports = PaymentCoin;
45 |
--------------------------------------------------------------------------------
/lib/drivers/haven.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Haven driver. Supports total supply
6 | * for native coin XHV on own blockchain Haven.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Haven extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 200, // 5 requests per second
15 | supports: {
16 | total: true,
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * @augments Driver.fetchCirculatingSupply
24 | */
25 | async fetchTotalSupply() {
26 | const { data: { coinbase: total } } = await this.request('https://explorer.havenprotocol.org/api/emission');
27 |
28 | return Number(total) / 10 ** 12;
29 | }
30 |
31 | /**
32 | * @augments Driver.getSupply
33 | */
34 | async getSupply() {
35 | const total = await this.fetchTotalSupply();
36 |
37 | return new Supply({
38 | total,
39 | });
40 | }
41 | }
42 |
43 | module.exports = Haven;
44 |
--------------------------------------------------------------------------------
/tests/fixtures/EasyFi.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.easyfi.network:443",
4 | "method": "GET",
5 | "path": "/api/cmc",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "cmc": 1369336.1558931004
10 | },
11 | "rawHeaders": [
12 | "Content-Type",
13 | "application/json; charset=utf-8",
14 | "ETag",
15 | "W/\"1a-93KJC6ma3ctNIEUAenQAW+ZJ75A\"",
16 | "X-Powered-By",
17 | "Express",
18 | "Access-Control-Allow-Origin",
19 | "*",
20 | "Access-Control-Allow-Headers",
21 | "Origin, X-Requested-With, Content-Type, Accept, Authorization",
22 | "Access-Control-Allow-Methods",
23 | "GET, POST",
24 | "X-Powered-By",
25 | "ARR/3.0",
26 | "Date",
27 | "Fri, 22 Jan 2021 21:28:17 GMT",
28 | "Content-Length",
29 | "26"
30 | ],
31 | "responseIsBinary": false
32 | }
33 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Banano.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.creeper.banano.cc:443",
4 | "method": "GET",
5 | "path": "/supply",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "circulating": 1239824044.155531,
10 | "uncirculating": 679621344.4163083,
11 | "burned": 1483378280.6281605,
12 | "total": 1919445388.5718393
13 | },
14 | "rawHeaders": [
15 | "Server",
16 | "nginx/1.14.0 (Ubuntu)",
17 | "Date",
18 | "Tue, 11 May 2021 17:15:47 GMT",
19 | "Content-Type",
20 | "application/json; charset=utf-8",
21 | "Content-Length",
22 | "122",
23 | "Connection",
24 | "keep-alive",
25 | "X-Powered-By",
26 | "Express",
27 | "Access-Control-Allow-Origin",
28 | "*",
29 | "ETag",
30 | "W/\"7a-Ug+oIFraSH76YxC7xnEKQHg8Tg8\""
31 | ],
32 | "responseIsBinary": false
33 | }
34 | ]
--------------------------------------------------------------------------------
/lib/models/supply-modifier.js:
--------------------------------------------------------------------------------
1 | /**
2 | * One or more supply modifiers are used to calculate the circulating supply.
3 | * A supply modifier is a balance on a specific address, that holds a balance. E.g. for ethereum
4 | * the balance of address 0x0000000000000000000000000000000000000000 is substracted, because tokens
5 | * are sent there to get 'burned'. These burned tokens do exist on the blockchain, but because they
6 | * are not available to the public they are 'circulating'. So the 'total supply' minus these
7 | * supply modifiers result in the 'circulating supply'. Also see {@link Supply}.
8 | *
9 | * @namespace SupplyModifier
10 | * @class
11 | * @property {object} options The parameters of the supply modifier
12 | * @property {string} options.reference
13 | * A unique identifier. An address that holds a balance.
14 | * @property {number} options.balance
15 | * The balance of the adress.
16 | */
17 | class SupplyModifier {
18 | constructor(options) {
19 | this.reference = options.reference;
20 | this.balance = options.balance;
21 | }
22 | }
23 |
24 | module.exports = SupplyModifier;
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Coinranking
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/lib/drivers/blockscan.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Blockscan driver. Supports total
6 | * supply for Grin token.
7 | *
8 | * @augments Driver
9 | * @memberof Driver
10 | */
11 | class Blockscan extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | total: true,
17 | blockchains: ['Grin'],
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * get total supply for Grin
25 | *
26 | * @augments Driver.fetchTotalSupply
27 | */
28 | async fetchTotalSupply() {
29 | const { result } = await this.request(
30 | 'https://api-grin.blockscan.com/v1/api?module=stats&action=grinsupply',
31 | );
32 |
33 | return Number(result);
34 | }
35 |
36 | /**
37 | * @augments Driver.getSupply
38 | * @async
39 | */
40 | async getSupply() {
41 | const total = await this.fetchTotalSupply();
42 |
43 | return new Supply({
44 | total,
45 | });
46 | }
47 | }
48 |
49 | module.exports = Blockscan;
50 |
--------------------------------------------------------------------------------
/tests/fixtures/HederaHashgraph.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://hash-hash.info:443",
4 | "method": "GET",
5 | "path": "/rest/stats/circulating-supply-no-decimal",
6 | "body": "",
7 | "status": 200,
8 | "response": "3,377,366,918",
9 | "rawHeaders": [
10 | "Date",
11 | "Fri, 13 Mar 2020 22:30:59 GMT",
12 | "Content-Type",
13 | "text/plain;charset=UTF-8",
14 | "Content-Length",
15 | "13",
16 | "Connection",
17 | "keep-alive",
18 | "Set-Cookie",
19 | "__cfduid=d55c536083592925f81144fc295e10cda1584138658; expires=Sun, 12-Apr-20 22:30:58 GMT; path=/; domain=.hash-hash.info; HttpOnly; SameSite=Lax; Secure",
20 | "CF-Cache-Status",
21 | "DYNAMIC",
22 | "Expect-CT",
23 | "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
24 | "Server",
25 | "cloudflare",
26 | "CF-RAY",
27 | "573933d78cfde718-EWR"
28 | ],
29 | "responseIsBinary": false
30 | }
31 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Solana.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.mainnet-beta.solana.com:443",
4 | "method": "GET",
5 | "path": "/v0/total-supply",
6 | "body": "",
7 | "status": 200,
8 | "response": 488621097.2288002,
9 | "rawHeaders": [
10 | "content-length",
11 | "17",
12 | "date",
13 | "Wed, 02 Sep 2020 11:10:40 GMT",
14 | "Via",
15 | "1.1 google",
16 | "Alt-Svc",
17 | "clear"
18 | ],
19 | "responseIsBinary": false
20 | },
21 | {
22 | "scope": "https://api.mainnet-beta.solana.com:443",
23 | "method": "GET",
24 | "path": "/v0/circulating-supply",
25 | "body": "",
26 | "status": 200,
27 | "response": 32691561.39411291,
28 | "rawHeaders": [
29 | "content-length",
30 | "17",
31 | "date",
32 | "Wed, 02 Sep 2020 11:10:41 GMT",
33 | "Via",
34 | "1.1 google",
35 | "Alt-Svc",
36 | "clear"
37 | ],
38 | "responseIsBinary": false
39 | }
40 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Polygonscan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.polygonscan.com:443",
4 | "method": "GET",
5 | "path": "/api?module=stats&action=maticsupply&apikey=maskedSecret",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "status": "1",
10 | "message": "OK",
11 | "result": "9319469069284930000000000000"
12 | },
13 | "rawHeaders": [
14 | "Server",
15 | "nginx",
16 | "Date",
17 | "Thu, 03 Aug 2023 04:09:02 GMT",
18 | "Content-Type",
19 | "175",
20 | "Connection",
21 | "keep-alive",
22 | "Cache-Control",
23 | "private",
24 | "Vary",
25 | "Accept-Encoding",
26 | "Access-Control-Allow-Origin",
27 | "*",
28 | "Access-Control-Allow-Headers",
29 | "Content-Type",
30 | "Access-Control-Allow-Methods",
31 | "GET, POST, OPTIONS",
32 | "X-Frame-Options",
33 | "SAMEORIGIN"
34 | ],
35 | "responseIsBinary": false
36 | }
37 | ]
--------------------------------------------------------------------------------
/lib/drivers/reddcoin.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Reddcoin driver. Supports
6 | * circulating supply for native
7 | * token on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Reddcoin extends Driver {
13 | constructor(options) {
14 | super({
15 | supports: {
16 | circulating: true,
17 | total: false,
18 | blockchains: ['Reddcoin'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * get circulating supply for native token
26 | *
27 | * @augments Driver.fetchCirculatingSupply
28 | * @async
29 | */
30 | async fetchCirculatingSupply() {
31 | const { info: { moneysupply: circulating } } = await this.request('https://live.reddcoin.com/api/status?q=getInfo');
32 |
33 | return Number(circulating);
34 | }
35 |
36 | /**
37 | * @augments Driver.getSupply
38 | * @async
39 | */
40 | async getSupply() {
41 | const circulating = await this.fetchCirculatingSupply();
42 |
43 | return new Supply({
44 | circulating,
45 | });
46 | }
47 | }
48 |
49 | module.exports = Reddcoin;
50 |
--------------------------------------------------------------------------------
/tests/coins/CryptoID.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modifiers": [
4 | "M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua"
5 | ],
6 | "blockchain": "Litecoin"
7 | },
8 | {
9 | "modifiers": [
10 | "XtAG1982HcYJVibHxRZrBmdzL5YTzj4cA1"
11 | ],
12 | "blockchain": "Dash"
13 | },
14 | {
15 | "modifiers": [],
16 | "blockchain": "Dash"
17 | },
18 | {
19 | "modifiers": [],
20 | "blockchain": "Litecoin"
21 | },
22 | {
23 | "modifiers": [],
24 | "blockchain": "DigiByte"
25 | },
26 | {
27 | "modifiers": [],
28 | "blockchain": "BolivarCoin"
29 | },
30 | {
31 | "modifiers": [],
32 | "blockchain": "Trollcoin"
33 | },
34 | {
35 | "modifiers": [],
36 | "blockchain": "Pivx"
37 | },
38 | {
39 | "modifiers": [],
40 | "blockchain": "Stratis"
41 | },
42 | {
43 | "modifiers": [],
44 | "blockchain": "NavCoin"
45 | },
46 | {
47 | "modifiers": [],
48 | "blockchain": "Particl"
49 | },
50 | {
51 | "modifiers": [],
52 | "blockchain": "KnoxFS"
53 | },
54 | {
55 | "modifiers": [],
56 | "blockchain": "NewYorkCoin"
57 | },
58 | {
59 | "modifiers": [],
60 | "blockchain": "Fastcoin"
61 | }
62 | ]
--------------------------------------------------------------------------------
/lib/drivers/oasis.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Oasis driver. Supports circulating supply
6 | * for DIA token on Ethereum blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Oasis extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | circulating: true,
17 | total: false,
18 | blockchains: ['Dai'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * fetch circulating supply for native token
26 | *
27 | * @augments Driver.fetchCirculatingSupply
28 | * @async
29 | */
30 | async fetchCirculatingSupply() {
31 | const { data: circulating } = await this.request(
32 | 'https://api.oasis.app/v1/supply/dai',
33 | );
34 |
35 | return Number(circulating) / 10 ** 8;
36 | }
37 |
38 | /**
39 | * @augments Driver.getSupply
40 | * @async
41 | */
42 | async getSupply() {
43 | const circulating = await this.fetchCirculatingSupply();
44 |
45 | return new Supply({
46 | circulating,
47 | });
48 | }
49 | }
50 |
51 | module.exports = Oasis;
52 |
--------------------------------------------------------------------------------
/tests/fixtures/Zilliqa.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.viewblock.io:443",
4 | "method": "GET",
5 | "path": "/v1/zilliqa/addresses/zil1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq9yf6pz",
6 | "body": "",
7 | "status": 200,
8 | "response": [
9 | {
10 | "hash": "zil1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq9yf6pz",
11 | "balance": "7746401020075497110143",
12 | "nonce": 0,
13 | "type": "normal"
14 | }
15 | ],
16 | "rawHeaders": [
17 | "Access-Control-Allow-Headers",
18 | "Origin, X-APIKEY, X-Requested-With, Content-Type, Accept, Authorization",
19 | "Access-Control-Allow-Origin",
20 | "*",
21 | "Content-Type",
22 | "application/json; charset=utf-8",
23 | "Date",
24 | "Tue, 10 Mar 2020 11:35:42 GMT",
25 | "ETag",
26 | "W/\"74-JHqdv1I8pboQy4Mh5QOVi4iIaRo\"",
27 | "Server",
28 | "nginx/1.14.1",
29 | "X-Powered-By",
30 | "99",
31 | "Connection",
32 | "keep-alive"
33 | ],
34 | "responseIsBinary": false
35 | }
36 | ]
--------------------------------------------------------------------------------
/lib/drivers/bbscoin.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * BBScoin driver. Support
6 | * max and total supply for BBS token
7 | * on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Bbscoin extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | max: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * @augments Driver.fetchMaxSupply
25 | * @async
26 | */
27 | fetchMaxSupply() {
28 | return 184470000000;
29 | }
30 |
31 | /**
32 | * @augments Driver.fetchTotalSupply
33 | * @async
34 | */
35 | async fetchTotalSupply() {
36 | const total = await this.request('http://mine.bbscoin.click/circulation/bbscoin/precision/');
37 |
38 | return Number(total);
39 | }
40 |
41 | /**
42 | * @augments Driver.getSupply
43 | */
44 | async getSupply() {
45 | const total = await this.fetchTotalSupply();
46 | const max = this.fetchMaxSupply();
47 |
48 | return new Supply({
49 | total,
50 | max,
51 | });
52 | }
53 | }
54 |
55 | module.exports = Bbscoin;
56 |
--------------------------------------------------------------------------------
/lib/drivers/wownero.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Wownero driver. Supports max
6 | * and total supply for WOW native
7 | * coin on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Wownero extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | max: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * @augments Driver.fetchMaxSupply
25 | */
26 | fetchMaxSupply() {
27 | return 184467440;
28 | }
29 |
30 | /**
31 | * @augments Driver.fetchTotalSupply
32 | * @async
33 | */
34 | async fetchTotalSupply() {
35 | const { data: { coinbase: total } } = await this.request('https://explore.wownero.com/api/emission');
36 |
37 | return Number(total) / 10 ** 11;
38 | }
39 |
40 | /**
41 | * @augments Driver.getSupply
42 | */
43 | async getSupply() {
44 | const total = await this.fetchTotalSupply();
45 | const max = this.fetchMaxSupply();
46 |
47 | return new Supply({
48 | total,
49 | max,
50 | });
51 | }
52 | }
53 |
54 | module.exports = Wownero;
55 |
--------------------------------------------------------------------------------
/lib/drivers/ecomi.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Ecomi driver. Supports total and max
6 | * supply for OMI coin on GoChain blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Ecomi extends Driver {
12 | constructor(options) {
13 | super({
14 | supports: {
15 | max: true,
16 | circulating: false,
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * get max supply
24 | *
25 | * @augments Driver.fetchMaxSupply
26 | */
27 | fetchMaxSupply() {
28 | return 750000000000;
29 | }
30 |
31 | /**
32 | * get total supply for native token
33 | *
34 | * @augments Driver.fetchTotalSupply
35 | * @async
36 | */
37 | async fetchTotalSupply() {
38 | const { supply } = await this.request('http://143.198.76.15/circulating');
39 |
40 | return Number(supply);
41 | }
42 |
43 | /**
44 | * @augments Driver.getSupply
45 | */
46 | async getSupply() {
47 | const total = await this.fetchTotalSupply();
48 | const max = this.fetchMaxSupply();
49 |
50 | return new Supply({
51 | max,
52 | total,
53 | });
54 | }
55 | }
56 |
57 | module.exports = Ecomi;
58 |
--------------------------------------------------------------------------------
/lib/drivers/bitcoin-vault.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Bitcoin Vault driver. Supports total supply for BTCV
6 | * using Bitcoin Vault blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class BitcoinVault extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | circulating: false,
17 | max: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * @augments Driver.fetchTotalSupply
25 | * @async
26 | */
27 | async fetchTotalSupply() {
28 | const { total_coin_supply: totalCoinSupply } = await this.request('http://api.bitcoinvault.global/status');
29 | return Number(totalCoinSupply);
30 | }
31 |
32 | /**
33 | * @augments Driver.fetchMaxSupply
34 | */
35 | fetchMaxSupply() {
36 | return 21000000;
37 | }
38 |
39 | /**
40 | * @augments Driver.getSupply
41 | */
42 | async getSupply() {
43 | const total = await this.fetchTotalSupply();
44 | const max = this.fetchMaxSupply();
45 |
46 | return new Supply({
47 | total,
48 | max,
49 | });
50 | }
51 | }
52 |
53 | module.exports = BitcoinVault;
54 |
--------------------------------------------------------------------------------
/lib/drivers/electric-cash.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * ElectricCash driver. Supports total and max
6 | * supply for ELCASH coin on own blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class ElectricCash extends Driver {
12 | constructor(options) {
13 | super({
14 | supports: {
15 | total: true,
16 | max: true,
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * get max supply
24 | *
25 | * @augments Driver.fetchMaxSupply
26 | */
27 | fetchMaxSupply() {
28 | return 21000000;
29 | }
30 |
31 | /**
32 | * get total supply for native token
33 | *
34 | * @augments Driver.fetchTotalSupply
35 | * @async
36 | */
37 | async fetchTotalSupply() {
38 | const total = await this.request('https://api.electriccash.global/totalsupply');
39 |
40 | return Number(total);
41 | }
42 |
43 | /**
44 | * @augments Driver.getSupply
45 | */
46 | async getSupply() {
47 | const total = await this.fetchTotalSupply();
48 | const max = this.fetchMaxSupply();
49 |
50 | return new Supply({
51 | total,
52 | max,
53 | });
54 | }
55 | }
56 |
57 | module.exports = ElectricCash;
58 |
--------------------------------------------------------------------------------
/lib/drivers/cirquity.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Cirquity driver. Supports total and
6 | * max supply for CIRQ token on
7 | * Cirquity blockchain.
8 | *
9 | * @augments Driver
10 | * @memberof Driver
11 | */
12 | class Cirquity extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 200, // 5 requests per second
16 | supports: {
17 | max: true,
18 | blockchains: ['Cirquity'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * @augments Driver.fetchMaxSupply
26 | */
27 | fetchMaxSupply() {
28 | return 1000000000000;
29 | }
30 |
31 | /**
32 | * @augments Driver.fetchTotalSupply
33 | * @async
34 | */
35 | async fetchTotalSupply() {
36 | const total = await this.request('https://explorer.cirquity.com/api/supply/atomic');
37 |
38 | return Number(total / 10 ** 2);
39 | }
40 |
41 | /**
42 | * @augments Driver.getSupply
43 | * @async
44 | */
45 | async getSupply() {
46 | const total = await this.fetchTotalSupply();
47 | const max = this.fetchMaxSupply();
48 |
49 | return new Supply({
50 | total,
51 | max,
52 | });
53 | }
54 | }
55 |
56 | module.exports = Cirquity;
57 |
--------------------------------------------------------------------------------
/lib/drivers/modic.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Modic driver. Supports circulating
6 | * and max supply on own
7 | * blockchain Modic.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Modic extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 request per second
16 | supports: {
17 | total: false,
18 | max: true,
19 | circulating: true,
20 | },
21 | options,
22 | });
23 | }
24 |
25 | /**
26 | * @augments Driver.fetchMaxSupply
27 | */
28 | fetchMaxSupply() {
29 | return 70000000;
30 | }
31 |
32 | /**
33 | * @augments Driver.fetchCirculatingSupply
34 | * @async
35 | */
36 | async fetchCirculatingSupply() {
37 | const data = await this.request('https://exp.modic.fund/api/getcoinsupply/?legacy=1');
38 |
39 | return Number(data);
40 | }
41 |
42 | /**
43 | * @augments Driver.getSupply
44 | */
45 | async getSupply() {
46 | const circulating = await this.fetchCirculatingSupply();
47 | const max = this.fetchMaxSupply();
48 |
49 | return new Supply({
50 | max,
51 | circulating,
52 | });
53 | }
54 | }
55 |
56 | module.exports = Modic;
57 |
--------------------------------------------------------------------------------
/lib/drivers/unlimited-fiscuss-fyi.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Unlimited Fiscus Governance Coin driver. Supports
6 | * circulating supply on Ethereum
7 | * blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class UnlimitedFiscussFyi extends Driver {
13 | constructor(options) {
14 | super(
15 | {
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | total: false,
19 | circulating: true,
20 | },
21 | },
22 | options,
23 | );
24 | }
25 |
26 | /**
27 | * get circulating supply
28 | *
29 | * @augments Driver.fetchCirculatingSupply
30 | * @async
31 | */
32 | async fetchCirculatingSupply() {
33 | const { circulatingSupply: circulating } = await this.request('https://fiscus.fyi/api/v1/uFFYI/circulatingSupply');
34 | return Number(circulating) / 10 ** 18;
35 | }
36 |
37 | /**
38 | * get supply
39 | *
40 | * @augments Driver.getSupply
41 | */
42 | async getSupply() {
43 | const circulating = await this.fetchCirculatingSupply();
44 |
45 | return new Supply({
46 | circulating,
47 | });
48 | }
49 | }
50 |
51 | module.exports = UnlimitedFiscussFyi;
52 |
--------------------------------------------------------------------------------
/lib/drivers/siastats.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * SiaStats driver. Supports total supply and balance
6 | * for specific wallet address for native token SC on
7 | * Sia blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class SiaStats extends Driver {
13 | constructor(options) {
14 | super(
15 | {
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | total: false,
19 | circulating: true,
20 | blockchains: ['Sia'],
21 | },
22 | },
23 | options,
24 | );
25 | }
26 |
27 | /**
28 | * get total supply for native token
29 | *
30 | * @augments Driver.fetchCirculatingSupply
31 | * @async
32 | */
33 | async fetchCirculatingSupply() {
34 | const { coin_supply: supply } = await this.request('https://siastats.info/dbs/network_status.json');
35 |
36 | return Number(supply);
37 | }
38 |
39 | /**
40 | * get supply
41 | *
42 | * @augments Driver.getSupply
43 | */
44 | async getSupply() {
45 | const circulating = await this.fetchCirculatingSupply();
46 |
47 | return new Supply({
48 | circulating,
49 | });
50 | }
51 | }
52 |
53 | module.exports = SiaStats;
54 |
--------------------------------------------------------------------------------
/lib/drivers/iridium.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Iridium driver. Supports total and max supply on own
6 | * blockchain Iridium.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Iridium extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 request per second
15 | supports: {
16 | total: true,
17 | max: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * get max supply for native token
25 | *
26 | * @augments Driver.fetchMaxSupply
27 | */
28 | fetchMaxSupply() {
29 | return 25000000;
30 | }
31 |
32 | /**
33 | * get total supply of the native token
34 | *
35 | * @augments Driver.fetchTotalSupply
36 | * @async
37 | */
38 | async fetchTotalSupply() {
39 | const total = await this.request('https://explorer.ird.cash/issued');
40 |
41 | return Number(total);
42 | }
43 |
44 | /**
45 | * @augments Driver.getSupply
46 | */
47 | async getSupply() {
48 | const max = this.fetchMaxSupply();
49 | const total = await this.fetchTotalSupply();
50 |
51 | return new Supply({
52 | max,
53 | total,
54 | });
55 | }
56 | }
57 |
58 | module.exports = Iridium;
59 |
--------------------------------------------------------------------------------
/lib/drivers/monerov.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * MoneroV driver. Supports circulating
6 | * and max supply on own
7 | * blockchain MoneroV.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Monerov extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 request per second
16 | supports: {
17 | total: false,
18 | max: true,
19 | circulating: true,
20 | blockchains: ['MoneroV'],
21 | },
22 | options,
23 | });
24 | }
25 |
26 | /**
27 | * @augments Driver.fetchMaxSupply
28 | */
29 | fetchMaxSupply() {
30 | return 27000000;
31 | }
32 |
33 | /**
34 | * @augments Driver.fetchCirculatingSupply
35 | * @async
36 | */
37 | async fetchCirculatingSupply() {
38 | const data = await this.request('https://explorer.monerov.online/api/emission_txt2');
39 | return Number(data);
40 | }
41 |
42 | /**
43 | * @augments Driver.getSupply
44 | */
45 | async getSupply() {
46 | const circulating = await this.fetchCirculatingSupply();
47 | const max = this.fetchMaxSupply();
48 |
49 | return new Supply({
50 | max,
51 | circulating,
52 | });
53 | }
54 | }
55 |
56 | module.exports = Monerov;
57 |
--------------------------------------------------------------------------------
/tests/fixtures/Oasis.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.oasis.app:443",
4 | "method": "GET",
5 | "path": "/v1/supply/dai",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "data": "96788564.397572699347125922",
10 | "time": "2020-04-27T19:01:57.397Z",
11 | "message": "success"
12 | },
13 | "rawHeaders": [
14 | "Content-Type",
15 | "application/json",
16 | "Content-Length",
17 | "92",
18 | "Connection",
19 | "keep-alive",
20 | "Date",
21 | "Mon, 27 Apr 2020 19:01:57 GMT",
22 | "x-amzn-RequestId",
23 | "9293a015-8f57-44db-9b12-9b54cb871eff",
24 | "x-amz-apigw-id",
25 | "LqPVzGIloAMFcsg=",
26 | "X-Amzn-Trace-Id",
27 | "Root=1-5ea72c25-b51e876e1c266d1c56e16866",
28 | "X-Cache",
29 | "Miss from cloudfront",
30 | "Via",
31 | "1.1 fd2756277dcf50743fb09f4526b54aca.cloudfront.net (CloudFront)",
32 | "X-Amz-Cf-Pop",
33 | "VIE50-C1",
34 | "X-Amz-Cf-Id",
35 | "KXzW3sTjouujfPfP6AN-m-HIIgVzhtrbXE3gMMh_iwf2bjDg7CdhHQ=="
36 | ],
37 | "responseIsBinary": false
38 | }
39 | ]
--------------------------------------------------------------------------------
/lib/drivers/crypto-locally.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Cryptolocally driver. Supports fetching max
6 | * and circulating supply for GIV token on Ethereum
7 | * blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class CryptoLocally extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 200, // 5 requests per second
16 | supports: {
17 | circulating: true,
18 | total: false,
19 | max: true,
20 | },
21 | options,
22 | });
23 | }
24 |
25 | /**
26 | * @augments Driver.fetchMaxSupply
27 | */
28 | fetchMaxSupply() {
29 | return 999000000;
30 | }
31 |
32 | /**
33 | * @augments Driver.fetchCirculatingSupply
34 | */
35 | async fetchCirculatingSupply() {
36 | const circulating = await this.request('https://cryptolocally.com/api/giv/circulatingsupply');
37 |
38 | return Number(circulating);
39 | }
40 |
41 | /**
42 | * @augments Driver.getSupply
43 | */
44 | async getSupply() {
45 | const max = this.fetchMaxSupply();
46 | const circulating = await this.fetchCirculatingSupply();
47 |
48 | return new Supply({
49 | max,
50 | circulating,
51 | });
52 | }
53 | }
54 |
55 | module.exports = CryptoLocally;
56 |
--------------------------------------------------------------------------------
/lib/drivers/fix-network.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Fix network driver. Supports max and
6 | * total supply for own FIX coin
7 | * on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class FixNetwork extends Driver {
13 | constructor(options) {
14 | super(
15 | {
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | max: true,
19 | },
20 | },
21 | options,
22 | );
23 | }
24 |
25 | /**
26 | * @augments Driver.fetchMaxSupply
27 | */
28 | fetchMaxSupply() {
29 | return Number(100000000000);
30 | }
31 |
32 | /**
33 | * get circulating supply
34 | *
35 | * @augments Driver.fetchCirculatingSupply
36 | * @async
37 | */
38 | async fetchTotalSupply() {
39 | const total = await this.request('https://chain.review/api/db/fix/getmoneysupply');
40 | return Number(total);
41 | }
42 |
43 | /**
44 | * get supply
45 | *
46 | * @augments Driver.getSupply
47 | */
48 | async getSupply() {
49 | const max = this.fetchMaxSupply();
50 | const total = await this.fetchTotalSupply();
51 |
52 | return new Supply({
53 | max,
54 | total,
55 | });
56 | }
57 | }
58 |
59 | module.exports = FixNetwork;
60 |
--------------------------------------------------------------------------------
/tests/fixtures/Sierracoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.sierracoin.net:443",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 5237791.66611503,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "17",
16 | "ETag",
17 | "\"-1747481727\"",
18 | "Date",
19 | "Mon, 24 Feb 2020 17:15:40 GMT"
20 | ],
21 | "responseIsBinary": false
22 | },
23 | {
24 | "scope": "https://explorer.sierracoin.net:443",
25 | "method": "GET",
26 | "path": "/ext/getbalance/SbLVyTxtaVfPB1HAXXWg3zxAQiELAda8Nf",
27 | "body": "",
28 | "status": 200,
29 | "response": 10308,
30 | "rawHeaders": [
31 | "X-Powered-By",
32 | "Express",
33 | "Content-Type",
34 | "text/html; charset=utf-8",
35 | "Content-Length",
36 | "5",
37 | "ETag",
38 | "\"2065779502\"",
39 | "Date",
40 | "Mon, 24 Feb 2020 17:15:41 GMT"
41 | ],
42 | "responseIsBinary": false
43 | }
44 | ]
--------------------------------------------------------------------------------
/lib/drivers/reef-finance.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * ReefFinance driver. Supports
6 | * max and total supply native
7 | * token on Polkadot blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class ReefFinance extends Driver {
13 | constructor(options) {
14 | super({
15 | supports: {
16 | max: true,
17 | total: false,
18 | circulating: true,
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * get max supply for native token
26 | *
27 | * @augments Driver.fetchMaxSupply
28 | */
29 | fetchMaxSupply() {
30 | return 20000000000;
31 | }
32 |
33 | /**
34 | * get total supply for native token
35 | *
36 | * @augments Driver.fetchCirculatingSupply
37 | * @async
38 | */
39 | async fetchCirculatingSupply() {
40 | const total = await this.request('https://node-api.reef.finance/api/supply');
41 |
42 | return Number(total);
43 | }
44 |
45 | /**
46 | * @augments Driver.getSupply
47 | * @async
48 | */
49 | async getSupply() {
50 | const max = this.fetchMaxSupply();
51 | const circulating = await this.fetchCirculatingSupply();
52 |
53 | return new Supply({
54 | max,
55 | circulating,
56 | });
57 | }
58 | }
59 |
60 | module.exports = ReefFinance;
61 |
--------------------------------------------------------------------------------
/tests/fixtures/Blockscan.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api-grin.blockscan.com:443",
4 | "method": "GET",
5 | "path": "/v1/api?module=stats&action=grinsupply",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "status": "1",
10 | "message": "OK",
11 | "result": "37449840"
12 | },
13 | "rawHeaders": [
14 | "Date",
15 | "Wed, 25 Mar 2020 22:49:34 GMT",
16 | "Content-Type",
17 | "application/json; charset=utf-8",
18 | "Transfer-Encoding",
19 | "chunked",
20 | "Connection",
21 | "keep-alive",
22 | "Set-Cookie",
23 | "__cfduid=d08599a8e06ee31cac2b4c57343207acf1585176574; expires=Fri, 24-Apr-20 22:49:34 GMT; path=/; domain=.blockscan.com; HttpOnly; SameSite=Lax; Secure",
24 | "Cache-Control",
25 | "private",
26 | "X-AspNet-Version",
27 | "4.0.30319",
28 | "X-Powered-By",
29 | "ASP.NET",
30 | "CF-Cache-Status",
31 | "DYNAMIC",
32 | "Expect-CT",
33 | "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
34 | "Server",
35 | "cloudflare"
36 | ],
37 | "responseIsBinary": false
38 | }
39 | ]
--------------------------------------------------------------------------------
/tests/fixtures/ElectricCash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.electriccash.global:443",
4 | "method": "GET",
5 | "path": "/totalsupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 3039324.9999999977,
9 | "rawHeaders": [
10 | "Content-Type",
11 | "text/html; charset=utf-8",
12 | "Content-Length",
13 | "18",
14 | "Strict-Transport-Security",
15 | "max-age=15724800; includeSubDomains",
16 | "Date",
17 | "Wed, 14 Apr 2021 19:51:27 GMT",
18 | "Connection",
19 | "keep-alive",
20 | "Set-Cookie",
21 | "ak_bmsc=4480AEF88363B7D648595A559F6F0C38C31DB40FB16D0000BF47776045E01378~pl9NRBVjSNDV9b5kmDJcn3AZZmY0rlchf31VJ51IVAVVI0o+h+74rEqBFVYHCuegbNP1FzhBfePUMlzpRTWM4xgidLTWjr1G2WOYjZ9qHjuDeok8ht5ASV7co0icnJfAjTL37GeLddOXsZBLYTM06+qX5zSRONr9CVJrv+18l0MQGrYiGoQxZwLCly3dJe0iDbPGKhUe1lOZZx8nabOpldTy+sWQG2uKA/zRT04ip3S0E=; expires=Wed, 14 Apr 2021 21:51:27 GMT; max-age=7200; path=/; domain=.electriccash.global; HttpOnly",
22 | "Set-Cookie",
23 | "akaalb_API-Electriccash=~op=ElCash_API_IRL:API-EU|~rv=98~m=API-EU:0|~os=66f38c005b90323e9d50c56f79eb6754~id=50bbb125d8eec91186adbda24ad6f154; path=/; HttpOnly; Secure; SameSite=None"
24 | ],
25 | "responseIsBinary": false
26 | }
27 | ]
--------------------------------------------------------------------------------
/lib/drivers/chia.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Chia driver. Supports total and circulating supply
6 | * for XCH coin on own blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Chia extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | circulating: true,
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * @augments Driver.fetchTotalSupply
24 | * @async
25 | */
26 | async fetchTotalSupply() {
27 | const { xch: total } = await this.request('https://xchscan.com/api/total-supply');
28 |
29 | return Number(total);
30 | }
31 |
32 | /**
33 | * @augments Driver.fetchCirculatingSupply
34 | * @async
35 | */
36 | async fetchCirculatingSupply() {
37 | const { xch: circulating } = await this.request('https://xchscan.com/api/circulating-supply');
38 |
39 | return Number(circulating);
40 | }
41 |
42 | /**
43 | * @augments Driver.getSupply
44 | */
45 | async getSupply() {
46 | const circulating = await this.fetchCirculatingSupply();
47 | const total = await this.fetchTotalSupply();
48 |
49 | return new Supply({
50 | total,
51 | circulating,
52 | });
53 | }
54 | }
55 |
56 | module.exports = Chia;
57 |
--------------------------------------------------------------------------------
/lib/drivers/easy-fi.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * EasyFi driver. Supports circulating and max
6 | * supply for easyfi coin on Ethereum blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class EasyFi extends Driver {
12 | constructor(options) {
13 | super({
14 | supports: {
15 | total: false,
16 | max: true,
17 | circulating: true,
18 | blockchains: ['Ethereum'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * get max supply
26 | *
27 | * @augments Driver.fetchMaxSupply
28 | */
29 | fetchMaxSupply() {
30 | return 10000000;
31 | }
32 |
33 | /**
34 | * get circulating supply for native token
35 | *
36 | * @augments Driver.fetchCirculatingSupply
37 | * @async
38 | */
39 | async fetchCirculatingSupply() {
40 | const { cmc: circulating } = await this.request('https://api.easyfi.network/api/cmc');
41 |
42 | return Number(circulating);
43 | }
44 |
45 | /**
46 | * @augments Driver.getSupply
47 | */
48 | async getSupply() {
49 | const circulating = await this.fetchCirculatingSupply();
50 | const max = this.fetchMaxSupply();
51 |
52 | return new Supply({
53 | max,
54 | circulating,
55 | });
56 | }
57 | }
58 |
59 | module.exports = EasyFi;
60 |
--------------------------------------------------------------------------------
/tests/fixtures/TronMakingMachine.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://tmmtoken.com:443",
4 | "method": "GET",
5 | "path": "/api/index.php?para=circulatingSupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 2424087.8,
9 | "rawHeaders": [
10 | "date",
11 | "Tue, 22 Jun 2021 17:40:58 GMT",
12 | "server",
13 | "Apache",
14 | "x-powered-by",
15 | "PHP/7.2.34",
16 | "accept-ranges",
17 | "none",
18 | "vary",
19 | "Accept-Encoding",
20 | "content-length",
21 | "29"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "https://tmmtoken.com:443",
27 | "method": "GET",
28 | "path": "/api/index.php?para=totalSupply",
29 | "body": "",
30 | "status": 200,
31 | "response": 5000000,
32 | "rawHeaders": [
33 | "date",
34 | "Tue, 22 Jun 2021 17:40:58 GMT",
35 | "server",
36 | "Apache",
37 | "x-powered-by",
38 | "PHP/7.2.34",
39 | "accept-ranges",
40 | "none",
41 | "vary",
42 | "Accept-Encoding",
43 | "content-length",
44 | "23"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/lib/drivers/nest-protocol.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * NestProtocol driver. Supports circulating supply
6 | * for token NEST on Ethereum blockchain.
7 | *
8 | * @augments Driver
9 | * @memberof Driver
10 | */
11 | class NestProtocol extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | total: false,
17 | circulating: true,
18 | max: true,
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * @augments Driver.fetchMaxSupply
26 | */
27 | fetchMaxSupply() {
28 | return 10000000000;
29 | }
30 |
31 | /**
32 | * @augments Driver.fetchCirculatingSupply
33 | * @async
34 | */
35 | async fetchCirculatingSupply() {
36 | const circulating = await this.request({
37 | url: 'https://nestprotocol.org/nestapi/circulation',
38 | rejectUnauthorized: false,
39 | });
40 | return Number(circulating);
41 | }
42 |
43 | /**
44 | * @augments Driver.getSupply
45 | * @async
46 | */
47 | async getSupply() {
48 | const circulating = await this.fetchCirculatingSupply();
49 | const max = this.fetchMaxSupply();
50 |
51 | return new Supply({
52 | max,
53 | circulating,
54 | });
55 | }
56 | }
57 |
58 | module.exports = NestProtocol;
59 |
--------------------------------------------------------------------------------
/lib/drivers/fiscuss-fyi.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Fiscus Governance Coin driver. Supports max
6 | * and circulating supply on Ethereum
7 | * blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class FiscussFyi extends Driver {
13 | constructor(options) {
14 | super(
15 | {
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | max: true,
19 | total: false,
20 | circulating: true,
21 | },
22 | },
23 | options,
24 | );
25 | }
26 |
27 | fetchMaxSupply() {
28 | return Number(60000);
29 | }
30 |
31 | /**
32 | * get circulating supply
33 | *
34 | * @augments Driver.fetchCirculatingSupply
35 | * @async
36 | */
37 | async fetchCirculatingSupply() {
38 | const { circulatingSupply: circulating } = await this.request('https://fiscus.fyi/api/v1/FFYI/circulatingSupply');
39 | return Number(circulating) / 10 ** 18;
40 | }
41 |
42 | /**
43 | * get supply
44 | *
45 | * @augments Driver.getSupply
46 | */
47 | async getSupply() {
48 | const max = this.fetchMaxSupply();
49 | const circulating = await this.fetchCirculatingSupply();
50 |
51 | return new Supply({
52 | circulating,
53 | max,
54 | });
55 | }
56 | }
57 |
58 | module.exports = FiscussFyi;
59 |
--------------------------------------------------------------------------------
/lib/drivers/steem-dollars.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * SteemDollars driver. Supports circulating supply
6 | * for tokens STEEM on STEEM blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class SteemDollars extends Driver {
12 | constructor(options) {
13 | super(
14 | {
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | total: false,
18 | circulating: true,
19 | },
20 | },
21 | options,
22 | );
23 | }
24 |
25 | /**
26 | * get circulating supply for native token
27 | *
28 | * @augments Driver.fetchCirculatingSupply
29 | * @async
30 | */
31 | async fetchCirculatingSupply() {
32 | const data = await this.request({
33 | url: 'https://steemdb.io/api/props',
34 | rejectUnauthorized: false,
35 | });
36 | const record = data[0];
37 |
38 | if (record) {
39 | return Number(record.current_sbd_supply);
40 | }
41 |
42 | return Number(0);
43 | }
44 |
45 | /**
46 | * get supply
47 | *
48 | * @augments Driver.getSupply
49 | * @async
50 | */
51 | async getSupply() {
52 | const circulating = await this.fetchCirculatingSupply();
53 |
54 | return new Supply({
55 | circulating,
56 | });
57 | }
58 | }
59 |
60 | module.exports = SteemDollars;
61 |
--------------------------------------------------------------------------------
/lib/drivers/clover-finance.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * CloverFinance driver. Support total and circulating supply.
6 | *
7 | * @memberof Driver
8 | * @augments Driver
9 | */
10 | class CloverFinance extends Driver {
11 | constructor(options) {
12 | super({
13 | timeout: 200, // 5 requests per second
14 | supports: {},
15 | options,
16 | });
17 | }
18 |
19 | /**
20 | * get total supply
21 | *
22 | * @augments Driver.fetchTotalSupply
23 | * @async
24 | */
25 | async fetchTotalSupply() {
26 | const total = await this.request('https://tx-api.clover.finance/api/clv/totalSupply');
27 | return Number(total);
28 | }
29 |
30 | /**
31 | * get total supply
32 | *
33 | * @augments Driver.fetchCirculatingSupply
34 | * @async
35 | */
36 | async fetchCirculatingSupply() {
37 | const circulating = await this.request('https://tx-api.clover.finance/api/clv/circulatingSupply');
38 | return Number(circulating);
39 | }
40 |
41 | /**
42 | * @augments Driver.getSupply
43 | * @async
44 | */
45 | async getSupply() {
46 | const total = await this.fetchTotalSupply();
47 | const circulating = await this.fetchCirculatingSupply();
48 |
49 | return new Supply({
50 | total,
51 | circulating,
52 | });
53 | }
54 | }
55 |
56 | module.exports = CloverFinance;
57 |
--------------------------------------------------------------------------------
/lib/drivers/nash.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Nash driver. Supports max
6 | * supply and circulating supply
7 | * for NEX token on NEO blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Nash extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | total: false,
18 | max: true,
19 | circulating: true,
20 | },
21 | options,
22 | });
23 | }
24 |
25 | /**
26 | * get total supply for native token
27 | *
28 | * @augments Driver.fetchMaxSupply
29 | * @async
30 | */
31 | fetchMaxSupply() {
32 | return 50000000;
33 | }
34 |
35 | /**
36 | * get circulating supply
37 | *
38 | * @augments Driver.fetchCirculatingSupply
39 | * @async
40 | */
41 | async fetchCirculatingSupply() {
42 | const circulatingSupply = await this.request('https://app.nash.io/api/nex_data/circulating_supply');
43 | return Number(circulatingSupply);
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | */
49 | async getSupply() {
50 | const max = this.fetchMaxSupply();
51 | const circulating = await this.fetchCirculatingSupply();
52 |
53 | return new Supply({
54 | max,
55 | circulating,
56 | });
57 | }
58 | }
59 |
60 | module.exports = Nash;
61 |
--------------------------------------------------------------------------------
/tests/fixtures/Blip.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.blip.wtf:443",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 3135,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "5",
16 | "ETag",
17 | "\"1644995042\"",
18 | "Date",
19 | "Wed, 30 Sep 2020 16:58:47 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "https://explorer.blip.wtf:443",
27 | "method": "GET",
28 | "path": "/ext/getbalance/BkDRDwKWkM5Q8Pz2D7cKK3adoxf1p4iyAX",
29 | "body": "",
30 | "status": 200,
31 | "response": 225.002,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "7",
39 | "ETag",
40 | "\"-235626309\"",
41 | "Date",
42 | "Wed, 30 Sep 2020 16:58:47 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Checoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://159.65.81.41:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 23173126,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "9",
16 | "ETag",
17 | "\"54645852\"",
18 | "Date",
19 | "Fri, 21 May 2021 16:56:59 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://159.65.81.41:80",
27 | "method": "GET",
28 | "path": "/ext/getbalance/CRrcKx2kEFJba4ANcgvW8QYya7d3cCy5JP",
29 | "body": "",
30 | "status": 200,
31 | "response": 22161430.36001,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "14",
39 | "ETag",
40 | "\"1076625838\"",
41 | "Date",
42 | "Fri, 21 May 2021 16:56:59 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Helpico.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://helpico.tech:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 5013283.72711634,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "17",
16 | "ETag",
17 | "\"132670423\"",
18 | "Date",
19 | "Fri, 14 Feb 2020 07:49:43 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://helpico.tech:80",
27 | "method": "GET",
28 | "path": "/ext/getbalance/H8WMu99F1S4JbrZwus5dFS1qdbr2PQGRH5",
29 | "body": "",
30 | "status": 200,
31 | "response": 4153.24633875,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "13",
39 | "ETag",
40 | "\"1992706259\"",
41 | "Date",
42 | "Fri, 14 Feb 2020 07:49:43 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/_2x2.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://2x2block.space:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 3313664.35,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "11",
16 | "ETag",
17 | "\"-1165026398\"",
18 | "Date",
19 | "Mon, 24 Feb 2020 17:05:07 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://2x2block.space:80",
27 | "method": "GET",
28 | "path": "/ext/getbalance/CSwjoJqXdR3Vx4bDtSUMzMfqSQGWoi21v2",
29 | "body": "",
30 | "status": 200,
31 | "response": 49691.31787289,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "14",
39 | "ETag",
40 | "\"166590682\"",
41 | "Date",
42 | "Mon, 24 Feb 2020 17:05:07 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/lib/drivers/draken.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Draken driver. Support
6 | * total supply for Draken token.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Draken extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | blockchains: ['Draken'],
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * @augments Driver.fetchTotalSupply
24 | * @async
25 | */
26 | async fetchTotalSupply() {
27 | const data = await this.request({
28 | url: 'https://explorer.draken.tech/graphiql',
29 | method: 'POST',
30 | headers: { 'Content-Type': 'application/json' },
31 | json: {
32 | query: `
33 | query {
34 | address(hash: "0x0000000000000000000000000000000000000066") {
35 | fetchedCoinBalance
36 | }
37 | }
38 | `,
39 | },
40 | });
41 |
42 | const { data: { address: { fetchedCoinBalance } } } = data;
43 |
44 | return Number(fetchedCoinBalance) / 10 ** 18;
45 | }
46 |
47 | /**
48 | * @augments Driver.getSupply
49 | */
50 | async getSupply() {
51 | const total = await this.fetchTotalSupply();
52 |
53 | return new Supply({
54 | total,
55 | });
56 | }
57 | }
58 |
59 | module.exports = Draken;
60 |
--------------------------------------------------------------------------------
/tests/fixtures/BuySell.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://buysellcoin.org:3001",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 21330.0592,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "11",
16 | "ETag",
17 | "\"1154336470\"",
18 | "Date",
19 | "Tue, 14 Jan 2020 09:36:51 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://buysellcoin.org:3001",
27 | "method": "GET",
28 | "path": "/ext/getbalance/BjZXyE5rz3AxKTtjZPrg9i6AjT8G77K1iX",
29 | "body": "",
30 | "status": 200,
31 | "response": 10277.28239404,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "14",
39 | "ETag",
40 | "\"2057364666\"",
41 | "Date",
42 | "Tue, 14 Jan 2020 09:36:51 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/CryptoLocally.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://cryptolocally.com:443",
4 | "method": "GET",
5 | "path": "/api/giv/circulatingsupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 136895238,
9 | "rawHeaders": [
10 | "Date",
11 | "Thu, 22 Oct 2020 19:21:58 GMT",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "9",
16 | "Connection",
17 | "keep-alive",
18 | "Vary",
19 | "Origin",
20 | "Access-Control-Allow-Credentials",
21 | "true",
22 | "X-DNS-Prefetch-Control",
23 | "off",
24 | "X-Frame-Options",
25 | "ALLOW-FROM https://bloks.io/",
26 | "Strict-Transport-Security",
27 | "max-age=15552000; includeSubDomains",
28 | "X-Download-Options",
29 | "noopen",
30 | "X-Content-Type-Options",
31 | "nosniff",
32 | "X-XSS-Protection",
33 | "1; mode=block",
34 | "X-RateLimit-Limit",
35 | "400",
36 | "X-RateLimit-Remaining",
37 | "398",
38 | "X-RateLimit-Reset",
39 | "1603394519",
40 | "ETag",
41 | "W/\"9-LsFxJb9VmsBCVrPCIht7cR3AHNs\""
42 | ],
43 | "responseIsBinary": false
44 | }
45 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Konjungate.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://discover.konjungate.net:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 551171205.5411735,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "18",
16 | "ETag",
17 | "\"1752625346\"",
18 | "Date",
19 | "Fri, 21 Feb 2020 17:18:08 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://discover.konjungate.net:80",
27 | "method": "GET",
28 | "path": "/ext/getbalance/KtjjN15DXTHrHYRasZy7bnhVaKRmfsDJBW",
29 | "body": "",
30 | "status": 200,
31 | "response": 17250.00032322,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "14",
39 | "ETag",
40 | "\"-2005205384\"",
41 | "Date",
42 | "Fri, 21 Feb 2020 17:18:08 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/lib/drivers/moneroblocks.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * MoneroBlocks driver. Supports total
6 | * and circulating supply on own
7 | * blockchain Monero.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class MoneroBlocks extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | circulating: true,
18 | blockchains: ['Monero'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * @augments Driver.fetchTotalSupply
26 | * @async
27 | */
28 | async fetchTotalSupply() {
29 | const data = await this.request('http://moneroblocks.info/api/get_stats/');
30 | return Number(data.total_emission) / 1000000000000;
31 | }
32 |
33 | /**
34 | * @augments Driver.fetchCirculatingSupply
35 | * @async
36 | */
37 | async fetchCirculatingSupply() {
38 | const data = await this.request('http://moneroblocks.info/api/get_stats/');
39 | return Number(data.total_emission) / 1000000000000;
40 | }
41 |
42 | /**
43 | * @augments Driver.getSupply
44 | */
45 | async getSupply() {
46 | const total = await this.fetchTotalSupply();
47 | const circulating = await this.fetchCirculatingSupply();
48 |
49 | return new Supply({
50 | total,
51 | circulating,
52 | });
53 | }
54 | }
55 |
56 | module.exports = MoneroBlocks;
57 |
--------------------------------------------------------------------------------
/tests/fixtures/FanaticosCash.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.fanaticoscriptos.com:443",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 4271328.16210973,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "17",
16 | "ETag",
17 | "\"863477486\"",
18 | "Date",
19 | "Thu, 13 Aug 2020 16:27:45 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "https://explorer.fanaticoscriptos.com:443",
27 | "method": "GET",
28 | "path": "/ext/getbalance/FfamQfusb9WfgLU7dEJs6tn8qMYLBvkg8X",
29 | "body": "",
30 | "status": 200,
31 | "response": 420000,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "6",
39 | "ETag",
40 | "\"-669576048\"",
41 | "Date",
42 | "Thu, 13 Aug 2020 16:27:46 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/lib/drivers/eosdt.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Eosdt driver. Supports max and circulating supply for EOSDT token on EOS blockchain.
6 | *
7 | * @memberof Driver
8 | * @augments Driver
9 | */
10 | class Eosdt extends Driver {
11 | constructor(options) {
12 | super({
13 | supports: {
14 | total: false,
15 | max: true,
16 | circulating: true,
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * get max supply
24 | *
25 | * @augments Driver.fetchMaxSupply
26 | */
27 | fetchMaxSupply() {
28 | return 170000000;
29 | }
30 |
31 | /**
32 | * get circulating supply for native token
33 | *
34 | * @augments Driver.fetchCirculatingSupply
35 | * @async
36 | */
37 | async fetchCirculatingSupply() {
38 | const { currencies } = await this.request('https://statistics.eosdt.com/api/supply/actual');
39 | const record = currencies.find((item) => item.name === 'EOSDT');
40 |
41 | if (!record) {
42 | return undefined;
43 | }
44 |
45 | return Number(record.supply);
46 | }
47 |
48 | /**
49 | * @augments Driver.getSupply
50 | */
51 | async getSupply() {
52 | const circulating = await this.fetchCirculatingSupply();
53 | const max = this.fetchMaxSupply();
54 |
55 | return new Supply({
56 | max,
57 | circulating,
58 | });
59 | }
60 | }
61 |
62 | module.exports = Eosdt;
63 |
--------------------------------------------------------------------------------
/lib/drivers/hathor.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Hathor driver. Supports fetching total supply and circulating supply for HTR coin, on it's own
6 | * blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Hathor extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 200, // 5 requests per second
15 | supports: {
16 | circulating: true,
17 | total: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * @augments Driver.fetchCirculatingSupply
25 | */
26 | async fetchTotalSupply() {
27 | const { total_supply: total } = await this.request('https://api.economics.hathor.network/status');
28 |
29 | return Number(total.replace(/,/g, ''));
30 | }
31 |
32 | /**
33 | * @augments Driver.fetchCirculatingSupply
34 | */
35 | async fetchCirculatingSupply() {
36 | const { circulating_supply: circulating } = await this.request('https://api.economics.hathor.network/status');
37 |
38 | return Number(circulating.replace(/,/g, ''));
39 | }
40 |
41 | /**
42 | * @augments Driver.getSupply
43 | */
44 | async getSupply() {
45 | const total = await this.fetchTotalSupply();
46 | const circulating = await this.fetchCirculatingSupply();
47 |
48 | return new Supply({
49 | total,
50 | circulating,
51 | });
52 | }
53 | }
54 |
55 | module.exports = Hathor;
56 |
--------------------------------------------------------------------------------
/tests/fixtures/Tkm.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://5.189.162.110:3001",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 9207917331.538513,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "18",
16 | "ETag",
17 | "W/\"12-ThZATdLDUCjKO8y2lke+XfHrL5k\"",
18 | "Date",
19 | "Thu, 31 Dec 2020 11:24:59 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://5.189.162.110:3001",
27 | "method": "GET",
28 | "path": "/ext/getbalance/TSpTntH6vVszfm6sho7euAxAVrBRXVN52a",
29 | "body": "",
30 | "status": 200,
31 | "response": 2072109718,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "10",
39 | "ETag",
40 | "W/\"a-68d2xT8rshSL40i1CgXcFUhqVd8\"",
41 | "Date",
42 | "Thu, 31 Dec 2020 11:25:00 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/lib/drivers/beam.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Beam driver.
6 | *
7 | * @memberof Driver
8 | * @augments Driver
9 | */
10 | class Beam extends Driver {
11 | constructor(options) {
12 | super({
13 | timeout: 200, // 5 requests per second
14 | supports: {
15 | circulating: true,
16 | blockchains: ['BEAM'],
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * get total supply
24 | *
25 | * @augments Driver.fetchTotalSupply
26 | * @async
27 | */
28 | async fetchTotalSupply() {
29 | const { total_emission: total } = await this.request('https://mainnet-explorer.beam.mw/explorer/status/?format=json');
30 | return Number(total);
31 | }
32 |
33 | /**
34 | * get circulating supply
35 | *
36 | * @augments Driver.fetchCirculatingSupply
37 | * @async
38 | */
39 | async fetchCirculatingSupply() {
40 | const { total_coins_in_circulation: circulating } = await this.request('https://mainnet-explorer.beam.mw/explorer/status/?format=json');
41 | return Number(circulating);
42 | }
43 |
44 | /**
45 | * @augments Driver.getSupply
46 | */
47 | async getSupply() {
48 | const total = await this.fetchTotalSupply();
49 | const circulating = await this.fetchCirculatingSupply();
50 |
51 | return new Supply({
52 | total,
53 | circulating,
54 | });
55 | }
56 | }
57 |
58 | module.exports = Beam;
59 |
--------------------------------------------------------------------------------
/lib/drivers/mina.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Mina driver. Supports circulating
6 | * and total supply on own
7 | * blockchain Mina.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Mina extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 request per second
16 | supports: {
17 | total: true,
18 | circulating: true,
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * get total supply of the native token
26 | *
27 | * @augments Driver.fetchTotalSupply
28 | * @async
29 | */
30 | async fetchTotalSupply() {
31 | const { totalCurrency: total } = await this.request('https://api.minaexplorer.com/summary');
32 |
33 | return Number(total);
34 | }
35 |
36 | /**
37 | * @augments Driver.fetchCirculatingSupply
38 | * @async
39 | */
40 | async fetchCirculatingSupply() {
41 | const { circulatingSupply: circulating } = await this.request('https://api.minaexplorer.com/summary');
42 |
43 | return Number(circulating);
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | */
49 | async getSupply() {
50 | const total = await this.fetchTotalSupply();
51 | const circulating = await this.fetchCirculatingSupply();
52 |
53 | return new Supply({
54 | circulating,
55 | total,
56 | });
57 | }
58 | }
59 |
60 | module.exports = Mina;
61 |
--------------------------------------------------------------------------------
/lib/drivers/near.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Near driver. Supports max and circulating supply
6 | * for NEAR coin on own blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Near extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | total: false,
17 | max: true,
18 | circulating: true,
19 | blockchains: ['Handshake'],
20 | },
21 | options,
22 | });
23 | }
24 |
25 | /**
26 | * get total supply for native token
27 | *
28 | * @augments Driver.fetchMaxSupply
29 | * @async
30 | */
31 | fetchMaxSupply() {
32 | return 1000000000;
33 | }
34 |
35 | /**
36 | * get circulating supply
37 | *
38 | * @augments Driver.fetchCirculatingSupply
39 | * @async
40 | */
41 | async fetchCirculatingSupply() {
42 | const { circulating_supply_in_yoctonear: circulating } = await this.request('https://explorer.near.org/api/circulating-supply');
43 | return Number(circulating) / 10 ** 24;
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | */
49 | async getSupply() {
50 | const max = this.fetchMaxSupply();
51 | const circulating = await this.fetchCirculatingSupply();
52 |
53 | return new Supply({
54 | max,
55 | circulating,
56 | });
57 | }
58 | }
59 |
60 | module.exports = Near;
61 |
--------------------------------------------------------------------------------
/lib/drivers/tron-making-machine.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Tron Making Machine driver. Supports
6 | * max and total supply for native TMM token
7 | * on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class TronMakingMachine extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | max: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * get max supply for native token
25 | *
26 | * @augments Driver.fetchMaxSupply
27 | * @async
28 | */
29 | async fetchMaxSupply() {
30 | const max = await this.request('https://tmmtoken.com/api/index.php?para=totalSupply');
31 |
32 | return max;
33 | }
34 |
35 | /**
36 | * get total supply for native token
37 | *
38 | * @augments Driver.fetchTotalSupply
39 | * @async
40 | */
41 | async fetchTotalSupply() {
42 | const total = await this.request('https://tmmtoken.com/api/index.php?para=circulatingSupply');
43 | return Number(total);
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | */
49 | async getSupply() {
50 | const total = await this.fetchTotalSupply();
51 | const max = await this.fetchMaxSupply();
52 |
53 | return new Supply({
54 | total,
55 | max,
56 | });
57 | }
58 | }
59 |
60 | module.exports = TronMakingMachine;
61 |
--------------------------------------------------------------------------------
/tests/fixtures/Deracoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://deracoin-explorer.com:3001",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 6024465.2917,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "13",
16 | "ETag",
17 | "W/\"d-T9wrrpY+K3mBMZlkccwBVB5mvZM\"",
18 | "Date",
19 | "Wed, 23 Jun 2021 18:36:08 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://deracoin-explorer.com:3001",
27 | "method": "GET",
28 | "path": "/ext/getbalance/DU6SxukQDz6hFVLEsSQChrS59vwNQzqSrd",
29 | "body": "",
30 | "status": 200,
31 | "response": 1700,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "4",
39 | "ETag",
40 | "W/\"4-HBzr+zKD6lW0KxErplV1C4ZEP+U\"",
41 | "Date",
42 | "Wed, 23 Jun 2021 18:36:08 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/MyspesExplorer.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://178.128.164.33:5500",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 2288151.05996607,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "17",
16 | "ETag",
17 | "W/\"11-d88ph7jrMjHDB5atuf6hDIBWTAA\"",
18 | "Date",
19 | "Fri, 21 Feb 2020 17:07:41 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://178.128.164.33:5500",
27 | "method": "GET",
28 | "path": "/ext/getbalance/SfHfjyDKrNeBKekWr43tv5zKaAWa8wiak1",
29 | "body": "",
30 | "status": 200,
31 | "response": 56908.87368574,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "14",
39 | "ETag",
40 | "W/\"e-N+SwkksfglogtC/H5K0J8at5GBM\"",
41 | "Date",
42 | "Fri, 21 Feb 2020 17:07:41 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/MagpieCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://explorer.magpiecoin.org:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 9577107896.385973,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "18",
16 | "ETag",
17 | "W/\"12-fCmrlx+imD2diQQsXRCbqTXl66c\"",
18 | "Date",
19 | "Thu, 03 Jun 2021 19:59:33 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://explorer.magpiecoin.org:80",
27 | "method": "GET",
28 | "path": "/ext/getbalance/Mc9JsFZmJ6qGinCrFZhpdgtuHTbBroqydt",
29 | "body": "",
30 | "status": 200,
31 | "response": 340864592,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "9",
39 | "ETag",
40 | "W/\"9-EmYXOMHduXCbA/9PJR7BmQNOAv4\"",
41 | "Date",
42 | "Thu, 03 Jun 2021 19:59:34 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/lib/drivers/namebase.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Namebase driver. Supports max
6 | * supply and circulating supply
7 | * for native HNS token on Handshake blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Namebase extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | total: false,
18 | max: true,
19 | circulating: true,
20 | blockchains: ['Handshake'],
21 | },
22 | options,
23 | });
24 | }
25 |
26 | /**
27 | * get total supply for native token
28 | *
29 | * @augments Driver.fetchMaxSupply
30 | * @async
31 | */
32 | fetchMaxSupply() {
33 | return 2040000000;
34 | }
35 |
36 | /**
37 | * get circulating supply
38 | *
39 | * @augments Driver.fetchCirculatingSupply
40 | * @async
41 | */
42 | async fetchCirculatingSupply() {
43 | const { circulatingSupply } = await this.request('https://www.namebase.io/api/v0/ticker/supply?asset=HNS');
44 | return Number(circulatingSupply);
45 | }
46 |
47 | /**
48 | * @augments Driver.getSupply
49 | */
50 | async getSupply() {
51 | const max = this.fetchMaxSupply();
52 | const circulating = await this.fetchCirculatingSupply();
53 |
54 | return new Supply({
55 | max,
56 | circulating,
57 | });
58 | }
59 | }
60 |
61 | module.exports = Namebase;
62 |
--------------------------------------------------------------------------------
/tests/fixtures/BitcoinVirtualGold.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://23.94.198.107:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 2019951.25925936,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "17",
16 | "ETag",
17 | "W/\"11-54CJWOpXyueu4YKQP8Si6rfY2VM\"",
18 | "Date",
19 | "Tue, 01 Jun 2021 19:14:36 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://23.94.198.107:80",
27 | "method": "GET",
28 | "path": "/ext/getbalance/bvg1qadyc83ucxp5eja2hxcsatrfw3z8qk7pay8a540",
29 | "body": "",
30 | "status": 200,
31 | "response": 911152.81481835,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "15",
39 | "ETag",
40 | "W/\"f-QO88IwGgiaPWzyndy0wLZ+azJfo\"",
41 | "Date",
42 | "Tue, 01 Jun 2021 19:14:37 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/InfiniteBlocks.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://infiniteblocks.space:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 7433845.3779914,
9 | "rawHeaders": [
10 | "X-Powered-By",
11 | "Express",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Content-Length",
15 | "16",
16 | "ETag",
17 | "W/\"10-7ZcbuI2yitGP+wY6mHKLUKaf9Dk\"",
18 | "Date",
19 | "Wed, 23 Sep 2020 18:48:38 GMT",
20 | "Connection",
21 | "keep-alive"
22 | ],
23 | "responseIsBinary": false
24 | },
25 | {
26 | "scope": "http://infiniteblocks.space:80",
27 | "method": "GET",
28 | "path": "/ext/getbalance/1JJViUvU1USyPqzMmQ4Yp6FERCyWBLF3UZ",
29 | "body": "",
30 | "status": 200,
31 | "response": 236840.51124151,
32 | "rawHeaders": [
33 | "X-Powered-By",
34 | "Express",
35 | "Content-Type",
36 | "text/html; charset=utf-8",
37 | "Content-Length",
38 | "15",
39 | "ETag",
40 | "W/\"f-5r9JUWSwTIdJJOlYf1gkNiVcC2I\"",
41 | "Date",
42 | "Wed, 23 Sep 2020 18:48:39 GMT",
43 | "Connection",
44 | "keep-alive"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/lib/drivers/decred.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Decred driver. Supports total and circulating
6 | * supply on their own blockchain.
7 | *
8 | * @augments Driver
9 | * @memberof Driver
10 | */
11 | class Decred extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 200, // 5 requests per second
15 | supports: {
16 | circulating: true,
17 | blockchains: ['Decred'],
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * @augments Driver.fetchTotalSupply
25 | * @async
26 | */
27 | async fetchTotalSupply() {
28 | const { supply_ultimate: supply } = await this.request(
29 | 'https://dcrdata.decred.org/api/supply',
30 | );
31 | return Number(supply) / (10 ** 8);
32 | }
33 |
34 | /**
35 | * @augments Driver.fetchCirculatingSupply
36 | * @async
37 | */
38 | async fetchCirculatingSupply() {
39 | const { supply_mined: circulating } = await this.request(
40 | 'https://dcrdata.decred.org/api/supply',
41 | );
42 | return Number(circulating) / (10 ** 8);
43 | }
44 |
45 | /**
46 | * @augments Driver.getSupply
47 | * @async
48 | */
49 | async getSupply() {
50 | const total = await this.fetchTotalSupply();
51 | const circulating = await this.fetchCirculatingSupply();
52 |
53 | return new Supply({
54 | total,
55 | circulating,
56 | });
57 | }
58 | }
59 |
60 | module.exports = Decred;
61 |
--------------------------------------------------------------------------------
/lib/drivers/piratechain.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * PirateChain driver. Supports total and circulating
6 | * supply for native token ARRR on own blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class PirateChain extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | circulating: true,
17 | blockchains: ['PirateChain'],
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * total supply for native token
25 | *
26 | * @augments Driver.fetchTotalSupply
27 | * @async
28 | */
29 | async fetchTotalSupply() {
30 | return Number(200000000);
31 | }
32 |
33 | /**
34 | * circulating supply for native token
35 | *
36 | * @augments Driver.fetchCirculatingSupply
37 | * @async
38 | */
39 | async fetchCirculatingSupply() {
40 | const { supply: circulating } = await this.request(
41 | 'https://explorer.pirate.black/api/marketcap',
42 | );
43 | return Number(circulating);
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | * @async
49 | */
50 | async getSupply() {
51 | const total = await this.fetchTotalSupply();
52 | const circulating = await this.fetchCirculatingSupply();
53 |
54 | return new Supply({
55 | total,
56 | circulating,
57 | });
58 | }
59 | }
60 |
61 | module.exports = PirateChain;
62 |
--------------------------------------------------------------------------------
/lib/drivers/mcashchain.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * MCashScan driver. Support total
6 | * and circulating supply for MCASH
7 | * token on MCashchain blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class MCashChain extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | circulating: true,
18 | blockchains: ['MCashchain'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * @augments Driver.fetchTotalSupply
26 | * @async
27 | */
28 | async fetchTotalSupply() {
29 | const { total_supply: total } = await this.request('https://api.mcashscan.io/api/system/balance');
30 |
31 | return Number(total) / 10 ** 8;
32 | }
33 |
34 | /**
35 | * @augments Driver.fetchCirculatingSupply
36 | * @async
37 | */
38 | async fetchCirculatingSupply() {
39 | const { circulating_supply: circulating } = await this.request('https://api.mcashscan.io/api/system/balance');
40 |
41 | return Number(circulating) / 10 ** 8;
42 | }
43 |
44 | /**
45 | * @augments Driver.getSupply
46 | */
47 | async getSupply() {
48 | const total = await this.fetchTotalSupply();
49 | const circulating = await this.fetchCirculatingSupply();
50 |
51 | return new Supply({
52 | total,
53 | circulating,
54 | });
55 | }
56 | }
57 |
58 | module.exports = MCashChain;
59 |
--------------------------------------------------------------------------------
/lib/drivers/tzstats.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * TzStats driver. Supports total and
6 | * circulating supply, along with balance
7 | * for native token, on own blockchain
8 | * Tezos.
9 | *
10 | * @memberof Driver
11 | * @augments Driver
12 | */
13 | class TzStats extends Driver {
14 | constructor(options) {
15 | super({
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | circulating: true,
19 | blockchains: ['Tezos'],
20 | },
21 | options,
22 | });
23 | }
24 |
25 | /**
26 | * @augments Driver.fetchTotalSupply
27 | * @async
28 | */
29 | async fetchTotalSupply() {
30 | const total = await this.request('https://api.tzstats.com/tables/supply?time.gte=today&limit=1');
31 | return Number(total[0][4]);
32 | }
33 |
34 | /**
35 | * @augments Driver.fetchCirculatingSupply
36 | * @async
37 | */
38 | async fetchCirculatingSupply() {
39 | const circulating = await this.request('https://api.tzstats.com/tables/supply?time.gte=today&limit=1');
40 | return Number(circulating[0][7]);
41 | }
42 |
43 | /**
44 | * @augments Driver.getSupply
45 | * @async
46 | */
47 | async getSupply() {
48 | const total = await this.fetchTotalSupply();
49 | const circulating = await this.fetchCirculatingSupply();
50 |
51 | return new Supply({
52 | total,
53 | circulating,
54 | });
55 | }
56 | }
57 |
58 | module.exports = TzStats;
59 |
--------------------------------------------------------------------------------
/lib/drivers/kava.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Kava driver. Support total
6 | * supply for Kava coin on Kava
7 | * blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Kava extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | total: true,
18 | circulating: true,
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * get total supply for native token
26 | *
27 | * @augments Driver.fetchTotalSupply
28 | * @async
29 | */
30 | async fetchTotalSupply() {
31 | const { result: total } = await this.request('https://kava4.data.kava.io/supply/total/ukava');
32 |
33 | return Number(total) / 10 ** 6;
34 | }
35 |
36 | /**
37 | * get circulating supply
38 | *
39 | * @augments Driver.fetchCirculatingSupply
40 | * @async
41 | */
42 | async fetchCirculatingSupply() {
43 | const circulating = await this.request('https://kava4.data.kava.io/vesting/circulatingsupply');
44 |
45 | return Number(circulating);
46 | }
47 |
48 | /**
49 | * @augments Driver.getSupply
50 | */
51 | async getSupply() {
52 | const total = await this.fetchTotalSupply();
53 | const circulating = await this.fetchCirculatingSupply();
54 |
55 | return new Supply({
56 | total,
57 | circulating,
58 | });
59 | }
60 | }
61 |
62 | module.exports = Kava;
63 |
--------------------------------------------------------------------------------
/lib/drivers/nervos.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Nervos driver. Supports total
6 | * and circulating supply for native token
7 | * on own blockchain.
8 | *
9 | * @augments Driver
10 | * @memberof Driver
11 | */
12 | class Nervos extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | circulating: true,
18 | blockchains: ['Nervos'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * @augments Driver.fetchTotalSupply
26 | * @async
27 | */
28 | async fetchTotalSupply() {
29 | const supply = await this.request(
30 | 'https://api.explorer.nervos.org/api/v1/market_data/total_supply',
31 | );
32 | return Number(supply);
33 | }
34 |
35 | /**
36 | * @augments Driver.fetchCirculatingSupply
37 | * @async
38 | */
39 | async fetchCirculatingSupply() {
40 | const circulating = await this.request(
41 | 'https://api.explorer.nervos.org/api/v1/market_data/circulating_supply',
42 | );
43 | return Number(circulating);
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | * @async
49 | */
50 | async getSupply() {
51 | const total = await this.fetchTotalSupply();
52 | const circulating = await this.fetchCirculatingSupply();
53 |
54 | return new Supply({
55 | total,
56 | circulating,
57 | });
58 | }
59 | }
60 |
61 | module.exports = Nervos;
62 |
--------------------------------------------------------------------------------
/lib/drivers/cpcoin.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * CPCoin driver. Supports max, total
6 | * and circulating supply for native
7 | * CPC coin on own blockchain
8 | *
9 | * @augments Driver
10 | * @memberof Driver
11 | */
12 | class CPCoin extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | total: true,
18 | circulating: true,
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * fetch total supply for native token
26 | *
27 | * @augments Driver.fetchTotalSupply
28 | * @async
29 | */
30 | async fetchTotalSupply() {
31 | const total = await this.request('https://supply.cpcoin.io/totalsupply');
32 | return Number(total);
33 | }
34 |
35 | /**
36 | * fetch circulating supply for native token
37 | *
38 | * @augments Driver.fetchCirculatingSupply
39 | * @async
40 | */
41 | async fetchCirculatingSupply() {
42 | const circulating = await this.request('https://explorer.cpcoin.io/assets/supply-circ.html');
43 | return Number(circulating);
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | */
49 | async getSupply() {
50 | const total = await this.fetchTotalSupply();
51 | const circulating = await this.fetchCirculatingSupply();
52 |
53 | return new Supply({
54 | total,
55 | circulating,
56 | });
57 | }
58 | }
59 |
60 | module.exports = CPCoin;
61 |
--------------------------------------------------------------------------------
/lib/drivers/filecoin.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * FileCoin driver. Supports max
6 | * and circulating supply
7 | * on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class FileCoin extends Driver {
13 | constructor(options) {
14 | super(
15 | {
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | total: false,
19 | max: true,
20 | circulating: true,
21 | },
22 | },
23 | options,
24 | );
25 | }
26 |
27 | /**
28 | * get max supply
29 | *
30 | * @augments Driver.fetchMaxSupply
31 | */
32 | fetchMaxSupply() {
33 | return Number(2000000000);
34 | }
35 |
36 | /**
37 | * get circulating supply
38 | *
39 | * @augments Driver.fetchCirculatingSupply
40 | * @async
41 | */
42 | async fetchCirculatingSupply() {
43 | const circulating = await this.request('https://api.node.glif.io/statecirculatingsupply/fil');
44 |
45 | if (!circulating) throw new Error('Circulating supply is null');
46 |
47 | return Number(circulating);
48 | }
49 |
50 | /**
51 | * get supply
52 | *
53 | * @augments Driver.getSupply
54 | */
55 | async getSupply() {
56 | const max = this.fetchMaxSupply();
57 | const circulating = await this.fetchCirculatingSupply();
58 |
59 | return new Supply({
60 | circulating,
61 | max,
62 | });
63 | }
64 | }
65 |
66 | module.exports = FileCoin;
67 |
--------------------------------------------------------------------------------
/lib/drivers/wax.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Wax driver. Supports circulating and total supply for WAX token
6 | * on the own blockchain.
7 | *
8 | * @augments Driver
9 | * @memberof Driver
10 | */
11 | class Wax extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | circulating: true,
17 | },
18 | options,
19 | });
20 | }
21 |
22 | /**
23 | * get total supply for native token
24 | *
25 | * @augments Driver.fetchTotalSupply
26 | * @async
27 | */
28 | async fetchTotalSupply() {
29 | const total = await this.request('https://public-wax-on.wax.io/supply/?type=total');
30 |
31 | return Number(total);
32 | }
33 |
34 | /**
35 | * get circulating supply for native token
36 | *
37 | * @augments Driver.fetchCirculatingSupply
38 | * @async
39 | */
40 | async fetchCirculatingSupply() {
41 | const circulating = await this.request('https://public-wax-on.wax.io/supply/?type=circulating');
42 |
43 | return Number(circulating);
44 | }
45 |
46 | /**
47 | * get supply
48 | *
49 | * @augments Driver.getSupply
50 | * @async
51 | */
52 | async getSupply() {
53 | const total = await this.fetchTotalSupply();
54 | const circulating = await this.fetchCirculatingSupply();
55 |
56 | return new Supply({
57 | total,
58 | circulating,
59 | });
60 | }
61 | }
62 |
63 | module.exports = Wax;
64 |
--------------------------------------------------------------------------------
/tests/fixtures/SiaStats.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://siastats.info:443",
4 | "method": "GET",
5 | "path": "/dbs/network_status.json",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "block_height": 271475,
10 | "block_timestamp": 1596489377,
11 | "hashrate": 9272091315889540,
12 | "difficulty": 5403771920335198000,
13 | "coin_supply": 44594302992,
14 | "coin_price_USD": 0.00316,
15 | "market_cap_USD": 140917997,
16 | "used_storage_TB": 694.87,
17 | "network_capacity_TB": 2188.05,
18 | "online_hosts": 340,
19 | "active_contracts": 137424,
20 | "skynet_files": 1493432,
21 | "skynet_size": 9.21
22 | },
23 | "rawHeaders": [
24 | "Cache-Control",
25 | "no-cache",
26 | "Content-Type",
27 | "application/json",
28 | "Last-Modified",
29 | "Mon, 03 Aug 2020 21:18:34 GMT",
30 | "Accept-Ranges",
31 | "bytes",
32 | "ETag",
33 | "\"46d87a5db69d61:0\"",
34 | "Vary",
35 | "Accept-Encoding,Accept-Encoding",
36 | "Server",
37 | "Microsoft-IIS/10.0",
38 | "X-Powered-By",
39 | "ASP.NET",
40 | "Access-Control-Allow-Origin",
41 | "*",
42 | "Date",
43 | "401"
44 | ],
45 | "responseIsBinary": false
46 | }
47 | ]
--------------------------------------------------------------------------------
/lib/drivers/jiviz.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Jiviz explorer. Supports
6 | * total and circulating supply for
7 | * token (JVZ) on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Jiviz extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | total: false,
18 | max: true,
19 | circulating: true,
20 | },
21 | options,
22 | });
23 | }
24 |
25 | /**
26 | * get max supply
27 | *
28 | * @augments Driver.fetchMaxSupply
29 | * @async
30 | */
31 | async fetchMaxSupply() {
32 | const { Total_Max_Supply: max } = await this.request('https://jivizcoin.com/getcirculationsupplies');
33 |
34 | return Number(max);
35 | }
36 |
37 | /**
38 | * get circulating supply
39 | *
40 | * @augments Driver.fetchCirculatingSupply
41 | * @async
42 | */
43 | async fetchCirculatingSupply() {
44 | const { Circulating_Supply: circulating } = await this.request('https://jivizcoin.com/getcirculationsupplies');
45 |
46 | return Number(circulating);
47 | }
48 |
49 | /**
50 | * @augments Driver.getSupply
51 | */
52 | async getSupply() {
53 | const circulating = await this.fetchCirculatingSupply();
54 | const max = await this.fetchMaxSupply();
55 |
56 | return new Supply({
57 | circulating,
58 | max,
59 | });
60 | }
61 | }
62 |
63 | module.exports = Jiviz;
64 |
--------------------------------------------------------------------------------
/tests/fixtures/Hybrix.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.hybrix.io:443",
4 | "method": "GET",
5 | "path": "/engine/hystat/maximumSupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 21000000,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.17.7",
12 | "Date",
13 | "Wed, 21 Oct 2020 23:34:24 GMT",
14 | "Content-Type",
15 | "text/plain",
16 | "Transfer-Encoding",
17 | "chunked",
18 | "Connection",
19 | "keep-alive",
20 | "Vary",
21 | "Accept-Encoding",
22 | "Access-Control-Allow-Origin",
23 | "*"
24 | ],
25 | "responseIsBinary": false
26 | },
27 | {
28 | "scope": "https://api.hybrix.io:443",
29 | "method": "GET",
30 | "path": "/engine/hystat/circulatingSupply",
31 | "body": "",
32 | "status": 200,
33 | "response": 2830042.2121580243,
34 | "rawHeaders": [
35 | "Server",
36 | "nginx/1.17.7",
37 | "Date",
38 | "Wed, 21 Oct 2020 23:34:25 GMT",
39 | "Content-Type",
40 | "text/plain",
41 | "Transfer-Encoding",
42 | "chunked",
43 | "Connection",
44 | "keep-alive",
45 | "Vary",
46 | "Accept-Encoding",
47 | "Access-Control-Allow-Origin",
48 | "*"
49 | ],
50 | "responseIsBinary": false
51 | }
52 | ]
--------------------------------------------------------------------------------
/lib/drivers/banano.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Banano driver. Supports total and
6 | * circulating supply for native coin
7 | * BAN on own blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Banano extends Driver {
13 | constructor(options) {
14 | super(
15 | {
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | circulating: true,
19 | },
20 | },
21 | options,
22 | );
23 | }
24 |
25 | /**
26 | * get total supply for native token
27 | *
28 | * @augments Driver.fetchTotalSupply
29 | * @async
30 | */
31 | async fetchTotalSupply() {
32 | const { total } = await this.request('https://api.creeper.banano.cc/supply');
33 |
34 | return Number(total);
35 | }
36 |
37 | /**
38 | * get circulating supply for native token
39 | *
40 | * @augments Driver.fetchCirculatingSupply
41 | * @async
42 | */
43 | async fetchCirculatingSupply() {
44 | const { circulating } = await this.request('https://api.creeper.banano.cc/supply');
45 |
46 | return Number(circulating);
47 | }
48 |
49 | /**
50 | * get supply
51 | *
52 | * @augments Driver.getSupply
53 | */
54 | async getSupply() {
55 | const total = await this.fetchTotalSupply();
56 | const circulating = await this.fetchCirculatingSupply();
57 |
58 | return new Supply({
59 | total,
60 | circulating,
61 | });
62 | }
63 | }
64 |
65 | module.exports = Banano;
66 |
--------------------------------------------------------------------------------
/tests/fixtures/PirateChain.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.pirate.black:443",
4 | "method": "GET",
5 | "path": "/api/marketcap",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "coin": "PIRATE",
10 | "priceKMD": "0.05677926",
11 | "priceBTC": "0.00000348",
12 | "priceUSD": "0.03100760",
13 | "priceEUR": "0.02861023",
14 | "priceGBP": "0.02502409",
15 | "mcapKMD": 8797842.37,
16 | "mcapBTC": 539.22,
17 | "mcapUSD": 4804570.84,
18 | "mcapEUR": 4433102.75,
19 | "mcapGBP": 3877436.92,
20 | "height": 865582,
21 | "nethash": 67332567,
22 | "diff": 255475244,
23 | "blocktime": 1588182612,
24 | "reward": 64,
25 | "nexthalvingTS": 1606247000,
26 | "nexthalvingUTC": "2020-11-24 19:43",
27 | "nextreward": 32,
28 | "supply": "154948168.90751"
29 | },
30 | "rawHeaders": [
31 | "Date",
32 | "Wed, 29 Apr 2020 17:51:46 GMT",
33 | "Content-Type",
34 | "text/html; charset=UTF-8",
35 | "Transfer-Encoding",
36 | "chunked",
37 | "Connection",
38 | "keep-alive",
39 | "Upgrade",
40 | "h2,h2c",
41 | "Accept-Ranges",
42 | "none",
43 | "Vary",
44 | "Accept-Encoding"
45 | ],
46 | "responseIsBinary": false
47 | }
48 | ]
--------------------------------------------------------------------------------
/tests/fixtures/LitecoinNet.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://explorer.litecoin.net:80",
4 | "method": "GET",
5 | "path": "/chain/Litecoin/q/totalbc",
6 | "body": "",
7 | "status": 200,
8 | "response": 63673019.35336563,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx",
12 | "Date",
13 | "Fri, 20 Dec 2019 13:48:12 GMT",
14 | "Content-Type",
15 | "text/plain",
16 | "Transfer-Encoding",
17 | "chunked",
18 | "Connection",
19 | "keep-alive",
20 | "Cache-Control",
21 | "max-age=60",
22 | "Expires",
23 | "Fri, 20 Dec 2019 13:49:12 GMT"
24 | ],
25 | "responseIsBinary": false
26 | },
27 | {
28 | "scope": "http://explorer.litecoin.net:80",
29 | "method": "GET",
30 | "path": "/chain/Litecoin/q/totalbc",
31 | "body": "",
32 | "status": 200,
33 | "response": 63673019.35336563,
34 | "rawHeaders": [
35 | "Server",
36 | "nginx",
37 | "Date",
38 | "Fri, 20 Dec 2019 13:48:13 GMT",
39 | "Content-Type",
40 | "text/plain",
41 | "Transfer-Encoding",
42 | "chunked",
43 | "Connection",
44 | "keep-alive",
45 | "Cache-Control",
46 | "max-age=60",
47 | "Expires",
48 | "Fri, 20 Dec 2019 13:49:13 GMT"
49 | ],
50 | "responseIsBinary": false
51 | }
52 | ]
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/lib/drivers/litecoin-net.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * LitecoinNet driver.
6 | *
7 | * @memberof Driver
8 | * @augments Driver
9 | */
10 | class LitecoinNet extends Driver {
11 | constructor(options) {
12 | super({
13 | timeout: 100, // 10 requests per second
14 | supports: {
15 | circulating: true,
16 | max: true,
17 | blockchains: ['Litecoin'],
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * @augments Driver.fetchTotalSupply
25 | * @async
26 | */
27 | async fetchTotalSupply() {
28 | const total = await this.request('http://explorer.litecoin.net/chain/Litecoin/q/totalbc');
29 | return Number(total);
30 | }
31 |
32 | /**
33 | * @augments Driver.fetchCirculatingSupply
34 | * @async
35 | */
36 | async fetchCirculatingSupply() {
37 | const circulating = await this.request('http://explorer.litecoin.net/chain/Litecoin/q/totalbc');
38 | return Number(circulating);
39 | }
40 |
41 | /**
42 | * @augments Driver.fetchMaxSupply
43 | */
44 | fetchMaxSupply() {
45 | return 84000000;
46 | }
47 |
48 | /**
49 | * @augments Driver.getSupply
50 | */
51 | async getSupply() {
52 | const total = await this.fetchTotalSupply();
53 | const circulating = await this.fetchCirculatingSupply();
54 | const max = this.fetchMaxSupply();
55 |
56 | return new Supply({
57 | total,
58 | circulating,
59 | max,
60 | });
61 | }
62 | }
63 |
64 | module.exports = LitecoinNet;
65 |
--------------------------------------------------------------------------------
/tests/fixtures/Sprint.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://chain.sprintpay.net:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 3066588.22554217,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.14.0 (Ubuntu)",
12 | "Date",
13 | "Sun, 23 Aug 2020 09:01:09 GMT",
14 | "Content-Type",
15 | "text/html; charset=utf-8",
16 | "Content-Length",
17 | "17",
18 | "Connection",
19 | "keep-alive",
20 | "X-Powered-By",
21 | "Express",
22 | "ETag",
23 | "\"-878484511\""
24 | ],
25 | "responseIsBinary": false
26 | },
27 | {
28 | "scope": "http://chain.sprintpay.net:80",
29 | "method": "GET",
30 | "path": "/ext/getbalance/SjWpsbZbkwkLzGWVze3uDtDvYAF3xWEq8j",
31 | "body": "",
32 | "status": 200,
33 | "response": 72444.90533557,
34 | "rawHeaders": [
35 | "Server",
36 | "nginx/1.14.0 (Ubuntu)",
37 | "Date",
38 | "Sun, 23 Aug 2020 09:01:10 GMT",
39 | "Content-Type",
40 | "text/html; charset=utf-8",
41 | "Content-Length",
42 | "14",
43 | "Connection",
44 | "keep-alive",
45 | "X-Powered-By",
46 | "Express",
47 | "ETag",
48 | "\"-2041106560\""
49 | ],
50 | "responseIsBinary": false
51 | }
52 | ]
--------------------------------------------------------------------------------
/lib/drivers/tether.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Tether driver. Supports fetching
6 | * total supply for native token.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Tether extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | total: true,
17 | circulating: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * fetch total supply of native token
25 | *
26 | * @augments Driver.fetchTotalSupply
27 | * @async
28 | */
29 | async fetchTotalSupply() {
30 | const { data: { usdt: { bank_balance: total } } } = await this.request('https://wallet.tether.to/transparency.json');
31 |
32 | return Number(total);
33 | }
34 |
35 | /**
36 | * fetch circulating supply of native token
37 | *
38 | * @augments Driver.fetchCirculatingSupply
39 | * @async
40 | */
41 | async fetchCirculatingSupply() {
42 | const { data: { usdt: { total_liabilities: circulating } } } = await this.request('https://wallet.tether.to/transparency.json');
43 |
44 | return Number(circulating);
45 | }
46 |
47 | /**
48 | * @augments Driver.getSupply
49 | * @async
50 | */
51 | async getSupply() {
52 | const total = await this.fetchTotalSupply();
53 | const circulating = await this.fetchCirculatingSupply();
54 |
55 | return new Supply({
56 | total,
57 | circulating,
58 | });
59 | }
60 | }
61 |
62 | module.exports = Tether;
63 |
--------------------------------------------------------------------------------
/tests/fixtures/BiblePay.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "http://explorer.biblepay.org:80",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 1955417918.693246,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.10.3 (Ubuntu)",
12 | "Date",
13 | "Tue, 14 Jan 2020 09:16:00 GMT",
14 | "Content-Type",
15 | "text/html; charset=utf-8",
16 | "Content-Length",
17 | "18",
18 | "Connection",
19 | "keep-alive",
20 | "X-Powered-By",
21 | "Express",
22 | "ETag",
23 | "\"-1697152072\""
24 | ],
25 | "responseIsBinary": false
26 | },
27 | {
28 | "scope": "http://explorer.biblepay.org:80",
29 | "method": "GET",
30 | "path": "/ext/getbalance/BLsMvLH1PHgrXq74EuhBWrwB9zo6TmKz6T",
31 | "body": "",
32 | "status": 200,
33 | "response": 104456618.84729432,
34 | "rawHeaders": [
35 | "Server",
36 | "nginx/1.10.3 (Ubuntu)",
37 | "Date",
38 | "Tue, 14 Jan 2020 09:16:01 GMT",
39 | "Content-Type",
40 | "text/html; charset=utf-8",
41 | "Content-Length",
42 | "18",
43 | "Connection",
44 | "keep-alive",
45 | "X-Powered-By",
46 | "Express",
47 | "ETag",
48 | "\"1355130006\""
49 | ],
50 | "responseIsBinary": false
51 | }
52 | ]
--------------------------------------------------------------------------------
/lib/drivers/dunscan.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * DunScan explorer. Supports total and circulating
6 | * supply for native token on
7 | * DunNetwork blockchain
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class DunScan extends Driver {
13 | constructor(options) {
14 | super({
15 | supports: {
16 | circulating: true,
17 | blockchains: ['Dune Network'],
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * get total supply for native token
25 | *
26 | * @augments Driver.fetchTotalSupply
27 | * @async
28 | */
29 | async fetchTotalSupply() {
30 | const { total_supply_ico: supply } = await this.request(
31 | 'https://api6.dunscan.io/v4/supply',
32 | );
33 |
34 | return Number(supply) / 10 ** 7;
35 | }
36 |
37 | /**
38 | * get circulating supply for native token
39 | *
40 | * @augments Driver.fetchCirculatingSupply
41 | * @async
42 | */
43 | async fetchCirculatingSupply() {
44 | const { circulating_supply: circulating } = await this.request(
45 | 'https://api6.dunscan.io/v4/supply',
46 | );
47 |
48 | return Number(circulating) / 10 ** 7;
49 | }
50 |
51 | /**
52 | * @augments Driver.getSupply
53 | */
54 | async getSupply() {
55 | const total = await this.fetchTotalSupply();
56 | const circulating = await this.fetchCirculatingSupply();
57 |
58 | return new Supply({
59 | total,
60 | circulating,
61 | });
62 | }
63 | }
64 |
65 | module.exports = DunScan;
66 |
--------------------------------------------------------------------------------
/lib/drivers/neutrino-dollar.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * NeutrinoDollar driver. Supports circulating and
6 | * total supply for USDN token on Waves blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class NeutrinoDollar extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 request per second
15 | supports: {
16 | circulating: true,
17 | total: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * fetch circulating supply for native token
25 | *
26 | * @augments Driver.fetchTotalSupply
27 | * @async
28 | */
29 | async fetchTotalSupply() {
30 | const total = await this.request('https://beta.neutrino.at/api/explorer/get_total_issued');
31 |
32 | return Number(total);
33 | }
34 |
35 | /**
36 | * fetch circulating supply for native token
37 | *
38 | * @augments Driver.fetchCirculatingSupply
39 | * @async
40 | */
41 | async fetchCirculatingSupply() {
42 | const circulating = await this.request('https://beta.neutrino.at/api/explorer/get_total_issued');
43 |
44 | return Number(circulating);
45 | }
46 |
47 | /**
48 | * @augments Driver.getSupply
49 | * @async
50 | */
51 | async getSupply() {
52 | const total = await this.fetchTotalSupply();
53 | const circulating = await this.fetchCirculatingSupply();
54 |
55 | return new Supply({
56 | total,
57 | circulating,
58 | });
59 | }
60 | }
61 |
62 | module.exports = NeutrinoDollar;
63 |
--------------------------------------------------------------------------------
/lib/drivers/cosmostation.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Cosmostation driver. Supports total and
6 | * circulating supply for native token COSMOS
7 | * on their blockchain Cosmos.
8 | *
9 | * @augments Driver
10 | * @memberof Driver
11 | */
12 | class Cosmostation extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | circulating: true,
18 | blockchains: ['Cosmos'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * fetch total supply for native token
26 | *
27 | * @augments Driver.fetchTotalSupply
28 | * @async
29 | */
30 | async fetchTotalSupply() {
31 | const { total_supply_tokens: total } = await this.request('https://api.cosmostation.io/v1/status');
32 | return total / 10 ** 6;
33 | }
34 |
35 | /**
36 | * fetch circulating supply for native token
37 | *
38 | * @augments Driver.fetchCirculatingSupply
39 | * @async
40 | */
41 | async fetchCirculatingSupply() {
42 | const { total_circulating_tokens: total } = await this.request('https://api.cosmostation.io/v1/status');
43 | return total / 10 ** 6;
44 | }
45 |
46 | /**
47 | * @augments Driver.getSupply
48 | */
49 | async getSupply() {
50 | const total = await this.fetchTotalSupply();
51 | const circulating = await this.fetchCirculatingSupply();
52 |
53 | return new Supply({
54 | total,
55 | circulating,
56 | });
57 | }
58 | }
59 |
60 | module.exports = Cosmostation;
61 |
--------------------------------------------------------------------------------
/lib/drivers/blockmeta.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Blockmeta driver. Support total supply
6 | * and circulating supply for BTM coin
7 | * on Bytom blockchain.
8 | *
9 | * @augments Driver
10 | * @memberof Driver
11 | */
12 | class Blockmeta extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | circulating: true,
18 | blockchains: ['Bytom'],
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * @augments Driver.fetchTotalSupply
26 | * @async
27 | */
28 | async fetchTotalSupply() {
29 | const total = await this.request(
30 | 'https://blockmeta.com/api/v3/asset-totalcoins/ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
31 | ); // BTC coin
32 |
33 | return Number(total);
34 | }
35 |
36 | /**
37 | * @augments Driver.fetchCirculatingSupply
38 | * @async
39 | */
40 | async fetchCirculatingSupply() {
41 | const { circulating_supply: circulating } = await this.request(
42 | 'https://blockmeta.com/api/v2/stat/total',
43 | );
44 |
45 | return Number(circulating) / 10 ** 8;
46 | }
47 |
48 | /**
49 | * @augments Driver.getSupply
50 | * @async
51 | */
52 | async getSupply() {
53 | const total = await this.fetchTotalSupply();
54 |
55 | const circulating = await this.fetchCirculatingSupply();
56 |
57 | return new Supply({
58 | total,
59 | circulating,
60 | });
61 | }
62 | }
63 |
64 | module.exports = Blockmeta;
65 |
--------------------------------------------------------------------------------
/lib/drivers/enery-web.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * EnergyWeb driver.
6 | *
7 | * @augments Driver
8 | * @memberof Driver
9 | */
10 | class EnergyWeb extends Driver {
11 | constructor(options) {
12 | super(
13 | {
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | max: true,
17 | circulating: true,
18 | blockchains: ['Energy Web Chain'],
19 | },
20 | },
21 | options,
22 | );
23 | }
24 |
25 | /**
26 | * @augments Driver.fetchMaxSupply
27 | */
28 | fetchMaxSupply() {
29 | return 100000000;
30 | }
31 |
32 | /**
33 | * @augments Driver.fetchTotalSupply
34 | * @async
35 | */
36 | async fetchTotalSupply() {
37 | const supply = await this.request('https://explorer.energyweb.org/api?module=stats&action=coinsupply');
38 |
39 | return Number(supply);
40 | }
41 |
42 | /**
43 | * @augments Driver.fetchCirculatingSupply
44 | * @async
45 | */
46 | async fetchCirculatingSupply() {
47 | const circulating = await this.request('https://supply.energyweb.org/');
48 |
49 | return Number(circulating);
50 | }
51 |
52 | /**
53 | * @augments Driver.getSupply
54 | */
55 | async getSupply() {
56 | const total = await this.fetchTotalSupply();
57 | const circulating = await this.fetchCirculatingSupply();
58 | const max = this.fetchMaxSupply();
59 |
60 | return new Supply({
61 | max,
62 | total,
63 | circulating,
64 | });
65 | }
66 | }
67 |
68 | module.exports = EnergyWeb;
69 |
--------------------------------------------------------------------------------
/lib/drivers/idena.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Idena driver. Supports total and circulating supply
6 | * for specific wallet address for native token DNA on
7 | * Idena blockchain.
8 | *
9 | * @memberof Driver
10 | * @augments Driver
11 | */
12 | class Idena extends Driver {
13 | constructor(options) {
14 | super(
15 | {
16 | timeout: 100, // 10 request per second
17 | supports: {
18 | circulating: true,
19 | blockchains: ['Idena'],
20 | },
21 | },
22 | options,
23 | );
24 | }
25 |
26 | /**
27 | * get total supply for native token
28 | *
29 | * @augments Driver.fetchTotalSupply
30 | * @async
31 | */
32 | async fetchTotalSupply() {
33 | const { result: { minted } } = await this.request('https://api.idena.io/api/Coins');
34 | return Number(minted);
35 | }
36 |
37 | /**
38 | * get circulating supply for native token
39 | *
40 | * @augments Driver.fetchCirculatingSupply
41 | * @async
42 | */
43 | async fetchCirculatingSupply() {
44 | const { result } = await this.request('https://api.idena.io/api/CirculatingSupply');
45 | return Number(result);
46 | }
47 |
48 | /**
49 | * get supply
50 | *
51 | * @augments Driver.getSupply
52 | */
53 | async getSupply() {
54 | const total = await this.fetchTotalSupply();
55 | const circulating = await this.fetchCirculatingSupply();
56 |
57 | return new Supply({
58 | total,
59 | circulating,
60 | });
61 | }
62 | }
63 |
64 | module.exports = Idena;
65 |
--------------------------------------------------------------------------------
/lib/drivers/xin-fin.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * XinFin driver. Supports
6 | * max, total and circulating supply
7 | * for native token XDC on XinFin
8 | * blockchain.
9 | *
10 | * @memberof Driver
11 | * @augments Driver
12 | */
13 | class XinFin extends Driver {
14 | constructor(options) {
15 | super({
16 | timeout: 100, // 10 requests per second
17 | supports: {
18 | circulating: true,
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * get total supply for native token
26 | *
27 | * @augments Driver.fetchTotalSupply
28 | * @async
29 | */
30 | async fetchTotalSupply() {
31 | const { result: total } = await this.request('https://explorerapi.xinfin.network/publicAPI?module=balance&action=totalXDC');
32 | return Number(total);
33 | }
34 |
35 | /**
36 | * get circulating supply for native token
37 | *
38 | * @augments Driver.fetchCirculatingSupply
39 | * @async
40 | */
41 | async fetchCirculatingSupply() {
42 | const { result: circulating } = await this.request('https://explorerapi.xinfin.network/publicAPI?module=balance&action=getcirculatingsupply');
43 |
44 | return Number(circulating);
45 | }
46 |
47 | /**
48 | * @augments Driver.getSupply
49 | */
50 | async getSupply() {
51 | const total = await this.fetchTotalSupply();
52 | const circulating = await this.fetchCirculatingSupply();
53 |
54 | return new Supply({
55 | total,
56 | circulating,
57 | });
58 | }
59 | }
60 |
61 | module.exports = XinFin;
62 |
--------------------------------------------------------------------------------
/tests/fixtures/Coin4Trade.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.coin4trade.org:443",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 11000157.70157514,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.16.1",
12 | "Date",
13 | "Mon, 17 Aug 2020 16:35:51 GMT",
14 | "Content-Type",
15 | "text/html; charset=utf-8",
16 | "Content-Length",
17 | "18",
18 | "Connection",
19 | "keep-alive",
20 | "X-Powered-By",
21 | "Express",
22 | "ETag",
23 | "W/\"12-jaGf+IRx+nNRQ/fSg0CrMRhHexs\""
24 | ],
25 | "responseIsBinary": false
26 | },
27 | {
28 | "scope": "https://explorer.coin4trade.org:443",
29 | "method": "GET",
30 | "path": "/ext/getbalance/CQ8JdN4px4CfdGbijo7SLkspPKkYGZAsRh",
31 | "body": "",
32 | "status": 200,
33 | "response": 10986164.9999775,
34 | "rawHeaders": [
35 | "Server",
36 | "nginx/1.16.1",
37 | "Date",
38 | "Mon, 17 Aug 2020 16:35:51 GMT",
39 | "Content-Type",
40 | "text/html; charset=utf-8",
41 | "Content-Length",
42 | "16",
43 | "Connection",
44 | "keep-alive",
45 | "X-Powered-By",
46 | "Express",
47 | "ETag",
48 | "W/\"10-XUJiPcxjBdMWg95sfBZPsas4hVM\""
49 | ],
50 | "responseIsBinary": false
51 | }
52 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Idena.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://api.idena.io:443",
4 | "method": "GET",
5 | "path": "/api/Coins",
6 | "body": "",
7 | "status": 200,
8 | "response": {
9 | "result": {
10 | "minted": "57455570.0803580181822211",
11 | "burnt": "1478197.8016662131908343",
12 | "totalBalance": "54544774.1177706129097775",
13 | "totalStake": "1441363.1034953231020957"
14 | }
15 | },
16 | "rawHeaders": [
17 | "Server",
18 | "nginx/1.14.0 (Ubuntu)",
19 | "Date",
20 | "Mon, 03 Aug 2020 20:01:59 GMT",
21 | "Content-Type",
22 | "application/json",
23 | "Content-Length",
24 | "168",
25 | "Connection",
26 | "keep-alive"
27 | ],
28 | "responseIsBinary": false
29 | },
30 | {
31 | "scope": "https://api.idena.io:443",
32 | "method": "GET",
33 | "path": "/api/CirculatingSupply",
34 | "body": "",
35 | "status": 200,
36 | "response": {
37 | "result": "24975719.6180181847835274"
38 | },
39 | "rawHeaders": [
40 | "Server",
41 | "nginx/1.14.0 (Ubuntu)",
42 | "Date",
43 | "Mon, 03 Aug 2020 20:01:59 GMT",
44 | "Content-Type",
45 | "application/json",
46 | "Content-Length",
47 | "39",
48 | "Connection",
49 | "keep-alive"
50 | ],
51 | "responseIsBinary": false
52 | }
53 | ]
--------------------------------------------------------------------------------
/lib/drivers/planet-finance.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * PlanetFinance driver. Supports max,
6 | * total and circulating supply for
7 | * AQUA coin on own blockchain.
8 | *
9 | * @augments Driver
10 | * @memberof Driver
11 | */
12 | class PlanetFinance extends Driver {
13 | constructor(options) {
14 | super({
15 | timeout: 100, // 10 requests per second
16 | supports: {
17 | max: true,
18 | circulating: true,
19 | },
20 | options,
21 | });
22 | }
23 |
24 | /**
25 | * @augments Driver.fetchMaxSupply
26 | */
27 | fetchMaxSupply() {
28 | return 100000;
29 | }
30 |
31 | /**
32 | * @augments Driver.fetchTotalSupply
33 | * @async
34 | */
35 | async fetchTotalSupply() {
36 | const total = await this.request('https://api.planetfinance.io/totalSupply');
37 |
38 | return Number(total);
39 | }
40 |
41 | /**
42 | * @augments Driver.fetchCirculatingSupply
43 | * @async
44 | */
45 | async fetchCirculatingSupply() {
46 | const circulating = await this.request('https://api.planetfinance.io/circulatingSupply');
47 |
48 | return Number(circulating);
49 | }
50 |
51 | /**
52 | * @augments Driver.getSupply
53 | */
54 | async getSupply() {
55 | const max = this.fetchMaxSupply();
56 | const total = await this.fetchTotalSupply();
57 | const circulating = await this.fetchCirculatingSupply();
58 |
59 | return new Supply({
60 | max,
61 | total,
62 | circulating,
63 | });
64 | }
65 | }
66 |
67 | module.exports = PlanetFinance;
68 |
--------------------------------------------------------------------------------
/tests/fixtures/CacheGold.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://contract.cache.gold:443",
4 | "method": "GET",
5 | "path": "/api/totalSupplyDec",
6 | "body": "",
7 | "status": 200,
8 | "response": 34301.57,
9 | "rawHeaders": [
10 | "Date",
11 | "Mon, 31 Aug 2020 16:49:44 GMT",
12 | "Content-Type",
13 | "text/html; charset=utf-8",
14 | "Transfer-Encoding",
15 | "chunked",
16 | "Connection",
17 | "keep-alive",
18 | "Set-Cookie",
19 | "__cfduid=dce0c793af49f0f3e85f5c2f3122f4c781598892584; expires=Wed, 30-Sep-20 16:49:44 GMT; path=/; domain=.cache.gold; HttpOnly; SameSite=Lax",
20 | "X-DNS-Prefetch-Control",
21 | "off",
22 | "X-Frame-Options",
23 | "SAMEORIGIN",
24 | "Strict-Transport-Security",
25 | "max-age=15552000; includeSubDomains",
26 | "X-Download-Options",
27 | "noopen",
28 | "X-Content-Type-Options",
29 | "nosniff",
30 | "X-XSS-Protection",
31 | "1; mode=block",
32 | "Access-Control-Allow-Origin",
33 | "*",
34 | "CF-Cache-Status",
35 | "DYNAMIC",
36 | "cf-request-id",
37 | "04e705c606000091391e898200000001",
38 | "Expect-CT",
39 | "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
40 | "Server",
41 | "cloudflare"
42 | ],
43 | "responseIsBinary": false
44 | }
45 | ]
--------------------------------------------------------------------------------
/tests/fixtures/Ergon.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.ergon.network:443",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 1.04996514,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.18.0 (Ubuntu)",
12 | "Date",
13 | "Wed, 23 Jun 2021 18:28:06 GMT",
14 | "Content-Type",
15 | "text/html; charset=utf-8",
16 | "Content-Length",
17 | "11",
18 | "Connection",
19 | "keep-alive",
20 | "X-Powered-By",
21 | "Express",
22 | "ETag",
23 | "W/\"b-LlFKzbFfmxvyQf68KeS03N3wGo0\""
24 | ],
25 | "responseIsBinary": false
26 | },
27 | {
28 | "scope": "https://explorer.ergon.network:443",
29 | "method": "GET",
30 | "path": "/ext/getbalance/ergon:qq9n52zdwja0rk4gx8msnpy3hxmc8eu0cy7l86e37z",
31 | "body": "",
32 | "status": 200,
33 | "response": 0.48430502,
34 | "rawHeaders": [
35 | "Server",
36 | "nginx/1.18.0 (Ubuntu)",
37 | "Date",
38 | "Wed, 23 Jun 2021 18:28:07 GMT",
39 | "Content-Type",
40 | "text/html; charset=utf-8",
41 | "Content-Length",
42 | "10",
43 | "Connection",
44 | "keep-alive",
45 | "X-Powered-By",
46 | "Express",
47 | "ETag",
48 | "W/\"a-uBM48FUhSX2Rjig0widQMf0Pqgs\""
49 | ],
50 | "responseIsBinary": false
51 | }
52 | ]
--------------------------------------------------------------------------------
/tests/fixtures/QnodeCoin.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "scope": "https://explorer.qngnode.cc:443",
4 | "method": "GET",
5 | "path": "/ext/getmoneysupply",
6 | "body": "",
7 | "status": 200,
8 | "response": 4206425.05545825,
9 | "rawHeaders": [
10 | "Server",
11 | "nginx/1.14.0 (Ubuntu)",
12 | "Date",
13 | "Mon, 17 Aug 2020 15:52:20 GMT",
14 | "Content-Type",
15 | "text/html; charset=utf-8",
16 | "Content-Length",
17 | "17",
18 | "Connection",
19 | "keep-alive",
20 | "X-Powered-By",
21 | "Express",
22 | "ETag",
23 | "W/\"11-9OKqY+7pmtNt7TRVXMA1hmgMAko\""
24 | ],
25 | "responseIsBinary": false
26 | },
27 | {
28 | "scope": "https://explorer.qngnode.cc:443",
29 | "method": "GET",
30 | "path": "/ext/getbalance/9ECoBGxXM3vfaMdne691KGdtHwJQE2MLZB",
31 | "body": "",
32 | "status": 200,
33 | "response": 1747159.28838551,
34 | "rawHeaders": [
35 | "Server",
36 | "nginx/1.14.0 (Ubuntu)",
37 | "Date",
38 | "Mon, 17 Aug 2020 15:52:20 GMT",
39 | "Content-Type",
40 | "text/html; charset=utf-8",
41 | "Content-Length",
42 | "16",
43 | "Connection",
44 | "keep-alive",
45 | "X-Powered-By",
46 | "Express",
47 | "ETag",
48 | "W/\"10-aAAC9XtCZdbHREZfCGdv8gGLccE\""
49 | ],
50 | "responseIsBinary": false
51 | }
52 | ]
--------------------------------------------------------------------------------
/lib/drivers/avalanche.js:
--------------------------------------------------------------------------------
1 | const Driver = require('../models/driver');
2 | const Supply = require('../models/supply');
3 |
4 | /**
5 | * Avalanche driver. Support
6 | * total and circualting supply for AVAX token on own blockchain.
7 | *
8 | * @memberof Driver
9 | * @augments Driver
10 | */
11 | class Avalanche extends Driver {
12 | constructor(options) {
13 | super({
14 | timeout: 100, // 10 requests per second
15 | supports: {
16 | circulating: true,
17 | max: true,
18 | },
19 | options,
20 | });
21 | }
22 |
23 | /**
24 | * @augments Driver.fetchMaxSupply
25 | * @async
26 | */
27 | fetchMaxSupply() {
28 | return 720000000;
29 | }
30 |
31 | /**
32 | * @augments Driver.fetchTotalSupply
33 | * @async
34 | */
35 | async fetchTotalSupply() {
36 | const { totalSupply: total } = await this.request('https://avascan.info/api/v1/supply');
37 |
38 | return Number(total);
39 | }
40 |
41 | /**
42 | * @augments Driver.fetchCirculatingSupply
43 | * @async
44 | */
45 | async fetchCirculatingSupply() {
46 | const { circulatingSupply: circulating } = await this.request('https://avascan.info/api/v1/supply');
47 |
48 | return Number(circulating);
49 | }
50 |
51 | /**
52 | * @augments Driver.getSupply
53 | */
54 | async getSupply() {
55 | const total = await this.fetchTotalSupply();
56 | const max = this.fetchMaxSupply();
57 | const circulating = await this.fetchCirculatingSupply();
58 |
59 | return new Supply({
60 | total,
61 | max,
62 | circulating,
63 | });
64 | }
65 | }
66 |
67 | module.exports = Avalanche;
68 |
--------------------------------------------------------------------------------