Skip to main content

Questions tagged [deserialization]

Filter by
Sorted by
Tagged with
2 votes
1 answer
64 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 ...
Luigi Remor's user avatar
2 votes
2 answers
310 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. ...
Plz help's user avatar
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 ...
chinepun.sol's user avatar
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] ...
Abhishek Faliya's user avatar
1 vote
2 answers
311 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/...
imaykay's user avatar
  • 13
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,     ...
CryptoSHREE MONEY's user avatar
1 vote
1 answer
84 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?
McBain's user avatar
  • 5,384
0 votes
1 answer
217 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': "...
Levente Bencze's user avatar
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/...
Levente Bencze's user avatar
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, ...
Anas's user avatar
  • 71
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 ...
Md Tauhidul Islam's user avatar
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!(&...
beliveN DAOist.dev's user avatar
1 vote
2 answers
748 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": "...
CryptoTioSam's user avatar
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 (...
Nikita's user avatar
  • 1
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/...
xapgo's user avatar
  • 1
1 vote
1 answer
312 views

how to make a proper schema for the arguments

there are arguments "args": [ { "name": "decimals", "type": "u8" }, { "name": &...
slntrx's user avatar
  • 131
2 votes
1 answer
178 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: ...
panicKing's user avatar
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 ...
dbykv234's user avatar
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 ...
chalda's user avatar
  • 1,657
1 vote
1 answer
377 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 ...
Brian M.'s user avatar
  • 141
2 votes
1 answer
468 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 ...
johnhckuo's user avatar
  • 157
1 vote
1 answer
1k views

How to decode base64 response?

Req: { "method": "getMultipleAccounts", "jsonrpc": "2.0", "params": [ [ "...
omm's user avatar
  • 27
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 ...
omm's user avatar
  • 27
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 ...
Whiteseal's user avatar
  • 3,597
2 votes
1 answer
434 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("...
lameren's user avatar
  • 173
1 vote
0 answers
323 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 ...
jonasXchen's user avatar
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 ...
Jinspe's user avatar
  • 3
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 ...
DZWG's user avatar
  • 91
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<...
Varun Siva's user avatar
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 ...
LAUR_NASA's user avatar
  • 193
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])->...
Yilmaz's user avatar
  • 1,264
1 vote
0 answers
923 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. ...
Tomvkgames's user avatar
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, ...
Ripleys 0x's user avatar
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) {...
Sky020's user avatar
  • 167
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: ...
sayantank's user avatar
  • 465
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/...
CryptoSar's user avatar
  • 419
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 ...
ngundotra's user avatar
  • 528
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 ...
kafinsalim's user avatar
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....
tenxsoydev's user avatar
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 ...
Nikon Dolgushin's user avatar
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: ...
sayantank's user avatar
  • 465
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, ...
Nabeel Naveed's user avatar