feat(@desktop/wallet): Remove network prefixes in saved addresses and ReceiveModal

This commit is contained in:
Khushboo Mehta 2024-10-03 22:13:01 +02:00 committed by Khushboo-dev-cpp
parent 95369bca11
commit 7003ba73e2
50 changed files with 47 additions and 759 deletions

View File

@ -60,12 +60,6 @@ proc getCurrentCurrency*(self: Controller): string =
proc getCurrencyFormat*(self: Controller, symbol: string): CurrencyFormatDto = proc getCurrencyFormat*(self: Controller, symbol: string): CurrencyFormatDto =
return self.walletAccountService.getCurrencyFormat(symbol) return self.walletAccountService.getCurrencyFormat(symbol)
proc updateWalletAccountProdPreferredChains*(self: Controller, address, preferredChainIds: string) =
discard self.walletAccountService.updateWalletAccountProdPreferredChains(address, preferredChainIds)
proc updateWalletAccountTestPreferredChains*(self: Controller, address, preferredChainIds: string) =
discard self.walletAccountService.updateWalletAccountTestPreferredChains(address, preferredChainIds)
proc areTestNetworksEnabled*(self: Controller): bool = proc areTestNetworksEnabled*(self: Controller): bool =
return self.walletAccountService.areTestNetworksEnabled() return self.walletAccountService.areTestNetworksEnabled()

View File

@ -46,11 +46,5 @@ method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
method getCollectiblesModel*(self: AccessInterface): QVariant {.base.} = method getCollectiblesModel*(self: AccessInterface): QVariant {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method updateWalletAccountProdPreferredChains*(self: AccessInterface, address, preferredChainIds: string) {.base.} =
raise newException(ValueError, "No implementation available")
method updateWalletAccountTestPreferredChains*(self: AccessInterface, address, preferredChainIds: string) {.base.} =
raise newException(ValueError, "No implementation available")
method updateWatchAccountHiddenFromTotalBalance*(self: AccessInterface, address: string, hideFromTotalBalance: bool) {.base.} = method updateWatchAccountHiddenFromTotalBalance*(self: AccessInterface, address: string, hideFromTotalBalance: bool) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -81,18 +81,6 @@ QtObject:
break break
i.inc i.inc
proc onPreferredSharingChainsUpdated*(self: Model, address, prodPreferredChainIds, testPreferredChainIds: string) =
var i = 0
for item in self.items.mitems:
if address == item.address:
item.prodPreferredChainIds = prodPreferredChainIds
item.testPreferredChainIds = testPreferredChainIds
let index = self.createIndex(i, 0, nil)
defer: index.delete
self.dataChanged(index, index, @[ModelRole.PreferredSharingChainIds.int])
break
i.inc
method data(self: Model, index: QModelIndex, role: int): QVariant = method data(self: Model, index: QModelIndex, role: int): QVariant =
if (not index.isValid): if (not index.isValid):
return return

View File

@ -184,10 +184,6 @@ method load*(self: Module) =
self.events.on(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED) do(e:Args): self.events.on(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED) do(e:Args):
self.refreshWalletAccounts() self.refreshWalletAccounts()
self.events.on(SIGNAL_WALLET_ACCOUNT_PREFERRED_SHARING_CHAINS_UPDATED) do(e: Args):
let args = AccountArgs(e)
self.view.onPreferredSharingChainsUpdated(args.account.keyUid, args.account.address, args.account.prodPreferredChainIds, args.account.testPreferredChainIds)
self.events.on(SIGNAL_WALLET_ACCOUNT_HIDDEN_UPDATED) do(e: Args): self.events.on(SIGNAL_WALLET_ACCOUNT_HIDDEN_UPDATED) do(e: Args):
let args = AccountArgs(e) let args = AccountArgs(e)
self.view.onHideFromTotalBalanceUpdated(args.account.keyUid, args.account.address, args.account.hideFromTotalBalance) self.view.onHideFromTotalBalanceUpdated(args.account.keyUid, args.account.address, args.account.hideFromTotalBalance)
@ -221,11 +217,5 @@ method renameKeypair*(self: Module, keyUid: string, name: string) =
proc onKeypairRenamed(self: Module, keyUid: string, name: string) = proc onKeypairRenamed(self: Module, keyUid: string, name: string) =
self.view.keyPairModel.updateKeypairName(keyUid, name) self.view.keyPairModel.updateKeypairName(keyUid, name)
method updateWalletAccountProdPreferredChains*(self: Module, address, preferredChainIds: string) =
self.controller.updateWalletAccountProdPreferredChains(address, preferredChainIds)
method updateWalletAccountTestPreferredChains*(self: Module, address, preferredChainIds: string) =
self.controller.updateWalletAccountTestPreferredChains(address, preferredChainIds)
method updateWatchAccountHiddenFromTotalBalance*(self: Module, address: string, hideFromTotalBalance: bool) = method updateWatchAccountHiddenFromTotalBalance*(self: Module, address: string, hideFromTotalBalance: bool) =
self.controller.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) self.controller.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)

View File

@ -93,11 +93,6 @@ QtObject:
self.keyPairModel.onUpdatedKeypairOperability(keyUid, operability) self.keyPairModel.onUpdatedKeypairOperability(keyUid, operability)
self.refreshSelectedAccount() self.refreshSelectedAccount()
proc onPreferredSharingChainsUpdated*(self: View, keyUid, address, prodPreferredChainIds, testPreferredChainIds: string) =
self.accounts.onPreferredSharingChainsUpdated(address, prodPreferredChainIds, testPreferredChainIds)
self.keyPairModel.onPreferredSharingChainsUpdated(keyUid, address, prodPreferredChainIds, testPreferredChainIds)
self.refreshSelectedAccount()
proc onHideFromTotalBalanceUpdated*(self: View, keyUid, address: string, hideFromTotalBalance: bool) = proc onHideFromTotalBalanceUpdated*(self: View, keyUid, address: string, hideFromTotalBalance: bool) =
self.keyPairModel.onHideFromTotalBalanceUpdated(keyUid, address, hideFromTotalBalance) self.keyPairModel.onHideFromTotalBalanceUpdated(keyUid, address, hideFromTotalBalance)
self.refreshSelectedAccount() self.refreshSelectedAccount()
@ -135,12 +130,6 @@ QtObject:
proc moveAccountFinally(self: View, fromRow: int, toRow: int) {.slot.} = proc moveAccountFinally(self: View, fromRow: int, toRow: int) {.slot.} =
self.delegate.moveAccountFinally(fromRow, toRow) self.delegate.moveAccountFinally(fromRow, toRow)
proc updateWalletAccountProdPreferredChains*(self: View, address: string, preferredChainIds: string) {.slot.} =
self.delegate.updateWalletAccountProdPreferredChains(address, preferredChainIds)
proc updateWalletAccountTestPreferredChains*(self: View, address: string, preferredChainIds: string) {.slot.} =
self.delegate.updateWalletAccountTestPreferredChains(address, preferredChainIds)
proc setBalanceForKeyPairs*(self: View, address: string, balance: CurrencyAmount) = proc setBalanceForKeyPairs*(self: View, address: string, balance: CurrencyAmount) =
self.keyPairModel.setBalanceForAddress(address, balance) self.keyPairModel.setBalanceForAddress(address, balance)
self.refreshSelectedAccount() self.refreshSelectedAccount()

View File

@ -59,12 +59,6 @@ proc getWalletAccount*(self: Controller, address: string): WalletAccountDto =
proc updateAccount*(self: Controller, address: string, accountName: string, colorId: string, emoji: string) = proc updateAccount*(self: Controller, address: string, accountName: string, colorId: string, emoji: string) =
discard self.walletAccountService.updateWalletAccount(address, accountName, colorId, emoji) discard self.walletAccountService.updateWalletAccount(address, accountName, colorId, emoji)
proc updateWalletAccountProdPreferredChains*(self: Controller, address, preferredChainIds: string) =
discard self.walletAccountService.updateWalletAccountProdPreferredChains(address, preferredChainIds)
proc updateWalletAccountTestPreferredChains*(self: Controller, address, preferredChainIds: string) =
discard self.walletAccountService.updateWalletAccountTestPreferredChains(address, preferredChainIds)
proc areTestNetworksEnabled*(self: Controller): bool = proc areTestNetworksEnabled*(self: Controller): bool =
return self.walletAccountService.areTestNetworksEnabled() return self.walletAccountService.areTestNetworksEnabled()

View File

@ -34,11 +34,5 @@ method getWalletAccountAsJson*(self: AccessInterface, address: string): JsonNode
method viewDidLoad*(self: AccessInterface) {.base.} = method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method updateWalletAccountProdPreferredChains*(self: AccessInterface, address, preferredChainIds: string) {.base.} =
raise newException(ValueError, "No implementation available")
method updateWalletAccountTestPreferredChains*(self: AccessInterface, address, preferredChainIds: string) {.base.} =
raise newException(ValueError, "No implementation available")
method updateWatchAccountHiddenFromTotalBalance*(self: AccessInterface, address: string, hideFromTotalBalance: bool) {.base.} = method updateWatchAccountHiddenFromTotalBalance*(self: AccessInterface, address: string, hideFromTotalBalance: bool) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -253,15 +253,3 @@ QtObject:
if i < 0: if i < 0:
return false return false
return self.items[i].walletType != "watch" return self.items[i].walletType != "watch"
proc onPreferredSharingChainsUpdated*(self: Model, address, prodPreferredChainIds, testPreferredChainIds: string) =
var i = 0
for item in self.items.mitems:
if(cmpIgnoreCase(item.address, address) == 0):
item.prodPreferredChainIds = prodPreferredChainIds
item.testPreferredChainIds = testPreferredChainIds
let index = self.createIndex(i, 0, nil)
defer: index.delete
self.dataChanged(index, index, @[ModelRole.PreferredSharingChainIds.int])
break
i.inc

View File

