Skip to content

Commit

Permalink
fix: updated utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jatZama committed Mar 7, 2024
1 parent 0f6fc65 commit cc3b92a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 3 additions & 1 deletion test/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export const createInstance = async (contractAddress: string, account: Signer, e
const instance = await fhevmjs.createInstance({ chainId, publicKey });

if (HARDHAT_NETWORK === "hardhat") {
instance.encryptBool = createUintToUint8ArrayFunction(1);
instance.encrypt4 = createUintToUint8ArrayFunction(4);
instance.encrypt8 = createUintToUint8ArrayFunction(8);
instance.encrypt16 = createUintToUint8ArrayFunction(16);
instance.encrypt32 = createUintToUint8ArrayFunction(32);
Expand Down Expand Up @@ -81,7 +83,7 @@ const generatePublicKey = async (contractAddress: string, signer: Signer, instan

function createUintToUint8ArrayFunction(numBits: number) {
const numBytes = Math.ceil(numBits / 8);
return function (uint: number | bigint) {
return function (uint: number | bigint | boolean) {
const buffer = toBufferBE(BigInt(uint), numBytes);
return buffer;
};
Expand Down
12 changes: 0 additions & 12 deletions test/types.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import type { FhevmInstance } from "fhevmjs";

import { ConfidentialERC20 } from "../types";
import type { Signers } from "./signers";

declare module "mocha" {
export interface Context {
signers: Signers;
contractAddress: string;
instances: FhevmInstances;
erc20: ConfidentialERC20;
}
}

export interface FhevmInstances {
alice: FhevmInstance;
bob: FhevmInstance;
Expand Down

0 comments on commit cc3b92a

Please sign in to comment.