1
0

qml: don't pass lightning flag from GUI when creating payment requests

This commit is contained in:
Sander van Grieken
2023-03-14 14:49:58 +01:00
parent 950d8f4885
commit 1b0a58a0ff
2 changed files with 16 additions and 12 deletions

View File

@@ -206,18 +206,31 @@ ElDialog {
color: Material.accentColor
}
Label {
visible: request.message
Layout.fillWidth: true
text: request.message
wrapMode: Text.Wrap
}
Label {
visible: !request.message
Layout.fillWidth: true
text: qsTr('unspecified')
color: constants.mutedForeground
}
Label {
text: qsTr('Amount')
color: Material.accentColor
}
FormattedAmount {
visible: !request.amount.isEmpty
valid: !request.amount.isEmpty
amount: request.amount
}
Label {
visible: request.amount.isEmpty
text: qsTr('unspecified')
color: constants.mutedForeground
}
}
Rectangle {
@@ -323,13 +336,7 @@ ElDialog {
function createRequest() {
var qamt = Config.unitsToSats(receiveDetailsDialog.amount)
if (qamt.satsInt > Daemon.currentWallet.lightningCanReceive.satsInt) {
console.log('Creating OnChain request')
Daemon.currentWallet.createRequest(qamt, receiveDetailsDialog.description, receiveDetailsDialog.expiry, false, _ignore_gaplimit, _reuse_address)
} else {
console.log('Creating Lightning request')
Daemon.currentWallet.createRequest(qamt, receiveDetailsDialog.description, receiveDetailsDialog.expiry, true, _ignore_gaplimit, _reuse_address)
}
Daemon.currentWallet.createRequest(qamt, receiveDetailsDialog.description, receiveDetailsDialog.expiry, _ignore_gaplimit, _reuse_address)
}
function createDefaultRequest() {

View File

@@ -616,12 +616,9 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
@pyqtSlot(QEAmount, str, int, bool)
@pyqtSlot(QEAmount, str, int, bool, bool)
@pyqtSlot(QEAmount, str, int, bool, bool, bool)
def createRequest(self, amount: QEAmount, message: str, expiration: int, is_lightning: bool = False, ignore_gap: bool = False, reuse_address: bool = False):
def createRequest(self, amount: QEAmount, message: str, expiration: int, ignore_gap: bool = False, reuse_address: bool = False):
try:
if is_lightning:
if not self.wallet.lnworker.channels:
self.requestCreateError.emit('fatal',_("You need to open a Lightning channel first."))
return
if self.wallet.lnworker and self.wallet.lnworker.channels:
# TODO maybe show a warning if amount exceeds lnworker.num_sats_can_receive (as in kivy)
# TODO fallback address robustness
addr = self.wallet.get_unused_address()