Docs

resolveContractAbi

Resolves the ABI (Application Binary Interface) for a given contract. If the ABI is already cached, it returns the cached value. Otherwise, it tries to resolve the ABI from the contract's API. If that fails, it resolves the ABI from the contract's bytecode.

Example

import { createThirdwebClient, getContract } from "thirdweb";
import { resolveContractAbi } from "thirdweb/contract";
import { ethereum } from "thirdweb/chains";
const client = createThirdwebClient({ clientId: "..." });
const myContract = getContract({
client,
address: "...",
chain: ethereum,
});
const abi = await resolveContractAbi(myContract);

Parameters

Returns

A promise that resolves to the ABI of the contract.