Browse Source

qml: proper check for max amount onchain. move max amount lightning to superclass

patch-4
Sander van Grieken 3 years ago
parent
commit
b37262f232
  1. 2
      electrum/gui/qml/components/InvoiceDialog.qml
  2. 12
      electrum/gui/qml/qeinvoice.py

2
electrum/gui/qml/components/InvoiceDialog.qml

@ -115,7 +115,7 @@ ElDialog {
Label { Label {
width: parent.width width: parent.width
text: invoice.lnprops ? invoice.lnprops.pubkey : '' text: 'pubkey' in invoice.lnprops ? invoice.lnprops.pubkey : ''
font.family: FixedFont font.family: FixedFont
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }

12
electrum/gui/qml/qeinvoice.py

@ -107,10 +107,13 @@ class QEInvoice(QObject):
self.userinfoChanged.emit() self.userinfoChanged.emit()
def get_max_spendable_onchain(self): def get_max_spendable_onchain(self):
c, u, x = self._wallet.wallet.get_balance() spendable = self._wallet.confirmedBalance.satsInt
#TODO determine real max if not self._wallet.wallet.config.get('confirmed_only', False):
return c spendable += self._wallet.unconfirmedBalance.satsInt
return spendable
def get_max_spendable_lightning(self):
return self._wallet.wallet.lnworker.num_sats_can_send()
class QEInvoiceParser(QEInvoice): class QEInvoiceParser(QEInvoice):
@ -303,9 +306,6 @@ class QEInvoiceParser(QEInvoice):
PR_UNKNOWN: _('Invoice has unknown status'), PR_UNKNOWN: _('Invoice has unknown status'),
}[self.status] }[self.status]
def get_max_spendable_lightning(self):
return self._wallet.wallet.lnworker.num_sats_can_send()
def setValidOnchainInvoice(self, invoice: Invoice): def setValidOnchainInvoice(self, invoice: Invoice):
self._logger.debug('setValidOnchainInvoice') self._logger.debug('setValidOnchainInvoice')
if invoice.is_lightning(): if invoice.is_lightning():

Loading…
Cancel
Save