qml: dedupe swap auth handling, fix fee values when no tx
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user