2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Material
|
2022-04-22 12:16:57 +02:00
|
|
|
|
|
|
|
|
import org.electrum 1.0
|
|
|
|
|
|
|
|
|
|
import "controls"
|
|
|
|
|
|
2022-07-26 16:20:17 +02:00
|
|
|
ElDialog {
|
2022-04-22 12:16:57 +02:00
|
|
|
id: dialog
|
|
|
|
|
|
|
|
|
|
property Invoice invoice
|
2023-04-04 16:13:00 +02:00
|
|
|
property bool payImmediately: false
|
2025-03-24 12:10:41 +01:00
|
|
|
property string broadcastTxid
|
2022-04-22 12:16:57 +02:00
|
|
|
|
2022-04-26 13:18:34 +02:00
|
|
|
signal doPay
|
2022-10-26 11:12:58 +02:00
|
|
|
signal invoiceAmountChanged
|
2022-04-26 13:18:34 +02:00
|
|
|
|
2023-04-01 12:26:46 +02:00
|
|
|
title: invoice.invoiceType == Invoice.OnchainInvoice ? qsTr('On-chain Invoice') : qsTr('Lightning Invoice')
|
2023-01-02 16:58:37 +01:00
|
|
|
iconSource: Qt.resolvedUrl('../../icons/tab_send.png')
|
2022-04-22 12:16:57 +02:00
|
|
|
|
2022-10-19 14:15:24 +02:00
|
|
|
padding: 0
|
|
|
|
|
|
2022-10-20 17:18:46 +02:00
|
|
|
property bool _canMax: invoice.invoiceType == Invoice.OnchainInvoice
|
|
|
|
|
|
2023-03-27 11:46:00 +02:00
|
|
|
property Amount _invoice_amount: invoice.amount
|
|
|
|
|
|
2022-10-19 14:15:24 +02:00
|
|
|
ColumnLayout {
|
2022-12-28 16:07:30 +01:00
|
|
|
anchors.fill: parent
|
2022-10-19 14:15:24 +02:00
|
|
|
spacing: 0
|
2022-10-05 18:00:51 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Flickable {
|
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
|
Layout.fillHeight: true
|
2022-10-05 18:00:51 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
leftMargin: constants.paddingLarge
|
|
|
|
|
rightMargin: constants.paddingLarge
|
2022-10-05 18:00:51 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
contentHeight: rootLayout.height
|
|
|
|
|
clip:true
|
|
|
|
|
interactive: height < contentHeight
|
|
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
|
id: rootLayout
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
|
|
columns: 2
|
2022-10-05 18:00:51 +02:00
|
|
|
|
2023-02-10 17:24:14 +01:00
|
|
|
InfoTextArea {
|
2023-03-29 18:25:29 +02:00
|
|
|
id: helpText
|
2023-02-09 01:13:05 +01:00
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
2023-02-10 17:24:14 +01:00
|
|
|
Layout.bottomMargin: constants.paddingLarge
|
2023-03-29 18:25:29 +02:00
|
|
|
visible: text
|
2023-04-25 14:15:13 +02:00
|
|
|
text: invoice.userinfo ? invoice.userinfo : invoice.statusString
|
2023-03-30 11:24:50 +02:00
|
|
|
iconStyle: invoice.status == Invoice.Failed || invoice.status == Invoice.Unknown
|
2023-03-29 19:06:35 +02:00
|
|
|
? InfoTextArea.IconStyle.Warn
|
2023-03-30 11:24:50 +02:00
|
|
|
: invoice.status == Invoice.Expired
|
|
|
|
|
? InfoTextArea.IconStyle.Error
|
|
|
|
|
: invoice.status == Invoice.Inflight || invoice.status == Invoice.Routing || invoice.status == Invoice.Unconfirmed
|
|
|
|
|
? InfoTextArea.IconStyle.Progress
|
|
|
|
|
: invoice.status == Invoice.Paid
|
|
|
|
|
? InfoTextArea.IconStyle.Done
|
|
|
|
|
: invoice.status == Invoice.Unpaid && invoice.expiration > 0
|
2025-03-26 11:55:31 +01:00
|
|
|
? invoice.canPay
|
|
|
|
|
? InfoTextArea.IconStyle.Pending
|
|
|
|
|
: InfoTextArea.IconStyle.Error
|
2023-03-30 11:24:50 +02:00
|
|
|
: InfoTextArea.IconStyle.Info
|
2023-02-09 01:13:05 +01:00
|
|
|
}
|
|
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
2023-03-03 15:05:29 +01:00
|
|
|
Layout.topMargin: constants.paddingSmall
|
|
|
|
|
visible: invoice.invoiceType == Invoice.OnchainInvoice
|
2022-12-28 16:07:30 +01:00
|
|
|
text: qsTr('Address')
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
2023-02-09 01:13:05 +01:00
|
|
|
visible: invoice.invoiceType == Invoice.OnchainInvoice
|
2022-12-28 16:07:30 +01:00
|
|
|
leftPadding: constants.paddingMedium
|
2022-10-05 18:00:51 +02:00
|
|
|
|
2023-10-29 12:32:43 +01:00
|
|
|
RowLayout {
|
2022-12-28 16:07:30 +01:00
|
|
|
width: parent.width
|
2023-10-29 12:32:43 +01:00
|
|
|
Label {
|
|
|
|
|
text: invoice.address
|
|
|
|
|
font.pixelSize: constants.fontSizeLarge
|
|
|
|
|
font.family: FixedFont
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
}
|
|
|
|
|
ToolButton {
|
|
|
|
|
icon.source: '../../icons/share.png'
|
|
|
|
|
icon.color: 'transparent'
|
|
|
|
|
onClicked: {
|
|
|
|
|
var dialog = app.genericShareDialog.createObject(app, {
|
|
|
|
|
title: qsTr('Address'),
|
|
|
|
|
text: invoice.address
|
2023-11-01 11:38:47 +01:00
|
|
|
})
|
2023-10-29 12:32:43 +01:00
|
|
|
dialog.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-28 16:07:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
2022-10-05 18:00:51 +02:00
|
|
|
|
2022-10-26 11:12:58 +02:00
|
|
|
Label {
|
2023-03-03 15:05:29 +01:00
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.topMargin: constants.paddingSmall
|
2022-12-28 16:07:30 +01:00
|
|
|
text: qsTr('Description')
|
|
|
|
|
visible: invoice.message
|
|
|
|
|
color: Material.accentColor
|
2022-10-26 11:12:58 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2023-02-09 01:13:05 +01:00
|
|
|
visible: invoice.message
|
2022-12-28 16:07:30 +01:00
|
|
|
leftPadding: constants.paddingMedium
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
|
|
|
|
text: invoice.message
|
|
|
|
|
width: parent.width
|
|
|
|
|
font.pixelSize: constants.fontSizeXLarge
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2022-10-19 14:15:24 +02:00
|
|
|
Label {
|
2023-03-03 15:05:29 +01:00
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.topMargin: constants.paddingSmall
|
2022-12-28 16:07:30 +01:00
|
|
|
text: qsTr('Amount to send')
|
|
|
|
|
color: Material.accentColor
|
2022-10-19 14:15:24 +02:00
|
|
|
}
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
TextHighlightPane {
|
|
|
|
|
id: amountContainer
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2023-02-09 01:13:05 +01:00
|
|
|
leftPadding: constants.paddingXLarge
|
2024-12-12 13:25:44 +01:00
|
|
|
rightPadding: constants.paddingXLarge
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
property bool editmode: false
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
RowLayout {
|
|
|
|
|
id: amountLayout
|
|
|
|
|
width: parent.width
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
GridLayout {
|
|
|
|
|
visible: !amountContainer.editmode
|
|
|
|
|
columns: 2
|
2022-10-20 17:18:46 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
2023-03-17 16:44:26 +01:00
|
|
|
Layout.fillWidth: true
|
2023-03-27 11:46:00 +02:00
|
|
|
visible: _invoice_amount.isMax
|
2022-12-28 16:07:30 +01:00
|
|
|
font.pixelSize: constants.fontSizeXLarge
|
|
|
|
|
font.bold: true
|
|
|
|
|
text: qsTr('All on-chain funds')
|
|
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2023-03-17 16:44:26 +01:00
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
2023-03-27 11:46:00 +02:00
|
|
|
visible: _invoice_amount.isEmpty
|
2023-03-17 16:44:26 +01:00
|
|
|
font.pixelSize: constants.fontSizeXLarge
|
|
|
|
|
color: constants.mutedForeground
|
|
|
|
|
text: qsTr('not specified')
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
2023-03-13 18:22:51 +01:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2023-03-27 11:46:00 +02:00
|
|
|
visible: !_invoice_amount.isMax && !_invoice_amount.isEmpty
|
2022-12-28 16:07:30 +01:00
|
|
|
font.pixelSize: constants.fontSizeXLarge
|
|
|
|
|
font.family: FixedFont
|
|
|
|
|
font.bold: true
|
2023-03-29 18:03:15 +02:00
|
|
|
text: Config.formatSats(invoice.amount, false)
|
2022-12-28 16:07:30 +01:00
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
|
|
|
|
Layout.fillWidth: true
|
2023-03-27 11:46:00 +02:00
|
|
|
visible: !_invoice_amount.isMax && !_invoice_amount.isEmpty
|
2022-12-28 16:07:30 +01:00
|
|
|
text: Config.baseUnit
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
font.pixelSize: constants.fontSizeXLarge
|
|
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
|
|
|
|
id: fiatValue
|
2023-03-13 18:22:51 +01:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2023-03-27 11:46:00 +02:00
|
|
|
visible: Daemon.fx.enabled && !_invoice_amount.isMax && !_invoice_amount.isEmpty
|
2023-03-29 18:03:15 +02:00
|
|
|
text: Daemon.fx.fiatValue(invoice.amount, false)
|
2022-12-28 16:07:30 +01:00
|
|
|
font.pixelSize: constants.fontSizeMedium
|
|
|
|
|
color: constants.mutedForeground
|
|
|
|
|
}
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
|
|
|
|
Layout.fillWidth: true
|
2023-03-27 11:46:00 +02:00
|
|
|
visible: Daemon.fx.enabled && !_invoice_amount.isMax && !_invoice_amount.isEmpty
|
2022-12-28 16:07:30 +01:00
|
|
|
text: Daemon.fx.fiatCurrency
|
|
|
|
|
font.pixelSize: constants.fontSizeMedium
|
|
|
|
|
color: constants.mutedForeground
|
|
|
|
|
}
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2022-10-19 14:15:24 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
GridLayout {
|
2022-10-19 14:15:24 +02:00
|
|
|
Layout.fillWidth: true
|
2023-03-17 16:44:26 +01:00
|
|
|
visible: amountContainer.editmode
|
2023-03-27 11:54:28 +02:00
|
|
|
enabled: !(invoice.status == Invoice.Expired && _invoice_amount.isEmpty)
|
2023-03-17 16:44:26 +01:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
columns: 3
|
2023-03-17 16:44:26 +01:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
BtcField {
|
|
|
|
|
id: amountBtc
|
2024-12-12 13:25:44 +01:00
|
|
|
Layout.preferredWidth: amountFontMetrics.advanceWidth('0') * 14 + leftPadding + rightPadding
|
2022-12-28 16:07:30 +01:00
|
|
|
fiatfield: amountFiat
|
2024-12-12 13:25:44 +01:00
|
|
|
readOnly: amountMax.checked
|
|
|
|
|
color: readOnly
|
|
|
|
|
? Material.accentColor
|
|
|
|
|
: Material.foreground
|
2023-03-17 11:50:41 +01:00
|
|
|
onTextAsSatsChanged: {
|
2024-12-12 13:25:44 +01:00
|
|
|
if (!amountMax.checked)
|
|
|
|
|
invoice.amountOverride.satsInt = textAsSats.satsInt
|
|
|
|
|
}
|
|
|
|
|
Connections {
|
|
|
|
|
target: invoice.amountOverride
|
|
|
|
|
function onSatsIntChanged() {
|
2025-01-31 18:03:21 +01:00
|
|
|
console.log('amountOverride satsIntChanged, sats=' + invoice.amountOverride.satsInt)
|
2024-12-12 13:25:44 +01:00
|
|
|
if (amountMax.checked) // amountOverride updated by max amount estimate
|
2025-01-31 18:03:21 +01:00
|
|
|
amountBtc.text = Config.formatSatsForEditing(invoice.amountOverride.satsInt)
|
2024-12-12 13:25:44 +01:00
|
|
|
}
|
2023-03-17 11:50:41 +01:00
|
|
|
}
|
2022-12-28 16:07:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
Layout.fillWidth: amountMax.visible ? false : true
|
|
|
|
|
Layout.columnSpan: amountMax.visible ? 1 : 2
|
2023-02-09 12:42:09 +01:00
|
|
|
|
|
|
|
|
text: Config.baseUnit
|
|
|
|
|
color: Material.accentColor
|
2022-12-28 16:07:30 +01:00
|
|
|
}
|
2023-03-17 16:44:26 +01:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Switch {
|
|
|
|
|
id: amountMax
|
2023-02-09 12:42:09 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
text: qsTr('Max')
|
|
|
|
|
visible: _canMax
|
2023-02-09 12:42:09 +01:00
|
|
|
checked: false
|
2022-12-28 16:07:30 +01:00
|
|
|
onCheckedChanged: {
|
2024-12-12 13:25:44 +01:00
|
|
|
if (activeFocus) {
|
2023-03-17 11:50:41 +01:00
|
|
|
invoice.amountOverride.isMax = checked
|
2024-12-12 13:25:44 +01:00
|
|
|
if (checked) {
|
|
|
|
|
maxAmountMessage.text = ''
|
|
|
|
|
invoice.updateMaxAmount()
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-20 17:18:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
FiatField {
|
|
|
|
|
id: amountFiat
|
2024-12-12 13:25:44 +01:00
|
|
|
Layout.preferredWidth: amountFontMetrics.advanceWidth('0') * 14 + leftPadding + rightPadding
|
2022-12-28 16:07:30 +01:00
|
|
|
btcfield: amountBtc
|
2024-12-12 13:25:44 +01:00
|
|
|
visible: Daemon.fx.enabled
|
|
|
|
|
readOnly: amountMax.checked
|
|
|
|
|
color: readOnly
|
|
|
|
|
? Material.accentColor
|
|
|
|
|
: Material.foreground
|
2022-12-28 16:07:30 +01:00
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
2024-12-12 13:25:44 +01:00
|
|
|
visible: Daemon.fx.enabled
|
2022-12-28 16:07:30 +01:00
|
|
|
text: Daemon.fx.fiatCurrency
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
}
|
2024-12-12 13:25:44 +01:00
|
|
|
|
|
|
|
|
InfoTextArea {
|
|
|
|
|
Layout.topMargin: constants.paddingMedium
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.columnSpan: 3
|
|
|
|
|
id: maxAmountMessage
|
|
|
|
|
visible: amountMax.checked && text
|
|
|
|
|
compact: true
|
|
|
|
|
Connections {
|
|
|
|
|
target: invoice
|
|
|
|
|
function onMaxAmountMessage(message) {
|
|
|
|
|
maxAmountMessage.text = message
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
}
|
2022-09-27 15:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-28 16:07:30 +01:00
|
|
|
}
|
2022-09-27 15:09:06 +02:00
|
|
|
|
2023-03-15 15:18:48 +01:00
|
|
|
Heading {
|
|
|
|
|
Layout.columnSpan: 2
|
2023-03-16 10:11:33 +01:00
|
|
|
visible: invoice.invoiceType == Invoice.LightningInvoice
|
2023-03-15 15:18:48 +01:00
|
|
|
text: qsTr('Technical properties')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.topMargin: constants.paddingSmall
|
|
|
|
|
visible: invoice.invoiceType == Invoice.LightningInvoice
|
|
|
|
|
text: qsTr('Remote Pubkey')
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
visible: invoice.invoiceType == Invoice.LightningInvoice
|
|
|
|
|
leftPadding: constants.paddingMedium
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
width: parent.width
|
|
|
|
|
Label {
|
|
|
|
|
id: pubkeyLabel
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: 'pubkey' in invoice.lnprops ? invoice.lnprops.pubkey : ''
|
|
|
|
|
font.family: FixedFont
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
}
|
|
|
|
|
ToolButton {
|
|
|
|
|
icon.source: '../../icons/share.png'
|
|
|
|
|
icon.color: 'transparent'
|
|
|
|
|
enabled: pubkeyLabel.text
|
|
|
|
|
onClicked: {
|
|
|
|
|
var dialog = app.genericShareDialog.createObject(app,
|
|
|
|
|
{ title: qsTr('Node public key'), text: invoice.lnprops.pubkey }
|
|
|
|
|
)
|
|
|
|
|
dialog.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.topMargin: constants.paddingSmall
|
|
|
|
|
visible: invoice.invoiceType == Invoice.LightningInvoice
|
|
|
|
|
text: qsTr('Payment hash')
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
visible: invoice.invoiceType == Invoice.LightningInvoice
|
|
|
|
|
leftPadding: constants.paddingMedium
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
width: parent.width
|
|
|
|
|
Label {
|
|
|
|
|
id: paymenthashLabel
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: 'payment_hash' in invoice.lnprops ? invoice.lnprops.payment_hash : ''
|
|
|
|
|
font.family: FixedFont
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
}
|
|
|
|
|
ToolButton {
|
|
|
|
|
icon.source: '../../icons/share.png'
|
|
|
|
|
icon.color: 'transparent'
|
|
|
|
|
enabled: paymenthashLabel.text
|
|
|
|
|
onClicked: {
|
|
|
|
|
var dialog = app.genericShareDialog.createObject(app, {
|
|
|
|
|
title: qsTr('Payment hash'),
|
|
|
|
|
text: invoice.lnprops.payment_hash
|
|
|
|
|
})
|
|
|
|
|
dialog.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.topMargin: constants.paddingSmall
|
|
|
|
|
visible: 'r' in invoice.lnprops && invoice.lnprops.r.length
|
|
|
|
|
text: qsTr('Routing hints')
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
|
visible: 'r' in invoice.lnprops && invoice.lnprops.r.length
|
|
|
|
|
model: invoice.lnprops.r
|
|
|
|
|
|
|
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
text: modelData.scid
|
|
|
|
|
}
|
|
|
|
|
Label {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: modelData.node
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-01 12:26:46 +02:00
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.topMargin: constants.paddingSmall
|
|
|
|
|
visible: invoice.invoiceType == Invoice.LightningInvoice && invoice.address
|
|
|
|
|
text: qsTr('Fallback address')
|
|
|
|
|
color: Material.accentColor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextHighlightPane {
|
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
visible: invoice.invoiceType == Invoice.LightningInvoice && invoice.address
|
|
|
|
|
leftPadding: constants.paddingMedium
|
2023-11-01 11:38:47 +01:00
|
|
|
|
|
|
|
|
RowLayout {
|
2023-04-01 12:26:46 +02:00
|
|
|
width: parent.width
|
2023-11-01 11:38:47 +01:00
|
|
|
Label {
|
|
|
|
|
text: invoice.address
|
|
|
|
|
font.family: FixedFont
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
}
|
|
|
|
|
ToolButton {
|
|
|
|
|
icon.source: '../../icons/share.png'
|
|
|
|
|
icon.color: 'transparent'
|
|
|
|
|
onClicked: {
|
|
|
|
|
var dialog = app.genericShareDialog.createObject(app, {
|
|
|
|
|
title: qsTr('Address'),
|
|
|
|
|
text: invoice.address
|
|
|
|
|
})
|
|
|
|
|
dialog.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-01 12:26:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-10-19 14:15:24 +02:00
|
|
|
}
|
2022-06-29 00:14:18 +02:00
|
|
|
}
|
|
|
|
|
|
2023-02-03 13:33:17 +01:00
|
|
|
ButtonContainer {
|
2022-10-19 14:15:24 +02:00
|
|
|
Layout.fillWidth: true
|
2023-02-03 13:33:17 +01:00
|
|
|
|
|
|
|
|
FlatButton {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredWidth: 1
|
|
|
|
|
text: qsTr('Save')
|
|
|
|
|
icon.source: '../../icons/save.png'
|
2023-04-04 16:13:00 +02:00
|
|
|
enabled: !invoice.isSaved && invoice.canSave
|
2023-02-03 13:33:17 +01:00
|
|
|
onClicked: {
|
2023-03-18 16:46:20 +01:00
|
|
|
if (invoice.amount.isEmpty) {
|
2024-12-12 13:25:44 +01:00
|
|
|
invoice.amountOverride = Config.unitsToSats(amountBtc.text)
|
|
|
|
|
if (amountMax.checked)
|
|
|
|
|
invoice.amountOverride.isMax = true
|
2023-03-18 16:46:20 +01:00
|
|
|
}
|
2023-04-25 13:40:16 +02:00
|
|
|
invoice.saveInvoice()
|
2023-04-04 16:13:00 +02:00
|
|
|
app.stack.push(Qt.resolvedUrl('Invoices.qml'))
|
2023-02-03 13:33:17 +01:00
|
|
|
dialog.close()
|
|
|
|
|
}
|
2022-04-22 12:16:57 +02:00
|
|
|
}
|
2023-03-16 13:02:49 +01:00
|
|
|
FlatButton {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredWidth: 1
|
2024-10-23 11:45:42 +02:00
|
|
|
text: qsTr('Pay...')
|
2023-03-16 13:02:49 +01:00
|
|
|
icon.source: '../../icons/confirmed.png'
|
2023-03-17 11:50:41 +01:00
|
|
|
enabled: invoice.invoiceType != Invoice.Invalid && invoice.canPay
|
2023-03-16 13:02:49 +01:00
|
|
|
onClicked: {
|
2023-03-18 16:46:20 +01:00
|
|
|
if (invoice.amount.isEmpty) {
|
2024-12-12 13:25:44 +01:00
|
|
|
invoice.amountOverride = Config.unitsToSats(amountBtc.text)
|
|
|
|
|
if (amountMax.checked)
|
|
|
|
|
invoice.amountOverride.isMax = true
|
2023-03-18 16:46:20 +01:00
|
|
|
}
|
2023-04-04 16:13:00 +02:00
|
|
|
if (!invoice.isSaved) {
|
|
|
|
|
// save invoice if newly parsed
|
2023-04-25 13:40:16 +02:00
|
|
|
invoice.saveInvoice()
|
2023-03-18 16:46:20 +01:00
|
|
|
}
|
2023-03-16 13:02:49 +01:00
|
|
|
doPay() // only signal here
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-22 12:16:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-25 15:55:34 +02:00
|
|
|
Component.onCompleted: {
|
2023-03-17 16:44:26 +01:00
|
|
|
if (invoice.amount.isEmpty && !invoice.status == Invoice.Expired) {
|
2022-09-27 17:10:05 +02:00
|
|
|
amountContainer.editmode = true
|
2023-02-09 12:42:09 +01:00
|
|
|
} else if (invoice.amount.isMax) {
|
|
|
|
|
amountMax.checked = true
|
|
|
|
|
}
|
2023-04-04 16:13:00 +02:00
|
|
|
if (payImmediately) {
|
2023-03-31 15:39:29 +02:00
|
|
|
if (invoice.canPay) {
|
2023-04-04 16:13:00 +02:00
|
|
|
if (!invoice.isSaved) {
|
2023-04-25 13:40:16 +02:00
|
|
|
invoice.saveInvoice()
|
2023-03-31 15:39:29 +02:00
|
|
|
}
|
2023-03-31 15:04:27 +02:00
|
|
|
doPay()
|
2023-03-31 15:39:29 +02:00
|
|
|
}
|
2023-03-31 15:04:27 +02:00
|
|
|
}
|
2022-04-25 15:55:34 +02:00
|
|
|
}
|
2024-12-12 13:25:44 +01:00
|
|
|
|
2025-03-24 12:10:41 +01:00
|
|
|
Connections {
|
|
|
|
|
target: Daemon.currentWallet
|
|
|
|
|
function onBroadcastSucceeded(txid) {
|
|
|
|
|
if (dialog.broadcastTxid == txid) {
|
|
|
|
|
// our txid was broadcast successfully, close invoicedialog and show success popup
|
|
|
|
|
dialog.close()
|
|
|
|
|
var successdialog = app.messageDialog.createObject(mainView, {
|
|
|
|
|
text: qsTr('Payment sent.')
|
|
|
|
|
})
|
|
|
|
|
successdialog.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 13:25:44 +01:00
|
|
|
FontMetrics {
|
|
|
|
|
id: amountFontMetrics
|
|
|
|
|
font: amountBtc.font
|
|
|
|
|
}
|
2022-04-22 12:16:57 +02:00
|
|
|
}
|