metaplex-foundation / mpl-token-metadata

Program to attach additional data to Fungible or Non-Fungible tokens on Solana.
https://developers.metaplex.com/token-metadata
Other
98 stars 42 forks source link

What's the difference between set_and_verify_collection and verify_collection? #111

Open vitordhers opened 3 months ago

vitordhers commented 3 months ago

Hello, folks, I've been struggling a bit in order to understand what's the difference between set_and_verify_collection and verify_collection. As per what I (believe I could) understand, the first one sets a regular NFT as a MPL collection, while the second one only verifies it.

I've noticed a few things, though.

In both methods, I've seen that the instruction needs both metadata and collection_metadata (which takes *ctx.accounts.collection_metadata.key ) accounts. So, probably the collection_metadata refers to the NFT created with by create_metadata_accounts_v3, whose details parameter is Some(CollectionDetails::V1 { size: 10 }), for instance. Now, the metadata refers to what, specifically? Should I create a new metadata account in order to provide that data? If so, should it be mutable? Should it also provide a details Option other than None? And, the most important, how do I derive it's address? Rn, I'm passing the collection metadata derived access like that:

 const collectionMetadataAddress = findMetadataPda(umi, {
      mint: publicKey(collectionMintKeypair.publicKey)
    })[0];

Last but not least, I've noticed that both set_and_verify_collection and verify_collection both accept collection_authority_record, should I derive another PDA just for that, or setting Some(ctx.accounts.signer.key()) will suffice?

I'm using anchor_spl 0.28, which depends on mpl-token-metadata ^1.11

Thanks in advance