Coder Social home page Coder Social logo

coinbase-auth's Introduction

coinbase-auth

A Node.js library for interacting with the Coinbase Bitcoin API

Takes care of nonce-ing and authentication for Coinbase's secure API. Usage could not be easier. First:

npm install coinbase-auth

Next, give coinbase-auth your API credentials:

var coinbase = require('coinbase-auth');

coinbase.key('myAPIkey');
coinbase.secret('myAPIsecret');

Making a request is as easy as creating an options object and specifying the method. I use the following format:

var options = {
  url: 'https://coinbase.com/api/v1/account/generate_receive_address',
  json: {
    'address': {
      'callback_url': 'http://www.example.com/callback',
      'label': 'Dalmation donations'
    }
  }
};

coinbase.post(options, function (err, res) {
  if (err) {
    console.log(err);
  } else {
    console.log(res);
  }
});

var putOptions = {
  url: 'https://coinbase.com/api/v1/users/512db383f8182bd24d000001',
  json: {
    'user': {
      'email': '[email protected]'
    }
  }
};

coinbase.put(options, function (err, res) {
  if (err) {
    console.log(err);
  } else {
    console.log(res);
  }
});

For a GET or DELETE request, omit the options object and pass in only the url.

var url = 'https://coinbase.com/api/v1/account/balance';

coinbase.get(url, function (err, res) {
  if (err) {
    console.log(err);
  } else {
    console.log(res);
  }
});

var deleteUrl = 'https://coinbase.com/api/v1/transactions/501a3554f8182b2754000003/cancel_request';

coinbase.delete(url, function (err, res) {
  if (err) {
    console.log(err);
  } else {
    console.log(res);
  }
});

To see what you can do with the Coinbase API, take a look at their documentation.

To show your appreciation for this module, feel free to send love to 1EM5MS6pNdVKm1H5qu3VGY7NXh3ZqjAkti

coinbase-auth's People

Contributors

bitfundit avatar tmlbl avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

coinbase-auth's Issues

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.