Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updates fhevmjs and fhevmjsMocked to v0.6 #569

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
immortal-tofu marked this conversation as resolved.
Show resolved Hide resolved
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