parent
fa75cf7b9b
commit
1634109971
|
@ -63,6 +63,9 @@ proc getTokenBySymbolList*(self: Controller): var seq[TokenBySymbolItem] =
|
||||||
proc getTokenDetails*(self: Controller, symbol: string): TokenDetailsItem =
|
proc getTokenDetails*(self: Controller, symbol: string): TokenDetailsItem =
|
||||||
return self.tokenService.getTokenDetails(symbol)
|
return self.tokenService.getTokenDetails(symbol)
|
||||||
|
|
||||||
|
proc getTokenListUpdatedAt*(self: Controller): int64 =
|
||||||
|
return self.tokenService.getTokenListUpdatedAt()
|
||||||
|
|
||||||
proc getMarketValuesBySymbol*(self: Controller, symbol: string): TokenMarketValuesItem =
|
proc getMarketValuesBySymbol*(self: Controller, symbol: string): TokenMarketValuesItem =
|
||||||
return self.tokenService.getMarketValuesBySymbol(symbol)
|
return self.tokenService.getMarketValuesBySymbol(symbol)
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ method load*(self: Module) =
|
||||||
self.view.modelsAboutToUpdate()
|
self.view.modelsAboutToUpdate()
|
||||||
self.events.on(SIGNAL_TOKENS_LIST_UPDATED) do(e: Args):
|
self.events.on(SIGNAL_TOKENS_LIST_UPDATED) do(e: Args):
|
||||||
self.view.modelsUpdated()
|
self.view.modelsUpdated()
|
||||||
|
self.view.setTokenListUpdatedAt(self.controller.getTokenListUpdatedAt())
|
||||||
self.events.on(SIGNAL_TOKENS_DETAILS_ABOUT_TO_BE_UPDATED) do(e: Args):
|
self.events.on(SIGNAL_TOKENS_DETAILS_ABOUT_TO_BE_UPDATED) do(e: Args):
|
||||||
self.view.tokensDetailsAboutToUpdate()
|
self.view.tokensDetailsAboutToUpdate()
|
||||||
self.events.on(SIGNAL_TOKENS_DETAILS_UPDATED) do(e: Args):
|
self.events.on(SIGNAL_TOKENS_DETAILS_UPDATED) do(e: Args):
|
||||||
|
|
|
@ -8,6 +8,8 @@ QtObject:
|
||||||
delegate: io_interface.AccessInterface
|
delegate: io_interface.AccessInterface
|
||||||
marketHistoryIsLoading: bool
|
marketHistoryIsLoading: bool
|
||||||
balanceHistoryIsLoading: bool
|
balanceHistoryIsLoading: bool
|
||||||
|
|
||||||
|
tokenListUpdatedAt: int64
|
||||||
# This contains the different sources for the tokens list
|
# This contains the different sources for the tokens list
|
||||||
# ex. uniswap list, status tokens list
|
# ex. uniswap list, status tokens list
|
||||||
sourcesOfTokensModel: SourcesOfTokensModel
|
sourcesOfTokensModel: SourcesOfTokensModel
|
||||||
|
@ -51,6 +53,16 @@ QtObject:
|
||||||
read = getMarketHistoryIsLoading
|
read = getMarketHistoryIsLoading
|
||||||
notify = marketHistoryIsLoadingChanged
|
notify = marketHistoryIsLoadingChanged
|
||||||
|
|
||||||
|
proc tokenListUpdatedAtChanged*(self: View) {.signal.}
|
||||||
|
proc getTokenListUpdatedAt(self: View): QVariant {.slot.} =
|
||||||
|
return newQVariant(self.tokenListUpdatedAt)
|
||||||
|
proc setTokenListUpdatedAt*(self: View, updatedAt: int64) =
|
||||||
|
self.tokenListUpdatedAt = updatedAt
|
||||||
|
self.tokenListUpdatedAtChanged()
|
||||||
|
QtProperty[QVariant] tokenListUpdatedAt:
|
||||||
|
read = getTokenListUpdatedAt
|
||||||
|
notify = tokenListUpdatedAtChanged
|
||||||
|
|
||||||
proc balanceHistoryIsLoadingChanged*(self: View) {.signal.}
|
proc balanceHistoryIsLoadingChanged*(self: View) {.signal.}
|
||||||
proc getBalanceHistoryIsLoading(self: View): QVariant {.slot.} =
|
proc getBalanceHistoryIsLoading(self: View): QVariant {.slot.} =
|
||||||
return newQVariant(self.balanceHistoryIsLoading)
|
return newQVariant(self.balanceHistoryIsLoading)
|
||||||
|
|
|
@ -70,15 +70,17 @@ proc newTokenDto*(
|
||||||
type TokenSourceDto* = ref object of RootObj
|
type TokenSourceDto* = ref object of RootObj
|
||||||
name* {.serializedFieldName("name").}: string
|
name* {.serializedFieldName("name").}: string
|
||||||
tokens* {.serializedFieldName("tokens").}: seq[TokenDto]
|
tokens* {.serializedFieldName("tokens").}: seq[TokenDto]
|
||||||
updatedAt* {.serializedFieldName("updatedAt").}: int64
|
|
||||||
source* {.serializedFieldName("source").}: string
|
source* {.serializedFieldName("source").}: string
|
||||||
version* {.serializedFieldName("version").}: string
|
version* {.serializedFieldName("version").}: string
|
||||||
|
|
||||||
|
type TokenListDto* = ref object of RootObj
|
||||||
|
updatedAt* {.serializedFieldName("updatedAt").}: int64
|
||||||
|
data* {.serializedFieldName("data").}: seq[TokenSourceDto]
|
||||||
|
|
||||||
proc `$`*(self: TokenSourceDto): string =
|
proc `$`*(self: TokenSourceDto): string =
|
||||||
result = fmt"""TokenSourceDto[
|
result = fmt"""TokenSourceDto[
|
||||||
name: {self.name},
|
name: {self.name},
|
||||||
tokens: {self.tokens},
|
tokens: {self.tokens},
|
||||||
updatedAt: {self.updatedAt},
|
|
||||||
source: {self.source},
|
source: {self.source},
|
||||||
version: {self.version}
|
version: {self.version}
|
||||||
]"""
|
]"""
|
||||||
|
|
|
@ -84,6 +84,7 @@ QtObject:
|
||||||
tokensMarketDetailsLoading: bool
|
tokensMarketDetailsLoading: bool
|
||||||
hasMarketDetailsCache: bool
|
hasMarketDetailsCache: bool
|
||||||
hasPriceValuesCache: bool
|
hasPriceValuesCache: bool
|
||||||
|
tokenListUpdatedAt: int64
|
||||||
|
|
||||||
proc getCurrency*(self: Service): string
|
proc getCurrency*(self: Service): string
|
||||||
proc updateCachedTokenPrice(self: Service, crypto: string, fiat: string, price: float64)
|
proc updateCachedTokenPrice(self: Service, crypto: string, fiat: string, price: float64)
|
||||||
|
@ -202,6 +203,9 @@ QtObject:
|
||||||
let errDesription = e.msg
|
let errDesription = e.msg
|
||||||
error "error: ", errDesription
|
error "error: ", errDesription
|
||||||
|
|
||||||
|
proc getTokenListUpdatedAt*(self: Service): int64 =
|
||||||
|
return self.tokenListUpdatedAt
|
||||||
|
|
||||||
proc fetchTokensPrices(self: Service, symbols: seq[string]) =
|
proc fetchTokensPrices(self: Service, symbols: seq[string]) =
|
||||||
self.tokensPricesLoading = true
|
self.tokensPricesLoading = true
|
||||||
defer: self.events.emit(SIGNAL_TOKENS_PRICES_ABOUT_TO_BE_UPDATED, Args())
|
defer: self.events.emit(SIGNAL_TOKENS_PRICES_ABOUT_TO_BE_UPDATED, Args())
|
||||||
|
@ -254,16 +258,21 @@ QtObject:
|
||||||
|
|
||||||
if not errorString.isEmptyOrWhitespace:
|
if not errorString.isEmptyOrWhitespace:
|
||||||
raise newException(Exception, "Error getting supported tokens list: " & errorString)
|
raise newException(Exception, "Error getting supported tokens list: " & errorString)
|
||||||
let sourcesList = if tokensResult.isNil or tokensResult.kind == JNull: @[]
|
|
||||||
else: Json.decode($tokensResult, seq[TokenSourceDto], allowUnknownFields = true)
|
if tokensResult.isNil or tokensResult.kind == JNull:
|
||||||
|
raise newException(Exception, "Error in response of getting supported tokens list")
|
||||||
|
|
||||||
|
let tokenList = Json.decode($tokensResult, TokenListDto, allowUnknownFields = true)
|
||||||
|
self.tokenListUpdatedAt = tokenList.updatedAt
|
||||||
|
|
||||||
let supportedNetworkChains = self.networkService.getAllNetworkChainIds()
|
let supportedNetworkChains = self.networkService.getAllNetworkChainIds()
|
||||||
var flatTokensList: Table[string, TokenItem] = initTable[string, TokenItem]()
|
var flatTokensList: Table[string, TokenItem] = initTable[string, TokenItem]()
|
||||||
var tokenBySymbolList: Table[string, TokenBySymbolItem] = initTable[string, TokenBySymbolItem]()
|
var tokenBySymbolList: Table[string, TokenBySymbolItem] = initTable[string, TokenBySymbolItem]()
|
||||||
var tokenSymbols: seq[string] = @[]
|
var tokenSymbols: seq[string] = @[]
|
||||||
|
|
||||||
for s in sourcesList:
|
|
||||||
let newSource = SupportedSourcesItem(name: s.name, updatedAt: s.updatedAt, source: s.source, version: s.version, tokensCount: s.tokens.len)
|
for s in tokenList.data:
|
||||||
|
let newSource = SupportedSourcesItem(name: s.name, source: s.source, version: s.version, tokensCount: s.tokens.len)
|
||||||
self.sourcesOfTokensList.add(newSource)
|
self.sourcesOfTokensList.add(newSource)
|
||||||
|
|
||||||
for token in s.tokens:
|
for token in s.tokens:
|
||||||
|
|
|
@ -63,7 +63,6 @@ SplitView {
|
||||||
required property string name
|
required property string name
|
||||||
required property string image
|
required property string image
|
||||||
required property string source
|
required property string source
|
||||||
required property int updatedAt
|
|
||||||
required property string version
|
required property string version
|
||||||
required property int tokensCount
|
required property int tokensCount
|
||||||
|
|
||||||
|
@ -77,7 +76,6 @@ SplitView {
|
||||||
sourceName: delegate.name
|
sourceName: delegate.name
|
||||||
sourceImage: delegate.image
|
sourceImage: delegate.image
|
||||||
sourceUrl: delegate.source
|
sourceUrl: delegate.source
|
||||||
sourceUpdatedAt: delegate.updatedAt
|
|
||||||
sourceVersion: delegate.version
|
sourceVersion: delegate.version
|
||||||
tokensCount: delegate.tokensCount
|
tokensCount: delegate.tokensCount
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ ListModel {
|
||||||
{
|
{
|
||||||
key: root.uniswap,
|
key: root.uniswap,
|
||||||
name: "Uniswap Labs Default",
|
name: "Uniswap Labs Default",
|
||||||
updatedAt: 1695720962,
|
|
||||||
source: "https://gateway.ipfs.io/ipns/tokens.uniswap.org",
|
source: "https://gateway.ipfs.io/ipns/tokens.uniswap.org",
|
||||||
version: "11.6.0",
|
version: "11.6.0",
|
||||||
tokensCount: 731,
|
tokensCount: 731,
|
||||||
|
@ -22,7 +21,6 @@ ListModel {
|
||||||
{
|
{
|
||||||
key: root.status,
|
key: root.status,
|
||||||
name: "Status Token List",
|
name: "Status Token List",
|
||||||
updatedAt: 1661506562,
|
|
||||||
source: "https://status.im/",
|
source: "https://status.im/",
|
||||||
version: "11.6.0",
|
version: "11.6.0",
|
||||||
tokensCount: 250,
|
tokensCount: 250,
|
||||||
|
|
|
@ -90,7 +90,6 @@ StatusListView {
|
||||||
sourceName: delegate.name
|
sourceName: delegate.name
|
||||||
sourceImage: delegate.image
|
sourceImage: delegate.image
|
||||||
sourceUrl: delegate.source
|
sourceUrl: delegate.source
|
||||||
sourceUpdatedAt: delegate.updatedAt
|
|
||||||
sourceVersion: delegate.version
|
sourceVersion: delegate.version
|
||||||
tokensCount: delegate.tokensCount
|
tokensCount: delegate.tokensCount
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ StatusDialog {
|
||||||
required property string sourceName
|
required property string sourceName
|
||||||
required property string sourceImage
|
required property string sourceImage
|
||||||
required property string sourceUrl
|
required property string sourceUrl
|
||||||
required property int sourceUpdatedAt
|
|
||||||
required property string sourceVersion
|
required property string sourceVersion
|
||||||
required property int tokensCount
|
required property int tokensCount
|
||||||
required property var tokensListModel // Expected roles: name, symbol, image, chainName, explorerUrl, isTest
|
required property var tokensListModel // Expected roles: name, symbol, image, chainName, explorerUrl, isTest
|
||||||
|
@ -147,13 +146,6 @@ StatusDialog {
|
||||||
title: qsTr("Version")
|
title: qsTr("Version")
|
||||||
text: root.sourceVersion
|
text: root.sourceVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomTextBlock {
|
|
||||||
title: qsTr("Automatically updates")
|
|
||||||
text: qsTr("Last updated %n day(s) ago",
|
|
||||||
"",
|
|
||||||
LocaleUtils.daysBetween(root.sourceUpdatedAt * 1000, Date.now()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component CustomHeaderDelegate: RowLayout {
|
component CustomHeaderDelegate: RowLayout {
|
||||||
|
|
|
@ -309,6 +309,7 @@ SettingsContentBase {
|
||||||
implicitHeight: root.availableHeight
|
implicitHeight: root.availableHeight
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
tokenListUpdatedAt: tokensStore.tokenListUpdatedAt
|
||||||
sourcesOfTokensModel: tokensStore.sourcesOfTokensModel
|
sourcesOfTokensModel: tokensStore.sourcesOfTokensModel
|
||||||
tokensListModel: tokensStore.extendedFlatTokensModel
|
tokensListModel: tokensStore.extendedFlatTokensModel
|
||||||
baseWalletAssetsModel: RootStore.walletAssetsStore.groupedAccountAssetsModel
|
baseWalletAssetsModel: RootStore.walletAssetsStore.groupedAccountAssetsModel
|
||||||
|
|
|
@ -20,6 +20,7 @@ import AppLayouts.Wallet.panels 1.0
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property double tokenListUpdatedAt
|
||||||
required property var sourcesOfTokensModel // Expected roles: key, name, updatedAt, source, version, tokensCount, image
|
required property var sourcesOfTokensModel // Expected roles: key, name, updatedAt, source, version, tokensCount, image
|
||||||
required property var tokensListModel // Expected roles: name, symbol, image, chainName, explorerUrl
|
required property var tokensListModel // Expected roles: name, symbol, image, chainName, explorerUrl
|
||||||
|
|
||||||
|
@ -267,7 +268,7 @@ Item {
|
||||||
}
|
}
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
text: qsTr("Last updated %1 @%2").arg(LocaleUtils.formatDate(root.sourcesOfTokensModel.get(0).updatedAt * 1000)).arg(LocaleUtils.formatTime(root.sourcesOfTokensModel.get(0).updatedAt, Locale.ShortFormat))
|
text: qsTr("Last updated %1 @%2").arg(LocaleUtils.formatDate(root.tokenListUpdatedAt * 1000)).arg(LocaleUtils.formatTime(root.tokenListUpdatedAt, Locale.ShortFormat))
|
||||||
color: Style.current.darkGrey
|
color: Style.current.darkGrey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ QtObject {
|
||||||
readonly property var _allTokensModule: !!walletSectionAllTokens ? walletSectionAllTokens : null
|
readonly property var _allTokensModule: !!walletSectionAllTokens ? walletSectionAllTokens : null
|
||||||
readonly property var _networksModule: !!networksModule ? networksModule : null
|
readonly property var _networksModule: !!networksModule ? networksModule : null
|
||||||
|
|
||||||
|
readonly property double tokenListUpdatedAt: root._allTokensModule.tokenListUpdatedAt
|
||||||
|
|
||||||
/* This contains the different sources for the tokens list
|
/* This contains the different sources for the tokens list
|
||||||
ex. uniswap list, status tokens list */
|
ex. uniswap list, status tokens list */
|
||||||
readonly property var sourcesOfTokensModel: SortFilterProxyModel {
|
readonly property var sourcesOfTokensModel: SortFilterProxyModel {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 812910f087e0451cc702d2590cec3953bb8c3d14
|
Subproject commit 9c131edfaa47ab38fe25048a7116dc4c54336336
|
Loading…
Reference in New Issue