shared/RootStore: token related content moved to TokensStore

This commit is contained in:
Michał Cieślak 2024-10-01 17:23:17 +02:00 committed by Michał
parent 502c8df411
commit 26b588cc40
4 changed files with 21 additions and 21 deletions

View File

@ -14,6 +14,9 @@ QtObject {
readonly property double tokenListUpdatedAt: root._allTokensModule.tokenListUpdatedAt
readonly property bool marketHistoryIsLoading: Global.appIsReady ? walletSectionAllTokens.marketHistoryIsLoading : false
readonly property bool balanceHistoryIsLoading: Global.appIsReady ? walletSectionAllTokens.balanceHistoryIsLoading : false
/* This contains the different sources for the tokens list
ex. uniswap list, status tokens list */
readonly property var sourcesOfTokensModel: SortFilterProxyModel {
@ -115,6 +118,14 @@ QtObject {
signal displayAssetsBelowBalanceThresholdChanged()
function getHistoricalDataForToken(symbol, currency) {
root._allTokensModule.getHistoricalDataForToken(symbol, currency)
}
function fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum) {
root._allTokensModule.fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum)
}
function getDisplayAssetsBelowBalanceThresholdCurrency() {
return root._allTokensModule.displayAssetsBelowBalanceThreshold
}

View File

@ -15,6 +15,8 @@ import shared.views 1.0
import shared.controls 1.0
import shared.stores 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStores
import SortFilterProxyModel 0.2
import "../controls"
@ -26,6 +28,7 @@ Item {
id: root
property var token: ({})
property WalletStores.TokensStore tokensStore
property CurrenciesStore currencyStore
property NetworkConnectionStore networkConnectionStore
property var allNetworksModel
@ -187,7 +190,7 @@ Item {
LocaleUtils.getMonthYear(value)
}
chart.type: 'line'
chart.labels: RootStore.marketHistoryIsLoading ? [] : graphDetail.labelsData
chart.labels: root.tokensStore.marketHistoryIsLoading ? [] : graphDetail.labelsData
chart.datasets: {
return [{
xAxisId: 'x-axis-1',
@ -196,7 +199,7 @@ Item {
borderColor: (Theme.palette.name === "dark") ? 'rgba(136, 176, 255, 1)' : 'rgba(67, 96, 223, 1)',
borderWidth: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? 3 : 2,
pointRadius: 0,
data: RootStore.marketHistoryIsLoading ? [] : graphDetail.dataRange,
data: root.tokensStore.marketHistoryIsLoading ? [] : graphDetail.dataRange,
parsing: false,
}]
}
@ -310,7 +313,7 @@ Item {
LoadingGraphView {
anchors.fill: chart
active: RootStore.marketHistoryIsLoading
active: root.tokensStore.marketHistoryIsLoading
}
function updateBalanceStore() {
@ -318,7 +321,7 @@ Item {
let currencySymbol = RootStore.currencyStore.currentCurrency
if(!balanceStore.hasData(root.address, token.symbol, currencySymbol, selectedTimeRangeEnum) || d.forceRefreshBalanceStore) {
RootStore.fetchHistoricalBalanceForTokenAsJson(root.address, token.symbol, currencySymbol, selectedTimeRangeEnum)
root.tokensStore.fetchHistoricalBalanceForTokenAsJson(root.address, token.symbol, currencySymbol, selectedTimeRangeEnum)
}
}

View File

@ -305,8 +305,8 @@ RightTabBaseView {
onAssetClicked: (key) => {
const token = ModelUtils.getByKey(model, "key", key)
SharedStores.RootStore.getHistoricalDataForToken(
token.symbol, RootStore.currencyStore.currentCurrency)
RootStore.tokensStore.getHistoricalDataForToken(
token.symbol, RootStore.currencyStore.currentCurrency)
assetDetailView.token = token
RootStore.setCurrentViewedHolding(
@ -468,6 +468,7 @@ RightTabBaseView {
visible: (stack.currentIndex === 2)
tokensStore: RootStore.tokensStore
allNetworksModel: RootStore.filteredFlatModel
address: RootStore.overview.mixedcaseAddress
currencyStore: RootStore.currencyStore

View File

@ -63,11 +63,6 @@ QtObject {
walletSectionInst.activityController.updateFilter()
}
function getHistoricalDataForToken(symbol, currency) {
if (Global.appIsReady)
walletSectionAllTokens.getHistoricalDataForToken(symbol,currency)
}
function fetchDecodedTxData(txHash, input) {
walletSectionInst.fetchDecodedTxData(txHash, input)
}
@ -80,14 +75,4 @@ QtObject {
function getTxDetails() {
return walletSectionInst.activityDetailsController.activityDetails
}
property bool marketHistoryIsLoading: Global.appIsReady? walletSectionAllTokens.marketHistoryIsLoading : false
function fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum) {
if (Global.appIsReady)
walletSectionAllTokens.fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum)
}
property bool balanceHistoryIsLoading: Global.appIsReady? walletSectionAllTokens.balanceHistoryIsLoading : false
}