diff --git a/cmd/soroban-cli/src/commands/config/mod.rs b/cmd/soroban-cli/src/commands/config/mod.rs index 3c5f4cca4..efe99f0d8 100644 --- a/cmd/soroban-cli/src/commands/config/mod.rs +++ b/cmd/soroban-cli/src/commands/config/mod.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use clap::{arg, command, Parser}; +use clap::{arg, command}; use serde::{Deserialize, Serialize}; use crate::Pwd; @@ -12,16 +12,6 @@ use super::{keys, network}; pub mod locator; pub mod secret; -#[derive(Debug, Parser)] -pub enum Cmd { - /// Configure different networks. Depraecated, use `soroban network` instead. - #[command(subcommand)] - Network(network::Cmd), - /// Identity management. Deprecated, use `soroban keys` instead. - #[command(subcommand)] - Identity(keys::Cmd), -} - #[derive(thiserror::Error, Debug)] pub enum Error { #[error(transparent)] @@ -34,16 +24,6 @@ pub enum Error { Config(#[from] locator::Error), } -impl Cmd { - pub async fn run(&self) -> Result<(), Error> { - match &self { - Cmd::Identity(identity) => identity.run().await?, - Cmd::Network(network) => network.run().await?, - } - Ok(()) - } -} - #[derive(Debug, clap::Args, Clone, Default)] #[group(skip)] pub struct Args { diff --git a/cmd/soroban-cli/src/commands/mod.rs b/cmd/soroban-cli/src/commands/mod.rs index ab673a411..4aaa3e645 100644 --- a/cmd/soroban-cli/src/commands/mod.rs +++ b/cmd/soroban-cli/src/commands/mod.rs @@ -96,10 +96,10 @@ impl Root { Cmd::Contract(contract) => contract.run(&self.global_args).await?, Cmd::Events(events) => events.run().await?, Cmd::Lab(lab) => lab.run()?, + Cmd::Xdr(xdr) => xdr.run()?, Cmd::Network(network) => network.run().await?, Cmd::Version(version) => version.run(), Cmd::Keys(id) => id.run().await?, - Cmd::Config(c) => c.run().await?, }; Ok(()) } @@ -118,9 +118,6 @@ pub enum Cmd { /// Print shell completion code for the specified shell. #[command(long_about = completion::LONG_ABOUT)] Completion(completion::Cmd), - /// Deprecated, use `soroban keys` and `soroban network` instead - #[command(subcommand)] - Config(config::Cmd), /// Tools for smart contract developers #[command(subcommand)] Contract(contract::Cmd), @@ -132,6 +129,8 @@ pub enum Cmd { /// Experiment with early features and expert tools #[command(subcommand)] Lab(lab::Cmd), + /// Decode and encode XDR + Xdr(stellar_xdr::cli::Root), /// Start and configure networks #[command(subcommand)] Network(network::Cmd), @@ -151,7 +150,7 @@ pub enum Error { #[error(transparent)] Lab(#[from] lab::Error), #[error(transparent)] - Config(#[from] config::Error), + Xdr(#[from] stellar_xdr::cli::Error), #[error(transparent)] Clap(#[from] clap::error::Error), #[error(transparent)] diff --git a/docs/soroban-cli-full-docs.md b/docs/soroban-cli-full-docs.md index 4bdcfc5a3..5b9f8002d 100644 --- a/docs/soroban-cli-full-docs.md +++ b/docs/soroban-cli-full-docs.md @@ -6,21 +6,6 @@ This document contains the help content for the `soroban` command-line program. * [`soroban`↴](#soroban) * [`soroban completion`↴](#soroban-completion) -* [`soroban config`↴](#soroban-config) -* [`soroban config network`↴](#soroban-config-network) -* [`soroban config network add`↴](#soroban-config-network-add) -* [`soroban config network rm`↴](#soroban-config-network-rm) -* [`soroban config network ls`↴](#soroban-config-network-ls) -* [`soroban config network start`↴](#soroban-config-network-start) -* [`soroban config network stop`↴](#soroban-config-network-stop) -* [`soroban config identity`↴](#soroban-config-identity) -* [`soroban config identity add`↴](#soroban-config-identity-add) -* [`soroban config identity address`↴](#soroban-config-identity-address) -* [`soroban config identity fund`↴](#soroban-config-identity-fund) -* [`soroban config identity generate`↴](#soroban-config-identity-generate) -* [`soroban config identity ls`↴](#soroban-config-identity-ls) -* [`soroban config identity rm`↴](#soroban-config-identity-rm) -* [`soroban config identity show`↴](#soroban-config-identity-show) * [`soroban contract`↴](#soroban-contract) * [`soroban contract asset`↴](#soroban-contract-asset) * [`soroban contract asset id`↴](#soroban-contract-asset-id) @@ -60,6 +45,13 @@ This document contains the help content for the `soroban` command-line program. * [`soroban lab xdr decode`↴](#soroban-lab-xdr-decode) * [`soroban lab xdr encode`↴](#soroban-lab-xdr-encode) * [`soroban lab xdr version`↴](#soroban-lab-xdr-version) +* [`soroban xdr`↴](#soroban-xdr) +* [`soroban xdr types`↴](#soroban-xdr-types) +* [`soroban xdr types list`↴](#soroban-xdr-types-list) +* [`soroban xdr guess`↴](#soroban-xdr-guess) +* [`soroban xdr decode`↴](#soroban-xdr-decode) +* [`soroban xdr encode`↴](#soroban-xdr-encode) +* [`soroban xdr version`↴](#soroban-xdr-version) * [`soroban network`↴](#soroban-network) * [`soroban network add`↴](#soroban-network-add) * [`soroban network rm`↴](#soroban-network-rm) @@ -100,11 +92,11 @@ Full CLI reference: https://github.com/stellar/soroban-tools/tree/main/docs/soro ###### **Subcommands:** * `completion` — Print shell completion code for the specified shell -* `config` — Deprecated, use `soroban keys` and `soroban network` instead * `contract` — Tools for smart contract developers * `events` — Watch the network for contract events * `keys` — Create and manage identities including keys and addresses * `lab` — Experiment with early features and expert tools +* `xdr` — Decode and encode XDR * `network` — Start and configure networks * `version` — Print version information @@ -159,336 +151,6 @@ To enable autocomplete permanently, run: -## `soroban config` - -Deprecated, use `soroban keys` and `soroban network` instead - -**Usage:** `soroban config ` - -###### **Subcommands:** - -* `network` — Configure different networks. Depraecated, use `soroban network` instead -* `identity` — Identity management. Deprecated, use `soroban keys` instead - - - -## `soroban config network` - -Configure different networks. Depraecated, use `soroban network` instead - -**Usage:** `soroban config network ` - -###### **Subcommands:** - -* `add` — Add a new network -* `rm` — Remove a network -* `ls` — List networks -* `start` — Start network -* `stop` — Stop a network started with `network start`. For example, if you ran `soroban network start local`, you can use `soroban network stop local` to stop it - - - -## `soroban config network add` - -Add a new network - -**Usage:** `soroban config network add [OPTIONS] --rpc-url --network-passphrase ` - -###### **Arguments:** - -* `` — Name of network - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." - - - -## `soroban config network rm` - -Remove a network - -**Usage:** `soroban config network rm [OPTIONS] ` - -###### **Arguments:** - -* `` — Network to remove - -###### **Options:** - -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." - - - -## `soroban config network ls` - -List networks - -**Usage:** `soroban config network ls [OPTIONS]` - -###### **Options:** - -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." -* `-l`, `--long` — Get more info about the networks - - Possible values: `true`, `false` - - - - -## `soroban config network start` - -Start network - -Start a container running a Stellar node, RPC, API, and friendbot (faucet). - -soroban network start [OPTIONS] - -By default, when starting a testnet container, without any optional arguments, it will run the equivalent of the following docker command: docker run --rm -p 8000:8000 --name stellar stellar/quickstart:testing --testnet --enable-soroban-rpc - -**Usage:** `soroban config network start [OPTIONS] ` - -###### **Arguments:** - -* `` — Network to start - - Possible values: `local`, `testnet`, `futurenet`, `pubnet` - - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock -* `-l`, `--limits ` — Optional argument to specify the limits for the local network only -* `-p`, `--ports-mapping ` — Argument to specify the HOST_PORT:CONTAINER_PORT mapping - - Default value: `8000:8000` -* `-t`, `--image-tag-override ` — Optional argument to override the default docker image tag for the given network -* `-v`, `--protocol-version ` — Optional argument to specify the protocol version for the local network only - - - -## `soroban config network stop` - -Stop a network started with `network start`. For example, if you ran `soroban network start local`, you can use `soroban network stop local` to stop it - -**Usage:** `soroban config network stop [OPTIONS] ` - -###### **Arguments:** - -* `` — Network to stop - - Possible values: `local`, `testnet`, `futurenet`, `pubnet` - - -###### **Options:** - -* `-d`, `--docker-host ` — Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock - - - -## `soroban config identity` - -Identity management. Deprecated, use `soroban keys` instead - -**Usage:** `soroban config identity ` - -###### **Subcommands:** - -* `add` — Add a new identity (keypair, ledger, macOS keychain) -* `address` — 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 -* `rm` — Remove an identity -* `show` — Given an identity return its private key - - - -## `soroban config identity add` - -Add a new identity (keypair, ledger, macOS keychain) - -**Usage:** `soroban config identity add [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity - -###### **Options:** - -* `--secret-key` — Add using secret_key Can provide with SOROBAN_SECRET_KEY - - Possible values: `true`, `false` - -* `--seed-phrase` — Add using 12 word seed phrase to generate secret_key - - Possible values: `true`, `false` - -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." - - - -## `soroban config identity address` - -Given an identity return its address (public key) - -**Usage:** `soroban config identity address [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity to lookup, default test identity used if not provided - -###### **Options:** - -* `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." - - - -## `soroban config identity fund` - -Fund an identity on a test network - -**Usage:** `soroban config identity fund [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity to lookup, default test identity used if not provided - -###### **Options:** - -* `--rpc-url ` — RPC server endpoint -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `--network ` — Name of network to use from config -* `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." - - - -## `soroban config identity generate` - -Generate a new identity with a seed phrase, currently 12 words - -**Usage:** `soroban config identity generate [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity - -###### **Options:** - -* `--no-fund` — Do not fund address - - Possible values: `true`, `false` - -* `--seed ` — Optional seed to use when generating seed phrase. Random otherwise -* `-s`, `--as-secret` — Output the generated identity as a secret key - - Possible values: `true`, `false` - -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." -* `--hd-path ` — When generating a secret key, which hd_path should be used from the original seed_phrase -* `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000 - - Possible values: `true`, `false` - -* `--rpc-url ` — RPC server endpoint -* `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server -* `--network ` — Name of network to use from config - - - -## `soroban config identity ls` - -List identities - -**Usage:** `soroban config identity ls [OPTIONS]` - -###### **Options:** - -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." -* `-l`, `--long` - - Possible values: `true`, `false` - - - - -## `soroban config identity rm` - -Remove an identity - -**Usage:** `soroban config identity rm [OPTIONS] ` - -###### **Arguments:** - -* `` — Identity to remove - -###### **Options:** - -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." - - - -## `soroban config identity show` - -Given an identity return its private key - -**Usage:** `soroban config identity show [OPTIONS] ` - -###### **Arguments:** - -* `` — Name of identity to lookup, default is test identity - -###### **Options:** - -* `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 -* `--global` — Use global config - - Possible values: `true`, `false` - -* `--config-dir ` — Location of config directory, default is "." - - - ## `soroban contract` Tools for smart contract developers @@ -1478,6 +1140,152 @@ Print version information +## `soroban xdr` + +Decode and encode XDR + +**Usage:** `soroban xdr [CHANNEL] ` + +###### **Subcommands:** + +* `types` — View information about types +* `guess` — Guess the XDR type +* `decode` — Decode XDR +* `encode` — Encode XDR +* `version` — Print version information + +###### **Arguments:** + +* `` — Channel of XDR to operate on + + Default value: `+curr` + + Possible values: `+curr`, `+next` + + + + +## `soroban xdr types` + +View information about types + +**Usage:** `soroban xdr types ` + +###### **Subcommands:** + +* `list` — + + + +## `soroban xdr types list` + +**Usage:** `soroban xdr types list [OPTIONS]` + +###### **Options:** + +* `--output ` + + Default value: `plain` + + Possible values: `plain`, `json`, `json-formatted` + + + + +## `soroban xdr guess` + +Guess the XDR type + +**Usage:** `soroban xdr guess [OPTIONS] [FILE]` + +###### **Arguments:** + +* `` — File to decode, or stdin if omitted + +###### **Options:** + +* `--input ` + + Default value: `single-base64` + + Possible values: `single`, `single-base64`, `stream`, `stream-base64`, `stream-framed` + +* `--output ` + + Default value: `list` + + Possible values: `list` + +* `--certainty ` — Certainty as an arbitrary value + + Default value: `2` + + + +## `soroban xdr decode` + +Decode XDR + +**Usage:** `soroban xdr decode [OPTIONS] --type [FILES]...` + +###### **Arguments:** + +* `` — Files to decode, or stdin if omitted + +###### **Options:** + +* `--type ` — XDR type to decode +* `--input ` + + Default value: `stream-base64` + + Possible values: `single`, `single-base64`, `stream`, `stream-base64`, `stream-framed` + +* `--output ` + + Default value: `json` + + Possible values: `json`, `json-formatted`, `rust-debug`, `rust-debug-formatted` + + + + +## `soroban xdr encode` + +Encode XDR + +**Usage:** `soroban xdr encode [OPTIONS] --type [FILES]...` + +###### **Arguments:** + +* `` — Files to encode, or stdin if omitted + +###### **Options:** + +* `--type ` — XDR type to encode +* `--input ` + + Default value: `json` + + Possible values: `json` + +* `--output ` + + Default value: `single-base64` + + Possible values: `single`, `single-base64` + + + + +## `soroban xdr version` + +Print version information + +**Usage:** `soroban xdr version` + + + ## `soroban network` Start and configure networks