Interacting with Contracts

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

  • Generic reading data from and writing transactions to smart contracts using the Read and Write methods.
  • Using special features that are available for each extension that your smart contract implements.
  • Use our low-level Transaction Builder to prepare, build, and send transactions to your smart contract.

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.

contract MyContract is
ERC721,
IERC721Mintable {
// ...
}
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
ERC721BurnableBurn (take out of circulation) NFTsERC721Burnable
ERC721ClaimConditionsAllow users to claim NFTs from your drop under specific conditionsERC721ClaimConditions
ERC721EnumerableEnumerate through NFTs in a contract to get all or get owned NFTsERC721Enumerable
ERC721MintableMint new NFTs into the contractERC721Mintable
ERC721SupplyView information about the supply of the NFT collectionERC721Supply
ERC721SignatureMintUse signature-based minting functionality to mint new NFTs into the contractERC721SignatureMint

ERC1155

NameDescriptionDocumentation
ERC1155Basic functionality of ERC1155 "semi-fungible" NFTsERC1155
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
ERC1155MintableMint new NFTs into the contractERC1155Mintable
ERC1155SignatureMintableUse signature-based minting functionality to mint new NFTs into the contractERC1155SignatureMintable

ERC20

NameDescriptionDocumentation
ERC20Basic functionality of ERC20 "fungible" tokensERC20
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