Overview

Collection management is at the core of CreateKit. This guide covers everything you need to know about creating, configuring, and managing NFT collections using the BaseMint protocol.

Collection Metadata Structure

Every collection requires specific metadata that defines its characteristics:

Required Parameters

namestringpath

The name of your NFT collection (e.g., "Bored Ape Yacht Club")

symbolstringpath

The symbol/ticker for your collection (e.g., "BAYC")

creator0x${string}path

The Ethereum address of the collection creator

gameOwner0x${string}path

The Ethereum address of the game owner (can be same as creator)

Optional Parameters

maxSupplybigintpathdefault: 10000n

Maximum number of tokens that can be minted

mintPricebigintpathdefault: 0n

Price per token in wei (use parseEther() for ETH values)

maxPerWalletbigintpathdefault: 100n

Maximum tokens that can be minted per wallet

isWhitelistEnabledbooleanpathdefault: false

Whether whitelist-only minting is enabled

startTimebigintpathdefault: 0n

Unix timestamp when minting starts (0 = immediate)

endTimebigintpathdefault: BigInt(Date.now() / 1000 + 86400 * 365 * 100)

Unix timestamp when minting ends

tokenStandard'ERC721' | 'ERC1155'pathdefault: 'ERC721'

The token standard to use

chainIdnumberpathdefault: 8333

Chain ID (8333 = B3 Mainnet)

Creating Collections

Basic Collection

typescript
import { CollectionManager, b3Mainnet } from '@b3dotfun/basemint'import { createPublicClient, createWalletClient, http } from 'viem'import { privateKeyToAccount } from 'viem/accounts'const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)const publicClient = createPublicClient({ chain: b3Mainnet, transport: http()})const walletClient = createWalletClient({ chain: b3Mainnet, transport: http(), account})const collectionManager = new CollectionManager(publicClient)// Define basic collectionconst basicCollection = { name: "My Art Collection", symbol: "MAC", creator: account.address, gameOwner: account.address, description: "A collection of digital art pieces", image: "https://example.com/collection-image.png"}// Generate creator signatureconst creatorSignature = await collectionManager.generateCreatorSignature( walletClient, basicCollection)

Advanced Collection Configuration

