feat(@desktop/wallet): Remove preferred chains from wallet accounts all over the app
This commit is contained in:
parent
7003ba73e2
commit
3f55e6c9c5
|
@ -12,8 +12,7 @@ type
|
|||
Emoji,
|
||||
KeyUid,
|
||||
Position,
|
||||
KeycardAccount,
|
||||
PreferredSharingChainIds
|
||||
KeycardAccount
|
||||
|
||||
QtObject:
|
||||
type
|
||||
|
@ -58,7 +57,6 @@ QtObject:
|
|||
ModelRole.KeyUid.int: "keyUid",
|
||||
ModelRole.Position.int: "position",
|
||||
ModelRole.KeycardAccount.int: "keycardAccount",
|
||||
ModelRole.PreferredSharingChainIds.int: "preferredSharingChainIds"
|
||||
}.toTable
|
||||
|
||||
|
||||
|
@ -110,8 +108,6 @@ QtObject:
|
|||
result = newQVariant(item.getPosition())
|
||||
of ModelRole.KeycardAccount:
|
||||
result = newQVariant(item.keycardAccount())
|
||||
of ModelRole.PreferredSharingChainIds:
|
||||
result = newQVariant(item.preferredSharingChainIds())
|
||||
|
||||
proc moveItem*(self: Model, fromRow: int, toRow: int): bool =
|
||||
if toRow < 0 or toRow > self.items.len - 1:
|
||||
|
|
|
@ -79,8 +79,6 @@ proc convertWalletAccountDtoToKeyPairAccountItem(self: Module, account: WalletAc
|
|||
operability = account.operable,
|
||||
isDefaultAccount = account.isWallet,
|
||||
self.controller.areTestNetworksEnabled(),
|
||||
prodPreferredChainIds = account.prodPreferredChainIds,
|
||||
testPreferredChainIds = account.testPreferredChainIds,
|
||||
hideFromTotalBalance = account.hideFromTotalBalance)
|
||||
|
||||
proc setBalance(self: Module, accountAddresses: seq[string]) =
|
||||
|
|
|
@ -27,8 +27,6 @@ QtObject:
|
|||
assetsLoading: bool,
|
||||
isWallet: bool,
|
||||
areTestNetworksEnabled: bool,
|
||||
prodPreferredChainIds: string,
|
||||
testPreferredChainIds: string,
|
||||
hideFromTotalBalance: bool,
|
||||
canSend: bool
|
||||
) =
|
||||
|
@ -44,8 +42,6 @@ QtObject:
|
|||
position,
|
||||
operability = wa_dto.AccountFullyOperable,
|
||||
areTestNetworksEnabled,
|
||||
prodPreferredChainIds,
|
||||
testPreferredChainIds,
|
||||
hideFromTotalBalance)
|
||||
self.createdAt = createdAt
|
||||
self.assetsLoading = assetsLoading
|
||||
|
@ -71,8 +67,6 @@ QtObject:
|
|||
assetsLoading: bool = true,
|
||||
isWallet: bool = false,
|
||||
areTestNetworksEnabled: bool = false,
|
||||
prodPreferredChainIds: string = "",
|
||||
testPreferredChainIds: string = "",
|
||||
hideFromTotalBalance: bool = false,
|
||||
canSend: bool = true
|
||||
): Item =
|
||||
|
@ -91,8 +85,6 @@ QtObject:
|
|||
assetsLoading,
|
||||
isWallet,
|
||||
areTestNetworksEnabled,
|
||||
prodPreferredChainIds,
|
||||
testPreferredChainIds,
|
||||
hideFromTotalBalance,
|
||||
canSend)
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ type
|
|||
KeycardAccount,
|
||||
AssetsLoading,
|
||||
IsWallet,
|
||||
PreferredSharingChainIds,
|
||||
HideFromTotalBalance,
|
||||
CanSend
|
||||
|
||||
|
@ -70,7 +69,6 @@ QtObject:
|
|||
ModelRole.KeycardAccount.int: "keycardAccount",
|
||||
ModelRole.AssetsLoading.int: "assetsLoading",
|
||||
ModelRole.IsWallet.int: "isWallet",
|
||||
ModelRole.PreferredSharingChainIds.int: "preferredSharingChainIds",
|
||||
ModelRole.HideFromTotalBalance.int: "hideFromTotalBalance",
|
||||
ModelRole.CanSend.int: "canSend"
|
||||
}.toTable
|
||||
|
@ -184,8 +182,6 @@ QtObject:
|
|||
result = newQVariant(item.assetsLoading())
|
||||
of ModelRole.IsWallet:
|
||||
result = newQVariant(item.isWallet())
|
||||
of ModelRole.PreferredSharingChainIds:
|
||||
result = newQVariant(item.preferredSharingChainIds())
|
||||
of ModelRole.HideFromTotalBalance:
|
||||
result = newQVariant(item.hideFromTotalBalance())
|
||||
of ModelRole.CanSend:
|
||||
|
|
|
@ -170,26 +170,5 @@ QtObject:
|
|||
|
||||
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 =
|
||||
return self.delegate.getFlatNetworksList().filter(n => n.isEnabled and n.isTest == areTestNetworksEnabled).map(n => n.chainId).join(":")
|
||||
|
|
|
@ -94,12 +94,6 @@ QtObject:
|
|||
proc enableNetwork*(self: View, chainId: int) {.slot.} =
|
||||
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.} =
|
||||
return self.flatNetworks.getBlockExplorerURL(chainId)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ proc buildKeypairItem*(keypair: KeypairDto, areTestNetworksEnabled: bool): KeyPa
|
|||
icon = "wallet"
|
||||
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,
|
||||
acc.prodPreferredChainIds, acc.testPreferredChainIds, acc.hideFromTotalBalance))
|
||||
acc.hideFromTotalBalance))
|
||||
return item
|
||||
|
||||
proc buildKeyPairsList*(keypairs: seq[KeypairDto], excludeAlreadyMigratedPairs: bool,
|
||||
|
|
|
@ -28,8 +28,6 @@ proc walletAccountToWalletAccountItem*(w: WalletAccountDto, keycardAccount: bool
|
|||
w.position,
|
||||
w.operable,
|
||||
areTestNetworksEnabled,
|
||||
w.prodPreferredChainIds,
|
||||
w.testPreferredChainIds,
|
||||
w.hideFromTotalBalance
|
||||
)
|
||||
|
||||
|
@ -51,8 +49,6 @@ proc walletAccountToWalletAccountsItem*(w: WalletAccountDto, isKeycardAccount: b
|
|||
w.assetsLoading or marketValuesLoading,
|
||||
w.isWallet,
|
||||
areTestNetworksEnabled,
|
||||
w.prodPreferredChainIds,
|
||||
w.testPreferredChainIds,
|
||||
w.hideFromTotalBalance,
|
||||
canSend=w.walletType != "watch" and (w.operable==AccountFullyOperable or w.operable==AccountPartiallyOperable)
|
||||
)
|
||||
|
|
|
@ -18,8 +18,6 @@ QtObject:
|
|||
balanceFetched: bool
|
||||
isDefaultAccount: bool
|
||||
areTestNetworksEnabled: bool
|
||||
prodPreferredChainIds: string
|
||||
testPreferredChainIds: string
|
||||
hideFromTotalBalance: bool
|
||||
|
||||
proc delete*(self: KeyPairAccountItem) =
|
||||
|
@ -27,7 +25,7 @@ QtObject:
|
|||
|
||||
proc newKeyPairAccountItem*(name = "", path = "", address = "", pubKey = "", emoji = "", colorId = "", icon = "",
|
||||
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)
|
||||
result.QObject.setup
|
||||
result.name = name
|
||||
|
@ -42,8 +40,6 @@ QtObject:
|
|||
result.operability = operability
|
||||
result.isDefaultAccount = isDefaultAccount
|
||||
result.areTestNetworksEnabled = areTestNetworksEnabled
|
||||
result.prodPreferredChainIds = prodPreferredChainIds
|
||||
result.testPreferredChainIds = testPreferredChainIds
|
||||
result.hideFromTotalBalance = hideFromTotalBalance
|
||||
|
||||
proc `$`*(self: KeyPairAccountItem): string =
|
||||
|
@ -60,8 +56,6 @@ QtObject:
|
|||
operability: {self.operability},
|
||||
isDefaultAccount: {self.isDefaultAccount},
|
||||
areTestNetworksEnabled: {self.areTestNetworksEnabled},
|
||||
prodPreferredChainIds: {self.prodPreferredChainIds},
|
||||
testPreferredChainIds: {self.testPreferredChainIds},
|
||||
hideFromTotalBalance: {self.hideFromTotalBalance}
|
||||
]"""
|
||||
|
||||
|
@ -178,16 +172,6 @@ QtObject:
|
|||
read = getIsDefaultAccount
|
||||
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 hideFromTotalBalance*(self: KeyPairAccountItem): bool {.slot.} =
|
||||
return self.hideFromTotalBalance
|
||||
|
|
|
@ -16,8 +16,6 @@ QtObject:
|
|||
position: int
|
||||
operability: string
|
||||
areTestNetworksEnabled: bool
|
||||
prodPreferredChainIds: string
|
||||
testPreferredChainIds: string
|
||||
hideFromTotalBalance: bool
|
||||
|
||||
proc setup*(self: WalletAccountItem,
|
||||
|
@ -32,8 +30,6 @@ QtObject:
|
|||
position: int = 0,
|
||||
operability: string = wa_dto.AccountFullyOperable,
|
||||
areTestNetworksEnabled: bool = false,
|
||||
prodPreferredChainIds: string = "",
|
||||
testPreferredChainIds: string = "",
|
||||
hideFromTotalBalance: bool = true
|
||||
) =
|
||||
self.QObject.setup
|
||||
|
@ -48,8 +44,6 @@ QtObject:
|
|||
self.position = position
|
||||
self.operability = operability
|
||||
self.areTestNetworksEnabled = areTestNetworksEnabled
|
||||
self.prodPreferredChainIds = prodPreferredChainIds
|
||||
self.testPreferredChainIds = testPreferredChainIds
|
||||
self.hideFromTotalBalance = hideFromTotalBalance
|
||||
|
||||
proc delete*(self: WalletAccountItem) =
|
||||
|
@ -67,8 +61,6 @@ QtObject:
|
|||
position: int = 0,
|
||||
operability: string = wa_dto.AccountFullyOperable,
|
||||
areTestNetworksEnabled: bool = false,
|
||||
prodPreferredChainIds: string = "",
|
||||
testPreferredChainIds: string = "",
|
||||
hideFromTotalBalance: bool = true): WalletAccountItem =
|
||||
new(result, delete)
|
||||
result.QObject.setup
|
||||
|
@ -83,8 +75,6 @@ QtObject:
|
|||
result.position = position
|
||||
result.operability = operability
|
||||
result.areTestNetworksEnabled = areTestNetworksEnabled
|
||||
result.prodPreferredChainIds = prodPreferredChainIds
|
||||
result.testPreferredChainIds = testPreferredChainIds
|
||||
result.hideFromTotalBalance = hideFromTotalBalance
|
||||
|
||||
proc `$`*(self: WalletAccountItem): string =
|
||||
|
@ -100,8 +90,6 @@ QtObject:
|
|||
position: {self.position},
|
||||
operability: {self.operability},
|
||||
areTestNetworksEnabled: {self.areTestNetworksEnabled},
|
||||
prodPreferredChainIds: {self.prodPreferredChainIds},
|
||||
testPreferredChainIds: {self.testPreferredChainIds},
|
||||
hideFromTotalBalance: {self.hideFromTotalBalance}
|
||||
]"""
|
||||
|
||||
|
@ -195,24 +183,6 @@ QtObject:
|
|||
write = setOperability
|
||||
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 hideFromTotalBalance*(self: WalletAccountItem): bool {.slot.} =
|
||||
return self.hideFromTotalBalance
|
||||
|
|
|
@ -34,8 +34,6 @@ type
|
|||
operable*: string
|
||||
createdAt*: int
|
||||
position*: int
|
||||
prodPreferredChainIDs*: string
|
||||
testPreferredChainIDs*: string
|
||||
hideFromTotalBalance*: bool
|
||||
|
||||
proc toWalletAccountDto*(jsonObj: JsonNode): WalletAccountDto =
|
||||
|
@ -56,8 +54,6 @@ proc toWalletAccountDto*(jsonObj: JsonNode): WalletAccountDto =
|
|||
discard jsonObj.getProp("operable", result.operable)
|
||||
discard jsonObj.getProp("createdAt", result.createdAt)
|
||||
discard jsonObj.getProp("position", result.position)
|
||||
discard jsonObj.getProp("prodPreferredChainIds", result.prodPreferredChainIds)
|
||||
discard jsonObj.getProp("testPreferredChainIds", result.testPreferredChainIds)
|
||||
discard jsonObj.getProp("hidden", result.hideFromTotalBalance)
|
||||
result.assetsLoading = true
|
||||
|
||||
|
@ -76,8 +72,6 @@ proc `$`*(self: WalletAccountDto): string =
|
|||
assetsLoading: {self.assetsLoading},
|
||||
removed: {self.removed},
|
||||
operable: {self.operable},
|
||||
prodPreferredChainIds: {self.prodPreferredChainIds},
|
||||
testPreferredChainIds: {self.testPreferredChainIds},
|
||||
hideFromTotalBalance: {self.hideFromTotalBalance}
|
||||
]"""
|
||||
|
||||
|
@ -100,6 +94,4 @@ proc `%`*(x: WalletAccountDto): JsonNode =
|
|||
result["operable"] = % x.operable
|
||||
result["createdAt"] = % x.createdAt
|
||||
result["position"] = % x.position
|
||||
result["prodPreferredChainIds"] = % x.prodPreferredChainIds
|
||||
result["testPreferredChainIds"] = % x.testPreferredChainIds
|
||||
result["hideFromTotalBalance"] = % x.hideFromTotalBalance
|
||||
|
|
|
@ -36,8 +36,6 @@ proc replaceKeypair(self: Service, keypair: KeypairDto) =
|
|||
locAcc.emoji = acc.emoji
|
||||
locAcc.operable = acc.operable
|
||||
locAcc.removed = acc.removed
|
||||
locAcc.prodPreferredChainIds = acc.prodPreferredChainIds
|
||||
locAcc.testPreferredChainIds = acc.testPreferredChainIds
|
||||
break
|
||||
|
||||
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"
|
||||
return false
|
||||
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:
|
||||
error "status-go error", procName="updateWalletAccount", errCode=response.error.code, errDesription=response.error.message
|
||||
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"
|
||||
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, account.testPreferredChainIds, hideFromTotalBalance)
|
||||
account.keyUid, account.walletType, account.colorId, account.emoji, account.isWallet, account.isChat, hideFromTotalBalance)
|
||||
if not response.error.isNil:
|
||||
error "status-go error", procName="updateWatchAccountHiddenFromTotalBalance", errCode=response.error.code, errDesription=response.error.message
|
||||
return false
|
||||
|
|
|
@ -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
|
||||
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] =
|
||||
let payload = %* [
|
||||
{
|
||||
|
@ -122,8 +122,6 @@ proc updateAccount*(name, address, path: string, publicKey, keyUid, accountType,
|
|||
"name": name,
|
||||
"emoji": emoji,
|
||||
"colorId": colorId,
|
||||
"prodPreferredChainIds": prodPreferredChainIds,
|
||||
"testPreferredChainIds": testPreferredChainIds,
|
||||
"hidden": hideFromTotalBalance
|
||||
#"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
|
||||
|
|
|
@ -57,14 +57,6 @@ SplitView {
|
|||
property bool areTestNetworksEnabled: areTestNetworksEnabledCheckbox.checked
|
||||
function toggleNetwork(chainId) {
|
||||
}
|
||||
|
||||
function getNetworkShortNames() {
|
||||
return "eth:oeth:arb1:"
|
||||
}
|
||||
|
||||
function getAllNetworksChainIds() {
|
||||
return "1:10:42161"
|
||||
}
|
||||
}
|
||||
|
||||
property var keyPairModel: WalletKeyPairModel {}
|
||||
|
|
|
@ -462,9 +462,6 @@ Item {
|
|||
property var accounts: customAccountsModel.count > 0 ? customAccountsModel : defaultAccountsModel
|
||||
readonly property ListModel nonWatchAccounts: accounts
|
||||
|
||||
function getNetworkShortNames(chainIds) {
|
||||
return "eth:oeth:arb"
|
||||
}
|
||||
readonly property SharedStores.CurrenciesStore currencyStore: SharedStores.CurrenciesStore {}
|
||||
readonly property WalletStore.WalletAssetsStore walletAssetsStore: WalletStore.WalletAssetsStore {
|
||||
// Silence warnings
|
||||
|
|
|
@ -49,6 +49,10 @@ SplitView {
|
|||
qrImageSource: "https://upload.wikimedia.org/wikipedia/commons/4/41/QR_Code_Example.svg"
|
||||
|
||||
store: WalletStores.RootStore
|
||||
|
||||
onUpdateSelectedAddress: {
|
||||
dialog.selectedAccount = ModelUtils.getByKey(dialog.accounts, "address", address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,6 @@ SplitView {
|
|||
color: "#2A4AF5",
|
||||
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
|
||||
walletType: "",
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
|
||||
currencyBalance: ({amount: 1.25,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -68,8 +66,6 @@ SplitView {
|
|||
color: "#216266",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
|
||||
walletType: Constants.generatedWalletType,
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
|
||||
currencyBalance: ({amount: 10,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -83,8 +79,6 @@ SplitView {
|
|||
color: "#EC266C",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
|
||||
walletType: Constants.seedWalletType,
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
|
||||
currencyBalance: ({amount: 110.05,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -98,8 +92,6 @@ SplitView {
|
|||
color: "#CB6256",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883",
|
||||
walletType: Constants.watchWalletType,
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
|
||||
currencyBalance: ({amount: 3,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -113,8 +105,6 @@ SplitView {
|
|||
color: "#C78F67",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||
walletType: Constants.keyWalletType,
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
colorizedChainShortNames: WalletUtils.colorizedChainPrefixNew(chainColors, "eth:oeth:arb1:"),
|
||||
currencyBalance: ({amount: 999,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
|
|
@ -79,13 +79,11 @@ SplitView {
|
|||
|
||||
QtObject {
|
||||
id: d
|
||||
property string addressPrefixString: "eth:oeth:arb1:"
|
||||
property string addressName: "Ariana Pearlona"
|
||||
property bool isContact: true
|
||||
property bool isWallet: false
|
||||
property bool isSavedAccount: false
|
||||
property bool showPrefix: true
|
||||
readonly property string displayAddress: (d.showPrefix ? d.addressPrefixString : "") + "0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"
|
||||
readonly property string displayAddress: "0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"
|
||||
}
|
||||
|
||||
QtObject {
|
||||
|
@ -207,20 +205,6 @@ SplitView {
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ SplitView {
|
|||
clearVisible: showClearButton.checked
|
||||
name: nameField.text
|
||||
address: addressField.text
|
||||
chainShortNames: chainShortNamesField.text
|
||||
emoji: emojiField.text
|
||||
walletColor: walletColorField.text
|
||||
currencyBalance: QtObject {
|
||||
|
@ -70,12 +69,6 @@ SplitView {
|
|||
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 {
|
||||
id: emojiField
|
||||
text: "🐷"
|
||||
|
|
|
@ -244,9 +244,6 @@ Item {
|
|||
keycardAccount: false
|
||||
}
|
||||
}
|
||||
function getNetworkShortNames(chainIds) {
|
||||
return "eth:oeth:arb"
|
||||
}
|
||||
|
||||
readonly property var currencyStore: CurrenciesStore {}
|
||||
readonly property var walletAssetsStore: assetsStoreMock
|
||||
|
|
|
@ -37,7 +37,6 @@ Item {
|
|||
color: "#2A4AF5",
|
||||
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
|
||||
walletType: "",
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 1.25,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -51,7 +50,6 @@ Item {
|
|||
color: "#216266",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
|
||||
walletType: Constants.generatedWalletType,
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 10,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -65,7 +63,6 @@ Item {
|
|||
color: "#EC266C",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
|
||||
walletType: Constants.seedWalletType,
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 110.05,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -79,7 +76,6 @@ Item {
|
|||
color: "#C78F67",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||
walletType: Constants.keyWalletType,
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 999,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
|
|
@ -236,14 +236,16 @@ Item {
|
|||
|
||||
for(let i =0; i< comboBoxList.model.count; i++) {
|
||||
let delegateUnderTest = comboBoxList.itemAtIndex(i)
|
||||
compare(delegateUnderTest.title, swapAdaptor.nonWatchAccounts.get(i).name)
|
||||
compare(delegateUnderTest.subTitle, SQUtils.Utils.elideAndFormatWalletAddress(swapAdaptor.nonWatchAccounts.get(i).address))
|
||||
compare(delegateUnderTest.asset.color.toString().toUpperCase(), swapAdaptor.nonWatchAccounts.get(i).color.toString().toUpperCase())
|
||||
compare(delegateUnderTest.asset.emoji, swapAdaptor.nonWatchAccounts.get(i).emoji)
|
||||
let accountToBeTested = swapAdaptor.nonWatchAccounts.get(i)
|
||||
let elidedAddress = SQUtils.Utils.elideAndFormatWalletAddress(accountToBeTested.address)
|
||||
compare(delegateUnderTest.title, accountToBeTested.name)
|
||||
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")
|
||||
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
|
||||
if(comboBoxList.currentIndex === i) {
|
||||
|
@ -256,13 +258,13 @@ Item {
|
|||
// TODO: always null not sure why
|
||||
// const walletAccountTypeIcon = findChild(delegateUnderTest, "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
|
||||
mouseMove(delegateUnderTest, delegateUnderTest.width/2, delegateUnderTest.height/2)
|
||||
verify(delegateUnderTest.sensor.containsMouse)
|
||||
compare(delegateUnderTest.title, swapAdaptor.nonWatchAccounts.get(i).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.title, accountToBeTested.name)
|
||||
compare(delegateUnderTest.subTitle, Utils.richColorText(elidedAddress, Theme.palette.directColor1))
|
||||
verify(delegateUnderTest.color, Theme.palette.baseColor2)
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ ListModel {
|
|||
}
|
||||
}
|
||||
],
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 1.25,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -69,7 +68,6 @@ ListModel {
|
|||
}
|
||||
}
|
||||
],
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 10,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -105,7 +103,6 @@ ListModel {
|
|||
}
|
||||
}
|
||||
],
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 110.05,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -123,7 +120,6 @@ ListModel {
|
|||
position: 2,
|
||||
assets: [
|
||||
],
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 3,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
@ -150,7 +146,6 @@ ListModel {
|
|||
}
|
||||
}
|
||||
],
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
currencyBalance: ({amount: 999,
|
||||
symbol: "USD",
|
||||
displayDecimals: 2,
|
||||
|
|
|
@ -10,7 +10,6 @@ ListModel {
|
|||
colorId: Constants.walletAccountColors.primary,
|
||||
color: "#2A4AF5",
|
||||
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240",
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
walletType: "",
|
||||
position: 0,
|
||||
canSend: true,
|
||||
|
@ -22,7 +21,6 @@ ListModel {
|
|||
colorId: Constants.walletAccountColors.army,
|
||||
color: "#216266",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
walletType: Constants.generatedWalletType,
|
||||
position: 3,
|
||||
canSend: true,
|
||||
|
@ -34,7 +32,6 @@ ListModel {
|
|||
colorId: Constants.walletAccountColors.magenta,
|
||||
color: "#EC266C",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
walletType: Constants.seedWalletType,
|
||||
position: 1,
|
||||
canSend: true,
|
||||
|
@ -46,7 +43,6 @@ ListModel {
|
|||
colorId: Constants.walletAccountColors.copper,
|
||||
color: "#CB6256",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8883",
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
walletType: Constants.watchWalletType,
|
||||
position: 2,
|
||||
canSend: false,
|
||||
|
@ -58,7 +54,6 @@ ListModel {
|
|||
colorId: Constants.walletAccountColors.camel,
|
||||
color: "#C78F67",
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||
preferredSharingChainIds: "5:420:421613",
|
||||
walletType: Constants.keyWalletType,
|
||||
position: 4,
|
||||
canSend: true,
|
||||
|
|
|
@ -7,9 +7,6 @@ QtObject {
|
|||
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.
|
||||
function colorForChainShortName(chainShortName) {
|
||||
return "#FF0000" // Just some random testing color
|
||||
}
|
||||
|
||||
function savedAddressNameExists(name) {
|
||||
return false
|
||||
|
@ -19,10 +16,6 @@ QtObject {
|
|||
console.log("createOrUpdateSavedAddress")
|
||||
}
|
||||
|
||||
function getNetworkIds(chainSortNames) {
|
||||
return chainSortNames.split(":").filter((shortName) => shortName.length > 0)
|
||||
}
|
||||
|
||||
function getNameForAddress(address) {
|
||||
return "NAMEFOR: %1".arg(address)
|
||||
}
|
||||
|
|
|
@ -137,10 +137,6 @@ QtObject {
|
|||
}
|
||||
}
|
||||
|
||||
function getNetworkShortNames(chainIds) {
|
||||
return ""
|
||||
}
|
||||
|
||||
function setSendType(sendType) {
|
||||
root.sendType = sendType
|
||||
}
|
||||
|
|
|
@ -126,15 +126,6 @@ QtObject {
|
|||
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() {
|
||||
// TODO:
|
||||
// - `runAddAccountPopup` should be part of `root.walletModule`
|
||||
|
@ -156,10 +147,6 @@ QtObject {
|
|||
networksModuleInst.updateNetworkEndPointValues(chainId, testNetwork, newMainRpcInput, newFailoverRpcUrl, revertToDefault)
|
||||
}
|
||||
|
||||
function getNetworkShortNames(chainIds) {
|
||||
return networksModuleInst.getNetworkShortNames(chainIds)
|
||||
}
|
||||
|
||||
function getNetworkData(combinedNetwork) {
|
||||
return {
|
||||
prod: {chainId: combinedNetwork.prod.chainId,
|
||||
|
|
|
@ -11,61 +11,6 @@ import AppLayouts.Wallet.stores 1.0 as WalletStores
|
|||
|
||||
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) {
|
||||
if (chainLayer === 1) {
|
||||
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) {
|
||||
if (code === "") {
|
||||
return ""
|
||||
|
|
|
@ -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()
|
||||
}
|
|
@ -1,3 +1,2 @@
|
|||
CollectiblesSelectionAdaptor 1.0 CollectiblesSelectionAdaptor.qml
|
||||
TokenSelectorViewAdaptor 1.0 TokenSelectorViewAdaptor.qml
|
||||
WalletAccountsAdaptor 1.0 WalletAccountsAdaptor.qml
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@ NetworkFilter 1.0 NetworkFilter.qml
|
|||
NetworkSelectItemDelegate 1.0 NetworkSelectItemDelegate.qml
|
||||
SortOrderComboBox 1.0 SortOrderComboBox.qml
|
||||
StatusDateRangePicker 1.0 StatusDateRangePicker.qml
|
||||
StatusNetworkListItemTag 1.0 StatusNetworkListItemTag.qml
|
||||
StatusTxProgressBar 1.0 StatusTxProgressBar.qml
|
||||
SwapExchangeButton 1.0 SwapExchangeButton.qml
|
||||
SwapProvidersTermsAndConditionsText 1.0 SwapProvidersTermsAndConditionsText.qml
|
||||
|
|
|
@ -216,7 +216,7 @@ StatusMenu {
|
|||
}
|
||||
else {
|
||||
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
|
||||
|
|
|
@ -37,7 +37,7 @@ QObject {
|
|||
|
||||
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.
|
||||
readonly property var nonWatchAccounts: SortFilterProxyModel {
|
||||
sourceModel: root.swapStore.accounts
|
||||
|
@ -74,15 +74,6 @@ QObject {
|
|||
FastExpressionRole {
|
||||
name: "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"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ QObject {
|
|||
/// Model containig the dApps session requests to be resolved by the user
|
||||
readonly property SessionRequestsModel sessionRequestsModel: requestHandler.requestsModel
|
||||
/// 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
|
||||
readonly property var flatNetworks: root.walletRootStore.filteredFlatModel
|
||||
/// Service can interact with the current address selection
|
||||
|
@ -124,21 +124,6 @@ QObject {
|
|||
QObject {
|
||||
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 {
|
||||
id: dappsModel
|
||||
markerRoleName: "source"
|
||||
|
|
|
@ -165,10 +165,6 @@ QtObject {
|
|||
}
|
||||
}
|
||||
|
||||
function colorForChainShortName(chainShortName) {
|
||||
return d.chainColors[chainShortName]
|
||||
}
|
||||
|
||||
readonly property var flatNetworks: networksModule.flatNetworks
|
||||
readonly property SortFilterProxyModel filteredFlatModel: SortFilterProxyModel {
|
||||
sourceModel: root.flatNetworks
|
||||
|
@ -265,8 +261,6 @@ QtObject {
|
|||
operable: "",
|
||||
createdAt: -1,
|
||||
position: -1,
|
||||
prodPreferredChainIds: "",
|
||||
testPreferredChainIds: "",
|
||||
hideFromTotalBalance: false
|
||||
}
|
||||
|
||||
|
@ -397,23 +391,6 @@ QtObject {
|
|||
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) {
|
||||
walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)
|
||||
}
|
||||
|
|
|
@ -2022,7 +2022,6 @@ Item {
|
|||
property var selectedAccount: ({
|
||||
name: "",
|
||||
address: "",
|
||||
preferredSharingChainIds: "",
|
||||
colorId: "",
|
||||
emoji: ""
|
||||
})
|
||||
|
@ -2035,7 +2034,6 @@ Item {
|
|||
if (showQR.showSingleAccount || showQR.showForSavedAddress) {
|
||||
showQR.selectedAccount.name = params.name?? ""
|
||||
showQR.selectedAccount.address = params.address?? ""
|
||||
showQR.selectedAccount.preferredSharingChainIds = params.preferredSharingChainIds?? ""
|
||||
showQR.selectedAccount.colorId = params.colorId?? ""
|
||||
showQR.selectedAccount.emoji = params.emoji?? ""
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import shared.controls 1.0
|
|||
Expected model structure:
|
||||
name [string] - account name e.g. "Piggy Bank"
|
||||
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. "🐷"
|
||||
colorId [string] - color id for account e.g. "1"
|
||||
currencyBalance [var] - fiat currency balance
|
||||
|
@ -101,7 +100,6 @@ StatusComboBox {
|
|||
width: ListView.view.width
|
||||
name: model.name
|
||||
address: model.address
|
||||
chainShortNames: model.colorizedChainPrefixes ?? ""
|
||||
emoji: model.emoji
|
||||
walletColor: Utils.getColorForId(model.colorId)
|
||||
currencyBalance: model.currencyBalance
|
||||
|
|
|
@ -80,7 +80,6 @@ Item {
|
|||
id: d
|
||||
|
||||
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 isWallet: !isContact && !!walletAddressName
|
||||
property var contactData
|
||||
|
@ -193,15 +192,7 @@ Item {
|
|||
color: Theme.palette.directColor1
|
||||
wrapMode: Text.WrapAnywhere
|
||||
enabled: false // Set to false to disable hover for rich text
|
||||
text: {
|
||||
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
|
||||
}
|
||||
}
|
||||
text: root.address
|
||||
visible: !!root.address
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ StatusListItem {
|
|||
|
||||
required property string name
|
||||
required property string address
|
||||
required property string chainShortNames
|
||||
required property string emoji
|
||||
required property string walletColor
|
||||
required property var currencyBalance
|
||||
|
@ -41,7 +40,7 @@ StatusListItem {
|
|||
subTitle:{
|
||||
if(!!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 ""
|
||||
}
|
||||
|
|
|
@ -89,12 +89,6 @@ StatusDialog {
|
|||
|
||||
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 ||
|
||||
popup.preSelectedSendType === Constants.SendType.ENSRelease ||
|
||||
popup.preSelectedSendType === Constants.SendType.ENSSetPubKey ||
|
||||
|
@ -308,17 +302,6 @@ StatusDialog {
|
|||
}
|
||||
]
|
||||
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
|
||||
onCurrentAccountAddressChanged: {
|
||||
|
@ -621,7 +604,7 @@ StatusDialog {
|
|||
visible: !recipientInputLoader.ready && !d.isBridgeTx
|
||||
|
||||
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
|
||||
|
||||
onRecipientSelected: {
|
||||
|
|
|
@ -134,7 +134,6 @@ Item {
|
|||
walletType: model.walletType
|
||||
migratedToKeycard: model.migratedToKeycard ?? false
|
||||
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
|
||||
// TODO issue: #15492
|
||||
onClicked: recipientSelected({name: model.name,
|
||||
|
@ -144,7 +143,6 @@ Item {
|
|||
emoji: model.emoji,
|
||||
walletType: model.walletType,
|
||||
currencyBalance: model.currencyBalance,
|
||||
preferredSharingChainIds: model.preferredSharingChainIds,
|
||||
migratedToKeycard: model.migratedToKeycard
|
||||
},
|
||||
Helpers.RecipientAddressObjectType.Account)
|
||||
|
|
|
@ -41,11 +41,9 @@ Loader {
|
|||
onSelectedRecipientChanged: {
|
||||
root.isLoading()
|
||||
if(!!root.selectedRecipient) {
|
||||
let preferredChainIds = []
|
||||
switch(root.selectedRecipientType) {
|
||||
case Helpers.RecipientAddressObjectType.Account: {
|
||||
root.addressText = root.selectedRecipient.address
|
||||
preferredChainIds = root.selectedRecipient.preferredSharingChainIds
|
||||
break
|
||||
}
|
||||
case Helpers.RecipientAddressObjectType.SavedAddress: {
|
||||
|
@ -84,7 +82,7 @@ Loader {
|
|||
if(root.isBridgeTx)
|
||||
root.store.setAllNetworksAsRoutePreferredChains()
|
||||
else
|
||||
root.store.updateRoutePreferredChains(preferredChainIds)
|
||||
root.store.updateRoutePreferredChains([])
|
||||
}
|
||||
|
||||
recalculateRoutesAndFees()
|
||||
|
@ -159,7 +157,6 @@ Loader {
|
|||
|
||||
name: !!modelData ? modelData.name : ""
|
||||
address: !!modelData ? modelData.address : ""
|
||||
chainShortNames: !!modelData ? store.getNetworkShortNames(modelData.preferredSharingChainIds) : ""
|
||||
emoji: !!modelData ? modelData.emoji : ""
|
||||
walletColor: !!modelData ? Utils.getColorForId(modelData.colorId): ""
|
||||
currencyBalance: !!modelData ? modelData.currencyBalance : ""
|
||||
|
@ -174,8 +171,7 @@ Loader {
|
|||
sensor.enabled: false
|
||||
subTitle: {
|
||||
if(!!modelData) {
|
||||
const elidedAddress = StatusQUtils.Utils.elideAndFormatWalletAddress(modelData.address)
|
||||
return WalletUtils.colorizedChainPrefix(accountItem.chainShortNames) + elidedAddress
|
||||
return StatusQUtils.Utils.elideAndFormatWalletAddress(modelData.address)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ StatusDialog {
|
|||
Expected model structure:
|
||||
name [string] - account name e.g. "Piggy Bank"
|
||||
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. "🐷"
|
||||
colorId [string] - color id for account e.g. "1"
|
||||
currencyBalance [var] - fiat currency balance
|
||||
|
|
|
@ -98,10 +98,6 @@ QtObject {
|
|||
walletSectionSendInst.setReceiverAccount(address)
|
||||
}
|
||||
|
||||
function getNetworkShortNames(chainIds) {
|
||||
return networksModule.getNetworkShortNames(chainIds)
|
||||
}
|
||||
|
||||
function toggleFromDisabledChains(chainId) {
|
||||
walletSectionSendInst.fromNetworksRouteModel.toggleRouteDisabledChains(chainId)
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ Item {
|
|||
delegate: Item {
|
||||
id: delegateItem
|
||||
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)
|
||||
}
|
||||
function openCollectibleURL() {
|
||||
|
@ -61,7 +61,7 @@ Item {
|
|||
}
|
||||
|
||||
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)
|
||||
Global.openLinkWithConfirmation(link, StatusQUtils.StringUtils.extractDomainFromLink(link));
|
||||
}
|
||||
|
|
|
@ -57,14 +57,6 @@ QtObject {
|
|||
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) {
|
||||
return isHex(value) && ((startsWith0x(value) && value.length === 66) ||
|
||||
(!startsWith0x(value) && value.length === 64))
|
||||
|
|
Loading…
Reference in New Issue