feat(@desktop/wallet): remove address prefixes from wallet account settings

This commit is contained in:
Khushboo Mehta 2024-10-02 19:50:08 +02:00 committed by Khushboo-dev-cpp
parent d6031f8126
commit 60fb566580
10 changed files with 9 additions and 74 deletions

View File

@ -66,10 +66,6 @@ SplitView {
function getAllNetworksChainIds() {
return "1:10:42161"
}
function updateWalletAccountPreferredChains(address, preferredChainIds) {
console.warn("updateWalletAccountPreferredChains :: address ::", address, "preferredChainIds :: ", preferredChainIds)
}
}
property var keyPairModel: WalletKeyPairModel {}

View File

@ -3,6 +3,7 @@ import QtQuick 2.14
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
import AppLayouts.Wallet 1.0
@ -12,7 +13,6 @@ StatusListItem {
id: root
property var account
property var getNetworkShortNames: function(chainIds){}
property int totalCount: 0
property bool nextIconVisible: true
@ -20,7 +20,8 @@ StatusListItem {
objectName: account.name
title: account.name
subTitle: WalletUtils.addressToDisplay(account.address, root.getNetworkShortNames(account.preferredSharingChainIds), true, sensor.containsMouse)
subTitle: SQUtils.Utils.elideText(account.address, 6, 4)
statusListItemSubTitle.customColor: sensor.containsMouse ? Theme.palette.directColor1 : Theme.palette.baseColor1
asset.color: !!account.colorId ? Utils.getColorForId(account.colorId): ""
asset.emoji: account.emoji
asset.name: !account.emoji ? "filled-account": ""

View File

@ -21,6 +21,7 @@ StatusListItem {
readonly property var timer: Timer {}
}
sensor.enabled: isInteractive
statusListItemTitle.customColor: Theme.palette.baseColor1
statusListItemTitle.font.pixelSize: 13
statusListItemTitle.lineHeightMode: Text.FixedHeight

View File

@ -16,7 +16,6 @@ Rectangle {
property var keyPair
property bool hasPairedDevices
property var getNetworkShortNames: function(chainIds){}
property string userProfilePublicKey
signal goToAccountView(var account)
@ -112,7 +111,6 @@ Rectangle {
width: ListView.view.width
account: model.account
totalCount: ListView.view.count
getNetworkShortNames: root.getNetworkShortNames
onGoToAccountView: root.goToAccountView(model.account)
RowLayout {

View File

@ -19,7 +19,6 @@ StatusDialog {
property string name
property var relatedAccounts
property var getNetworkShortNames: function(chainIds){}
signal confirmClicked()
@ -68,7 +67,6 @@ StatusDialog {
id: delegate
width: parent.width
account : model.account
getNetworkShortNames: root.getNetworkShortNames
color: Theme.palette.transparent
nextIconVisible: false
components: StatusBaseText {

View File

@ -26,11 +26,9 @@ StatusMenu {
name: "",
emoji: "",
colorId: "",
preferredSharingChainIds: ""
})
property bool areTestNetworksEnabled: false
property bool isGoerliEnabled: false
property var preferredSharedNetworkNamesArray
signal copyToClipboard(string address)
@ -42,7 +40,6 @@ StatusMenu {
StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.mainnet)
enabled: root.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.mainnet)
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.mainnet, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "")
@ -52,7 +49,6 @@ StatusMenu {
StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.arbitrum)
enabled: root.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.arbitrum)
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.arbitrum, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "")
@ -62,7 +58,6 @@ StatusMenu {
StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.optimism)
enabled: root.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.optimism)
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.optimism, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "")
@ -89,8 +84,7 @@ StatusMenu {
name: root.selectedAccount.name?? "",
address: root.selectedAccount.address?? "",
emoji: root.selectedAccount.emoji?? "",
colorId: root.selectedAccount.colorId?? "",
preferredSharingChainIds: root.selectedAccount.preferredSharingChainIds?? ""
colorId: root.selectedAccount.colorId?? ""
})
}
}

View File

@ -163,15 +163,6 @@ QtObject {
networksModuleInst.updateNetworkEndPointValues(chainId, testNetwork, newMainRpcInput, newFailoverRpcUrl, revertToDefault)
}
function updateWalletAccountPreferredChains(address, preferredChainIds) {
if(areTestNetworksEnabled) {
accountsModule.updateWalletAccountTestPreferredChains(address, preferredChainIds)
}
else {
accountsModule.updateWalletAccountProdPreferredChains(address, preferredChainIds)
}
}
function getNetworkShortNames(chainIds) {
return networksModuleInst.getNetworkShortNames(chainIds)
}

