0.0.3 • Published 6 years ago

flappycoin v0.0.3

Weekly downloads
2
License
Unlicense
Repository
github
Last release
6 years ago

node-flappycoin

npm downloads js-standard-style

node-flappycoin is a simple wrapper for the flappycoin client's JSON-RPC API.

If starting a new project, I highly encourage you to take a look at the more modern flappycoin-core, which features:

  • ES6 support
  • optional promise support
  • support for newer REST API, in addition to RPC methods

Install

npm install flappycoin

Examples

Create client

// all config options are optional
var client = new flappycoin.Client({
  host: 'localhost',
  port: 8332,
  user: 'username',
  pass: 'password',
  timeout: 30000
});

Get balance across all accounts with minimum confirmations of 6

client.getBalance('*', 6, function(err, balance, resHeaders) {
  if (err) return console.log(err);
  console.log('Balance:', balance);
});

Getting the balance directly using cmd

client.cmd('getbalance', '*', 6, function(err, balance, resHeaders){
  if (err) return console.log(err);
  console.log('Balance:', balance);
});

Batch multiple RPC calls into single HTTP request

var batch = [];
for (var i = 0; i < 10; ++i) {
  batch.push({
    method: 'getnewaddress',
    params: ['myaccount']
  });
}
client.cmd(batch, function(err, address, resHeaders) {
  if (err) return console.log(err);
  console.log('Address:', address);
});

Flap on!

0.0.3

6 years ago

0.0.2

6 years ago

3.0.1

6 years ago