Skip to content

Commit edaabb1

Browse files
committed
client: display cometBFT tx hash
1 parent 8d7bd19 commit edaabb1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

crates/sdk/src/rpc.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use namada_proof_of_stake::types::{
5959
use namada_state::{BlockHeader, LastBlock};
6060
use namada_token::masp::MaspTokenRewardData;
6161
use namada_tx::data::{BatchedTxResult, DryRunResult, ResultCode, TxResult};
62-
use namada_tx::event::{Batch as BatchAttr, Code as CodeAttr};
62+
use namada_tx::event::{Batch as BatchAttr, Code as CodeAttr, CometTxHash};
6363
use serde::{Deserialize, Serialize};
6464

6565
use crate::args::{InputAmount, OsmosisPoolHop, Slippage};
@@ -703,6 +703,8 @@ pub struct TxResponse {
703703
pub code: ResultCode,
704704
/// Gas used.
705705
pub gas_used: WholeGas,
706+
/// CometBFT matching tx hash
707+
pub comet_tx_hash: Hash,
706708
}
707709

708710
/// Determines a result of an inner tx from
@@ -744,6 +746,9 @@ impl TryFrom<TxAppliedEvents> for TxResponse {
744746
let gas_used = applied_event
745747
.read_attribute::<GasUsedAttr>()
746748
.map_err(|err| err.to_string())?;
749+
let comet_tx_hash = applied_event
750+
.read_attribute::<CometTxHash>()
751+
.map_err(|err| err.to_string())?;
747752

748753
// Reconstruct the inner txs' events
749754
if let Some(batch) = &mut batch {
@@ -773,6 +778,7 @@ impl TryFrom<TxAppliedEvents> for TxResponse {
773778
height,
774779
code,
775780
gas_used,
781+
comet_tx_hash,
776782
})
777783
}
778784
}

crates/sdk/src/tx.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,8 @@ pub fn display_batch_resp(context: &impl Namada, resp: &TxResponse) {
607607
);
608608
}
609609

610+
display_line!(context.io(), "CometBFT tx hash: {}", resp.comet_tx_hash);
611+
610612
tracing::debug!(
611613
"Full result: {}",
612614
serde_json::to_string_pretty(&resp).unwrap()

0 commit comments

Comments
 (0)