@dadi/nano

0.4.0 • Public • Published

Node.js JSON-RPC Client for Nano

Overview

Install

$ npm install @dadi/nano

Usage

const Nano = require('@dadi/nano')

// configure connection options
const options = {
  host: '127.0.0.1',
  port: 3456
}

const nano = new Nano(options)

nano
  .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

nano
  .accountInfo('xrb_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est', null, true, true)
  .then(accountInfo => {
    console.log(accountInfo)
  })

Single object argument

nano
  .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'

Readme

Keywords

none

Package Sidebar

Install

npm i @dadi/nano

Weekly Downloads

0

Version

0.4.0

License

ISC

Last publish

Collaborators

  • annybs
  • josephdenne
  • jimlambie
  • adamkdean