2024-06-06 16:05:31 +02:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
2024-06-24 15:52:10 +02:00
|
|
|
import utils 1.0
|
|
|
|
|
2024-06-06 16:05:31 +02:00
|
|
|
/* 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 02:45:33 +02:00
|
|
|
property string fromTokenAmount: ""
|
|
|
|
property string toTokenAmount: ""
|
2024-07-02 00:35:10 +02:00
|
|
|
// TODO: this should be string but backend gas_estimate_item.nim passes this as float
|
2024-06-06 16:05:31 +02:00
|
|
|
property real totalFees: 0
|
|
|
|
property bool hasError
|
2024-07-19 00:36:36 -03:00
|
|
|
property string errCode
|
|
|
|
property string errDescription
|
2024-06-06 16:05:31 +02:00
|
|
|
property var rawPaths: []
|
2024-06-24 15:52:10 +02:00
|
|
|
// need to check how this is done in new router v2, right now it is Enum type
|
|
|
|
property int estimatedTime
|
|
|
|
property string txProviderName
|
|
|
|
property bool approvalNeeded
|
|
|
|
property string approvalGasFees
|
|
|
|
property string approvalAmountRequired
|
|
|
|
property string approvalContractAddress
|
2024-06-06 16:05:31 +02:00
|
|
|
|
2024-07-04 00:08:03 +02:00
|
|
|
function resetPathInfoAndError() {
|
|
|
|
root.hasError = false
|
2024-07-19 00:36:36 -03:00
|
|
|
root.errCode = ""
|
|
|
|
root.errDescription = ""
|
2024-07-04 00:08:03 +02:00
|
|
|
root.rawPaths = []
|
|
|
|
}
|
|
|
|
|
2024-06-06 16:05:31 +02:00
|
|
|
function reset() {
|
2024-06-13 02:45:33 +02:00
|
|
|
root.fromTokenAmount = ""
|
|
|
|
root.toTokenAmount = ""
|
2024-07-04 00:08:03 +02:00
|
|
|
root.txProviderName = ""
|
|
|
|
root.estimatedTime = Constants.TransactionEstimatedTime.Unknown
|
2024-06-06 16:05:31 +02:00
|
|
|
root.totalFees = 0
|
|
|
|
root.approvalNeeded = false
|
2024-07-04 00:08:03 +02:00
|
|
|
root.approvalGasFees = ""
|
|
|
|
root.approvalAmountRequired = ""
|
|
|
|
root.approvalContractAddress = ""
|
|
|
|
resetPathInfoAndError()
|
2024-06-06 16:05:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|