I'm currently attempting to retrieve the
collection field from the Metaplex metadata of a NFT in python. My results are half correct but the collection key deserialized is entirely different than what is show on-chain. Below is an example of my code:
import asyncio import base64 from rpc_client import Rpc from helper import Helper from borsh_construct import CStruct, U8, Bool, Enum, Option from anchorpy.borsh_extension import BorshPubkey async def main(): Pubkey = BorshPubkey rpc = Rpc("https://ssc-dao.genesysgo.net/") helper = Helper(rpc) mint_hash = "EoBKaS2YwesLUAmBCaAx8vg67pBEpcWQqP9b6xz46DWT" pda_data = await helper.nft_pda(mint_hash) # Derives the PDA and returns the account data of it struct = CStruct( "collection" / CStruct("verified" / Bool, "key" / Pubkey) ) metadata = struct.parse(base64.b64decode(pda_data)) asyncio.run(main())
The above code returns the following:
Container: collection = Container: verified = True key = 4bUf8AByHXNMawak1nyhMAaDHuJpRJPCxBUuHMyVKfwQ
verified key is correct,
key is not correct. The correct key for this collection is
Here is a link to the NFT on solscan to see the difference in collection keys.
Would anyone happen to have any suggestions on what might be causing this?