diff --git a/electrum/gui/qml/components/LnurlPayRequestDialog.qml b/electrum/gui/qml/components/LnurlPayRequestDialog.qml index ead002b68..468db200a 100644 --- a/electrum/gui/qml/components/LnurlPayRequestDialog.qml +++ b/electrum/gui/qml/components/LnurlPayRequestDialog.qml @@ -102,12 +102,4 @@ ElDialog { } } - Connections { - target: invoiceParser - function onLnurlError(code, message) { - var dialog = app.messageDialog.createObject(app, { text: message }) - dialog.open() - } - } - } diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index 34c487b14..a8ce5687b 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -235,9 +235,14 @@ Item { onInvoiceCreateError: console.log(code + ' ' + message) onLnurlRetrieved: { + closeSendDialog() var dialog = lnurlPayDialog.createObject(app, { invoiceParser: invoiceParser }) dialog.open() } + onLnurlError: { + var dialog = app.messageDialog.createObject(app, { text: message }) + dialog.open() + } } Connections { diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index 78c84673d..a5de70498 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -620,16 +620,21 @@ class QEInvoiceParser(QEInvoice, QtEventListener): params['comment'] = comment coro = callback_lnurl(self._lnurlData['callback_url'], params) fut = asyncio.run_coroutine_threadsafe(coro, self._wallet.wallet.network.asyncio_loop) - self.on_lnurl_invoice(fut.result()) + self.on_lnurl_invoice(amount, fut.result()) except Exception as e: - self.lnurlError.emit('lnurl', repr(e)) + self._logger.error(repr(e)) + self.lnurlError.emit('lnurl', str(e)) threading.Thread(target=fetch_invoice_task).start() - def on_lnurl_invoice(self, invoice): + def on_lnurl_invoice(self, orig_amount, invoice): self._logger.debug('on_lnurl_invoice') self._logger.debug(f'{repr(invoice)}') + # assure no shenanigans with the bolt11 invoice we get back + lninvoice = Invoice.from_bech32(invoice) + assert orig_amount * 1000 == lninvoice.amount_msat + invoice = invoice['pr'] self.recipient = invoice