Skip to content

Commit

Permalink
Merge pull request #6 from jplomas/master
Browse files Browse the repository at this point in the history
Complete example to README
  • Loading branch information
jplomas authored Jul 17, 2020
2 parents cfff9e4 + eae0cea commit 6bd5475
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ A helper library for interacting with QRL nodes via GRPC
import the helper class:

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

instantiate a new class object:

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

make a connection to the node:
Expand All @@ -40,6 +41,26 @@ testnet.api('GetStats').then((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
})

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.
Expand Down

0 comments on commit 6bd5475

Please sign in to comment.