Skip to main content

Questions tagged [deserialization]

Filter by
Sorted by
Tagged with
2 votes
1 answer
65 views

How to Handle Base64-Encoded Signed Transactions in Rust

does anyone know the correct way to handle a string payload that is a signed transaction in Uint8Array format encoded in base64? const signedTransactionDecoded = base58.decode(transaction); const ...
2 votes
2 answers
318 views

Decoding data that is owned by Raydium Authority V4

Hello! (I'm new to Solana blockchain) I have a problem with finding schema for base64 encoded data field. I use websocket connection and subscribe to base vault address using accountSubscribe method. ...
1 vote
3 answers
2k views

Decoding account data buffer from an account owner by Raydium Liquidity Pool V4

I'm trying to decode the account data buffer that is provided when calling methods such as getAccountInfo or getProgramAccounts with web3.js. The account in question is the account whose address is a ...
0 votes
1 answer
77 views

Serialising/deserialising data on android

I am currently going though the Solana development course and I try to adapt what I learn onto an Android application. Everything is going great so far but now I am stuck when I try to serialise/...
1 vote
1 answer
39 views

Solana Program - Rust Borsh serialization issue

Solana Program - Rust Borsh serialization issue Here is the solana program [ethereum terms this is called a smart contract]: use solana_program::{     account_info::AccountInfo,     entrypoint,     ...
1 vote
2 answers
317 views

How to deserialize Transaction/Instructions data in Java?

I am trying to create a Java (not Javascript!) Solana client that is able to understand/filter/process Meteora transactions. I started using the officially recommended library https://github.com/...
1 vote
1 answer
66 views

Deserialize Token Account in Rust Client

I am trying to obtain the state of a token account(spl_token::state::Account::AccountState), How do I deserialize a raw Solana Account to obtain this state. Other solutions i have come across involve ...
1 vote
3 answers
218 views

Error: Function Stack offset of 7256 exceeded max offset of 4096 by 3160 bytes, please minimize large stack variables

I was using anchor version 0.25.0, this error was not in that version, Now I'm using latest version of anchor, I'm using zero_copy on all the structs here are the dependencies [profile.release] ...
0 votes
1 answer
218 views

Deserialize transaction input data with publickey

How can I deserialize input args with publicKey inputs? Full Code: const borsh = require('borsh'); const bs58 = require('bs58'); const schema = { 'struct': { 'discriminator': 'u64', 'mint': "...
1 vote
1 answer
85 views

What is the difference between `serialize`,`try_to_vec` and `try_serialize` in anchor?

If I have an account let a : MyAccount and I try to serialize it to borsh, there's seemingly three ways to do this: a.try_to_vec a.try_serialize a.serialize Are these all the same?
1 vote
1 answer
68 views

What is account serialize and deserialize?

I was going through the anchor documentation and got to the tic tac toe game. Now having a hard time understanding why we need account serialize and deserialize here. pub enum GameState { Active, ...
0 votes
0 answers
28 views

Transaction input args deserialization

How can I deserialize the input args on Solana if I know the data structure and the "Instruction Data Raw"? Example transaction: https://solscan.io/tx/...
1 vote
1 answer
66 views

Not able to read the updated value in a Solana Data Account

I have a simple solana greeting-counter program, I have it deployed locally. When I am calling from my typescript code I am able to do pretty much all the transactions and verify them. Except the last ...
0 votes
1 answer
112 views

anchor_lang::AccountDeserialize

How to implement correctly try_deserialize and try_deserialize_unchecked for this Example struct? I've been trying, but failing miserably. #[derive(Clone)] pub struct ExampleProgram; declare_id!(&...
2 votes
1 answer
179 views

Deserialise getAccountInfo data from Rust rpcclient for a PDA from drift protocol

Basically I have the following code in devnet. I want to call getAccountInfo to get some account information. I have a PDA: JD71QyQpAJvoyq4p6mfwyaw4rY9qaDLk4CQpHeuPSpEK created by the programId: ...
1 vote
2 answers
750 views

Decode account data

I am trying to decode data from accounts. This is the IDL for the data I want to decode: { "name": "deployment", "type": { "kind": "...
0 votes
0 answers
91 views

Problem with account data serialization and deserializatin

I'm working on a Solana program and encountered an issue related to state management with Program Derived Accounts (PDAs). I successfully created a state for my Solana program and saved it to a PDA (...
1 vote
1 answer
313 views

how to make a proper schema for the arguments

there are arguments "args": [ { "name": "decimals", "type": "u8" }, { "name": &...
0 votes
1 answer
80 views

How to deserialize VoteState account from on-chain program

I would like to deserialize VoteState account in Solana on-chain program. https://github.com/solana-labs/solana/blob/v1.17.10/sdk/program/src/vote/state/mod.rs#L285 From what I can see it's not ...
1 vote
1 answer
379 views

Issues with Using AnchorSerialize and AnchorDeserialize Traits

so I'm looking to create an instruction that creates an account called GamePot that contains a field called TokenInfo that holds the data for what is meant to be any particular SPL token with a mint ...
2 votes
1 answer
470 views

What's the difference of using Borsh and buffer layout to encode/decode?

I want to interact with a program and discover this website: https://bettercallsol.dev/ Basically it allows you to serialize the data using both Borsh & Buffer layout. Despite they are two ...
1 vote
1 answer
1k views

How to decode base64 response?

Req: { "method": "getMultipleAccounts", "jsonrpc": "2.0", "params": [ [ "...
1 vote
1 answer
1k views

How to properly deserialize encoded transaction?

// Sign the transaction const feePayer = USER_KEYPAIR; const deserializedTx = Transaction.from(Buffer.from(swapTransaction, 'base64')); deserializedTx.partialSign(feePayer); const ...
3 votes
1 answer
245 views

Using u128 without sacrificing alignment 8

We have a struct like: #[account(zero_copy)] #[repr(C)] pub struct SomeStruct { pub authority: Pubkey, pub some_value: u128, pub another_value: u64, // etc... } This struct has alignment ...
2 votes
1 answer
435 views

How to deserialized Anchor accounts in Rust

In JS/TS I can decode an account from bytes using the coder: const program = new Program(IDL, new PublicKey(""), anchorProvider) const decoded = program.coder.accounts.decode("...
1 vote
0 answers
324 views

How to deserialize Metadata account in Typescript without Anchor IDL?

I managed to deserialize everything with this custom getMetadata() function, except for CollectionDetails and ProgrammableConfig. Does anybody know the solutions? /** * This blob of a file is pulled ...
0 votes
2 answers
1k 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 ...
1 vote
3 answers
802 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 ...
2 votes
1 answer
41 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<...
6 votes
2 answers
2k 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 ...
2 votes
1 answer
58 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 ...
1 vote
1 answer
91 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])->...
2 votes
1 answer
428 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) {...
1 vote
0 answers
927 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
263 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, ...
1 vote
0 answers
106 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: ...
4 votes
1 answer
135 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/...
2 votes
1 answer
84 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....
3 votes
1 answer
388 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 ...
3 votes
1 answer
180 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: ...
0 votes
1 answer
2k 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 ...
1 vote
2 answers
110 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, ...