bmresearch / Solnet.Metaplex

Metaplex Protocol .NET integration library.
MIT License
35 stars 21 forks source link

Encode payload data for CreateMetadataAccountV3 (with Collections Details) #42

Closed mihneacalugaru closed 1 year ago

mihneacalugaru commented 2 years ago

I am aware that there has not yet been released a version which takes into account certified collections. Anyway, I do plan to make the necessary adjustments to the existing code so as to allow creating a collection.

From my understanding, for creating a certified collection, the following are needed:

I always get a deserialization exception from the on-chain program. I am using testnet at the moment. Can you help me get the encoding of the collectionDetails right until the feature will be implemented in this repo? Also, as I am in the need of using this quite often, I will be delighted to also contribute to the project.

Thank you very much!

BifrostTitan commented 2 years ago

Ive implemented MetadataAccount V3 instructions.

This is what you were looking for. It took me several hours to figure this out.

        if(collectionDetails == 0)
        {
            writer.Write((byte)0);  // 0 = null | No collection details
        }
        else
        {
            writer.Write((byte)1);
            writer.Write((byte)0); // collection detail size sits in an array - this byte defines its position | should always be 0
            writer.Write((ulong)collectionDetails); //collection details size of V1 defined as a ulong

        }