Coinbase-node by coinbase

The official Knot.js library for the Coinbase API.

Statistics on coinbase-node

The official Knot.js library for the Coinbase API.

Features

  • Utter Test coverage.
  • Support for both API Key + Secret and OAuth Two authentication.
  • Convenient methods for making calls to the API.
  • Automatic parsing of API responses into relevant Javascript objects.
  • Adheres to the nodejs error-first callback protocol.
  • Continuous Integration testing against knot 0.Ten, 0.11, and 0.12.

Installation

npm install coinbase

Version Compatibility

Npm coinbase package name used to refer to the unofficial coinbase library maintained by Matt Walters. Matt graciously permitted us to use the name for this package instead. You can still find that package on Github. Thanks, Matt.

Quick Commence

The very first thing you’ll need to do is sign up for coinbase.

API Key

If you’re writing code for your own Coinbase account, enable an API key. Next, create a Client object for interacting with the API:

OAuth2

If you’re writing code that will act on behalf of another user, begin by creating a fresh OAuth Two application. You will need to do some work to obtain OAuth credentials for your users, while outside the scope of this document, please refer to our OAuth Two tutorial and documentation. Once you have these credentials, create a client:

Making API Calls

With a client example , you can now make API calls. We’ve included some examples below, but in general the library has Javascript prototypes for each of the objects described in our REST API documentation. These classes each have methods for making the relevant API calls, for example, coinbase.model.Transaction.finish maps to the finish bitcoin request API endpoint. The comments of each method in the code references the endpoint it implements. Each API method comes back an object indicating the JSON response from the API.

Listing available accounts

Get Balance from an Account Id

Listing current transactions

Verifying merchant callback authenticity

Error Treating

Errors are thrown for invalid arguments but are otherwise returned as the very first argument to callback functions using http-errors module.

Errors contain name , status , and message fields for error treating. You can find more information about error types here

Testing / Contributing

Any and all contributions are welcome! The process is plain:

  1. Fork this repo
  2. Make your switches and add tests
  3. Run the test suite
  4. Submit a pull request.

Tests are run via mocha and nock. To run the tests, clone the repository and then:

Please also scan the packages for known vulnerabilities.

Related movie: Fidelity Bets Big On Bitcoin On CNBC


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *