How to check if a contract is an ERC721/ERC1155/ERC20 contract

In this guide, we will explore how to determine if a contract is either ERC721, ERC1155, or ERC20 using the thirdweb SDK.

 

FOR ERC721

 import { isERC721 } from "thirdweb/extensions/erc721";
 const result = await isERC721({ contract }); // boolean

FOR ERC1155

import { isERC1155 } from "thirdweb/extensions/erc1155";
const result = await isERC1155({ contract }); // boolean

FOR ERC20

 import { isERC20 } from "thirdweb/extensions/erc20";
 const result = await isERC20({ contract }); // boolean
 

Can’t get this working? If you’ve followed the above and still have issues, contact our support team for help.

Did this answer your question?
😞
😐
🤩