mirror of
https://github.com/luxfhe/example-rng-game.git
synced 2026-10-30 18:13:18 +00:00
- Update to unified FHE decryption API - Update dependencies to @luxfi/contracts
32 lines
890 B
TypeScript
32 lines
890 B
TypeScript
import { type SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
|
|
import { type Permission } from "@luxfhe/sdk/node";
|
|
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;
|
|
};
|