Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcli: display ics20 withdrawals in pcli v tx #3099

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions crates/bin/pcli/src/command/view/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,19 @@ impl TxCmd {
"Claim Liquidity Position Reward".to_string(),
"".to_string(),
],
penumbra_transaction::ActionView::Ics20Withdrawal(_) => {
["Ics20 Withdrawal".to_string(), "".to_string()]
penumbra_transaction::ActionView::Ics20Withdrawal(w) => {
let unit = w.denom.best_unit_for(w.amount);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question: the Ics20Withdrawal domain type has an asset::DenomMetadata, but the ICS20 packet only has a string denom, correct? How does the domain type get the asset metadata? @aubrika

[
"Ics20 Withdrawal".to_string(),
// TODO: why doesn't format_value include the unit?
format!(
"{}{} via {} to {}",
unit.format_value(w.amount),
unit,
w.source_channel,
w.destination_chain_address,
),
]
}
penumbra_transaction::ActionView::DaoDeposit(_) => {
["Dao Deposit".to_string(), "".to_string()]
Expand Down
1 change: 1 addition & 0 deletions crates/core/component/ibc/src/ics20_withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub struct Ics20Withdrawal {
// the source channel used for the withdrawal
pub source_channel: ChannelId,
}

impl Ics20Withdrawal {
pub fn value(&self) -> Value {
Value {
Expand Down