feat(@desktop/wallet): Remove preferred chains from wallet accounts all over the app

This commit is contained in:
Khushboo Mehta 2024-10-04 17:23:26 +02:00 committed by Khushboo-dev-cpp
parent 7003ba73e2
commit 3f55e6c9c5
48 changed files with 33 additions and 783 deletions

View File

@ -12,8 +12,7 @@ type
Emoji, Emoji,
KeyUid, KeyUid,
Position, Position,
KeycardAccount, KeycardAccount
PreferredSharingChainIds
QtObject: QtObject:
type type
@ -58,7 +57,6 @@ QtObject:
ModelRole.KeyUid.int: "keyUid", ModelRole.KeyUid.int: "keyUid",
ModelRole.Position.int: "position", ModelRole.Position.int: "position",
ModelRole.KeycardAccount.int: "keycardAccount", ModelRole.KeycardAccount.int: "keycardAccount",
ModelRole.PreferredSharingChainIds.int: "preferredSharingChainIds"
}.toTable }.toTable
@ -110,8 +108,6 @@ QtObject:
result = newQVariant(item.getPosition()) result = newQVariant(item.getPosition())
of ModelRole.KeycardAccount: of ModelRole.KeycardAccount:
result = newQVariant(item.keycardAccount()) result = newQVariant(item.keycardAccount())
of ModelRole.PreferredSharingChainIds:
result = newQVariant(item.preferredSharingChainIds())
proc moveItem*(self: Model, fromRow: int, toRow: int): bool = proc moveItem*(self: Model, fromRow: int, toRow: int): bool =
if toRow < 0 or toRow > self.items.len - 1: if toRow < 0 or toRow > self.items.len - 1:

View File

@ -79,8 +79,6 @@ proc convertWalletAccountDtoToKeyPairAccountItem(self: Module, account: WalletAc
operability = account.operable, operability = account.operable,
isDefaultAccount = account.isWallet, isDefaultAccount = account.isWallet,
self.controller.areTestNetworksEnabled(), self.controller.areTestNetworksEnabled(),
prodPreferredChainIds = account.prodPreferredChainIds,
testPreferredChainIds = account.testPreferredChainIds,
hideFromTotalBalance = account.hideFromTotalBalance) hideFromTotalBalance = account.hideFromTotalBalance)
proc setBalance(self: Module, accountAddresses: seq[string]) = proc setBalance(self: Module, accountAddresses: seq[string]) =

View File

@ -27,8 +27,6 @@ QtObject:
assetsLoading: bool, assetsLoading: bool,
isWallet: bool, isWallet: bool,
areTestNetworksEnabled: bool, areTestNetworksEnabled: bool,
prodPreferredChainIds: string,
testPreferredChainIds: string,
hideFromTotalBalance: bool, hideFromTotalBalance: bool,
canSend: bool canSend: bool
) = ) =
@ -44,8 +42,6 @@ QtObject:
position, position,
operability = wa_dto.AccountFullyOperable, operability = wa_dto.AccountFullyOperable,
areTestNetworksEnabled, areTestNetworksEnabled,
prodPreferredChainIds,
testPreferredChainIds,
hideFromTotalBalance) hideFromTotalBalance)
self.createdAt = createdAt self.createdAt = createdAt
self.assetsLoading = assetsLoading self.assetsLoading = assetsLoading
@ -71,8 +67,6 @@ QtObject:
assetsLoading: bool = true, assetsLoading: bool = true,
isWallet: bool = false, isWallet: bool = false,
areTestNetworksEnabled: bool = false, areTestNetworksEnabled: bool = false,
prodPreferredChainIds: string = "",
testPreferredChainIds: string = "",
hideFromTotalBalance: bool = false, hideFromTotalBalance: bool = false,
canSend: bool = true canSend: bool = true
): Item = ): Item =
@ -91,8 +85,6 @@ QtObject:
assetsLoading, assetsLoading,
isWallet, isWallet,
areTestNetworksEnabled, areTestNetworksEnabled,
prodPreferredChainIds,
testPreferredChainIds,
hideFromTotalBalance, hideFromTotalBalance,
canSend) canSend)

View File

@ -18,7 +18,6 @@ type
KeycardAccount, KeycardAccount,
AssetsLoading, AssetsLoading,
IsWallet, IsWallet,
PreferredSharingChainIds,
HideFromTotalBalance, HideFromTotalBalance,
CanSend CanSend
@ -70,7 +69,6 @@ QtObject:
ModelRole.KeycardAccount.int: "keycardAccount", ModelRole.KeycardAccount.int: "keycardAccount",
ModelRole.AssetsLoading.int: "assetsLoading", ModelRole.AssetsLoading.int: "assetsLoading",
ModelRole.IsWallet.int: "isWallet", ModelRole.IsWallet.int: "isWallet",
ModelRole.PreferredSharingChainIds.int: "preferredSharingChainIds",
ModelRole.HideFromTotalBalance.int: "hideFromTotalBalance", ModelRole.HideFromTotalBalance.int: "hideFromTotalBalance",
ModelRole.CanSend.int: "canSend" ModelRole.CanSend.int: "canSend"
}.toTable }.toTable
@ -184,8 +182,6 @@ QtObject:
result = newQVariant(item.assetsLoading()) result = newQVariant(item.assetsLoading())
of ModelRole.IsWallet: of ModelRole.IsWallet:
result = newQVariant(item.isWallet()) result = newQVariant(item.isWallet())
of ModelRole.PreferredSharingChainIds:
result = newQVariant(item.preferredSharingChainIds())
of ModelRole.HideFromTotalBalance: of ModelRole.HideFromTotalBalance:
result = newQVariant(item.hideFromTotalBalance()) result = newQVariant(item.hideFromTotalBalance())
of ModelRole.CanSend: of ModelRole.CanSend:

View File

@ -170,26 +170,5 @@ QtObject:
return (chainIds, enable) return (chainIds, enable)
# TODO: To be removed once all qml calls to this method are removed. Normally the formatting methods should live in the qml project.
proc getNetworkShortNames*(self: Model, preferredNetworks: string, areTestNetworksEnabled: bool): string =
var networkString = ""
let networks = preferredNetworks.split(":")
for nw in networks:
for item in self.delegate.getFlatNetworksList():
if $item.chainId == nw and item.isTest == areTestNetworksEnabled:
networkString = networkString & item.shortName & ':'
break
return networkString
proc getNetworkIds*(self: Model, shortNames: string, areTestNetworksEnabled: bool): string =
var networkIds = ""
let networksNames = shortNames.split(":")
for name in networksNames:
for item in self.delegate.getFlatNetworksList():
if item.shortName == name and item.isTest == areTestNetworksEnabled:
networkIds = networkIds & $item.chainId & ':'
break
return networkIds
proc getEnabledChainIds*(self: Model, areTestNetworksEnabled: bool): string = proc getEnabledChainIds*(self: Model, areTestNetworksEnabled: bool): string =
return self.delegate.getFlatNetworksList().filter(n => n.isEnabled and n.isTest == areTestNetworksEnabled).map(n => n.chainId).join(":") return self.delegate.getFlatNetworksList().filter(n => n.isEnabled and n.isTest == areTestNetworksEnabled).map(n => n.chainId).join(":")

View File

@ -93,13 +93,7 @@ QtObject:
proc enableNetwork*(self: View, chainId: int) {.slot.} = proc enableNetwork*(self: View, chainId: int) {.slot.} =
self.delegate.setNetworksState(@[chainId], enable = true) self.delegate.setNetworksState(@[chainId], enable = true)
proc getNetworkShortNames*(self: View, preferredNetworks: string): string {.slot.} =
return self.flatNetworks.getNetworkShortNames(preferredNetworks, self.areTestNetworksEnabled)
proc getNetworkIds*(self: View, shortNames: string): string {.slot.} =
return self.flatNetworks.getNetworkIds(shortNames, self.areTestNetworksEnabled)
proc getBlockExplorerURL*(self: View, chainId: int): string {.slot.} = proc getBlockExplorerURL*(self: View, chainId: int): string {.slot.} =
return self.flatNetworks.getBlockExplorerURL(chainId) return self.flatNetworks.getBlockExplorerURL(chainId)

View File

