2022-07-01 11:24:32 +00:00
|
|
|
|
import QtQuick 2.13
|
2022-05-19 08:53:57 +00:00
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
|
|
import utils 1.0
|
2023-01-08 22:23:51 +00:00
|
|
|
|
import shared.stores 1.0
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
|
|
|
|
|
import "../controls"
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
2022-11-23 17:58:22 +00:00
|
|
|
|
implicitHeight: visible ? tabBar.height + stackLayout.height + Style.current.xlPadding : 0
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
|
|
|
|
property var store
|
2023-01-08 22:23:51 +00:00
|
|
|
|
property var currencyStore : store.currencyStore
|
2022-07-01 11:24:32 +00:00
|
|
|
|
property var selectedAccount
|
2023-02-01 10:44:22 +00:00
|
|
|
|
property string ensAddressOrEmpty: ""
|
2022-07-01 11:24:32 +00:00
|
|
|
|
property var selectedAsset
|
2023-01-08 22:23:51 +00:00
|
|
|
|
property var amountToSend
|
|
|
|
|
property var requiredGasInEth
|
2022-10-17 10:17:25 +00:00
|
|
|
|
property var bestRoutes
|
|
|
|
|
property bool isLoading: false
|
|
|
|
|
property bool advancedOrCustomMode: (tabBar.currentIndex === 1) || (tabBar.currentIndex === 2)
|
2022-11-25 09:13:02 +00:00
|
|
|
|
property bool errorMode: advancedNetworkRoutingPage.errorMode
|
2022-10-17 10:17:25 +00:00
|
|
|
|
property bool interactive: true
|
2022-11-23 17:58:22 +00:00
|
|
|
|
property bool isBridgeTx: false
|
2022-11-25 09:13:02 +00:00
|
|
|
|
property bool showUnpreferredNetworks: advancedNetworkRoutingPage.showUnpreferredNetworks
|
2022-12-14 21:06:14 +00:00
|
|
|
|
property var toNetworksList: []
|
2022-12-19 13:02:56 +00:00
|
|
|
|
property int errorType: Constants.NoError
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
|
signal reCalculateSuggestedRoute()
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
2022-07-01 11:24:32 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
readonly property int backgroundRectRadius: 13
|
|
|
|
|
readonly property string backgroundRectColor: Theme.palette.indirectColor1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusSwitchTabBar {
|
|
|
|
|
id: tabBar
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
StatusSwitchTabButton {
|
|
|
|
|
text: qsTr("Simple")
|
|
|
|
|
}
|
|
|
|
|
StatusSwitchTabButton {
|
|
|
|
|
text: qsTr("Advanced")
|
|
|
|
|
}
|
2022-11-25 09:13:02 +00:00
|
|
|
|
StatusSwitchTabButton {
|
|
|
|
|
text: qsTr("Custom")
|
|
|
|
|
}
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
|
|
|
|
StackLayout {
|
|
|
|
|
id: stackLayout
|
2022-07-01 11:24:32 +00:00
|
|
|
|
anchors.top: tabBar.bottom
|
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
|
|
|
|
height: currentIndex == 0 ? networksSimpleRoutingPage.height + networksSimpleRoutingPage.anchors.margins + Style.current.bigPadding:
|
2022-11-25 09:13:02 +00:00
|
|
|
|
advancedNetworkRoutingPage.height + advancedNetworkRoutingPage.anchors.margins + Style.current.bigPadding
|
2022-05-19 08:53:57 +00:00
|
|
|
|
width: parent.width
|
2022-11-25 09:13:02 +00:00
|
|
|
|
currentIndex: tabBar.currentIndex === 0 ? 0 : 1
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
2022-07-01 11:24:32 +00:00
|
|
|
|
Rectangle {
|
|
|
|
|
id: simple
|
|
|
|
|
radius: d.backgroundRectRadius
|
|
|
|
|
color: d.backgroundRectColor
|
|
|
|
|
NetworksSimpleRoutingView {
|
|
|
|
|
id: networksSimpleRoutingPage
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.margins: Style.current.padding
|
2022-07-27 21:10:00 +00:00
|
|
|
|
width: stackLayout.width - Style.current.bigPadding
|
2022-10-17 10:17:25 +00:00
|
|
|
|
bestRoutes: root.bestRoutes
|
2022-11-23 17:58:22 +00:00
|
|
|
|
isBridgeTx: root.isBridgeTx
|
2022-07-01 11:24:32 +00:00
|
|
|
|
amountToSend: root.amountToSend
|
2022-10-17 10:17:25 +00:00
|
|
|
|
isLoading: root.isLoading
|
2022-11-23 17:58:22 +00:00
|
|
|
|
store: root.store
|
2022-12-09 09:10:05 +00:00
|
|
|
|
selectedAsset: root.selectedAsset
|
|
|
|
|
selectedAccount: root.selectedAccount
|
2022-11-25 09:13:02 +00:00
|
|
|
|
errorMode: root.errorMode
|
2022-12-19 13:02:56 +00:00
|
|
|
|
errorType: root.errorType
|
2022-12-14 21:06:14 +00:00
|
|
|
|
toNetworksList: root.toNetworksList
|
2022-10-17 10:17:25 +00:00
|
|
|
|
weiToEth: function(wei) {
|
2023-01-08 22:23:51 +00:00
|
|
|
|
return root.currencyStore.getCurrencyAmount(parseFloat(store.getWei2Eth(wei, selectedAsset.decimals)), selectedAsset.symbol)
|
2022-11-23 17:58:22 +00:00
|
|
|
|
}
|
|
|
|
|
reCalculateSuggestedRoute: function() {
|
|
|
|
|
root.reCalculateSuggestedRoute()
|
2022-05-19 08:53:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: advanced
|
|
|
|
|
radius: d.backgroundRectRadius
|
|
|
|
|
color: d.backgroundRectColor
|
|
|
|
|
NetworksAdvancedCustomRoutingView {
|
|
|
|
|
id: advancedNetworkRoutingPage
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.margins: Style.current.padding
|
|
|
|
|
store: root.store
|
2022-11-25 09:13:02 +00:00
|
|
|
|
customMode: tabBar.currentIndex === 2
|
2022-07-01 11:24:32 +00:00
|
|
|
|
selectedAccount: root.selectedAccount
|
2023-02-01 10:44:22 +00:00
|
|
|
|
ensAddressOrEmpty: root.ensAddressOrEmpty
|
2022-07-01 11:24:32 +00:00
|
|
|
|
amountToSend: root.amountToSend
|
|
|
|
|
requiredGasInEth: root.requiredGasInEth
|
|
|
|
|
selectedAsset: root.selectedAsset
|
2022-10-17 10:17:25 +00:00
|
|
|
|
onReCalculateSuggestedRoute: root.reCalculateSuggestedRoute()
|
|
|
|
|
bestRoutes: root.bestRoutes
|
|
|
|
|
isLoading: root.isLoading
|
|
|
|
|
interactive: root.interactive
|
2022-12-09 09:10:05 +00:00
|
|
|
|
isBridgeTx: root.isBridgeTx
|
2022-12-19 13:02:56 +00:00
|
|
|
|
errorType: root.errorType
|
2022-10-17 10:17:25 +00:00
|
|
|
|
weiToEth: function(wei) {
|
2023-01-08 22:23:51 +00:00
|
|
|
|
return root.currencyStore.getCurrencyAmount(parseFloat(store.getWei2Eth(wei, selectedAsset.decimals)), selectedAsset.symbol)
|
|
|
|
|
}
|
|
|
|
|
getCryptoCurrencyAmount: function(cryptoValue) {
|
|
|
|
|
return selectedAsset ? root.currencyStore.getCurrencyAmount(parseFloat(cryptoValue), selectedAsset.symbol) : undefined
|
2022-10-17 10:17:25 +00:00
|
|
|
|
}
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-19 08:53:57 +00:00
|
|
|
|
}
|
2022-07-27 21:10:00 +00:00
|
|
|
|
}
|