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
andWrite
methods. - 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.
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
Name | Description | Documentation |
---|---|---|
ERC721 | Basic functionality of ERC721 "non-fungible" NFTs | ERC721 |
ERC721BatchMintable | Batch minting of new NFTs | ERC721BatchMintable |
ERC721Burnable | Burn (take out of circulation) NFTs | ERC721Burnable |
ERC721ClaimConditions | Allow users to claim NFTs from your drop under specific conditions | ERC721ClaimConditions |
ERC721LazyMintable | Batch lazy-mint new NFTs for others to claim them | ERC721LazyMintable |
ERC721Enumerable | Enumerate through NFTs in a contract to get all or get owned NFTs | ERC721Enumerable |
ERC721Mintable | Mint new NFTs into the contract | ERC721Mintable |
ERC721Revealable | Use delayed reveal on NFTs you lazy mint | ERC721Revealable |
ERC721Supply | View information about the supply of the NFT collection | ERC721Supply |
ERC721TieredDrop | Use special tiered drop functionality | ERC721TieredDrop |
ERC721SignatureMint | Use signature-based minting functionality to mint new NFTs into the contract | ERC721SignatureMint |
ERC1155
Name | Description | Documentation |
---|---|---|
ERC1155 | Basic functionality of ERC1155 "semi-fungible" NFTs | ERC1155 |
ERC1155BatchMintable | Batch minting of new NFTs | ERC1155BatchMintable |
ERC1155Burnable | Burn (take out of circulation) NFTs | ERC1155Burnable |
ERC1155ClaimConditions | Allow users to claim NFTs from your drop under specific conditions | ERC1155ClaimConditions |
ERC1155Enumerable | Enumerate through NFTs in a contract to get all or get owned NFTs | ERC1155Enumerable |
ERC1155LazyMintable | Batch lazy-mint new NFTs for others to claim them | ERC1155LazyMintable |
ERC1155Mintable | Mint new NFTs into the contract | ERC1155Mintable |
ERC1155Revealable | Use delayed reveal on NFTs you lazy mint | ERC1155Revealable |
ERC1155SignatureMintable | Use signature-based minting functionality to mint new NFTs into the contract | ERC1155SignatureMintable |
ERC20
Name | Description | Documentation |
---|---|---|
ERC20 | Basic functionality of ERC20 "fungible" tokens | ERC20 |
ERC20BatchMintable | Batch minting of new tokens | ERC20BatchMintable |
ERC20Burnable | Burn (take out of circulation) tokens | ERC20Burnable |
ERC20Mintable | Mint new tokens into the contract | ERC20Mintable |
ERC20SignatureMintable | Use signature-based minting functionality to mint new tokens into the contract | ERC20SignatureMintable |
ERC20ClaimConditions | Allow users to claim tokens from your drop under specific conditions | ERC20ClaimConditions |