@ -98,9 +98,6 @@ method load*(self: Module) =
self.controller.init() self.controller.init()
self.view.load() self.view.load()
self.events.on(SIGNAL_WALLET_ACCOUNT_PREFERRED_SHARING_CHAINS_UPDATED) do(e: Args):
let args = AccountArgs(e)
self.view.onPreferredSharingChainsUpdated(args.account.keyUid, args.account.address, args.account.prodPreferredChainIds, args.account.testPreferredChainIds)
self.events.on(SIGNAL_TOKENS_MARKET_VALUES_UPDATED) do(e:Args): self.events.on(SIGNAL_TOKENS_MARKET_VALUES_UPDATED) do(e:Args):
self.refreshAllWalletAccountsBalances() self.refreshAllWalletAccountsBalances()
self.events.on(SIGNAL_CURRENCY_FORMATS_UPDATED) do(e:Args): self.events.on(SIGNAL_CURRENCY_FORMATS_UPDATED) do(e:Args):
@ -147,12 +144,6 @@ method deleteAccount*(self: Module, address: string) =
method updateAccount*(self: Module, address: string, accountName: string, colorId: string, emoji: string) = method updateAccount*(self: Module, address: string, accountName: string, colorId: string, emoji: string) =
self.controller.updateAccount(address, accountName, colorId, emoji) self.controller.updateAccount(address, accountName, colorId, emoji)
method updateWalletAccountProdPreferredChains*(self: Module, address, preferredChainIds: string) =
self.controller.updateWalletAccountProdPreferredChains(address, preferredChainIds)
method updateWalletAccountTestPreferredChains*(self: Module, address, preferredChainIds: string) =
self.controller.updateWalletAccountTestPreferredChains(address, preferredChainIds)
method updateWatchAccountHiddenFromTotalBalance*(self: Module, address: string, hideFromTotalBalance: bool) = method updateWatchAccountHiddenFromTotalBalance*(self: Module, address: string, hideFromTotalBalance: bool) =
self.controller.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) self.controller.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)

View File

@ -74,17 +74,8 @@ QtObject:
proc isOwnedAccount(self: View, address: string): bool {.slot.} = proc isOwnedAccount(self: View, address: string): bool {.slot.} =
return self.accounts.isOwnedAccount(address) return self.accounts.isOwnedAccount(address)
proc updateWalletAccountProdPreferredChains*(self: View, address: string, preferredChainIds: string) {.slot.} =
self.delegate.updateWalletAccountProdPreferredChains(address, preferredChainIds)
proc updateWalletAccountTestPreferredChains*(self: View, address: string, preferredChainIds: string) {.slot.} =
self.delegate.updateWalletAccountTestPreferredChains(address, preferredChainIds)
proc updateWatchAccountHiddenFromTotalBalance*(self: View, address: string, hideFromTotalBalance: bool) {.slot.} = proc updateWatchAccountHiddenFromTotalBalance*(self: View, address: string, hideFromTotalBalance: bool) {.slot.} =
self.delegate.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) self.delegate.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)
proc getWalletAccountAsJson*(self: View, address: string): string {.slot.} = proc getWalletAccountAsJson*(self: View, address: string): string {.slot.} =
return $self.delegate.getWalletAccountAsJson(address) return $self.delegate.getWalletAccountAsJson(address)
proc onPreferredSharingChainsUpdated*(self: View, keyUid, address, prodPreferredChainIds, testPreferredChainIds: string) =
self.accounts.onPreferredSharingChainsUpdated(address, prodPreferredChainIds, testPreferredChainIds)

View File

@ -46,9 +46,8 @@ proc getSavedAddresses*(self: Controller): seq[saved_address_service.SavedAddres
proc getSavedAddress*(self: Controller, address: string, ignoreNetworkMode: bool): SavedAddressDto = proc getSavedAddress*(self: Controller, address: string, ignoreNetworkMode: bool): SavedAddressDto =
return self.savedAddressService.getSavedAddress(address, ignoreNetworkMode) return self.savedAddressService.getSavedAddress(address, ignoreNetworkMode)
proc createOrUpdateSavedAddress*(self: Controller, name: string, address: string, ens: string, colorId: string, proc createOrUpdateSavedAddress*(self: Controller, name: string, address: string, ens: string, colorId: string) =
chainShortNames: string) = self.savedAddressService.createOrUpdateSavedAddress(name, address, ens, colorId)
self.savedAddressService.createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames)
proc deleteSavedAddress*(self: Controller, address: string) = proc deleteSavedAddress*(self: Controller, address: string) =
self.savedAddressService.deleteSavedAddress(address) self.savedAddressService.deleteSavedAddress(address)

View File

@ -17,11 +17,7 @@ method viewDidLoad*(self: AccessInterface) {.base.} =
method loadSavedAddresses*(self: AccessInterface) {.base.} = method loadSavedAddresses*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method createOrUpdateSavedAddress*(self: AccessInterface, name: string, address: string, ens: string, colorId: string, method createOrUpdateSavedAddress*(self: AccessInterface, name: string, address: string, ens: string, colorId: string) {.base.} =
chainShortNames: string) {.base.} =
raise newException(ValueError, "No implementation available")
method updatePreferredChains*(self: AccessInterface, address: string, chainShortNames: string) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method deleteSavedAddress*(self: AccessInterface, address: string) {.base.} = method deleteSavedAddress*(self: AccessInterface, address: string) {.base.} =

View File

@ -9,7 +9,6 @@ type
mixedcaseAddress: string mixedcaseAddress: string
ens: string ens: string
colorId: string colorId: string
chainShortNames: string
isTest: bool isTest: bool
proc initItem*( proc initItem*(
@ -18,7 +17,6 @@ proc initItem*(
mixedcaseAddress: string, mixedcaseAddress: string,
ens: string, ens: string,
colorId: string, colorId: string,
chainShortNames: string,
isTest: bool isTest: bool
): Item = ): Item =
result.name = name result.name = name
@ -26,7 +24,6 @@ proc initItem*(
result.mixedcaseAddress = mixedcaseAddress result.mixedcaseAddress = mixedcaseAddress
result.ens = ens result.ens = ens
result.colorId = colorId result.colorId = colorId
result.chainShortNames = chainShortNames
result.isTest = isTest result.isTest = isTest
proc `$`*(self: Item): string = proc `$`*(self: Item): string =
@ -36,7 +33,6 @@ proc `$`*(self: Item): string =
mixedcaseAddress: {self.mixedcaseAddress}, mixedcaseAddress: {self.mixedcaseAddress},
ens: {self.ens}, ens: {self.ens},
colorId: {self.colorId}, colorId: {self.colorId},
chainShortNames: {self.chainShortNames},
isTest: {self.isTest}, isTest: {self.isTest},
]""" ]"""
@ -58,8 +54,5 @@ proc getMixedcaseAddress*(self: Item): string =
proc getColorId*(self: Item): string = proc getColorId*(self: Item): string =
return self.colorId return self.colorId
proc getChainShortNames*(self: Item): string =
return self.chainShortNames
proc getIsTest*(self: Item): bool = proc getIsTest*(self: Item): bool =
return self.isTest return self.isTest

View File

@ -12,7 +12,6 @@ type
MixedcaseAddress MixedcaseAddress
Ens Ens
ColorId ColorId
ChainShortNames
IsTest IsTest
QtObject: QtObject:
@ -55,7 +54,6 @@ QtObject:
ModelRole.MixedcaseAddress.int:"mixedcaseAddress", ModelRole.MixedcaseAddress.int:"mixedcaseAddress",
ModelRole.Ens.int:"ens", ModelRole.Ens.int:"ens",
ModelRole.ColorId.int:"colorId", ModelRole.ColorId.int:"colorId",
ModelRole.ChainShortNames.int:"chainShortNames",
ModelRole.IsTest.int:"isTest", ModelRole.IsTest.int:"isTest",
}.toTable }.toTable
@ -80,8 +78,6 @@ QtObject:
result = newQVariant(item.getEns()) result = newQVariant(item.getEns())
of ModelRole.ColorId: of ModelRole.ColorId:
result = newQVariant(item.getColorId()) result = newQVariant(item.getColorId())
of ModelRole.ChainShortNames:
result = newQVariant(item.getChainShortNames())
of ModelRole.IsTest: of ModelRole.IsTest:
result = newQVariant(item.getIsTest()) result = newQVariant(item.getIsTest())

View File

@ -42,7 +42,6 @@ method loadSavedAddresses*(self: Module) =
s.mixedcaseAddress, s.mixedcaseAddress,
s.ens, s.ens,
s.colorId, s.colorId,
s.chainShortNames,
s.isTest, s.isTest,
)) ))
) )
@ -61,15 +60,8 @@ method viewDidLoad*(self: Module) =
self.moduleLoaded = true self.moduleLoaded = true
self.delegate.savedAddressesModuleDidLoad() self.delegate.savedAddressesModuleDidLoad()
method createOrUpdateSavedAddress*(self: Module, name: string, address: string, ens: string, colorId: string, method createOrUpdateSavedAddress*(self: Module, name: string, address: string, ens: string, colorId: string) =
chainShortNames: string) = self.controller.createOrUpdateSavedAddress(name, address, ens, colorId)
self.controller.createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames)
method updatePreferredChains*(self: Module, address: string, chainShortNames: string) =
let item = self.view.getModel().getItemByAddress(address, self.controller.areTestNetworksEnabled())
if item.getAddress().len == 0:
return
self.controller.createOrUpdateSavedAddress(item.getName(), address, item.getEns(), item.getColorId(), chainShortNames)
method deleteSavedAddress*(self: Module, address: string) = method deleteSavedAddress*(self: Module, address: string) =
self.controller.deleteSavedAddress(address) self.controller.deleteSavedAddress(address)
@ -100,7 +92,6 @@ method getSavedAddressAsJson*(self: Module, address: string): string =
"address": saDto.address, "address": saDto.address,
"ens": saDto.ens, "ens": saDto.ens,
"colorId": saDto.colorId, "colorId": saDto.colorId,
"chainShortNames": saDto.chainShortNames,
"isTest": saDto.isTest, "isTest": saDto.isTest,
} }
return $jsonObj return $jsonObj

View File

