Skip to content

Add --send and --cost options to contract upload and contract deploy for consistency with contract invoke #2326

@leighmcculloch

Description

@leighmcculloch

What problem does your feature solve?

There are inconsistencies in the CLI options available across commands that simulate and send transactions with contract invocations:

  1. --send option missing on contract upload and contract deploy: The contract invoke command has a --send option that controls whether to simulate-only or actually send the transaction. This option is not available on contract upload or contract deploy, meaning users cannot use the same interface for simulating without sending. The workaround is to use --build-only | stellar tx simulate, but this is inconsistent with the contract invoke experience.

  2. --cost option missing on contract upload and contract deploy: The contract invoke command has a --cost option that provides visibility into the costs paid. This option is not available on contract upload or contract deploy, so users have no visibility into the costs of these operations.

  3. --cost option missing on stellar tx simulate: Even when using the workaround of piping to stellar tx simulate, there's no --cost option on that command either. Users can get back a simulated transaction, but cannot see human-friendly cost output on the command line without manually decoding the transaction to extract the costs.

Use case: A developer wants to measure ahead of time what the cost of uploading or deploying a contract will be on mainnet. Currently there's no straightforward way to simulate these operations and see the costs without actually submitting the transaction or manually decoding XDR output.

What would you like to see?

Any command that simulates or sends transactions with contract invoke host operations should support a consistent set of options for:

  • Deciding whether to simulate-only or send (--send)
  • Gaining insight into costs (--cost)

Some examples (not exhaustive):

  • Add --send option to contract upload and contract deploy
  • Add --cost option to contract upload and contract deploy
  • Add --cost option to stellar tx simulate

There may be other commands that would benefit from these options as well. The general principle is that commands dealing with transaction simulation and submission should have a consistent interface.

What alternatives are there?

  • Use --build-only and pipe to stellar tx simulate (but this still lacks --cost output)
  • Pipe the output of stellar tx simulate to stellar xdr decode to extract cost information from the transaction XDR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo (Ready for Dev)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions