Skip to content

Commit

Permalink
Fix node.js readme example (#2220)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Electron authored Apr 15, 2024
1 parent d9eea41 commit 8dd0d73
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bindings/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,17 @@ calling [`Client.getInfo()`](https://wiki.iota.org/shimmer/iota-sdk/references/n
and then print the node's information.

```javascript
const { Client, initLogger } = require('@iota/sdk');
import { Client } from '@iota/sdk';

// In this example we will get information about the node
async function run() {
initLogger();

const client = new Client({
nodes: ['https://api.testnet.shimmer.network'],
localPow: true,
});

try {
const nodeInfo = await client.getInfo();
console.log('Node info: ', nodeInfo);
const nodeInfo = (await client.getInfo()).nodeInfo;
console.log(nodeInfo);
} catch (error) {
console.error('Error: ', error);
}
Expand Down

0 comments on commit 8dd0d73

Please sign in to comment.