Function autoload

  • autoload is a convenience helper for doing All The Things to load an ABI of a contract address, including resolving proxies.

    Parameters

    Returns Promise<AutoloadResult>

    import { ethers } from "ethers";
    import { whatsabi } from "@shazow/whatsabi";

    const provider = ethers.getDefaultProvider(); // substitute with your fav provider
    const address = "0x00000000006c3852cbEf3e08E8dF289169EdE581"; // Or your fav contract address

    // Quick-start:

    const result = await whatsabi.autoload(address, { provider });
    console.log(result.abi);
    // -> [ ... ]

    See AutoloadConfig for additional features that can be enabled.

    const result = await whatsabi.autoload(address, {
    provider,
    followProxies: true,
    loadContractResult: true, // Load full contract metadata (slower)
    enableExperimentalMetadata: true, // Include less reliable static analysis results (e.g. event topics)
    // and more! See AutoloadConfig for all the options.
    });