0.3.1 • Published 8 years ago

bitcoind-rpc-client v0.3.1

Weekly downloads
152
License
MIT
Repository
github
Last release
8 years ago

bitcoind-rpc-client

NPM Package build status Coverage Status Dependency status

js-standard-style

Bitcoind RPC client with blackjack and hookers.

Current rpc client support promises and callbacks.

Installation

npm install bitcoind-rpc-client

Commands

You can find list of all available commands in source code.

Examples

Create client

var client = new RpcClient({
  host: '127.0.0.1',
  port: 18332
});
client.set('user', 'bitcoinrpc')

getnewaddress with callback

client.getNewAddress(function (err, result) {
  console.log(err, result) // null, {result: {...}, error: null}
})

getnewaddress with promise

client.getNewAddress().then(function (result) {
  console.log(result) // {result: {...}, error: null}
})

alias of getnewaddress with promise

client.getnewaddress().then(function (result) {
  console.log(result) // {result: {...}, error: null}
})

getnewaddress using cmd

client.cmd('getnewaddress').then(function (result) {
  console.log(result) // {result: {...}, error: null}
})

batch (array form)

client.batch([
  {method: 'getnewaddress', params: ['myaccount']},
  {method: 'getnewaddress', params: ['myaccount']}
])
.then(function (result) {
  console.log(result) // [{result: {...}, error: null}, {result: {...}, error: null}]
})

batch (chained form)

client.batch()
  .getInfo()
  .clear()
  .getNewAddress('myaccount')
  .getNewAddress('secondaccount')
  .call()
  .then(function (result) {
    console.log(result) // [{result: {...}, error: null}, {result: {...}, error: null}]
  })

License

Code released under the MIT license.

0.3.1

8 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago