You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
If anything except for a JSON map is put as the parameters for any call or view cli command, this error is returned:
PositionalArgsError: Contract method calls expect named arguments wrapped in object, e.g.
{ argName1: argValue1, argName2: argValue2 }
The issue is that the JSON does not have to be a map to be deserialized as parameters of a function. For example, in the near-sdk-rs, serde is used for the input parameters which allows deserializing as a map or an ordered sequence (JSON array).
So, if a method within near_bindgen is:
pubfnmethod(param_a:u8,param_b:String){..}
The parameters that would be valid are:
{"param_a":8,"param_b":"some_val"}
OR
[8,"some_val"]
but the latter is not allowed through CLI. This is very helpful when debugging quickly but also to minimize the size of the JSON being serialized and sent as input.
To Reproduce
Steps to reproduce the behavior:
Call any method with anything except map JSON, for example: near call <account_id> method '[8,"some_val"]'
Expected behavior
Should let the request be sent off, because the tx would succeed if done correctly
The text was updated successfully, but these errors were encountered:
I believe we should avoid enabling error-prone ways of interaction. We use JSON format to ease reviewing the arguments and we drop the field names, we should better use borsh.
CLI should allow sending anything, even binary data. near.cli.rs does that just fine.
Describe the bug
If anything except for a JSON map is put as the parameters for any call or view cli command, this error is returned:
The issue is that the JSON does not have to be a map to be deserialized as parameters of a function. For example, in the
near-sdk-rs
,serde
is used for the input parameters which allows deserializing as a map or an ordered sequence (JSON array).So, if a method within
near_bindgen
is:The parameters that would be valid are:
OR
but the latter is not allowed through CLI. This is very helpful when debugging quickly but also to minimize the size of the JSON being serialized and sent as input.
To Reproduce
Steps to reproduce the behavior:
Call any method with anything except map JSON, for example:
near call <account_id> method '[8,"some_val"]'
Expected behavior
Should let the request be sent off, because the tx would succeed if done correctly
The text was updated successfully, but these errors were encountered: