Skip to content

Commit

Permalink
Merge pull request #569 from zama-ai/fhevmjs06
Browse files Browse the repository at this point in the history
chore: updates fhevmjs and fhevmjsMocked to v0.6
  • Loading branch information
jatZama authored Oct 10, 2024
2 parents 331945e + f76de69 commit f51b435
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 21 deletions.
97 changes: 84 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"ethers": "^6.8.0",
"fhevmjs": "^0.5.0",
"fhevmjs": "^0.6.0-1",
"hardhat": "^2.22.10",
"hardhat-deploy": "^0.11.29",
"hardhat-gas-reporter": "^1.0.2",
Expand Down
29 changes: 22 additions & 7 deletions test/instance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { clientKeyDecryptor, createInstance as createFhevmInstance, getCiphertextCallParams } from 'fhevmjs';
import dotenv from 'dotenv';
import {
clientKeyDecryptor,
createEIP712,
createInstance as createFhevmInstance,
generateKeypair,
getCiphertextCallParams,
} from 'fhevmjs';
import { readFileSync } from 'fs';
import * as fs from 'fs';
import { ethers, ethers as hethers, network } from 'hardhat';
import { homedir } from 'os';
import path from 'path';
Expand All @@ -13,13 +21,17 @@ const FHE_CLIENT_KEY_PATH = process.env.FHE_CLIENT_KEY_PATH;

let clientKey: Uint8Array | undefined;

const kmsAdd = dotenv.parse(fs.readFileSync('lib/.env.kmsverifier')).KMS_VERIFIER_CONTRACT_ADDRESS;
const aclAdd = dotenv.parse(fs.readFileSync('lib/.env.acl')).ACL_CONTRACT_ADDRESS;

const createInstanceMocked = async () => {
const instance = await createFhevmInstance({
chainId: network.config.chainId,
});
instance.reencrypt = reencryptRequestMocked;
instance.createEncryptedInput = createEncryptedInputMocked;
instance.getPublicKey = () => '0xFFAA44433';
const instance = {
reencrypt: reencryptRequestMocked,
createEncryptedInput: createEncryptedInputMocked,
getPublicKey: () => '0xFFAA44433',
generateKeypair: generateKeypair,
createEIP712: createEIP712(network.config.chainId),
};
return instance;
};

Expand All @@ -43,7 +55,10 @@ export const createInstances = async (accounts: Signers): Promise<FhevmInstances
};

export const createInstance = async () => {
console.log('net url:', network.config.url);
const instance = await createFhevmInstance({
kmsContractAddress: kmsAdd,
aclContractAddress: aclAdd,
networkUrl: network.config.url,
gatewayUrl: 'http://localhost:7077',
});
Expand Down

0 comments on commit f51b435

Please sign in to comment.