@ -42,12 +42,8 @@ QtObject:
proc savedAddressAddedOrUpdated*(self: View, added: bool, name: string, address: string, errorMsg: string) {.signal.} proc savedAddressAddedOrUpdated*(self: View, added: bool, name: string, address: string, errorMsg: string) {.signal.}
proc createOrUpdateSavedAddress*(self: View, name: string, address: string, ens: string, colorId: string, proc createOrUpdateSavedAddress*(self: View, name: string, address: string, ens: string, colorId: string) {.slot.} =
chainShortNames: string) {.slot.} = self.delegate.createOrUpdateSavedAddress(name, address, ens, colorId)
self.delegate.createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames)
proc updatePreferredChains*(self: View, address: string, chainShortNames: string) {.slot.} =
self.delegate.updatePreferredChains(address, chainShortNames)
proc savedAddressDeleted*(self: View, name: string, address: string, errorMsg: string) {.signal.} proc savedAddressDeleted*(self: View, name: string, address: string, errorMsg: string) {.signal.}

View File

@ -252,14 +252,6 @@ QtObject:
return splitWords[i] return splitWords[i]
return "" return ""
proc getShortChainIds(self: View, chainShortNames : string): string {.slot.} =
if chainShortNames.isEmptyOrWhitespace():
return ""
var preferredChains: seq[int]
for shortName in chainShortNames.split(':'):
preferredChains.add(self.delegate.getNetworkChainId(shortName))
return preferredChains.join(":")
# "Stateless" methods # "Stateless" methods
proc fetchSuggestedRoutesWithParameters*(self: View, proc fetchSuggestedRoutesWithParameters*(self: View,
uuid: string, uuid: string,

View File

@ -184,12 +184,6 @@ QtObject:
return self.testPreferredChainIds return self.testPreferredChainIds
else : else :
return self.prodPreferredChainIds return self.prodPreferredChainIds
proc setProdPreferredChainIds*(self: KeyPairAccountItem, value: string) =
self.prodPreferredChainIds = value
self.preferredSharingChainIdsChanged()
proc setTestPreferredChainIds*(self: KeyPairAccountItem, value: string) =
self.testPreferredChainIds = value
self.preferredSharingChainIdsChanged()
QtProperty[string] preferredSharingChainIds: QtProperty[string] preferredSharingChainIds:
read = preferredSharingChainIds read = preferredSharingChainIds
notify = preferredSharingChainIdsChanged notify = preferredSharingChainIdsChanged

View File

@ -140,12 +140,6 @@ QtObject:
if cmpIgnoreCase(self.items[i].getAddress(), address) == 0: if cmpIgnoreCase(self.items[i].getAddress(), address) == 0:
self.items[i].setBalance(balance) self.items[i].setBalance(balance)
proc updatePreferredSharingChainsForAddress*(self: KeyPairAccountModel, address, prodPreferredChainIds, testPreferredChainIds: string) =
for i in 0 ..< self.items.len:
if cmpIgnoreCase(self.items[i].getAddress(), address) == 0:
self.items[i].setProdPreferredChainIds(prodPreferredChainIds)
self.items[i].setTestPreferredChainIds(testPreferredChainIds)
proc updateAccountHiddenInTotalBalance*(self: KeyPairAccountModel, address: string, hideFromTotalBalance: bool) = proc updateAccountHiddenInTotalBalance*(self: KeyPairAccountModel, address: string, hideFromTotalBalance: bool) =
for i in 0 ..< self.items.len: for i in 0 ..< self.items.len:
if cmpIgnoreCase(self.items[i].getAddress(), address) == 0: if cmpIgnoreCase(self.items[i].getAddress(), address) == 0:

View File

@ -285,8 +285,6 @@ QtObject:
return self.accounts.containsPathOutOfTheDefaultStatusDerivationTree() return self.accounts.containsPathOutOfTheDefaultStatusDerivationTree()
proc updateDetailsForAccountWithAddressIfTheyAreSet*(self: KeyPairItem, address, name, colorId, emoji: string) = proc updateDetailsForAccountWithAddressIfTheyAreSet*(self: KeyPairItem, address, name, colorId, emoji: string) =
self.accounts.updateDetailsForAddressIfTheyAreSet(address, name, colorId, emoji) self.accounts.updateDetailsForAddressIfTheyAreSet(address, name, colorId, emoji)
proc updatePreferredSharingChainsForAddress*(self: KeyPairItem, address, prodPreferredChainIds, testPreferredChainIds: string) =
self.accounts.updatePreferredSharingChainsForAddress(address, prodPreferredChainIds, testPreferredChainIds)
proc updateAccountHiddenInTotalBalance*(self: KeyPairItem, address: string, hideFromTotalBalance: bool) = proc updateAccountHiddenInTotalBalance*(self: KeyPairItem, address: string, hideFromTotalBalance: bool) =
self.accounts.updateAccountHiddenInTotalBalance(address, hideFromTotalBalance) self.accounts.updateAccountHiddenInTotalBalance(address, hideFromTotalBalance)
proc setBalanceForAddress*(self: KeyPairItem, address: string, balance: CurrencyAmount) = proc setBalanceForAddress*(self: KeyPairItem, address: string, balance: CurrencyAmount) =

View File

@ -96,12 +96,6 @@ QtObject:
item.updateOperabilityForAllAddresses(operability) item.updateOperabilityForAllAddresses(operability)
break break
proc onPreferredSharingChainsUpdated*(self: KeyPairModel, keyUid, address, prodPreferredChainIds, testPreferredChainIds: string) =
for item in self.items:
if keyUid == item.getKeyUid():
item.getAccountsModel().updatePreferredSharingChainsForAddress(address, prodPreferredChainIds, testPreferredChainIds)
break
proc onHideFromTotalBalanceUpdated*(self: KeyPairModel, keyUid, address: string, hideFromTotalBalance: bool) = proc onHideFromTotalBalanceUpdated*(self: KeyPairModel, keyUid, address: string, hideFromTotalBalance: bool) =
for item in self.items: for item in self.items:
if keyUid == item.getKeyUid(): if keyUid == item.getKeyUid():

View File

@ -11,7 +11,6 @@ type
name: string name: string
address: string address: string
colorId: string colorId: string
chainShortNames: string
ens: string ens: string
isTestAddress: bool isTestAddress: bool
@ -82,7 +81,6 @@ proc upsertSavedAddressTask(argEncoded: string) {.gcsafe, nimcall.} =
name: arg.name, name: arg.name,
address: arg.address, address: arg.address,
colorId: arg.colorId, colorId: arg.colorId,
chainShortNames: arg.chainShortNames,
ens: arg.ens, ens: arg.ens,
isTest: arg.isTestAddress) isTest: arg.isTestAddress)
let rpcResponse = checkForEnsNameAndUpdate(arg.chainId, savedAddress, UpdateCriteria.AlwaysUpdate) let rpcResponse = checkForEnsNameAndUpdate(arg.chainId, savedAddress, UpdateCriteria.AlwaysUpdate)

View File

@ -9,7 +9,6 @@ type
mixedcaseAddress*: string mixedcaseAddress*: string
ens*: string ens*: string
colorId*: string colorId*: string
chainShortNames*: string
isTest*: bool isTest*: bool
removed*: bool removed*: bool
createdAt*: int64 createdAt*: int64
@ -22,7 +21,6 @@ proc toSavedAddressDto*(jsonObj: JsonNode): SavedAddressDto =
discard jsonObj.getProp("ens", result.ens) discard jsonObj.getProp("ens", result.ens)
discard jsonObj.getProp("colorId", result.colorId) discard jsonObj.getProp("colorId", result.colorId)
result.colorId = result.colorId.toUpper() # to match `preDefinedWalletAccountColors` on the qml side result.colorId = result.colorId.toUpper() # to match `preDefinedWalletAccountColors` on the qml side
discard jsonObj.getProp("chainShortNames", result.chainShortNames)
discard jsonObj.getProp("isTest", result.isTest) discard jsonObj.getProp("isTest", result.isTest)
discard jsonObj.getProp("createdAt", result.createdAt) discard jsonObj.getProp("createdAt", result.createdAt)
discard jsonObj.getProp("removed", result.removed) discard jsonObj.getProp("removed", result.removed)
@ -34,7 +32,6 @@ proc toJsonNode*(self: SavedAddressDto): JsonNode =
"mixedcaseAddress": self.mixedcaseAddress, "mixedcaseAddress": self.mixedcaseAddress,
"ens": self.ens, "ens": self.ens,
"colorId": self.colorId, "colorId": self.colorId,
"chainShortNames": self.chainShortNames,
"isTest": self.isTest, "isTest": self.isTest,
"createdAt": self.createdAt, "createdAt": self.createdAt,
"removed": self.removed "removed": self.removed

View File

