Browse Source

qml: update swaphelper server fee

patch-4
Sander van Grieken 2 years ago
parent
commit
d95b18c510
  1. 6
      electrum/gui/qml/components/SwapDialog.qml
  2. 7
      electrum/gui/qml/qeswaphelper.py

6
electrum/gui/qml/components/SwapDialog.qml

@ -89,9 +89,6 @@ ElDialog {
}
RowLayout {
Label {
text: swaphelper.serverfeeperc
}
Label {
text: Config.formatSats(swaphelper.serverfee)
font.family: FixedFont
@ -100,6 +97,9 @@ ElDialog {
text: Config.baseUnit
color: Material.accentColor
}
Label {
text: '(' + swaphelper.serverfeeperc + ')'
}
}
Label {

7
electrum/gui/qml/qeswaphelper.py

@ -1,4 +1,5 @@
import asyncio
import math
from typing import Union
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
@ -242,7 +243,8 @@ class QESwapHelper(AuthMixin, QObject):
# fee breakdown
self.serverfeeperc = f'{swap_manager.percentage:0.1f}%'
self.serverfee = QEAmount(amount_sat=swap_manager.lockup_fee)
serverfee = math.ceil(swap_manager.percentage * pay_amount / 100) + swap_manager.lockup_fee
self.serverfee = QEAmount(amount_sat=serverfee)
self.miningfee = QEAmount(amount_sat=swap_manager.get_claim_fee())
else: # forward (normal) swap
@ -261,7 +263,8 @@ class QESwapHelper(AuthMixin, QObject):
# fee breakdown
self.serverfeeperc = f'{swap_manager.percentage:0.1f}%'
self.serverfee = QEAmount(amount_sat=swap_manager.normal_fee)
serverfee = math.ceil(swap_manager.percentage * pay_amount / 100) + swap_manager.normal_fee
self.serverfee = QEAmount(amount_sat=serverfee)
self.miningfee = QEAmount(amount_sat=self._tx.get_fee()) if self._tx else QEAmount()
if pay_amount and receive_amount:

Loading…
Cancel
Save