Merge #351: Gui unconfirmed badge
9535b802584a153fd0e6fcb808d8af7aa067ec95 Add spent tag to confirmed broadcast tx (edouard) 120f87462f0402c8a056c4af2c318601174bdfb6 Change pending label for unconfirmed (edouard) Pull request description:  ACKs for top commit: edouardparis: Self-ACK 9535b802584a153fd0e6fcb808d8af7aa067ec95 Tree-SHA512: 537f65e96ea99821ea2d342e80c55d9e1c8508664cb9fadb00ef08531e0f4c337b33a53d93e397ab07dfc8f1e051e18445d87baf4fe34acb1793561c48e3eded
This commit is contained in:
commit
4f4327fd1f
@ -70,11 +70,7 @@ fn coin_list_view(
|
||||
Row::new()
|
||||
.push(badge::coin())
|
||||
.push_maybe(if coin.spend_info.is_some() {
|
||||
Some(
|
||||
Container::new(text(" Spent ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Success),
|
||||
)
|
||||
Some(badge::spent())
|
||||
} else {
|
||||
let seq = remaining_sequence(coin, blockheight, timelock);
|
||||
if seq == 0 {
|
||||
@ -116,11 +112,7 @@ fn coin_list_view(
|
||||
}
|
||||
})
|
||||
.push_maybe(if coin.block_height.is_none() {
|
||||
Some(
|
||||
Container::new(text(" Unconfirmed ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Simple),
|
||||
)
|
||||
Some(badge::unconfirmed())
|
||||
} else {
|
||||
None
|
||||
})
|
||||
|
||||
@ -130,9 +130,7 @@ fn event_list_view<'a>(i: usize, event: &HistoryTransaction) -> Element<'a, Mess
|
||||
.small(),
|
||||
)
|
||||
} else {
|
||||
Container::new(text(" Pending ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Success)
|
||||
badge::unconfirmed()
|
||||
})
|
||||
.spacing(10)
|
||||
.align_items(Alignment::Center)
|
||||
|
||||
@ -210,16 +210,9 @@ fn spend_header<'a>(tx: &SpendTx) -> Element<'a, Message> {
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.push_maybe(match tx.status {
|
||||
SpendStatus::Deprecated => Some(
|
||||
Container::new(text(" Deprecated ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Simple),
|
||||
),
|
||||
SpendStatus::Broadcast => Some(
|
||||
Container::new(text(" Broadcast ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Success),
|
||||
),
|
||||
SpendStatus::Deprecated => Some(badge::deprecated()),
|
||||
SpendStatus::Broadcast => Some(badge::unconfirmed()),
|
||||
SpendStatus::Spent => Some(badge::spent()),
|
||||
_ => None,
|
||||
})
|
||||
.push(
|
||||
|
||||
@ -156,16 +156,9 @@ fn spend_tx_list_view<'a>(i: usize, tx: &SpendTx) -> Element<'a, Message> {
|
||||
.width(Length::Fill),
|
||||
)
|
||||
.push_maybe(match tx.status {
|
||||
SpendStatus::Deprecated => Some(
|
||||
Container::new(text(" Deprecated ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Simple),
|
||||
),
|
||||
SpendStatus::Broadcast => Some(
|
||||
Container::new(text(" Broadcast ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Success),
|
||||
),
|
||||
SpendStatus::Deprecated => Some(badge::deprecated()),
|
||||
SpendStatus::Broadcast => Some(badge::unconfirmed()),
|
||||
SpendStatus::Spent => Some(badge::spent()),
|
||||
_ => None,
|
||||
})
|
||||
.push(
|
||||
|
||||
@ -206,11 +206,7 @@ fn coin_list_view<'a>(
|
||||
})
|
||||
.push(badge::coin())
|
||||
.push_maybe(if coin.spend_info.is_some() {
|
||||
Some(
|
||||
Container::new(text(" Spent ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Success),
|
||||
)
|
||||
Some(badge::spent())
|
||||
} else {
|
||||
let seq = remaining_sequence(coin, blockheight, timelock);
|
||||
if seq == 0 {
|
||||
@ -244,11 +240,7 @@ fn coin_list_view<'a>(
|
||||
}
|
||||
})
|
||||
.push_maybe(if coin.block_height.is_none() {
|
||||
Some(
|
||||
Container::new(text(" Unconfirmed ").small())
|
||||
.padding(3)
|
||||
.style(badge::PillStyle::Simple),
|
||||
)
|
||||
Some(badge::unconfirmed())
|
||||
} else {
|
||||
None
|
||||
})
|
||||
|
||||
@ -37,6 +37,7 @@ pub enum SpendStatus {
|
||||
Pending,
|
||||
Deprecated,
|
||||
Broadcast,
|
||||
Spent,
|
||||
}
|
||||
|
||||
impl SpendTx {
|
||||
@ -60,7 +61,11 @@ impl SpendTx {
|
||||
inputs_amount += coin.amount;
|
||||
if let Some(info) = coin.spend_info {
|
||||
if info.txid == psbt.unsigned_tx.txid() {
|
||||
status = SpendStatus::Broadcast
|
||||
if info.height.is_some() {
|
||||
status = SpendStatus::Spent
|
||||
} else {
|
||||
status = SpendStatus::Broadcast
|
||||
}
|
||||
} else {
|
||||
status = SpendStatus::Deprecated
|
||||
}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
use iced::{
|
||||
widget::{self, Container},
|
||||
widget::{self, tooltip, Container},
|
||||
Element, Length,
|
||||
};
|
||||
|
||||
use crate::ui::{color, icon};
|
||||
use crate::ui::{
|
||||
color,
|
||||
component::{card, text::*},
|
||||
icon,
|
||||
};
|
||||
|
||||
pub enum Style {
|
||||
Standard,
|
||||
@ -164,3 +168,42 @@ impl From<PillStyle> for iced::theme::Container {
|
||||
iced::theme::Container::Custom(i.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unconfirmed<'a, T: 'a>() -> widget::container::Container<'a, T> {
|
||||
Container::new(
|
||||
tooltip::Tooltip::new(
|
||||
Container::new(text(" Unconfirmed ").small())
|
||||
.padding(3)
|
||||
.style(PillStyle::Simple),
|
||||
"Do not treat this as a payment until it is confirmed",
|
||||
tooltip::Position::Top,
|
||||
)
|
||||
.style(card::SimpleCardStyle),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn deprecated<'a, T: 'a>() -> widget::container::Container<'a, T> {
|
||||
Container::new(
|
||||
tooltip::Tooltip::new(
|
||||
Container::new(text(" Deprecated ").small())
|
||||
.padding(3)
|
||||
.style(PillStyle::Simple),
|
||||
"This spend cannot be included anymore in the blockchain",
|
||||
tooltip::Position::Top,
|
||||
)
|
||||
.style(card::SimpleCardStyle),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn spent<'a, T: 'a>() -> widget::container::Container<'a, T> {
|
||||
Container::new(
|
||||
tooltip::Tooltip::new(
|
||||
Container::new(text(" Spent ").small())
|
||||
.padding(3)
|
||||
.style(PillStyle::Simple),
|
||||
"The spend transaction was included in the blockchain",
|
||||
tooltip::Position::Top,
|
||||
)
|
||||
.style(card::SimpleCardStyle),
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user