UNPKG

@hyperlane-xyz/sdk

Version:

The official SDK for the Hyperlane Network

122 lines 5.11 kB
import { Address, HexString } from '@hyperlane-xyz/utils'; import { SolidityStandardJsonInput } from '../deploy/verify/types.js'; import { GetEventLogsResponse } from '../rpc/evm/types.js'; export declare enum EtherscanLikeExplorerApiModule { LOGS = "logs", CONTRACT = "contract" } export declare enum EtherscanLikeExplorerApiAction { GETSOURCECODE = "getsourcecode", VERIFY_IMPLEMENTATION = "verifysourcecode", VERIFY_PROXY = "verifyproxycontract", CHECK_IMPLEMENTATION_STATUS = "checkverifystatus", CHECK_PROXY_STATUS = "checkproxyverification", GET_CONTRACT_CREATION_CODE = "getcontractcreation", GET_LOGS = "getLogs" } export declare enum EtherscanLikeExplorerApiErrors { ALREADY_VERIFIED = "Contract source code already verified", ALREADY_VERIFIED_ALT = "Already Verified", NOT_VERIFIED = "Contract source code not verified", VERIFICATION_PENDING = "Pending in queue", PROXY_FAILED = "A corresponding implementation contract was unfortunately not detected for the proxy address.", BYTECODE_MISMATCH = "Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode.", UNABLE_TO_VERIFY = "Fail - Unable to verify", UNKNOWN_UID = "Unknown UID", NO_RECORD = "No records found", NO_LOGS_FOUND = "No logs found" } export declare enum ExplorerLicenseType { NO_LICENSE = "1", UNLICENSED = "2", MIT = "3", GPL2 = "4", GPL3 = "5", LGPL2 = "6", LGPL3 = "7", BSD2 = "8", BSD3 = "9", MPL2 = "10", OSL3 = "11", APACHE2 = "12", AGPL3 = "13", BSL = "14" } interface EtherscanLikeAPIOptions { apiKey?: string; apiUrl: string; } interface BaseEtherscanLikeAPIParams<TModule extends EtherscanLikeExplorerApiModule, TAction extends EtherscanLikeExplorerApiAction> { module: TModule; action: TAction; } type GetContractDeploymentTransactionResponse = { contractAddress: Address; contractCreator: Address; txHash: HexString; }; export declare function tryGetContractDeploymentTransaction(explorerOptions: EtherscanLikeAPIOptions, { contractAddress }: { contractAddress: Address; }): Promise<GetContractDeploymentTransactionResponse | undefined>; export declare function getContractDeploymentTransaction(explorerOptions: EtherscanLikeAPIOptions, requestOptions: { contractAddress: Address; }): Promise<GetContractDeploymentTransactionResponse>; interface GetEventLogs extends BaseEtherscanLikeAPIParams<EtherscanLikeExplorerApiModule.LOGS, EtherscanLikeExplorerApiAction.GET_LOGS> { address: Address; fromBlock: number; toBlock: number; topic0: string; } export declare function getLogsFromEtherscanLikeExplorerAPI({ apiUrl, apiKey: apikey }: EtherscanLikeAPIOptions, options: Omit<GetEventLogs, 'module' | 'action'>): Promise<Array<GetEventLogsResponse>>; type GetContractSourceCodeResponse = { SourceCode: string; ContractName: string; CompilerVersion: string; OptimizationUsed: string; Runs: string; ConstructorArguments: string; EVMVersion: string; Library: string; LicenseType: string; Proxy: string; Implementation: string; SwarmSource: string; SimilarMatch: string; }; export declare function getContractSourceCode(explorerOptions: EtherscanLikeAPIOptions, { contractAddress }: { contractAddress: Address; }): Promise<GetContractSourceCodeResponse>; type VerifyImplementationContractViaSolidityStandardJsonOptions = { sourceCode: SolidityStandardJsonInput; contractName: string; contractAddress: Address; compilerVersion: string; zkCompilerVersion?: string; licenseType?: ExplorerLicenseType; constructorArguments?: HexString; }; /** * Wrapper function for the `https://api.etherscan.io/v2/api?chainid=1&module=contract&action=verifysourcecode&apikey=...` * endpoint request with the `codeformat` option set to `solidity-standard-json-input` */ export declare function verifyContractSourceCodeViaStandardJsonInput(explorerOptions: EtherscanLikeAPIOptions, verificationOptions: VerifyImplementationContractViaSolidityStandardJsonOptions): Promise<string>; type VerifyProxyContractOptions = { contractAddress: Address; implementationAddress: Address; }; /** * Wrapper function for the `https://api.etherscan.io/v2/api?chainid=...&module=contract&action=verifyproxycontract&apikey=...` */ export declare function verifyProxyContract(explorerOptions: EtherscanLikeAPIOptions, { contractAddress, implementationAddress }: VerifyProxyContractOptions): Promise<string>; /** * Wrapper function for the * `https://api.etherscan.io/v2/api?chainid=...&module=contract&action=...&guid=...&apikey=...` * endpoint request with the `action` option set to `checkverifystatus` if `isProxy` is false * or set to `checkproxyverification` if set to true. */ export declare function checkContractVerificationStatus(explorerOptions: EtherscanLikeAPIOptions, { isProxy, verificationId }: { verificationId: string; isProxy: boolean; }): Promise<void>; export {}; //# sourceMappingURL=etherscan.d.ts.map