2023-05-10 11:05:45 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
2023-11-28 19:16:18 +00:00
|
|
|
import StatusQ 0.1
|
2023-09-26 13:45:44 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2023-05-10 11:05:45 +00:00
|
|
|
import Storybook 1.0
|
|
|
|
import utils 1.0
|
|
|
|
|
2023-09-05 15:27:30 +00:00
|
|
|
import shared.popups.send 1.0
|
2023-05-10 11:05:45 +00:00
|
|
|
import shared.stores 1.0
|
2023-09-15 08:51:06 +00:00
|
|
|
import shared.stores.send 1.0
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-11-28 19:16:18 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
import AppLayouts.Wallet.stores 1.0
|
|
|
|
|
2023-05-10 11:05:45 +00:00
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
orientation: Qt.Horizontal
|
|
|
|
|
2023-11-28 19:16:18 +00:00
|
|
|
property WalletAssetsStore walletAssetStore: WalletAssetsStore {
|
|
|
|
assetsWithFilteredBalances: root.assetsWithFilteredBalances
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
property SubmodelProxyModel assetsWithFilteredBalances: SubmodelProxyModel {
|
|
|
|
sourceModel: root.walletAssetStore.groupedAccountsAssetsModel
|
|
|
|
submodelRoleName: "balances"
|
|
|
|
delegateModel: SortFilterProxyModel {
|
|
|
|
sourceModel: submodel
|
2024-01-30 13:15:58 +00:00
|
|
|
filters: FastExpressionFilter {
|
|
|
|
expression: txStore.selectedSenderAccount.address === model.account
|
|
|
|
expectedRoles: ["account"]
|
2023-11-28 19:16:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
TransactionStore {
|
|
|
|
id: txStore
|
2023-11-28 19:16:18 +00:00
|
|
|
walletAssetStore: root.walletAssetStore
|
2024-01-30 13:15:58 +00:00
|
|
|
showCommunityAssetsInSend: showCommunityAssetsCheckBox.checked
|
|
|
|
balanceThresholdEnabled: balanceThresholdCheckbox.checked
|
|
|
|
balanceThresholdAmount: Number(balanceThresholdValue.text)
|
2023-09-26 13:45:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: dummyEventData
|
|
|
|
|
|
|
|
property ListModel toModel: ListModel {
|
|
|
|
ListElement {
|
|
|
|
chainId: 420
|
|
|
|
chainName: "Optimism"
|
|
|
|
iconUrl: "network/Network=Optimism"
|
|
|
|
amountOut: "3003845308235848343"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
property var suggestesRoutes: [{
|
|
|
|
bridgeName:"Hop",
|
|
|
|
fromNetwork: 1,
|
|
|
|
toNetwork: 10,
|
|
|
|
maxAmountIn:"2649485258572837546",
|
|
|
|
amountIn:"200000000000000000",
|
|
|
|
amountOut:"200000000000000000",
|
|
|
|
gasAmount:501000,
|
|
|
|
gasFees: {
|
|
|
|
gasPrice:1.7e-08,
|
|
|
|
baseFee:1.0,
|
|
|
|
maxPriorityFeePerGas:2e-09,
|
|
|
|
maxFeePerGasL:1.1e-08,
|
|
|
|
maxFeePerGasM:1.0,
|
|
|
|
maxFeePerGasH:2.0,
|
|
|
|
eip1559Enabled:true
|
|
|
|
},
|
|
|
|
tokenFees:-0.004508663259772343,
|
|
|
|
cost:-6.39534887667951,
|
|
|
|
estimatedTime:1,
|
|
|
|
amountInLocked:false,
|
|
|
|
isFirstSimpleTx:true,
|
|
|
|
isFirstBridgeTx:true,
|
|
|
|
approvalRequired:false,
|
|
|
|
approvalGasFees:0.0,
|
|
|
|
approvalAmountRequired:"0",
|
|
|
|
approvalContractAddress:""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
bridgeName:"Transfer",
|
|
|
|
fromNetwork: 10,
|
|
|
|
toNetwork:10,
|
|
|
|
maxAmountIn:"443890157817650036",
|
|
|
|
amountIn:"200000000000000000",
|
|
|
|
amountOut:"200000000000000000",
|
|
|
|
gasAmount:22000,
|
|
|
|
gasFees:{
|
|
|
|
gasPrice:0.10000005,
|
|
|
|
baseFee:4.4e-08,
|
|
|
|
maxPriorityFeePerGas:0.1,
|
|
|
|
maxFeePerGasL:5e-08,
|
|
|
|
maxFeePerGasM:0.1,
|
|
|
|
maxFeePerGasH:0.2,
|
|
|
|
eip1559Enabled:true
|
|
|
|
},
|
|
|
|
tokenFees:0.0,
|
|
|
|
bonderFees:"0x0",
|
|
|
|
cost:0.003510716,
|
|
|
|
estimatedTime:1,
|
|
|
|
amountInLocked:false,
|
|
|
|
isFirstSimpleTx:false,
|
|
|
|
isFirstBridgeTx:false,
|
|
|
|
approvalRequired:false,
|
|
|
|
approvalGasFees:0.0,
|
|
|
|
approvalAmountRequired:"0",
|
|
|
|
approvalContractAddress:""
|
|
|
|
}]
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
|
|
|
Item {
|
2023-09-26 13:45:44 +00:00
|
|
|
anchors.left: parent.left
|
2023-05-10 11:05:45 +00:00
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
color: "lightgray"
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: loader
|
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
property var preSelectedAccount: txStore.selectedSenderAccount
|
|
|
|
property string preSelectedHoldingID
|
2023-11-07 22:45:47 +00:00
|
|
|
property int preSelectedHoldingType: Constants.TokenType.Unknown
|
2023-09-26 13:45:44 +00:00
|
|
|
property int preSelectedSendType: Constants.SendType.Unknown
|
|
|
|
property bool onlyAssets: false
|
|
|
|
property string preDefinedAmountToSend
|
|
|
|
property string preSelectedRecipient
|
|
|
|
|
2023-05-10 11:05:45 +00:00
|
|
|
active: false
|
|
|
|
|
|
|
|
sourceComponent: SendModal {
|
|
|
|
visible: true
|
|
|
|
modal: false
|
|
|
|
closePolicy: Popup.NoAutoClose
|
2023-09-11 10:20:36 +00:00
|
|
|
onlyAssets: false
|
2023-09-26 13:45:44 +00:00
|
|
|
store: txStore
|
|
|
|
preSelectedAccount: loader.preSelectedAccount
|
|
|
|
preDefinedAmountToSend: loader.preDefinedAmountToSend
|
|
|
|
preSelectedRecipient: loader.preSelectedRecipient
|
|
|
|
preSelectedSendType: loader.preSelectedSendType
|
|
|
|
preSelectedHoldingID: loader.preSelectedHoldingID
|
|
|
|
preSelectedHoldingType: loader.preSelectedHoldingType
|
|
|
|
}
|
|
|
|
Component.onCompleted: loader.active = true
|
|
|
|
}
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
LogsAndControlsPanel {
|
|
|
|
SplitView.minimumHeight: 100
|
|
|
|
SplitView.preferredHeight: 100
|
2023-05-10 11:05:45 +00:00
|
|
|
|
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width
|
|
|
|
spacing: 20
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
Layout.topMargin: 20
|
|
|
|
width: parent.width
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
text: "This button can be used as respons eot the suggestedROutes API called once a token and its amount is selected along with a valid recipient."
|
|
|
|
color: "orange"
|
|
|
|
wrapMode: Text.WrapAnywhere
|
|
|
|
}
|
|
|
|
StatusButton {
|
|
|
|
enabled: txStore.suggestedRoutesCalled
|
|
|
|
text: "emit suggestedRoutesReady"
|
|
|
|
onClicked: {
|
|
|
|
let txRoutes = {
|
|
|
|
suggestedRoutes: dummyEventData.suggestesRoutes,
|
|
|
|
gasTimeEstimate:{
|
|
|
|
totalFeesInEth:0.0005032000000000001,
|
|
|
|
totalTokenFees:-0.004508663259772343,
|
|
|
|
totalTime:2
|
|
|
|
},
|
|
|
|
amountToReceive: txStore.amountToSend - (txStore.amountToSend*5/100),
|
|
|
|
toNetworksModel: dummyEventData.toModel
|
2023-05-10 11:05:45 +00:00
|
|
|
}
|
2023-09-26 13:45:44 +00:00
|
|
|
txStore.fromNetworksModel.updateFromNetworks(dummyEventData.suggestesRoutes)
|
|
|
|
txStore.toNetworksModel.updateToNetworks(dummyEventData.suggestesRoutes)
|
|
|
|
txStore.walletSectionSendInst.suggestedRoutesReady(txRoutes)
|
|
|
|
txStore.suggestedRoutesCalled = false
|
2023-05-10 11:05:45 +00:00
|
|
|
}
|
2023-09-26 13:45:44 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: "grey"
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
StatusBaseText {
|
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
text: "Note: After filling in the preSelected inputs you need to reload the SendModal as per current implementation"
|
|
|
|
color: "orange"
|
|
|
|
wrapMode: Text.WrapAnywhere
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
StatusBaseText {
|
|
|
|
text:"preSelectedAccount"
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
textRole: "name"
|
2024-07-03 03:55:05 +00:00
|
|
|
model: txStore.accounts
|
|
|
|
onCurrentIndexChanged: loader.preSelectedAccount = txStore.accounts.get(currentIndex)
|
2023-09-26 13:45:44 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
StatusBaseText {
|
|
|
|
text:"preSelectedHoldingType"
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
id: tokenType
|
2023-11-07 22:45:47 +00:00
|
|
|
model: ["Native", "Asset", "Collectible", "Fungible Token", "Unknown", "ENS"]
|
|
|
|
currentIndex: 4
|
|
|
|
onCurrentIndexChanged: {
|
|
|
|
loader.preSelectedHoldingType = currentIndex
|
|
|
|
}
|
2023-09-26 13:45:44 +00:00
|
|
|
}
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
StatusInput {
|
2023-11-07 22:45:47 +00:00
|
|
|
enabled: tokenType.currentIndex > 0 && tokenType.currentIndex < 3
|
2023-09-26 13:45:44 +00:00
|
|
|
label: "preSelectedHoldingID (case sensitive)"
|
|
|
|
onTextChanged: loader.preSelectedHoldingID = text
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
StatusInput {
|
|
|
|
label: "preDefinedAmountToSend"
|
|
|
|
onTextChanged: loader.preDefinedAmountToSend = text
|
2023-05-10 11:05:45 +00:00
|
|
|
}
|
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
StatusBaseText {
|
|
|
|
text:"preSelectedSendType"
|
2023-05-10 11:05:45 +00:00
|
|
|
}
|
2023-09-26 13:45:44 +00:00
|
|
|
ComboBox {
|
|
|
|
model: ["Transfer",
|
|
|
|
"ENSRegister",
|
|
|
|
"ENSRelease",
|
|
|
|
"ENSSetPubKey",
|
|
|
|
"StickersBuy",
|
|
|
|
"Bridge",
|
|
|
|
"ERC721Transfer",
|
|
|
|
"Unknown"]
|
|
|
|
onCurrentIndexChanged: loader.preSelectedSendType = currentIndex
|
|
|
|
}
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
StatusInput {
|
|
|
|
label: "preSelectedRecipient"
|
|
|
|
onTextChanged: loader.preSelectedRecipient = text
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
StatusButton {
|
|
|
|
text: "Reload popup"
|
|
|
|
onClicked: {
|
|
|
|
loader.item.close()
|
|
|
|
loader.item.open()
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
}
|
2024-01-30 13:15:58 +00:00
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: showCommunityAssetsCheckBox
|
|
|
|
text: "Show community assets when sending tokens"
|
|
|
|
checked: true
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: balanceThresholdCheckbox
|
|
|
|
text: "Turn on balance threshold"
|
|
|
|
checked: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
border.width: 1
|
|
|
|
Layout.preferredWidth: 100
|
|
|
|
Layout.preferredHeight: 50
|
|
|
|
color: "lightgrey"
|
|
|
|
TextInput {
|
|
|
|
id: balanceThresholdValue
|
|
|
|
anchors.fill: parent
|
|
|
|
enabled: balanceThresholdCheckbox.checked
|
|
|
|
text: "0.10"
|
|
|
|
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
|
|
|
}
|
|
|
|
}
|
2023-05-10 11:05:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Popups
|