soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

cli: when interacting with a network output tx hash

Open tomerweller opened this issue 2 years ago • 13 comments

Maybe even with a link to the transaction page in a supported block explorer

tomerweller avatar Jul 27 '23 23:07 tomerweller

It would be helpful if in general the CLI outputted the tx hash for any tx it has built for any purpose.

leighmcculloch avatar Nov 15 '23 18:11 leighmcculloch

This feature missing is very inconvenient when wanting to introspect further into a transaction the CLI has submitted.

leighmcculloch avatar Feb 27 '24 04:02 leighmcculloch

I've opened a separate issue for being able to get the tx hash for any tx:

  • https://github.com/stellar/soroban-cli/issues/1316

It doesn't compete with this feature exactly, but I'd also find it useful and it's semi-related.

leighmcculloch avatar May 07 '24 11:05 leighmcculloch

Can log without waiting for the tx to complete

janewang avatar May 07 '24 20:05 janewang

I thought about logging the transaction hash as a debug logging, which would then be available when using --verbose. Wdyt?

$ stellar --verbose contract deploy --wasm target/wasm32-unknown-unknown/release/hello_world.wasm --source alice --network testnet --alias hello
2024-07-16T16:51:08.633869Z DEBUG soroban_cli::commands::contract::deploy::wasm: transaction hash: b92b5cd32a13eb40400b4a71361d256074cdb381df554342284ceda38202039e
CB4YDNXFAZ42EM2DJG2PXTIVXXAKTKUYOCFJ2IGVTG5FFYLNS3HV7PMO

I don't love that the verbose logging includes that much noise, but it seems like a good choice and backwards compatible.

fnando avatar Jul 16 '24 16:07 fnando

Debug is verbose. Trace is very verbose

willemneal avatar Jul 16 '24 17:07 willemneal

I think the transaction hash could be debug or info.

leighmcculloch avatar Jul 16 '24 23:07 leighmcculloch

Our commands could be more communicative about what they're doing, and not in terms of logs, but in terms of stderr output so that the user understands what is happening. We've started to do this on some commands, but not most, where we have informational output about each step.

Something like:

$ stellar contract deploy --wasm out/hello_world.wasm --source alice --network testnet --alias hello
ℹ️ Simulating install transaction...
🌎 Submitting install transaction... b92b5cd32a13eb40400b4a71361d256074cdb381df554342284ceda38202039e
ℹ️ Simulating deploy transaction...
🌎 Submitting deploy transaction... b92b5cd32a13eb40400b4a71361d256074cdb381df554342284ceda38202039e
✅ Deployed
CB4YDNXFAZ42EM2DJG2PXTIVXXAKTKUYOCFJ2IGVTG5FFYLNS3HV7PMO

In the output above all lines are stderr except the last that is stdout.

leighmcculloch avatar Jul 16 '24 23:07 leighmcculloch

@leighmcculloch I like that. Should we send everything to stderr and just the contract id to stdout, so it's backward compatible?

fnando avatar Jul 17 '24 12:07 fnando

Yeah definitely. Stdout should just be for the Contract Id so that it can be captured in scripts.

willemneal avatar Jul 17 '24 12:07 willemneal

+1 Ideally every command that could be used in a scriptable way has a single entity on stdout for scripting.

leighmcculloch avatar Jul 17 '24 13:07 leighmcculloch

It could be beneficial to do a quick sketch in a google doc for what each of the major commands are, and what type of stderr output we'd like for them. Taking a holistic view of how this should play out. Then we can make sure we have a good unified and consistent story for what this UX would look like.

leighmcculloch avatar Jul 17 '24 13:07 leighmcculloch

I think we can start with stellar contract deploy, laying out the foundation with functions like info(message), link(url), and so on. The functions would know which emoji to use and any other annotations we'd like to add.

fnando avatar Jul 17 '24 14:07 fnando