Skip to content

Commit

Permalink
GITBOOK-9: Update documentation style and Remix IDE
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu authored and gitbook-bot committed Sep 20, 2023
1 parent f190c30 commit 8ae286c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 34 deletions.
30 changes: 13 additions & 17 deletions docs/sdk/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,19 @@ pnpm add fhevmjs

This will download and install the fhevmjs library and its dependencies into your project.

## Template

You can use our [React template using Vite and TypeScript](https://github.com/zama-ai/fhevmjs-react-template)

## Usage

The package includes two different versions: node and browser.

### Node
## Quick start

{% tabs %}
{% tab title="Node" %}
```javascript
const { createInstance } = require('fhevmjs');
createInstance({ chainId, publicKey }).then((instance) => {
console.log(instance);
});
```
{% endtab %}

### Browser

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

```javascript
Expand Down Expand Up @@ -69,11 +63,9 @@ You can take a look at [this template](https://github.com/zama-ai/fhevmjs-react-

### Troubleshooting

#### Webpack: "Module not found: Error: Can't resolve 'tfhe_bg.wasm'"
#### Webpack: "Module not found: Error: Can't resolve 'tfhe\_bg.wasm'"

In the codebase, there is a `new URL('tfhe_bg.wasm')` which triggers a resolve by Webpack. If yo
u encounter an issue, you can add a fallback for this file by adding a resolve configuration in y
our `webpack.config.js`:
In the codebase, there is a `new URL('tfhe_bg.wasm')` which triggers a resolve by Webpack. If yo u encounter an issue, you can add a fallback for this file by adding a resolve configuration in y our `webpack.config.js`:

```javascript
resolve: {
Expand All @@ -85,8 +77,7 @@ our `webpack.config.js`:

#### Issue with importing ESM version

With a bundler such as Webpack or Rollup, imports will be replaced with the version mentioned in the `"browser"` field of the `package.json`.
If you encounter issue with typing, you can use this [tsconfig.json](https://github.com/zama-ai/fhevmjs-react-template/blob/main/tsconfig.json) using TypeScript 5.
With a bundler such as Webpack or Rollup, imports will be replaced with the version mentioned in the `"browser"` field of the `package.json`. If you encounter issue with typing, you can use this [tsconfig.json](https://github.com/zama-ai/fhevmjs-react-template/blob/main/tsconfig.json) using TypeScript 5.

If you encounter any other issue, you can force import of the browser package.

Expand All @@ -108,3 +99,8 @@ const start = async () => {
});
};
```
{% endtab %}
{% endtabs %}



47 changes: 30 additions & 17 deletions docs/solidity/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,37 @@

Welcome to the documentation for fhEVM Solidity Library! This comprehensive guide provides developers with detailed information on the library's functions, parameters, and usage examples. Explore how to leverage TFHE's powerful capabilities for computing over encrypted data within Solidity smart contracts, enabling secure computations and encrypted data manipulation. Unlock a new level of privacy and confidentiality in your blockchain applications with fhEVM Solidity Library.

## Hardhat
## Installation

The best way to start writing smart contracts with fhEVM is to use our [Hardhat template](https://github.com/zama-ai/fhevm-hardhat-template). It allows you to start a fhEVM docker image and run your smart contract on it. Read the [README](https://github.com/zama-ai/fhevm-hardhat-template/blob/main/README.md) for more information.
To get started with fhEVM Solidity Library, you need to install it as a dependency in your JavaScript project. You can do this using npm (Node Package Manager) or Yarn. Open your terminal and navigate to your project's directory, then run one of the following commands:

```bash
# Using npm
npm install fhevm

# Using Yarn
yarn add fhevm

# Using pnpm
pnpm add fhevm
```

This will download and install the fhEVM Solidity Library and its dependencies into your project.

## Quick start

{% tabs %}
{% tab title="Hardhat" %}
The best way to start writing smart contracts with fhEVM is to use our [Hardhat template](https://github.com/zama-ai/fhevm-hardhat-template).

## Docker
It allows you to start a fhEVM docker image and run your smart contract on it. Read the [README](https://github.com/zama-ai/fhevm-hardhat-template/blob/main/README.md) for more information.
{% endtab %}

{% tab title="Remix IDE" %}
We developed a [version of Remix IDE](https://github.com/zama-ai/remix-project) to interact with a blockchain using fhEVM. You can use it on [https://remix.zama.ai](https://remix.zama.ai)
{% endtab %}

{% tab title="Docker" %}
We provide a docker image to spin up a fhEVM node for local development.

```bash
Expand All @@ -21,17 +46,5 @@ If you need to get coins for a specific wallet, you can use the faucet as follow
```bash
docker exec -i fhevm faucet 0xa5e1defb98EFe38EBb2D958CEe052410247F4c80
```

## Solidity library

To get started with fhEVM Solidity Library, you need to install it as a dependency in your JavaScript project. You can do this using npm (Node Package Manager) or Yarn. Open your terminal and navigate to your project's directory, then run one of the following commands:

```bash
# Using npm
npm install fhevm

# Using Yarn
yarn add fhevm
```

This will download and install the fhEVM Solidity Library and its dependencies into your project.
{% endtab %}
{% endtabs %}

0 comments on commit 8ae286c

Please sign in to comment.