@ -114,15 +114,13 @@ QtObject:
error "onSavedAddressesFetched", msg = e.msg error "onSavedAddressesFetched", msg = e.msg
self.events.emit(SIGNAL_SAVED_ADDRESSES_UPDATED, Args()) self.events.emit(SIGNAL_SAVED_ADDRESSES_UPDATED, Args())
proc createOrUpdateSavedAddress*(self: Service, name: string, address: string, ens: string, colorId: string, proc createOrUpdateSavedAddress*(self: Service, name: string, address: string, ens: string, colorId: string) =
chainShortNames: string) =
let arg = SavedAddressTaskArg( let arg = SavedAddressTaskArg(
chainId: self.networkService.getAppNetwork().chainId, chainId: self.networkService.getAppNetwork().chainId,
name: name, name: name,
address: address, address: address,
ens: ens, ens: ens,
colorId: colorId, colorId: colorId,
chainShortNames: chainShortNames,
isTestAddress: self.areTestNetworksEnabled(), isTestAddress: self.areTestNetworksEnabled(),
tptr: upsertSavedAddressTask, tptr: upsertSavedAddressTask,
vptr: cast[ByteAddress](self.vptr), vptr: cast[ByteAddress](self.vptr),

View File

@ -311,22 +311,6 @@ proc updateAccountInLocalStoreAndNotify(self: Service, address, name, colorId, e
if notify: if notify:
self.events.emit(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED, Args()) self.events.emit(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED, Args())
proc updateTestPreferredSharingChainsAndNotify(self: Service, address, testPreferredChains: string) =
var account = self.getAccountByAddress(address)
if account.isNil:
error "account's address is not among known addresses: ", address=address, procName="updateTestPreferredSharingChainsAndNotify"
return
account.testPreferredChainIds = testPreferredChains
self.events.emit(SIGNAL_WALLET_ACCOUNT_PREFERRED_SHARING_CHAINS_UPDATED, AccountArgs(account: account))
proc updateProdPreferredSharingChainsAndNotify(self: Service, address, prodPreferredChains: string) =
var account = self.getAccountByAddress(address)
if account.isNil:
error "account's address is not among known addresses: ", address=address, procName="updateProdPreferredSharingChainsAndNotify"
return
account.prodPreferredChainIds = prodPreferredChains
self.events.emit(SIGNAL_WALLET_ACCOUNT_PREFERRED_SHARING_CHAINS_UPDATED, AccountArgs(account: account))
## if password is not provided local keystore file won't be created ## if password is not provided local keystore file won't be created
proc addWalletAccount*(self: Service, password: string, doPasswordHashing: bool, name, address, path, publicKey, proc addWalletAccount*(self: Service, password: string, doPasswordHashing: bool, name, address, path, publicKey,
keyUid, accountType, colorId, emoji: string, hideFromTotalBalance: bool): string = keyUid, accountType, colorId, emoji: string, hideFromTotalBalance: bool): string =
@ -587,40 +571,6 @@ proc updateWalletAccount*(self: Service, address: string, accountName: string, c
error "error: ", procName="updateWalletAccount", errName=e.name, errDesription=e.msg error "error: ", procName="updateWalletAccount", errName=e.name, errDesription=e.msg
return false return false
proc updateWalletAccountProdPreferredChains*(self: Service, address, preferredChainIds: string): bool =
try:
var account = self.getAccountByAddress(address)
if account.isNil:
error "account's address is not among known addresses: ", address=address, procName="updateWalletAccountProdPreferredChains"
return false
let response = status_go_accounts.updateAccount(account.name, account.address, account.path, account.publicKey,
account.keyUid, account.walletType, account.colorId, account.emoji, account.isWallet, account.isChat, preferredChainIds, account.testPreferredChainIds, account.hideFromTotalBalance)
if not response.error.isNil:
error "status-go error", procName="updateWalletAccountProdPreferredChains", errCode=response.error.code, errDesription=response.error.message
return false
self.updateProdPreferredSharingChainsAndNotify(address, preferredChainIds)
return true
except Exception as e:
error "error: ", procName="updateWalletAccountProdPreferredChains", errName=e.name, errDesription=e.msg
return false
proc updateWalletAccountTestPreferredChains*(self: Service, address, preferredChainIds: string): bool =
try:
var account = self.getAccountByAddress(address)
if account.isNil:
error "account's address is not among known addresses: ", address=address, procName="updateWalletAccountTestPreferredChains"
return false
let response = status_go_accounts.updateAccount(account.name, account.address, account.path, account.publicKey,
account.keyUid, account.walletType, account.colorId, account.emoji, account.isWallet, account.isChat, account.prodPreferredChainIds, preferredChainIds, account.hideFromTotalBalance)
if not response.error.isNil:
error "status-go error", procName="updateWalletAccountTestPreferredChains", errCode=response.error.code, errDesription=response.error.message
return false
self.updateTestPreferredSharingChainsAndNotify(address, preferredChainIds)
return true
except Exception as e:
error "error: ", procName="updateWalletAccountTestPreferredChains", errName=e.name, errDesription=e.msg
return false
proc updateWatchAccountHiddenFromTotalBalance*(self: Service, address: string, hideFromTotalBalance: bool): bool = proc updateWatchAccountHiddenFromTotalBalance*(self: Service, address: string, hideFromTotalBalance: bool): bool =
try: try:
var account = self.getAccountByAddress(address) var account = self.getAccountByAddress(address)

View File

@ -19,7 +19,6 @@ const SIGNAL_WALLET_ACCOUNT_ADDRESS_DETAILS_FETCHED* = "walletAccount/addressDet
const SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED* = "walletAccount/positionUpdated" const SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED* = "walletAccount/positionUpdated"
const SIGNAL_WALLET_ACCOUNT_OPERABILITY_UPDATED* = "walletAccount/operabilityUpdated" const SIGNAL_WALLET_ACCOUNT_OPERABILITY_UPDATED* = "walletAccount/operabilityUpdated"
const SIGNAL_WALLET_ACCOUNT_CHAIN_ID_FOR_URL_FETCHED* = "walletAccount/chainIdForUrlFetched" const SIGNAL_WALLET_ACCOUNT_CHAIN_ID_FOR_URL_FETCHED* = "walletAccount/chainIdForUrlFetched"
const SIGNAL_WALLET_ACCOUNT_PREFERRED_SHARING_CHAINS_UPDATED* = "walletAccount/preferredSharingChainsUpdated"
const SIGNAL_WALLET_ACCOUNT_HIDDEN_UPDATED* = "walletAccount/accountHiddenChanged" const SIGNAL_WALLET_ACCOUNT_HIDDEN_UPDATED* = "walletAccount/accountHiddenChanged"
const SIGNAL_KEYPAIR_SYNCED* = "keypairSynced" const SIGNAL_KEYPAIR_SYNCED* = "keypairSynced"

View File

@ -47,11 +47,6 @@ SplitView {
modal: false modal: false
closePolicy: Popup.NoAutoClose closePolicy: Popup.NoAutoClose
flatNetworks: SortFilterProxyModel {
sourceModel: NetworksModel.flatNetworks
filters: ValueFilter { roleName: "isTest"; value: false }
}
store: WalletStores.RootStore store: WalletStores.RootStore
sharedRootStore: SharedStores.RootStore {} sharedRootStore: SharedStores.RootStore {}

View File

@ -43,22 +43,10 @@ SplitView {
"emoji": "🚗", "emoji": "🚗",
"color": "#216266", "color": "#216266",
"address": "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881", "address": "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
"preferredSharingChainIds": "5:420:421613",
} }
switchingAccounsEnabled: true switchingAccounsEnabled: true
changingPreferredChainsEnabled: true
hasFloatingButtons: true hasFloatingButtons: true
qrImageSource: "https://upload.wikimedia.org/wikipedia/commons/4/41/QR_Code_Example.svg" qrImageSource: "https://upload.wikimedia.org/wikipedia/commons/4/41/QR_Code_Example.svg"
getNetworkShortNames: function (chainIDsString) {
let chainArray = chainIDsString.split(":")
let chainNameString = ""
for (let i =0; i<chainArray.length; i++) {
chainNameString += NetworksModel.getShortChainName(Number(chainArray[i])) + ":"
}
return chainNameString
}
property string networksNames: "oeth:arb1:eth:"
store: WalletStores.RootStore store: WalletStores.RootStore
} }
@ -67,39 +55,6 @@ SplitView {
Pane { Pane {
SplitView.minimumWidth: 300 SplitView.minimumWidth: 300
SplitView.preferredWidth: 300 SplitView.preferredWidth: 300
Column {
spacing: 12
Label {
text: "Test extended footer"
font.bold: true
}
Column {
RadioButton {
text: "Medium length address"
onCheckedChanged: {
dialog.networksNames = "oeth:arb1:eth:arb1:solana:status:other:"
}
}
RadioButton {
text: "Super long address"
onCheckedChanged: {
dialog.networksNames = "oeth:arb1:eth:arb1:solana:status:other:something:hey:whatsapp:tele:viber:do:it:now:blackjack:some:black:number:check:it:out:heyeey:dosay:what:are:you:going:to:do:with:me:forever:young:michael:jackson:super:long:string:crasy:daisy:this:is:amazing:whatever:you:do:whenever:you:go:"
}
}
RadioButton {
checked: true
text: "Short address"
onCheckedChanged: {
dialog.networksNames = "oeth:arb1:eth:"
}
}
}
}
} }
} }

View File

@ -38,7 +38,6 @@ SplitView {
name: "some saved addr name " + i, name: "some saved addr name " + i,
ens: [], ens: [],
address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4", address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4",
chainShortNames: "eth:arb1"
}) })
append(data) append(data)
} }

View File

@ -32,7 +32,6 @@ SplitView {
function getNameForSavedWalletAddress(address) { return "Saved Wallet Name" } function getNameForSavedWalletAddress(address) { return "Saved Wallet Name" }
function getNameForAddress(address) { return "Address Name" } function getNameForAddress(address) { return "Address Name" }
function getEnsForSavedWalletAddress(address) { return "123" } function getEnsForSavedWalletAddress(address) { return "123" }
function getChainShortNamesForSavedWalletAddress(address) { return "" }
function getGasEthValue(gasAmount, gasPrice) { return (gasAmount * Math.pow(10, -9)).toPrecision(5) } function getGasEthValue(gasAmount, gasPrice) { return (gasAmount * Math.pow(10, -9)).toPrecision(5) }
readonly property string currentCurrency: "USD" readonly property string currentCurrency: "USD"

View File

@ -22,7 +22,6 @@ Item {
name: "some saved addr name " + i, name: "some saved addr name " + i,
ens: [], ens: [],
address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4", address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4",
chainShortNames: "eth:arb1"
}) })
append(data) append(data)
} }

View File

@ -9,7 +9,6 @@ QtObject {
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
ens: "" ens: ""
favourite: true favourite: true
chainShortNames: "eth:arb1:oeth"
isTest: false isTest: false
checked: true checked: true
allChecked: true allChecked: true
@ -20,7 +19,6 @@ QtObject {
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756ccx" address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756ccx"
ens: "anthony.statusofus.eth" ens: "anthony.statusofus.eth"
favourite: true favourite: true
chainShortNames: ""
isTest: false isTest: false
checked: true checked: true
allChecked: true allChecked: true
@ -31,7 +29,6 @@ QtObject {
address: "0xb794f5ea0ba39494ce839613fffba74279579268" address: "0xb794f5ea0ba39494ce839613fffba74279579268"
ens: "" ens: ""
favourite: true favourite: true
chainShortNames: "eth:"
isTest: false isTest: false
checked: true checked: true
allChecked: true allChecked: true

View File

@ -15,7 +15,7 @@ QtObject {
return false return false
} }
function createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames) { function createOrUpdateSavedAddress(name, address, ens, colorId) {
console.log("createOrUpdateSavedAddress") console.log("createOrUpdateSavedAddress")
} }

View File

@ -64,13 +64,11 @@ QtObject {
name: "some saved addr name " + i, name: "some saved addr name " + i,
ens: [], ens: [],
address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4", address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b4",
chainShortNames: "eth:arb1"
}) })
append({ append({
name: "some saved ENS name ", name: "some saved ENS name ",
ens: ["me@status.eth"], ens: ["me@status.eth"],
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc4", address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc4",
chainShortNames: "eth:arb1:opt"
}) })
} }
} }
@ -143,15 +141,6 @@ QtObject {
return "" return ""
} }
function getShortChainIds(chainIds) {
let listOfChains = chainIds.split(":")
let listOfChainIds = []
for (let k =0;k<listOfChains.length;k++) {
listOfChainIds.push(SQUtils.ModelUtils.getByKey(flatNetworksModel, "shortName", listOfChains[k], "chainId"))
}
return listOfChainIds
}
function setSendType(sendType) { function setSendType(sendType) {
root.sendType = sendType root.sendType = sendType
} }

