1
0

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

This commit is contained in:
Sander van Grieken
2022-07-20 07:53:41 +02:00
parent 2ea1d88567
commit bbbb19eee4
2 changed files with 3 additions and 20 deletions

View File

@@ -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)
}
}
}

View File

@@ -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