nearprotocol / near-runtime-ts

Typescript library for writing near smart contracts
22 stars 7 forks source link

PersistentMap does not support array as value. #100

Closed bowenwang1996 closed 4 years ago

bowenwang1996 commented 4 years ago

PersistentMap cannot have something of array type as value due to lack of serialization support. Example https://studio.nearprotocol.com/?f=6k84p8jm3

willemneal commented 4 years ago

Found the issue. The runtime should use the generic encode/decode methods on generic types since [].serialize() isn't a method. The set method in the storage class used the serialized method. I'll add a test and make a PR.

Here is an example of it working for the newest NEAR Studio and the most up to date binding code.

willemneal commented 4 years ago

fixed by #96