Skip to content

Commit

Permalink
Fix examples in docs (#201)
Browse files Browse the repository at this point in the history
* Add stellar-xdr bin

* Expose all versions of xdr

* Update CLI to use multiple channels

* fmt

* Use makefile in tests

* simplify build

* undo

* fix version

* update readme

* fix docs

* fix

* fix docs

* fix doc

* simplify example

* fix

* fix
  • Loading branch information
leighmcculloch authored Nov 30, 2022
1 parent 3283038 commit 7532610
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and is receiving breaking changes frequently.**
To use the library, include in your toml:

```toml
stellar-xdr = { version = "...", default-features = true, features = [...] }
stellar-xdr = { version = "...", default-features = true, features = [] }
```

##### Features
Expand Down Expand Up @@ -66,24 +66,28 @@ the root of the crate.

To use the CLI:

```toml
```console
cargo install --locked stellar-xdr --version ... --features cli
```

##### Examples

Parse a `TransactionEnvelope`:
```rust
echo -n 'AAAAA...' | stellar-xdr decode --type TransactionEnvelope
```console
stellar-xdr decode --type TransactionEnvelope << -
AAAAA...
-
```

Parse a `ScSpecEntry` stream from a contract:
```rust
echo -n 'AAAAA...' | stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted
```console
stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted << -
AAAAA...
-
```

Parse a `BucketEntry` framed stream from a bucket file:
```rust
```console
stellar-xdr decode --type BucketEntry --input stream-framed --output json-formatted bucket.xdr
```

Expand Down
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! To use the library, include in your toml:
//!
//! ```toml
//! stellar-xdr = { version = "...", default-features = true, features = [...] }
//! stellar-xdr = { version = "...", default-features = true, features = [] }
//! ```
//!
//! #### Features
Expand Down Expand Up @@ -68,20 +68,24 @@
//!
//! To use the CLI:
//!
//! ```toml
//! ```console
//! cargo install --locked stellar-xdr --version ... --features cli
//! ```
//!
//! #### Examples
//!
//! Parse a `TransactionEnvelope`:
//! ```console
//! echo -n 'AAAAA...' | stellar-xdr decode --type TransactionEnvelope
//! stellar-xdr decode --type TransactionEnvelope << -
//! AAAAA...
//! -
//! ```
//!
//! Parse a `ScSpecEntry` stream from a contract:
//! ```console
//! echo -n 'AAAAA...' | stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted
//! stellar-xdr +next decode --type ScSpecEntry --input stream-base64 --output json-formatted << -
//! AAAAA...
//! -
//! ```
//!
//! Parse a `BucketEntry` framed stream from a bucket file:
Expand Down

0 comments on commit 7532610

Please sign in to comment.