Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theqrl/node-helpers
QRL node helpers
https://github.com/theqrl/node-helpers
qrl
Last synced: 5 days ago
JSON representation
QRL node helpers
- Host: GitHub
- URL: https://github.com/theqrl/node-helpers
- Owner: theQRL
- License: mit
- Created: 2018-04-15T15:46:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-09T17:04:52.000Z (almost 2 years ago)
- Last Synced: 2024-08-11T00:29:20.707Z (3 months ago)
- Topics: qrl
- Language: JavaScript
- Size: 769 KB
- Stars: 1
- Watchers: 4
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @theqrl/node-helpers
[![Build Status](https://travis-ci.com/theQRL/node-helpers.svg?branch=master)](https://travis-ci.com/theQRL/node-helpers) [![Coverage Status](https://coveralls.io/repos/github/theQRL/node-helpers/badge.svg?branch=master)](https://coveralls.io/github/theQRL/node-helpers?branch=master) [![npm version](https://badge.fury.io/js/%40theqrl%2Fnode-helpers.svg)](https://badge.fury.io/js/%40theqrl%2Fnode-helpers) ![GitHub](https://img.shields.io/github/license/theqrl/node-helpers)
A helper library for interacting with QRL nodes via GRPC
## Installation
`npm install @theqrl/node-helpers`
## Usage
import the helper class:
```javascript
var QrlNode = require("@theqrl/node-helpers")
// or for ES6 style imports: import QrlNode from '@theqrl/node-helpers'
```instantiate a new class object:
```javascript
var ip = 'testnet-1.automated.theqrl.org'
var port = '19009'
var testnet = new QrlNode(ip, port)
```make a connection to the node:
```javascript
testnet.connect().then(() => {
console.log(testnet.connection) // true if connection successful
})
```make an API call (needs a node connection):
```javascript
testnet.api('GetStats').then((result) => {
console.log(result)
})
```Complete example:
```javascript
// 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.js version ≥ 16. If using nvm (which is recommended) then `nvm use` inside the cloned repo will set a correct node version.
`npm install` to install dependecies
`npm run build` will transpile ES6 JS using babel for the deployed module
Contact [email protected] if you are interested in contributing. PRs welcomed.