Skip to content

Commit

Permalink
Merge branch 'main' into fix/extra_print
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal authored Aug 29, 2024
2 parents 9aa2422 + 34e8a5d commit 20402d9
Show file tree
Hide file tree
Showing 25 changed files with 688 additions and 298 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
77 changes: 77 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,82 @@ Deploy builtin Soroban Asset Contract



## `stellar contract alias`

Utilities to manage contract aliases

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

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

* `remove` — Remove contract alias
* `add` — Add contract alias
* `show` — Show the contract id associated with a given 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 alias add`

Add contract alias

**Usage:** `stellar contract alias add [OPTIONS] --id <CONTRACT_ID> <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
* `--overwrite` — Overwrite the contract alias if it already exists
* `--id <CONTRACT_ID>` — The contract id that will be associated with the alias



## `stellar contract alias show`

Show the contract id associated with a given alias

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

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

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

###### **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
12 changes: 8 additions & 4 deletions cmd/crates/soroban-test/tests/it/help.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use soroban_cli::commands::contract;
use soroban_cli::commands::contract::{self, arg_parsing};
use soroban_test::TestEnv;

use crate::util::{invoke_custom as invoke, CUSTOM_TYPES, DEFAULT_CONTRACT_ID};
Expand Down Expand Up @@ -55,7 +55,7 @@ async fn complex_enum_help() {
async fn multi_arg_failure() {
assert!(matches!(
invoke_custom("multi_args", "--b").await.unwrap_err(),
contract::invoke::Error::MissingArgument(_)
contract::invoke::Error::ArgParsing(arg_parsing::Error::MissingArgument(_))
));
}

Expand All @@ -64,7 +64,9 @@ async fn handle_arg_larger_than_i32_failure() {
let res = invoke_custom("i32_", &format!("--i32_={}", u32::MAX)).await;
assert!(matches!(
res,
Err(contract::invoke::Error::CannotParseArg { .. })
Err(contract::invoke::Error::ArgParsing(
arg_parsing::Error::CannotParseArg { .. }
))
));
}

Expand All @@ -73,7 +75,9 @@ async fn handle_arg_larger_than_i64_failure() {
let res = invoke_custom("i64_", &format!("--i64_={}", u64::MAX)).await;
assert!(matches!(
res,
Err(contract::invoke::Error::CannotParseArg { .. })
Err(contract::invoke::Error::ArgParsing(
arg_parsing::Error::CannotParseArg { .. }
))
));
}

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
40 changes: 40 additions & 0 deletions cmd/soroban-cli/src/commands/contract/alias.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use crate::commands::global;

pub mod add;
pub mod remove;
pub mod show;

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

/// Add contract alias
Add(add::Cmd),

/// Show the contract id associated with a given alias
Show(show::Cmd),
}

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

#[error(transparent)]
Add(#[from] add::Error),

#[error(transparent)]
Show(#[from] show::Error),
}

impl Cmd {
pub fn run(&self, global_args: &global::Args) -> Result<(), Error> {
match &self {
Cmd::Remove(remove) => remove.run(global_args)?,
Cmd::Add(add) => add.run(global_args)?,
Cmd::Show(show) => show.run(global_args)?,
}
Ok(())
}
}
Loading

0 comments on commit 20402d9

Please sign in to comment.