MplBubblegum.Mint (mpl_bubblegum_lib v0.1.0)

View Source

Functions for minting compressed NFTs on Solana.

Overview

Compressed NFTs (cNFTs) use Solana's state compression feature to store NFT data off-chain while maintaining the security guarantees of the blockchain. This results in significantly lower costs compared to traditional NFTs.

Requirements

Before minting, ensure you have:

  1. Established a connection using MplBubblegum.Connection.create_connection/2
  2. Created a Merkle tree account to store your compressed NFTs
  3. Sufficient SOL in your wallet to cover transaction fees

Example Usage

# First establish a connection
MplBubblegum.Connection.create_connection(secret_key, rpc_url)

# Then mint a compressed NFT
signature = MplBubblegum.Mint.mint_v1(
  "merkle_tree_address",
  "My NFT",
  "MNFT",
  "https://arweave.net/my-metadata-uri",
  "creator_address",
  "100"  # 100% royalty to the creator
)

Summary

Functions

Mints a new compressed NFT and returns the transaction signature.

Functions

mint_v1(merkle_tree, name, symbol, uri, basis, share)

@spec mint_v1(binary(), binary(), binary(), binary(), binary(), binary()) :: binary()

Mints a new compressed NFT and returns the transaction signature.

Parameters

  • merkle_tree - The address of the Merkle tree account as a base58 string
  • name - The name of the NFT
  • symbol - The symbol/ticker of the NFT collection
  • uri - The URI pointing to the NFT's metadata JSON file (typically on Arweave)
  • basis - The creator's wallet address as a base58 string
  • share - The creator's royalty share as a string (e.g., "100" for 100%)

Returns

  • binary() - The transaction signature as a base58 string

Error Handling

May raise errors in the following cases:

  • Connection not established
  • Invalid Merkle tree address
  • Transaction failure
  • Network issues

Examples

signature = MplBubblegum.Mint.mint_v1(
  "9WzDXyMrFftHVK4jBUEcqABUVVjLPCT9keST9ycxL22F",  # Merkle tree address
  "Awesome NFT",                                    # NFT name
  "ANFT",                                           # Symbol
  "https://arweave.net/abc123",                     # Metadata URI
  "DEF456GHI789jklMNOpqrSTUvwxYZ",                  # Creator address
  "100"                                             # 100% royalty
)