Skip to content

Commit

Permalink
feat: contract install-> upload and keys address -> public-key
Browse files Browse the repository at this point in the history
Also keep the old names as aliases to be deprecated.
  • Loading branch information
willemneal authored and gitbutler-client committed Dec 2, 2024
1 parent b36db49 commit 58a8129
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 22 deletions.
12 changes: 6 additions & 6 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -682,11 +682,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 <SOURCE_ACCOUNT> --wasm <WASM>`
**Usage:** `stellar contract upload [OPTIONS] --source-account <SOURCE_ACCOUNT> --wasm <WASM>`

###### **Options:**

Expand Down Expand Up @@ -934,7 +934,7 @@ Create and manage identities including keys and addresses
###### **Subcommands:**

* `add` — Add a new identity (keypair, ledger, macOS keychain)
* `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
Expand Down Expand Up @@ -964,11 +964,11 @@ Add a new identity (keypair, ledger, macOS keychain)



## `stellar keys address`
## `stellar keys public-key`

Given an identity return its address (public key)

**Usage:** `stellar keys address [OPTIONS] <NAME>`
**Usage:** `stellar keys public-key [OPTIONS] <NAME>`

###### **Arguments:**

Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,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::<keys::address::Cmd>(&format!("--hd-path={hd_path}"))
self.cmd::<keys::public_key::Cmd>(&format!("--hd-path={hd_path}"))
.public_key()
.unwrap()
.to_string()
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/contract/arg_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub fn build_host_function_parameters(
if let Some(mut val) = matches_.get_raw(&name) {
let mut s = val.next().unwrap().to_string_lossy().to_string();
if matches!(i.type_, ScSpecTypeDef::Address) {
let cmd = crate::commands::keys::address::Cmd {
let cmd = crate::commands::keys::public_key::Cmd {
name: s.clone(),
hd_path: Some(0),
locator: config.locator.clone(),
Expand Down
6 changes: 3 additions & 3 deletions cmd/soroban-cli/src/commands/contract/deploy/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}")]
Expand Down Expand Up @@ -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(),
Expand Down
9 changes: 5 additions & 4 deletions cmd/soroban-cli/src/commands/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod id;
pub mod info;
pub mod init;
pub mod inspect;
pub mod install;
pub mod upload;
pub mod invoke;
pub mod optimize;
pub mod read;
Expand Down Expand Up @@ -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
///
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -154,7 +155,7 @@ impl Cmd {
Cmd::Info(info) => info.run().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?,
Expand Down
6 changes: 3 additions & 3 deletions cmd/soroban-cli/src/commands/keys/fund.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use clap::command;

use crate::config::network;

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),
}
Expand All @@ -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 {
Expand Down
9 changes: 5 additions & 4 deletions cmd/soroban-cli/src/commands/keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::commands::global;
use clap::Parser;

pub mod add;
pub mod address;
pub mod public_key;
pub mod default;
pub mod fund;
pub mod generate;
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -71,7 +72,7 @@ impl Cmd {
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
match self {
Cmd::Add(cmd) => cmd.run()?,
Cmd::Address(cmd) => cmd.run()?,
Cmd::PublicKey(cmd) => cmd.run()?,
Cmd::Fund(cmd) => cmd.run().await?,
Cmd::Generate(cmd) => cmd.run(global_args).await?,
Cmd::Ls(cmd) => cmd.run()?,
Expand Down

0 comments on commit 58a8129

Please sign in to comment.