Skip to main content

Interacting with Contracts

The TypeScript SDK provides different ways for you to interact with smart contract functionality:

  1. Generic reading data from and writing transactions to smart contracts using the call method.
  2. Using special features that are available for each extension that your smart contract implements.

Extensions

Each extension (i.e. Solidity interface) that your smart contract implements unlocks new functionality for you to use in the SDK. For example, NFT collection smart contracts implements the ERC721 extension, allowing you can to use the ERC721 extension in the SDK when interacting with that contract.

These extension interfaces are available for the most common EIP standards, including support for ERC20, ERC721, ERC1155, permissions, metadata, and more. They handle the pre-processing of calling the smart contract functions for you, such as checking for token approval, uploading metadata to IPFS, formatting inputs, etc. Making your code safer and easier to write.

MyContract.sol
contract MyContract is 
ERC721,
IERC721Mintable {
// ...
}
MyApp.js
const MyApp = () => {
// ERC721 -> ".erc721"
// IERC721Mintable -> ".mint"
const tx = await contract.erc721.mint({...})
}

Example: the "mint" function above uploads and pins your NFT metadata to IPFS for you before minting.

Supported Extensions

ERC721

NameDescriptionDocumentation
ERC721Basic functionality of ERC721 "non-fungible" NFTsERC721
ERC721BatchMintableBatch minting of new NFTsERC721BatchMintable
ERC721BurnableBurn (take out of circulation) NFTsERC721Burnable
ERC721ClaimConditionsAllow users to claim NFTs from your drop under specific conditionsERC721ClaimConditions
ERC721LazyMintableBatch lazy-mint new NFTs for others to claim themERC721LazyMintable
ERC721EnumerableEnumerate through NFTs in a contract to get all or get owned NFTsERC721Enumerable
ERC721MintableMint new NFTs into the contractERC721Mintable
ERC721RevealableUse delayed reveal on NFTs you lazy mintERC721Revealable
ERC721SupplyView information about the supply of the NFT collectionERC721Supply
ERC721TieredDropUse special tiered drop functionalityERC721TieredDrop
ERC721SignatureMintUse signature-based minting functionality to mint new NFTs into the contractERC721SignatureMint

ERC1155

NameDescriptionDocumentation
ERC1155Basic functionality of ERC1155 "semi-fungible" NFTsERC1155
ERC1155BatchMintableBatch minting of new NFTsERC1155BatchMintable
ERC1155BurnableBurn (take out of circulation) NFTsERC1155Burnable
ERC1155ClaimConditionsAllow users to claim NFTs from your drop under specific conditionsERC1155ClaimConditions
ERC1155EnumerableEnumerate through NFTs in a contract to get all or get owned NFTsERC1155Enumerable
ERC1155LazyMintableBatch lazy-mint new NFTs for others to claim themERC1155LazyMintable
ERC1155MintableMint new NFTs into the contractERC1155Mintable
ERC1155RevealableUse delayed reveal on NFTs you lazy mintERC1155Revealable
ERC1155SignatureMintableUse signature-based minting functionality to mint new NFTs into the contractERC1155SignatureMintable

ERC20

NameDescriptionDocumentation
ERC20Basic functionality of ERC20 "fungible" tokensERC20
ERC20BatchMintableBatch minting of new tokensERC20BatchMintable
ERC20BurnableBurn (take out of circulation) tokensERC20Burnable
ERC20MintableMint new tokens into the contractERC20Mintable
ERC20SignatureMintableUse signature-based minting functionality to mint new tokens into the contractERC20SignatureMintable
ERC20ClaimConditionsAllow users to claim tokens from your drop under specific conditionsERC20ClaimConditions

Marketplace V3

NameDescriptionDocumentation
DirectListingsList NFTs for sale, allowing other users to make offers or buy them outrightDirectListings
EnglishAuctionsList NFTs for auction, allowing users to bid on themEnglishAuctions
OffersAllow users to make offers on any NFT on a smart contract, even if not listed for saleOffers

General Extensions

NameDescriptionDocumentation
ContractMetadataGet and set metadata about a smart contractContractMetadata
OwnableGet and set the owner wallet address of a smart contractOwnable
GaslessEnable gasless transactions for functions on a smart contractGasless
PermissionsRestrict function execution for users who hold specific rolesPermissions
PackVRFSpecial functionality for using the PackVRF contractPackVRF
PlatformFeeCharge a percentage fee wherever there is a transfer of currency in your contractPlatformFee
PluginRouterSpecial functionality for using dynamic contractsPluginRouter
PrimarySaleConfigure where/how much funds are sent for sales of tokens in your contractPrimarySale
RoyaltyConfigure where/how much funds are sent for secondary sales of tokens in your contractRoyalty