Skip to content

Commit

Permalink
pcli: show sender and memo in list-tx-hashes
Browse files Browse the repository at this point in the history
In the future, once the MemoView has an AddressView, we can change this to show
the AddressView and show the address structure.

(cherry picked from commit a041ea4)
  • Loading branch information
hdevalence authored and conorsch committed Nov 16, 2023
1 parent 7f89bf4 commit 2b066b0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion crates/bin/pcli/src/command/view/transaction_hashes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::Result;
use comfy_table::{presets, Table};
use penumbra_keys::FullViewingKey;
use penumbra_transaction::MemoView;
use penumbra_view::ViewClient;

#[derive(Debug, clap::Args)]
Expand All @@ -26,12 +27,20 @@ impl TransactionHashesCmd {
.transaction_info(self.start_height, self.end_height)
.await?;

table.set_header(vec!["Block Height", "Transaction Hash"]);
table.set_header(vec!["Height", "Transaction Hash", "Sender", "Memo"]);

for tx_info in txs {
let (sender, memo) = match tx_info.view.body_view.memo_view {
Some(MemoView::Visible { plaintext, .. }) => {
(plaintext.sender.display_short_form(), plaintext.text)
}
_ => (String::new(), String::new()),
};
table.add_row(vec![
format!("{}", tx_info.height),
format!("{}", hex::encode(tx_info.id)),
format!("{}", sender),
format!("{}", memo),
]);
}

Expand Down

0 comments on commit 2b066b0

Please sign in to comment.