I am trying to perform collection verification using Solana on-chain (Rust) code.
let verify_collection_ix = VerifyCollection {
metadata: *metadata_account.key,
collection_authority: *payer_account.key,
payer: *payer_account.key,
collection_mint: *collection_mint.key,
collection: *collection_metadata.key,
collection_master_edition_account: *collection_master_edition_account.key,
collection_authority_record: None,
}.instruction();
invoke(
&verify_collection_ix,
&[
metadata_account.clone(),
payer_account.clone(),
collection_mint.clone(),
collection_metadata.clone(),
collection_master_edition_account.clone(),
system_program.clone(),
rent_account.clone(),
metadata_program.clone(),
],
)?;
However, when I try to verify the collection in this way, it fails with the error log below.
logs: [
'Program 5QV2JKhmKshShindhxERAnpbJ7yKz4Hv7S89dhLHr7cf invoke [1]',
'Program log: Start Program : 5QV2JKhmKshShindhxERAnpbJ7yKz4Hv7S89dhLHr7cf',
'Program log: Verifying collection',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [2]',
'Program log: IX: Verify Collection',
'Program log: Collection Must Be a Unique Master Edition v2',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 26200 of 180043 compute units',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x52',
When I verify using the metaplex function on the client, the verification succeeds even in the same situation, but I have no idea what the problem is.
metaplex.nfts().verifyCollection({
mintAddress: nftAddress,
collectionMintAddress: collectionAddress,});
If anyone knows how to solve this problem in Rust code, please help. I'm spending too much time on this one issue.