@ -48,7 +48,7 @@ proc buildKeypairItem*(keypair: KeypairDto, areTestNetworksEnabled: bool): KeyPa
icon = "wallet" icon = "wallet"
item.addAccount(newKeyPairAccountItem(acc.name, acc.path, acc.address, acc.publicKey, acc.emoji, acc.colorId, item.addAccount(newKeyPairAccountItem(acc.name, acc.path, acc.address, acc.publicKey, acc.emoji, acc.colorId,
icon, newCurrencyAmount(), balanceFetched = true, operability = acc.operable, acc.isWallet, areTestNetworksEnabled, icon, newCurrencyAmount(), balanceFetched = true, operability = acc.operable, acc.isWallet, areTestNetworksEnabled,
acc.prodPreferredChainIds, acc.testPreferredChainIds, acc.hideFromTotalBalance)) acc.hideFromTotalBalance))
return item return item
proc buildKeyPairsList*(keypairs: seq[KeypairDto], excludeAlreadyMigratedPairs: bool, proc buildKeyPairsList*(keypairs: seq[KeypairDto], excludeAlreadyMigratedPairs: bool,

View File

@ -28,8 +28,6 @@ proc walletAccountToWalletAccountItem*(w: WalletAccountDto, keycardAccount: bool
w.position, w.position,
w.operable, w.operable,
areTestNetworksEnabled, areTestNetworksEnabled,
w.prodPreferredChainIds,
w.testPreferredChainIds,
w.hideFromTotalBalance w.hideFromTotalBalance
) )
@ -51,9 +49,7 @@ proc walletAccountToWalletAccountsItem*(w: WalletAccountDto, isKeycardAccount: b
w.assetsLoading or marketValuesLoading, w.assetsLoading or marketValuesLoading,
w.isWallet, w.isWallet,
areTestNetworksEnabled, areTestNetworksEnabled,
w.prodPreferredChainIds,
w.testPreferredChainIds,
w.hideFromTotalBalance, w.hideFromTotalBalance,
canSend=w.walletType != "watch" and (w.operable==AccountFullyOperable or w.operable==AccountPartiallyOperable) canSend=w.walletType != "watch" and (w.operable==AccountFullyOperable or w.operable==AccountPartiallyOperable)
) )

View File

@ -18,8 +18,6 @@ QtObject:
balanceFetched: bool balanceFetched: bool
isDefaultAccount: bool isDefaultAccount: bool
areTestNetworksEnabled: bool areTestNetworksEnabled: bool
prodPreferredChainIds: string
testPreferredChainIds: string
hideFromTotalBalance: bool hideFromTotalBalance: bool
proc delete*(self: KeyPairAccountItem) = proc delete*(self: KeyPairAccountItem) =
@ -27,7 +25,7 @@ QtObject:
proc newKeyPairAccountItem*(name = "", path = "", address = "", pubKey = "", emoji = "", colorId = "", icon = "", proc newKeyPairAccountItem*(name = "", path = "", address = "", pubKey = "", emoji = "", colorId = "", icon = "",
balance = newCurrencyAmount(), balanceFetched = true, operability = wa_dto.AccountFullyOperable, balance = newCurrencyAmount(), balanceFetched = true, operability = wa_dto.AccountFullyOperable,
isDefaultAccount = false, areTestNetworksEnabled =false, prodPreferredChainIds = "", testPreferredChainIds = "", hideFromTotalBalance = false): KeyPairAccountItem = isDefaultAccount = false, areTestNetworksEnabled =false, hideFromTotalBalance = false): KeyPairAccountItem =
new(result, delete) new(result, delete)
result.QObject.setup result.QObject.setup
result.name = name result.name = name
@ -42,8 +40,6 @@ QtObject:
result.operability = operability result.operability = operability
result.isDefaultAccount = isDefaultAccount result.isDefaultAccount = isDefaultAccount
result.areTestNetworksEnabled = areTestNetworksEnabled result.areTestNetworksEnabled = areTestNetworksEnabled
result.prodPreferredChainIds = prodPreferredChainIds
result.testPreferredChainIds = testPreferredChainIds
result.hideFromTotalBalance = hideFromTotalBalance result.hideFromTotalBalance = hideFromTotalBalance
proc `$`*(self: KeyPairAccountItem): string = proc `$`*(self: KeyPairAccountItem): string =
@ -60,8 +56,6 @@ QtObject:
operability: {self.operability}, operability: {self.operability},
isDefaultAccount: {self.isDefaultAccount}, isDefaultAccount: {self.isDefaultAccount},
areTestNetworksEnabled: {self.areTestNetworksEnabled}, areTestNetworksEnabled: {self.areTestNetworksEnabled},
prodPreferredChainIds: {self.prodPreferredChainIds},
testPreferredChainIds: {self.testPreferredChainIds},
hideFromTotalBalance: {self.hideFromTotalBalance} hideFromTotalBalance: {self.hideFromTotalBalance}
]""" ]"""
@ -178,16 +172,6 @@ QtObject:
read = getIsDefaultAccount read = getIsDefaultAccount
notify = isDefaultAccountChanged notify = isDefaultAccountChanged
proc preferredSharingChainIdsChanged*(self: KeyPairAccountItem) {.signal.}
proc preferredSharingChainIds*(self: KeyPairAccountItem): string {.slot.} =
if self.areTestNetworksEnabled:
return self.testPreferredChainIds
else :
return self.prodPreferredChainIds
QtProperty[string] preferredSharingChainIds:
read = preferredSharingChainIds
notify = preferredSharingChainIdsChanged
proc hideFromTotalBalanceChanged*(self: KeyPairAccountItem) {.signal.} proc hideFromTotalBalanceChanged*(self: KeyPairAccountItem) {.signal.}
proc hideFromTotalBalance*(self: KeyPairAccountItem): bool {.slot.} = proc hideFromTotalBalance*(self: KeyPairAccountItem): bool {.slot.} =
return self.hideFromTotalBalance return self.hideFromTotalBalance

View File

@ -16,8 +16,6 @@ QtObject:
position: int position: int
operability: string operability: string
areTestNetworksEnabled: bool areTestNetworksEnabled: bool
prodPreferredChainIds: string
testPreferredChainIds: string
hideFromTotalBalance: bool hideFromTotalBalance: bool
proc setup*(self: WalletAccountItem, proc setup*(self: WalletAccountItem,
@ -32,8 +30,6 @@ QtObject:
position: int = 0, position: int = 0,
operability: string = wa_dto.AccountFullyOperable, operability: string = wa_dto.AccountFullyOperable,
areTestNetworksEnabled: bool = false, areTestNetworksEnabled: bool = false,
prodPreferredChainIds: string = "",
testPreferredChainIds: string = "",
hideFromTotalBalance: bool = true hideFromTotalBalance: bool = true
) = ) =
self.QObject.setup self.QObject.setup
@ -48,8 +44,6 @@ QtObject:
self.position = position self.position = position
self.operability = operability self.operability = operability
self.areTestNetworksEnabled = areTestNetworksEnabled self.areTestNetworksEnabled = areTestNetworksEnabled
self.prodPreferredChainIds = prodPreferredChainIds
self.testPreferredChainIds = testPreferredChainIds
self.hideFromTotalBalance = hideFromTotalBalance self.hideFromTotalBalance = hideFromTotalBalance
proc delete*(self: WalletAccountItem) = proc delete*(self: WalletAccountItem) =
@ -67,8 +61,6 @@ QtObject:
position: int = 0, position: int = 0,
operability: string = wa_dto.AccountFullyOperable, operability: string = wa_dto.AccountFullyOperable,
areTestNetworksEnabled: bool = false, areTestNetworksEnabled: bool = false,
prodPreferredChainIds: string = "",
testPreferredChainIds: string = "",
hideFromTotalBalance: bool = true): WalletAccountItem = hideFromTotalBalance: bool = true): WalletAccountItem =
new(result, delete) new(result, delete)
result.QObject.setup result.QObject.setup
@ -83,8 +75,6 @@ QtObject:
result.position = position result.position = position
result.operability = operability result.operability = operability
result.areTestNetworksEnabled = areTestNetworksEnabled result.areTestNetworksEnabled = areTestNetworksEnabled
result.prodPreferredChainIds = prodPreferredChainIds
result.testPreferredChainIds = testPreferredChainIds
result.hideFromTotalBalance = hideFromTotalBalance result.hideFromTotalBalance = hideFromTotalBalance
proc `$`*(self: WalletAccountItem): string = proc `$`*(self: WalletAccountItem): string =
@ -100,8 +90,6 @@ QtObject:
position: {self.position}, position: {self.position},
operability: {self.operability}, operability: {self.operability},
areTestNetworksEnabled: {self.areTestNetworksEnabled}, areTestNetworksEnabled: {self.areTestNetworksEnabled},
prodPreferredChainIds: {self.prodPreferredChainIds},
testPreferredChainIds: {self.testPreferredChainIds},
hideFromTotalBalance: {self.hideFromTotalBalance} hideFromTotalBalance: {self.hideFromTotalBalance}
]""" ]"""
@ -195,24 +183,6 @@ QtObject:
write = setOperability write = setOperability
notify = operabilityChanged notify = operabilityChanged
proc preferredSharingChainIdsChanged*(self: WalletAccountItem) {.signal.}
proc preferredSharingChainIds*(self: WalletAccountItem): string {.slot.} =
if self.areTestNetworksEnabled:
return self.testPreferredChainIds
else :
return self.prodPreferredChainIds
QtProperty[string] preferredSharingChainIds:
read = preferredSharingChainIds
notify = preferredSharingChainIdsChanged
proc `testPreferredChainIds=`*(self: WalletAccountItem, value: string) {.inline.} =
self.testPreferredChainIds = value
self.preferredSharingChainIdsChanged()
proc `prodPreferredChainIds=`*(self: WalletAccountItem, value: string) {.inline.} =
self.prodPreferredChainIds = value
self.preferredSharingChainIdsChanged()
proc hideFromTotalBalanceChanged*(self: WalletAccountItem) {.signal.} proc hideFromTotalBalanceChanged*(self: WalletAccountItem) {.signal.}
proc hideFromTotalBalance*(self: WalletAccountItem): bool {.slot.} = proc hideFromTotalBalance*(self: WalletAccountItem): bool {.slot.} =
return self.hideFromTotalBalance return self.hideFromTotalBalance

