soroban-cli
soroban-cli copied to clipboard
Support passing contract invocation args as JSON
This idea was shared or formed from some combination of @janewang @chadoh @willemneal (sorry I missed who put this in the doc but I think it was one of you!). I'm moving it here because the doc was focused on capturing the status quo.
Currently invoking a contract has the following format. It is elegant and meets most needs:
soroban contract invoke --id C123… -- do_something \
--num 1 \
--complex_arg '{ "field": 1 }'
There are situations where it may be helpful to form a single JSON blob for the args and pass them in as a single value either via an arg:
soroban contract invoke --id C123... \
--args-json ‘{“method”: “do_something”, “args”: {“num”: 1, “complex_arg”: {“field”: 1}}’
or via stdin:
soroban contract invoke --id C123... -- do_something << -
{“num”: 1, “complex_arg”: {“field”: 1}}
-