Browse Source

qml swap dialog: show normal swap amount without mining fee, to be consistent with the qt GUI.

master
ThomasV 3 years ago
parent
commit
a270bb5c43
  1. 9
      electrum/gui/qml/components/SwapDialog.qml
  2. 3
      electrum/gui/qml/qeswaphelper.py

9
electrum/gui/qml/components/SwapDialog.qml

@ -47,7 +47,6 @@ ElDialog {
source: swaphelper.isReverse source: swaphelper.isReverse
? '../../icons/lightning.png' ? '../../icons/lightning.png'
: '../../icons/bitcoin.png' : '../../icons/bitcoin.png'
visible: swaphelper.valid
} }
} }
@ -58,12 +57,10 @@ ElDialog {
id: tosend id: tosend
text: Config.formatSats(swaphelper.tosend) text: Config.formatSats(swaphelper.tosend)
font.family: FixedFont font.family: FixedFont
visible: swaphelper.valid
} }
Label { Label {
text: Config.baseUnit text: Config.baseUnit
color: Material.accentColor color: Material.accentColor
visible: swaphelper.valid
} }
} }
@ -82,7 +79,6 @@ ElDialog {
source: swaphelper.isReverse source: swaphelper.isReverse
? '../../icons/bitcoin.png' ? '../../icons/bitcoin.png'
: '../../icons/lightning.png' : '../../icons/lightning.png'
visible: swaphelper.valid
} }
} }
@ -93,12 +89,10 @@ ElDialog {
id: toreceive id: toreceive
text: Config.formatSats(swaphelper.toreceive) text: Config.formatSats(swaphelper.toreceive)
font.family: FixedFont font.family: FixedFont
visible: swaphelper.valid
} }
Label { Label {
text: Config.baseUnit text: Config.baseUnit
color: Material.accentColor color: Material.accentColor
visible: swaphelper.valid
} }
} }
@ -140,11 +134,12 @@ ElDialog {
Label { Label {
text: Config.formatSats(swaphelper.miningfee) text: Config.formatSats(swaphelper.miningfee)
font.family: FixedFont font.family: FixedFont
visible: swaphelper.valid
} }
Label { Label {
Layout.fillWidth: true
text: Config.baseUnit text: Config.baseUnit
color: Material.accentColor color: Material.accentColor
visible: swaphelper.valid
} }
} }
} }

3
electrum/gui/qml/qeswaphelper.py

@ -298,6 +298,7 @@ class QESwapHelper(AuthMixin, QObject):
self.userinfo = _('Adds Lightning sending capacity.') self.userinfo = _('Adds Lightning sending capacity.')
self.isReverse = False self.isReverse = False
self._send_amount = position self._send_amount = position
self.tosend = QEAmount(amount_sat=self._send_amount)
self._receive_amount = swap_manager.get_recv_amount(send_amount=position, is_reverse=False) self._receive_amount = swap_manager.get_recv_amount(send_amount=position, is_reverse=False)
self.toreceive = QEAmount(amount_sat=self._receive_amount) self.toreceive = QEAmount(amount_sat=self._receive_amount)
@ -324,8 +325,6 @@ class QESwapHelper(AuthMixin, QObject):
self.update_tx(self._send_amount) self.update_tx(self._send_amount)
# add lockup fees, but the swap amount is position # add lockup fees, but the swap amount is position
pay_amount = self._send_amount + self._tx.get_fee() if self._tx else 0 pay_amount = self._send_amount + self._tx.get_fee() if self._tx else 0
self.tosend = QEAmount(amount_sat=pay_amount)
self.miningfee = QEAmount(amount_sat=self._tx.get_fee()) if self._tx else QEAmount() self.miningfee = QEAmount(amount_sat=self._tx.get_fee()) if self._tx else QEAmount()
self.check_valid(pay_amount, self._receive_amount) self.check_valid(pay_amount, self._receive_amount)

Loading…
Cancel
Save