diff --git a/src/auto.ts b/src/auto.ts index f10be5f..de47f1f 100644 --- a/src/auto.ts +++ b/src/auto.ts @@ -3,7 +3,7 @@ import { Fragment, FunctionFragment } from "ethers"; import type { AnyProvider } from "./providers.js"; import type { ABI, ABIFunction } from "./abi.js"; import { type ProxyResolver, DiamondProxyResolver } from "./proxies.js"; -import type { ABILoader, SignatureLookup } from "./loaders.js"; +import type { ABILoader, SignatureLookup, ContractResult } from "./loaders.js"; import * as errors from "./errors.js"; import { CompatibleProvider } from "./providers.js"; @@ -28,6 +28,9 @@ export type AutoloadResult = { /** Whether the `abi` is loaded from a verified source */ abiLoadedFrom?: ABILoader; + /** Full contract metadata result, only included if {@link AutoloadConfig.loadContractResult} is true. */ + contractResult?: ContractResult; + /** List of resolveable proxies detected in the contract */ proxies: ProxyResolver[], @@ -82,6 +85,15 @@ export type AutoloadConfig = { */ followProxies?: boolean; + + /** + * Load full contract metadata result, include it in {@link AutoloadResult.ContractResult} if successful. + * + * This changes the behaviour of autoload to use {@link ABILoader.getContract} instead of {@link ABILoader.loadABI}, + * which returns a larger superset result including all of the available verified contract metadata. + */ + loadContractResult?: boolean; + /** * Enable pulling additional metadata from WhatsABI's static analysis, still unreliable *