-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Hello I have an array of structs coming from a Rust app that I am trying to deserialize using buffer-layout. It sort of works but the values are coming in a strange sort of offset. Basically my struct has two fields: archive_id and created_on but the created_on is being filled into the next item in the array instead of together with the matching archive_id.
// this is the rust struct that is coming into my client js code
#[derive(BorshSerialize, BorshDeserialize, Debug)] pub struct ChatMessage { pub archive_id: String, pub created_on: String }
// this is the deserialization code in javascript
const archive_id = lo.cstr("archive_id"); const created_on = lo.cstr("created_on"); const dataStruct = lo.struct([archive_id, created_on], "ChatMessage"); const ds = lo.seq(dataStruct, CHAT_MESSAGE_ELEMENTS_COUNT); const messages = ds.decode(sentAccount.data);
// this is the how the results come in. note on rust side the logs look normal
