diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index 29637dcbd..cd42d818f 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -42,8 +42,8 @@ pub struct Cmd { // For testing only #[arg(skip)] pub wasm: Option, - /// Do not sign and submit transaction - #[arg(long, env = "SOROBAN_INVOKE_SIGN", env = "SYSTEM_TEST_VERBOSE_OUTPUT")] + /// View the result simulating and do not sign and submit transaction + #[arg(long, env = "SOROBAN_INVOKE_VIEW")] pub is_view: bool, /// Function name as subcommand, then arguments for that function as `--arg-name value` #[arg(last = true, id = "CONTRACT_FN_AND_ARGS")] @@ -148,6 +148,14 @@ impl From for Error { } impl Cmd { + fn is_view(&self) -> bool { + self.is_view || + // TODO: Remove at next major release. Was added to retain backwards + // compatibility when this env var used to be used for the --is-view + // option. + std::env::var("SYSTEM_TEST_VERBOSE_OUTPUT").as_deref() == Ok("true") + } + fn build_host_function_parameters( &self, contract_id: [u8; 32], @@ -328,7 +336,7 @@ impl NetworkRunnable for Cmd { )?; let txn = client.create_assembled_transaction(&tx).await?; let txn = self.fee.apply_to_assembled_txn(txn); - let (return_value, events) = if self.is_view { + let (return_value, events) = if self.is_view() { ( txn.sim_response().results()?[0].xdr.clone(), txn.sim_response().events()?, diff --git a/docs/soroban-cli-full-docs.md b/docs/soroban-cli-full-docs.md index 5600db277..6e06debe9 100644 --- a/docs/soroban-cli-full-docs.md +++ b/docs/soroban-cli-full-docs.md @@ -953,7 +953,7 @@ soroban contract invoke ... -- --help ###### **Options:** * `--id ` — Contract ID to invoke -* `--is-view` — Do not sign and submit transaction +* `--is-view` — View the result simulating and do not sign and submit transaction Possible values: `true`, `false`