From c74fd51e320ad1f1d9f58d8d679a15f33da1f7ad Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Mon, 2 Dec 2024 10:06:30 -0500 Subject: [PATCH] feat: contract install-> upload and keys address -> public-key Also keep the old names as aliases to be deprecated. --- FULL_HELP_DOCS.md | 12 ++++++------ cmd/crates/soroban-test/src/lib.rs | 2 +- cmd/soroban-cli/src/commands/contract/deploy/wasm.rs | 6 +++--- cmd/soroban-cli/src/commands/contract/mod.rs | 9 +++++---- .../src/commands/contract/{install.rs => upload.rs} | 0 cmd/soroban-cli/src/commands/keys/fund.rs | 6 +++--- cmd/soroban-cli/src/commands/keys/mod.rs | 9 +++++---- .../src/commands/keys/{address.rs => public_key.rs} | 0 8 files changed, 23 insertions(+), 21 deletions(-) rename cmd/soroban-cli/src/commands/contract/{install.rs => upload.rs} (100%) rename cmd/soroban-cli/src/commands/keys/{address.rs => public_key.rs} (100%) diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index 87f32eafe..175d2125d 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -88,7 +88,7 @@ Tools for smart contract developers * `info` — Access info about contracts * `init` — Initialize a Soroban contract project * `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 +* `upload` — Install a WASM file to the ledger without creating a contract instance * `invoke` — Invoke a contract function * `optimize` — Optimize a WASM file * `read` — Print the current value of a contract-data ledger entry @@ -683,11 +683,11 @@ This command will create a Cargo workspace project and add a sample Stellar cont -## `stellar contract install` +## `stellar contract upload` Install a WASM file to the ledger without creating a contract instance -**Usage:** `stellar contract install [OPTIONS] --source-account --wasm ` +**Usage:** `stellar contract upload [OPTIONS] --source-account --wasm ` ###### **Options:** @@ -939,7 +939,7 @@ Create and manage identities including keys and addresses ###### **Subcommands:** * `add` — Add a new identity (keypair, ledger, OS specific secure store) -* `address` — Given an identity return its address (public key) +* `public-key` — Given an identity return its address (public key) * `fund` — Fund an identity on a test network * `generate` — Generate a new identity with a seed phrase, currently 12 words * `ls` — List identities @@ -969,11 +969,11 @@ Add a new identity (keypair, ledger, OS specific secure store) -## `stellar keys address` +## `stellar keys public-key` Given an identity return its address (public key) -**Usage:** `stellar keys address [OPTIONS] ` +**Usage:** `stellar keys public-key [OPTIONS] ` ###### **Arguments:** diff --git a/cmd/crates/soroban-test/src/lib.rs b/cmd/crates/soroban-test/src/lib.rs index 4f36a0b33..b53557d76 100644 --- a/cmd/crates/soroban-test/src/lib.rs +++ b/cmd/crates/soroban-test/src/lib.rs @@ -300,7 +300,7 @@ impl TestEnv { /// Returns the public key corresponding to the test keys's `hd_path` pub fn test_address(&self, hd_path: usize) -> String { - self.cmd::(&format!("--hd-path={hd_path}")) + self.cmd::(&format!("--hd-path={hd_path}")) .public_key() .unwrap() .to_string() diff --git a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs index 1d85832b0..0a1699fd0 100644 --- a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs +++ b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs @@ -19,7 +19,7 @@ use soroban_spec_tools::contract as contract_spec; use crate::{ assembled::simulate_and_assemble_transaction, commands::{ - contract::{self, arg_parsing, id::wasm::get_contract_id, install}, + contract::{self, arg_parsing, id::wasm::get_contract_id, upload}, global, txn_result::{TxnEnvelopeResult, TxnResult}, NetworkRunnable, HEADING_RPC, @@ -73,7 +73,7 @@ pub struct Cmd { #[derive(thiserror::Error, Debug)] pub enum Error { #[error(transparent)] - Install(#[from] install::Error), + Install(#[from] upload::Error), #[error("error parsing int: {0}")] ParseIntError(#[from] ParseIntError), #[error("internal conversion error: {0}")] @@ -181,7 +181,7 @@ impl NetworkRunnable for Cmd { let hash = if self.fee.build_only || self.fee.sim_only { wasm::Args { wasm: wasm.clone() }.hash()? } else { - install::Cmd { + upload::Cmd { wasm: wasm::Args { wasm: wasm.clone() }, config: config.clone(), fee: self.fee.clone(), diff --git a/cmd/soroban-cli/src/commands/contract/mod.rs b/cmd/soroban-cli/src/commands/contract/mod.rs index 42792a70d..1e95ee388 100644 --- a/cmd/soroban-cli/src/commands/contract/mod.rs +++ b/cmd/soroban-cli/src/commands/contract/mod.rs @@ -10,11 +10,11 @@ pub mod id; pub mod info; pub mod init; pub mod inspect; -pub mod install; pub mod invoke; pub mod optimize; pub mod read; pub mod restore; +pub mod upload; use crate::commands::global; @@ -66,7 +66,8 @@ pub enum Cmd { Inspect(inspect::Cmd), /// Install a WASM file to the ledger without creating a contract instance - Install(install::Cmd), + #[command(visible_alias = "install")] + Upload(upload::Cmd), /// Invoke a contract function /// @@ -126,7 +127,7 @@ pub enum Error { Inspect(#[from] inspect::Error), #[error(transparent)] - Install(#[from] install::Error), + Install(#[from] upload::Error), #[error(transparent)] Invoke(#[from] invoke::Error), @@ -154,7 +155,7 @@ impl Cmd { Cmd::Info(info) => info.run(global_args).await?, Cmd::Init(init) => init.run(global_args)?, Cmd::Inspect(inspect) => inspect.run(global_args)?, - Cmd::Install(install) => install.run(global_args).await?, + Cmd::Upload(install) => install.run(global_args).await?, Cmd::Invoke(invoke) => invoke.run(global_args).await?, Cmd::Optimize(optimize) => optimize.run()?, Cmd::Fetch(fetch) => fetch.run().await?, diff --git a/cmd/soroban-cli/src/commands/contract/install.rs b/cmd/soroban-cli/src/commands/contract/upload.rs similarity index 100% rename from cmd/soroban-cli/src/commands/contract/install.rs rename to cmd/soroban-cli/src/commands/contract/upload.rs diff --git a/cmd/soroban-cli/src/commands/keys/fund.rs b/cmd/soroban-cli/src/commands/keys/fund.rs index 2419c4be2..28d018d90 100644 --- a/cmd/soroban-cli/src/commands/keys/fund.rs +++ b/cmd/soroban-cli/src/commands/keys/fund.rs @@ -2,12 +2,12 @@ use clap::command; use crate::{commands::global, config::network, print::Print}; -use super::address; +use super::public_key; #[derive(thiserror::Error, Debug)] pub enum Error { #[error(transparent)] - Address(#[from] address::Error), + Address(#[from] public_key::Error), #[error(transparent)] Network(#[from] network::Error), } @@ -19,7 +19,7 @@ pub struct Cmd { pub network: network::Args, /// Address to fund #[command(flatten)] - pub address: address::Cmd, + pub address: public_key::Cmd, } impl Cmd { diff --git a/cmd/soroban-cli/src/commands/keys/mod.rs b/cmd/soroban-cli/src/commands/keys/mod.rs index 3e36df085..5ccaa8803 100644 --- a/cmd/soroban-cli/src/commands/keys/mod.rs +++ b/cmd/soroban-cli/src/commands/keys/mod.rs @@ -2,11 +2,11 @@ use crate::commands::global; use clap::Parser; pub mod add; -pub mod address; pub mod default; pub mod fund; pub mod generate; pub mod ls; +pub mod public_key; pub mod rm; pub mod secret; @@ -16,7 +16,8 @@ pub enum Cmd { Add(add::Cmd), /// Given an identity return its address (public key) - Address(address::Cmd), + #[command(visible_alias = "address")] + PublicKey(public_key::Cmd), /// Fund an identity on a test network Fund(fund::Cmd), @@ -46,7 +47,7 @@ pub enum Error { Add(#[from] add::Error), #[error(transparent)] - Address(#[from] address::Error), + Address(#[from] public_key::Error), #[error(transparent)] Fund(#[from] fund::Error), @@ -71,7 +72,7 @@ impl Cmd { pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> { match self { Cmd::Add(cmd) => cmd.run(global_args)?, - Cmd::Address(cmd) => cmd.run()?, + Cmd::PublicKey(cmd) => cmd.run()?, Cmd::Fund(cmd) => cmd.run(global_args).await?, Cmd::Generate(cmd) => cmd.run(global_args).await?, Cmd::Ls(cmd) => cmd.run()?, diff --git a/cmd/soroban-cli/src/commands/keys/address.rs b/cmd/soroban-cli/src/commands/keys/public_key.rs similarity index 100% rename from cmd/soroban-cli/src/commands/keys/address.rs rename to cmd/soroban-cli/src/commands/keys/public_key.rs