Questions tagged [borsh]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

'Program log: Error: InvalidInstructionData',

const { SystemProgram, PublicKey, TransactionInstruction, SYSVAR_RENT_PUBKEY, Connection, Transaction, sendAndConfirmTransaction, Keypair, } = require("@solana/web3.js"); ...
Roomka's user avatar
  • 33
0 votes
1 answer
11 views

borsh.serialize is not a function

class Initialize1 { constructor({ nonce, openTime }) { this.nonce = nonce; this.openTime = openTime; } static schema = new Map([ [ Initialize1, { kind: "...
Roomka's user avatar
  • 33
0 votes
0 answers
25 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
38 views

Parsing instructions in Rust

I'm exploring a service called Streaming Fast that parses instruction data by program ID. I'm currently listening to the Stake11111111111111111111111111111111111111 program id and I see: { "...
AceGravity's user avatar
1 vote
1 answer
62 views

how to make a proper schema for the arguments

there are arguments "args": [ { "name": "decimals", "type": "u8" }, { "name": &...
slntrx's user avatar
  • 97
2 votes
1 answer
76 views

Deserializing an Enum with borsh

How do I make a "kind": "enum" using borsh? In the IDL, it says that it's an enum instead of "struct". Here is what I tried: const WhitelistMode = borsh.rustEnum([ ...
Garen's user avatar
  • 21
1 vote
1 answer
84 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
  • 135
0 votes
1 answer
75 views

program return data to client error

I'm returning a Result<u64> from my program and want to get that value in the typescript client. I'm using anchor, and attempting to use the functions below: const getReturnLog = (...
joebuild's user avatar
  • 455
5 votes
1 answer
101 views

Borsh dependency issue with latest versions of crates

I am getting this type of errors the trait bound `Pubkey: BorshSerialize` is not satisfied --> src/system_program.rs:343:10 | 343 | #[derive(Accounts)] | ^^^^^^^^ the trait `...
Abhishek Faliya's user avatar
3 votes
1 answer
351 views

Borsh, pubkey & COption

#[derive(BorshSerialize, BorshDeserialize)] pub struct Mint_instruction_data { pub tag: u8, pub decimals: u8, pub mint_authority: Pubkey, pub freeze_authority: COption<Pubkey>, }...
0xZiyad's user avatar
  • 31
1 vote
3 answers
225 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
  • 71
2 votes
1 answer
32 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
1 vote
1 answer
72 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,071
3 votes
1 answer
104 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
4 votes
1 answer
640 views

Borsh Deserialization error: Trying to access beyond buffer length

I've seen some similar threads regarding this problem but none have provided a stable solution. I get the following error when attempting to fetch and deserialize account data: Deserialization error: ...
Joey Meere's user avatar
2 votes
1 answer
319 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
  • 117
4 votes
1 answer
105 views

How does borsh serialize updated data back into account?

In the code from the project here, the processing logic is as follows: pub struct Processor {} impl Processor { pub fn process_instruction( _program_id: &Pubkey, accounts: &...
Finlay Weber's user avatar
1 vote
1 answer
124 views

Deserializing Enum using borch_construct (Candy Machine Account Data)

While deserializing account data from: https://explorer.solana.com/address/DZWdnz5VXYxGrutAFCUHzy5JkGc3kY4aGGv8oeT3nR26/anchor-account I am running into issues with the Enum object in borsh_construct. ...
Jim Eagle's user avatar
2 votes
0 answers
105 views

Trying to access beyond buffer length when decoding Solana program accounts data wit Borsh [closed]

Going through the Solana Cookbook lesson 6 but got stuck: If I try to decode the account data through Borsh, creating the data schema and using the decode function, I get: "Trying to access ...
Vitto's user avatar
  • 121
0 votes
2 answers
98 views

How do you decode struct numbers for testing in anchor?

I have the following pub fn initialize_state( ctx: Context<InitializeState>, deposit_cap: u64, ) -> Result<()> { let mut state_account = ctx.accounts.state_account.load_init(...
escargo's user avatar
  • 15
1 vote
1 answer
611 views

Rust Client - Get Serum liquidity pool info

I'd like to get account data from a Serum Liquidity Pool in my Solana Rust Client. I have chosen the path to do this in Rust, so please avoid asking why I don't do this in TypeScript. I have ...
CTKI's user avatar
  • 43
2 votes
1 answer
120 views

Persistent negative offset span value when serialising a structure in Borsh generated by Anchor

Using the Anchor framework (version 0.25.0 which is the latest at the time of writing) for blockchain programs on Solana, I defined a structure with four String fields. Besides that, it has a BN.js ...
WalrusGumboot's user avatar
4 votes
3 answers
298 views

Program cannot deserialize borsch serialized instruction from typescript client

I am trying to write a client code in typescript for a contract written in vanilla rust. I am unable to serialize an instruction such that it can be deserialized by the program #[derive(Debug, ...
chinepun.sol's user avatar