From 2bdc303662bee6034ce563eebf0cb3e129db756b Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Fri, 31 Mar 2023 15:39:29 +0200 Subject: [PATCH] qml: keep lnurlData even after bolt11 has been retrieved, add isLnurlPay property and save bolt11 before triggering pay --- electrum/gui/qml/components/InvoiceDialog.qml | 8 ++++++-- electrum/gui/qml/qeinvoice.py | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qml/components/InvoiceDialog.qml b/electrum/gui/qml/components/InvoiceDialog.qml index 3fdd19db6..9757c5165 100644 --- a/electrum/gui/qml/components/InvoiceDialog.qml +++ b/electrum/gui/qml/components/InvoiceDialog.qml @@ -456,10 +456,14 @@ ElDialog { } else if (invoice.amount.isMax) { amountMax.checked = true } - if (invoice.lnurlData) { + if (invoice.isLnurlPay) { // we arrive from a lnurl-pay confirm dialog where the user already indicated the intent to pay. - if (invoice.canPay) + if (invoice.canPay) { + if (invoice_key == '') { + invoice.save_invoice() + } doPay() + } } } } diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index 894f880b3..c70381048 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -203,10 +203,8 @@ class QEInvoiceParser(QEInvoice, QtEventListener): @recipient.setter def recipient(self, recipient: str): - #if self._recipient != recipient: self.canPay = False self._recipient = recipient - self._lnurlData = None self.amountOverride = QEAmount() if recipient: self.validateRecipient(recipient) @@ -216,6 +214,10 @@ class QEInvoiceParser(QEInvoice, QtEventListener): def lnurlData(self): return self._lnurlData + @pyqtProperty(bool, notify=lnurlRetrieved) + def isLnurlPay(self): + return not self._lnurlData is None + @pyqtProperty(str, notify=invoiceChanged) def message(self): return self._effectiveInvoice.message if self._effectiveInvoice else ''