import { type Abi } from "abitype"; import { type ThirdwebContract } from "../contract.js"; /** * 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. * @param contract The contract for which to resolve the ABI. * @param contractApiBaseUrl The base URL of the contract API. Defaults to "https://contract.thirdweb.com/abi". * @returns A promise that resolves to the ABI of the contract. * @example * ```ts * 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); * ``` * @contract */ export declare function resolveContractAbi(contract: ThirdwebContract, contractApiBaseUrl?: string): Promise; /** * Resolves the ABI (Application Binary Interface) for a contract from the contract API. * @param contract The ThirdwebContract instance representing the contract. * @param contractApiBaseUrl The base URL of the contract API. Defaults to "https://contract.thirdweb.com/abi". * @returns A promise that resolves to the ABI of the contract. * @example * ```ts * import { createThirdwebClient, getContract } from "thirdweb"; * import { resolveAbiFromContractApi } from "thirdweb/contract" * import { ethereum } from "thirdweb/chains"; * const client = createThirdwebClient({ clientId: "..." }); * const myContract = getContract({ * client, * address: "...", * chain: ethereum, * }); * const abi = await resolveAbiFromContractApi(myContract); * ``` * @contract */ export declare function resolveAbiFromContractApi(contract: ThirdwebContract, contractApiBaseUrl?: string): Promise; /** * Resolves the ABI (Application Binary Interface) from the bytecode of a contract. * @param contract The ThirdwebContract instance. * @returns The resolved ABI as a generic type. * @throws Error if no IPFS URI is found in the bytecode. * @example * ```ts * import { createThirdwebClient, getContract } from "thirdweb"; * import { resolveAbiFromBytecode } from "thirdweb/contract"; * import { ethereum } from "thirdweb/chains"; * const client = createThirdwebClient({ clientId: "..." }); * const myContract = getContract({ * client, * address: "...", * chain: ethereum, * }); * const abi = await resolveAbiFromBytecode(myContract); * ``` * @contract */ export declare function resolveAbiFromBytecode(contract: ThirdwebContract): Promise; /** * Resolves the ABI for a contract based on its bytecode. * If the contract follows the plugin-pattern or dynamic pattern, it resolves the ABIs for the plugins and merges them with the root ABI. * If the contract follows the base router pattern, it resolves the ABIs for the plugins and merges them with the root ABI. * If the contract follows the diamond pattern, it resolves the ABIs for the facets and merges them with the root ABI. * @param contract The contract for which to resolve the ABI. * @param rootAbi The root ABI to use for the contract. If not provided, it resolves the ABI from the contract's bytecode. * @param resolveSubAbi A function to resolve the ABI for a sub-contract. If not provided, it uses the default ABI resolution logic. * @returns The resolved ABI for the contract. * @example * ```ts * import { createThirdwebClient, getContract } from "thirdweb"; * import { resolveCompositeAbiFromBytecode } from "thirdweb/contract"; * import { ethereum } from "thirdweb/chains"; * const client = createThirdwebClient({ clientId: "..." }); * const myContract = getContract({ * client, * address: "...", * chain: ethereum, * }); * const abi = await resolveCompositeAbiFromBytecode(myContract); * ``` * @contract */ export declare function resolveCompositeAbi(contract: ThirdwebContract, rootAbi?: Abi, resolveSubAbi?: (contract: ThirdwebContract) => Promise): Promise; //# sourceMappingURL=resolve-abi.d.ts.map