Files
zeekay 7b9c11df53 Update @luxfhe packages to latest versions
- @luxfhe/wasm: ^0.2.0
- @luxfhe/kms: ^0.2.0
- @luxfhe/relayer-sdk: ^0.6.0
- @luxfhe/mock-contracts: ^0.6.0
- Remove deprecated Zama dependencies
2026-01-02 10:49:22 -08:00

29 lines
1006 B
TypeScript

import { Counter } from "../typechain-types";
import { task } from "hardhat/config";
import type { TaskArguments } from "hardhat/types";
task("task:getCount").setAction(async function (_taskArguments: TaskArguments, hre) {
const { luxfhe, ethers, deployments } = hre;
const [signer] = await ethers.getSigners();
const Counter = await deployments.get("Counter");
console.log(`Running getCount, targeting contract at: ${Counter.address}`);
const contract = (await ethers.getContractAt("Counter", Counter.address)) as unknown as unknown as Counter;
const permit = await luxfhe.generatePermit(
Counter.address,
undefined, // use the internal provider
signer,
);
const result = await contract.getCounterPermit(permit);
console.log(`got count: ${result.toString()}`);
const sealedResult = await contract.getCounterPermitSealed(permit);
const unsealed = luxfhe.unseal(Counter.address, sealedResult.data);
console.log(`got unsealed result: ${unsealed.toString()}`);
});