Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into apterygote-wickedish
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Jul 23, 2024
2 parents 439d411 + 31cdfdd commit d213609
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 31 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ Initialize a Soroban project with an example contract
* `-f`, `--frontend-template <FRONTEND_TEMPLATE>` — An optional flag to pass in a url for a frontend template repository.

Default value: ``
* `-o`, `--overwrite` — Overwrite all existing files.



Expand Down Expand Up @@ -1006,6 +1007,7 @@ Sign, Simulate, and Send transactions
###### **Subcommands:**

* `simulate` — Simulate a transaction envelope from stdin
* `hash` — Calculate the hash of a transaction envelope from stdin



Expand All @@ -1027,6 +1029,20 @@ Simulate a transaction envelope from stdin



## `stellar tx hash`

Calculate the hash of a transaction envelope from stdin

**Usage:** `stellar tx hash [OPTIONS]`

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

* `--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 xdr`

Decode and encode XDR
Expand Down
19 changes: 19 additions & 0 deletions cmd/crates/soroban-test/tests/it/integration/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ async fn txn_simulate() {
assembled_str
);
}

#[tokio::test]
async fn txn_hash() {
let sandbox = &TestEnv::new();

let xdr_base64 = "AAAAAgAAAACVk/0xt9tV/cUbF53iwQ3tkKLlq9zG2wV5qd9lRjZjlQAHt/sAFsKTAAAABAAAAAEAAAAAAAAAAAAAAABmOg6nAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABfcHs35M1GZ/JkY2+DHMs4dEUaqjynMnDYK/Gp0eulN8AAAAIdHJhb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GAAAAAX3B7N+TNRmfyZGNvgxzLOHRFGqo8pzJw2CvxqdHrpTfAAAAEAAAAAEAAAACAAAADwAAAAdCYWxhbmNlAAAAABIAAAABBTtRUdloOPUBWOSjzhQENG1eXzfuyw9hkkLzmh0h+OEAAAABAAAAAAAAAACVk/0xt9tV/cUbF53iwQ3tkKLlq9zG2wV5qd9lRjZjlQAAAAYAAAABBTtRUdloOPUBWOSjzhQENG1eXzfuyw9hkkLzmh0h+OEAAAAVAAABj1LItJUAAAAAAEyTowAAGMgAAAG4AAAAAAADJBsAAAABRjZjlQAAAEASFnAIzNqpfdzv6yT0rSLMUDFgt7a/inCHurNCG55Jp8Imho04qRH+JNdkq0BgMC7yAJqH4N6Y2iGflFt3Lp4L";

let expected_hash = "bcc9fa60c8f6607c981d6e1c65d77ae07617720113f9080fe5883d8e4a331a68";

let hash = sandbox
.new_assert_cmd("tx")
.arg("hash")
.write_stdin(xdr_base64.as_bytes())
.assert()
.success()
.stdout_as_str();

assert_eq!(hash.trim(), expected_hash);
}
1 change: 1 addition & 0 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ ureq = { version = "2.9.1", features = ["json"] }
assert_cmd = "2.0.4"
assert_fs = "1.0.7"
predicates = "2.1.5"
walkdir = "2.5.0"
Loading

0 comments on commit d213609

Please sign in to comment.