Merge #100: Fix spend creation
d541ca90e59f7890aa26373c8675278a3a559d5b Fix spend creation (edouard)
3e43a806cfa129e4c8449c4a43353290579fcd22 bump minisafe (edouard)
Pull request description:
ACKs for top commit:
edouardparis:
Self-ACK d541ca90e59f7890aa26373c8675278a3a559d5b
Tree-SHA512: 6be37c5ea63c46d2e834444c58a5732e77e13a53d14c00912828d9ceb1daf89aaa6e6c770e400e61987d7bfe13dae5e5a6cab79f2a51cbea6d0410058dde57ed
This commit is contained in:
commit
72a7bbea4c
4
gui/Cargo.lock
generated
4
gui/Cargo.lock
generated
@ -1620,7 +1620,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
[[package]]
|
||||
name = "minisafe"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/revault/minisafe?branch=master#ac80aa77215169d93bf5a44afb2b854f52e74348"
|
||||
source = "git+https://github.com/revault/minisafe?branch=master#25bbce8612f7aaef45d24ec16fc1fd55c6b73594"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"base64",
|
||||
@ -2804,7 +2804,7 @@ version = "1.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if 0.1.10",
|
||||
"rand 0.8.5",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
@ -346,7 +346,7 @@ impl Step for SaveSpend {
|
||||
psbt.unsigned_tx
|
||||
.output
|
||||
.iter()
|
||||
.position(|output| outputs_script_pubkeys.contains(&output.script_pubkey))
|
||||
.position(|output| !outputs_script_pubkeys.contains(&output.script_pubkey))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
@ -37,9 +37,11 @@ pub fn spend_view<'a, T: Into<Element<'a, Message>>>(
|
||||
show_delete,
|
||||
warning,
|
||||
column()
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20)
|
||||
.push(spend_overview_view(tx))
|
||||
.push(spend_header(tx))
|
||||
.push(action)
|
||||
.push(spend_overview_view(tx))
|
||||
.push(inputs_and_outputs_view(
|
||||
&tx.coins,
|
||||
&tx.psbt,
|
||||
@ -139,7 +141,11 @@ pub fn spend_modal<'a, T: Into<Element<'a, Message>>>(
|
||||
)
|
||||
.width(Length::Fill)
|
||||
} else {
|
||||
column().width(Length::Fill)
|
||||
column()
|
||||
.push(
|
||||
button::transparent(None, "< Previous").on_press(Message::Previous),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
})
|
||||
.align_items(iced::Alignment::Center)
|
||||
.push(
|
||||
@ -155,7 +161,7 @@ pub fn spend_modal<'a, T: Into<Element<'a, Message>>>(
|
||||
.into()
|
||||
}
|
||||
|
||||
fn spend_overview_view<'a>(tx: &SpendTx) -> Element<'a, Message> {
|
||||
fn spend_header<'a>(tx: &SpendTx) -> Element<'a, Message> {
|
||||
column()
|
||||
.spacing(20)
|
||||
.align_items(Alignment::Center)
|
||||
@ -192,49 +198,53 @@ fn spend_overview_view<'a>(tx: &SpendTx) -> Element<'a, Message> {
|
||||
tx.fee_amount.to_btc()
|
||||
)))),
|
||||
)
|
||||
.push(card::simple(
|
||||
column()
|
||||
.push(container(
|
||||
row()
|
||||
.push(
|
||||
container(
|
||||
row()
|
||||
.push(container(icon::key_icon().size(30).width(Length::Fill)))
|
||||
.push(column().push(text("Number of signatures:").bold()).push(
|
||||
text(&format!("{}", tx.psbt.inputs[0].partial_sigs.len(),)),
|
||||
))
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20),
|
||||
)
|
||||
.width(Length::FillPortion(1)),
|
||||
)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20),
|
||||
))
|
||||
.push(separation().width(Length::Fill))
|
||||
.push(
|
||||
column()
|
||||
.push(
|
||||
row()
|
||||
.push(text("Tx ID:").bold().width(Length::Fill))
|
||||
.push(text(&format!("{}", tx.psbt.unsigned_tx.txid())).small())
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.push(
|
||||
row()
|
||||
.push(text("Psbt:").bold().width(Length::Fill))
|
||||
.push(
|
||||
button::transparent(Some(icon::clipboard_icon()), "Copy")
|
||||
.on_press(Message::Clipboard(tx.psbt.to_string())),
|
||||
)
|
||||
.align_items(Alignment::Center),
|
||||
),
|
||||
)
|
||||
.spacing(20),
|
||||
))
|
||||
.into()
|
||||
}
|
||||
|
||||
fn spend_overview_view<'a>(tx: &SpendTx) -> Element<'a, Message> {
|
||||
card::simple(
|
||||
column()
|
||||
.push(container(
|
||||
row()
|
||||
.push(
|
||||
container(
|
||||
row()
|
||||
.push(container(icon::key_icon().size(30).width(Length::Fill)))
|
||||
.push(column().push(text("Number of signatures:").bold()).push(
|
||||
text(&format!("{}", tx.psbt.inputs[0].partial_sigs.len(),)),
|
||||
))
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20),
|
||||
)
|
||||
.width(Length::FillPortion(1)),
|
||||
)
|
||||
.align_items(Alignment::Center)
|
||||
.spacing(20),
|
||||
))
|
||||
.push(separation().width(Length::Fill))
|
||||
.push(
|
||||
column()
|
||||
.push(
|
||||
row()
|
||||
.push(text("Tx ID:").bold().width(Length::Fill))
|
||||
.push(text(&format!("{}", tx.psbt.unsigned_tx.txid())).small())
|
||||
.align_items(Alignment::Center),
|
||||
)
|
||||
.push(
|
||||
row()
|
||||
.push(text("Psbt:").bold().width(Length::Fill))
|
||||
.push(
|
||||
button::transparent(Some(icon::clipboard_icon()), "Copy")
|
||||
.on_press(Message::Clipboard(tx.psbt.to_string())),
|
||||
)
|
||||
.align_items(Alignment::Center),
|
||||
),
|
||||
)
|
||||
.spacing(20),
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
fn inputs_and_outputs_view<'a>(
|
||||
coins: &[Coin],
|
||||
psbt: &Psbt,
|
||||
@ -272,24 +282,28 @@ fn inputs_and_outputs_view<'a>(
|
||||
col.push(
|
||||
card::simple(
|
||||
column()
|
||||
.width(Length::Fill)
|
||||
.spacing(10)
|
||||
.push(
|
||||
text(&format!(
|
||||
"{} BTC",
|
||||
Amount::from_sat(output.value).to_btc()
|
||||
))
|
||||
.bold(),
|
||||
)
|
||||
.push(
|
||||
text(&format!(
|
||||
"{}",
|
||||
Address::from_script(
|
||||
&output.script_pubkey,
|
||||
network
|
||||
column()
|
||||
.width(Length::Fill)
|
||||
.push(
|
||||
text(&format!(
|
||||
"{} BTC",
|
||||
Amount::from_sat(output.value).to_btc()
|
||||
))
|
||||
.bold(),
|
||||
)
|
||||
.unwrap()
|
||||
))
|
||||
.small(),
|
||||
.push(
|
||||
text(&format!(
|
||||
"{}",
|
||||
Address::from_script(
|
||||
&output.script_pubkey,
|
||||
network
|
||||
)
|
||||
.unwrap()
|
||||
))
|
||||
.small(),
|
||||
),
|
||||
)
|
||||
.push_maybe(if Some(i) == change_index {
|
||||
Some(
|
||||
|
||||
@ -120,7 +120,7 @@ impl Daemon for EmbeddedDaemon {
|
||||
.read()
|
||||
.unwrap()
|
||||
.control
|
||||
.create_spend(coins_outpoints, destinations, feerate_vb)
|
||||
.create_spend(destinations, coins_outpoints, feerate_vb)
|
||||
.map_err(|e| DaemonError::Unexpected(e.to_string()))
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ use iced::pure::{
|
||||
};
|
||||
use iced::Length;
|
||||
|
||||
use crate::ui::{color, component::text::*};
|
||||
use crate::ui::{color, component::text::*, util::Collection};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Value<T> {
|
||||
@ -70,21 +70,24 @@ where
|
||||
|
||||
impl<'a, Message: 'a + Clone> From<Form<'a, Message>> for Element<'a, Message> {
|
||||
fn from(form: Form<'a, Message>) -> Element<'a, Message> {
|
||||
if !form.valid {
|
||||
if let Some(message) = form.warning {
|
||||
return container(
|
||||
column()
|
||||
.push(form.input.style(InvalidFormStyle))
|
||||
.push(text(message).color(color::ALERT).small())
|
||||
.width(Length::Fill)
|
||||
.spacing(5),
|
||||
)
|
||||
container(
|
||||
column()
|
||||
.push(if !form.valid {
|
||||
form.input.style(InvalidFormStyle)
|
||||
} else {
|
||||
form.input
|
||||
})
|
||||
.push_maybe(if !form.valid {
|
||||
form.warning
|
||||
.map(|message| text(message).color(color::ALERT).small())
|
||||
} else {
|
||||
None
|
||||
})
|
||||
.width(Length::Fill)
|
||||
.into();
|
||||
}
|
||||
}
|
||||
|
||||
container(form.input).width(Length::Fill).into()
|
||||
.spacing(5),
|
||||
)
|
||||
.width(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user