Closed mihneacalugaru closed 1 year 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
}
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:
Changing
MetadataProgram.CreateMetadataAccount
function so as to also encode thecollectionDetails
. However, I tried to change it according to the order, offsets and sizes of arguments listed here https://docs.metaplex.com/programs/token-metadata/instructions#create-a-metadata-account and I don't seem to manage to get it working. My modified version ofMetadataProgram.CreateMetadataAccount
is: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!