Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xdr command to root #1307

Merged
merged 7 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/soroban-cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down
154 changes: 154 additions & 0 deletions docs/soroban-cli-full-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -1132,6 +1140,152 @@ Print version information



## `soroban xdr`

Decode and encode XDR

**Usage:** `soroban xdr [CHANNEL] <COMMAND>`

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

* `types` — View information about types
* `guess` — Guess the XDR type
* `decode` — Decode XDR
* `encode` — Encode XDR
* `version` — Print version information

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

* `<CHANNEL>` — Channel of XDR to operate on

Default value: `+curr`

Possible values: `+curr`, `+next`




## `soroban xdr types`

View information about types

**Usage:** `soroban xdr types <COMMAND>`

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

* `list` —



## `soroban xdr types list`

**Usage:** `soroban xdr types list [OPTIONS]`

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

* `--output <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>` — File to decode, or stdin if omitted

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

* `--input <INPUT>`

Default value: `single-base64`

Possible values: `single`, `single-base64`, `stream`, `stream-base64`, `stream-framed`

* `--output <OUTPUT>`

Default value: `list`

Possible values: `list`

* `--certainty <CERTAINTY>` — Certainty as an arbitrary value

Default value: `2`



## `soroban xdr decode`

Decode XDR

**Usage:** `soroban xdr decode [OPTIONS] --type <TYPE> [FILES]...`

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

* `<FILES>` — Files to decode, or stdin if omitted

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

* `--type <TYPE>` — XDR type to decode
* `--input <INPUT>`

Default value: `stream-base64`

Possible values: `single`, `single-base64`, `stream`, `stream-base64`, `stream-framed`

* `--output <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 <TYPE> [FILES]...`

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

* `<FILES>` — Files to encode, or stdin if omitted

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

* `--type <TYPE>` — XDR type to encode
* `--input <INPUT>`

Default value: `json`

Possible values: `json`

* `--output <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
Expand Down
Loading