mirror of
https://github.com/luxfhe/example-smart-wallet.git
synced 2026-10-30 18:13:16 +00:00
- @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
29 lines
1006 B
TypeScript
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()}`);
|
|
});
|