Mint assets
Minting assets on Immutable means to bring into existence tokens from a smart contract. For more information on this concept, please see Deep dive into minting.
In order for a user to mint tokens, they need:
- A smart contract deployed on L1 (Ethereum) with certain requirements
- To be registered as a user on Immutable
- To have registered an administrative entity, a project, on Immutable
- To have registered their collection (as represented by their smart contract) on Immutable
- Ensure your metadata is available to be fetched by our systems before minting.
Typescript SDK
Once you have verified that a user has a smart contract deployed on L1 and that they are the owner, then your application can start the process of enabling them to mint tokens on L2 from this contract.
1. Register user
Before a user can register a project or collection and mint tokens on Immutable, they must be registered as a user on Immutable. Follow Register User Guide to do this.
2. Register a project
A project is an administrative-level entity that is associated with an user. A project can have many collections, which are represented by smart contracts. Follow How to Create and Launch a Project via Immutable Hub.
3. Register a collection
A collection refers to a deployed token smart contract that has been registered on Immutable. Once this has occured, its tokens can be transacted (ie. minted, traded, bought and sold) on Immutable.
Each collection belongs to a project.
Use the project ID returned from registering a project to use in the request body of this section.
The createCollection
endpoint requires a signer (obtained in the first step) and a createCollectionRequest
object:
const createCollectionRequest = {
name: 'name',
contract_address: 'address',
project_id: 'name',
owner_public_key: 'owner public key',
};
Then, create a collection:
const createCollectionResponse = await client.createCollection(
ethSigner,
createCollectionRequest
);
4. Mint tokens
- You can set up to 50 royalty recipients
- You cannot set the same recipient more than once
- The royalty percentage for a single user cannot exceed 100% (however, the combined percentage for all recipients may exceed 100% - as this amount is calculated on top of the sale price)
- Individual percentage fees can’t be < 0%
const mintResponse = await client.mint({
"contractAddress": "0xc6185055ea9891d5d9020c927ff65229baebdef2",
// Specifying contract-wide royalty information
"royalties": [
{
// Specifying the contract-wide royalty recipient's wallet address
"recipient": "0xA91E927148548992f13163B98be47Cf4c8Cb3B16",
// Specifying the contract-wide royalty rate for this collection
"percentage": 2.5
}
],
"users": [
{
"etherKey": "0xc3ec7590d5970867ebd17bbe8397500b6ae5f690",
"tokens": [
{
// Specific NFT token
"id": "1",
"blueprint": "my-on-chain-metadata",
// Overriding the contract-wide royalty information with token-specific royalty information
"royalties": [
{
// Same recipient's wallet address
"recipient": "0xA91E927148548992f13163B98be47Cf4c8Cb3B16",
// Changed royalty rate for this specific token (i.e. 1% instead of the default 2.5%)
"percentage": 1
}
],
}
]
},
{
"etherKey": "0xA91E927148548992f13163B98be47Cf4c8Cb3B16",
"tokens": [
{
// Specific NFT token
// No token-specific royalty information specified; contract-wide royalty infromation will be used
"id": "2",
"blueprint": "my-other-on-chain-metadata"
}
]
},
...
]
});