gagliardetto / metaplex-go

Go clients for the Metaplex Solana programs
MIT License
42 stars 30 forks source link

Support for new token metadata instructions released in metaplex program library on Feb 01 #13

Open oyyblin opened 2 years ago

oyyblin commented 2 years ago

https://github.com/metaplex-foundation/metaplex-program-library/discussions/178

This release on 02/01/2022 includes 4 new instructions:

I'm wondering whether we can add support for these instructions? I can help out too

Thanks :)

oyyblin commented 2 years ago

I generated a new client using anchor-go with IDL https://github.com/metaplex-foundation/metaplex-program-library/blob/master/token-metadata/js/idl/mpl_token_metadata.json

But it's now giving me this error:

(string) (len=116) "Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: Failed to serialize or deserialize account data: Unknown"

Instruction is NewCreateMetadataAccountV2InstructionBuilder. It seems like the error comes from the account keys change from

Accounts[len=7]
      │          ├─      metadataKeyPDA: 9qjc6eQYwt4sfFHwv7o126YsvTsmD85VxgDKffjUqYrS [WRITE] 
      │          ├─         mintOfToken: BLnhJN2pM7zVYJ1VM4yfVUgFanSNnicwrZQYLmaBnwr1 [WRITE, SIGN] 
      │          ├─       mintAuthority: 2LHQaVx6LnnzFaktWWpw21SJAyYbgccpuJ8kFtzsxBYM [SIGN] 
      │          ├─               payer: EmHF5zeyeqJshiwdLtNg41CRWSjwPdkASuB36giaMDsY [WRITE, SIGN] 
      │          ├─ updateAuthorityInfo: AT8BHkdwqDLCqyMSHwJstY2dtTDiqVdXjHfPtiYMNWcw [SIGN] 
      │          ├─              system: 11111111111111111111111111111111 [] 
      │          └─                rent: SysvarRent111111111111111111111111111111111 [] 

to

Accounts[len=7]
      │          ├─        metadata: FJUfinP6K4YDghKmPVZfdKP7zePCcQ8gh4G1JepqoiFy [WRITE] 
      │          ├─            mint: EbfH3QM4AaxSKXYdJp4V1LfVBvc1uK4mdfM11TGi4jhb [WRITE, SIGN] 
      │          ├─   mintAuthority: 2LHQaVx6LnnzFaktWWpw21SJAyYbgccpuJ8kFtzsxBYM [SIGN] 
      │          ├─           payer: EmHF5zeyeqJshiwdLtNg41CRWSjwPdkASuB36giaMDsY [WRITE, SIGN] 
      │          ├─ updateAuthority: AT8BHkdwqDLCqyMSHwJstY2dtTDiqVdXjHfPtiYMNWcw [SIGN] 
      │          ├─   systemProgram: 11111111111111111111111111111111 [] 
      │          └─            rent: SysvarRent111111111111111111111111111111111 [] 

Do you know how may we deal with this error?

gagliardetto commented 2 years ago

Hey @oyyblin !

I had put together the token-metadata IDL manually, so right now it's hard to be able to quickly add things without rechecking everything: https://github.com/gagliardetto/anchor-go/blob/main/idl/metaplex/token-metadata.json

You can try to delete everything from the destination folder, and then regenerate the code.