Skip to content

AccountInfo data decoding #378

Answered by hoakbuilds
tratteo asked this question in Q&A
May 2, 2022 · 1 comments · 7 replies
Discussion options

You must be logged in to vote

Taken from #140, an old reply.

This depends on the kind of object you're trying to decode but here's a general idea of what to do to try and decode the data:

First and foremost decode the data from base64 into a byte[] a Span<byte> or whatever your preferred type for this is going to be, you can check some examples of this being done in the Serum code, or the Mango or Solend ones
Afterwards, it depends on the type of account you're trying to decode, certain accounts will have a certain data layout, i.e. Serum Market accounts have a certain layout (Serum Market account layouts), and they have to be decoded according to that layout, by using offsets and reading the desired data type for the…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@tratteo
Comment options

@hoakbuilds
Comment options

@tratteo
Comment options

@hoakbuilds
Comment options

@tratteo
Comment options

Answer selected by tratteo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants