Skip to content

NFhbar/rpc-client

 
 

Repository files navigation

rpc-client

Build Status

Simple RPC client, supports promises and callbacks.

Installation

Clone repo:

$ git clone [email protected]:NFhbar/rpc-client.git
$ npm install

Examples

Create client

const client = new RpcClient({
  host: '127.0.0.1',
  port: 18332
})

You can also set the parameters individually:

client.set('user', 'bitcoinrpc')

Command using cmd

client.cmd('command').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}]
})

License

This software is licensed under the MIT License.

About

JSON-RPC Client in JavaScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%