This guide explains how to use theDocumentation Index
Fetch the complete documentation index at: https://fireblocks-43c4b3ee-chore-add-cli.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
v1/tokenization/collections endpoint through the Fireblocks SDK to issue new ERC721F/ERC1155F tokens. It will walk you through the process that will result in deploying collection contracts, making them available in the Tokenization Engine. It will also show how to perform minting, burning, and other operations related to their respective standards.
What are ERC721F and ERC1155F contracts?
ERC721F and ERC1155F are non-fungible and semi-fungible token reference implementations developed by Fireblocks. They build upon the widely used ERC-721 and ERC-1155 token standards. ERC721F and ERC1155F tokens can represent ownership of digital or physical assets. They are used in various applications such as digital art, collectibles, and gaming. These implementations are designed to be flexible, allowing for token minting, burning, and secure integration within Fireblocks’ ecosystem. They are designed for compliance, making them ideal for organizations requiring scalable and customizable token management solutions.Why use Collections API?
The Collections API allows you to easily deploy mint, burn and manage non-fungible and semi-fungible tokens. It is a wrapper around the Tokenization API that enables you to handle operations related to ERC721F/ERC1155F tokens. This means the Collections API will deploy and link the NFT contract by leveraging the tokenization API, with additional helpers to manage the NFT metadata. Essentially, it’s a convenience layer on top of the Tokenization API that abstracts the complexity of deploying and linking NFT contracts.Note: Collections API is only available for ERC721F and ERC1155F tokens.
Prerequisites
Before issuing a new ERC721F/ERC1155F token using the Fireblocks SDK, ensure you know the following:- assetId: The Asset Id of the blockchain where the token will be deployed (e.g. ETH_TEST5 for Sepolia). This is the Fireblocks ID of the gas token of the blockchain where the token will be deployed. (To get the asset ID, refer to this assetId list)
- vaultAccountId: The Id of the Vault that will deploy the token. Ensure the vault has sufficient native gas for transaction fees. The vaultAccountId can be retrieved from the Fireblocks console by checking the URL of the selected vault, e.g.,
https://console.fireblocks.io/v2/accounts/vault/<vaultAccountId>. For more details about Vault Accounts, refer to the Create Vault Account guide. - Ensure you have access to the Fireblocks Smart Contracts package, which includes the reference protocol contracts. Contact your CSM if unsure if your workspace has this SKU.
Example 1: Issuing a New NFT collection
Here’s an example of how to issue a new ERC721F or ERC1155F token using the Fireblocks SDK:1. Initialize the Fireblocks SDK
First, import the Fireblocks SDK and initialize it by providing your Fireblocks API key and private key:2. Create a new Collection
To deploy a new ERC721F/ERC1155F collection contract, you need to know the following:baseAssetId: The assetId of the blockchain where the collection will be deployed (e.g. ETH_TEST5 for Sepolia).vaultAccountId: The vaultAccountId of the vault that will deploy the token.type: The type of the collection, eitherNON_FUNGIBLE_TOKENorSEMI_FUNGIBLE_TOKEN.- when type is
NON_FUNGIBLE_TOKENthe collection will be an ERC721F contract. - when type is
SEMI_FUNGIBLE_TOKENthe collection will be an ERC1155F contract.
- when type is
name: The name of the collection. This name will be stored on the smart contract.symbol: The symbol of the collection.adminAddress: The address that will receive admin roles on the contract. Ensure that it’s an address you control.displayName: The display name of the collection. This name will be displayed in the Fireblocks console.
id: The token link id of the collection. Since collections are linked to Tokenization Engine just like fungible tokens deployed using the tokenization API, the collection will have a token link id.status: The token link status. Possible values arePENDING,COMPLETEDandFAILEDbut, right after sending create collection request, status will bePENDING.type: The type of the collection, eitherNON_FUNGIBLE_TOKENorSEMI_FUNGIBLE_TOKEN.displayName: The display name of the collection as it appears in the Fireblocks console.tokenMetadata: The metadata of the collection. For now, it will be empty. But once the deployment transaction is completed, and the collection is linked, the metadata will be updated with the contract address and other details. For more information, refer to the Collection Metadata section below.
Note:
The procedure for creating an ERC1155F collection is the same, only that the type should be changed to SEMI_FUNGIBLE_TOKEN.
Collection Metadata:
The token metadata can be one of the following:ContractMetadataDto: If the contract is a utility contract (i.e. any arbitrary contract).AssetMetadataDto: If the contract is a fungible token (i.e. ERC20).CollectionMetadataDto: If the contract is a non-fungible token (i.e. ERC721 or ERC1155).
tokenMetadata will assume a value of type collectionMetadataDto. This metadata object that holds the contract address and other details. This object will be stored on the Fireblocks database and it looks like this:
getLinkedCollections method.
2.1 Fetching a Collection
To fetch a collection, you need to know the id of the collection, which is the token link id of the linked token. In this example we will use the id of the collection we created in the previous step. If the id is not known, you can use the getLinkedCollections method, which will return a list of all linked collections. Then you can find and use the id of the collection you want to fetch.Example 2: Minting an NFT
To mint an NFT, the caller must have theMINTER_ROLE role on the collection contract. If the collection was deployed through Collections API, the MINTER_ROLE role is assigned to the adminAddress that was provided when creating the collection. You also need to perform two steps mentioned in Issuing a New NFT collection example above.
Note:
If you wish to use a different address to mint tokens, you can assign the MINTER_ROLE role to the desired address. The process is similar to the one described in the Assigning Roles guide for ERC20F.
3. Minting an NFT
To mint an NFT, you need to know the following:vaultAccountId: The vaultAccountId that will mint the token. Make sure this vault has enough native gas tokens for the transaction fees and the MINTER_ROLE role on the smart contract.to: The address that will receive the minted token.tokenId: The id of the token to mint. This id must be unique within the collection. For this field, it is recommended to have a numerical format and in sequential order.amount: (Optional) The amount of the token to mint. For ERC721F, amount is ignored. For ERC1155F, the amount should be 1 or greater.metadataURI: (Optional) The metadata URI of the token. This URI will be stored on the smart contract and can be used to fetch the metadata of the token. This URL is usually an IPFS URL.metadata: (Optional) The metadata of the token. This metadata object will be uploaded to IPFS and the URI will be stored on the smart contract. For detailed information about the metadata, refer to the NFT metadata section below.
NFT Metadata:
The metadata object should have the following properties:name: The name of the token.description: The description of the token.image: (Optional) The image of the token. This should be a URL to the image of the token. (e.g. https://some\_domain.com/image\_filepath).animation: (Optional) The animation of the token. This should be a URL to the animation of the token. (e.g. https://some\_domain.com/animation\_filepath).external_url: (Optional) The external URL of the token. This should be a URL to the token’s external page. (e.g. https://some\_domain.com/token\_page).attributes: (Optional) The attributes of the token. The token can have many attributes or traits depending on the use case. This should be an array of objects, each object should have the following properties:trait_type: The trait type of the attribute. (e.g. rarity).value: The value of the attribute. (e.g. common, legendary).display_type: (Optional) The display type of the attribute. This describes how would you like the trait to be displayed (e.g. number, date).
Caution: Make sure to use eithermetadataURIormetadata- not both. If you use both metadataURI and metadata the request will fail.
3.1. Fetching the minted token
To fetch the minted token, you need to know the tokenId of the token. In this example we will use the tokenId we minted in the previous step. To fetch the token you can use the fetchCollectionTokenDetails method that will return the nft token object.tokenId: The id of the token.metadataURI: The metadata URI of the token.totalSupply: The total supply of the token.
Example 3: Burning an NFT
To burn an NFT, the caller must have theBURNER_ROLE role on the collection contract. The BURNER_ROLE role is not assigned to anyone by default. You also need to make sure you have a collection of NFTs and an NFT to burn which described in example 1 and 2. To assign the BURNER_ROLE role to an address, you can use the grantRole method. For more information, refer to the Assigning Roles guide for ERC20F. The process is the same for ERC721F/ERC1155F.
4. Burning an NFT
To burn an NFT, you need to know the following:collectionId: The id of the collection.vaultAccountId: The vaultAccountId that will burn the token. Make sure this vault has enough native gas for the transaction fees and the BURNER_ROLE role on the smart contract.tokenId: The id of the token to burn.amount: (Optional) The amount of the token to burn. For ERC721F, amount is ignored. For ERC1155F, amount should be 1 or greater.
Summary
The Collections API is a high-level API provides a simple interface to manage NFTs. Without collections API, you would need to:- Fetch the templates from
getContractTemplates. - Find the template (e.g. ERC721F) from the list.
- Fetch the template using
getContractTemplate. - Deploy the contract.
- Mint the NFT.