Seeking assistance with creating edition NFTs from master editions in Solana

I’m working on a Solana Metaplex NFT project using Rust and Anchor. I need help with a function that makes edition NFTs from master editions.

My code uses mpl_token_metadata::instruction::mint_new_edition_from_master_edition_via_token. But I’m confused about two fields: metadata and metadata_mint. The Metaplex docs only mention needing the master record metadata account.

Can someone explain what values I should use for metadata and metadata_mint? And why?

Here’s a simplified version of my code:

pub fn make_edition_nft(ctx: Context<NewEdition>, num: u64) -> Result<()> {
    let accounts = vec![
        ctx.accounts.token_prog.to_account_info(),
        ctx.accounts.new_meta.to_account_info(),
        // ... other accounts ...
    ];
    
    invoke(&mint_new_edition_from_master_edition_via_token(
        ctx.accounts.token_prog.key(),
        ctx.accounts.new_meta.key(),
        // ... other parameters ...
        ctx.accounts.meta.key(),
        ctx.accounts.meta.key(),
        num
    ), accounts.as_slice())?;

    msg!("New edition NFT created!");
    Ok(())
}

Any help would be great. Thanks!

Regarding your question about metadata and metadata_mint fields, I can offer some clarification based on my experience with Solana NFTs.

The metadata parameter should be set to the address of the new edition’s metadata account that you’re creating. This is distinct from the master edition’s metadata.

For metadata_mint, use the mint address for the new edition token you’re minting. This is separate from the master edition’s mint.

To ensure you’re using the correct values, I’d recommend adding some debug logging before the invoke call. This can help verify the addresses you’re passing in.

Have you considered using the Metaplex SDK? It can simplify some of these operations and reduce confusion around parameter usage. Might be worth exploring if you haven’t already.

Hey Isaac31! Interesting project you’ve got there. i’ve been playing around with solana nfts too and ran into similar confusion. :sweat_smile:

for the metadata and metadata_mint fields, here’s what i’ve figured out:

metadata should be the address of the new edition’s metadata account (the one you’re creating).

metadata_mint should be the mint address for the new edition token.

both of these are different from the master edition’s metadata account.

have you tried using different values for these? what happens when you do?

btw, are you planning to make this project open source? would love to take a peek if you do! :raised_hands:

keep us posted on how it goes!

yo isaac, been there with solana nfts! for metadata, use the new edition’s metadata account address (you’re makin this). metadata_mint is the new edition’s token mint address. they’re different from the master edition stuff.

try printing these values before the invoke call to double-check. also, metaplex discord’s pretty helpful for these kinda Qs. good luck with ur project!