Skip to content

Commit

Permalink
update code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jochasinga committed Oct 29, 2024
1 parent 99f0efa commit 60862d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 6 additions & 8 deletions documentation/src/02-installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ In this section, we will show how to add Filecoin.js library to your web applica

## NodeJS

**Step 1:** Install Filecoin.js using [yarn](https://classic.yarnpkg.com/en/package/jest)
**Step 1:** Install Filecoin.js

```shell
$ npm install filecoin.js
// or
$ yarn add filecoin.js
```
or [npm](https://www.npmjs.com/)
```shell
$ npm install filecoin.js
```

**Step 2:** Import module using node.js require or ES6 synthax

```javascript
const { } = require("filecoin.js");
const filecoin = require("filecoin.js");
// or
import { } from "filecoin.js";
import * as filecoin from "filecoin.js";
```

## Browser
Expand Down
14 changes: 8 additions & 6 deletions documentation/src/03-guides-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ Node JavaScript/TypeScript:
```javascript
import { HttpJsonRpcConnector, LotusClient } from 'filecoin.js';

(async () => {

const httpConnector = new HttpJsonRpcConnector({ url: __LOTUS_HTTP_RPC_ENDPOINT__, token: __LOTUS_AUTH_TOKEN__ });

async function helloFilecoinJs() {
const httpConnector = new HttpJsonRpcConnector({
url: __LOTUS_HTTP_RPC_ENDPOINT__,
token: __LOTUS_AUTH_TOKEN__
});
const lotusClient = new LotusClient(httpConnector);
const version = await lotusClient.common.version();
console.log(version);
console.log(`Hello, Filecoin.js v${version}`);
}

})().then().catch();
await helloFilecoinJs();
```

Browser:
Expand Down

0 comments on commit 60862d7

Please sign in to comment.