Merge #1707: [GUI] some fixes for unused addresses list

efd0c32e5df323a555850e364ef7c18ce6474cbb fix: hide prev addresses option if there are none (Michael Mallan)
c629142c58408909877d60b4ab38f76cb3ad5518 fix: ignore address with index 0 (Michael Mallan)

Pull request description:

  This PR consists of two fixes following #1704:
  1) don't show the address with index 0 in the list of unused addresses. This is because a new Liana wallet starts generating new addresses from index 1.
  2) hide the option to view unused addresses if there aren't any (such as for a new wallet).

ACKs for top commit:
  pythcoiner:
    tACK efd0c32e

Tree-SHA512: d80ff4358387b8a06867845eea89aac6f9a6896292975b92901b17e324564b01ca6b2af00faadf932a37bf38d6459d18f2533659adb5c8e8582f71ea6e1d7869
This commit is contained in:
edouardparis 2025-05-16 09:45:41 +02:00
commit 21e1ee14b4
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
2 changed files with 27 additions and 20 deletions

View File

@ -238,6 +238,11 @@ impl State for ReceivePanel {
&& (start_index.is_some() || self.prev_addresses.is_empty())
{
for entry in revealed.addresses.iter() {
// A new wallet always has index 0 "revealed", but we ignore it as
// it was not generated by the user.
if entry.index == 0.into() {
continue;
}
self.prev_addresses.list.push(entry.address.clone());
self.prev_addresses.derivation_indexes.push(entry.index);
if let Some(label) = &entry.label {

View File

@ -126,27 +126,29 @@ pub fn receive<'a>(
},
)),
)
.push(
Container::new(
Button::new(
Row::new()
.align_y(Alignment::Center)
.push(
p1_bold("Previously generated addresses still awaiting deposit")
.width(Length::Fill),
)
.push(if show_prev_addresses {
icon::collapsed_icon()
} else {
icon::collapse_icon()
}),
.push_maybe(
(!prev_addresses.is_empty()).then_some(
Container::new(
Button::new(
Row::new()
.align_y(Alignment::Center)
.push(
p1_bold("Previously generated addresses still awaiting deposit")
.width(Length::Fill),
)
.push(if show_prev_addresses {
icon::collapsed_icon()
} else {
icon::collapse_icon()
}),
)
.on_press(Message::ToggleShowPreviousAddresses)
.padding(20)
.width(Length::Fill)
.style(theme::button::transparent_border),
)
.on_press(Message::ToggleShowPreviousAddresses)
.padding(20)
.width(Length::Fill)
.style(theme::button::transparent_border),
)
.style(theme::card::simple),
.style(theme::card::simple),
),
)
.push_maybe(show_prev_addresses.then_some(Row::new().spacing(10).push(
prev_addresses.iter().enumerate().fold(