qml: dedupe swap auth handling, fix fee values when no tx
This commit is contained in:
@@ -181,25 +181,8 @@ Dialog {
|
|||||||
})
|
})
|
||||||
dialog.open()
|
dialog.open()
|
||||||
}
|
}
|
||||||
onAuthRequired: { // TODO: don't replicate this code
|
onAuthRequired: {
|
||||||
if (swaphelper.wallet.verify_password('')) {
|
app.handleAuthRequired(swaphelper, method)
|
||||||
// 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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ 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)
|
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:
|
if pay_amount and receive_amount:
|
||||||
self.valid = True
|
self.valid = True
|
||||||
|
|||||||
Reference in New Issue
Block a user