View File

@ -34,8 +34,6 @@ type
operable*: string operable*: string
createdAt*: int createdAt*: int
position*: int position*: int
prodPreferredChainIDs*: string
testPreferredChainIDs*: string
hideFromTotalBalance*: bool hideFromTotalBalance*: bool
proc toWalletAccountDto*(jsonObj: JsonNode): WalletAccountDto = proc toWalletAccountDto*(jsonObj: JsonNode): WalletAccountDto =
@ -56,8 +54,6 @@ proc toWalletAccountDto*(jsonObj: JsonNode): WalletAccountDto =
discard jsonObj.getProp("operable", result.operable) discard jsonObj.getProp("operable", result.operable)
discard jsonObj.getProp("createdAt", result.createdAt) discard jsonObj.getProp("createdAt", result.createdAt)
discard jsonObj.getProp("position", result.position) discard jsonObj.getProp("position", result.position)
discard jsonObj.getProp("prodPreferredChainIds", result.prodPreferredChainIds)
discard jsonObj.getProp("testPreferredChainIds", result.testPreferredChainIds)
discard jsonObj.getProp("hidden", result.hideFromTotalBalance) discard jsonObj.getProp("hidden", result.hideFromTotalBalance)
result.assetsLoading = true result.assetsLoading = true
@ -76,8 +72,6 @@ proc `$`*(self: WalletAccountDto): string =
assetsLoading: {self.assetsLoading}, assetsLoading: {self.assetsLoading},
removed: {self.removed}, removed: {self.removed},
operable: {self.operable}, operable: {self.operable},
prodPreferredChainIds: {self.prodPreferredChainIds},
testPreferredChainIds: {self.testPreferredChainIds},
hideFromTotalBalance: {self.hideFromTotalBalance} hideFromTotalBalance: {self.hideFromTotalBalance}
]""" ]"""
@ -100,6 +94,4 @@ proc `%`*(x: WalletAccountDto): JsonNode =
result["operable"] = % x.operable result["operable"] = % x.operable
result["createdAt"] = % x.createdAt result["createdAt"] = % x.createdAt
result["position"] = % x.position result["position"] = % x.position
result["prodPreferredChainIds"] = % x.prodPreferredChainIds
result["testPreferredChainIds"] = % x.testPreferredChainIds
result["hideFromTotalBalance"] = % x.hideFromTotalBalance result["hideFromTotalBalance"] = % x.hideFromTotalBalance

View File

