Mint All Tokens to Self - Tutorial

This tutorial walks through the process of creating a collection and minting all tokens to yourself in a single transaction. This is useful for creating collections where you want to control the initial distribution.

Overview

This is a two-step process that can be executed as a single multi-message transaction:

  1. Create Collection with a mint approval that allows you to mint tokens

  2. Execute Transfer using that approval to mint tokens to yourself

Step 1: Create Mint Approval

First, create an approval that allows you to mint tokens from the "Mint" address:

// Step 1: Set up your mint approval
const mintApproval = {
    fromListId: 'Mint', // From the mint address
    toListId: 'All', // To any address
    initiatedByListId: myAddress, // Only you can initiate
    transferTimes: UintRangeArray.FullRanges(),
    tokenIds: UintRangeArray.FullRanges(), // All token IDs
    ownershipTimes: UintRangeArray.FullRanges(),
    approvalId: 'mint-approval',
    version: 0n,
    approvalCriteria: {
        // No restrictions - you can mint unlimited amounts
        ...defaultNoRestrictionsApprovalCriteria,
        overridesFromOutgoingApprovals: true, // Required for mint address
    },
};

// Step 1: Create your collection with the mint approval
const collection = {
    ...BaseCollectionDetails,
    collectionApprovalTimeline: [
        {
            timelineTimes: FullTimeRanges,
            collectionApprovals: [mintApproval, ...otherApprovals],
        },
    ],
};

// Create the collection

Step 2: Execute Mint Transfer

After creating the collection, use the mint approval to transfer tokens to yourself:

Last updated