stellar / stellar-cli

CLI for Stellar developers
Apache License 2.0
72 stars 70 forks source link

Design for creating and combining multiple operations via CLI #1566

Open willemneal opened 2 months ago

willemneal commented 2 months ago

Currently we are adding the ability to create operations transactions here: https://github.com/stellar/stellar-cli/issues/1437

This adds a new tx new subcommand. Then each operation is a subcommand of this: e.g.

stellar tx new create-account --destination G... --starting-balance 10000

By default this will sign and submit the transaction, but does also accept --build-only to return the built transaction.

So to be able to add multiple operations into one transaction we would add a tx add subcommand. This would take a transaction envelope as input via stdin and then has the same interface as new, but in this case would add the operation to the passed in transaction. e.g.

stellar tx new --build-only create-account --destination G... --starting-balance 10000 | 
stellar tx add payment --source <key corresponding to the first> --amount 1000 --destination G..
leighmcculloch commented 2 months ago

I think we should change tx add to tx add-operation / tx add-op so it is clear what's being added.

In the future we may want sub-commands for adding other things, like add-signature.

This seems like a nice idea to me, but I'm not sure what the priority is as it seems like it would be usable only by some very advanced use cases, and folks can always use Stellar SDKs for advanced use cases.

willemneal commented 2 months ago

I think it's definitely useful for creating accounts since the generate can't fund on mainnet. And for payments (which yes can also be done via the SAC). Also I think set options could be useful. In general I think it is good for education and just being in alignment with the other tooling. The priority was that we made general transaction creation an OKR.

leighmcculloch commented 2 months ago

Agreed, but that goal can be served without supporting sponsorship specifically, and without supporting multi-operation transactions. Do we specifically need those?

janewang commented 2 months ago

A multi-operation transaction is a neat feature that we could work on in the future. For this quarter, I think being able to add classic ops is already a great win.