resolveMethod

Resolves and returns the ABI function with the specified method name. Throws an error if the function is not found in the ABI.

Example

import { resolveMethod, prepareContractCall } from "thirdweb";
const tx = prepareContractCall({
contract,
// automatically resolves the necessary abi to encode the transaction
method: resolveMethod("transfer"),
// however there is no type completion for params in this case (as the resolution is async and happens at runtime)
params: [to, value],
});
function resolveMethod(
method: string,
): (
contract: Readonly<ContractOptions<TAbi>>,
) => Promise<AbiFunction>;

Parameters

The name of the method to resolve.

Type

let method: string;

Returns

let returnType: (
contract: Readonly<ContractOptions<TAbi>>,
) => Promise<AbiFunction>;

The resolved ABI function.