Skip to main content

QRL Node Helpers

Build Status Coverage Status npm version GitHub

A helper library for interacting with QRL nodes via GRPC

Installation

npm install @theqrl/node-helpers

Usage

Import the helper class:

var QrlNode = require("@theqrl/node-helpers")
// or for ES6 style imports: import QrlNode from '@theqrl/node-helpers'

instantiate a new class object:

var ip = 'testnet-1.automated.theqrl.org'
var port = '19009'
var testnet = new QrlNode(ip, port)

make a connection to the node:

testnet.connect().then(() => {
console.log(testnet.connection) // true if connection successful
})

make an API call (needs a node connection):

testnet.api('GetStats').then((result) => {
console.log(result)
})

Complete example:

// example.js (requires node v10)

var QrlNode = require("@theqrl/node-helpers")

var ip = 'testnet-1.automated.theqrl.org'
var port = '19009'
var testnet = new QrlNode(ip, port)

testnet.connect().then(() => {
console.log(testnet.connection); // true if connection successful

// we can now start using the API
testnet.api('GetStats').then((result) => {
console.log(result);
});

});

Development of this module

Development requires node version > 10. If using nvm (which is recommended) then nvm use inside the cloned repo will set a correct node version.

npm install to install dependencies

npm run dev will run a nodemon server with continual linting, testing and coverage on file updating

npm run build will transpile ES6 JS using babel for the deployed module

Contact jp@theqrl.org if you are interested in contributing. PRs welcomed.