View File

@ -39,7 +39,7 @@ StatusMenu {
} }
StatusAction { StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.mainnet) text: qsTr("View on Etherscan")
icon.name: "link" icon.name: "link"
onTriggered: { onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.mainnet, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "") let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.mainnet, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "")
@ -47,24 +47,6 @@ StatusMenu {
} }
} }
StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.arbitrum)
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.arbitrum, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "")
Global.openLink(link)
}
}
StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.optimism)
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.optimism, root.areTestNetworksEnabled, root.isGoerliEnabled, root.selectedAccount.address?? "")
Global.openLink(link)
}
}
StatusSuccessAction { StatusSuccessAction {
id: copyAddressAction id: copyAddressAction
successText: qsTr("Address copied") successText: qsTr("Address copied")
@ -79,7 +61,6 @@ StatusMenu {
onTriggered: Global.openShowQRPopup({ onTriggered: Global.openShowQRPopup({
showSingleAccount: true, showSingleAccount: true,
switchingAccounsEnabled: false, switchingAccounsEnabled: false,
changingPreferredChainsEnabled: false,
hasFloatingButtons: false, hasFloatingButtons: false,
name: root.selectedAccount.name?? "", name: root.selectedAccount.name?? "",
address: root.selectedAccount.address?? "", address: root.selectedAccount.address?? "",

View File

@ -235,7 +235,6 @@ Item {
headerButton.visible: !RootStore.overview.isAllAccounts headerButton.visible: !RootStore.overview.isAllAccounts
onLaunchShareAddressModal: Global.openShowQRPopup({ onLaunchShareAddressModal: Global.openShowQRPopup({
switchingAccounsEnabled: true, switchingAccounsEnabled: true,
changingPreferredChainsEnabled: true,
hasFloatingButtons: true hasFloatingButtons: true
}) })
onLaunchSwapModal: { onLaunchSwapModal: {
@ -326,7 +325,6 @@ Item {
onLaunchShareAddressModal: Global.openShowQRPopup({ onLaunchShareAddressModal: Global.openShowQRPopup({
switchingAccounsEnabled: true, switchingAccounsEnabled: true,
changingPreferredChainsEnabled: true,
hasFloatingButtons: true hasFloatingButtons: true
}) })
onLaunchSendModal: (fromAddress) => { onLaunchSendModal: (fromAddress) => {

View File

@ -26,7 +26,6 @@ StatusListItem {
property string address property string address
property string ens property string ens
property string colorId property string colorId
property string chainShortNames
property bool areTestNetworksEnabled: false property bool areTestNetworksEnabled: false
property bool isGoerliEnabled: false property bool isGoerliEnabled: false
@ -51,9 +50,7 @@ StatusListItem {
if (ens.length > 0) if (ens.length > 0)
return ens return ens
else { else {
return sensor.containsMouse ? WalletUtils.colorizedChainPrefix(root.chainShortNames) + return WalletUtils.addressToDisplay(root.address, false, sensor.containsMouse)
Utils.richColorText(root.address, Theme.palette.directColor1)
: root.chainShortNames + root.address
} }
} }
@ -75,7 +72,6 @@ StatusListItem {
id: d id: d
readonly property string visibleAddress: !!root.ens? root.ens : root.address readonly property string visibleAddress: !!root.ens? root.ens : root.address
readonly property var preferredSharedNetworkNamesArray: root.chainShortNames.split(":").filter(Boolean)
} }
onClicked: { onClicked: {
@ -85,7 +81,6 @@ StatusListItem {
Global.openSavedAddressActivityPopup({ Global.openSavedAddressActivityPopup({
name: root.name, name: root.name,
address: root.address, address: root.address,
chainShortNames: root.chainShortNames,
ens: root.ens, ens: root.ens,
colorId: root.colorId colorId: root.colorId
}) })
@ -113,7 +108,6 @@ StatusListItem {
{ {
name: root.name, name: root.name,
address: root.address, address: root.address,
chainShortNames: root.chainShortNames,
ens: root.ens, ens: root.ens,
colorId: root.colorId, colorId: root.colorId,
} }
@ -127,7 +121,6 @@ StatusListItem {
id: menu id: menu
property string name property string name
property string address property string address
property string chainShortNames
property string ens property string ens
property string colorId property string colorId
@ -138,7 +131,6 @@ StatusListItem {
function openMenu(parent, x, y, model) { function openMenu(parent, x, y, model) {
menu.name = model.name; menu.name = model.name;
menu.address = model.address; menu.address = model.address;
menu.chainShortNames = model.chainShortNames;
menu.ens = model.ens; menu.ens = model.ens;
menu.colorId = model.colorId; menu.colorId = model.colorId;
popup(parent, x, y); popup(parent, x, y);
@ -146,7 +138,6 @@ StatusListItem {
onClosed: { onClosed: {
menu.name = ""; menu.name = "";
menu.address = ""; menu.address = "";
menu.chainShortNames = ""
menu.ens = "" menu.ens = ""
menu.colorId = "" menu.colorId = ""
} }
@ -163,7 +154,6 @@ StatusListItem {
edit: true, edit: true,
address: menu.address, address: menu.address,
name: menu.name, name: menu.name,
chainShortNames: menu.chainShortNames,
ens: menu.ens, ens: menu.ens,
colorId: menu.colorId colorId: menu.colorId
}) })
@ -193,12 +183,10 @@ StatusListItem {
showSingleAccount: true, showSingleAccount: true,
showForSavedAddress: true, showForSavedAddress: true,
switchingAccounsEnabled: false, switchingAccounsEnabled: false,
changingPreferredChainsEnabled: true, hasFloatingButtons: false,
hasFloatingButtons: true,
name: menu.name, name: menu.name,
address: menu.address, address: menu.address,
colorId: menu.colorId, colorId: menu.colorId
preferredSharingChainIds: RootStore.getNetworkIds(menu.chainShortNames)
}) })
} }
} }
@ -218,13 +206,10 @@ StatusListItem {
} }
} }
StatusMenuSeparator { StatusMenuSeparator {}
visible: d.preferredSharedNetworkNamesArray.length > 0
}
StatusAction { StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.mainnet) text: qsTr("View on Etherscan")
enabled: d.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.mainnet)
icon.name: "link" icon.name: "link"
onTriggered: { onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.mainnet, root.areTestNetworksEnabled, root.isGoerliEnabled, d.visibleAddress ? d.visibleAddress : root.ens) let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.mainnet, root.areTestNetworksEnabled, root.isGoerliEnabled, d.visibleAddress ? d.visibleAddress : root.ens)
@ -232,26 +217,6 @@ StatusListItem {
} }
} }
StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.arbitrum)
enabled: d.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.arbitrum)
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.arbitrum, root.areTestNetworksEnabled, root.isGoerliEnabled, d.visibleAddress ? d.visibleAddress : root.ens)
Global.openLink(link)
}
}
StatusAction {
text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.optimism)
enabled: d.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.optimism)
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.optimism, root.areTestNetworksEnabled, root.isGoerliEnabled, d.visibleAddress ? d.visibleAddress : root.ens)
Global.openLink(link)
}
}
StatusMenuSeparator { } StatusMenuSeparator { }
StatusAction { StatusAction {
@ -267,8 +232,7 @@ StatusListItem {
name: menu.name, name: menu.name,
address: menu.address, address: menu.address,
ens: menu.ens, ens: menu.ens,
colorId: menu.colorId, colorId: menu.colorId
chainShortNames: menu.chainShortNames
}) })
} }
} }

View File

