Closed mbaranovski closed 3 weeks ago
All right, answering to myself. Apparently Anchor uses first 8 bytes of the data for the discriminator (sha256 hash of the account’s Rust identifier) so I needed to padLeft by 8 bytes.
Hint found in this article: https://blog.chalda.cz/posts/decoding-solana-data
Solution:
getStructDecoder([
["validatorVoteAccount", padLeftDecoder(getAddressDecoder(), 8)],
["merkleRootUploadAuthority", getAddressDecoder()],
])
Hi, I'm aware this might not be an ideal repo to create this issue on, however it's closely related to JITO nevertheless. I'm trying to decode the
TipDistributionAccount
data using Node.js and I'm getting different results compared to the data presented on Solscan.Account data in Solscan: https://solscan.io/account/YnhGiadNZaZmmhSzGPf4wRMg9dvDT6AazZQ1JbgtHTh#data Base64 encoded account info:
For simplicity let's say we want to decode only first 2 fields:
validatorVoteAccount
andmerkleRootUploadAuthority
. My attempt:Result:
In order to verify if I'm not making any mistakes I cross-checked it with online SOL / Borsh Decoder and the result is similar to mine:
Any hints appreciated!