2024-06-06 14:05:31 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
|
|
|
/* This is so that all the data from the response
|
|
|
|
to the swap request can be placed here at one place. */
|
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
2024-06-13 00:45:33 +00:00
|
|
|
property string fromTokenAmount: ""
|
|
|
|
property string toTokenAmount: ""
|
2024-06-06 14:05:31 +00:00
|
|
|
property real totalFees: 0
|
|
|
|
property var bestRoutes: []
|
|
|
|
property bool approvalNeeded
|
|
|
|
property bool hasError
|
|
|
|
property var rawPaths: []
|
|
|
|
|
|
|
|
function reset() {
|
2024-06-13 00:45:33 +00:00
|
|
|
root.fromTokenAmount = ""
|
|
|
|
root.toTokenAmount = ""
|
2024-06-18 17:24:07 +00:00
|
|
|
root.resetAllButReceivedTokenValuesForSwap()
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetAllButReceivedTokenValuesForSwap() {
|
2024-06-06 14:05:31 +00:00
|
|
|
root.totalFees = 0
|
|
|
|
root.bestRoutes = []
|
|
|
|
root.approvalNeeded = false
|
|
|
|
root.hasError = false
|
|
|
|
root.rawPaths = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|