I am trying to mint a edition from a master edition with the following metaplex function:
let accounts = vec![
ctx.accounts.new_metadata.to_account_info(),
ctx.accounts.new_edition.to_account_info(),
ctx.accounts.master_edition.to_account_info(),
ctx.accounts.new_mint.to_account_info(),
ctx.accounts.edition_mark_pda.to_account_info(),
ctx.accounts.new_mint_authority.to_account_info(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.token_account_owner.to_account_info(),
ctx.accounts.token_account.to_account_info(),
ctx.accounts.new_metadata_update_authority.to_account_info(),
ctx.accounts.metadata.to_account_info(),
ctx.accounts.token_program.to_account_info(),
ctx.accounts.system_program.to_account_info(),
ctx.accounts.rent.to_account_info(),
];
invoke(
&mint_new_edition_from_master_edition_via_token(
ctx.accounts.token_metadata_program.key(),
ctx.accounts.new_metadata.key(),
ctx.accounts.new_edition.key(),
ctx.accounts.master_edition.key(),
ctx.accounts.new_mint.key(),
ctx.accounts.new_mint_authority.key(),
ctx.accounts.payer.key(),
ctx.accounts.token_account_owner.key(),
ctx.accounts.token_account.key(),
ctx.accounts.new_metadata_update_authority.key(),
ctx.accounts.metadata.key(),
ctx.accounts.metadata.key(),
1,
),
&accounts,
)?;
Unfortunatly I always receive this error:
'Program log: Instruction: MintEdition',
'Instruction references an unknown account F5mAJWXVpQ4rupmvMGTY7ZDqK7UUzSkS7dTfTRX6WMLf',
'Program 4euwMgqxB9GkxVBY7uXKRRuC68yhkNbsVUhDPYS1mbhD consumed 18852 of 200000 compute units',
'Program 4euwMgqxB9GkxVBY7uXKRRuC68yhkNbsVUhDPYS1mbhD failed: An account required by the instruction is missing'
My function call from the frontend looks like the following:
await program.methods
.mintEdition()
.accounts({
newMetadata: metadataAddress,
newEdition: newEditionAddress,
masterEdition: masterEditionAddress,
newMint: newMint.publicKey,
editionMarkPda: editionMarkPda,
newMintAuthority: provider.wallet.publicKey,
payer: provider.wallet.publicKey,
tokenAccountOwner: provider.wallet.publicKey,
tokenAccount: ata,
newMetadataUpdateAuthority: provider.wallet.publicKey,
metadata: metadataAddress,
tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
tokenProgram: TOKEN_PROGRAM_ID,
systemProgram: anchor.web3.SystemProgram.programId,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
})
.rpc();
This is how I get the editionMarkPda in the frontend:
await anchor.web3.PublicKey.findProgramAddress(
[
Buffer.from("metadata"),
TOKEN_METADATA_PROGRAM_ID.toBuffer(),
masterEditionMint.publicKey.toBuffer(),
Buffer.from("edition"),
Buffer.from("1"),
],
TOKEN_METADATA_PROGRAM_ID
)
Any ideas what is missing?
edition_mark_pda
is an easy one to get wrong. Can you show how you're generating it on your frontend?