gui(send): display max calculated amount w/ 8 decimals

This commit is contained in:
pythcoiner 2024-11-04 08:26:08 +01:00
parent 327f0ea665
commit 7ab6d05f0b
2 changed files with 9 additions and 9 deletions

View File

@ -8,7 +8,7 @@ use iced::{
use liana::{
descriptors::LianaPolicy,
miniscript::bitcoin::{bip32::Fingerprint, Amount, Network},
miniscript::bitcoin::{bip32::Fingerprint, Amount, Denomination, Network},
};
use liana_ui::{
@ -379,14 +379,14 @@ pub fn recipient_view<'a>(
.width(Length::Fixed(110.0)),
)
.push_maybe(if is_max_selected {
let amount_txt = Amount::from_str_in(&amount.value, Denomination::Bitcoin)
.ok()
.map(amount_as_string)
.unwrap_or(amount.value.clone());
Some(
Container::new(
text(amount.value.clone())
.size(P1_SIZE)
.style(color::GREY_2),
)
.padding(10)
.width(Length::Fill),
Container::new(text(amount_txt).size(P1_SIZE).style(color::GREY_2))
.padding(10)
.width(Length::Fill),
)
} else {
None

View File

@ -39,7 +39,7 @@ pub fn unconfirmed_amount_with_size<'a, T: 'a>(a: &Amount, size: u16) -> Row<'a,
//
// Format a BTC amount as a string for display.
fn amount_as_string(a: Amount) -> String {
pub fn amount_as_string(a: Amount) -> String {
let amount = a.to_btc().to_string();
// Reformat the integer portion of the amount with space separation.