Browse Source

qml: dedupe swap auth handling, fix fee values when no tx

patch-4
Sander van Grieken 3 years ago
parent
commit
bbbb19eee4
  1. 21
      electrum/gui/qml/components/Swap.qml
  2. 2
      electrum/gui/qml/qeswaphelper.py

21
electrum/gui/qml/components/Swap.qml

@ -181,25 +181,8 @@ Dialog {
})
dialog.open()
}
onAuthRequired: { // TODO: don't replicate this code
if (swaphelper.wallet.verify_password('')) {
// wallet has no password
console.log('wallet has no password, proceeding')
swaphelper.authProceed()
} else {
var dialog = app.passwordDialog.createObject(app, {'title': qsTr('Enter current password')})
dialog.accepted.connect(function() {
if (swaphelper.wallet.verify_password(dialog.password)) {
swaphelper.wallet.authProceed()
} else {
swaphelper.wallet.authCancel()
}
})
dialog.rejected.connect(function() {
swaphelper.wallet.authCancel()
})
dialog.open()
}
onAuthRequired: {
app.handleAuthRequired(swaphelper, method)
}
}
}

2
electrum/gui/qml/qeswaphelper.py

@ -262,7 +262,7 @@ class QESwapHelper(AuthMixin, QObject):
# fee breakdown
self.serverfeeperc = f'{swap_manager.percentage:0.1f}%'
self.serverfee = QEAmount(amount_sat=swap_manager.normal_fee)
self.miningfee = QEAmount(amount_sat=self._tx.get_fee())
self.miningfee = QEAmount(amount_sat=self._tx.get_fee()) if self._tx else QEAmount()
if pay_amount and receive_amount:
self.valid = True

Loading…
Cancel
Save