Open erik78se opened 1 month ago
Automatic conversion should be possible for -text
, for sure.
The -json
option at the moment assumes just an input method, e.g. -json mmr_generateProof
. Perhaps it would be better to have an option -json
which takes a raw JSON string as in your example, and another -method
which accepts just a method.
Thoughts?
I think that the automatic detection and conversion of return-type payload would make alot of sense and perhaps be default and perhaps, if you think its what the tool should do, it to allow the data be passed as binary 8bit output for pipeing into other tools for debugging.
I was very confused initially when I was passing what I thought to be json and only when switching to -text it was accepted. But maybe I'm missing something on how the tool needs to operate?
Started addressing this issue, PR with initial changes: https://github.com/jakobilobi/wsstat/pull/11
Planning to add in the near future:
PR https://github.com/jakobilobi/wsstat/pull/12 adds "raw" output as an option, and automatically decodes responses into JSON.
I'll make another sweep to improve the --help
command before closing this issue.
It is a bit counter intuitive user experience when run against a polkadot websocket.
This was my call:
wsstat -text '{"id": 1, "jsonrpc": "2.0", "method": "mmr_generateProof", "params": [[1021312]]}' ws://192.168.109.179:9933
It returns: