gagliardetto / metaplex-go

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

Question: i got a decode error when i'm using `GetAccountInfo` function to get candymachinev2 state info #15

Closed gtsigner closed 2 years ago

gtsigner commented 2 years ago

in exmaple test file image

image

Many thanks. Could u help me or tell me how to fix this errors?

gtsigner commented 2 years ago

I'm very interested in your repos built recently for SOLANA, hope i can join you one day.

gagliardetto commented 2 years ago

hey @godtoy

The data contained in the account you're fetching is not a CandyMachine.

gagliardetto commented 2 years ago

Each type of account contains a special 8 bytes at the beginning that determine its type (so that one account type won't be accidentally parsed as another).

The CandyMachine object expects an account that starts with these first 8 bytes: [51, 173, 177, 113, 25, 241, 109, 189]

That's not the case here, which means it's not a CandyMachine.

gtsigner commented 2 years ago

I figure out why,haha. it's different with CandyMachineV2 IDL

https://explorer.solana.com/address/CMZYPASGWeTz7RNGHaRJfCq2XQ5pYK6nDvVQxzkH51zb/anchor-program

I solved , thank you so much

gtsigner commented 2 years ago

it's from magiceden, https://magiceden.io/ . could u please add it in this project?

gtsigner commented 2 years ago

anchor-go is also so amazing

gagliardetto commented 2 years ago

it's from magiceden, https://magiceden.io/ . could u please add it in this project?

I don't have experience with magiceden (no idea how it works).

gtsigner commented 2 years ago

Same with Candymachine, it just a fork less change. https://explorer.solana.com/address/CMZYPASGWeTz7RNGHaRJfCq2XQ5pYK6nDvVQxzkH51zb/anchor-program

U can copy this IDL json config to your anchor-go project than gen it to metaplex folder

gtsigner commented 2 years ago

image

works for me now.

gtsigner commented 2 years ago

image

gagliardetto commented 2 years ago

I get it now