typescript
import { parseEther } from 'viem'const advancedCollection = { // Required name: "Premium Gaming Items", symbol: "PGI", creator: account.address, gameOwner: "0x1234567890123456789012345678901234567890", // Different game owner // Supply and pricing maxSupply: 5000n, mintPrice: parseEther("0.01"), // 0.01 ETH maxPerWallet: 5n, // Timing controls startTime: BigInt(Math.floor(Date.now() / 1000) + 3600), // Start in 1 hour endTime: BigInt(Math.floor(Date.now() / 1000) + 86400 * 7), // End in 7 days // Whitelist configuration isWhitelistEnabled: true, whitelistMerkleRoot: "0x..." as `0x${string}`, // Metadata description: "Exclusive gaming items for premium players", image: "https://example.com/premium-collection.png", external_url: "https://mygame.com/premium-items", animation_url: "https://example.com/collection-animation.mp4", // Collection attributes attributes: [ { trait_type: "Category", value: "Gaming" }, { trait_type: "Rarity", value: "Premium" }, { trait_type: "Edition", value: "First" } ], // Technical tokenStandard: "ERC1155" as const, chainId: 8333}

Token Standards

CreateKit supports both ERC721 and ERC1155 standards:

typescript
const erc721Collection = { name: "Unique Art Pieces", symbol: "UAP", creator: account.address, gameOwner: account.address, tokenStandard: "ERC721" as const, maxSupply: 1000n, // Each token is unique description: "One-of-a-kind digital art pieces"}// ERC721 minting (quantity always 1)const collection721 = collectionManager.createCollection( predictedAddress, "ERC721")await collection721.mint( walletClient, 1n, // Always 1 for ERC721 undefined, // metadata URI mintPrice, proof)

Metadata Management

Collection-Level Metadata

typescript
const collectionMetadata = { name: "My Collection", description: "A fantastic collection of digital assets", image: "https://example.com/collection-image.png", external_url: "https://mywebsite.com/collection", // Background and banner for marketplaces background_color: "ffffff", banner_image_url: "https://example.com/banner.png", // Collection attributes attributes: [ { trait_type: "Theme", value: "Fantasy" }, { trait_type: "Artist", value: "Digital Creator" } ]}

Token-Level Metadata

CreateKit automatically generates token metadata based on your collection settings:

typescript
import { NFTMetadataManager, MediaType } from '@b3dotfun/basemint'// Generate metadata for different media typesconst artworkMetadata = NFTMetadataManager.generateNFTMetadata( collectionMetadata, MediaType.ARTWORK)const model3dMetadata = NFTMetadataManager.generateNFTMetadata( collectionMetadata, MediaType.MODEL_3D)const videoMetadata = NFTMetadataManager.generateNFTMetadata( collectionMetadata, MediaType.VIDEO)// Convert to JSONconst metadataJson = NFTMetadataManager.generateJSON(artworkMetadata)console.log(metadataJson)

Collection Validation

CreateKit provides built-in validation for collection parameters:

typescript
import { validateCollectionMetadata } from '@b3dotfun/basemint'try { // Validate collection metadata const validation = validateCollectionMetadata(collectionMetadata) if (!validation.isValid) { console.error("Validation errors:", validation.errors) return } console.log("✅ Collection metadata is valid") // Proceed with signature generation const signature = await collectionManager.generateCreatorSignature( walletClient, collectionMetadata )} catch (error) { console.error("Validation failed:", error)}

Address Prediction

One of CreateKit's key features is deterministic address prediction:

typescript
// Generate creator signature firstconst creatorSignature = await collectionManager.generateCreatorSignature( walletClient, collectionMetadata)// Predict the collection addressconst predictedAddress = collectionManager.predictCollectionAddress( collectionMetadata, creatorSignature)console.log(`Collection will be deployed at: ${predictedAddress}`)// You can now use this address before deployment// for marketplace integration, frontend display, etc.

Collection Management Operations

Checking Collection Status

typescript
const collection = collectionManager.createCollection( predictedAddress, "ERC721")// Check if collection is deployedconst isDeployed = await collection.isDeployed()console.log(`Deployed: ${isDeployed}`)// Get collection info (only works after deployment)if (isDeployed) { const info = await collection.getCollectionInfo() console.log("Collection Info:", { name: info.name, symbol: info.symbol, totalSupply: info.totalSupply.toString(), maxSupply: info.maxSupply.toString(), mintPrice: info.mintPrice.toString(), maxPerWallet: info.maxPerWallet.toString() })}

Updating Collection Settings

Warning

Most collection parameters cannot be changed after deployment. Plan your collection configuration carefully.

typescript
// Only certain operations are possible after deployment// Check current mint price (if dynamic pricing is implemented)const currentPrice = await collection.getCurrentMintPrice()// Check if minting is currently activeconst isMintingActive = await collection.isMintingActive()// Get remaining supplyconst remainingSupply = await collection.getRemainingSupply()console.log({ currentPrice: currentPrice.toString(), isMintingActive, remainingSupply: remainingSupply.toString()})

Best Practices

1. Collection Planning

Supply Strategy
  • Set appropriate max supply based on use case
  • Consider future demand and scarcity
  • Leave room for growth or special editions
Pricing Strategy
  • Research similar collections for pricing reference
  • Consider gas costs and transaction fees
  • Plan for different market conditions

2. Metadata Quality

typescript
const qualityCollection = { name: "Professional Art Collection", symbol: "PAC", creator: account.address, gameOwner: account.address, // High-quality descriptions description: "A curated collection of professional digital artworks featuring contemporary themes and innovative techniques.", // Professional imagery (minimum 640x640px) image: "https://example.com/high-res-collection-image.png", // Comprehensive attributes for better discoverability attributes: [ { trait_type: "Art Style", value: "Contemporary" }, { trait_type: "Medium", value: "Digital" }, { trait_type: "Artist Verification", value: "Verified" }, { trait_type: "Edition Type", value: "Limited" } ], // External links for credibility external_url: "https://professionalartist.com/collection"}

3. Security Considerations

  • Never hardcode private keys in source code
  • Use environment variables or secure key management
  • Consider using multi-signature wallets for valuable collections
  • Always validate signatures before deployment
  • Verify collection parameters match intended values
  • Use a staging deployment before production rollout
  • Carefully choose creator and gameOwner addresses
  • Understand reward distribution implications
  • Plan for long-term collection management

Troubleshooting

Ensure all collection parameters are identical between signature generation and deployment. Even small changes will result in different addresses.

Check that all required fields are provided and that values are within acceptable ranges (e.g., maxSupply > 0, valid addresses).

Verify that your wallet client is properly configured and that you have sufficient funds for the signing transaction.

Next Steps

Now that you understand collection management, explore these related topics:

Minting Guide

Learn how to implement token minting functionality

Learn More
Whitelist Management

Set up whitelist-based minting for exclusive access

Learn More
Ask a question... ⌘I