From 7003ba73e21994e6c9494b5290dad008b44f28e1 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Thu, 3 Oct 2024 22:13:01 +0200 Subject: [PATCH] feat(@desktop/wallet): Remove network prefixes in saved addresses and ReceiveModal --- .../wallet/accounts/controller.nim | 8 +- .../wallet/accounts/io_interface.nim | 6 - .../profile_section/wallet/accounts/model.nim | 12 -- .../wallet/accounts/module.nim | 10 - .../profile_section/wallet/accounts/view.nim | 11 - .../wallet_section/accounts/controller.nim | 6 - .../wallet_section/accounts/io_interface.nim | 6 - .../main/wallet_section/accounts/model.nim | 12 -- .../main/wallet_section/accounts/module.nim | 11 +- .../main/wallet_section/accounts/view.nim | 9 - .../saved_addresses/controller.nim | 5 +- .../saved_addresses/io_interface.nim | 6 +- .../wallet_section/saved_addresses/item.nim | 7 - .../wallet_section/saved_addresses/model.nim | 4 - .../wallet_section/saved_addresses/module.nim | 15 +- .../wallet_section/saved_addresses/view.nim | 10 +- .../modules/main/wallet_section/send/view.nim | 8 - .../shared_models/keypair_account_item.nim | 6 - .../shared_models/keypair_account_model.nim | 6 - .../modules/shared_models/keypair_item.nim | 2 - .../modules/shared_models/keypair_model.nim | 6 - .../service/saved_address/async_tasks.nim | 2 - src/app_service/service/saved_address/dto.nim | 5 +- .../service/saved_address/service.nim | 6 +- .../wallet_account/service_account.nim | 52 +---- .../wallet_account/signals_and_payloads.nim | 1 - .../pages/AddEditSavedAddressPopupPage.qml | 7 +- storybook/pages/ReceiveModalPage.qml | 45 ---- .../pages/RecipientSelectorPanelPage.qml | 1 - storybook/pages/TransactionDetailViewPage.qml | 1 - .../tests/tst_RecipientSelectorPanel.qml | 1 - storybook/src/Models/RecipientModel.qml | 3 - .../AppLayouts/Wallet/stores/RootStore.qml | 2 +- .../shared/stores/send/TransactionStore.qml | 11 - .../Profile/popups/WalletAddressMenu.qml | 21 +- ui/app/AppLayouts/Wallet/WalletLayout.qml | 2 - .../controls/SavedAddressesDelegate.qml | 48 +---- .../popups/AddEditSavedAddressPopup.qml | 200 +----------------- .../AppLayouts/Wallet/popups/ReceiveModal.qml | 123 +---------- .../Wallet/popups/RemoveSavedAddressPopup.qml | 3 +- .../popups/SavedAddressActivityPopup.qml | 7 +- .../Wallet/popups/TransactionAddressMenu.qml | 16 +- ui/app/AppLayouts/Wallet/stores/RootStore.qml | 18 +- .../Wallet/views/SavedAddresses.qml | 4 +- ui/app/mainui/AppMain.qml | 12 -- .../send/controls/SavedAddressListItem.qml | 2 +- .../popups/send/views/RecipientView.qml | 4 +- .../shared/stores/send/TransactionStore.qml | 4 - .../profile/ProfileShowcaseAccountsView.qml | 24 --- ui/imports/utils/Utils.qml | 15 -- 50 files changed, 47 insertions(+), 759 deletions(-) diff --git a/src/app/modules/main/profile_section/wallet/accounts/controller.nim b/src/app/modules/main/profile_section/wallet/accounts/controller.nim index ee6c3f1097..dadda5379d 100644 --- a/src/app/modules/main/profile_section/wallet/accounts/controller.nim +++ b/src/app/modules/main/profile_section/wallet/accounts/controller.nim @@ -60,12 +60,6 @@ proc getCurrentCurrency*(self: Controller): string = proc getCurrencyFormat*(self: Controller, symbol: string): CurrencyFormatDto = 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 = return self.walletAccountService.areTestNetworksEnabled() @@ -73,4 +67,4 @@ proc getTotalCurrencyBalance*(self: Controller, address: string, chainIds: seq[i return self.walletAccountService.getTotalCurrencyBalance(@[address], chainIds) proc updateWatchAccountHiddenFromTotalBalance*(self: Controller, address: string, hideFromTotalBalance: bool) = - discard self.walletAccountService.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) \ No newline at end of file + discard self.walletAccountService.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) diff --git a/src/app/modules/main/profile_section/wallet/accounts/io_interface.nim b/src/app/modules/main/profile_section/wallet/accounts/io_interface.nim index 9d68ca541a..cb04a3d2f2 100644 --- a/src/app/modules/main/profile_section/wallet/accounts/io_interface.nim +++ b/src/app/modules/main/profile_section/wallet/accounts/io_interface.nim @@ -46,11 +46,5 @@ method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} = method getCollectiblesModel*(self: AccessInterface): QVariant {.base.} = 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.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/profile_section/wallet/accounts/model.nim b/src/app/modules/main/profile_section/wallet/accounts/model.nim index 4fc345275d..71dd31d8c7 100644 --- a/src/app/modules/main/profile_section/wallet/accounts/model.nim +++ b/src/app/modules/main/profile_section/wallet/accounts/model.nim @@ -81,18 +81,6 @@ QtObject: break 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 = if (not index.isValid): return diff --git a/src/app/modules/main/profile_section/wallet/accounts/module.nim b/src/app/modules/main/profile_section/wallet/accounts/module.nim index 5dcd1c4280..e36535f082 100644 --- a/src/app/modules/main/profile_section/wallet/accounts/module.nim +++ b/src/app/modules/main/profile_section/wallet/accounts/module.nim @@ -184,10 +184,6 @@ method load*(self: Module) = self.events.on(SIGNAL_WALLET_ACCOUNT_POSITION_UPDATED) do(e:Args): 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): let args = AccountArgs(e) 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) = 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) = self.controller.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) diff --git a/src/app/modules/main/profile_section/wallet/accounts/view.nim b/src/app/modules/main/profile_section/wallet/accounts/view.nim index 8759c17808..81c693d838 100644 --- a/src/app/modules/main/profile_section/wallet/accounts/view.nim +++ b/src/app/modules/main/profile_section/wallet/accounts/view.nim @@ -93,11 +93,6 @@ QtObject: self.keyPairModel.onUpdatedKeypairOperability(keyUid, operability) 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) = self.keyPairModel.onHideFromTotalBalanceUpdated(keyUid, address, hideFromTotalBalance) self.refreshSelectedAccount() @@ -135,12 +130,6 @@ QtObject: proc moveAccountFinally(self: View, fromRow: int, toRow: int) {.slot.} = 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) = self.keyPairModel.setBalanceForAddress(address, balance) self.refreshSelectedAccount() diff --git a/src/app/modules/main/wallet_section/accounts/controller.nim b/src/app/modules/main/wallet_section/accounts/controller.nim index 668a45caa0..2b33602756 100644 --- a/src/app/modules/main/wallet_section/accounts/controller.nim +++ b/src/app/modules/main/wallet_section/accounts/controller.nim @@ -59,12 +59,6 @@ proc getWalletAccount*(self: Controller, address: string): WalletAccountDto = proc updateAccount*(self: Controller, address: string, accountName: string, colorId: string, emoji: string) = 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 = return self.walletAccountService.areTestNetworksEnabled() diff --git a/src/app/modules/main/wallet_section/accounts/io_interface.nim b/src/app/modules/main/wallet_section/accounts/io_interface.nim index ae270b1ea9..acbf08c2f1 100644 --- a/src/app/modules/main/wallet_section/accounts/io_interface.nim +++ b/src/app/modules/main/wallet_section/accounts/io_interface.nim @@ -34,11 +34,5 @@ method getWalletAccountAsJson*(self: AccessInterface, address: string): JsonNode method viewDidLoad*(self: AccessInterface) {.base.} = 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.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/wallet_section/accounts/model.nim b/src/app/modules/main/wallet_section/accounts/model.nim index d3208fa37b..e6f48b88ac 100644 --- a/src/app/modules/main/wallet_section/accounts/model.nim +++ b/src/app/modules/main/wallet_section/accounts/model.nim @@ -253,15 +253,3 @@ QtObject: if i < 0: return false 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 \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/accounts/module.nim b/src/app/modules/main/wallet_section/accounts/module.nim index 8d67be8e92..8892de30f0 100644 --- a/src/app/modules/main/wallet_section/accounts/module.nim +++ b/src/app/modules/main/wallet_section/accounts/module.nim @@ -98,9 +98,6 @@ method load*(self: Module) = self.controller.init() 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.refreshAllWalletAccountsBalances() 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) = 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) = self.controller.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) @@ -160,4 +151,4 @@ method getWalletAccountAsJson*(self: Module, address: string): JsonNode = let walletAccountDto = self.controller.getWalletAccount(address) if walletAccountDto.isNil: return newJNull() - return % walletAccountDto \ No newline at end of file + return % walletAccountDto diff --git a/src/app/modules/main/wallet_section/accounts/view.nim b/src/app/modules/main/wallet_section/accounts/view.nim index e9e0f4f145..80956b18aa 100644 --- a/src/app/modules/main/wallet_section/accounts/view.nim +++ b/src/app/modules/main/wallet_section/accounts/view.nim @@ -74,17 +74,8 @@ QtObject: proc isOwnedAccount(self: View, address: string): bool {.slot.} = 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.} = self.delegate.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) proc getWalletAccountAsJson*(self: View, address: string): string {.slot.} = return $self.delegate.getWalletAccountAsJson(address) - - proc onPreferredSharingChainsUpdated*(self: View, keyUid, address, prodPreferredChainIds, testPreferredChainIds: string) = - self.accounts.onPreferredSharingChainsUpdated(address, prodPreferredChainIds, testPreferredChainIds) \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/saved_addresses/controller.nim b/src/app/modules/main/wallet_section/saved_addresses/controller.nim index 383045c87b..aa9c2cc379 100644 --- a/src/app/modules/main/wallet_section/saved_addresses/controller.nim +++ b/src/app/modules/main/wallet_section/saved_addresses/controller.nim @@ -46,9 +46,8 @@ proc getSavedAddresses*(self: Controller): seq[saved_address_service.SavedAddres proc getSavedAddress*(self: Controller, address: string, ignoreNetworkMode: bool): SavedAddressDto = return self.savedAddressService.getSavedAddress(address, ignoreNetworkMode) -proc createOrUpdateSavedAddress*(self: Controller, name: string, address: string, ens: string, colorId: string, - chainShortNames: string) = - self.savedAddressService.createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames) +proc createOrUpdateSavedAddress*(self: Controller, name: string, address: string, ens: string, colorId: string) = + self.savedAddressService.createOrUpdateSavedAddress(name, address, ens, colorId) proc deleteSavedAddress*(self: Controller, address: string) = self.savedAddressService.deleteSavedAddress(address) diff --git a/src/app/modules/main/wallet_section/saved_addresses/io_interface.nim b/src/app/modules/main/wallet_section/saved_addresses/io_interface.nim index 23ffff93c6..b6296cb34e 100644 --- a/src/app/modules/main/wallet_section/saved_addresses/io_interface.nim +++ b/src/app/modules/main/wallet_section/saved_addresses/io_interface.nim @@ -17,11 +17,7 @@ method viewDidLoad*(self: AccessInterface) {.base.} = method loadSavedAddresses*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") -method createOrUpdateSavedAddress*(self: AccessInterface, name: string, address: string, ens: string, colorId: string, - chainShortNames: string) {.base.} = - raise newException(ValueError, "No implementation available") - -method updatePreferredChains*(self: AccessInterface, address: string, chainShortNames: string) {.base.} = +method createOrUpdateSavedAddress*(self: AccessInterface, name: string, address: string, ens: string, colorId: string) {.base.} = raise newException(ValueError, "No implementation available") method deleteSavedAddress*(self: AccessInterface, address: string) {.base.} = diff --git a/src/app/modules/main/wallet_section/saved_addresses/item.nim b/src/app/modules/main/wallet_section/saved_addresses/item.nim index 34b8d17b9c..5a3366041d 100644 --- a/src/app/modules/main/wallet_section/saved_addresses/item.nim +++ b/src/app/modules/main/wallet_section/saved_addresses/item.nim @@ -9,7 +9,6 @@ type mixedcaseAddress: string ens: string colorId: string - chainShortNames: string isTest: bool proc initItem*( @@ -18,7 +17,6 @@ proc initItem*( mixedcaseAddress: string, ens: string, colorId: string, - chainShortNames: string, isTest: bool ): Item = result.name = name @@ -26,7 +24,6 @@ proc initItem*( result.mixedcaseAddress = mixedcaseAddress result.ens = ens result.colorId = colorId - result.chainShortNames = chainShortNames result.isTest = isTest proc `$`*(self: Item): string = @@ -36,7 +33,6 @@ proc `$`*(self: Item): string = mixedcaseAddress: {self.mixedcaseAddress}, ens: {self.ens}, colorId: {self.colorId}, - chainShortNames: {self.chainShortNames}, isTest: {self.isTest}, ]""" @@ -58,8 +54,5 @@ proc getMixedcaseAddress*(self: Item): string = proc getColorId*(self: Item): string = return self.colorId -proc getChainShortNames*(self: Item): string = - return self.chainShortNames - proc getIsTest*(self: Item): bool = return self.isTest diff --git a/src/app/modules/main/wallet_section/saved_addresses/model.nim b/src/app/modules/main/wallet_section/saved_addresses/model.nim index 40db0befe4..c8b9d757f2 100644 --- a/src/app/modules/main/wallet_section/saved_addresses/model.nim +++ b/src/app/modules/main/wallet_section/saved_addresses/model.nim @@ -12,7 +12,6 @@ type MixedcaseAddress Ens ColorId - ChainShortNames IsTest QtObject: @@ -55,7 +54,6 @@ QtObject: ModelRole.MixedcaseAddress.int:"mixedcaseAddress", ModelRole.Ens.int:"ens", ModelRole.ColorId.int:"colorId", - ModelRole.ChainShortNames.int:"chainShortNames", ModelRole.IsTest.int:"isTest", }.toTable @@ -80,8 +78,6 @@ QtObject: result = newQVariant(item.getEns()) of ModelRole.ColorId: result = newQVariant(item.getColorId()) - of ModelRole.ChainShortNames: - result = newQVariant(item.getChainShortNames()) of ModelRole.IsTest: result = newQVariant(item.getIsTest()) diff --git a/src/app/modules/main/wallet_section/saved_addresses/module.nim b/src/app/modules/main/wallet_section/saved_addresses/module.nim index bf3631876a..0a27d185ff 100644 --- a/src/app/modules/main/wallet_section/saved_addresses/module.nim +++ b/src/app/modules/main/wallet_section/saved_addresses/module.nim @@ -42,7 +42,6 @@ method loadSavedAddresses*(self: Module) = s.mixedcaseAddress, s.ens, s.colorId, - s.chainShortNames, s.isTest, )) ) @@ -61,15 +60,8 @@ method viewDidLoad*(self: Module) = self.moduleLoaded = true self.delegate.savedAddressesModuleDidLoad() -method createOrUpdateSavedAddress*(self: Module, name: string, address: string, ens: string, colorId: string, - chainShortNames: string) = - 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 createOrUpdateSavedAddress*(self: Module, name: string, address: string, ens: string, colorId: string) = + self.controller.createOrUpdateSavedAddress(name, address, ens, colorId) method deleteSavedAddress*(self: Module, address: string) = self.controller.deleteSavedAddress(address) @@ -100,10 +92,9 @@ method getSavedAddressAsJson*(self: Module, address: string): string = "address": saDto.address, "ens": saDto.ens, "colorId": saDto.colorId, - "chainShortNames": saDto.chainShortNames, "isTest": saDto.isTest, } return $jsonObj method remainingCapacityForSavedAddresses*(self: Module): int = - return self.controller.remainingCapacityForSavedAddresses() \ No newline at end of file + return self.controller.remainingCapacityForSavedAddresses() diff --git a/src/app/modules/main/wallet_section/saved_addresses/view.nim b/src/app/modules/main/wallet_section/saved_addresses/view.nim index 553f41a0b3..481bcb7ce2 100644 --- a/src/app/modules/main/wallet_section/saved_addresses/view.nim +++ b/src/app/modules/main/wallet_section/saved_addresses/view.nim @@ -42,12 +42,8 @@ QtObject: 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, - chainShortNames: string) {.slot.} = - self.delegate.createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames) - - proc updatePreferredChains*(self: View, address: string, chainShortNames: string) {.slot.} = - self.delegate.updatePreferredChains(address, chainShortNames) + proc createOrUpdateSavedAddress*(self: View, name: string, address: string, ens: string, colorId: string) {.slot.} = + self.delegate.createOrUpdateSavedAddress(name, address, ens, colorId) proc savedAddressDeleted*(self: View, name: string, address: string, errorMsg: string) {.signal.} @@ -61,4 +57,4 @@ QtObject: return self.delegate.getSavedAddressAsJson(address) proc remainingCapacityForSavedAddresses*(self: View): int {.slot.} = - return self.delegate.remainingCapacityForSavedAddresses() \ No newline at end of file + return self.delegate.remainingCapacityForSavedAddresses() diff --git a/src/app/modules/main/wallet_section/send/view.nim b/src/app/modules/main/wallet_section/send/view.nim index e5056241d8..f80aeec63a 100644 --- a/src/app/modules/main/wallet_section/send/view.nim +++ b/src/app/modules/main/wallet_section/send/view.nim @@ -252,14 +252,6 @@ QtObject: return splitWords[i] 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 proc fetchSuggestedRoutesWithParameters*(self: View, uuid: string, diff --git a/src/app/modules/shared_models/keypair_account_item.nim b/src/app/modules/shared_models/keypair_account_item.nim index 75f708d6c2..e329403be9 100644 --- a/src/app/modules/shared_models/keypair_account_item.nim +++ b/src/app/modules/shared_models/keypair_account_item.nim @@ -184,12 +184,6 @@ QtObject: return self.testPreferredChainIds else : 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: read = preferredSharingChainIds notify = preferredSharingChainIdsChanged diff --git a/src/app/modules/shared_models/keypair_account_model.nim b/src/app/modules/shared_models/keypair_account_model.nim index 92547fa8f7..02ce719ec9 100644 --- a/src/app/modules/shared_models/keypair_account_model.nim +++ b/src/app/modules/shared_models/keypair_account_model.nim @@ -140,12 +140,6 @@ QtObject: if cmpIgnoreCase(self.items[i].getAddress(), address) == 0: 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) = for i in 0 ..< self.items.len: if cmpIgnoreCase(self.items[i].getAddress(), address) == 0: diff --git a/src/app/modules/shared_models/keypair_item.nim b/src/app/modules/shared_models/keypair_item.nim index 9e1b2a1192..e80432e618 100644 --- a/src/app/modules/shared_models/keypair_item.nim +++ b/src/app/modules/shared_models/keypair_item.nim @@ -285,8 +285,6 @@ QtObject: return self.accounts.containsPathOutOfTheDefaultStatusDerivationTree() proc updateDetailsForAccountWithAddressIfTheyAreSet*(self: KeyPairItem, address, name, colorId, emoji: string) = 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) = self.accounts.updateAccountHiddenInTotalBalance(address, hideFromTotalBalance) proc setBalanceForAddress*(self: KeyPairItem, address: string, balance: CurrencyAmount) = diff --git a/src/app/modules/shared_models/keypair_model.nim b/src/app/modules/shared_models/keypair_model.nim index 13073759af..65e8c57bcf 100644 --- a/src/app/modules/shared_models/keypair_model.nim +++ b/src/app/modules/shared_models/keypair_model.nim @@ -96,12 +96,6 @@ QtObject: item.updateOperabilityForAllAddresses(operability) 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) = for item in self.items: if keyUid == item.getKeyUid(): diff --git a/src/app_service/service/saved_address/async_tasks.nim b/src/app_service/service/saved_address/async_tasks.nim index 7723934e2f..56bdd43e38 100644 --- a/src/app_service/service/saved_address/async_tasks.nim +++ b/src/app_service/service/saved_address/async_tasks.nim @@ -11,7 +11,6 @@ type name: string address: string colorId: string - chainShortNames: string ens: string isTestAddress: bool @@ -82,7 +81,6 @@ proc upsertSavedAddressTask(argEncoded: string) {.gcsafe, nimcall.} = name: arg.name, address: arg.address, colorId: arg.colorId, - chainShortNames: arg.chainShortNames, ens: arg.ens, isTest: arg.isTestAddress) let rpcResponse = checkForEnsNameAndUpdate(arg.chainId, savedAddress, UpdateCriteria.AlwaysUpdate) diff --git a/src/app_service/service/saved_address/dto.nim b/src/app_service/service/saved_address/dto.nim index 75d3beed79..8c9e05dc9e 100644 --- a/src/app_service/service/saved_address/dto.nim +++ b/src/app_service/service/saved_address/dto.nim @@ -9,7 +9,6 @@ type mixedcaseAddress*: string ens*: string colorId*: string - chainShortNames*: string isTest*: bool removed*: bool createdAt*: int64 @@ -22,7 +21,6 @@ proc toSavedAddressDto*(jsonObj: JsonNode): SavedAddressDto = discard jsonObj.getProp("ens", result.ens) discard jsonObj.getProp("colorId", result.colorId) 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("createdAt", result.createdAt) discard jsonObj.getProp("removed", result.removed) @@ -34,8 +32,7 @@ proc toJsonNode*(self: SavedAddressDto): JsonNode = "mixedcaseAddress": self.mixedcaseAddress, "ens": self.ens, "colorId": self.colorId, - "chainShortNames": self.chainShortNames, "isTest": self.isTest, "createdAt": self.createdAt, "removed": self.removed - } \ No newline at end of file + } diff --git a/src/app_service/service/saved_address/service.nim b/src/app_service/service/saved_address/service.nim index 621043a145..775fe9894e 100644 --- a/src/app_service/service/saved_address/service.nim +++ b/src/app_service/service/saved_address/service.nim @@ -114,15 +114,13 @@ QtObject: error "onSavedAddressesFetched", msg = e.msg self.events.emit(SIGNAL_SAVED_ADDRESSES_UPDATED, Args()) - proc createOrUpdateSavedAddress*(self: Service, name: string, address: string, ens: string, colorId: string, - chainShortNames: string) = + proc createOrUpdateSavedAddress*(self: Service, name: string, address: string, ens: string, colorId: string) = let arg = SavedAddressTaskArg( chainId: self.networkService.getAppNetwork().chainId, name: name, address: address, ens: ens, colorId: colorId, - chainShortNames: chainShortNames, isTestAddress: self.areTestNetworksEnabled(), tptr: upsertSavedAddressTask, vptr: cast[ByteAddress](self.vptr), @@ -180,4 +178,4 @@ QtObject: raise newException(CatchableError, response.error.message) return response.result.getInt except Exception as e: - error "error: ", procName="remainingCapacityForSavedAddresses", errName=e.name, errDesription=e.msg \ No newline at end of file + error "error: ", procName="remainingCapacityForSavedAddresses", errName=e.name, errDesription=e.msg diff --git a/src/app_service/service/wallet_account/service_account.nim b/src/app_service/service/wallet_account/service_account.nim index b9aedaba85..8762d24f00 100644 --- a/src/app_service/service/wallet_account/service_account.nim +++ b/src/app_service/service/wallet_account/service_account.nim @@ -311,22 +311,6 @@ proc updateAccountInLocalStoreAndNotify(self: Service, address, name, colorId, e if notify: 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 proc addWalletAccount*(self: Service, password: string, doPasswordHashing: bool, name, address, path, publicKey, 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 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 = try: var account = self.getAccountByAddress(address) @@ -864,4 +814,4 @@ proc remainingWatchOnlyAccountCapacity*(self: Service): int = raise newException(CatchableError, response.error.message) return response.result.getInt except Exception as e: - error "error: ", procName="remainingWatchOnlyAccountCapacity", errName=e.name, errDesription=e.msg \ No newline at end of file + error "error: ", procName="remainingWatchOnlyAccountCapacity", errName=e.name, errDesription=e.msg diff --git a/src/app_service/service/wallet_account/signals_and_payloads.nim b/src/app_service/service/wallet_account/signals_and_payloads.nim index 027c4dea6c..67e95287a0 100644 --- a/src/app_service/service/wallet_account/signals_and_payloads.nim +++ b/src/app_service/service/wallet_account/signals_and_payloads.nim @@ -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_OPERABILITY_UPDATED* = "walletAccount/operabilityUpdated" 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_KEYPAIR_SYNCED* = "keypairSynced" diff --git a/storybook/pages/AddEditSavedAddressPopupPage.qml b/storybook/pages/AddEditSavedAddressPopupPage.qml index 75f20ec8ef..1a0deac3f0 100644 --- a/storybook/pages/AddEditSavedAddressPopupPage.qml +++ b/storybook/pages/AddEditSavedAddressPopupPage.qml @@ -45,12 +45,7 @@ SplitView { visible: true destroyOnClose: true modal: false - closePolicy: Popup.NoAutoClose - - flatNetworks: SortFilterProxyModel { - sourceModel: NetworksModel.flatNetworks - filters: ValueFilter { roleName: "isTest"; value: false } - } + closePolicy: Popup.NoAutoClose store: WalletStores.RootStore sharedRootStore: SharedStores.RootStore {} diff --git a/storybook/pages/ReceiveModalPage.qml b/storybook/pages/ReceiveModalPage.qml index 0f64c25f13..fd29e6e134 100644 --- a/storybook/pages/ReceiveModalPage.qml +++ b/storybook/pages/ReceiveModalPage.qml @@ -43,22 +43,10 @@ SplitView { "emoji": "🚗", "color": "#216266", "address": "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881", - "preferredSharingChainIds": "5:420:421613", } switchingAccounsEnabled: true - changingPreferredChainsEnabled: true hasFloatingButtons: true 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 { diff --git a/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml b/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml index 7f4d44ad6b..5a52822308 100644 --- a/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml +++ b/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml @@ -26,7 +26,6 @@ StatusListItem { property string address property string ens property string colorId - property string chainShortNames property bool areTestNetworksEnabled: false property bool isGoerliEnabled: false @@ -51,9 +50,7 @@ StatusListItem { if (ens.length > 0) return ens else { - return sensor.containsMouse ? WalletUtils.colorizedChainPrefix(root.chainShortNames) + - Utils.richColorText(root.address, Theme.palette.directColor1) - : root.chainShortNames + root.address + return WalletUtils.addressToDisplay(root.address, false, sensor.containsMouse) } } @@ -75,7 +72,6 @@ StatusListItem { id: d readonly property string visibleAddress: !!root.ens? root.ens : root.address - readonly property var preferredSharedNetworkNamesArray: root.chainShortNames.split(":").filter(Boolean) } onClicked: { @@ -85,7 +81,6 @@ StatusListItem { Global.openSavedAddressActivityPopup({ name: root.name, address: root.address, - chainShortNames: root.chainShortNames, ens: root.ens, colorId: root.colorId }) @@ -113,7 +108,6 @@ StatusListItem { { name: root.name, address: root.address, - chainShortNames: root.chainShortNames, ens: root.ens, colorId: root.colorId, } @@ -127,7 +121,6 @@ StatusListItem { id: menu property string name property string address - property string chainShortNames property string ens property string colorId @@ -138,7 +131,6 @@ StatusListItem { function openMenu(parent, x, y, model) { menu.name = model.name; menu.address = model.address; - menu.chainShortNames = model.chainShortNames; menu.ens = model.ens; menu.colorId = model.colorId; popup(parent, x, y); @@ -146,7 +138,6 @@ StatusListItem { onClosed: { menu.name = ""; menu.address = ""; - menu.chainShortNames = "" menu.ens = "" menu.colorId = "" } @@ -163,7 +154,6 @@ StatusListItem { edit: true, address: menu.address, name: menu.name, - chainShortNames: menu.chainShortNames, ens: menu.ens, colorId: menu.colorId }) @@ -193,12 +183,10 @@ StatusListItem { showSingleAccount: true, showForSavedAddress: true, switchingAccounsEnabled: false, - changingPreferredChainsEnabled: true, - hasFloatingButtons: true, + hasFloatingButtons: false, name: menu.name, address: menu.address, - colorId: menu.colorId, - preferredSharingChainIds: RootStore.getNetworkIds(menu.chainShortNames) + colorId: menu.colorId }) } } @@ -218,13 +206,10 @@ StatusListItem { } } - StatusMenuSeparator { - visible: d.preferredSharedNetworkNamesArray.length > 0 - } + StatusMenuSeparator {} StatusAction { - text: Utils.getActionNameForDisplayingAddressOnNetwork(Constants.networkShortChainNames.mainnet) - enabled: d.preferredSharedNetworkNamesArray.includes(Constants.networkShortChainNames.mainnet) + text: qsTr("View on Etherscan") icon.name: "link" onTriggered: { 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 { } StatusAction { @@ -267,8 +232,7 @@ StatusListItem { name: menu.name, address: menu.address, ens: menu.ens, - colorId: menu.colorId, - chainShortNames: menu.chainShortNames + colorId: menu.colorId }) } } diff --git a/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml b/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml index d7b3ad4655..d8634d2095 100644 --- a/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml +++ b/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml @@ -32,8 +32,6 @@ StatusModal { required property WalletStores.RootStore store required property SharedStores.RootStore sharedRootStore - property var flatNetworks - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside width: 477 @@ -44,7 +42,6 @@ StatusModal { function initWithParams(params = {}) { d.storedName = params.name?? "" d.storedColorId = params.colorId?? "" - d.storedChainShortNames = params.chainShortNames?? "" d.editMode = params.edit?? false d.addAddress = params.addAddress?? false @@ -53,7 +50,6 @@ StatusModal { d.address = params.address?? Constants.zeroAddress d.ens = params.ens?? "" d.colorId = d.storedColorId - d.chainShortNames = d.storedChainShortNames d.initialized = true @@ -68,9 +64,7 @@ StatusModal { if (d.addressInputIsENS) addressInput.setPlainText(d.ens) else - addressInput.setPlainText("%1%2" - .arg(d.chainShortNames) - .arg(d.address == Constants.zeroAddress? "" : d.address)) + addressInput.setPlainText("%1".arg(d.address == Constants.zeroAddress? "" : d.address)) 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 ens: "" property string colorId: "" - property string chainShortNames: "" property string storedName: "" 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 || addressInput.input.dirty && @@ -115,21 +98,19 @@ StatusModal { !d.addressAlreadyAddedToSavedAddressesError readonly property bool valid: d.addressInputValid && nameInput.valid 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() property bool incorrectChecksum: false - readonly property var chainPrefixRegexPattern: /[^:]+\:?|:/g readonly property bool addressInputIsENS: !!d.ens && Utils.isValidEns(d.ens) readonly property bool addressInputIsAddress: !!d.address && d.address != Constants.zeroAddress && - (Utils.isAddress(d.address) || Utils.isValidAddressWithChainPrefix(d.address)) + Utils.isAddress(d.address) readonly property bool addressInputHasError: !!addressInput.errorMessageCmp.text onAddressInputHasErrorChanged: addressInput.input.valid = !addressInputHasError // can't use binding because valid is overwritten in StatusInput - readonly property string networksHiddenState: "networksHidden" property ListModel cardsModel: ListModel {} @@ -184,19 +165,13 @@ StatusModal { 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 - function getPrefixArrayWithColumns(prefixStr) { - return prefixStr.match(d.chainPrefixRegexPattern) - } - function resetAddressValues(fullReset) { if (fullReset) { d.ens = "" d.address = Constants.zeroAddress - d.chainShortNames = "" - d.networkSelection = [] } d.cardsModel.clear() @@ -266,7 +241,6 @@ StatusModal { return } - networkSelector.state = "" if (d.addressInputIsAddress) { d.checkForAddressInputOwningErrorsWarnings() d.checkIfAddressChecksumIsValid() @@ -288,7 +262,7 @@ StatusModal { 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() } } @@ -307,11 +281,6 @@ StatusModal { } 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() if (input.edit.previousText != plainText) { - let newText = plainText - const prefixAndAddress = Utils.splitToChainPrefixAndAddress(plainText) - - if (!Utils.isLikelyEnsName(plainText)) { - newText = WalletUtils.colorizedChainPrefix(prefixAndAddress.prefix) + - prefixAndAddress.address - } - - setRichText(newText) + setRichText(plainText) // Reset d.resetAddressValues(plainText.length == 0) @@ -518,18 +479,10 @@ StatusModal { if (Utils.isLikelyEnsName(plainText)) { d.ens = plainText d.address = Constants.zeroAddress - d.chainShortNames = "" } else { d.ens = "" - d.address = prefixAndAddress.address - 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) - }) + d.address = plainText } } @@ -555,41 +508,6 @@ StatusModal { input.cursorPosition = curPos 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 { @@ -647,110 +565,6 @@ StatusModal { 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 - } - } } } diff --git a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml index 13ecfb878a..766ec3fa09 100644 --- a/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/ReceiveModal.qml @@ -32,21 +32,12 @@ StatusModal { property var selectedAccount property bool switchingAccounsEnabled: true - property bool changingPreferredChainsEnabled: true - property string qrImageSource: root.store.getQrCode(d.visibleAddress) - property var getNetworkShortNames: function(chainIDsString) { - return root.store.getNetworkShortNames(chainIDsString) - } + property string qrImageSource: root.store.getQrCode(root.selectedAccount.address) property WalletStores.RootStore store: WalletStores.RootStore signal updateSelectedAddress(string address) - signal updatePreferredChains(string address, string preferredChains) - - onSelectedAccountChanged: { - d.preferredChainIdsArray = root.selectedAccount.preferredSharingChainIds.split(":").filter(Boolean).map(Number) - } width: 556 contentHeight: content.implicitHeight + d.advanceFooterHeight @@ -64,19 +55,7 @@ StatusModal { width: implicitWidth model: SortFilterProxyModel { sourceModel: root.accounts - 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 : "" @@ -129,7 +108,7 @@ StatusModal { verticalAlignment: Text.AlignVCenter textFormat: TextEdit.RichText wrapMode: Text.WrapAnywhere - text: WalletUtils.colorizedChainPrefix(d.preferredChainShortNames) + root.selectedAccount.address + text: root.selectedAccount.address font.pixelSize: 15 color: Theme.palette.directColor1 } @@ -141,7 +120,7 @@ StatusModal { Layout.preferredWidth: 32 Layout.preferredHeight: 32 Layout.fillWidth: true - textToCopy: d.visibleAddress + textToCopy: root.selectedAccount.address successCircleVisible: true } } @@ -155,22 +134,7 @@ StatusModal { QtObject { id: d - readonly property bool multiChainView: tabBar.currentIndex === 1 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 { @@ -182,21 +146,6 @@ StatusModal { bottomPadding: Style.current.xlPadding 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 { id: qrCode 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) - } - } - } - } } } diff --git a/ui/app/AppLayouts/Wallet/popups/RemoveSavedAddressPopup.qml b/ui/app/AppLayouts/Wallet/popups/RemoveSavedAddressPopup.qml index 7f82574815..f35c94f4db 100644 --- a/ui/app/AppLayouts/Wallet/popups/RemoveSavedAddressPopup.qml +++ b/ui/app/AppLayouts/Wallet/popups/RemoveSavedAddressPopup.qml @@ -22,7 +22,6 @@ StatusDialog { property string address property string ens property string colorId - property string chainShortNames signal removeSavedAddress(string address) @@ -46,7 +45,7 @@ StatusDialog { if (root.ens.length > 0) 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() diff --git a/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml b/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml index abc24ff0d8..f636f02aff 100644 --- a/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml +++ b/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml @@ -43,7 +43,6 @@ StatusModal { d.address = params.address?? Constants.zeroAddress d.ens = params.ens?? "" d.colorId = params.colorId?? "" - d.chainShortNames = params.chainShortNames?? "" walletSection.activityController.setFilterToAddresses(JSON.stringify([d.address])) walletSection.activityController.updateFilter() @@ -62,7 +61,6 @@ StatusModal { property string address: Constants.zeroAddress property string ens: "" property string colorId: "" - property string chainShortNames: "" readonly property string visibleAddress: !!d.ens? d.ens : d.address @@ -133,7 +131,7 @@ StatusModal { return d.ens } 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 "" @@ -152,7 +150,6 @@ StatusModal { name: d.name address: d.address - chainShortNames: d.chainShortNames ens: d.ens colorId: d.colorId @@ -213,7 +210,7 @@ StatusModal { anchors.rightMargin: Style.current.padding anchors.leftMargin: Style.current.padding 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 font.pixelSize: 15 color: Theme.palette.directColor1 diff --git a/ui/app/AppLayouts/Wallet/popups/TransactionAddressMenu.qml b/ui/app/AppLayouts/Wallet/popups/TransactionAddressMenu.qml index ca3b59c6a1..5173f6711f 100644 --- a/ui/app/AppLayouts/Wallet/popups/TransactionAddressMenu.qml +++ b/ui/app/AppLayouts/Wallet/popups/TransactionAddressMenu.qml @@ -58,7 +58,6 @@ StatusMenu { property string addressName: "" property string addressEns: "" property string colorId: "" - property string addressChains: "" property string contractName: "" @@ -155,7 +154,6 @@ StatusMenu { d.addressName = savedAddress.name d.addressEns = savedAddress.ens d.colorId = savedAddress.colorId - d.addressChains = savedAddress.chainShortNames } } @@ -300,7 +298,6 @@ StatusMenu { onTriggered: Global.openShowQRPopup({ showSingleAccount: true, switchingAccounsEnabled: false, - changingPreferredChainsEnabled: false, hasFloatingButtons: false, name: d.addressName, address: d.selectedAddress, @@ -324,11 +321,10 @@ StatusMenu { icon.name: "star-icon-outline" onTriggered: { Global.openAddEditSavedAddressesPopup({ - addAddress: true, - address: d.selectedAddress, - ens: d.addressEns, - chainShortNames: d.addressChains - }) + addAddress: true, + address: d.selectedAddress, + ens: d.addressEns + }) } } StatusAction { @@ -341,9 +337,7 @@ StatusMenu { name: d.addressName, address: d.selectedAddress, ens: d.addressEns, - colorId: d.colorId, - chainShortNames: d.addressChains - }) + colorId: d.colorId}) } StatusAction { id: sendToAddressAction diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml index 8c5bcd3dfa..5ba01a1889 100644 --- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml @@ -290,7 +290,6 @@ QtObject { address: "", ens: "", colorId: Constants.walletAccountColors.primary, - chainShortNames: "", isTest: false, } @@ -356,13 +355,9 @@ QtObject { return walletSectionAccounts.getColorByAddress(address) } - function createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames) { + function createOrUpdateSavedAddress(name, address, ens, colorId) { root.addingSavedAddress = true - walletSectionSavedAddresses.createOrUpdateSavedAddress(name, address, ens, colorId, chainShortNames) - } - - function updatePreferredChains(address, chainShortNames) { - walletSectionSavedAddresses.updatePreferredChains(address, chainShortNames) + walletSectionSavedAddresses.createOrUpdateSavedAddress(name, address, ens, colorId) } function deleteSavedAddress(address) { @@ -419,15 +414,6 @@ QtObject { return networksModule.getNetworkIds(shortNames) } - function updateWalletAccountPreferredChains(address, preferredChainIds) { - if(areTestNetworksEnabled) { - walletSectionAccounts.updateWalletAccountTestPreferredChains(address, preferredChainIds) - } - else { - walletSectionAccounts.updateWalletAccountProdPreferredChains(address, preferredChainIds) - } - } - function updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) { walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) } diff --git a/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml b/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml index d1e39df054..e1e6581243 100644 --- a/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml +++ b/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml @@ -121,8 +121,7 @@ ColumnLayout { let keyword = searchBox.text.trim().toUpperCase() return spellingTolerantSearch(model.name, keyword) || model.address.toUpperCase().includes(keyword) || - model.ens.toUpperCase().includes(keyword) || - model.chainShortNames.toUpperCase().includes(keyword) + model.ens.toUpperCase().includes(keyword) } } } @@ -146,7 +145,6 @@ ColumnLayout { objectName: "savedAddressView_Delegate_" + name name: model.name address: model.mixedcaseAddress - chainShortNames: model.chainShortNames ens: model.ens colorId: model.colorId networkConnectionStore: root.networkConnectionStore diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 87d98e0e2f..d77964eed0 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -1901,7 +1901,6 @@ Item { sourceComponent: WalletPopups.AddEditSavedAddressPopup { store: WalletStores.RootStore sharedRootStore: appMain.sharedRootStore - flatNetworks: WalletStores.RootStore.filteredFlatModel onClosed: { addEditSavedAddress.close() @@ -1968,7 +1967,6 @@ Item { deleteSavedAddress.item.ens = deleteSavedAddress.params.ens?? "" deleteSavedAddress.item.name = deleteSavedAddress.params.name?? "" deleteSavedAddress.item.colorId = deleteSavedAddress.params.colorId?? "blue" - deleteSavedAddress.item.chainShortNames = deleteSavedAddress.params.chainShortNames?? "" deleteSavedAddress.item.open() } @@ -2051,7 +2049,6 @@ Item { onLoaded: { showQR.item.switchingAccounsEnabled = showQR.params.switchingAccounsEnabled?? true - showQR.item.changingPreferredChainsEnabled = showQR.params.changingPreferredChainsEnabled?? true showQR.item.hasFloatingButtons = showQR.params.hasFloatingButtons?? true showQR.item.open() @@ -2087,15 +2084,6 @@ Item { 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: { showQR.close() } diff --git a/ui/imports/shared/popups/send/controls/SavedAddressListItem.qml b/ui/imports/shared/popups/send/controls/SavedAddressListItem.qml index 1a82670a46..90d542ece6 100644 --- a/ui/imports/shared/popups/send/controls/SavedAddressListItem.qml +++ b/ui/imports/shared/popups/send/controls/SavedAddressListItem.qml @@ -24,7 +24,7 @@ StatusListItem { } else { 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 "" diff --git a/ui/imports/shared/popups/send/views/RecipientView.qml b/ui/imports/shared/popups/send/views/RecipientView.qml index 58fd68c6ae..dd8a655237 100644 --- a/ui/imports/shared/popups/send/views/RecipientView.qml +++ b/ui/imports/shared/popups/send/views/RecipientView.qml @@ -56,7 +56,6 @@ Loader { d.isPending = true d.resolveENS(root.selectedRecipient.ens) } - preferredChainIds = store.getShortChainIds(root.selectedRecipient.chainShortNames) break } case Helpers.RecipientAddressObjectType.RecentsAddress: { @@ -133,7 +132,6 @@ Loader { Component { id: savedAddressRecipient SavedAddressListItem { - property string chainShortNames: !!modelData ? modelData.chainShortNames: "" implicitWidth: parent.width modelData: root.selectedRecipient radius: 8 @@ -145,7 +143,7 @@ Loader { if (!!modelData && !!modelData.ens && modelData.ens.length > 0) return Utils.richColorText(modelData.ens, Theme.palette.directColor1) else - return WalletUtils.colorizedChainPrefix(modelData.chainShortNames) + StatusQUtils.Utils.elideText(modelData.address,6,4) + return StatusQUtils.Utils.elideText(modelData.address,6,4) } return "" } diff --git a/ui/imports/shared/stores/send/TransactionStore.qml b/ui/imports/shared/stores/send/TransactionStore.qml index 387af2a7b2..e768e5621c 100644 --- a/ui/imports/shared/stores/send/TransactionStore.qml +++ b/ui/imports/shared/stores/send/TransactionStore.qml @@ -161,10 +161,6 @@ QtObject { } } - function getShortChainIds(chainShortNames) { - return walletSectionSendInst.getShortChainIds(chainShortNames) - } - function formatCurrencyAmountFromBigInt(balance, symbol, decimals, options = null) { return currencyStore.formatCurrencyAmountFromBigInt(balance, symbol, decimals, options) } diff --git a/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml b/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml index c690da5077..5a5d762145 100644 --- a/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml +++ b/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml @@ -161,30 +161,6 @@ Item { 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)); - } - } } } diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index e7c52effe5..4275d70e97 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -40,10 +40,6 @@ QtObject { 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) { // matchAll is not supported by QML JS engine return address.match(/([a-zA-Z]{3,5}:)*/)[0].split(':').filter(e => !!e) @@ -644,17 +640,6 @@ QtObject { 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) { const type = isAddressNotTx ? Constants.networkExplorerLinks.addressPath