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 { RowLayout {
Label {
text: swaphelper.serverfeeperc
}
Label { Label {
text: Config.formatSats(swaphelper.serverfee) text: Config.formatSats(swaphelper.serverfee)
font.family: FixedFont font.family: FixedFont
@ -100,6 +97,9 @@ ElDialog {
text: Config.baseUnit text: Config.baseUnit
color: Material.accentColor color: Material.accentColor
} }
Label {
text: '(' + swaphelper.serverfeeperc + ')'
}
} }
Label { Label {

7
electrum/gui/qml/qeswaphelper.py

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

Loading…
Cancel
Save