项目作者: allmywallets

项目描述 :
Library to retrieve balances and transactions from a variety of cryptocurrencies explorers and exchanges.
高级语言: JavaScript
项目地址: git://github.com/allmywallets/providers.git
创建时间: 2018-01-20T15:03:11Z
项目社区:https://github.com/allmywallets/providers

开源协议:MIT License

下载


Providers

Library to retrieve balances and transactions from a variety of cryptocurrencies explorers and exchanges

npm (scoped)

Installation

  1. npm install @allmywallets/providers

Usage

Cryptocurrency provider

  1. const Provider = require('@allmywallets/providers').providers['ethereum.etherscan']
  2. const provider = new Provider({ apiKey: process.env.ETHERSCAN_API_KEY });
  3. (async function () {
  4. const res = await provider
  5. .address('0x2f5218c475f152152ac9787db76b9eea7e59c3d8')
  6. .fetch(['transactions', 'balances'])
  7. .exec()
  8. console.log(res[0].balances)
  9. }()).catch(console.log)

You can run the code above

  1. node demo.js

DeFi provider

  1. const BSCDeFi = require('@allmywallets/providers').providers['bsc.defi']
  2. const defi = new BSCDeFi();
  3. (async function () {
  4. const platforms = ['pancakeSwap']
  5. const platformPools = await defi
  6. .address('0x91766b9e7c125e48714c63ed76d3c98ddd633da0')
  7. .platforms(platforms)
  8. .exec()
  9. console.log(platformPools)
  10. }()).catch(console.log)

Run the tests

Make sure to set up your env vars

  • YOBIT_API_KEY
  • YOBIT_SECRET
  • CRYPTOID_API_KEY
  • ETHERSCAN_API_KEY
    1. npm test