View File

@ -447,7 +447,6 @@ SettingsContentBase {
sourceComponent: RemoveKeypairPopup {
name: removeKeypairPopup.name
relatedAccounts: removeKeypairPopup.accounts
getNetworkShortNames: function(chainIds) {return root.walletStore.getNetworkShortNames(chainIds)}
onClosed: removeKeypairPopup.active = false
onConfirmClicked: {
root.walletStore.deleteKeypair(removeKeypairPopup.keyUid)

View File

@ -44,9 +44,6 @@ ColumnLayout {
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
readonly property bool seedImport: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.seedImport: false
readonly property string preferredSharingNetworks: !!root.account? root.account.preferredSharingChainIds: ""
property var preferredSharingNetworksArray: preferredSharingNetworks.split(":").filter(Boolean).map(Number)
property string preferredSharingNetworkShortNames: walletStore.getNetworkShortNames(preferredSharingNetworks)
}
spacing: 0
@ -130,10 +127,7 @@ ColumnLayout {
isInteractive: true
moreButtonEnabled: true
title: qsTr("Address")
subTitle: {
let address = !!root.account && root.account.address ? root.account.address: ""
return WalletUtils.colorizedChainPrefix(d.preferredSharingNetworkShortNames) + address
}
subTitle: !!root.account && root.account.address ? root.account.address: ""
onButtonClicked: addressMenu.openMenu(this)
}
Separator {
@ -219,6 +213,7 @@ ColumnLayout {
}
Separator {
visible: d.watchOnlyAccount
Layout.topMargin: 40
Layout.fillWidth: true
Layout.preferredHeight: 1
@ -246,43 +241,6 @@ ColumnLayout {
color: Theme.palette.baseColor2
}
StatusListItem {
objectName: "PreferredNetworks_ListItem"
Layout.fillWidth: true
Layout.topMargin: Style.current.halfPadding
title: qsTr("Preferred networks when sharing this address")
color: Theme.palette.transparent
components: [
NetworkFilter {
flatNetworks: root.walletStore.filteredFlatModel
multiSelection: true
selection: d.preferredSharingNetworksArray
property string initialSelection
onSelectionChanged: {
if (selection !== d.preferredSharingNetworksArray) {
d.preferredSharingNetworksArray = selection
}
}
control.popup.onOpened: initialSelection = JSON.stringify(selection)
control.popup.onClosed: {
if (!!root.account && initialSelection !== JSON.stringify(selection)) {
root.walletStore.updateWalletAccountPreferredChains(root.account.address, d.preferredSharingNetworksArray.join(":"))
}
}
}
]
}
Separator {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: Theme.palette.baseColor2
}
StatusButton {
Layout.topMargin: 20
Layout.fillWidth: true
@ -309,7 +267,8 @@ ColumnLayout {
accountName: !!root.account ? root.account.name : ""
accountAddress: !!root.account ? root.account.address : ""
accountDerivationPath: !!root.account ? root.account.path : ""
preferredSharingNetworkShortNames: d.preferredSharingNetworkShortNames
// TODO: remove in when RemoveAccountConfirmationPopup.qml removes preferred networks
preferredSharingNetworkShortNames: ""
emoji: !!root.account ? root.account.emoji : ""
color: !!root.account ? Utils.getColorForId(root.account.colorId) : ""
@ -337,7 +296,6 @@ ColumnLayout {
selectedAccount: root.account
areTestNetworksEnabled: root.walletStore.areTestNetworksEnabled
isGoerliEnabled: root.walletStore.isGoerliEnabled
preferredSharedNetworkNamesArray: d.preferredSharingNetworkShortNames.split(":").filter(Boolean)
onCopyToClipboard: ClipboardUtils.setText(address)
}

View File

@ -285,7 +285,6 @@ Column {
width: parent.width
keyPair: model.keyPair
hasPairedDevices: root.walletStore.walletModule.hasPairedDevices
getNetworkShortNames: walletStore.getNetworkShortNames
userProfilePublicKey: walletStore.userProfilePublicKey
onGoToAccountView: root.goToAccountView(account)
onRunRenameKeypairFlow: root.runRenameKeypairFlow(model)