XRPLF / clio

An XRP Ledger API Server
https://xrpl.org
ISC License
61 stars 51 forks source link

Clio requires json input types to be actual types #460

Open legleux opened 1 year ago

legleux commented 1 year ago

rippled expects every input to be a string and as such, will even cast integers to strings. Clio seems to do the opposite. If you pass a string of a number in, it complains it wants a number:

curl -s s.altnet.rippletest.net:51234 -d'{"method": "account_tx", "params":[{"account": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe", "ledger_index_max": -1, "ledger_index_min": -1, "limit": "2"}]}'
...
"status": "success"
...

vs:

curl -s 34.219.224.23:51234 -d'{"method": "account_tx", "params":[{"account": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe", "ledger_index_max": -1, "ledger_index_min": -1, "limit": "2"}]}'
...    
"error": "invalidParams",
    "error_code": 31,
    "error_message": "limitNotInt"
...
godexsoft commented 1 year ago

There is an argument to be had there as to which one is correct and which one is not.

godexsoft commented 1 year ago

As it is right now, in clio the RPC parsing and validation of input is implemented separately in each RPC command. Once we refactor to have some common place to parse the input and potentially convert strings to ints etc. then we can much more easily support this if needed.

cindyyan317 commented 1 year ago

Seems rippled does not always accept actual int and int in string: Screenshot 2023-03-09 at 09 50 11