@ -32,8 +32,6 @@ StatusModal {
required property WalletStores.RootStore store required property WalletStores.RootStore store
required property SharedStores.RootStore sharedRootStore required property SharedStores.RootStore sharedRootStore
property var flatNetworks
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
width: 477 width: 477
@ -44,7 +42,6 @@ StatusModal {
function initWithParams(params = {}) { function initWithParams(params = {}) {
d.storedName = params.name?? "" d.storedName = params.name?? ""
d.storedColorId = params.colorId?? "" d.storedColorId = params.colorId?? ""
d.storedChainShortNames = params.chainShortNames?? ""
d.editMode = params.edit?? false d.editMode = params.edit?? false
d.addAddress = params.addAddress?? false d.addAddress = params.addAddress?? false
@ -53,7 +50,6 @@ StatusModal {
d.address = params.address?? Constants.zeroAddress d.address = params.address?? Constants.zeroAddress
d.ens = params.ens?? "" d.ens = params.ens?? ""
d.colorId = d.storedColorId d.colorId = d.storedColorId
d.chainShortNames = d.storedChainShortNames
d.initialized = true d.initialized = true
@ -68,9 +64,7 @@ StatusModal {
if (d.addressInputIsENS) if (d.addressInputIsENS)
addressInput.setPlainText(d.ens) addressInput.setPlainText(d.ens)
else else
addressInput.setPlainText("%1%2" addressInput.setPlainText("%1".arg(d.address == Constants.zeroAddress? "" : d.address))
.arg(d.chainShortNames)
.arg(d.address == Constants.zeroAddress? "" : d.address))
nameInput.input.edit.forceActiveFocus() nameInput.input.edit.forceActiveFocus()
} }
@ -92,20 +86,9 @@ StatusModal {
property string address: Constants.zeroAddress // Setting as zero address since we don't have the address yet property string address: Constants.zeroAddress // Setting as zero address since we don't have the address yet
property string ens: "" property string ens: ""
property string colorId: "" property string colorId: ""
property string chainShortNames: ""
property string storedName: "" property string storedName: ""
property string storedColorId: "" property string storedColorId: ""
property string storedChainShortNames: ""
property bool chainShortNamesDirty: false
property var networkSelection: []
onNetworkSelectionChanged: {
if (d.networkSelection !== networkSelectPopup.selection) {
networkSelectPopup.selection = d.networkSelection
}
}
property bool addressInputValid: d.editMode || property bool addressInputValid: d.editMode ||
addressInput.input.dirty && addressInput.input.dirty &&
@ -115,21 +98,19 @@ StatusModal {
!d.addressAlreadyAddedToSavedAddressesError !d.addressAlreadyAddedToSavedAddressesError
readonly property bool valid: d.addressInputValid && nameInput.valid readonly property bool valid: d.addressInputValid && nameInput.valid
readonly property bool dirty: nameInput.input.dirty && (!d.editMode || d.storedName !== d.name) readonly property bool dirty: nameInput.input.dirty && (!d.editMode || d.storedName !== d.name)
|| chainShortNamesDirty && (!d.editMode || d.storedChainShortNames !== d.chainShortNames) || !d.editMode
|| d.colorId.toUpperCase() !== d.storedColorId.toUpperCase() || d.colorId.toUpperCase() !== d.storedColorId.toUpperCase()
property bool incorrectChecksum: false property bool incorrectChecksum: false
readonly property var chainPrefixRegexPattern: /[^:]+\:?|:/g
readonly property bool addressInputIsENS: !!d.ens && readonly property bool addressInputIsENS: !!d.ens &&
Utils.isValidEns(d.ens) Utils.isValidEns(d.ens)
readonly property bool addressInputIsAddress: !!d.address && readonly property bool addressInputIsAddress: !!d.address &&
d.address != Constants.zeroAddress && d.address != Constants.zeroAddress &&
(Utils.isAddress(d.address) || Utils.isValidAddressWithChainPrefix(d.address)) Utils.isAddress(d.address)
readonly property bool addressInputHasError: !!addressInput.errorMessageCmp.text readonly property bool addressInputHasError: !!addressInput.errorMessageCmp.text
onAddressInputHasErrorChanged: addressInput.input.valid = !addressInputHasError // can't use binding because valid is overwritten in StatusInput onAddressInputHasErrorChanged: addressInput.input.valid = !addressInputHasError // can't use binding because valid is overwritten in StatusInput
readonly property string networksHiddenState: "networksHidden"
property ListModel cardsModel: ListModel {} property ListModel cardsModel: ListModel {}
@ -184,19 +165,13 @@ StatusModal {
property var contactsModuleInst: root.sharedRootStore.profileSectionModuleInst.contactsModule property var contactsModuleInst: root.sharedRootStore.profileSectionModuleInst.contactsModule
/// Ensures that the \c root.address and \c root.chainShortNames are not reset when the initial text is set /// Ensures that the \c root.address is not reset when the initial text is set
property bool initialized: false property bool initialized: false
function getPrefixArrayWithColumns(prefixStr) {
return prefixStr.match(d.chainPrefixRegexPattern)
}
function resetAddressValues(fullReset) { function resetAddressValues(fullReset) {
if (fullReset) { if (fullReset) {
d.ens = "" d.ens = ""
d.address = Constants.zeroAddress d.address = Constants.zeroAddress
d.chainShortNames = ""
d.networkSelection = []
} }
d.cardsModel.clear() d.cardsModel.clear()
@ -266,7 +241,6 @@ StatusModal {
return return
} }
networkSelector.state = ""
if (d.addressInputIsAddress) { if (d.addressInputIsAddress) {
d.checkForAddressInputOwningErrorsWarnings() d.checkForAddressInputOwningErrorsWarnings()
d.checkIfAddressChecksumIsValid() d.checkIfAddressChecksumIsValid()
@ -288,7 +262,7 @@ StatusModal {
return return
} }
root.store.createOrUpdateSavedAddress(d.name, d.address, d.ens, d.colorId, d.chainShortNames) root.store.createOrUpdateSavedAddress(d.name, d.address, d.ens, d.colorId)
root.close() root.close()
} }
} }
@ -307,11 +281,6 @@ StatusModal {
} }
catch (e) { catch (e) {
} }
if (!d.addressInputHasError)
networkSelector.state = d.networksHiddenState
else
networkSelector.state = ""
} }
} }
@ -500,15 +469,7 @@ StatusModal {
plainText = input.edit.getText(0, text.length).trim() plainText = input.edit.getText(0, text.length).trim()
if (input.edit.previousText != plainText) { if (input.edit.previousText != plainText) {
let newText = plainText setRichText(plainText)
const prefixAndAddress = Utils.splitToChainPrefixAndAddress(plainText)
if (!Utils.isLikelyEnsName(plainText)) {
newText = WalletUtils.colorizedChainPrefix(prefixAndAddress.prefix) +
prefixAndAddress.address
}
setRichText(newText)
// Reset // Reset
d.resetAddressValues(plainText.length == 0) d.resetAddressValues(plainText.length == 0)
@ -518,18 +479,10 @@ StatusModal {
if (Utils.isLikelyEnsName(plainText)) { if (Utils.isLikelyEnsName(plainText)) {
d.ens = plainText d.ens = plainText
d.address = Constants.zeroAddress d.address = Constants.zeroAddress
d.chainShortNames = ""
} }
else { else {
d.ens = "" d.ens = ""
d.address = prefixAndAddress.address d.address = plainText
d.chainShortNames = prefixAndAddress.prefix
Qt.callLater(()=> {
// Sync chain short names with model. This could result in removing networks from this text
// Call it later to avoid binding loop warnings
d.networkSelection = store.getNetworkIds(d.chainShortNames).split(":").filter(Boolean).map(Number)
})
} }
} }
@ -555,41 +508,6 @@ StatusModal {
input.cursorPosition = curPos input.cursorPosition = curPos
skipTextUpdate = false skipTextUpdate = false
} }
function getUnknownPrefixes(prefixes) {
const networksCount = root.flatNetworks.rowCount()
let unknownPrefixes = prefixes.filter(e => {
for (let i = 0; i < networksCount; i++) {
if (e == StatusQUtils.ModelUtils.get(root.flatNetworks, i).shortName)
return false
}
return true
})
return unknownPrefixes
}
// Add all chain short names from model, while keeping existing
function syncChainPrefixWithModel(prefix, model) {
let prefixes = prefix.split(":").filter(Boolean)
let prefixStr = ""
// Keep unknown prefixes from user input, the rest must be taken
// from the model
for (let i = 0; i < model.count; i++) {
const item = model.get(i)
prefixStr += item.shortName + ":"
// Remove all added prefixes from initial array
prefixes = prefixes.filter(e => e !== item.shortName)
}
const unknownPrefixes = getUnknownPrefixes(prefixes)
if (unknownPrefixes.length > 0) {
prefixStr += unknownPrefixes.join(":") + ":"
}
return prefixStr
}
} }
Column { Column {
@ -647,110 +565,6 @@ StatusModal {
d.colorId = Utils.getIdForColor(selectedColor) d.colorId = Utils.getIdForColor(selectedColor)
} }
} }
StatusNetworkSelector {
id: networkSelector
objectName: "addSavedAddressNetworkSelector"
title: qsTr("Network preference")
implicitWidth: d.componentWidth
anchors.horizontalCenter: parent.horizontalCenter
enabled: d.addressInputValid && !d.addressInputIsENS
visible: !(d.editMode && d.addressInputIsENS)
defaultItemText: qsTr("Add networks")
defaultItemImageSource: "add"
rightButtonVisible: true
itemsModel: SortFilterProxyModel {
sourceModel: root.flatNetworks
filters: FastExpressionFilter {
readonly property var filteredNetworks: d.networkSelection
expression: {
return filteredNetworks.length > 0 && filteredNetworks.includes(model.chainId)
}
expectedRoles: ["chainId"]
}
onCountChanged: {
if (d.initialized) {
// Initially source model is empty, filter proxy is also empty, but does
// extra work and mistakenly overwrites d.chainShortNames property
if (sourceModel.count != 0) {
const prefixAndAddress = Utils.splitToChainPrefixAndAddress(addressInput.plainText)
const syncedPrefix = addressInput.syncChainPrefixWithModel(prefixAndAddress.prefix, this)
if (addressInput.text !== syncedPrefix + prefixAndAddress.address)
addressInput.setPlainText(syncedPrefix + prefixAndAddress.address)
}
}
}
}
addButton.highlighted: networkSelectPopup.visible
addButton.onClicked: {
networkSelectPopup.openAtPosition(addButton.x, addButton.height + Style.current.xlPadding)
}
onItemClicked: function (item, index, mouse) {
// Append first item
if (index === 0 && defaultItem.visible)
networkSelectPopup.openAtPosition(defaultItem.x, defaultItem.height + Style.current.xlPadding)
}
onItemRightButtonClicked: function (item, index, mouse) {
let networkSelection = [...d.networkSelection]
d.networkSelection = networkSelection.filter(n => n !== item.modelRef.chainId)
d.chainShortNamesDirty = true
}
readonly property int animationDuration: 350
states: [
// As when networks seclector becomes invisible, spacing before it disappears as well, we see jumping height
// To overcome this, we animate bottom padding to 0 and when spacing disappears, reset bottom padding to spacing to compensate it
State {
name: d.networksHiddenState
PropertyChanges { target: networkSelector; height: 0 }
PropertyChanges { target: networkSelector; opacity: 0 }
PropertyChanges { target: column; bottomPadding: 0 }
}
]
transitions: [
Transition {
NumberAnimation { property: "height"; duration: networkSelector.animationDuration; easing.type: Easing.OutCirc }
NumberAnimation { property: "opacity"; duration: networkSelector.animationDuration; easing.type: Easing.OutCirc}
SequentialAnimation {
NumberAnimation { property: "bottomPadding"; duration: networkSelector.animationDuration; easing.type: Easing.OutCirc }
PropertyAction { target: column; property: "bottomPadding"; value: column.spacing }
}
}
]
NetworkSelectPopup {
id: networkSelectPopup
function openAtPosition(x, y) {
networkSelectPopup.x = x
networkSelectPopup.y = y
networkSelectPopup.open()
}
flatNetworks: root.flatNetworks
selection: d.networkSelection
multiSelection: true
onSelectionChanged: {
if (d.networkSelection !== networkSelectPopup.selection) {
d.networkSelection = networkSelectPopup.selection
d.chainShortNamesDirty = true
}
}
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
modal: true
dim: false
}
}
} }
} }

