near / near-api-py

Python API to interact with NEAR via RPC API
MIT License
52 stars 29 forks source link

Decoding view_call response #3

Open Dirt-Nasty opened 2 years ago

Dirt-Nasty commented 2 years ago

Any reason why view_call response is not returning the byte array decoded? Just want to make sure I'm not setting myself up for disaster down the road. I been using json.loads("".join(map(chr, bytes_data))) and it seems to be working well but not sure if that is the most efficient way.

frol commented 2 years ago

@Dirt-Nasty That is because NEAR Protocol by design operates with byte-array inputs/outputs, and it is up to contract developers to define the serialization/deserialization and it just happens that most of the contracts use JSON. You are welcome to contribute the support for custom serialization/deserialization for view_call method.