2021-12-08 21:20:43 +00:00
|
|
|
pragma Singleton
|
|
|
|
|
2024-09-04 14:27:24 +00:00
|
|
|
import QtQuick 2.15
|
2023-02-14 09:20:53 +00:00
|
|
|
import utils 1.0
|
2021-12-08 21:20:43 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: root
|
2022-01-26 10:36:37 +00:00
|
|
|
|
2024-09-04 14:27:24 +00:00
|
|
|
readonly property GifStore gifStore: GifStore {}
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
property var profileSectionModuleInst: profileSectionModule
|
|
|
|
property var privacyModule: profileSectionModuleInst.privacyModule
|
2023-02-14 09:20:53 +00:00
|
|
|
property var userProfileInst: !!Global.userProfile? Global.userProfile : null
|
|
|
|
property var walletSectionInst: Global.appIsReady && !!walletSection? walletSection : null
|
|
|
|
property var appSettingsInst: Global.appIsReady && !!appSettings? appSettings : null
|
|
|
|
property var accountSensitiveSettings: Global.appIsReady && !!localAccountSensitiveSettings? localAccountSensitiveSettings : null
|
2022-12-08 15:49:14 +00:00
|
|
|
property real volume: !!appSettingsInst ? appSettingsInst.volume * 0.01 : 0.5
|
2023-03-17 11:39:50 +00:00
|
|
|
property bool isWalletEnabled: Global.appIsReady? mainModule.sectionsModel.getItemEnabledBySectionType(Constants.appSection.wallet) : true
|
2023-03-15 13:35:03 +00:00
|
|
|
|
2022-12-08 15:49:14 +00:00
|
|
|
property bool notificationSoundsEnabled: !!appSettingsInst ? appSettingsInst.notificationSoundsEnabled : true
|
2021-12-08 21:20:43 +00:00
|
|
|
property bool neverAskAboutUnfurlingAgain: !!accountSensitiveSettings ? accountSensitiveSettings.neverAskAboutUnfurlingAgain : false
|
2023-10-18 09:03:32 +00:00
|
|
|
property bool gifUnfurlingEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.gifUnfurlingEnabled : false
|
2021-12-08 21:20:43 +00:00
|
|
|
|
2022-12-29 16:44:51 +00:00
|
|
|
property CurrenciesStore currencyStore: CurrenciesStore {}
|
2023-06-29 17:35:18 +00:00
|
|
|
property string currentCurrency: Global.appIsReady? walletSectionInst.currentCurrency : ""
|
|
|
|
|
|
|
|
readonly property var transactionActivityStatus: Global.appIsReady ? walletSectionInst.activityController.status : null
|
|
|
|
|
|
|
|
property var historyTransactions: Global.appIsReady? walletSectionInst.activityController.model : null
|
|
|
|
readonly property bool loadingHistoryTransactions: Global.appIsReady && walletSectionInst.activityController.status.loadingData
|
|
|
|
readonly property bool newDataAvailable: Global.appIsReady && walletSectionInst.activityController.status.newDataAvailable
|
|
|
|
property bool isNonArchivalNode: Global.appIsReady && walletSectionInst.isNonArchivalNode
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property TokenMarketValuesStore marketValueStore: TokenMarketValuesStore{}
|
2022-09-27 08:30:18 +00:00
|
|
|
|
2024-02-08 12:49:12 +00:00
|
|
|
function resetActivityData() {
|
|
|
|
walletSectionInst.activityController.resetActivityData()
|
2023-07-04 22:29:34 +00:00
|
|
|
}
|
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
property var flatNetworks: networksModule.flatNetworks
|
2022-03-25 08:46:47 +00:00
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
function setNeverAskAboutUnfurlingAgain(value) {
|
|
|
|
localAccountSensitiveSettings.neverAskAboutUnfurlingAgain = value;
|
|
|
|
}
|
|
|
|
|
2023-10-18 09:03:32 +00:00
|
|
|
function setGifUnfurlingEnabled(value) {
|
|
|
|
localAccountSensitiveSettings.gifUnfurlingEnabled = value
|
2021-12-08 21:20:43 +00:00
|
|
|
}
|
|
|
|
|
2022-07-20 12:34:44 +00:00
|
|
|
function getPasswordStrengthScore(password) {
|
|
|
|
return root.privacyModule.getPasswordStrengthScore(password);
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
2022-03-25 08:46:47 +00:00
|
|
|
|
2023-06-15 13:09:35 +00:00
|
|
|
function fetchMoreTransactions() {
|
|
|
|
if (RootStore.historyTransactions.count === 0
|
|
|
|
|| !RootStore.historyTransactions.hasMore
|
2023-06-30 13:50:06 +00:00
|
|
|
|| loadingHistoryTransactions)
|
2023-06-15 13:09:35 +00:00
|
|
|
return
|
2023-06-29 17:35:18 +00:00
|
|
|
walletSectionInst.activityController.loadMoreItems()
|
2022-03-25 08:46:47 +00:00
|
|
|
}
|
|
|
|
|
2024-02-08 12:49:12 +00:00
|
|
|
function updateTransactionFilterIfDirty() {
|
2023-07-21 10:55:36 +00:00
|
|
|
if (transactionActivityStatus.isFilterDirty)
|
2023-06-29 17:35:18 +00:00
|
|
|
walletSectionInst.activityController.updateFilter()
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
|
|
|
|
2023-01-08 22:23:51 +00:00
|
|
|
function getCurrencyAmount(amount, symbol) {
|
|
|
|
return currencyStore.getCurrencyAmount(amount, symbol)
|
|
|
|
}
|
|
|
|
|
2024-02-05 16:44:49 +00:00
|
|
|
function getFiatValue(balance, cryptoSymbol) {
|
|
|
|
return currencyStore.getFiatValue(balance, cryptoSymbol)
|
2023-01-08 22:23:51 +00:00
|
|
|
}
|
|
|
|
|
2024-02-05 16:44:49 +00:00
|
|
|
function getCryptoValue(balance, cryptoSymbol) {
|
|
|
|
return currencyStore.getCryptoValue(balance, cryptoSymbol)
|
2023-01-08 22:23:51 +00:00
|
|
|
}
|
|
|
|
|
2022-09-05 09:15:47 +00:00
|
|
|
function getGasEthValue(gweiValue, gasLimit) {
|
2023-01-08 22:23:51 +00:00
|
|
|
return currencyStore.getGasEthValue(gweiValue, gasLimit)
|
|
|
|
}
|
|
|
|
|
2023-08-30 12:10:59 +00:00
|
|
|
function getFeeEthValue(feeCurrency) {
|
2023-09-11 10:08:21 +00:00
|
|
|
if (!feeCurrency || feeCurrency.symbol !== "Gwei")
|
2023-09-22 10:03:15 +00:00
|
|
|
return 0
|
2023-08-30 12:10:59 +00:00
|
|
|
return currencyStore.getGasEthValue(feeCurrency.amount / Math.pow(10, feeCurrency.displayDecimals), 1)
|
|
|
|
}
|
|
|
|
|
2023-02-17 12:56:31 +00:00
|
|
|
function formatCurrencyAmount(amount, symbol, options = null, locale = null) {
|
|
|
|
return currencyStore.formatCurrencyAmount(amount, symbol, options, locale)
|
2022-09-05 09:15:47 +00:00
|
|
|
}
|
2022-09-27 08:30:18 +00:00
|
|
|
|
|
|
|
function getHistoricalDataForToken(symbol, currency) {
|
2023-02-14 09:20:53 +00:00
|
|
|
if (Global.appIsReady)
|
|
|
|
walletSectionAllTokens.getHistoricalDataForToken(symbol,currency)
|
2022-09-27 08:30:18 +00:00
|
|
|
}
|
2022-10-28 17:17:16 +00:00
|
|
|
|
2023-08-02 04:36:54 +00:00
|
|
|
function fetchDecodedTxData(txHash, input) {
|
|
|
|
walletSectionInst.fetchDecodedTxData(txHash, input)
|
|
|
|
}
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
function fetchTxDetails(txID) {
|
|
|
|
walletSectionInst.activityController.fetchTxDetails(txID)
|
|
|
|
walletSectionInst.activityDetailsController.fetchExtraTxDetails()
|
2023-08-30 12:10:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function getTxDetails() {
|
2024-02-29 14:53:08 +00:00
|
|
|
return walletSectionInst.activityDetailsController.activityDetails
|
2023-08-30 12:10:59 +00:00
|
|
|
}
|
|
|
|
|
2023-02-14 09:20:53 +00:00
|
|
|
property bool marketHistoryIsLoading: Global.appIsReady? walletSectionAllTokens.marketHistoryIsLoading : false
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2024-03-28 11:54:39 +00:00
|
|
|
function fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum) {
|
2023-02-14 09:20:53 +00:00
|
|
|
if (Global.appIsReady)
|
2024-03-28 11:54:39 +00:00
|
|
|
walletSectionAllTokens.fetchHistoricalBalanceForTokenAsJson(address, tokenSymbol, currencySymbol, timeIntervalEnum)
|
2022-10-28 17:17:16 +00:00
|
|
|
}
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2023-02-14 09:20:53 +00:00
|
|
|
property bool balanceHistoryIsLoading: Global.appIsReady? walletSectionAllTokens.balanceHistoryIsLoading : false
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
}
|