2022-03-07 09:33:38 +00:00
|
|
|
import QtQuick 2.13
|
2023-07-18 09:10:48 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
2022-07-28 20:56:44 +00:00
|
|
|
|
2022-03-07 09:33:38 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2023-07-18 09:10:48 +00:00
|
|
|
import StatusQ.Core 0.1
|
2022-03-07 09:33:38 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-07-18 09:10:48 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
|
|
|
|
|
|
|
import AppLayouts.Wallet 1.0
|
2023-07-21 08:41:24 +00:00
|
|
|
import AppLayouts.Wallet.controls 1.0
|
2023-07-28 07:57:58 +00:00
|
|
|
import AppLayouts.Profile.popups 1.0
|
2022-07-28 20:56:44 +00:00
|
|
|
|
2023-08-23 11:46:04 +00:00
|
|
|
import shared.controls 1.0
|
2022-07-28 20:56:44 +00:00
|
|
|
import shared.popups 1.0
|
2023-07-18 09:10:48 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import utils 1.0
|
2022-03-07 09:33:38 +00:00
|
|
|
|
2023-07-21 08:41:24 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
import "../../controls"
|
2022-03-07 09:33:38 +00:00
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
ColumnLayout {
|
2022-03-07 09:33:38 +00:00
|
|
|
id: root
|
2023-07-14 12:06:41 +00:00
|
|
|
|
2022-03-07 09:33:38 +00:00
|
|
|
signal goBack
|
2023-07-28 07:57:58 +00:00
|
|
|
signal runRenameKeypairFlow()
|
|
|
|
signal runRemoveKeypairFlow()
|
2023-08-23 07:09:50 +00:00
|
|
|
signal runImportMissingKeypairFlow()
|
2023-08-25 09:05:05 +00:00
|
|
|
signal runMoveKeypairToKeycardFlow()
|
2023-08-29 14:22:41 +00:00
|
|
|
signal runStopUsingKeycardFlow()
|
2023-10-10 15:46:43 +00:00
|
|
|
signal updateWatchAccountHiddenFromTotalBalance(string address, bool hideFromTotalBalance)
|
2022-03-07 09:33:38 +00:00
|
|
|
|
2023-04-17 11:36:40 +00:00
|
|
|
property var account
|
2023-07-18 09:10:48 +00:00
|
|
|
property var keyPair
|
|
|
|
property var walletStore
|
|
|
|
property var emojiPopup
|
|
|
|
property string userProfilePublicKey
|
2022-03-07 09:33:38 +00:00
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
2023-08-04 10:29:04 +00:00
|
|
|
readonly property bool watchOnlyAccount: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.watchOnly: false
|
|
|
|
readonly property bool privateKeyAccount: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.privateKeyImport: false
|
2023-12-11 12:58:15 +00:00
|
|
|
readonly property bool seedImport: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.seedImport: false
|
2023-08-04 10:29:04 +00:00
|
|
|
readonly property string preferredSharingNetworks: !!root.account? root.account.preferredSharingChainIds: ""
|
2024-06-15 21:33:12 +00:00
|
|
|
property var preferredSharingNetworksArray: preferredSharingNetworks.split(":").filter(Boolean).map(Number)
|
2023-07-28 07:57:58 +00:00
|
|
|
property string preferredSharingNetworkShortNames: walletStore.getNetworkShortNames(preferredSharingNetworks)
|
2023-07-18 09:10:48 +00:00
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
spacing: 0
|
2022-07-19 13:45:27 +00:00
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
2022-03-10 17:01:17 +00:00
|
|
|
spacing: Style.current.smallPadding
|
2023-07-18 09:10:48 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: accountName
|
|
|
|
objectName: "walletAccountViewAccountName"
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
2023-08-04 10:29:04 +00:00
|
|
|
text: !!root.account? root.account.name : ""
|
2023-07-18 09:10:48 +00:00
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 28
|
2023-08-04 10:29:04 +00:00
|
|
|
color: !!root.account? Utils.getColorForId(root.account.colorId) : Theme.palette.directColor1
|
2023-07-18 09:10:48 +00:00
|
|
|
}
|
|
|
|
StatusEmoji {
|
2022-03-07 09:33:38 +00:00
|
|
|
id: accountImage
|
2022-08-10 09:23:06 +00:00
|
|
|
objectName: "walletAccountViewAccountImage"
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.preferredWidth: 28
|
|
|
|
Layout.preferredHeight: 28
|
2023-08-04 10:29:04 +00:00
|
|
|
emojiId: StatusQUtils.Emoji.iconId(!!root.account && root.account.emoji ? root.account.emoji : "", StatusQUtils.Emoji.size.big) || ""
|
2022-03-10 17:01:17 +00:00
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
}
|
|
|
|
StatusButton {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
objectName: "walletAccountViewEditAccountButton"
|
2023-12-08 08:41:39 +00:00
|
|
|
text: d.watchOnlyAccount ? qsTr("Edit watched address") : qsTr("Edit account")
|
2023-07-18 09:10:48 +00:00
|
|
|
icon.name: "edit_pencil"
|
|
|
|
onClicked: Global.openPopup(renameAccountModalComponent)
|
|
|
|
}
|
|
|
|
}
|
2022-08-03 12:51:47 +00:00
|
|
|
|
2023-08-23 11:46:04 +00:00
|
|
|
ImportKeypairInfo {
|
2023-08-23 07:09:50 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Style.current.bigPadding
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
|
|
|
visible: !!root.keyPair && root.keyPair.operability === Constants.keypair.operability.nonOperable
|
|
|
|
|
2023-08-23 11:46:04 +00:00
|
|
|
onRunImport: {
|
|
|
|
root.runImportMissingKeypairFlow()
|
2023-08-23 07:09:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
StatusBaseText {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "AccountDetails_TextLabel"
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.topMargin: Style.current.bigPadding
|
|
|
|
text: qsTr("Account details")
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
2022-08-03 12:51:47 +00:00
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
Rectangle {
|
|
|
|
Layout.topMargin: Style.current.halfPadding
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
|
|
|
radius: Style.current.radius
|
|
|
|
border.width: 1
|
|
|
|
border.color: Theme.palette.directColor8
|
|
|
|
color: Theme.palette.transparent
|
2022-08-03 12:51:47 +00:00
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width
|
|
|
|
spacing: 0
|
|
|
|
WalletAccountDetailsListItem {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "Balance_ListItem"
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
title: qsTr("Balance")
|
2023-08-04 10:29:04 +00:00
|
|
|
subTitle: !!root.account && root.account.balance ? LocaleUtils.currencyAmountToLocaleString(root.account.balance): ""
|
2023-07-18 09:10:48 +00:00
|
|
|
}
|
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
}
|
|
|
|
WalletAccountDetailsListItem {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "Address_ListItem"
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.fillWidth: true
|
2023-07-28 07:57:58 +00:00
|
|
|
isInteractive: true
|
|
|
|
moreButtonEnabled: true
|
2023-07-18 09:10:48 +00:00
|
|
|
title: qsTr("Address")
|
|
|
|
subTitle: {
|
2023-08-04 10:29:04 +00:00
|
|
|
let address = !!root.account && root.account.address ? root.account.address: ""
|
2023-07-28 07:57:58 +00:00
|
|
|
return WalletUtils.colorizedChainPrefix(d.preferredSharingNetworkShortNames) + address
|
2022-03-07 09:33:38 +00:00
|
|
|
}
|
2023-07-28 07:57:58 +00:00
|
|
|
onButtonClicked: addressMenu.openMenu(this)
|
2022-03-07 09:33:38 +00:00
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "Keypair_TextLabel"
|
2024-06-07 13:29:09 +00:00
|
|
|
text: qsTr("Key pair")
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.leftMargin: 16
|
|
|
|
Layout.topMargin: 12
|
|
|
|
font.pixelSize: 13
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
visible: !d.watchOnlyAccount
|
|
|
|
}
|
|
|
|
WalletAccountDetailsKeypairItem {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "KeyPair_Item"
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
keyPair: root.keyPair
|
|
|
|
visible: !d.watchOnlyAccount
|
2023-07-28 07:57:58 +00:00
|
|
|
onButtonClicked: keycardMenu.popup(this, this.width - 40, this.height / 2 + 20)
|
2023-07-18 09:10:48 +00:00
|
|
|
}
|
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
visible: !d.watchOnlyAccount
|
|
|
|
}
|
|
|
|
WalletAccountDetailsListItem {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "Origin_ListItem"
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
title: qsTr("Origin")
|
|
|
|
subTitle: {
|
2023-08-04 10:29:04 +00:00
|
|
|
if(!!root.keyPair) {
|
|
|
|
switch(root.keyPair.pairType) {
|
|
|
|
case Constants.keypair.type.profile:
|
2024-06-07 13:29:09 +00:00
|
|
|
return qsTr("Derived from your default Status key pair")
|
2023-08-04 10:29:04 +00:00
|
|
|
case Constants.keypair.type.seedImport:
|
2023-07-18 09:10:48 +00:00
|
|
|
return qsTr("Imported from seed phrase")
|
2023-08-04 10:29:04 +00:00
|
|
|
case Constants.keypair.type.privateKeyImport:
|
2023-07-18 09:10:48 +00:00
|
|
|
return qsTr("Imported from private key")
|
2023-08-04 10:29:04 +00:00
|
|
|
case Constants.keypair.type.watchOnly:
|
2023-07-18 09:10:48 +00:00
|
|
|
return qsTr("Watched address")
|
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
return ""
|
2022-03-07 09:33:38 +00:00
|
|
|
}
|
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
}
|
|
|
|
WalletAccountDetailsListItem {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "DerivationPath_ListItem"
|
2023-07-18 09:10:48 +00:00
|
|
|
id: derivationPath
|
|
|
|
Layout.fillWidth: true
|
2023-07-28 07:57:58 +00:00
|
|
|
isInteractive: true
|
|
|
|
copyButtonEnabled: true
|
2023-07-18 09:10:48 +00:00
|
|
|
title: qsTr("Derivation Path")
|
2023-08-04 10:29:04 +00:00
|
|
|
subTitle: !!root.account? Utils.getPathForDisplay(root.account.path) : ""
|
|
|
|
onCopyClicked: root.walletStore.copyToClipboard(!!root.account? root.account.path : "")
|
2023-07-21 08:41:24 +00:00
|
|
|
visible: !!subTitle && !d.privateKeyAccount && !d.watchOnlyAccount
|
2023-07-18 09:10:48 +00:00
|
|
|
}
|
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
visible: derivationPath.visible
|
|
|
|
}
|
|
|
|
WalletAccountDetailsListItem {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "Stored_ListItem"
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
title: qsTr("Stored")
|
2023-10-05 15:16:30 +00:00
|
|
|
subTitle: Utils.getKeypairLocation(root.keyPair, true)
|
2023-11-03 08:41:30 +00:00
|
|
|
visible: !!subTitle
|
2023-08-04 10:29:04 +00:00
|
|
|
statusListItemSubTitle.color: Utils.getKeypairLocationColor(root.keyPair)
|
2022-07-19 13:45:27 +00:00
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
Separator {
|
|
|
|
Layout.topMargin: 40
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
}
|
|
|
|
|
2023-07-21 08:41:24 +00:00
|
|
|
StatusListItem {
|
2023-07-18 09:10:48 +00:00
|
|
|
Layout.fillWidth: true
|
2024-04-26 10:14:44 +00:00
|
|
|
title: qsTr("Include in total balances and activity")
|
2023-11-09 09:57:46 +00:00
|
|
|
objectName: "includeTotalBalanceListItem"
|
2023-10-10 15:46:43 +00:00
|
|
|
visible: d.watchOnlyAccount
|
|
|
|
color: Theme.palette.transparent
|
|
|
|
components: [
|
|
|
|
StatusSwitch {
|
|
|
|
checked: !!root.account && !account.hideFromTotalBalance
|
|
|
|
onToggled: root.updateWatchAccountHiddenFromTotalBalance(account.address, !checked)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
visible: d.watchOnlyAccount
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusListItem {
|
2023-10-20 07:42:07 +00:00
|
|
|
objectName: "PreferredNetworks_ListItem"
|
2023-10-10 15:46:43 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Style.current.halfPadding
|
2023-07-21 08:41:24 +00:00
|
|
|
title: qsTr("Preferred networks when sharing this address")
|
|
|
|
color: Theme.palette.transparent
|
|
|
|
components: [
|
|
|
|
NetworkFilter {
|
2024-03-20 17:29:45 +00:00
|
|
|
flatNetworks: root.walletStore.filteredFlatModel
|
2024-06-15 21:33:12 +00:00
|
|
|
multiSelection: true
|
|
|
|
selection: d.preferredSharingNetworksArray
|
|
|
|
|
|
|
|
onSelectionChanged: {
|
|
|
|
if (selection !== d.preferredSharingNetworksArray) {
|
|
|
|
d.preferredSharingNetworksArray = selection
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-04 10:29:04 +00:00
|
|
|
control.popup.onClosed: {
|
|
|
|
if (!!root.account) {
|
|
|
|
root.walletStore.updateWalletAccountPreferredChains(root.account.address, d.preferredSharingNetworksArray.join(":"))
|
|
|
|
}
|
|
|
|
}
|
2023-07-21 08:41:24 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.fillWidth: true
|
|
|
|
objectName: "deleteAccountButton"
|
|
|
|
visible: !!root.account && !root.account.isDefaultAccount
|
2023-12-08 08:41:39 +00:00
|
|
|
text: d.watchOnlyAccount ? qsTr("Remove watched address") : qsTr("Remove account")
|
2023-07-21 08:41:24 +00:00
|
|
|
icon.name: "delete"
|
|
|
|
type: StatusBaseButton.Type.Danger
|
|
|
|
onClicked: confirmationPopup.open()
|
|
|
|
|
2023-12-11 12:58:15 +00:00
|
|
|
RemoveAccountConfirmationPopup {
|
2023-07-21 08:41:24 +00:00
|
|
|
id: confirmationPopup
|
2023-12-11 12:58:15 +00:00
|
|
|
accountType: {
|
|
|
|
if (d.watchOnlyAccount) {
|
|
|
|
return Constants.watchWalletType
|
|
|
|
} else if (d.privateKeyAccount) {
|
|
|
|
return Constants.keyWalletType
|
|
|
|
} else if (d.seedImport){
|
|
|
|
return Constants.seedWalletType
|
|
|
|
} else {
|
|
|
|
return Constants.generatedWalletType
|
2023-08-04 10:29:04 +00:00
|
|
|
}
|
2023-12-11 12:58:15 +00:00
|
|
|
}
|
|
|
|
accountName: !!root.account ? root.account.name : ""
|
|
|
|
accountAddress: !!root.account ? root.account.address : ""
|
|
|
|
accountDerivationPath: !!root.account ? root.account.path : ""
|
|
|
|
preferredSharingNetworkShortNames: d.preferredSharingNetworkShortNames
|
|
|
|
emoji: !!root.account ? root.account.emoji : ""
|
|
|
|
color: !!root.account ? Utils.getColorForId(root.account.colorId) : ""
|
|
|
|
|
|
|
|
onRemoveAccount: {
|
|
|
|
root.walletStore.deleteAccount(root.account.address)
|
|
|
|
close()
|
2023-07-21 08:41:24 +00:00
|
|
|
root.goBack()
|
2022-03-07 09:33:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-21 08:41:24 +00:00
|
|
|
|
2022-03-10 17:01:17 +00:00
|
|
|
Component {
|
|
|
|
id: renameAccountModalComponent
|
|
|
|
RenameAccontModal {
|
2023-04-17 11:36:40 +00:00
|
|
|
account: root.account
|
2022-03-10 17:01:17 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
onClosed: destroy()
|
|
|
|
walletStore: root.walletStore
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
}
|
|
|
|
}
|
2023-07-28 07:57:58 +00:00
|
|
|
|
|
|
|
WalletAddressMenu {
|
|
|
|
id: addressMenu
|
2024-01-15 09:19:25 +00:00
|
|
|
selectedAccount: root.account
|
2023-07-28 07:57:58 +00:00
|
|
|
areTestNetworksEnabled: root.walletStore.areTestNetworksEnabled
|
2024-02-20 09:31:04 +00:00
|
|
|
isGoerliEnabled: root.walletStore.isGoerliEnabled
|
2024-01-15 12:27:47 +00:00
|
|
|
preferredSharedNetworkNamesArray: d.preferredSharingNetworkShortNames.split(":").filter(Boolean)
|
2023-07-28 07:57:58 +00:00
|
|
|
onCopyToClipboard: root.walletStore.copyToClipboard(address)
|
|
|
|
}
|
|
|
|
|
2023-08-04 10:29:04 +00:00
|
|
|
WalletKeypairAccountMenu {
|
2023-07-28 07:57:58 +00:00
|
|
|
id: keycardMenu
|
|
|
|
keyPair: root.keyPair
|
2023-08-21 10:58:21 +00:00
|
|
|
hasPairedDevices: root.walletStore.walletModule.hasPairedDevices
|
2023-07-28 07:57:58 +00:00
|
|
|
onRunRenameKeypairFlow: root.runRenameKeypairFlow()
|
|
|
|
onRunRemoveKeypairFlow: root.runRemoveKeypairFlow()
|
2023-08-25 09:05:05 +00:00
|
|
|
onRunMoveKeypairToKeycardFlow: root.runMoveKeypairToKeycardFlow()
|
2023-08-29 14:22:41 +00:00
|
|
|
onRunStopUsingKeycardFlow: root.runStopUsingKeycardFlow()
|
2023-07-28 07:57:58 +00:00
|
|
|
}
|
2022-03-10 17:01:17 +00:00
|
|
|
}
|