soroban-cli
soroban-cli copied to clipboard
`stellar contract invoke` should support inputting and outputting with XDR
What problem does your feature solve?
The stellar contract invoke command allows passing the parameters for the invocation in their JSON/textual forms, and outputs the response in the same form. The textual form is very convenient following natural command line patterns for most types, but is still bespoke to the CLI and is not documented. When scripting using XDR there is no clear way to convert back and forth, and passing in XDR and getting XDR back would be more convenient.
What would you like to see?
Every function parameter to have a corresponding --<param>-xdr option that can be used to pass base64 encoded XDR instead. This pattern of providing a second parameter with a different suffix is a pattern already used in the CLI on the stellar contract read --key-xdr ... command, and the stellar contract invoke ... -- fn --param-file-path ... command.
An option added to the invoke command to change the output format of the function call:
--output text|xdr
What alternatives are there?
Open to suggestion but the only alternatives that come to mind are inconsistent with the existing patterns noted above.