raiblocks
v0.4.0
Published
Node.js JSON-RPC Client for RaiBlocks
Downloads
8
Readme
Node.js JSON-RPC Client for RaiBlocks
Overview
- Promise-based
- https://github.com/clemahieu/raiblocks/wiki/RPC-protocol
Install
$ npm install raiblocks
Usage
const RaiBlocks = require('raiblocks')
// configure connection options
const options = {
host: '127.0.0.1',
port: 3456
}
const raiBlocks = new RaiBlocks(options)
raiBlocks
.accountInfo('xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est')
.then(accountInfo => {
console.log(accountInfo)
})
Optional arguments
Some calls accept optional parameters, as seen in the documentation for Account Info. There are two ways to call all methods, one is to specify all the arguments, in order (as specified in callSpec.js), or to pass an object containing properties for the arguments you need.
Specify all arguments
raiBlocks
.accountInfo('xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est', null, true, true)
.then(accountInfo => {
console.log(accountInfo)
})
Single object argument
raiBlocks
.accountInfo({
account: 'xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est',
weight: true
}).then(accountInfo => {
console.log(accountInfo)
})
Configuration
| Property | Description | Default
|:---- |:----------------- |:-------------------
| host | | '127.0.0.1'
| port | | 3456
| protocol | | 'http'
| user | | 'user'
| password | | 'pass'