Skip to main content

Interacting with Contracts

The Unity 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 Read and Write methods.
  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 {
// ...
}
MyScript.cs
public async void MintERC721() {
// ERC721 -> ".ERC721"
// IERC721Mintable -> ".Mint"
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