View File

@ -32,21 +32,12 @@ StatusModal {
property var selectedAccount property var selectedAccount
property bool switchingAccounsEnabled: true property bool switchingAccounsEnabled: true
property bool changingPreferredChainsEnabled: true
property string qrImageSource: root.store.getQrCode(d.visibleAddress) property string qrImageSource: root.store.getQrCode(root.selectedAccount.address)
property var getNetworkShortNames: function(chainIDsString) {
return root.store.getNetworkShortNames(chainIDsString)
}
property WalletStores.RootStore store: WalletStores.RootStore property WalletStores.RootStore store: WalletStores.RootStore
signal updateSelectedAddress(string address) signal updateSelectedAddress(string address)
signal updatePreferredChains(string address, string preferredChains)
onSelectedAccountChanged: {
d.preferredChainIdsArray = root.selectedAccount.preferredSharingChainIds.split(":").filter(Boolean).map(Number)
}
width: 556 width: 556
contentHeight: content.implicitHeight + d.advanceFooterHeight contentHeight: content.implicitHeight + d.advanceFooterHeight
@ -64,19 +55,7 @@ StatusModal {
width: implicitWidth width: implicitWidth
model: SortFilterProxyModel { model: SortFilterProxyModel {
sourceModel: root.accounts sourceModel: root.accounts
sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder } sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder }
proxyRoles: [
FastExpressionRole {
name: "colorizedChainPrefixes"
function getChainShortNames(chainIds) {
const chainShortNames = root.getNetworkShortNames(chainIds)
return WalletUtils.colorizedChainPrefix(chainShortNames)
}
expression: getChainShortNames(model.preferredSharingChainIds)
expectedRoles: ["preferredSharingChainIds"]
}
]
} }
selectedAddress: !!root.selectedAccount ? root.selectedAccount.address : "" selectedAddress: !!root.selectedAccount ? root.selectedAccount.address : ""
@ -129,7 +108,7 @@ StatusModal {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
text: WalletUtils.colorizedChainPrefix(d.preferredChainShortNames) + root.selectedAccount.address text: root.selectedAccount.address
font.pixelSize: 15 font.pixelSize: 15
color: Theme.palette.directColor1 color: Theme.palette.directColor1
} }
@ -141,7 +120,7 @@ StatusModal {
Layout.preferredWidth: 32 Layout.preferredWidth: 32
Layout.preferredHeight: 32 Layout.preferredHeight: 32
Layout.fillWidth: true Layout.fillWidth: true
textToCopy: d.visibleAddress textToCopy: root.selectedAccount.address
successCircleVisible: true successCircleVisible: true
} }
} }
@ -155,22 +134,7 @@ StatusModal {
QtObject { QtObject {
id: d id: d
readonly property bool multiChainView: tabBar.currentIndex === 1
readonly property int advanceFooterHeight: 88 readonly property int advanceFooterHeight: 88
property var preferredChainIdsArray: []
Binding on preferredChainIdsArray {
value: root.selectedAccount.preferredSharingChainIds.split(":").filter(Boolean).map(Number)
}
onPreferredChainIdsArrayChanged: {
if (preferredChainIdsArray !== selectPopup.selection) {
selectPopup.selection = preferredChainIdsArray
}
}
property var preferredChainIds: d.preferredChainIdsArray.join(":")
readonly property string preferredChainShortNames: d.multiChainView? root.getNetworkShortNames(d.preferredChainIds) : ""
readonly property string visibleAddress: "%1%2".arg(d.preferredChainShortNames).arg(root.selectedAccount.address)
} }
Column { Column {
@ -182,21 +146,6 @@ StatusModal {
bottomPadding: Style.current.xlPadding bottomPadding: Style.current.xlPadding
spacing: Style.current.bigPadding spacing: Style.current.bigPadding
StatusSwitchTabBar {
id: tabBar
anchors.horizontalCenter: parent.horizontalCenter
currentIndex: 1
StatusSwitchTabButton {
objectName: "legacyButton"
text: qsTr("Legacy")
}
StatusSwitchTabButton {
objectName: "multichainButton"
text: qsTr("Multichain")
}
}
Item { Item {
id: qrCode id: qrCode
height: 320 height: 320
@ -267,72 +216,6 @@ StatusModal {
} }
} }
} }
Item {
width: parent.width
height: Math.max(flow.height, editButton.height)
anchors.horizontalCenter: parent.horizontalCenter
visible: d.multiChainView && (d.preferredChainIdsArray.length > 0 || root.changingPreferredChainsEnabled)
Flow {
id: flow
anchors.horizontalCenter: parent.horizontalCenter
spacing: 5
Repeater {
model: root.store.filteredFlatModel
delegate: StatusNetworkListItemTag {
enabled: false
button.visible: false
title: model.shortName
asset.name: model.isTest ? Style.svg(model.iconUrl + "-test") : Style.svg(model.iconUrl)
visible: d.preferredChainIdsArray.includes(model.chainId)
}
}
}
StatusRoundButton {
id: editButton
width: 32
height: 32
anchors.right: parent.right
anchors.rightMargin: Style.current.bigPadding
anchors.verticalCenter: parent.verticalCenter
icon.name: "edit_pencil"
type: StatusRoundButton.Type.Tertiary
visible: root.changingPreferredChainsEnabled
highlighted: selectPopup.visible
onClicked: selectPopup.open()
NetworkSelectPopup {
id: selectPopup
property string initialSelection
x: editButton.width - width
y: editButton.height + 2
margins: -1 // to allow positioning outside the bounds of the dialog
flatNetworks: root.store.filteredFlatModel
selection: d.preferredChainIdsArray
multiSelection: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
onSelectionChanged: {
if (selection !== d.preferredChainIdsArray)
d.preferredChainIdsArray = selection
}
onOpened: initialSelection = JSON.stringify(selection)
onClosed: {
if (initialSelection !== JSON.stringify(selection))
root.updatePreferredChains(root.selectedAccount.address, d.preferredChainIds)
}
}
}
}
} }
} }

View File

@ -22,7 +22,6 @@ StatusDialog {
property string address property string address
property string ens property string ens
property string colorId property string colorId
property string chainShortNames
signal removeSavedAddress(string address) signal removeSavedAddress(string address)
@ -46,7 +45,7 @@ StatusDialog {
if (root.ens.length > 0) if (root.ens.length > 0)
return root.ens return root.ens
return WalletUtils.colorizedChainPrefix(root.chainShortNames) + Utils.richColorText(StatusQUtils.Utils.elideText(root.address, 6, 4), Theme.palette.directColor1) return Utils.richColorText(StatusQUtils.Utils.elideText(root.address, 6, 4), Theme.palette.directColor1)
} }
actions.closeButton.onClicked: root.close() actions.closeButton.onClicked: root.close()

View File

@ -43,7 +43,6 @@ StatusModal {
d.address = params.address?? Constants.zeroAddress d.address = params.address?? Constants.zeroAddress
d.ens = params.ens?? "" d.ens = params.ens?? ""
d.colorId = params.colorId?? "" d.colorId = params.colorId?? ""
d.chainShortNames = params.chainShortNames?? ""
walletSection.activityController.setFilterToAddresses(JSON.stringify([d.address])) walletSection.activityController.setFilterToAddresses(JSON.stringify([d.address]))
walletSection.activityController.updateFilter() walletSection.activityController.updateFilter()
@ -62,7 +61,6 @@ StatusModal {
property string address: Constants.zeroAddress property string address: Constants.zeroAddress
property string ens: "" property string ens: ""
property string colorId: "" property string colorId: ""
property string chainShortNames: ""
readonly property string visibleAddress: !!d.ens? d.ens : d.address readonly property string visibleAddress: !!d.ens? d.ens : d.address
@ -133,7 +131,7 @@ StatusModal {
return d.ens return d.ens
} }
else { else {
return WalletUtils.colorizedChainPrefix(d.chainShortNames) + Utils.richColorText(StatusQUtils.Utils.elideText(d.address,6,4), Theme.palette.directColor1) return Utils.richColorText(StatusQUtils.Utils.elideText(d.address,6,4), Theme.palette.directColor1)
} }
} }
return "" return ""
@ -152,7 +150,6 @@ StatusModal {
name: d.name name: d.name
address: d.address address: d.address
chainShortNames: d.chainShortNames
ens: d.ens ens: d.ens
colorId: d.colorId colorId: d.colorId
@ -213,7 +210,7 @@ StatusModal {
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: !!d.ens? d.ens : WalletUtils.colorizedChainPrefix(d.chainShortNames) + d.address text: !!d.ens ? d.ens : d.address
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
font.pixelSize: 15 font.pixelSize: 15
color: Theme.palette.directColor1 color: Theme.palette.directColor1

View File

@ -58,7 +58,6 @@ StatusMenu {
property string addressName: "" property string addressName: ""
property string addressEns: "" property string addressEns: ""
property string colorId: "" property string colorId: ""
property string addressChains: ""
property string contractName: "" property string contractName: ""
@ -155,7 +154,6 @@ StatusMenu {
d.addressName = savedAddress.name d.addressName = savedAddress.name
d.addressEns = savedAddress.ens d.addressEns = savedAddress.ens
d.colorId = savedAddress.colorId d.colorId = savedAddress.colorId
d.addressChains = savedAddress.chainShortNames
} }
} }
@ -300,7 +298,6 @@ StatusMenu {
onTriggered: Global.openShowQRPopup({ onTriggered: Global.openShowQRPopup({
showSingleAccount: true, showSingleAccount: true,
switchingAccounsEnabled: false, switchingAccounsEnabled: false,
changingPreferredChainsEnabled: false,
hasFloatingButtons: false, hasFloatingButtons: false,
name: d.addressName, name: d.addressName,
address: d.selectedAddress, address: d.selectedAddress,
@ -326,8 +323,7 @@ StatusMenu {
Global.openAddEditSavedAddressesPopup({ Global.openAddEditSavedAddressesPopup({
addAddress: true, addAddress: true,
address: d.selectedAddress, address: d.selectedAddress,
ens: d.addressEns, ens: d.addressEns
chainShortNames: d.addressChains
}) })
} }
} }
@ -341,9 +337,7 @@ StatusMenu {
name: d.addressName, name: d.addressName,
address: d.selectedAddress, address: d.selectedAddress,
ens: d.addressEns, ens: d.addressEns,
colorId: d.colorId, colorId: d.colorId})
chainShortNames: d.addressChains
})
} }
StatusAction { StatusAction {
id: sendToAddressAction id: sendToAddressAction

View File

@ -290,7 +290,6 @@ QtObject {
address: "", address: "",
ens: "", ens: "",
colorId: Constants.walletAccountColors.primary, colorId: Constants.walletAccountColors.primary,
chainShortNames: "",
isTest: false, isTest: false,
} }
@ -356,13 +355,9 @@ QtObject {
return walletSectionAccounts.getColorByAddress(address) return walletSectionAccounts.getColorByAddress(address)
} }
function createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames) { function createOrUpdateSavedAddress(name, address, ens, colorId) {
root.addingSavedAddress = true root.addingSavedAddress = true
walletSectionSavedAddresses.createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames) walletSectionSavedAddresses.createOrUpdateSavedAddress(name, address, ens, colorId)
}
function updatePreferredChains(address, chainShortNames) {
walletSectionSavedAddresses.updatePreferredChains(address, chainShortNames)
} }
function deleteSavedAddress(address) { function deleteSavedAddress(address) {
@ -419,15 +414,6 @@ QtObject {
return networksModule.getNetworkIds(shortNames) return networksModule.getNetworkIds(shortNames)
} }
function updateWalletAccountPreferredChains(address, preferredChainIds) {
if(areTestNetworksEnabled) {
walletSectionAccounts.updateWalletAccountTestPreferredChains(address, preferredChainIds)
}
else {
walletSectionAccounts.updateWalletAccountProdPreferredChains(address, preferredChainIds)
}
}
function updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) { function updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) {
walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)
} }

