Skip to content

Commit

Permalink
show-tx: include fees and signer count
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jul 25, 2024
1 parent d3b7bc3 commit e638976
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions packages/cosmos-bin/src/chain.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
use std::path::PathBuf;

use anyhow::Result;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use cosmos::{
proto::{cosmos::base::abci::v1beta1::TxResponse, traits::Message},
proto::{
cosmos::{
base::abci::v1beta1::TxResponse,
tx::v1beta1::{AuthInfo, Tx},
},
traits::Message,
},
Address, BlockInfo, Cosmos, TxResponseExt,
};

Expand Down Expand Up @@ -158,6 +164,28 @@ pub(crate) async fn go(Opt { sub }: Opt, opt: crate::cli::Opt) -> Result<()> {
println!("Gas wanted: {gas_wanted}");
println!("Gas used: {gas_used}");
println!("Timestamp: {timestamp}");
let tx = tx.context("Missing tx field")?;
println!("Encoded length: {}", tx.encoded_len());
let Tx {
body: _,
auth_info,
signatures: _,
} = Tx::decode(&*tx.value)?;
let AuthInfo {
signer_infos,
fee,
tip: _,
} = auth_info.context("Missing auth_info field")?;
let fee = fee.context("Missing fee field")?;
print!("Fee: ");
for (idx, coin) in fee.amount.iter().enumerate() {
if idx != 0 {
print!(", ");
}
print!("{}{}", coin.amount, coin.denom);
}
println!();
println!("Signer count: {}", signer_infos.len());
if complete {
println!("Data: {data}");
for (idx, log) in logs.into_iter().enumerate() {
Expand All @@ -167,9 +195,6 @@ pub(crate) async fn go(Opt { sub }: Opt, opt: crate::cli::Opt) -> Result<()> {
println!("Event #{idx}: {event:?}");
}
}
if let Some(tx) = tx {
println!("Encoded length: {}", tx.encoded_len());
}
}
Subcommand::ListTxsFor {
address,
Expand Down

0 comments on commit e638976

Please sign in to comment.