@ -36,8 +36,6 @@ proc replaceKeypair(self: Service, keypair: KeypairDto) =
locAcc.emoji = acc.emoji locAcc.emoji = acc.emoji
locAcc.operable = acc.operable locAcc.operable = acc.operable
locAcc.removed = acc.removed locAcc.removed = acc.removed
locAcc.prodPreferredChainIds = acc.prodPreferredChainIds
locAcc.testPreferredChainIds = acc.testPreferredChainIds
break break
proc storeAccountToKeypair(self: Service, account: WalletAccountDto) = proc storeAccountToKeypair(self: Service, account: WalletAccountDto) =
@ -561,7 +559,7 @@ proc updateWalletAccount*(self: Service, address: string, accountName: string, c
error "account's address is not among known addresses: ", address=address, procName="updateWalletAccount" error "account's address is not among known addresses: ", address=address, procName="updateWalletAccount"
return false return false
let response = status_go_accounts.updateAccount(accountName, account.address, account.path, account.publicKey, let response = status_go_accounts.updateAccount(accountName, account.address, account.path, account.publicKey,
account.keyUid, account.walletType, colorId, emoji, account.isWallet, account.isChat, account.prodPreferredChainIds, account.testPreferredChainIds, account.hideFromTotalBalance) account.keyUid, account.walletType, colorId, emoji, account.isWallet, account.isChat, account.hideFromTotalBalance)
if not response.error.isNil: if not response.error.isNil:
error "status-go error", procName="updateWalletAccount", errCode=response.error.code, errDesription=response.error.message error "status-go error", procName="updateWalletAccount", errCode=response.error.code, errDesription=response.error.message
return false return false
@ -578,7 +576,7 @@ proc updateWatchAccountHiddenFromTotalBalance*(self: Service, address: string, h
error "account's address is not among known addresses: ", address=address, procName="updateWatchAccountHiddenFromTotalBalance" error "account's address is not among known addresses: ", address=address, procName="updateWatchAccountHiddenFromTotalBalance"
return false return false
let response = status_go_accounts.updateAccount(account.name, account.address, account.path, account.publicKey, 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, account.testPreferredChainIds, hideFromTotalBalance) account.keyUid, account.walletType, account.colorId, account.emoji, account.isWallet, account.isChat, hideFromTotalBalance)
if not response.error.isNil: if not response.error.isNil:
error "status-go error", procName="updateWatchAccountHiddenFromTotalBalance", errCode=response.error.code, errDesription=response.error.message error "status-go error", procName="updateWatchAccountHiddenFromTotalBalance", errCode=response.error.code, errDesription=response.error.message
return false return false

View File

@ -108,7 +108,7 @@ proc addAccountWithoutKeystoreFileCreation*(name, address, path, publicKey, keyU
## Updates either regular or keycard account, without interaction to a Keystore file and notifies paired devices ## Updates either regular or keycard account, without interaction to a Keystore file and notifies paired devices
proc updateAccount*(name, address, path: string, publicKey, keyUid, accountType, colorId, emoji: string, proc updateAccount*(name, address, path: string, publicKey, keyUid, accountType, colorId, emoji: string,
walletDefaultAccount: bool, chatDefaultAccount: bool, prodPreferredChainIds, testPreferredChainIds: string, hideFromTotalBalance: bool): walletDefaultAccount: bool, chatDefaultAccount: bool, hideFromTotalBalance: bool):
RpcResponse[JsonNode] = RpcResponse[JsonNode] =
let payload = %* [ let payload = %* [
{ {
@ -122,8 +122,6 @@ proc updateAccount*(name, address, path: string, publicKey, keyUid, accountType,
"name": name, "name": name,
"emoji": emoji, "emoji": emoji,
"colorId": colorId, "colorId": colorId,
"prodPreferredChainIds": prodPreferredChainIds,
"testPreferredChainIds": testPreferredChainIds,
"hidden": hideFromTotalBalance "hidden": hideFromTotalBalance
#"clock" we leave this empty, set on the status-go side #"clock" we leave this empty, set on the status-go side
#"removed" present on the status-go side, used for synchronization, no need to set it here #"removed" present on the status-go side, used for synchronization, no need to set it here
@ -439,4 +437,4 @@ proc remainingKeypairCapacity*(): RpcResponse[JsonNode] =
proc remainingWatchOnlyAccountCapacity*(): RpcResponse[JsonNode] = proc remainingWatchOnlyAccountCapacity*(): RpcResponse[JsonNode] =
let payload = %* [] let payload = %* []
return core.callPrivateRPC("accounts_remainingWatchOnlyAccountCapacity", payload) return core.callPrivateRPC("accounts_remainingWatchOnlyAccountCapacity", payload)

View File

@ -57,14 +57,6 @@ SplitView {
property bool areTestNetworksEnabled: areTestNetworksEnabledCheckbox.checked property bool areTestNetworksEnabled: areTestNetworksEnabledCheckbox.checked
function toggleNetwork(chainId) { function toggleNetwork(chainId) {
} }
function getNetworkShortNames() {
return "eth:oeth:arb1:"
}
function getAllNetworksChainIds() {
return "1:10:42161"
}
} }
property var keyPairModel: WalletKeyPairModel {} property var keyPairModel: WalletKeyPairModel {}

View File

@ -462,9 +462,6 @@ Item {
property var accounts: customAccountsModel.count > 0 ? customAccountsModel : defaultAccountsModel property var accounts: customAccountsModel.count > 0 ? customAccountsModel : defaultAccountsModel
readonly property ListModel nonWatchAccounts: accounts readonly property ListModel nonWatchAccounts: accounts
function getNetworkShortNames(chainIds) {
return "eth:oeth:arb"
}
readonly property SharedStores.CurrenciesStore currencyStore: SharedStores.CurrenciesStore {} readonly property SharedStores.CurrenciesStore currencyStore: SharedStores.CurrenciesStore {}
readonly property WalletStore.WalletAssetsStore walletAssetsStore: WalletStore.WalletAssetsStore { readonly property WalletStore.WalletAssetsStore walletAssetsStore: WalletStore.WalletAssetsStore {
// Silence warnings // Silence warnings

View File

@ -49,6 +49,10 @@ SplitView {
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"
store: WalletStores.RootStore store: WalletStores.RootStore
onUpdateSelectedAddress: {
dialog.selectedAccount = ModelUtils.getByKey(dialog.accounts, "address", address)
}
} }
} }

View File

@ -53,8 +53,6 @@ SplitView {
color: "#2A4AF5", color: "#2A4AF5",
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240", address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
walletType: "", walletType: "",
preferredSharingChainIds: "5:420:421613",
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
currencyBalance: ({amount: 1.25, currencyBalance: ({amount: 1.25,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -68,8 +66,6 @@ SplitView {
color: "#216266", color: "#216266",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
walletType: Constants.generatedWalletType, walletType: Constants.generatedWalletType,
preferredSharingChainIds: "5:420:421613",
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
currencyBalance: ({amount: 10, currencyBalance: ({amount: 10,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -83,8 +79,6 @@ SplitView {
color: "#EC266C", color: "#EC266C",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
walletType: Constants.seedWalletType, walletType: Constants.seedWalletType,
preferredSharingChainIds: "5:420:421613",
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
currencyBalance: ({amount: 110.05, currencyBalance: ({amount: 110.05,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -98,8 +92,6 @@ SplitView {
color: "#CB6256", color: "#CB6256",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883",
walletType: Constants.watchWalletType, walletType: Constants.watchWalletType,
preferredSharingChainIds: "5:420:421613",
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
currencyBalance: ({amount: 3, currencyBalance: ({amount: 3,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -113,8 +105,6 @@ SplitView {
color: "#C78F67", color: "#C78F67",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
walletType: Constants.keyWalletType, walletType: Constants.keyWalletType,
preferredSharingChainIds: "5:420:421613",
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
currencyBalance: ({amount: 999, currencyBalance: ({amount: 999,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,

View File

@ -79,13 +79,11 @@ SplitView {
QtObject { QtObject {
id: d id: d
property string addressPrefixString: "eth:oeth:arb1:"
property string addressName: "Ariana Pearlona" property string addressName: "Ariana Pearlona"
property bool isContact: true property bool isContact: true
property bool isWallet: false property bool isWallet: false
property bool isSavedAccount: false property bool isSavedAccount: false
property bool showPrefix: true readonly property string displayAddress: "0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"
readonly property string displayAddress: (d.showPrefix ? d.addressPrefixString : "") + "0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"
} }
QtObject { QtObject {
@ -207,20 +205,6 @@ SplitView {
onTextChanged: d.addressName = text onTextChanged: d.addressName = text
} }
} }
Label {
text: "Address prefix:"
}
RowLayout {
TextField {
text: d.addressPrefixString
onTextChanged: d.addressPrefixString = text
}
CheckBox {
text: "Show"
checked: d.showPrefix
onCheckedChanged: d.showPrefix = checked
}
}
} }
} }
} }

View File

@ -16,7 +16,6 @@ SplitView {
clearVisible: showClearButton.checked clearVisible: showClearButton.checked
name: nameField.text name: nameField.text
address: addressField.text address: addressField.text
chainShortNames: chainShortNamesField.text
emoji: emojiField.text emoji: emojiField.text
walletColor: walletColorField.text walletColor: walletColorField.text
currencyBalance: QtObject { currencyBalance: QtObject {
@ -70,12 +69,6 @@ SplitView {
placeholderText: "Address" placeholderText: "Address"
} }
TextField {
id: chainShortNamesField
text: "<font color=\"red\">eth:</font><font color=\"blue\">oeth:</font><font color=\"green\">arb:</font>"
placeholderText: "Chain Short Names"
}
TextField { TextField {
id: emojiField id: emojiField
text: "🐷" text: "🐷"

View File

@ -244,9 +244,6 @@ Item {
keycardAccount: false keycardAccount: false
} }
} }
function getNetworkShortNames(chainIds) {
return "eth:oeth:arb"
}
readonly property var currencyStore: CurrenciesStore {} readonly property var currencyStore: CurrenciesStore {}
readonly property var walletAssetsStore: assetsStoreMock readonly property var walletAssetsStore: assetsStoreMock

View File

@ -37,7 +37,6 @@ Item {
color: "#2A4AF5", color: "#2A4AF5",
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240", address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
walletType: "", walletType: "",
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 1.25, currencyBalance: ({amount: 1.25,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -51,7 +50,6 @@ Item {
color: "#216266", color: "#216266",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
walletType: Constants.generatedWalletType, walletType: Constants.generatedWalletType,
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 10, currencyBalance: ({amount: 10,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -65,7 +63,6 @@ Item {
color: "#EC266C", color: "#EC266C",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
walletType: Constants.seedWalletType, walletType: Constants.seedWalletType,
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 110.05, currencyBalance: ({amount: 110.05,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -79,7 +76,6 @@ Item {
color: "#C78F67", color: "#C78F67",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
walletType: Constants.keyWalletType, walletType: Constants.keyWalletType,
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 999, currencyBalance: ({amount: 999,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,

View File

@ -236,14 +236,16 @@ Item {
for(let i =0; i< comboBoxList.model.count; i++) { for(let i =0; i< comboBoxList.model.count; i++) {
let delegateUnderTest = comboBoxList.itemAtIndex(i) let delegateUnderTest = comboBoxList.itemAtIndex(i)
compare(delegateUnderTest.title, swapAdaptor.nonWatchAccounts.get(i).name) let accountToBeTested = swapAdaptor.nonWatchAccounts.get(i)
compare(delegateUnderTest.subTitle, SQUtils.Utils.elideAndFormatWalletAddress(swapAdaptor.nonWatchAccounts.get(i).address)) let elidedAddress = SQUtils.Utils.elideAndFormatWalletAddress(accountToBeTested.address)
compare(delegateUnderTest.asset.color.toString().toUpperCase(), swapAdaptor.nonWatchAccounts.get(i).color.toString().toUpperCase()) compare(delegateUnderTest.title, accountToBeTested.name)
compare(delegateUnderTest.asset.emoji, swapAdaptor.nonWatchAccounts.get(i).emoji) compare(delegateUnderTest.subTitle, elidedAddress)
compare(delegateUnderTest.asset.color.toString().toUpperCase(), accountToBeTested.color.toString().toUpperCase())
compare(delegateUnderTest.asset.emoji, accountToBeTested.emoji)
const walletAccountCurrencyBalance = findChild(delegateUnderTest, "walletAccountCurrencyBalance") const walletAccountCurrencyBalance = findChild(delegateUnderTest, "walletAccountCurrencyBalance")
verify(!!walletAccountCurrencyBalance) verify(!!walletAccountCurrencyBalance)
verify(walletAccountCurrencyBalance.text, LocaleUtils.currencyAmountToLocaleString(swapAdaptor.nonWatchAccounts.get(i).currencyBalance)) verify(walletAccountCurrencyBalance.text, LocaleUtils.currencyAmountToLocaleString(accountToBeTested.currencyBalance))
// check if selected item in combo box is highlighted with the right color // check if selected item in combo box is highlighted with the right color
if(comboBoxList.currentIndex === i) { if(comboBoxList.currentIndex === i) {
@ -256,13 +258,13 @@ Item {
// TODO: always null not sure why // TODO: always null not sure why
// const walletAccountTypeIcon = findChild(delegateUnderTest, "walletAccountTypeIcon") // const walletAccountTypeIcon = findChild(delegateUnderTest, "walletAccountTypeIcon")
// verify(!!walletAccountTypeIcon) // verify(!!walletAccountTypeIcon)
// compare(walletAccountTypeIcon.icon, swapAdaptor.nonWatchAccounts.get(i).walletType === Constants.watchWalletType ? "show" : delegateUnderTest.model.migratedToKeycard ? "keycard": "") // compare(walletAccountTypeIcon.icon, accountToBeTested.walletType === Constants.watchWalletType ? "show" : delegateUnderTest.model.migratedToKeycard ? "keycard": "")
// Hover over the item and check hovered state // Hover over the item and check hovered state
mouseMove(delegateUnderTest, delegateUnderTest.width/2, delegateUnderTest.height/2) mouseMove(delegateUnderTest, delegateUnderTest.width/2, delegateUnderTest.height/2)
verify(delegateUnderTest.sensor.containsMouse) verify(delegateUnderTest.sensor.containsMouse)
compare(delegateUnderTest.title, swapAdaptor.nonWatchAccounts.get(i).name) compare(delegateUnderTest.title, accountToBeTested.name)
compare(delegateUnderTest.subTitle, WalletUtils.colorizedChainPrefix(WalletUtils.getNetworkShortNames(swapAdaptor.nonWatchAccounts.get(i).preferredSharingChainIds, root.swapStore.flatNetworks)), "Randomly failing locally. Add a bug if you see this failing in CI") compare(delegateUnderTest.subTitle, Utils.richColorText(elidedAddress, Theme.palette.directColor1))
verify(delegateUnderTest.color, Theme.palette.baseColor2) verify(delegateUnderTest.color, Theme.palette.baseColor2)
} }

View File

@ -42,7 +42,6 @@ ListModel {
} }
} }
], ],
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 1.25, currencyBalance: ({amount: 1.25,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -69,7 +68,6 @@ ListModel {
} }
} }
], ],
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 10, currencyBalance: ({amount: 10,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -105,7 +103,6 @@ ListModel {
} }
} }
], ],
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 110.05, currencyBalance: ({amount: 110.05,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -123,7 +120,6 @@ ListModel {
position: 2, position: 2,
assets: [ assets: [
], ],
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 3, currencyBalance: ({amount: 3,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,
@ -150,7 +146,6 @@ ListModel {
} }
} }
], ],
preferredSharingChainIds: "5:420:421613",
currencyBalance: ({amount: 999, currencyBalance: ({amount: 999,
symbol: "USD", symbol: "USD",
displayDecimals: 2, displayDecimals: 2,

View File

@ -10,7 +10,6 @@ ListModel {
colorId: Constants.walletAccountColors.primary, colorId: Constants.walletAccountColors.primary,
color: "#2A4AF5", color: "#2A4AF5",
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240", address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
preferredSharingChainIds: "5:420:421613",
walletType: "", walletType: "",
position: 0, position: 0,
canSend: true, canSend: true,
@ -22,7 +21,6 @@ ListModel {
colorId: Constants.walletAccountColors.army, colorId: Constants.walletAccountColors.army,
color: "#216266", color: "#216266",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
preferredSharingChainIds: "5:420:421613",
walletType: Constants.generatedWalletType, walletType: Constants.generatedWalletType,
position: 3, position: 3,
canSend: true, canSend: true,
@ -34,7 +32,6 @@ ListModel {
colorId: Constants.walletAccountColors.magenta, colorId: Constants.walletAccountColors.magenta,
color: "#EC266C", color: "#EC266C",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
preferredSharingChainIds: "5:420:421613",
walletType: Constants.seedWalletType, walletType: Constants.seedWalletType,
position: 1, position: 1,
canSend: true, canSend: true,
@ -46,7 +43,6 @@ ListModel {
colorId: Constants.walletAccountColors.copper, colorId: Constants.walletAccountColors.copper,
color: "#CB6256", color: "#CB6256",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883",
preferredSharingChainIds: "5:420:421613",
walletType: Constants.watchWalletType, walletType: Constants.watchWalletType,
position: 2, position: 2,
canSend: false, canSend: false,
@ -58,7 +54,6 @@ ListModel {
colorId: Constants.walletAccountColors.camel, colorId: Constants.walletAccountColors.camel,
color: "#C78F67", color: "#C78F67",
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884", address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
preferredSharingChainIds: "5:420:421613",
walletType: Constants.keyWalletType, walletType: Constants.keyWalletType,
position: 4, position: 4,
canSend: true, canSend: true,

View File

@ -7,9 +7,6 @@ QtObject {
id: root id: root
// TODO: Remove this. This stub should be empty. The color transformation should be done in adaptors or in the first model transformation steps. // TODO: Remove this. This stub should be empty. The color transformation should be done in adaptors or in the first model transformation steps.
function colorForChainShortName(chainShortName) {
return "#FF0000" // Just some random testing color
}
function savedAddressNameExists(name) { function savedAddressNameExists(name) {
return false return false
@ -19,10 +16,6 @@ QtObject {
console.log("createOrUpdateSavedAddress") console.log("createOrUpdateSavedAddress")
} }
function getNetworkIds(chainSortNames) {
return chainSortNames.split(":").filter((shortName) => shortName.length > 0)
}
function getNameForAddress(address) { function getNameForAddress(address) {
return "NAMEFOR: %1".arg(address) return "NAMEFOR: %1".arg(address)
} }

View File

@ -137,10 +137,6 @@ QtObject {
} }
} }
function getNetworkShortNames(chainIds) {
return ""
}
function setSendType(sendType) { function setSendType(sendType) {
root.sendType = sendType root.sendType = sendType
} }

View File

@ -126,15 +126,6 @@ QtObject {
root.accountsModule.setSelectedAccount(address) root.accountsModule.setSelectedAccount(address)
} }
function getAllNetworksChainIds() {
let result = []
let chainIdsArray = ModelUtils.modelToFlatArray(root.filteredFlatModel, "chainId")
for(let i = 0; i< chainIdsArray.length; i++) {
result.push(chainIdsArray[i].toString())
}
return result
}
function runAddAccountPopup() { function runAddAccountPopup() {
// TODO: // TODO:
// - `runAddAccountPopup` should be part of `root.walletModule` // - `runAddAccountPopup` should be part of `root.walletModule`
@ -156,10 +147,6 @@ QtObject {
networksModuleInst.updateNetworkEndPointValues(chainId, testNetwork, newMainRpcInput, newFailoverRpcUrl, revertToDefault) networksModuleInst.updateNetworkEndPointValues(chainId, testNetwork, newMainRpcInput, newFailoverRpcUrl, revertToDefault)
} }
function getNetworkShortNames(chainIds) {
return networksModuleInst.getNetworkShortNames(chainIds)
}
function getNetworkData(combinedNetwork) { function getNetworkData(combinedNetwork) {
return { return {
prod: {chainId: combinedNetwork.prod.chainId, prod: {chainId: combinedNetwork.prod.chainId,

View File

@ -11,61 +11,6 @@ import AppLayouts.Wallet.stores 1.0 as WalletStores
QtObject { QtObject {
function colorizedChainPrefixNew(chainColors, prefix) {
if (!prefix)
return ""
const prefixes = prefix.split(":").filter(Boolean)
let prefixStr = ""
const lastPrefixEndsWithColumn = prefix.endsWith(":")
const defaultColor = Theme.palette.baseColor1
for (let i in prefixes) {
const pref = prefixes[i]
let col = chainColors[pref]
if (!col)
col = defaultColor
prefixStr += Utils.richColorText(pref, col)
// Avoid adding ":" if it was not there for the last prefix,
// because when user manually edits the address, it breaks editing
if (!(i === (prefixes.length - 1) && !lastPrefixEndsWithColumn)) {
prefixStr += Utils.richColorText(":", Theme.palette.baseColor1)
}
}
return prefixStr
}
// TODO: Remove dependency to RootStore by requesting model or chainColors as a parameter. Indeed, this
// method should be just replaced by `colorizedChainPrefixNew`
// Issue #15494
function colorizedChainPrefix(prefix) {
if (!prefix)
return ""
const prefixes = prefix.split(":").filter(Boolean)
let prefixStr = ""
const lastPrefixEndsWithColumn = prefix.endsWith(":")
const defaultColor = Theme.palette.baseColor1
for (let i in prefixes) {
const pref = prefixes[i]
let col = WalletStores.RootStore.colorForChainShortName(pref)
if (!col)
col = defaultColor
prefixStr += Utils.richColorText(pref, col)
// Avoid adding ":" if it was not there for the last prefix,
// because when user manually edits the address, it breaks editing
if (!(i === (prefixes.length - 1) && !lastPrefixEndsWithColumn)) {
prefixStr += Utils.richColorText(":", Theme.palette.baseColor1)
}
}
return prefixStr
}
function calculateConfirmationTimestamp(chainLayer, timestamp) { function calculateConfirmationTimestamp(chainLayer, timestamp) {
if (chainLayer === 1) { if (chainLayer === 1) {
return timestamp + 12 * 4 // A block on layer1 is every 12s return timestamp + 12 * 4 // A block on layer1 is every 12s
@ -119,20 +64,6 @@ QtObject {
} }
} }
// Where: chainIds [string] - separated by `:`, e.g "42161:10:1"
function getNetworkShortNames(chainIds: string, flatNetworksModel) {
let networkString = ""
const chainIdsArray = chainIds.split(":")
for (let i = 0; i < chainIdsArray.length; i++) {
const nwShortName = StatusQUtils.ModelUtils.getByKey(flatNetworksModel, "chainId", Number(chainIdsArray[i]), "shortName")
if (!!nwShortName)
networkString = networkString + nwShortName + ':'
}
return networkString
}
function getRouterErrorBasedOnCode(code) { function getRouterErrorBasedOnCode(code) {
if (code === "") { if (code === "") {
return "" return ""

View File

@ -1,80 +0,0 @@
import QtQml 2.15
import AppLayouts.Wallet 1.0
import StatusQ 0.1
import StatusQ.Core.Utils 0.1
import SortFilterProxyModel 0.2
QObject {
id: root
// Input parameters:
/**
Expected model structure:
address [string] - wallet account address, e.g "0x10b...eaf"
name [string] - wallet account name, e.g "Status account"
keyUid [string] - unique identifier, e.g "0x79e07.....006"
currencyBalance [var] - CurrencyAmount type
amount [string]
symbol [string]
displayDecimals [int]
stripTrailingZeroes [bool]
emoji [string] - custom emoji
walletType [string] - e.g "generated"
colorId [string] - e.g "YELLOW"
preferredSharingChainIds [string] - separated by `:`, e.g "42161:10:1"
position [int] - visual order, e.g: "1"
**/
property var accountsModel
property var flatNetworksModel
property bool areTestNetworksEnabled
// Output parameters:
/**
Model structure:
All roles from the source model are passed directly to the output model,
additionally:
colorizedChainShortNames [string] - build from `preferredSharingChainIds` adding different colors to different network short names
**/
readonly property alias model: sfpm
readonly property SortFilterProxyModel filteredFlatNetworksModel: SortFilterProxyModel {
sourceModel: root.flatNetworksModel
filters: ValueFilter { roleName: "isTest"; value: root.areTestNetworksEnabled }
}
QtObject {
id: d
property var chainColors: ({})
function initChainColors() {
for (let i = 0; i < root.flatNetworksModel.count; i++) {
const item = ModelUtils.get(root.flatNetworksModel, i)
chainColors[item.shortName] = item.chainColor
}
}
}
SortFilterProxyModel {
id: sfpm
sourceModel: root.accountsModel ?? null
proxyRoles: FastExpressionRole {
function getChainShortNames(preferredSharingChainIds){
const chainShortNames = WalletUtils.getNetworkShortNames(preferredSharingChainIds, root.flatNetworksModel)
return WalletUtils.colorizedChainPrefixNew(d.chainColors, chainShortNames)
}
name: "colorizedChainShortNames"
expectedRoles: ["preferredSharingChainIds"]
expression: getChainShortNames(model.preferredSharingChainIds)
}
}
onFlatNetworksModelChanged: d.initChainColors()
}

View File

@ -1,3 +1,2 @@
CollectiblesSelectionAdaptor 1.0 CollectiblesSelectionAdaptor.qml CollectiblesSelectionAdaptor 1.0 CollectiblesSelectionAdaptor.qml
TokenSelectorViewAdaptor 1.0 TokenSelectorViewAdaptor.qml TokenSelectorViewAdaptor 1.0 TokenSelectorViewAdaptor.qml
WalletAccountsAdaptor 1.0 WalletAccountsAdaptor.qml

View File

@ -1,97 +0,0 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
Control {
id: root
property alias titleText: titleText
property alias button: button
property string title: ""
signal clicked(var mouse)
property StatusAssetSettings asset: StatusAssetSettings {
height: 20
width: 20
rotation: 0
isLetterIdenticon: false
letterSize: 10
color: "transparent"
bgWidth: 15
bgHeight: 15
bgColor: "transparent"
bgBorderColor: Theme.palette.baseColor2
bgRadius: 16
imgIsIdenticon: false
}
QtObject {
id: d
readonly property int commonMargin: 5
readonly property int leftMargin: 8
readonly property int minHeight: 32
}
leftPadding: d.leftMargin
spacing: d.commonMargin
implicitHeight: d.minHeight
background: Rectangle {
objectName: "networkTagRectangle_" + root.title
color: root.hovered ? Theme.palette.primaryColor3 : asset.bgColor
radius: asset.bgRadius
border.color: asset.bgBorderColor
MouseArea {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
onClicked: root.clicked(mouse)
}
}
contentItem: RowLayout {
spacing: root.spacing
StatusSmartIdenticon {
id: iconOrImage
asset: root.asset
name: root.title
active: root.asset.isLetterIdenticon ||
!!root.asset.name
}
StatusBaseText {
id: titleText
Layout.rightMargin: button.visible ? 0 : d.commonMargin
Layout.fillWidth: true
color: enabled ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
text: root.title
font.pixelSize: 15
font.weight: Font.Medium
elide: Text.ElideRight
}
StatusRoundButton {
id: button
Layout.preferredHeight: root.height - d.commonMargin
Layout.preferredWidth: root.height - d.commonMargin
Layout.rightMargin: d.commonMargin
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
radius: height / 2
type: StatusRoundButton.Tertiary
icon.name: "close"
}
}
}

View File

@ -1,219 +0,0 @@
import QtQuick 2.14
import QtQuick.Layouts 1.14
import QtQuick.Controls 2.14 as QC
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Core.Utils 0.1
import utils 1.0
/*!
\qmltype StatusNetworkSelector
\inherits Rectangle
\inqmlmodule StatusQ.Components
\since StatusQ.Components 0.1
\brief It allows to add items and display them as a tag item with an image and text. It also allows to store and display logical `and` / `or` operators into the list. Inherits \l{https://doc.qt.io/qt-6/qml-qtquick-rectangle.html}{Item}.
The \c StatusNetworkSelector is populated with a data model. The data model is commonly a JavaScript array or a ListModel object with specific expected roles.
Example of how the component looks like:
\image status_item_selector.png
Example of how to use it:
\qml
StatusNetworkSelector {
id: networkSelector
title: "Network preference"
enabled: addressInput.valid
defaultItemText: "Add networks"
defaultItemImageSource: "add"
itemsModel: ListModel {}
addButton.onClicked: {
}
onItemClicked: {
}
onItemRightButtonClicked: {
}
}
\endqml
For a list of components available see StatusQ.
*/
Rectangle {
id: root
/*!
\qmlproperty string StatusNetworkSelector::title
This property holds the title shown on top of the component.
*/
property string title
/*!
\qmlproperty string StatusNetworkSelector::defaultItemText
This property holds the default item text shown when the list of items is empty.
*/
property string defaultItemText
/*!
\qmlproperty url StatusNetworkSelector::defaultItemImageSource
This property holds the default item icon shown when the list of items is empty.
*/
property string defaultItemImageSource: ""
/*!
\qmlproperty StatusRoundButton StatusNetworkSelector::addButton
This property holds an alias to the `add` button.
*/
readonly property alias addButton: addItemButton
/*!
\qmlproperty ListModel StatusNetworkSelector::itemsModel
This property holds the data that will be populated in the items selector.
Here an example of the model roles expected:
\qml
itemsModel: ListModel {
ListElement {
text: "Ethereum"
iconUrl: "Network=Ethereum"
}
ListElement {
text: "Optimism"
iconUrl: "Network=Optimism"
}
}
\endqml
*/
property var itemsModel: ListModel { }
/*!
\qmlproperty bool StatusNetworkSelector::useIcons
This property determines if the imageSource role from the model will be handled as
an image or an icon.
*/
property bool useIcons: false
property StatusAssetSettings asset: StatusAssetSettings {
height: 20
width: 20
bgColor: "transparent"
isImage: !root.useIcons
isLetterIdenticon: root.useLetterIdenticons
}
/*!
\qmlproperty bool StatusNetworkSelector::useLetterIdenticons
This property determines if letter identicons should be used. If set to
true, the model is expected to contain roles "color" and "emoji".
*/
property bool useLetterIdenticons: false
/*!
\qmlsignal StatusNetworkSelector::itemClicked
This signal is emitted when the item is clicked.
*/
signal itemClicked(var item, int index, var mouse)
/*!
\qmlsignal StatusNetworkSelector::itemRightButtonClicked
This signal is emitted when the item's right button is clicked.
*/
signal itemRightButtonClicked(var item, int index, var mouse)
color: "transparent"
implicitHeight: columnLayout.implicitHeight
implicitWidth: 560
property bool rightButtonVisible: false
/*!
\qmlproperty StatusNetworkListItemTag StatusNetworkSelector::defaultItem
This property holds an alias to the `defaultItem` tag
*/
property alias defaultItem: defaultListItemTag
ColumnLayout {
id: columnLayout
spacing: 8
StatusBaseText {
text: root.title
color: Theme.palette.directColor1
font.pixelSize: 15
}
Flow {
id: flow
Layout.preferredWidth: root.width
Layout.fillWidth: true
spacing: 6
StatusRoundButton {
id: addItemButton
objectName: "addNetworkTagItemButton"
implicitHeight: 32
implicitWidth: implicitHeight
height: width
type: StatusRoundButton.Type.Tertiary
border.color: Theme.palette.baseColor2
icon.name: root.defaultItemImageSource
visible: itemsModel.count > 0
icon.color: Theme.palette.primaryColor1
}
StatusNetworkListItemTag {
id: defaultListItemTag
objectName: "networkSelectorTag"
visible: !itemsModel || itemsModel.count === 0
title: root.defaultItemText
button.visible: true
button.icon.name: root.defaultItemImageSource
button.enabled: false
button.icon.disabledColor: titleText.color
button.icon.color: titleText.color
onClicked: {
root.itemClicked(this, 0, mouse)
}
}
Repeater {
model: itemsModel
StatusNetworkListItemTag {
id: networkTag
title: model.shortName
asset.height: root.asset.height
asset.width: root.asset.width
asset.name: root.useLetterIdenticons ? model.text : (model.isTest ? Style.svg(model.iconUrl + "-test") : Style.svg(model.iconUrl))
asset.isImage: root.asset.isImage
asset.bgColor: root.asset.bgColor
asset.isLetterIdenticon: root.useLetterIdenticons
button.visible: root.rightButtonVisible
titleText.color: Theme.palette.primaryColor1
button.icon.disabledColor: titleText.color
button.icon.color: titleText.color
hoverEnabled: false
property var modelRef: model // model is not reachable outside via item.model.someData, so expose it
onClicked: {
root.itemClicked(this, index, mouse)
}
button.onClicked: {
root.itemRightButtonClicked(networkTag, index, mouse)
}
}
}
}
}
}

View File

@ -19,7 +19,6 @@ NetworkFilter 1.0 NetworkFilter.qml
NetworkSelectItemDelegate 1.0 NetworkSelectItemDelegate.qml NetworkSelectItemDelegate 1.0 NetworkSelectItemDelegate.qml
SortOrderComboBox 1.0 SortOrderComboBox.qml SortOrderComboBox 1.0 SortOrderComboBox.qml
StatusDateRangePicker 1.0 StatusDateRangePicker.qml StatusDateRangePicker 1.0 StatusDateRangePicker.qml
StatusNetworkListItemTag 1.0 StatusNetworkListItemTag.qml
StatusTxProgressBar 1.0 StatusTxProgressBar.qml StatusTxProgressBar 1.0 StatusTxProgressBar.qml
SwapExchangeButton 1.0 SwapExchangeButton.qml SwapExchangeButton 1.0 SwapExchangeButton.qml
SwapProvidersTermsAndConditionsText 1.0 SwapProvidersTermsAndConditionsText.qml SwapProvidersTermsAndConditionsText 1.0 SwapProvidersTermsAndConditionsText.qml

View File

@ -216,7 +216,7 @@ StatusMenu {
} }
else { else {
let elidedAddress = StatusQUtils.Utils.elideText(model.address,6,4) let elidedAddress = StatusQUtils.Utils.elideText(model.address,6,4)
return sensor.containsMouse ? WalletUtils.colorizedChainPrefix(model.chainShortNames) + Utils.richColorText(elidedAddress, Theme.palette.directColor1): model.chainShortNames + elidedAddress return sensor.containsMouse ? Utils.richColorText(elidedAddress, Theme.palette.directColor1): elidedAddress
} }
} }
statusListItemSubTitle.elide: Text.ElideMiddle statusListItemSubTitle.elide: Text.ElideMiddle

View File

@ -37,7 +37,7 @@ QObject {
readonly property string uuid: d.uuid readonly property string uuid: d.uuid
// TO REVIEW: It has been created a `WalletAccountsAdaptor.qml` file. // TO REVIEW: Handle this in a separate `WalletAccountsAdaptor.qml` file.
// Probably this data transformation should live there since they have common base. // Probably this data transformation should live there since they have common base.
readonly property var nonWatchAccounts: SortFilterProxyModel { readonly property var nonWatchAccounts: SortFilterProxyModel {
sourceModel: root.swapStore.accounts sourceModel: root.swapStore.accounts
@ -74,15 +74,6 @@ QObject {
FastExpressionRole { FastExpressionRole {
name: "fromToken" name: "fromToken"
expression: root.fromToken expression: root.fromToken
},
FastExpressionRole {
name: "colorizedChainPrefixes"
function getChainShortNames(chainIds) {
const chainShortNames = WalletUtils.getNetworkShortNames(chainIds, root.filteredFlatNetworksModel)
return WalletUtils.colorizedChainPrefix(chainShortNames)
}
expression: getChainShortNames(model.preferredSharingChainIds)
expectedRoles: ["preferredSharingChainIds"]
} }
] ]
} }

View File

@ -39,7 +39,7 @@ QObject {
/// Model containig the dApps session requests to be resolved by the user /// Model containig the dApps session requests to be resolved by the user
readonly property SessionRequestsModel sessionRequestsModel: requestHandler.requestsModel readonly property SessionRequestsModel sessionRequestsModel: requestHandler.requestsModel
/// Model containing the valid accounts a dApp can interact with /// Model containing the valid accounts a dApp can interact with
readonly property var validAccounts: d.validAccounts readonly property var validAccounts: root.walletRootStore.nonWatchAccounts
/// Model containing the networks a dApp can interact with /// Model containing the networks a dApp can interact with
readonly property var flatNetworks: root.walletRootStore.filteredFlatModel readonly property var flatNetworks: root.walletRootStore.filteredFlatModel
/// Service can interact with the current address selection /// Service can interact with the current address selection
@ -124,21 +124,6 @@ QObject {
QObject { QObject {
id: d id: d
readonly property var validAccounts: SortFilterProxyModel {
sourceModel: root.walletRootStore.nonWatchAccounts
proxyRoles: [
FastExpressionRole {
name: "colorizedChainPrefixes"
function getChainShortNames(chainIds) {
const chainShortNames = root.walletRootStore.getNetworkShortNames(chainIds)
return WalletUtils.colorizedChainPrefix(chainShortNames)
}
expression: getChainShortNames(model.preferredSharingChainIds)
expectedRoles: ["preferredSharingChainIds"]
}
]
}
readonly property var dappsModel: ConcatModel { readonly property var dappsModel: ConcatModel {
id: dappsModel id: dappsModel
markerRoleName: "source" markerRoleName: "source"

View File

@ -165,10 +165,6 @@ QtObject {
} }
} }
function colorForChainShortName(chainShortName) {
return d.chainColors[chainShortName]
}
readonly property var flatNetworks: networksModule.flatNetworks readonly property var flatNetworks: networksModule.flatNetworks
readonly property SortFilterProxyModel filteredFlatModel: SortFilterProxyModel { readonly property SortFilterProxyModel filteredFlatModel: SortFilterProxyModel {
sourceModel: root.flatNetworks sourceModel: root.flatNetworks
@ -265,8 +261,6 @@ QtObject {
operable: "", operable: "",
createdAt: -1, createdAt: -1,
position: -1, position: -1,
prodPreferredChainIds: "",
testPreferredChainIds: "",
hideFromTotalBalance: false hideFromTotalBalance: false
} }
@ -397,23 +391,6 @@ QtObject {
walletSection.toggleWatchOnlyAccounts() walletSection.toggleWatchOnlyAccounts()
} }
function getAllNetworksChainIds() {
let result = []
let chainIdsArray = SQUtils.ModelUtils.modelToFlatArray(root.filteredFlatModel, "chainId")
for(let i = 0; i< chainIdsArray.length; i++) {
result.push(chainIdsArray[i].toString())
}
return result
}
function getNetworkShortNames(chainIds) {
return networksModule.getNetworkShortNames(chainIds)
}
function getNetworkIds(shortNames) {
return networksModule.getNetworkIds(shortNames)
}
function updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) { function updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) {
walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance) walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)
} }

View File

@ -2022,7 +2022,6 @@ Item {
property var selectedAccount: ({ property var selectedAccount: ({
name: "", name: "",
address: "", address: "",
preferredSharingChainIds: "",
colorId: "", colorId: "",
emoji: "" emoji: ""
}) })
@ -2035,7 +2034,6 @@ Item {
if (showQR.showSingleAccount || showQR.showForSavedAddress) { if (showQR.showSingleAccount || showQR.showForSavedAddress) {
showQR.selectedAccount.name = params.name?? "" showQR.selectedAccount.name = params.name?? ""
showQR.selectedAccount.address = params.address?? "" showQR.selectedAccount.address = params.address?? ""
showQR.selectedAccount.preferredSharingChainIds = params.preferredSharingChainIds?? ""
showQR.selectedAccount.colorId = params.colorId?? "" showQR.selectedAccount.colorId = params.colorId?? ""
showQR.selectedAccount.emoji = params.emoji?? "" showQR.selectedAccount.emoji = params.emoji?? ""
} }

View File

@ -18,7 +18,6 @@ import shared.controls 1.0
Expected model structure: Expected model structure:
name [string] - account name e.g. "Piggy Bank" name [string] - account name e.g. "Piggy Bank"
address [string] - wallet account address e.g. "0x1234567890" address [string] - wallet account address e.g. "0x1234567890"
colorizedChainPrefixes [string] - chain prefixes with rich text colors e.g. "<font color=\"red\">eth:</font><font color=\"blue\">oeth:</font><font color=\"green\">arb:</font>"
emoji [string] - emoji for account e.g. "🐷" emoji [string] - emoji for account e.g. "🐷"
colorId [string] - color id for account e.g. "1" colorId [string] - color id for account e.g. "1"
currencyBalance [var] - fiat currency balance currencyBalance [var] - fiat currency balance
@ -101,7 +100,6 @@ StatusComboBox {
width: ListView.view.width width: ListView.view.width
name: model.name name: model.name
address: model.address address: model.address
chainShortNames: model.colorizedChainPrefixes ?? ""
emoji: model.emoji emoji: model.emoji
walletColor: Utils.getColorForId(model.colorId) walletColor: Utils.getColorForId(model.colorId)
currencyBalance: model.currencyBalance currencyBalance: model.currencyBalance

View File

@ -80,7 +80,6 @@ Item {
id: d id: d
property string contactPubKey: !!root.contactsStore ? root.contactsStore.getContactPublicKeyByAddress(root.address) : "" property string contactPubKey: !!root.contactsStore ? root.contactsStore.getContactPublicKeyByAddress(root.address) : ""
readonly property var prefixAndAddress: Utils.splitToChainPrefixAndAddress(root.address)
readonly property bool isContact: contactData.isContact readonly property bool isContact: contactData.isContact
readonly property bool isWallet: !isContact && !!walletAddressName readonly property bool isWallet: !isContact && !!walletAddressName
property var contactData property var contactData
@ -193,15 +192,7 @@ Item {
color: Theme.palette.directColor1 color: Theme.palette.directColor1
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
enabled: false // Set to false to disable hover for rich text enabled: false // Set to false to disable hover for rich text
text: { text: root.address
if(!!root.address == false)
return ""
if (d.prefixAndAddress.prefix.length > 0) {
return WalletUtils.colorizedChainPrefix(d.prefixAndAddress.prefix) + d.prefixAndAddress.address
} else {
return d.prefixAndAddress.address
}
}
visible: !!root.address visible: !!root.address
elide: Text.ElideRight elide: Text.ElideRight
} }

View File

@ -18,7 +18,6 @@ StatusListItem {
required property string name required property string name
required property string address required property string address
required property string chainShortNames
required property string emoji required property string emoji
required property string walletColor required property string walletColor
required property var currencyBalance required property var currencyBalance
@ -41,7 +40,7 @@ StatusListItem {
subTitle:{ subTitle:{
if(!!root.address) { if(!!root.address) {
let elidedAddress = StatusQUtils.Utils.elideAndFormatWalletAddress(root.address) let elidedAddress = StatusQUtils.Utils.elideAndFormatWalletAddress(root.address)
return sensor.containsMouse ? root.chainShortNames || Utils.richColorText(elidedAddress, Theme.palette.directColor1) : elidedAddress return sensor.containsMouse ? Utils.richColorText(elidedAddress, Theme.palette.directColor1) : elidedAddress
} }
return "" return ""
} }

View File

@ -89,12 +89,6 @@ StatusDialog {
property string extraParamsJson: "" property string extraParamsJson: ""
readonly property WalletAccountsAdaptor accountsAdaptor: WalletAccountsAdaptor {
accountsModel: popup.store.accounts
flatNetworksModel: popup.store.flatNetworksModel
areTestNetworksEnabled: popup.store.areTestNetworksEnabled
}
property bool ensOrStickersPurpose: popup.preSelectedSendType === Constants.SendType.ENSRegister || property bool ensOrStickersPurpose: popup.preSelectedSendType === Constants.SendType.ENSRegister ||
popup.preSelectedSendType === Constants.SendType.ENSRelease || popup.preSelectedSendType === Constants.SendType.ENSRelease ||
popup.preSelectedSendType === Constants.SendType.ENSSetPubKey || popup.preSelectedSendType === Constants.SendType.ENSSetPubKey ||
@ -308,17 +302,6 @@ StatusDialog {
} }
] ]
sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder } sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder }
proxyRoles: [
FastExpressionRole {
name: "colorizedChainPrefixes"
function getChainShortNames(chainIds) {
const chainShortNames = popup.store.getNetworkShortNames(chainIds)
return WalletUtils.colorizedChainPrefix(chainShortNames)
}
expression: getChainShortNames(model.preferredSharingChainIds)
expectedRoles: ["preferredSharingChainIds"]
}
]
} }
selectedAddress: popup.preSelectedAccountAddress selectedAddress: popup.preSelectedAccountAddress
onCurrentAccountAddressChanged: { onCurrentAccountAddressChanged: {
@ -621,7 +604,7 @@ StatusDialog {
visible: !recipientInputLoader.ready && !d.isBridgeTx visible: !recipientInputLoader.ready && !d.isBridgeTx
savedAddressesModel: popup.store.savedAddressesModel savedAddressesModel: popup.store.savedAddressesModel
myAccountsModel: d.accountsAdaptor.model myAccountsModel: popup.store.accounts
recentRecipientsModel: popup.store.tempActivityController1Model // Use Layer1 controller since this could go on top of other activity lists recentRecipientsModel: popup.store.tempActivityController1Model // Use Layer1 controller since this could go on top of other activity lists
onRecipientSelected: { onRecipientSelected: {

View File

@ -134,7 +134,6 @@ Item {
walletType: model.walletType walletType: model.walletType
migratedToKeycard: model.migratedToKeycard ?? false migratedToKeycard: model.migratedToKeycard ?? false
accountBalance: model.accountBalance ?? null accountBalance: model.accountBalance ?? null
chainShortNames: model.colorizedChainShortNames ?? ""
// This should only pass a `key` role to identify the accounts object but not necessary to pass the complete object structure // This should only pass a `key` role to identify the accounts object but not necessary to pass the complete object structure
// TODO issue: #15492 // TODO issue: #15492
onClicked: recipientSelected({name: model.name, onClicked: recipientSelected({name: model.name,
@ -144,7 +143,6 @@ Item {
emoji: model.emoji, emoji: model.emoji,
walletType: model.walletType, walletType: model.walletType,
currencyBalance: model.currencyBalance, currencyBalance: model.currencyBalance,
preferredSharingChainIds: model.preferredSharingChainIds,
migratedToKeycard: model.migratedToKeycard migratedToKeycard: model.migratedToKeycard
}, },
Helpers.RecipientAddressObjectType.Account) Helpers.RecipientAddressObjectType.Account)

View File

@ -41,11 +41,9 @@ Loader {
onSelectedRecipientChanged: { onSelectedRecipientChanged: {
root.isLoading() root.isLoading()
if(!!root.selectedRecipient) { if(!!root.selectedRecipient) {
let preferredChainIds = []
switch(root.selectedRecipientType) { switch(root.selectedRecipientType) {
case Helpers.RecipientAddressObjectType.Account: { case Helpers.RecipientAddressObjectType.Account: {
root.addressText = root.selectedRecipient.address root.addressText = root.selectedRecipient.address
preferredChainIds = root.selectedRecipient.preferredSharingChainIds
break break
} }
case Helpers.RecipientAddressObjectType.SavedAddress: { case Helpers.RecipientAddressObjectType.SavedAddress: {
@ -84,7 +82,7 @@ Loader {
if(root.isBridgeTx) if(root.isBridgeTx)
root.store.setAllNetworksAsRoutePreferredChains() root.store.setAllNetworksAsRoutePreferredChains()
else else
root.store.updateRoutePreferredChains(preferredChainIds) root.store.updateRoutePreferredChains([])
} }
recalculateRoutesAndFees() recalculateRoutesAndFees()
@ -159,7 +157,6 @@ Loader {
name: !!modelData ? modelData.name : "" name: !!modelData ? modelData.name : ""
address: !!modelData ? modelData.address : "" address: !!modelData ? modelData.address : ""
chainShortNames: !!modelData ? store.getNetworkShortNames(modelData.preferredSharingChainIds) : ""
emoji: !!modelData ? modelData.emoji : "" emoji: !!modelData ? modelData.emoji : ""
walletColor: !!modelData ? Utils.getColorForId(modelData.colorId): "" walletColor: !!modelData ? Utils.getColorForId(modelData.colorId): ""
currencyBalance: !!modelData ? modelData.currencyBalance : "" currencyBalance: !!modelData ? modelData.currencyBalance : ""
@ -174,8 +171,7 @@ Loader {
sensor.enabled: false sensor.enabled: false
subTitle: { subTitle: {
if(!!modelData) { if(!!modelData) {
const elidedAddress = StatusQUtils.Utils.elideAndFormatWalletAddress(modelData.address) return StatusQUtils.Utils.elideAndFormatWalletAddress(modelData.address)
return WalletUtils.colorizedChainPrefix(accountItem.chainShortNames) + elidedAddress
} }
return "" return ""
} }

View File

@ -31,7 +31,6 @@ StatusDialog {
Expected model structure: Expected model structure:
name [string] - account name e.g. "Piggy Bank" name [string] - account name e.g. "Piggy Bank"
address [string] - wallet account address e.g. "0x1234567890" address [string] - wallet account address e.g. "0x1234567890"
colorizedChainPrefixes [string] - chain prefixes with rich text colors e.g. "<font color=\"red\">eth:</font><font color=\"blue\">oeth:</font><font color=\"green\">arb:</font>"
emoji [string] - emoji for account e.g. "🐷" emoji [string] - emoji for account e.g. "🐷"
colorId [string] - color id for account e.g. "1" colorId [string] - color id for account e.g. "1"
currencyBalance [var] - fiat currency balance currencyBalance [var] - fiat currency balance

View File

@ -98,10 +98,6 @@ QtObject {
walletSectionSendInst.setReceiverAccount(address) walletSectionSendInst.setReceiverAccount(address)
} }
function getNetworkShortNames(chainIds) {
return networksModule.getNetworkShortNames(chainIds)
}
function toggleFromDisabledChains(chainId) { function toggleFromDisabledChains(chainId) {
walletSectionSendInst.fromNetworksRouteModel.toggleRouteDisabledChains(chainId) walletSectionSendInst.fromNetworksRouteModel.toggleRouteDisabledChains(chainId)
} }

View File

@ -52,7 +52,7 @@ Item {
delegate: Item { delegate: Item {
id: delegateItem id: delegateItem
function getCollectibleURL() { function getCollectibleURL() {
const networkShortName = root.walletStore.getNetworkShortNames(model.chainId); const networkShortName = StatusQUtils.ModelUtils.getByKey(root.walletStore.filteredFlatModel, "chainId", model.chainId, "shortName")
return root.walletStore.getOpenSeaCollectibleUrl(networkShortName, model.contractAddress, model.tokenId) return root.walletStore.getOpenSeaCollectibleUrl(networkShortName, model.contractAddress, model.tokenId)
} }
function openCollectibleURL() { function openCollectibleURL() {
@ -61,7 +61,7 @@ Item {
} }
function openCollectionURL() { function openCollectionURL() {
let networkShortName = root.walletStore.getNetworkShortNames(model.chainId); const networkShortName = StatusQUtils.ModelUtils.getByKey(root.walletStore.filteredFlatModel, "chainId", model.chainId, "shortName")
let link = root.walletStore.getOpenSeaCollectionUrl(networkShortName, model.contractAddress) let link = root.walletStore.getOpenSeaCollectionUrl(networkShortName, model.contractAddress)
Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link)); Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link));
} }

View File

@ -57,14 +57,6 @@ QtObject {
return "<font color=\"" + color + "\">" + text + "</font>" return "<font color=\"" + color + "\">" + text + "</font>"
} }
function splitToChainPrefixAndAddress(input) {
const addressIdx = input.indexOf('0x')
if (addressIdx < 0)
return { prefix: input, address: "" }
return { prefix: input.substring(0, addressIdx), address: input.substring(addressIdx) }
}
function isPrivateKey(value) { function isPrivateKey(value) {
return isHex(value) && ((startsWith0x(value) && value.length === 66) || return isHex(value) && ((startsWith0x(value) && value.length === 66) ||
(!startsWith0x(value) && value.length === 64)) (!startsWith0x(value) && value.length === 64))