Skip to content

Commit

Permalink
Fix import and installation + example in readme. (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M authored Mar 18, 2021
1 parent b4ad86a commit 5c96ab3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-import-and-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nodejs-binding": minor
---

Fix import and installation + example in readme.
26 changes: 6 additions & 20 deletions bindings/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,15 @@

Node.js binding to the IOTA client library.

## Requirements

`Rust` and `Cargo` are required. Install them [here](https://doc.rust-lang.org/cargo/getting-started/installation.html).

## Installation

Currently the package isn't published so you'd need to link it to your project using `npm` or `yarn`.

- Using NPM:
```
$ git clone https://github.com/iotaledger/iota.rs
$ cd iota.rs/bindings/nodejs
$ npm link
$ cd /path/to/nodejs/project/
$ npm link iota-client
$ npm i @iota/client
```
- Using yarn:
```
$ git clone https://github.com/iotaledger/iota.rs
$ cd iota.rs/bindings/nodejs
$ yarn link
$ cd /path/to/nodejs/project/
$ yarn link iota-client
$ yarn add @iota/client
```

Connecting to a MQTT broker using raw ip doesn't work. This is a limitation of rustls.
Expand All @@ -34,11 +20,11 @@ Connecting to a MQTT broker using raw ip doesn't work. This is a limitation of r
After you linked the library, you can create a `Client` instance and interface with it.

```javascript
const { ClientBuilder } = require('iota-client')
const { ClientBuilder } = require('@iota/client')
const client = new ClientBuilder()
.node('http://localhost:14265')
.build()
client.getTips().then(console.log).catch(console.error)
.node('https://api.lb-0.testnet.chrysalis2.com')
.build()
client.getInfo().then(console.log).catch(console.error)
```

## API Reference
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
UnspentAddressGetter,
AddressGetter,
BalanceGetter
} = require('../native')
} = require('../build/Release')

function promisify(fn, parse = true) {
return function () {
Expand Down

0 comments on commit 5c96ab3

Please sign in to comment.