1.0.7 • Published 5 years ago

npm-komodorpc-library v1.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Komodo_Logo

Node JS Library

RPC API-Library for Komodo-based asset chains, for Node JS Developers

Description:

  • Komodo RPC library helps you integrate your Node JS Apps with Komodo asset-chains without having to setup/implement required RPC functions. Install this NPM Module and call Komodo API RPCs as easily as calling a local function. Komodo RPC library acts as a wrapper between your Node JS app and the Komodo-daemon running on a server.

Installation:

Install 'npm-komodorpc-library' npm Module:

  • npm install npm-komodorpc-library

Usage:

  • Create object for Connect class using rpc_user, rpc_password, rpc_ipaddress, rpc_port parameters from YOUR_SMARTCHAIN_name.conf file
  • Use the above object to call any method
  • Response is a pending Promise return
  • Use Async/Await or Promise to capture the response
Example
  • Using Async function and await keyword :
const komodo = require('npm-komodorpc-library');

const conn = new komodo.Connect(rpc_user='user568251219',
rpc_password='pass766db41922bac0bbe3c1909a41e3dfe0291e2c1b6c76f7172c3e9bdf46f64d16f9',
rpc_ipaddress='http://127.0.0.1',
rpc_port='12450');

async function mainfunc(){
    let walletinfo = await conn.getwalletinfo() // await works in a async function
    console.log(walletinfo)
}

mainfunc()
  • Using promise :
const komodo = require('npm-komodorpc-library');

const conn = new komodo.Connect(rpc_user='user568251219',
rpc_password='pass766db41922bac0bbe3c1909a41e3dfe0291e2c1b6c76f7172c3e9bdf46f64d16f9',
rpc_ipaddress='http://127.0.0.1',
rpc_port='12450');

let walletinfo = conn.getwalletinfo()
walletinfo.then((res)=>console.log(res)) //Promise.prototype.then
  • Create an object of Komodo Connect class with following parameters to populate RPC options and authentication parameters.
ArgumentDescription
rpc_usernameUsername for RPC authentication
rpc_passwordPassword for RPC authentication
node_ipaddressIP address of the node where the Komodo-daemon is running; Default: '127.0.0.1'
rpc_portPort number where the Komodo-daemon is listening for RPCs

Documentation:

NPM package listing:

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago