Closed pvolnov closed 10 months ago
How I can deserialize in borsh UnorderedMap?
Now my schema is
const schema = new Map([ [ Record, { kind: "struct", fields: [ ["x2", { kind: 'map', key: 'string', value: 'u128'} ], ], }, ], ]);
Rust struct:
pub struct Counter { x2: UnorderedMap<AccountId, Balance>, }
But I have error: "Expected buffer length 2036811841 isn't within bounds"
"Expected buffer length 2036811841 isn't within bounds"
When I try serialize same struct in js, it dont work too
const value = new Test({ x2: {"1":"1"} }); const schema = new Map([ [ Test, { kind: "struct", fields: [ ["x2", { kind: 'map', key: 'string', value: 'string'} ], ] } ] ]); const buffer = borsh.serialize(schema, value); console.log(buffer.toString('base64'))
Error: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (0)
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (0)
should be fixed now, please open again if not
How I can deserialize in borsh UnorderedMap?
Now my schema is
Rust struct:
But I have error:
"Expected buffer length 2036811841 isn't within bounds"
When I try serialize same struct in js, it dont work too
Error:
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (0)