MplBubblegum.Mint (mpl_bubblegum_lib v0.1.0)
View SourceFunctions 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:
- Established a connection using
MplBubblegum.Connection.create_connection/2
- Created a Merkle tree account to store your compressed NFTs
- 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
Mints a new compressed NFT and returns the transaction signature.
Parameters
merkle_tree
- The address of the Merkle tree account as a base58 stringname
- The name of the NFTsymbol
- The symbol/ticker of the NFT collectionuri
- The URI pointing to the NFT's metadata JSON file (typically on Arweave)basis
- The creator's wallet address as a base58 stringshare
- 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
)