Skip to content

Commit d8f151c

Browse files
authored
Summation of selected utxo value (#623)
Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
1 parent 4d66f7a commit d8f151c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/utill.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -927,17 +927,24 @@ pub fn interactive_select(
927927
selected: &[bool],
928928
scroll_offset: usize|
929929
-> Result<(), WalletError> {
930+
let selected_total = choices
931+
.iter()
932+
.zip(selected)
933+
.filter(|(_, sel)| **sel)
934+
.map(|((selected_choice, _), _)| selected_choice.amount.to_btc())
935+
.collect::<Vec<_>>();
930936
if max_scroll > 0 {
931937
queue!(
932938
stdout,
933939
MoveTo(0, 2),
934940
Print(format!(
935-
"\x1b[90mScrolling: {} / {} (showing rows {}-{})\x1b[0m",
936-
scroll_offset + 1,
937-
max_scroll + 1,
938-
scroll_offset + 1,
939-
(scroll_offset + visible_rows).min(total_rows)
940-
))
941+
"\x1b[90mScrolling: {} / {} (showing rows {}-{})\x1b[0m Total Selected (In BTC) : {:.8}",
942+
scroll_offset + 1,
943+
max_scroll + 1,
944+
scroll_offset + 1,
945+
(scroll_offset + visible_rows).min(total_rows),
946+
selected_total.iter().sum::<f64>()
947+
))
941948
)?;
942949
}
943950
// Clear only the grid area, not the entire screen

0 commit comments

Comments
 (0)