qml: don't pass lightning flag from GUI when creating payment requests
This commit is contained in:
@@ -206,18 +206,31 @@ ElDialog {
|
|||||||
color: Material.accentColor
|
color: Material.accentColor
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
|
visible: request.message
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: request.message
|
text: request.message
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
|
Label {
|
||||||
|
visible: !request.message
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: qsTr('unspecified')
|
||||||
|
color: constants.mutedForeground
|
||||||
|
}
|
||||||
Label {
|
Label {
|
||||||
text: qsTr('Amount')
|
text: qsTr('Amount')
|
||||||
color: Material.accentColor
|
color: Material.accentColor
|
||||||
}
|
}
|
||||||
FormattedAmount {
|
FormattedAmount {
|
||||||
|
visible: !request.amount.isEmpty
|
||||||
valid: !request.amount.isEmpty
|
valid: !request.amount.isEmpty
|
||||||
amount: request.amount
|
amount: request.amount
|
||||||
}
|
}
|
||||||
|
Label {
|
||||||
|
visible: request.amount.isEmpty
|
||||||
|
text: qsTr('unspecified')
|
||||||
|
color: constants.mutedForeground
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -323,13 +336,7 @@ ElDialog {
|
|||||||
|
|
||||||
function createRequest() {
|
function createRequest() {
|
||||||
var qamt = Config.unitsToSats(receiveDetailsDialog.amount)
|
var qamt = Config.unitsToSats(receiveDetailsDialog.amount)
|
||||||
if (qamt.satsInt > Daemon.currentWallet.lightningCanReceive.satsInt) {
|
Daemon.currentWallet.createRequest(qamt, receiveDetailsDialog.description, receiveDetailsDialog.expiry, _ignore_gaplimit, _reuse_address)
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDefaultRequest() {
|
function createDefaultRequest() {
|
||||||
|
|||||||
@@ -616,12 +616,9 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
|||||||
@pyqtSlot(QEAmount, str, int, bool)
|
@pyqtSlot(QEAmount, str, int, bool)
|
||||||
@pyqtSlot(QEAmount, str, int, bool, bool)
|
@pyqtSlot(QEAmount, str, int, bool, bool)
|
||||||
@pyqtSlot(QEAmount, str, int, bool, 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:
|
try:
|
||||||
if is_lightning:
|
if self.wallet.lnworker and self.wallet.lnworker.channels:
|
||||||
if not self.wallet.lnworker.channels:
|
|
||||||
self.requestCreateError.emit('fatal',_("You need to open a Lightning channel first."))
|
|
||||||
return
|
|
||||||
# TODO maybe show a warning if amount exceeds lnworker.num_sats_can_receive (as in kivy)
|
# TODO maybe show a warning if amount exceeds lnworker.num_sats_can_receive (as in kivy)
|
||||||
# TODO fallback address robustness
|
# TODO fallback address robustness
|
||||||
addr = self.wallet.get_unused_address()
|
addr = self.wallet.get_unused_address()
|
||||||
|
|||||||
Reference in New Issue
Block a user