Questions tagged [deserialization]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
56 views

Offline Transaction: Transaction signature verification failure?

we are recently been having some issues with our transactions on Solana. We serialize the transaction, send it to the user, deserialize it, make the user sign, extract the signature, send back the ...
  • 3
1 vote
3 answers
58 views

Solana Deserialization

Anymore has some resources or something on how to implement borsh deserialization for Solana instruction data? I'm having the issue that I don't know the length so I get an error when trying to call ...
  • 71
2 votes
1 answer
23 views

Am I allowed to use a BinaryHeap in an account?

I'm pretty sure std::collections::BinaryHeap supports Borsh, so I thought I could use it with an account. Here is the account: #[account] pub struct Voter { pub claim_queue: BinaryHeap<...
2 votes
1 answer
25 views

is it automatically written data to a pda account once you serialise it's data buffer?

I am learning Solana from the soldev.app. The code is taken from the StateManagement tutorial. After the pda_account is deserialized, there is written new values into its buffer. Shouldn't be a method ...
  • 113
1 vote
1 answer
37 views

What does range full operator do in borsh serialize?

I follow hackernoon-solana to see the syntax in non anchor project. this is the function signature pub fn process_instruction(program_id:&Pubkey,accounts:&[AccountInfo],input:&[u8])->...
  • 957
1 vote
0 answers
138 views

Deserialize metaplex token metadata instruction data

I would like to dezerialise instruction data to the metaplex token metadata program in node js. For example the instruction data of creating a metadata account v2 or when creating a master edition v3. ...
3 votes
1 answer
52 views

Recommended serialization library for dynamically sized objects

I am trying to write a vector of objects into a solana account. The problem is, the pre-allocated size of the account might be too small for my vector. I know i can re-size the account with realloc, ...
2 votes
1 answer
110 views

Data Account Cannot Be Deserialized

Following the helloworld example, I have a client script that is supposed to create a data account for a program account: export async function createAccount(connection,payer,programId,accountPubkey) {...
  • 65
1 vote
0 answers
39 views

How to have a Sequence of Union while using buffer-layout?

I'm trying to create some layouts for serum-dex Slab accounts, where, export class Slab { readonly header: SlabHeader; readonly nodes: SlabNode[]; constructor(header: SlabHeader, nodes: ...
  • 395
4 votes
1 answer
43 views

How to allot 1 bit space for boolean in Anchor program?

Anchor requires the allotment of 1 byte of space for a boolean value even though only 1 bit is required. Is there a way to use only 1 bit for booleans while still using Anchor for the serialization/...
  • 349
5 votes
2 answers
191 views

What's the best way to deserialize Anchor Account Data from AccountInfo?

I have struct MyAccount that I want to deserialize from a list of ctx.remaining_accounts. What's the best way of doing this? Currently I'm using the following format, copied from jet protocol v2's ...
0 votes
0 answers
10 views

Problem reading an object from an account

I'm having a problem with Vec, when I try to read an array of objects in my test, all I'm getting is [object Object], this is the state of my program #[derive(Debug, Clone, BorshSchema, ...
  • 1
1 vote
1 answer
172 views

Instruction Error after upgrading solana program

I deployed a program. some account interact with it and created PDA for the user state of the program. After a while I upgraded the program because i need to modify the user state PDA, adding a new ...
2 votes
1 answer
47 views

Is it possible to use type `char` in an account field / as funciton arguments?

The goal is to use to use the char type. I couldn't find a way or ressource on how to solve to borsh serialization errors that get thrown when trying to store a char type in an #[account] struct field....
0 votes
1 answer
166 views

Failed to serialize or deserialize account data: Unknown

I am trying to write data to an account that is the account of the created bet. My smart contract should send reports from the user's account to the bet account. then write down some data (the amount ...
3 votes
1 answer
87 views

Transaction Serialization/Deserialization not matching

I'm trying to send a serialized transaction to a server, and then deserialize it there to be sent to an RPC then. There's one owner account, and two types of instructions as mentioned: NonWritableIx: ...
  • 395
1 vote
2 answers
55 views

Recommended way to get Co-ordinated cluster time off chain

Q1.What is the recommended way to fetch current cluster co-ordinated timestamp ? is it via fetching the clock account and deserializing it if so is there a method which takes care of deserializing it, ...