Skip to content

Commit

Permalink
docs: various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Mar 7, 2024
1 parent 94115da commit cff0a91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/guides/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ const encryptedParam8 = instance.encrypt4(3);
const encryptedParam8 = instance.encrypt8(14);
const encryptedParam16 = instance.encrypt16(650);
const encryptedParam32 = instance.encrypt32(71721057);
const encryptedParam32 = instance.encrypt64(71721075);
const encryptedParam64 = instance.encrypt64(71721075);
```
6 changes: 3 additions & 3 deletions docs/guides/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ yarn add fhevmjs
pnpm add fhevmjs
```

`fhevmjs` uses ESM format for web version and commonjs for node version. You need to set the [type to "commonjs" in your package.json](https://nodejs.org/api/packages.html#type) to load the correct version.
`fhevmjs` uses ESM format for web version and commonjs for node version. You need to set the [type to "commonjs" in your package.json](https://nodejs.org/api/packages.html#type) to load the correct version of fhevmjs. If your node project use `"type": "module"`, you can force the loading of the Node version by using `import { createInstance } from 'fhevmjs/node';`

## Create an instance

```javascript
const { createInstance } = require("fhevmjs");
const ethers, { JsonRpcProvider } = require("ethers");
const { ethers, JsonRpcProvider } = require("ethers");

const provider = new JsonRpcProvider(`https://devnet.zama.ai/`);

Expand All @@ -40,4 +40,4 @@ createFhevmInstance().then((instance) => {
});
```

You can now use your instance to [encrypt parameters](inputs.md) or do a [reencryption](reencryption.md).
You can now use your instance to [encrypt parameters](./inputs.md) or do a [reencryption](./reencryption.md).
6 changes: 3 additions & 3 deletions docs/guides/webapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ yarn add fhevmjs
pnpm add fhevmjs
```

`fhevmjs` uses ESM format. You need to set the [type to "module" in your package.json](https://nodejs.org/api/packages.html#type).
`fhevmjs` uses ESM format. You need to set the [type to "module" in your package.json](https://nodejs.org/api/packages.html#type). If your node project use `"type": "commonjs"` or no type, you can force the loading of the web version by using `import { createInstance } from 'fhevmjs/web';`

To use the library in your project, you need to load the WASM of [TFHE](https://www.npmjs.com/package/tfhe) first with `initFhevm`.

Expand All @@ -53,7 +53,7 @@ Once the WASM is loaded, you can now create an instance. An instance needs two e
- The blockchain' chain ID. This value is needed for reencryption process.

```javascript
import { BrowserProvider } from "ethers";
import { ethers, BrowserProvider } from "ethers";
import { initFhevm, createInstance, getPublicKeyCallParams } from "fhevmjs";

const createFhevmInstance = async () => {
Expand All @@ -80,4 +80,4 @@ init().then((instance) => {
});
```

You can now use your instance to [encrypt parameters](inputs.md) or do a [reencryption](reencryption.md).
You can now use your instance to [encrypt parameters](./inputs.md) or do a [reencryption](./reencryption.md).

0 comments on commit cff0a91

Please sign in to comment.