near / borsh-js

TypeScript/JavaScript implementation of Binary Object Representation Serializer for Hashing
Apache License 2.0
112 stars 38 forks source link

add support for fixed size array of any type #3

Closed defactojob closed 10 months ago

MarioProjects commented 2 years ago

@ailisp @defactojob or @mehtaphysical there is any update?

I want to send a list of [u64; 12] (96 bytes) but I cannot achieve it with this code:

let parsed_bundles = bundles.split(";").map(Number);
let bundles_prices = [];
for (let i = 0; i < 12; i++) {
    bundles_prices.push(new BN(sol_to_lamports(parsed_bundles[i]), 16) || new BN(0, 16));
}

Error: Expecting byte array of length 96, but got 12 bytes

Any suggestion or help? Thanks!

daoplays commented 2 years ago

When you say of any type, does that include f64?

gagdiez commented 10 months ago

Closing PR as it is not compatible with the new code, please resolve conflicts if still relevant and open again