Mint assets

Mint assets

Minting assets on XpansionChain 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:

  1. A smart contract deployed on L1 (Ethereum) with certain requirements

  2. To be registered as a user on XpansionChain

  3. To have registered an administrative entity, a project, on XpansionChain

  4. To have registered their collection (as represented by their smart contract) on XpansionChain

  5. Ensure your metadata is available to be fetched by our systems before minting.

📝GUIDES

  • Core SDK

  • JS SDK

Core 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 XpansionChain, they must be registered as a user on XpansionChain. Follow this 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.

  • Typescript Core SDK

📚SDK REFERENCE

  • createProject

The createProject endpoint requires a signer (obtained in the previous step) and a createProjectRequest object:

const createProjectRequest = {
  company_name: 'company',
  contract_email: 'email',
  name: 'name',
};

Then, create a project:

const createProjectResponse = await client.createProject(
  ethSigner,
  createProjectRequest
);

const projectId = createProjectResponse.id.toString();

  • Kotlin (JVM) Core SDK

📚SDK REFERENCE

  • createProject

  • Swift Core SDK

📚SDK REFERENCE

  • createProject

  • Golang Core SDK

📚SDK REFERENCE

  • CreateProject

💻EXAMPLE

  • CreateProject

3. Register a collection

A collection refers to a deployed token smart contract that has been registered on XpansionChain. Once this has occured, its tokens can be transacted (ie. minted, traded, bought and sold) on XpansionChain.

Each collection belongs to a project.

  • Typescript Core SDK

📚SDK REFERENCE

  • createCollection

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
);

  • Kotlin (JVM) Core SDK

📚SDK REFERENCE

  • createCollection

  • Swift Core SDK

📚SDK REFERENCE

  • createCollection

  • Golang Core SDK

📚SDK REFERENCE

  • CreateCollection

💻EXAMPLE

  • CreateCollection

4. Mint tokens

WHEN SETTING ROYALTIES IN THE ORDER PARAMS

  • 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% :::

  • Typescript Core SDK

📚SDK REFERENCE

  • mint

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"
        }
      ]
    },
    ...
  ]
});

  • Kotlin (JVM) Core SDK

📚SDK REFERENCE

  • mintTokens

  • Swift Core SDK

📚SDK REFERENCE

  • mintTokens

  • Golang Core SDK

📚SDK REFERENCE

  • Mint

💻EXAMPLE

  • Mint

Last updated