ERC-1155 Token Contract APIs
You can use the following methods related to token functionality in ERC-1155 token contracts.
Token Configuration Methods
__ERC1155Token_init- This method is called when a token contract is deployed. This method can be called only by a
Token Admin.
Token Setup Methods
saveNFTClass- This method saves NFT class information on the ledger. This method can be called only by a
Token Admin. createNonFungibleToken- This method mints NFTs based on the saved NFT class information. This method can be called by a user with the minter role or by the
Token Admin. createFungibleToken- This method is called when the token contract is deployed. This method can be called only by the
Token Admin. getTokenById- This method gets the details for a specified token. This method can be called only by a
Token Adminor by a token owner. getTokenDecimals- This method returns the number of decimals places that were configured for a token. This method can be called only by a
Token Admin. tokenIdOf- This method returns the token ID. This method can be called only by a
Token Admin. balanceOf- This method returns the current token balance for a specified user. This method can be called only by a
Token Adminor by the token owner. balanceOfBatch- This method returns the current token balances for a batch of specified users. This method can be called only by a
Token Adminor by the token owner. exists- This method checks whether a specified token exists. This method can be called only by a
Token Admin. totalSupply- This method returns the total supply of tokens in a contract. This method can be called only by a
Token Admin.
Token Behavior Methods - Mintable Behavior
mintBatch- This method mints ERC-1155 tokens in batches. The tokens must already be intialized. This method can be called by any user with the minter role.
Token Behavior Methods - Burnable Behavior
burnBatch- This method burns ERC-1155 tokens in batches. The tokens must already be initialized. This method can be called by any user with the burner role.
burnNFT- This method burns NFTs. The token must already be initialized. This method can be called by any user with the burner role.
Token Behavior Methods - Transferable Behavior
safeTransferFrom- This method can be called by any user with tokens to transfer them to another user.
safeBatchTransferFrom- This method can be called by any user with tokens to transfer them in batches to another user.
Token Behavior Methods - Delegable Behavior
setApprovalForAll- This method can be called by any user who owns tokens to grant or revoke permission for an operator to transfer the caller's tokens.
isApprovedForAll- This method can be called by any user who owns tokens to check whether a specified user has permission as an operator to transfer the caller's tokens.
Token Behavior Methods - Pausable Behavior
paused- This method checks whether a contract is paused. This method can be called only by any user.
pause- This method pauses a contract. This method can be called only by a
Token Admin. unpause- This method starts a paused contract. This method can be called only by a
Token Admin.
Token Behavior Methods - Lockable Behavior
lockNFT- This method locks an NFT. This method can be called only by a user with the
TOKEN_SYS_VAULT_ROLErole. isNFTLocked- This method checks whether an NFT is locked. This method can be called only by a user with the
TOKEN_SYS_VAULT_ROLErole or by aToken Admin.
Context Management Methods
setContext- This method sets the token contract address for the account contract. This method can be called only by a
Token Admin. getContext- This method gets the token contract address for the account contract. This method can be called by any user.
setGovernanceContext- This method sets the governance contract to use to manage the governance life cycle for the account contract. This method can be called only by a
Token Admin. getGovernanceContext- This method gets the governance context details. This method can be called by any user.
isDeploymentActive- This method checks whether the deployment is active. This method can be called by any user.