Coder Social home page Coder Social logo

alexander-morris / crypto-balances Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danielheyman/crypto-balances

0.0 1.0 0.0 101 KB

Crypto coins and tokens api for checking balances of an address

License: Other

Dockerfile 0.34% JavaScript 99.66%

crypto-balances's Introduction

Extended from the original deprecated package by @litvintech to provide API services and re-formatted results.

Crypto-balances

Easily check address balances of various crypto tokens. Script automaticaly recognizes a protocol by address and returns balances of tokens associated with it.

As a dependency

Require the package and use it as any other promise:

~ » npm install --save https://github.com/danielheyman/crypto-balances.git
const balance = require('crypto-balances');

balance("0xfc30a6c6d1d61f0027556ed25a670345ab39d0cb")
.then(result => console.log(result))
.catch(error => console.log(`OH NO! ${error}`));

// logs: { "address_type": "ETH", balances: {"ETH": 0.29, "OMG": 124.448} }

// balance takes an optional second coin type parameter.
// eg. balance("0xfc30a6c6d1d61f0027556ed25a670345ab39d0cb", "BTC")

As an API

Run npm start to get the service running.

An API call can be made to port 8888 with a given address to http://127.0.0.71:8888/address_to_check.

It will return a json response such as { "address_type": "ETH", balances: {"ETH": 0.29, "OMG": 124.448} }.

If an error occurs, it will return a json response such as { "error": "ethplorer: Invalid API key" }.

For a specific coin, a call can be made to http://127.0.0.71:8888/coin/address_to_check. eg. http://127.0.0.71:8888/eth/0xfc30a6c6d1d61f0027556ed25a670345ab39d0cb

As an API using Docker

Useful when running on a machine with multiple node applications, each requiring different specifications.

Run docker-compose up to get the container up.

An API call can be made on port 8888 with a given address to http://0.0.0.0:8888/address_to_check.

Supported Protocols

Installation

~ » git clone https://github.com/danielheyman/crypto-balances
~ » cd crypto-balances
~ » npm install
~ » npm start

Tests

~ » npm run test

License

Under MIT License

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

crypto-balances's People

Contributors

danielheyman avatar ziddey avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.