Skip to content

Commit

Permalink
WIP: autoload: Add AutoloadResult.ContractResult and AutoloadConfig.l…
Browse files Browse the repository at this point in the history
…oadContractResult
  • Loading branch information
shazow committed Sep 29, 2024
1 parent da18e52 commit 83d7c18
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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[],

Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 83d7c18

Please sign in to comment.