Files
Fuma Nama 0fb792d6f8 refactor(fhe): unify API - reveal() replaces getDecryptResult()
- Update to unified FHE decryption API
- Add foundry.toml for testing
- Update dependencies to @luxfi/contracts
2025-12-31 21:11:02 -08:00

32 lines
885 B
TypeScript

import { type SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
import { type Permission } from "@luxfhe/sdk";
import { type HardhatRuntimeEnvironment } from "hardhat/types/runtime";
export const getTokensFromFaucet = async (
hre: HardhatRuntimeEnvironment,
address: string,
) => {
if (hre.network.name === "localluxfhe") {
if ((await hre.ethers.provider.getBalance(address)).toString() === "0") {
await hre.luxfhe.getFunds(address);
}
}
};
export const createPermissionForContract = async (
hre: HardhatRuntimeEnvironment,
signer: SignerWithAddress,
contractAddress: string,
): Promise<Permission> => {
const provider = hre.ethers.provider;
const permit = await hre.luxfhe.generatePermit(
contractAddress,
provider,
signer,
);
const permission = hre.luxfhe.extractPermitPermission(permit);
return permission;
};