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

Open
#2,326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
cli

Research direction

Start by tracing the CLI entry points for contract invoke, contract upload, contract deploy, and tx simulate, comparing how their transaction options are defined and handled. Determine the intended shared behavior for --send and --cost, including human-readable cost output. Done means the relevant commands expose consistent options and simulation, sending, and cost reporting work without manual XDR decoding.

Written by the indexing model from the issue text.

Description

feature request
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
Dominant language
Rust
Stars
123
Forks
141
Avg merge
2d 21h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stellar/stellar-cli

All issues in stellar/stellar-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.