Skip to content

Commit

Permalink
Merge pull request #486 from zama-ai/typosEncrypt
Browse files Browse the repository at this point in the history
docs: fixed typos for encrypt
  • Loading branch information
jatZama authored Aug 30, 2024
2 parents 6cdf722 + 080991e commit 8ac8ef9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
14 changes: 11 additions & 3 deletions docs/fundamentals/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@ On client side for the previous function, using [fhevmjs](https://github.com/zam
const instance = await createInstance({ networkUrl: "http://localhost:8545" });

const input = instance.createEncryptedInput(contractAddress, userAddress);
const { inputs, data } = input.add64(64).addBool(true).add8(4).encrypt(); // Encrypt the three parameters

contract.myExample("0xa5e1defb98EFe38EBb2D958CEe052410247F4c80", inputs[0], 32, inputs[1], inputs[2], data);
const inputs = input.add64(64).addBool(true).add8(4).encrypt(); // Encrypt the three parameters

contract.myExample(
"0xa5e1defb98EFe38EBb2D958CEe052410247F4c80",
inputs.handles[0],
32,
inputs.handles[1],
inputs.handles[2],
true,
inputs.inputProof,
);
```

### Validate input
Expand Down
18 changes: 13 additions & 5 deletions docs/references/fhevmjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ An input can include **multiple values of various types**, resulting in a single
const userAddress = "0xa5e1defb98EFe38EBb2D958CEe052410247F4c80";
const contractAddress = "0xfCefe53c7012a075b8a711df391100d9c431c468";

const input = instance.createEncryptedInput(userAddress, contractAddress);
const input = instance.createEncryptedInput(contractAddress, userAddress);
```

### input.addBool, input.add8, ...
Expand All @@ -75,7 +75,7 @@ Input object has different method to add values:
- `addAddress`

```javascript
const input = instance.createEncryptedInput(userAddress, contractAddress);
const input = instance.createEncryptedInput(contractAddress, userAddress);

input.addBool(true);
input.add16(239);
Expand All @@ -91,9 +91,17 @@ These methods process values and return the necessary data for use on the blockc
input.addBool(true);
input.addBool(true);
input.add8(4);
const { inputs, data } = input.encrypt(); // or input.send() if using a coprocessor

contract.myExample("0xa5e1defb98EFe38EBb2D958CEe052410247F4c80", inputs[0], 32, inputs[1], inputs[2], data);
const inputs = input.encrypt(); // or input.send() if using a coprocessor

contract.myExample(
"0xa5e1defb98EFe38EBb2D958CEe052410247F4c80",
inputs.handles[0],
32,
inputs.handles[1],
inputs.handles[2],
true,
inputs.inputProof,
);
```

## Reencryption
Expand Down

0 comments on commit 8ac8ef9

Please sign in to comment.