import { CoprocessorConfig, FhevmContractName, FhevmMockProvider, MinimalProvider, MockCoprocessor, contracts } from "@fhevm/mock-utils"; import type { FhevmInstance } from "@zama-fhe/relayer-sdk/node"; import { ethers as EthersT } from "ethers"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; import { HardhatFhevmRuntimeEnvironment } from "../types"; import { FhevmDebugger } from "./FhevmDebugger"; import { FhevmEnvironmentPaths } from "./FhevmEnvironmentPaths"; export type FhevmEnvironmentAddresses = { /** * Indicates the addresses stored in the solidity `CoprocessorConfig` struct used in the project. */ CoprocessorConfig: CoprocessorConfig; /** * Indicates the address of the solidity contract `InputVerifier.sol` used in the project. */ InputVerifierAddress: `0x${string}`; /** * Indicates the address of the solidity contract `HCULimit.sol` used in the project. */ HCULimitAddress: `0x${string}`; /** * Indicates the absolute path of the 'ZamaConfig.sol' solidity file used in the project. */ CoprocessorConfigDotSolPath: string; /** * Indicates the relayer url used in the project. */ relayerUrl?: string; /** * Indicates whether the addresses were resolved using env variables. */ resolvedUsingEnv: boolean; }; export type FhevmSigners = { coprocessor: EthersT.Signer[]; kms: EthersT.Signer[]; zero: EthersT.Signer; zeroAddress: string; one: EthersT.Signer; oneAddress: string; }; export type FhevmProviderInfo = { web3ClientVersion: string; url?: string; networkName: string; isNetworkHardhatNode: boolean; isAnvil: boolean; methods: { setCode?: string; impersonateAccount?: string; setBalance?: string; }; }; export type FhevmContractRecordEntry = { contractName: FhevmContractName; address: string; contract: EthersT.Contract; package: string; }; export declare class FhevmEnvironment { private _hre; private _runningInHHNode; private _runningInHHTest; private _runningInHHFHEVMInstallSolidity; private _paths; private _deployRunning; private _deployCompleted; private _cliAPIInitializing; private _cliAPIInitialized; private _setupAddressesRunning; private _setupAddressesCompleted; private _addresses; private _fhevmMockProvider; private _minimalInitPromise; private _initializeCLIApiPromise; private _contractsRepository; private _instance; private _fhevmAPI; private _fhevmDebugger; private _mockCoprocessor; private _relayerSignerAddress; private _id; private static _idCount; /** * Constructor must be ultra-lightweight! */ constructor(hre: HardhatRuntimeEnvironment); /** * This command is only supported using the 'hardhat' network. */ setRunningInHHFHEVMInstallSolidity(): void; unsetRunningInHHFHEVMInstallSolidity(): void; setRunningInHHTest(): void; /** * `npx hardhat node` only supports the 'hardhat' network * Running `npx hardhat node --network ` will raise the following error * Error HH605: Unsupported network for JSON-RPC server. Only hardhat is currently supported. * Note that `npx hardhat node --network localhost` also fails. */ setRunningInHHNode(): void; get isRunningInHHTest(): boolean; get isRunningInHHNode(): boolean; get isRunningInHHFHEVMInstallSolidity(): boolean; get useEmbeddedMockEngine(): boolean; get hre(): HardhatRuntimeEnvironment; get relayerProvider(): MinimalProvider; get readonlyEthersProvider(): EthersT.Provider; get readonlyEip1193Provider(): MinimalProvider; get mockProvider(): FhevmMockProvider; get paths(): FhevmEnvironmentPaths; get debugger(): FhevmDebugger; /** * Only called by the FhevmProviderExtender */ get coprocessor(): MockCoprocessor; getInstanceOrUndefined(): FhevmInstance | undefined; get instance(): FhevmInstance; getRelayerUrl(): string; resolveRelayerUrl(ACLAddress: string): string; private __getAddresses; getACLAddress(): `0x${string}`; getFHEVMExecutorAddress(): `0x${string}`; getInputVerifierAddress(): `0x${string}`; getKMSVerifierAddress(): `0x${string}`; getCoprocessorSigners(): EthersT.Signer[] | undefined; getCoprocessorSignersOrThrow(): EthersT.Signer[]; getKMSSigners(): EthersT.Signer[] | undefined; getKMSSignersOrThrow(): EthersT.Signer[]; /** * Fhevm Gateway InputVerification.sol contract * Address of the contract deployed on the gateway chain * (identified by the chainId returned from getGatewayChainId()) * responsible for performing EIP-712 signature verification * for input values * @returns InputVerification contract address */ getGatewayInputVerificationAddress(): `0x${string}`; /** * Fhevm Gateway Decryption.sol contract * Address of the contract deployed on the gateway chain * (identified by the chainId returned from getGatewayChainId()) * responsible for performing EIP-712 signature verification * for decryption operations * @returns Decryption contract address */ getGatewayDecryptionAddress(): `0x${string}`; getACLReadOnly(): EthersT.Contract; getFHEVMExecutorReadOnly(): EthersT.Contract; getInputVerifierReadOnly(): EthersT.Contract; getKMSVerifierReadOnly(): EthersT.Contract; getGatewayChainId(): number; get chainId(): number; getRelayerSignerAddress(): string; /** * Client API */ get externalFhevmAPI(): HardhatFhevmRuntimeEnvironment; getContractsRepository(): contracts.FhevmContractsRepository; get isDeployed(): boolean; initializeCLIApi(): Promise; private __initializeCLIApi; /** * TODO: Should be improved: * - if `Sepolia`: no need to deploy! just create instance and pick up addresses * Ex: `npx hardhat fhevm user-decrypt --network sepolia ...` * - if `Hardhat Node`: it's already deployed (because of `npx hardhat node` CLI auto deploy) * - if `Anvil`: may no be deployed (maybe add `npx hardhat fhevm anvil`) */ deploy(): Promise; private __guessDefaultProvider; minimalInitWithAddresses(ignoreCache: boolean): Promise; minimalInit(): Promise; private __minimalInit; private __minimalInitCore; private _createSigners; private _deployCore; createInstance(): Promise; /** * Generates: * - `/path/to/user-package/fhevmTemp/@fhevm/solidity/config/ZamaConfig.sol` */ private __initializeAddresses; private _initializeAddressesEnv; private _initializeAddressesSepolia; private _initializeAddressesMainnet; private _initializeAddressesMock; getRemappings(): Record; getSoliditySourcePaths(): string[]; } //# sourceMappingURL=FhevmEnvironment.d.ts.map