2020-08-13 07:27:53 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-28 20:23:30 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.controls 1.0
|
|
|
|
import shared.controls.chat 1.0
|
2021-10-21 15:07:13 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-07-01 11:24:32 +00:00
|
|
|
import StatusQ.Components 0.1
|
2022-10-17 10:17:25 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-21 15:07:13 +00:00
|
|
|
|
2020-08-13 07:27:53 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
2021-05-21 20:19:03 +00:00
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
property string selectedTokenSymbol
|
|
|
|
property string currentCurrency
|
|
|
|
property string currentCurrencySymbol
|
2021-07-05 12:34:56 +00:00
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
property var bestRoutes: []
|
|
|
|
property var getGasEthValue: function () {}
|
|
|
|
property var getFiatValue: function () {}
|
2021-07-05 12:34:56 +00:00
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
width: parent.width
|
2022-11-30 12:59:21 +00:00
|
|
|
height: visible ? advancedGasSelector.height + Style.current.halfPadding : 0
|
2020-08-13 07:27:53 +00:00
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
Column {
|
|
|
|
id: advancedGasSelector
|
2021-05-21 20:19:03 +00:00
|
|
|
width: parent.width
|
2022-10-17 10:17:25 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 10
|
|
|
|
|
|
|
|
spacing: Style.current.halfPadding
|
2020-08-20 04:45:29 +00:00
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
// Normal transaction
|
|
|
|
Repeater {
|
|
|
|
model: root.bestRoutes
|
|
|
|
StatusListItem {
|
|
|
|
id: listItem
|
|
|
|
color: Theme.palette.statusListItem.backgroundColor
|
|
|
|
width: parent.width
|
|
|
|
asset.name: index == 0 ? "tiny/gas" : ""
|
|
|
|
title: qsTr("%1 transaction fee").arg(modelData.fromNetwork.chainName)
|
|
|
|
subTitle: "%1 eth".arg(LocaleUtils.numberToLocaleString(parseFloat(totalGasAmount)))
|
|
|
|
property string totalGasAmount : {
|
2022-11-30 12:59:21 +00:00
|
|
|
let maxFees = modelData.gasFees.maxFeePerGasM
|
2022-10-17 10:17:25 +00:00
|
|
|
let gasPrice = modelData.gasFees.eip1559Enabled ? maxFees : modelData.gasFees.gasPrice
|
|
|
|
return root.getGasEthValue(gasPrice , modelData.gasAmount)
|
|
|
|
}
|
|
|
|
statusListItemSubTitle.width: listItem.width/2 - Style.current.smallPadding
|
|
|
|
statusListItemSubTitle.elide: Text.ElideMiddle
|
|
|
|
statusListItemSubTitle.wrapMode: Text.NoWrap
|
|
|
|
components: [
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
text: "%1%2".arg(currentCurrencySymbol).arg(LocaleUtils.numberToLocaleString(parseFloat(root.getFiatValue(totalGasAmount, "ETH", root.currentCurrency))))
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
width: listItem.width/2 - Style.current.padding
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
]
|
2021-07-05 12:34:56 +00:00
|
|
|
}
|
2020-08-13 07:27:53 +00:00
|
|
|
}
|
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
// Bridge
|
|
|
|
Repeater {
|
|
|
|
model: root.bestRoutes
|
|
|
|
StatusListItem {
|
|
|
|
id: listItem2
|
|
|
|
color: Theme.palette.statusListItem.backgroundColor
|
|
|
|
width: parent.width
|
|
|
|
asset.name: index == 0 ? "tiny/bridge" : ""
|
|
|
|
title: qsTr("%1 -> %2 bridge").arg(modelData.fromNetwork.chainName).arg(modelData.toNetwork.chainName)
|
|
|
|
subTitle: "%1 %2".arg(LocaleUtils.numberToLocaleString(modelData.tokenFees)).arg(root.selectedTokenSymbol)
|
|
|
|
visible: modelData.bridgeName !== "Simple"
|
2022-11-30 12:59:21 +00:00
|
|
|
statusListItemSubTitle.width: 100
|
2022-10-17 10:17:25 +00:00
|
|
|
statusListItemSubTitle.elide: Text.ElideMiddle
|
|
|
|
components: [
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
text: "%1%2".arg(currentCurrencySymbol).arg(LocaleUtils.numberToLocaleString(parseFloat(root.getFiatValue(modelData.tokenFees, root.selectedTokenSymbol, root.currentCurrency))))
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
width: listItem2.width/2 - Style.current.padding
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2020-08-13 07:27:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|