From 954f7f28f7f59e55d638ff2344917eb113e21b12 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 20 Sep 2024 18:36:41 +0200 Subject: [PATCH] cli: fix displaying fungible amount with history command --- cli/src/command.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cli/src/command.rs b/cli/src/command.rs index 8a4f1b3..a2dea3e 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -47,7 +47,7 @@ use rgb::{ RgbDescr, RgbKeychain, RgbWallet, StateType, TransferParams, WalletError, WalletProvider, XChain, XOutpoint, XWitnessId, }; -use rgbstd::interface::ContractIface; +use rgbstd::interface::{AllocatedState, ContractIface}; use rgbstd::persistence::{MemContractState, StockError}; use rgbstd::{KnownState, OutputAssignment}; use seals::SecretSeal; @@ -379,7 +379,12 @@ impl Exec for RgbArgs { witness, } in history { - print!("{direction}\t{state}"); + print!("{direction: <9}\t"); + if let AllocatedState::Amount(amount) = state { + print!("{: >9}", amount.value()); + } else { + print!("{state}"); + } if *details { print!("\t{ty}"); } @@ -392,7 +397,7 @@ impl Exec for RgbArgs { ); if *details { println!( - "{}", + "\t{}", opids .iter() .map(OpId::to_string)