Skip to main content
1 of 2
Dev Bharel
  • 224
  • 1
  • 7

How to deserialize raw account data from tx in rust?

I get a b64 encoded data for an account from the transaction. I need to decode it into my account data struct called "Entity".

I deserialize the b64 data into bytes then :-

I tried to straight Entity::try_from_slice(bytes) but that throws an unexpected length of input error. This leads me to believe that that data is an AccountInfo struct, but there's no AccountInfo::try_from_slice() as I would have expected and the try_from() fn doesn't take in bytes.

Stuck on trying to figure out how to deserialize raw account data into an AccountInfo struct or better yet directly into my data struct.

Dev Bharel
  • 224
  • 1
  • 7