UNPKG

@nomicfoundation/hardhat-verify

Version:
59 lines 2.82 kB
import type { LibraryAddresses } from "./libraries.js"; import type { VerificationProvider } from "./types.js"; import type { Dispatcher } from "@nomicfoundation/hardhat-utils/request"; import type { ChainDescriptorsConfig, VerificationProvidersConfig } from "hardhat/types/config"; import type { HardhatRuntimeEnvironment } from "hardhat/types/hre"; import type { EthereumProvider } from "hardhat/types/providers"; export interface VerifyContractArgs { address: string; constructorArgs?: unknown[]; libraries?: LibraryAddresses; /** The fully qualified name of the contract, in the format: `<source-name>:<contract-name>` */ contract?: string; force?: boolean; provider?: keyof VerificationProvidersConfig; /** The hash of the contract creation transaction (Sourcify only) */ creationTxHash?: string; } /** * Verifies a deployed smart contract on the specified block explorer (e.g., * Etherscan). * * This function performs all required checks and attempts verification using * minimal and full compiler input, handling constructor arguments and linked * libraries as needed. On success, returns `true`. On failure, throws a * HardhatError. * * @param {VerifyContractArgs} verifyContractArgs - Arguments for contract * verification, including address, constructor arguments, libraries, contract * FQN, and force flag. * @param {HardhatRuntimeEnvironment} hre - The Hardhat Runtime Environment. * @returns {Promise<boolean>} Resolves to `true` if the contract was * successfully verified, or was already verified. * @throws {HardhatError} On failure, throws a HardhatError. * * @example * import { verifyContract } from "hardhat-verify/verify"; * * await verifyContract( * { * address: "0x...", * constructorArgs: [/* ... *\/], * libraries: { MyLibrary: "0x..." }, * contract: "contracts/MyContract.sol:MyContract", * }, * hre * ); */ export declare function verifyContract(verifyContractArgs: VerifyContractArgs, hre: HardhatRuntimeEnvironment, consoleLog?: (text: string) => void, dispatcher?: Dispatcher, provider?: EthereumProvider): Promise<boolean>; export declare function validateVerificationProviderName(provider: unknown): void; export declare function validateArgs({ address, contract }: VerifyContractArgs): void; export declare function createVerificationProviderInstance({ provider, networkName, chainDescriptors, verificationProviderName, verificationProvidersConfig, dispatcher, }: { provider: EthereumProvider; networkName: string; chainDescriptors: ChainDescriptorsConfig; verificationProviderName: keyof VerificationProvidersConfig; verificationProvidersConfig: VerificationProvidersConfig; dispatcher?: Dispatcher; }): Promise<VerificationProvider>; //# sourceMappingURL=verification.d.ts.map