Skip to content

Commit 060c290

Browse files
authored
Merge pull request #119 from FhenixProtocol/cofhejs-0.3.1
Update cofhejs version + update encrypt usage
2 parents 02e47ab + 6946a9e commit 060c290

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

docs/devdocs/cofhejs/encryption-operations.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ const logState = (state) => {
4141
console.log(`Log Encrypt State :: ${state}`);
4242
};
4343

44-
let result: [CofheInBool] = await cofhejs.encrypt(logState, [Encryptable.bool(true)]);
45-
let result: [CoFheInUint8] = await cofhejs.encrypt(logState, [Encryptable.uint8(10)]);
46-
let result: [CoFheInUint16] = await cofhejs.encrypt(logState, [Encryptable.uint16(10)]);
47-
let result: [CoFheInUint32] = await cofhejs.encrypt(logState, [Encryptable.uint32(10)]);
48-
let result: [CoFheInUint64] = await cofhejs.encrypt(logState, [Encryptable.uint64(10)]);
49-
let result: [CoFheInUint128] = await cofhejs.encrypt(logState, [Encryptable.uint128(10)]);
50-
let result: [CoFheInUint256] = await cofhejs.encrypt(logState, [Encryptable.uint256(10)]);
51-
let result: [CoFheInAddress] = await cofhejs.encrypt(logState, [Encryptable.address("0x1234567890123456789012345678901234567890")]);
44+
let result: [CofheInBool] = await cofhejs.encrypt([Encryptable.bool(true)], logState);
45+
let result: [CoFheInUint8] = await cofhejs.encrypt([Encryptable.uint8(10)], logState);
46+
let result: [CoFheInUint16] = await cofhejs.encrypt([Encryptable.uint16(10)], logState);
47+
let result: [CoFheInUint32] = await cofhejs.encrypt([Encryptable.uint32(10)], logState);
48+
let result: [CoFheInUint64] = await cofhejs.encrypt([Encryptable.uint64(10)], logState);
49+
let result: [CoFheInUint128] = await cofhejs.encrypt([Encryptable.uint128(10)], logState);
50+
let result: [CoFheInUint256] = await cofhejs.encrypt([Encryptable.uint256(10)], logState);
51+
let result: [CoFheInAddress] = await cofhejs.encrypt([Encryptable.address("0x1234567890123456789012345678901234567890")], logState);
5252
```
5353

5454
Or, we can use the nested form to encrypt multiple values at once:
5555

5656
```javascript
57-
let result = await cofhejs.encrypt(logState, [
57+
let result = await cofhejs.encrypt([
5858
Encryptable.bool(true),
5959
Encryptable.uint8(10),
6060
Encryptable.uint16(10),
@@ -63,7 +63,7 @@ let result = await cofhejs.encrypt(logState, [
6363
Encryptable.uint128(10),
6464
Encryptable.uint256(10),
6565
Encryptable.address('0x1234567890123456789012345678901234567890'),
66-
])
66+
], logState)
6767
```
6868

6969
The returned types from the encrypt function will be an array of the type `CoFheInBool`, `CoFheInUint8`, `CoFheInUint16`, `CoFheInUint32` (or 64/128/256) or `CoFheInAddress` depending on the type you specified.

docs/devdocs/cofhejs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ const logState = (state: EncryptStep) => {
120120
};
121121

122122
// This will encrypt only the encrypted values (total 4 in this case)
123-
const encryptedValues = await cofhejs.encrypt(logState, [
123+
const encryptedValues = await cofhejs.encrypt([
124124
{ a: Encryptable.bool(false), b: Encryptable.uint64(10n), c: "hello" },
125125
["hello", 20n, Encryptable.address(contractAddress)],
126126
Encryptable.uint8("10"),
127-
] as const);
127+
] as const, logState);
128128

129129
const contract = new ethers.Contract(CONTRACT_ADDRESS, CONTRACT_ABI, wallet);
130130
// Use the encrypted value of 10n
@@ -259,7 +259,7 @@ await decryptCounter();
259259
// Result should be 2
260260
await readCounterDecryptedValue();
261261

262-
const encryptedValues = await cofhejs.encrypt(logState, [Encryptable.uint64(10n)]);
262+
const encryptedValues = await cofhejs.encrypt([Encryptable.uint64(10n)], logState);
263263
await resetCounter(encryptedValues.data[0]);
264264

265265
// Result should be 10

docs/devdocs/pay-attention/component-compatibility.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ This document provides detailed compatibility information for all components in
1313
| Component | Current Version | Minimum Compatible Version | Notes |
1414
|-----------|----------------|-------------------------------------------------------------------------------------------|-------|
1515
| **cofhe-contracts** | [`0.0.13`](https://github.com/FhenixProtocol/cofhe-contracts/tree/v0.0.13) ([abi](https://cofhe-docs.s3.us-east-1.amazonaws.com/v0.0.13/index.html)) | [`0.0.13`](https://github.com/FhenixProtocol/cofhe-contracts/tree/v0.0.13) ([abi](https://cofhe-docs.s3.us-east-1.amazonaws.com/v0.0.13/index.html)) | Solidity Libraries and Smart contracts for FHE operations. |
16-
| **Cofhejs** | [`0.3.0`](https://github.com/FhenixProtocol/cofhejs/releases/tag/v0.3.0) | [`0.2.1-alpha.1`](https://github.com/FhenixProtocol/cofhejs/releases/tag/v0.2.1-alpha.1) | JavaScript library for interacting with FHE contracts and the CoFHE coprocessor. |
17-
| **cofhe-mock-contracts** | [`0.3.0`](https://github.com/FhenixProtocol/cofhe-mock-contracts/releases/tag/v0.3.0) | [`0.2.1-alpha.3`](https://github.com/FhenixProtocol/cofhe-mock-contracts/releases/tag/v0.2.1-alpha.3) | Solidity contracts that mimic CoFHE off-chain behavior. |
18-
| **cofhe-hardhat-plugin** | [`0.3.0`](https://github.com/FhenixProtocol/cofhe-hardhat-plugin/releases/tag/v0.3.0) | [`0.2.1-alpha.3`](https://github.com/FhenixProtocol/cofhe-hardhat-plugin/releases/tag/v0.2.1-alpha.3) | Hardhat plugin that deploys the cofhe-mock-contracts and exposes utilities. |
16+
| **Cofhejs** | [`0.3.1`](https://github.com/FhenixProtocol/cofhejs/releases/tag/v0.3.1) | [`0.2.1-alpha.1`](https://github.com/FhenixProtocol/cofhejs/releases/tag/v0.2.1-alpha.1) | JavaScript library for interacting with FHE contracts and the CoFHE coprocessor. |
17+
| **cofhe-mock-contracts** | [`0.3.1`](https://github.com/FhenixProtocol/cofhe-mock-contracts/releases/tag/v0.3.1) | [`0.2.1-alpha.3`](https://github.com/FhenixProtocol/cofhe-mock-contracts/releases/tag/v0.2.1-alpha.3) | Solidity contracts that mimic CoFHE off-chain behavior. |
18+
| **cofhe-hardhat-plugin** | [`0.3.1`](https://github.com/FhenixProtocol/cofhe-hardhat-plugin/releases/tag/v0.3.1) | [`0.2.1-alpha.3`](https://github.com/FhenixProtocol/cofhe-hardhat-plugin/releases/tag/v0.2.1-alpha.3) | Hardhat plugin that deploys the cofhe-mock-contracts and exposes utilities. |
1919

2020

2121
## Network Compatibility

docs/devdocs/tutorials/migrating-to-cofhe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const logState = (state) => {
214214
// diff-add
215215
}
216216
// diff-add
217-
const encryptedValues = await cofhejs.encrypt(logState, [Encryptable.uint32(10n), Encryptable.uint64(20n)])
217+
const encryptedValues = await cofhejs.encrypt([Encryptable.uint32(10n), Encryptable.uint64(20n)], logState)
218218
```
219219

220220
### 3. Permits and Unsealing

0 commit comments

Comments
 (0)