Skip to main content

Questions tagged [deserialization]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
61 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
23 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
29 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
  • 51
1 vote
1 answer
44 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
68 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
377 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
70 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
63 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
214 views

how to make a proper schema for the arguments

there are arguments "args": [ { "name": "decimals", "type": "u8" }, { "name": &...
slntrx's user avatar
  • 111
2 votes
1 answer
131 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
1k 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
58 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,402
1 vote
1 answer
204 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
  • 121
1 vote
1 answer
228 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
  • 137
1 vote
1 answer
952 views

How to decode base64 response?

Req: { "method": "getMultipleAccounts", "jsonrpc": "2.0", "params": [ [ "...
omm's user avatar
  • 27
1 vote
1 answer
870 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
118 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,234
2 votes
1 answer
318 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
  • 163
1 vote
0 answers
271 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
954 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
596 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
38 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
53 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
  • 183
1 vote
1 answer
85 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,164
1 vote
0 answers
722 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
186 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
393 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
  • 147
1 vote
0 answers
95 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
  • 435
4 votes
1 answer
113 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
  • 399
6 votes
2 answers
1k 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
  • 146
2 votes
1 answer
357 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
74 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
1k 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
175 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
  • 435
1 vote
2 answers
95 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