From f311b9bfecfa21d5e45c34959a23c1bb456a18de Mon Sep 17 00:00:00 2001 From: Gleb Date: Fri, 27 Sep 2024 18:26:13 -0400 Subject: [PATCH 1/4] Deprecate contract inspect --- FULL_HELP_DOCS.md | 4 ++-- cmd/soroban-cli/src/commands/contract/inspect.rs | 8 +++++++- cmd/soroban-cli/src/commands/contract/mod.rs | 5 +++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index 479ac6720..2406d81c1 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -85,7 +85,7 @@ Tools for smart contract developers * `id` — Generate the contract id for a given contract or asset * `info` — Access info about contracts * `init` — Initialize a Soroban project with an example contract -* `inspect` — Inspect a WASM file listing contract functions, meta, etc +* `inspect` — (Deprecated) Inspect a WASM file listing contract functions, meta, etc * `install` — Install a WASM file to the ledger without creating a contract instance * `invoke` — Invoke a contract function * `optimize` — Optimize a WASM file @@ -634,7 +634,7 @@ Initialize a Soroban project with an example contract ## `stellar contract inspect` -Inspect a WASM file listing contract functions, meta, etc +(Deprecated) Inspect a WASM file listing contract functions, meta, etc **Usage:** `stellar contract inspect [OPTIONS] --wasm ` diff --git a/cmd/soroban-cli/src/commands/contract/inspect.rs b/cmd/soroban-cli/src/commands/contract/inspect.rs index 36a1a2302..46fdc33a7 100644 --- a/cmd/soroban-cli/src/commands/contract/inspect.rs +++ b/cmd/soroban-cli/src/commands/contract/inspect.rs @@ -5,6 +5,8 @@ use std::{fmt::Debug, path::PathBuf}; use tracing::debug; use super::SpecOutput; +use crate::commands::global::Args; +use crate::print::Print; use crate::{config::locator, wasm}; #[derive(Parser, Debug, Clone)] @@ -33,7 +35,11 @@ pub enum Error { } impl Cmd { - pub fn run(&self) -> Result<(), Error> { + pub fn run(&self, global_args: &Args) -> Result<(), Error> { + Print::new(global_args.quiet).warnln( + "`contract inspect` has been deprecated in favor of `contract info`. \ + Please use `contract info` instead.", + ); let wasm = self.wasm.parse()?; debug!("File: {}", self.wasm.wasm.to_string_lossy()); let output = match self.output { diff --git a/cmd/soroban-cli/src/commands/contract/mod.rs b/cmd/soroban-cli/src/commands/contract/mod.rs index 761784de9..a0e5da585 100644 --- a/cmd/soroban-cli/src/commands/contract/mod.rs +++ b/cmd/soroban-cli/src/commands/contract/mod.rs @@ -56,7 +56,8 @@ pub enum Cmd { /// Initialize a Soroban project with an example contract Init(init::Cmd), - /// Inspect a WASM file listing contract functions, meta, etc + /// (Deprecated) Inspect a WASM file listing contract functions, meta, etc + #[command(display_order = 100)] Inspect(inspect::Cmd), /// Install a WASM file to the ledger without creating a contract instance @@ -147,7 +148,7 @@ impl Cmd { Cmd::Id(id) => id.run()?, Cmd::Info(info) => info.run().await?, Cmd::Init(init) => init.run(global_args)?, - Cmd::Inspect(inspect) => inspect.run()?, + Cmd::Inspect(inspect) => inspect.run(global_args)?, Cmd::Install(install) => install.run(global_args).await?, Cmd::Invoke(invoke) => invoke.run(global_args).await?, Cmd::Optimize(optimize) => optimize.run()?, From 0fded26f3847acad12ba82faa25e43df34072f72 Mon Sep 17 00:00:00 2001 From: Gleb Date: Fri, 4 Oct 2024 11:24:18 -0700 Subject: [PATCH 2/4] Update cmd/soroban-cli/src/commands/contract/mod.rs Co-authored-by: Willem Wyndham --- cmd/soroban-cli/src/commands/contract/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/soroban-cli/src/commands/contract/mod.rs b/cmd/soroban-cli/src/commands/contract/mod.rs index a0e5da585..9ac6b8527 100644 --- a/cmd/soroban-cli/src/commands/contract/mod.rs +++ b/cmd/soroban-cli/src/commands/contract/mod.rs @@ -56,7 +56,7 @@ pub enum Cmd { /// Initialize a Soroban project with an example contract Init(init::Cmd), - /// (Deprecated) Inspect a WASM file listing contract functions, meta, etc + /// (Deprecated in favor of `contract info` subcommands) Inspect a WASM file listing contract functions, meta, etc #[command(display_order = 100)] Inspect(inspect::Cmd), From 1a9b04e0d600a38dddf0673cbdfc90ec7fd716a6 Mon Sep 17 00:00:00 2001 From: Gleb Date: Fri, 4 Oct 2024 11:42:30 -0700 Subject: [PATCH 3/4] Clippy --- cmd/soroban-cli/src/commands/network/container/shared.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/soroban-cli/src/commands/network/container/shared.rs b/cmd/soroban-cli/src/commands/network/container/shared.rs index 38cb17af2..c7964abb0 100644 --- a/cmd/soroban-cli/src/commands/network/container/shared.rs +++ b/cmd/soroban-cli/src/commands/network/container/shared.rs @@ -157,7 +157,7 @@ fn try_docker_desktop_socket( &default_docker_desktop_host, DEFAULT_TIMEOUT, API_DEFAULT_VERSION, - ).map_err(|e| { + ).inspect_err(|_| { print.errorln(format!( "Failed to connect to the Docker daemon at {host:?}. Is the docker daemon running?" )); @@ -167,7 +167,6 @@ fn try_docker_desktop_socket( print.infoln( "Please note that if you are using Docker Desktop, you may need to utilize the `--docker-host` flag to pass in the location of the docker socket on your machine." ); - e }) } From 15089448f6ec680b45abae9dd1d23ac98ed110df Mon Sep 17 00:00:00 2001 From: Gleb Date: Fri, 4 Oct 2024 11:45:59 -0700 Subject: [PATCH 4/4] Docs --- FULL_HELP_DOCS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index d69f3f4a4..5128ce396 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -85,7 +85,7 @@ Tools for smart contract developers * `id` — Generate the contract id for a given contract or asset * `info` — Access info about contracts * `init` — Initialize a Soroban project with an example contract -* `inspect` — (Deprecated) Inspect a WASM file listing contract functions, meta, etc +* `inspect` — (Deprecated in favor of `contract info` subcommands) Inspect a WASM file listing contract functions, meta, etc * `install` — Install a WASM file to the ledger without creating a contract instance * `invoke` — Invoke a contract function * `optimize` — Optimize a WASM file @@ -630,7 +630,7 @@ Initialize a Soroban project with an example contract ## `stellar contract inspect` -(Deprecated) Inspect a WASM file listing contract functions, meta, etc +(Deprecated in favor of `contract info` subcommands) Inspect a WASM file listing contract functions, meta, etc **Usage:** `stellar contract inspect [OPTIONS] --wasm `