Skip to content

Commit

Permalink
Merge branch 'main' into retrievableness-axolemma
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Aug 27, 2024
2 parents 1cc8bef + 05e362b commit dcb7f86
Show file tree
Hide file tree
Showing 14 changed files with 180 additions and 26 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default-members = ["cmd/soroban-cli", "cmd/crates/soroban-spec-tools", "cmd/crat
exclude = ["cmd/crates/soroban-test/tests/fixtures/hello"]

[workspace.package]
version = "21.4.0"
version = "21.4.1"
rust-version = "1.79.0"

[workspace.dependencies.soroban-env-host]
Expand All @@ -27,15 +27,15 @@ version = "=21.5.0"
version = "=21.5.0"

[workspace.dependencies.soroban-spec-json]
version = "=21.4.0"
version = "=21.4.1"
path = "./cmd/crates/soroban-spec-json"

[workspace.dependencies.soroban-spec-typescript]
version = "21.4.0"
version = "21.4.1"
path = "./cmd/crates/soroban-spec-typescript"

[workspace.dependencies.soroban-spec-tools]
version = "21.4.0"
version = "21.4.1"
path = "./cmd/crates/soroban-spec-tools"

[workspace.dependencies.soroban-sdk]
Expand All @@ -48,7 +48,7 @@ version = "=21.2.0"
version = "=21.2.0"

[workspace.dependencies.soroban-cli]
version = "=21.4.0"
version = "=21.4.1"
path = "cmd/soroban-cli"

[workspace.dependencies.soroban-rpc]
Expand Down
33 changes: 33 additions & 0 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Tools for smart contract developers
###### **Subcommands:**

* `asset` — Utilities to deploy a Stellar Asset Contract or get its id
* `alias` — Utilities to manage contract aliases
* `bindings` — Generate code client bindings for a contract
* `build` — Build a contract from source
* `extend` — Extend the time to live ledger of a contract-data ledger entry
Expand Down Expand Up @@ -151,6 +152,38 @@ Deploy builtin Soroban Asset Contract



## `stellar contract alias`

Utilities to manage contract aliases

**Usage:** `stellar contract alias <COMMAND>`

###### **Subcommands:**

* `remove` — Remove contract alias



## `stellar contract alias remove`

Remove contract alias

**Usage:** `stellar contract alias remove [OPTIONS] <ALIAS>`

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

* `<ALIAS>` — The contract alias that will be removed

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

* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config



## `stellar contract bindings`

Generate code client bindings for a contract
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/soroban-test"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
version = "21.4.0"
version = "21.4.1"
edition = "2021"
rust-version.workspace = true
autobins = false
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "soroban-hello"
version = "21.4.0"
version = "21.4.1"
edition = "2021"
publish = false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_custom_account"
version = "21.4.0"
version = "21.4.1"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_custom_types"
version = "21.4.0"
version = "21.4.1"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_hello_world"
version = "21.4.0"
version = "21.4.1"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/stellar-cli"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
version = "21.4.0"
version = "21.4.1"
edition = "2021"
rust-version.workspace = true
autobins = false
Expand Down
24 changes: 24 additions & 0 deletions cmd/soroban-cli/src/commands/contract/alias.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::commands::global;

pub mod remove;

#[derive(Debug, clap::Subcommand)]
pub enum Cmd {
/// Remove contract alias
Remove(remove::Cmd),
}

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error(transparent)]
Remove(#[from] remove::Error),
}

impl Cmd {
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
match &self {
Cmd::Remove(remove) => remove.run(global_args).await?,
}
Ok(())
}
}
62 changes: 62 additions & 0 deletions cmd/soroban-cli/src/commands/contract/alias/remove.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
use std::fmt::Debug;

use clap::{command, Parser};

use crate::commands::{config::network, global};
use crate::config::locator;
use crate::print::Print;

#[derive(Parser, Debug, Clone)]
#[group(skip)]
pub struct Cmd {
#[command(flatten)]
pub config_locator: locator::Args,

#[command(flatten)]
network: network::Args,

/// The contract alias that will be removed.
pub alias: String,
}

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error(transparent)]
Locator(#[from] locator::Error),

#[error(transparent)]
Network(#[from] network::Error),

#[error("no contract found with alias `{alias}`")]
NoContract { alias: String },
}

impl Cmd {
#[allow(clippy::unused_async)]
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
let print = Print::new(global_args.quiet);
let alias = &self.alias;
let network = self.network.get(&self.config_locator)?;
let network_passphrase = &network.network_passphrase;

let Some(contract) = self
.config_locator
.get_contract_id(&self.alias, network_passphrase)?
else {
return Err(Error::NoContract {
alias: alias.into(),
});
};

print.infoln(format!(
"Contract alias '{alias}' references {contract} on network '{network_passphrase}'"
));

self.config_locator
.remove_contract_id(&network.network_passphrase, alias)?;

print.checkln(format!("Contract alias '{alias}' has been removed"));

Ok(())
}
}
10 changes: 10 additions & 0 deletions cmd/soroban-cli/src/commands/contract/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod alias;
pub mod asset;
pub mod bindings;
pub mod build;
Expand All @@ -21,6 +22,11 @@ pub enum Cmd {
/// Utilities to deploy a Stellar Asset Contract or get its id
#[command(subcommand)]
Asset(asset::Cmd),

/// Utilities to manage contract aliases
#[command(subcommand)]
Alias(alias::Cmd),

/// Generate code client bindings for a contract
#[command(subcommand)]
Bindings(bindings::Cmd),
Expand Down Expand Up @@ -82,6 +88,9 @@ pub enum Error {
#[error(transparent)]
Asset(#[from] asset::Error),

#[error(transparent)]
Alias(#[from] alias::Error),

#[error(transparent)]
Bindings(#[from] bindings::Error),

Expand Down Expand Up @@ -132,6 +141,7 @@ impl Cmd {
Cmd::Bindings(bindings) => bindings.run().await?,
Cmd::Build(build) => build.run()?,
Cmd::Extend(extend) => extend.run().await?,
Cmd::Alias(alias) => alias.run(global_args).await?,
Cmd::Deploy(deploy) => deploy.run(global_args).await?,
Cmd::Id(id) => id.run()?,
Cmd::Info(info) => info.run().await?,
Expand Down
Loading

0 comments on commit dcb7f86

Please sign in to comment.