1

i was modifying the hello world program and trying to store/fetch an i32 value. my lib.rs GreetingAccount struct was already updated to i32 but when i change my GreetingSchema in hello_world.ts from u32 to i32 it returns an error, does it only accepts u32 value or am i missing something? thanks in advance folks!

enter image description here

error message:enter image description here

2 Answers 2

1

It looks like i32 is not supported by borsh-js. If you look at the source code, it only contains writers for unsigned types, such writeU32.

The library needs an update to support signed types.

You can find the source code at https://github.com/near/borsh-js/blob/6db74764cedb88097bd6d5636407f0b3481fba4c/lib/index.js

0

Borsh does not have support so just coerce it in your constructor assignment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.