2024-05-27 19:50:16 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQml 2.15
|
|
|
|
import Qt.labs.settings 1.0
|
|
|
|
import QtTest 1.15
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
|
|
|
|
|
|
|
import Models 1.0
|
|
|
|
import Storybook 1.0
|
|
|
|
|
|
|
|
import shared.popups.walletconnect 1.0
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
import AppLayouts.Wallet.panels 1.0
|
2024-06-23 08:27:29 +00:00
|
|
|
import AppLayouts.Wallet.services.dapps.types 1.0
|
2024-05-27 19:50:16 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.stores 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
function openModal() {
|
2024-05-31 09:58:47 +00:00
|
|
|
modal.open()
|
2024-05-27 19:50:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// qml Splitter
|
|
|
|
SplitView {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
|
|
|
|
Component.onCompleted: root.openModal()
|
|
|
|
|
|
|
|
DAppRequestModal {
|
|
|
|
id: modal
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
dappName: settings.dappName
|
|
|
|
dappUrl: settings.dappUrl
|
|
|
|
dappIcon: settings.dappIcon
|
2024-06-12 13:48:44 +00:00
|
|
|
payloadData: d.currentPayload ? d.currentPayload.payloadData : null
|
|
|
|
method: d.currentPayload ? d.currentPayload.method : ""
|
|
|
|
maxFeesText: d.currentPayload ? d.currentPayload.maxFeesText : ""
|
2024-06-23 08:27:29 +00:00
|
|
|
maxFeesEthText: d.currentPayload ? d.currentPayload.maxFeesEthText : ""
|
|
|
|
enoughFunds: settings.enoughFunds
|
2024-06-12 13:48:44 +00:00
|
|
|
estimatedTimeText: d.currentPayload ? d.currentPayload.estimatedTimeText : ""
|
2024-05-27 19:50:16 +00:00
|
|
|
|
|
|
|
account: d.selectedAccount
|
|
|
|
network: d.selectedNetwork
|
|
|
|
|
|
|
|
onSign: {
|
|
|
|
console.log("Sign button clicked")
|
|
|
|
}
|
|
|
|
onReject: {
|
|
|
|
console.log("Reject button clicked")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
id: openButton
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.margins: 20
|
|
|
|
|
|
|
|
text: "Open DAppRequestModal"
|
|
|
|
|
|
|
|
onClicked: root.openModal()
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: optionsSpace
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: dappNameTextField
|
|
|
|
|
|
|
|
text: settings.dappName
|
|
|
|
onTextChanged: settings.dappName = text
|
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: dappUrlTextField
|
|
|
|
|
|
|
|
text: settings.dappUrl
|
|
|
|
onTextChanged: settings.dappUrl = text
|
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: dappIconTextField
|
|
|
|
|
|
|
|
text: settings.dappIcon
|
|
|
|
onTextChanged: settings.dappIcon = text
|
|
|
|
}
|
|
|
|
TextField {
|
|
|
|
id: accountDisplayTextField
|
|
|
|
|
|
|
|
text: settings.accountDisplay
|
|
|
|
onTextChanged: settings.accountDisplay = text
|
|
|
|
}
|
2024-06-12 13:48:44 +00:00
|
|
|
StatusComboBox {
|
|
|
|
id: methodsComboBox
|
|
|
|
|
|
|
|
model: d.methodsModel
|
|
|
|
control.textRole: "method"
|
|
|
|
currentIndex: settings.payloadMethod
|
|
|
|
onCurrentIndexChanged: {
|
|
|
|
d.currentPayload = null
|
|
|
|
settings.payloadMethod = currentIndex
|
|
|
|
d.currentPayload = d.payloadOptions[currentIndex]
|
|
|
|
}
|
|
|
|
}
|
2024-06-23 08:27:29 +00:00
|
|
|
StatusCheckBox {
|
|
|
|
id: enoughFundsCheckBox
|
|
|
|
|
|
|
|
text: "Enough funds"
|
|
|
|
checked: settings.enoughFunds
|
|
|
|
onCheckedChanged: settings.enoughFunds = checked
|
|
|
|
}
|
2024-05-27 19:50:16 +00:00
|
|
|
|
|
|
|
Item { Layout.fillHeight: true }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings {
|
|
|
|
id: settings
|
|
|
|
|
|
|
|
property string dappName: "OpenSea"
|
|
|
|
property string dappUrl: "opensea.io"
|
|
|
|
property string dappIcon: "https://opensea.io/static/images/logos/opensea-logo.svg"
|
|
|
|
property string accountDisplay: "helloworld"
|
2024-06-12 13:48:44 +00:00
|
|
|
property int payloadMethod: 0
|
2024-06-23 08:27:29 +00:00
|
|
|
property bool enoughFunds: true
|
2024-05-27 19:50:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
2024-06-12 13:48:44 +00:00
|
|
|
Component.onCompleted: methodsModel.append(payloadOptions)
|
|
|
|
|
2024-05-27 19:50:16 +00:00
|
|
|
readonly property var accountsModel: WalletAccountsModel{}
|
|
|
|
readonly property var selectedAccount: accountsModel.data[0]
|
|
|
|
|
|
|
|
readonly property var selectedNetwork: NetworksModel.flatNetworks.get(0)
|
|
|
|
|
2024-06-12 13:48:44 +00:00
|
|
|
readonly property ListModel methodsModel: ListModel {}
|
|
|
|
property var currentPayload: payloadOptions[settings.payloadMethod]
|
|
|
|
property string maxFeesText: ""
|
|
|
|
property string estimatedTimeText: ""
|
|
|
|
|
|
|
|
readonly property var payloadOptions: [
|
|
|
|
{
|
|
|
|
payloadData: {"message":"This is a message to sign.\nSigning this will prove ownership of the account."},
|
2024-06-23 08:27:29 +00:00
|
|
|
method: SessionRequest.methods.personalSign.name,
|
2024-06-12 13:48:44 +00:00
|
|
|
maxFeesText: "",
|
2024-06-23 08:27:29 +00:00
|
|
|
maxFeesEthText: "",
|
2024-06-12 13:48:44 +00:00
|
|
|
estimatedTimeText: ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
payloadData: {"message": "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"Person\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"wallet\",\"type\":\"address\"}],\"Mail\":[{\"name\":\"from\",\"type\":\"Person\"},{\"name\":\"to\",\"type\":\"Person\"},{\"name\":\"contents\",\"type\":\"string\"}]},\"primaryType\":\"Mail\",\"domain\":{\"name\":\"Ether Mail\",\"version\":\"1\",\"chainId\":1,\"verifyingContract\":\"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\"},\"message\":{\"from\":{\"name\":\"Cow\",\"wallet\":\"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826\"},\"to\":{\"name\":\"Bob\",\"wallet\":\"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\"},\"contents\":\"Hello, Bob!\"}}"},
|
2024-06-23 08:27:29 +00:00
|
|
|
method: SessionRequest.methods.signTypedData_v4.name,
|
2024-06-12 13:48:44 +00:00
|
|
|
maxFeesText: "",
|
2024-06-23 08:27:29 +00:00
|
|
|
maxFeesEthText: "",
|
2024-06-12 13:48:44 +00:00
|
|
|
estimatedTimeText: ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
payloadData: {"tx":{"data":"0x","from":"0xE2d622C817878dA5143bBE06866ca8E35273Ba8a","gasLimit":"0x5208","gasPrice":"0x048ddbc5","nonce":"0x2a","to":"0xE2d622C817878dA5143bBE06866ca8E35273Ba8a","value":"0x00"}},
|
2024-06-23 08:27:29 +00:00
|
|
|
method: SessionRequest.methods.signTransaction.name,
|
2024-06-12 13:48:44 +00:00
|
|
|
maxFeesText: "1.82 EUR",
|
2024-06-23 08:27:29 +00:00
|
|
|
maxFeesEthText: "0.0001 ETH",
|
2024-06-12 13:48:44 +00:00
|
|
|
estimatedTimeText: "3-5 mins"
|
2024-06-23 08:27:29 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
payloadData: {"tx":{"data":"0x","from":"0xE2d622C817878dA5143bBE06866ca8E35273Ba8a","gasLimit":"0x5208","gasPrice":"0x048ddbc5","nonce":"0x2a","to":"0xE2d622C817878dA5143bBE06866ca8E35273Ba8a","value":"0x00"}},
|
|
|
|
method: SessionRequest.methods.sendTransaction.name,
|
|
|
|
maxFeesText: "0.92 EUR",
|
|
|
|
maxFeesEthText: "0.00005 ETH",
|
|
|
|
estimatedTimeText: "1-2 mins"
|
2024-06-12 13:48:44 +00:00
|
|
|
}
|
|
|
|
]
|
2024-05-27 19:50:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// category: Wallet
|