isERC20

Check if a contract is an ERC20 token.

Example

import { isERC20 } from "thirdweb/extensions/erc20";
import { resolveContractAbi } from "thirdweb/contract";
const abi = await resolveContractAbi(contract);
const selectors = abi
.filter((f) => f.type === "function")
.map((f) => toFunctionSelector(f));
const result = await isERC20(selectors);
function isERC20(availableSelectors: Array<string>): boolean;

Parameters

Type

let availableSelectors: Array<string>;

Returns

let returnType: boolean;

A boolean indicating whether the contract is an ERC20 token.