Skip to content

Commit

Permalink
Add tx hash at the top of the send command
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMD committed Nov 20, 2024
1 parent b37da02 commit 5f0f9bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions cmd/soroban-cli/src/commands/tx/send.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_trait::async_trait;
use soroban_rpc::GetTransactionResponse;
use crate::utils::transaction_hash;

use crate::{
commands::{global, NetworkRunnable},
Expand Down Expand Up @@ -56,6 +57,16 @@ impl NetworkRunnable for Cmd {
};
let client = network.rpc_client()?;
let tx_env = super::xdr::tx_envelope_from_stdin()?;
match super::xdr::unwrap_envelope_v1(tx_env.clone()).map(|tx| transaction_hash(&tx, &network.network_passphrase)) {
Ok(Ok(hash)) => {
println!(
"Transaction Hash: {}",
hex::encode(hash)
);
}
_ => {
}
}
Ok(client.send_transaction_polling(&tx_env).await?)
}
}
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
};

cargoLock.outputHashes = {
# The only git+https dependency in Cargo.lock
"stellar-rpc-client-21.4.0" = "sha256-ue7Ynux9YaDP3f/XkHz2OPd2g0iCX5R0yS5SaVHEYxQ";
# This is needed for any git+https dependency in Cargo.lock
# "somepackage-1.2.3" = "sha256-somehash";
};

doCheck = false;
Expand Down

0 comments on commit 5f0f9bc

Please sign in to comment.