View File

@ -121,8 +121,7 @@ ColumnLayout {
let keyword = searchBox.text.trim().toUpperCase() let keyword = searchBox.text.trim().toUpperCase()
return spellingTolerantSearch(model.name, keyword) || return spellingTolerantSearch(model.name, keyword) ||
model.address.toUpperCase().includes(keyword) || model.address.toUpperCase().includes(keyword) ||
model.ens.toUpperCase().includes(keyword) || model.ens.toUpperCase().includes(keyword)
model.chainShortNames.toUpperCase().includes(keyword)
} }
} }
} }
@ -146,7 +145,6 @@ ColumnLayout {
objectName: "savedAddressView_Delegate_" + name objectName: "savedAddressView_Delegate_" + name
name: model.name name: model.name
address: model.mixedcaseAddress address: model.mixedcaseAddress
chainShortNames: model.chainShortNames
ens: model.ens ens: model.ens
colorId: model.colorId colorId: model.colorId
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore

View File

@ -1901,7 +1901,6 @@ Item {
sourceComponent: WalletPopups.AddEditSavedAddressPopup { sourceComponent: WalletPopups.AddEditSavedAddressPopup {
store: WalletStores.RootStore store: WalletStores.RootStore
sharedRootStore: appMain.sharedRootStore sharedRootStore: appMain.sharedRootStore
flatNetworks: WalletStores.RootStore.filteredFlatModel
onClosed: { onClosed: {
addEditSavedAddress.close() addEditSavedAddress.close()
@ -1968,7 +1967,6 @@ Item {
deleteSavedAddress.item.ens = deleteSavedAddress.params.ens?? "" deleteSavedAddress.item.ens = deleteSavedAddress.params.ens?? ""
deleteSavedAddress.item.name = deleteSavedAddress.params.name?? "" deleteSavedAddress.item.name = deleteSavedAddress.params.name?? ""
deleteSavedAddress.item.colorId = deleteSavedAddress.params.colorId?? "blue" deleteSavedAddress.item.colorId = deleteSavedAddress.params.colorId?? "blue"
deleteSavedAddress.item.chainShortNames = deleteSavedAddress.params.chainShortNames?? ""
deleteSavedAddress.item.open() deleteSavedAddress.item.open()
} }
@ -2051,7 +2049,6 @@ Item {
onLoaded: { onLoaded: {
showQR.item.switchingAccounsEnabled = showQR.params.switchingAccounsEnabled?? true showQR.item.switchingAccounsEnabled = showQR.params.switchingAccounsEnabled?? true
showQR.item.changingPreferredChainsEnabled = showQR.params.changingPreferredChainsEnabled?? true
showQR.item.hasFloatingButtons = showQR.params.hasFloatingButtons?? true showQR.item.hasFloatingButtons = showQR.params.hasFloatingButtons?? true
showQR.item.open() showQR.item.open()
@ -2087,15 +2084,6 @@ Item {
appMain.transactionStore.setReceiverAccount(address) appMain.transactionStore.setReceiverAccount(address)
} }
onUpdatePreferredChains: {
if (showQR.showForSavedAddress) {
let shortNames = WalletStores.RootStore.getNetworkShortNames(preferredChains)
WalletStores.RootStore.updatePreferredChains(address, shortNames)
return
}
WalletStores.RootStore.updateWalletAccountPreferredChains(address, preferredChains)
}
onClosed: { onClosed: {
showQR.close() showQR.close()
} }

View File

@ -24,7 +24,7 @@ StatusListItem {
} }
else { else {
let elidedAddress = StatusQUtils.Utils.elideText(modelData.address,6,4) let elidedAddress = StatusQUtils.Utils.elideText(modelData.address,6,4)
return sensor.containsMouse ? WalletUtils.colorizedChainPrefix(modelData.chainShortNames) + Utils.richColorText(elidedAddress, Theme.palette.directColor1): modelData.chainShortNames + elidedAddress return sensor.containsMouse ? Utils.richColorText(elidedAddress, Theme.palette.directColor1): elidedAddress
} }
} }
return "" return ""

View File

@ -56,7 +56,6 @@ Loader {
d.isPending = true d.isPending = true
d.resolveENS(root.selectedRecipient.ens) d.resolveENS(root.selectedRecipient.ens)
} }
preferredChainIds = store.getShortChainIds(root.selectedRecipient.chainShortNames)
break break
} }
case Helpers.RecipientAddressObjectType.RecentsAddress: { case Helpers.RecipientAddressObjectType.RecentsAddress: {
@ -133,7 +132,6 @@ Loader {
Component { Component {
id: savedAddressRecipient id: savedAddressRecipient
SavedAddressListItem { SavedAddressListItem {
property string chainShortNames: !!modelData ? modelData.chainShortNames: ""
implicitWidth: parent.width implicitWidth: parent.width
modelData: root.selectedRecipient modelData: root.selectedRecipient
radius: 8 radius: 8
@ -145,7 +143,7 @@ Loader {
if (!!modelData && !!modelData.ens && modelData.ens.length > 0) if (!!modelData && !!modelData.ens && modelData.ens.length > 0)
return Utils.richColorText(modelData.ens, Theme.palette.directColor1) return Utils.richColorText(modelData.ens, Theme.palette.directColor1)
else else
return WalletUtils.colorizedChainPrefix(modelData.chainShortNames) + StatusQUtils.Utils.elideText(modelData.address,6,4) return StatusQUtils.Utils.elideText(modelData.address,6,4)
} }
return "" return ""
} }

View File

@ -161,10 +161,6 @@ QtObject {
} }
} }
function getShortChainIds(chainShortNames) {
return walletSectionSendInst.getShortChainIds(chainShortNames)
}
function formatCurrencyAmountFromBigInt(balance, symbol, decimals, options = null) { function formatCurrencyAmountFromBigInt(balance, symbol, decimals, options = null) {
return currencyStore.formatCurrencyAmountFromBigInt(balance, symbol, decimals, options) return currencyStore.formatCurrencyAmountFromBigInt(balance, symbol, decimals, options)
} }

View File

@ -161,30 +161,6 @@ Item {
Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link)); Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link));
} }
} }
StatusAction {
text: qsTr("View on Optimism Explorer")
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.optimism,
root.walletStore.areTestNetworksEnabled,
root.walletStore.isGoerliEnabled,
contextMenu.accountAddress);
Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link));
}
}
StatusAction {
text: qsTr("View on Arbiscan")
icon.name: "link"
onTriggered: {
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.arbitrum,
root.walletStore.areTestNetworksEnabled,
root.walletStore.isGoerliEnabled,
contextMenu.accountAddress);
Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link));
}
}
} }
} }

View File

@ -40,10 +40,6 @@ QtObject {
return startsWith0x(value) && isHex(value) && value.length === 42 return startsWith0x(value) && isHex(value) && value.length === 42
} }
function isValidAddressWithChainPrefix(value) {
return value.match(/^(([a-zA-Z]{3,5}:)*)?(0x[a-fA-F0-9]{40})$/)
}
function getChainsPrefix(address) { function getChainsPrefix(address) {
// matchAll is not supported by QML JS engine // matchAll is not supported by QML JS engine
return address.match(/([a-zA-Z]{3,5}:)*/)[0].split(':').filter(e => !!e) return address.match(/([a-zA-Z]{3,5}:)*/)[0].split(':').filter(e => !!e)
@ -644,17 +640,6 @@ QtObject {
Theme.palette.warningColor1 Theme.palette.warningColor1
} }
function getActionNameForDisplayingAddressOnNetwork(networkShortName) {
if (networkShortName === Constants.networkShortChainNames.arbitrum) {
return qsTr("View on Arbiscan")
}
if (networkShortName === Constants.networkShortChainNames.optimism) {
return qsTr("View on Optimism Explorer")
}
return qsTr("View on Etherscan")
}
function getEtherscanUrl(networkShortName, testnetMode, sepoliaEnabled, addressOrTx, isAddressNotTx) { function getEtherscanUrl(networkShortName, testnetMode, sepoliaEnabled, addressOrTx, isAddressNotTx) {
const type = isAddressNotTx const type = isAddressNotTx
? Constants.networkExplorerLinks.addressPath ? Constants.networkExplorerLinks.addressPath