diff --git a/documentation/src/02-installing.md b/documentation/src/02-installing.md index 3bf4efd..7efc418 100644 --- a/documentation/src/02-installing.md +++ b/documentation/src/02-installing.md @@ -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 diff --git a/documentation/src/03-guides-example.md b/documentation/src/03-guides-example.md index c667c7d..a8d43b1 100644 --- a/documentation/src/03-guides-example.md +++ b/documentation/src/03-guides-example.md @@ -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: