diff --git a/cmd/soroban-cli/src/commands/mod.rs b/cmd/soroban-cli/src/commands/mod.rs index 1f4a5daae..4aaa3e645 100644 --- a/cmd/soroban-cli/src/commands/mod.rs +++ b/cmd/soroban-cli/src/commands/mod.rs @@ -96,6 +96,7 @@ 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?, @@ -128,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), @@ -147,6 +150,8 @@ pub enum Error { #[error(transparent)] Lab(#[from] lab::Error), #[error(transparent)] + Xdr(#[from] stellar_xdr::cli::Error), + #[error(transparent)] Clap(#[from] clap::error::Error), #[error(transparent)] Plugin(#[from] plugin::Error), diff --git a/docs/soroban-cli-full-docs.md b/docs/soroban-cli-full-docs.md index 77a2ab8e1..5b9f8002d 100644 --- a/docs/soroban-cli-full-docs.md +++ b/docs/soroban-cli-full-docs.md @@ -45,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) @@ -89,6 +96,7 @@ Full CLI reference: https://github.com/stellar/soroban-tools/tree/main/docs/soro * `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 @@ -1132,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