TransactionDetailView: RootStore and CurrenciesStore decoupled

This commit is contained in:
Michał Cieślak 2024-09-24 13:51:22 +02:00 committed by Michał
parent afe1cd59c0
commit 47f75c1ae2
8 changed files with 82 additions and 73 deletions

View File

@ -76,7 +76,7 @@ SplitView {
id: delegate
Layout.fillWidth: true
modelData: root.mockupModelData
rootStore: SharedStores.RootStore {
currenciesStore: SharedStores.CurrenciesStore {
readonly property string currentCurrency: "EUR"
function getFiatValue(cryptoValue, symbol) {
@ -86,9 +86,8 @@ SplitView {
function formatCurrencyAmount(cryptoValue, symbol) {
return "%L1 %2".arg(cryptoValue).arg(symbol)
}
property var flatNetworks: NetworksModel.flatNetworks
}
flatNetworks: NetworksModel.flatNetworks
walletRootStore: WalletStores.RootStore
}
}

View File

@ -228,6 +228,7 @@ SplitView {
active: root.globalUtilsReady && root.mainModuleReady
sourceComponent: TransactionDetailView {
rootStore: rootStoreMock
currenciesStore: CurrenciesStore {}
contactsStore: contactsStoreMockup
controller: controllerMockup
overview: overviewMockup

View File

@ -502,6 +502,7 @@ RightTabBaseView {
communitiesStore: root.communitiesStore
sendModal: root.sendModal
rootStore: SharedStores.RootStore
currenciesStore: SharedStores.RootStore.currencyStore
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
visible: (stack.currentIndex === 3)

View File

@ -32,6 +32,7 @@ Item {
property var overview: WalletStores.RootStore.overview
property RootStore rootStore
property CurrenciesStore currenciesStore
property ProfileStores.ContactsStore contactsStore
property CommunitiesStore communitiesStore
property NetworkConnectionStore networkConnectionStore
@ -86,27 +87,27 @@ Item {
readonly property string fiatValueFormatted: {
if (!d.isTransactionValid || transactionHeader.isMultiTransaction || !symbol)
return ""
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.fiatValue, root.rootStore.currentCurrency)
return root.currenciesStore.formatCurrencyAmount(transactionHeader.fiatValue, root.currenciesStore.currentCurrency)
}
readonly property string cryptoValueFormatted: {
if (!d.isTransactionValid || transactionHeader.isMultiTransaction)
return ""
const formatted = root.rootStore.currencyStore.formatCurrencyAmount(transaction.amount, transaction.symbol)
const formatted = root.currenciesStore.formatCurrencyAmount(transaction.amount, transaction.symbol)
return symbol || (!d.isDetailsValid || !d.details.contract) ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenAddress, 4))
}
readonly property string outFiatValueFormatted: {
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction || !outSymbol)
return ""
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.outFiatValue, root.rootStore.currentCurrency)
return root.currenciesStore.formatCurrencyAmount(transactionHeader.outFiatValue, root.currenciesStore.currentCurrency)
}
readonly property string outCryptoValueFormatted: {
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction)
return ""
const formatted = root.rootStore.currencyStore.formatCurrencyAmount(transaction.outAmount, transaction.outSymbol)
const formatted = root.currenciesStore.formatCurrencyAmount(transaction.outAmount, transaction.outSymbol)
return outSymbol || !transaction.tokenOutAddress ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenOutAddress, 4))
}
readonly property real feeEthValue: d.details ? root.rootStore.currencyStore.getFeeEthValue(d.details.totalFees) : 0
readonly property real feeFiatValue: root.rootStore.currencyStore.getFiatValue(d.feeEthValue, Constants.ethToken)
readonly property real feeEthValue: d.details ? root.currenciesStore.getFeeEthValue(d.details.totalFees) : 0
readonly property real feeFiatValue: root.currenciesStore.getFiatValue(d.feeEthValue, Constants.ethToken)
readonly property int transactionType: d.isTransactionValid ? WalletStores.RootStore.transactionType(transaction) : Constants.TransactionType.Send
readonly property bool isBridge: d.transactionType === Constants.TransactionType.Bridge
@ -177,7 +178,8 @@ Item {
showAllAccounts: root.showAllAccounts
modelData: transaction
timeStampText: d.isTransactionValid ? qsTr("Signed at %1").arg(LocaleUtils.formatDateTime(transaction.timestamp * 1000, Locale.LongFormat)): ""
rootStore: root.rootStore
flatNetworks: root.rootStore.flatNetworks
currenciesStore: root.currenciesStore
walletRootStore: WalletStores.RootStore
community: isModelDataValid && communityId && communitiesStore ? communitiesStore.getCommunityDetailsAsJson(communityId) : null
@ -649,20 +651,20 @@ Item {
return ""
const type = d.transactionType
if (type === Constants.TransactionType.Swap) {
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.inCryptoValue, d.inSymbol)
return root.currenciesStore.formatCurrencyAmount(transactionHeader.inCryptoValue, d.inSymbol)
} else if (type === Constants.TransactionType.Bridge) {
// Reduce crypto value by fee value
const valueInCrypto = root.rootStore.currencyStore.getCryptoValue(transactionHeader.outFiatValue - d.feeFiatValue, d.inSymbol)
return root.rootStore.currencyStore.formatCurrencyAmount(valueInCrypto, d.inSymbol)
const valueInCrypto = root.currenciesStore.getCryptoValue(transactionHeader.outFiatValue - d.feeFiatValue, d.inSymbol)
return root.currenciesStore.formatCurrencyAmount(valueInCrypto, d.inSymbol)
}
return ""
}
tertiaryTitle: {
const type = d.transactionType
if (type === Constants.TransactionType.Swap) {
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.inFiatValue, root.rootStore.currentCurrency)
return root.currenciesStore.formatCurrencyAmount(transactionHeader.inFiatValue, root.currenciesStore.currentCurrency)
} else if (type === Constants.TransactionType.Bridge) {
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.outFiatValue - d.feeFiatValue, root.rootStore.currentCurrency)
return root.currenciesStore.formatCurrencyAmount(transactionHeader.outFiatValue - d.feeFiatValue, root.currenciesStore.currentCurrency)
}
return ""
}
@ -676,8 +678,8 @@ Item {
if (!d.isTransactionValid || transactionHeader.isNFT || !d.isDetailsValid)
return ""
if (!d.symbol) {
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
return root.rootStore.currencyStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
return root.currenciesStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
}
switch(d.transactionType) {
@ -694,12 +696,12 @@ Item {
return ""
let fiatValue
if (!d.symbol) {
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
fiatValue = root.rootStore.currencyStore.getFiatValue(maxFeeEth, Constants.ethToken)
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
fiatValue = root.currenciesStore.getFiatValue(maxFeeEth, Constants.ethToken)
} else {
fiatValue = d.feeFiatValue
}
return root.rootStore.currencyStore.formatCurrencyAmount(fiatValue, root.rootStore.currentCurrency)
return root.currenciesStore.formatCurrencyAmount(fiatValue, root.currenciesStore.currentCurrency)
}
visible: !!subTitle
}
@ -723,30 +725,30 @@ Item {
if (fieldIsHidden)
return ""
if (showMaxFee) {
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
return root.rootStore.currencyStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
return root.currenciesStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
} else if (showFee) {
return root.rootStore.currencyStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken)
return root.currenciesStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken)
} else if (showValue) {
return d.cryptoValueFormatted
}
const cryptoValue = transactionHeader.isMultiTransaction ? d.outCryptoValueFormatted : d.cryptoValueFormatted
return "%1 + %2".arg(cryptoValue).arg(root.rootStore.currencyStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken))
return "%1 + %2".arg(cryptoValue).arg(root.currenciesStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken))
}
tertiaryTitle: {
if (fieldIsHidden)
return ""
if (showMaxFee) {
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
const maxFeeFiat = root.rootStore.currencyStore.getFiatValue(d.feeEthValue, Constants.ethToken)
return root.rootStore.currencyStore.formatCurrencyAmount(maxFeeFiat, root.rootStore.currentCurrency)
const maxFeeEth = root.currenciesStore.getFeeEthValue(d.details.maxTotalFees)
const maxFeeFiat = root.currenciesStore.getFiatValue(d.feeEthValue, Constants.ethToken)
return root.currenciesStore.formatCurrencyAmount(maxFeeFiat, root.currenciesStore.currentCurrency)
} else if (showFee) {
return root.rootStore.currencyStore.formatCurrencyAmount(d.feeFiatValue, root.rootStore.currentCurrency)
return root.currenciesStore.formatCurrencyAmount(d.feeFiatValue, root.currenciesStore.currentCurrency)
} else if (showValue) {
return d.fiatValueFormatted
}
const fiatValue = transactionHeader.isMultiTransaction ? transactionHeader.outFiatValue : transactionHeader.fiatValue
return root.rootStore.currencyStore.formatCurrencyAmount(fiatValue + d.feeFiatValue, root.rootStore.currentCurrency)
return root.currenciesStore.formatCurrencyAmount(fiatValue + d.feeFiatValue, root.currenciesStore.currentCurrency)
}
visible: !!subTitle
highlighted: true

View File

@ -299,7 +299,8 @@ Item {
width: parent.width
modelData: model.activityEntry
timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000, true) : ""
rootStore: root.rootStore
flatNetworks: root.rootStore.flatNetworks
currenciesStore: root.rootStore.currencyStore
walletRootStore: root.walletRootStore
showAllAccounts: root.walletRootStore.showAllAccounts
displayValues: true

View File

@ -29,7 +29,8 @@ import shared.stores 1.0 as SharedStores
id: delegate
width: ListView.view.width
modelData: model.activityEntry
rootStore: RootStore
flatNetworks: root.flatNetworks
currenciesStore: root.currencyStore
walletRootStore: WalletStores.RootStore
loading: isModelDataValid
}
@ -48,7 +49,9 @@ StatusListItem {
property bool showAllAccounts: false
property bool displayValues: true
required property SharedStores.RootStore rootStore
required property var flatNetworks
required property SharedStores.CurrenciesStore currenciesStore
required property WalletStores.RootStore walletRootStore
readonly property bool isModelDataValid: modelData !== undefined && !!modelData
@ -56,17 +59,17 @@ StatusListItem {
readonly property string txID: isModelDataValid ? modelData.id : "INVALID"
readonly property int transactionStatus: isModelDataValid ? modelData.status : Constants.TransactionStatus.Pending
readonly property bool isMultiTransaction: isModelDataValid && modelData.isMultiTransaction
readonly property string currentCurrency: rootStore.currentCurrency
readonly property string currentCurrency: currenciesStore.currentCurrency
readonly property double cryptoValue: isModelDataValid ? modelData.amount : 0.0
readonly property double fiatValue: isModelDataValid && !isMultiTransaction ? rootStore.currencyStore.getFiatValue(cryptoValue, modelData.symbol) : 0.0
readonly property double fiatValue: isModelDataValid && !isMultiTransaction ? currenciesStore.getFiatValue(cryptoValue, modelData.symbol) : 0.0
readonly property double inCryptoValue: isModelDataValid ? modelData.inAmount : 0.0
readonly property double inFiatValue: isModelDataValid && isMultiTransaction ? rootStore.currencyStore.getFiatValue(inCryptoValue, modelData.inSymbol): 0.0
readonly property double inFiatValue: isModelDataValid && isMultiTransaction ? currenciesStore.getFiatValue(inCryptoValue, modelData.inSymbol): 0.0
readonly property double outCryptoValue: isModelDataValid ? modelData.outAmount : 0.0
readonly property double outFiatValue: isModelDataValid && isMultiTransaction ? rootStore.currencyStore.getFiatValue(outCryptoValue, modelData.outSymbol): 0.0
readonly property string networkColor: isModelDataValid ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainId, "chainColor") : ""
readonly property string networkName: isModelDataValid ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainId, "chainName") : ""
readonly property string networkNameIn: isMultiTransaction ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainIdIn, "chainName") : ""
readonly property string networkNameOut: isMultiTransaction ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainIdOut, "chainName") : ""
readonly property double outFiatValue: isModelDataValid && isMultiTransaction ? currenciesStore.getFiatValue(outCryptoValue, modelData.outSymbol): 0.0
readonly property string networkColor: isModelDataValid ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainId, "chainColor") : ""
readonly property string networkName: isModelDataValid ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainId, "chainName") : ""
readonly property string networkNameIn: isMultiTransaction ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdIn, "chainName") : ""
readonly property string networkNameOut: isMultiTransaction ? SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdOut, "chainName") : ""
readonly property string addressNameTo: isModelDataValid ? walletRootStore.getNameForAddress(modelData.recipient) : ""
readonly property string addressNameFrom: isModelDataValid ? walletRootStore.getNameForAddress(modelData.sender) : ""
readonly property bool isNFT: isModelDataValid && modelData.isNFT
@ -105,26 +108,26 @@ StatusListItem {
value += (modelData.nftName ? modelData.nftName : "#" + modelData.tokenID)
return value
} else if (!modelData.symbol && !!modelData.tokenAddress) {
return "%1 (%2)".arg(root.rootStore.currencyStore.formatCurrencyAmount(cryptoValue, "")).arg(Utils.compactAddress(modelData.tokenAddress, 4))
return "%1 (%2)".arg(root.currenciesStore.formatCurrencyAmount(cryptoValue, "")).arg(Utils.compactAddress(modelData.tokenAddress, 4))
}
return root.rootStore.currencyStore.formatCurrencyAmount(cryptoValue, modelData.symbol)
return root.currenciesStore.formatCurrencyAmount(cryptoValue, modelData.symbol)
}
readonly property string inTransactionValue: {
if (!isModelDataValid || !isMultiTransaction) {
return qsTr("N/A")
} else if (!modelData.inSymbol && !!modelData.tokenInAddress) {
return "%1 (%2)".arg(root.rootStore.currencyStore.formatCurrencyAmount(inCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenInAddress, 4))
return "%1 (%2)".arg(root.currenciesStore.formatCurrencyAmount(inCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenInAddress, 4))
}
return rootStore.currencyStore.formatCurrencyAmount(inCryptoValue, modelData.inSymbol)
return currenciesStore.formatCurrencyAmount(inCryptoValue, modelData.inSymbol)
}
readonly property string outTransactionValue: {
if (!isModelDataValid || !isMultiTransaction) {
return qsTr("N/A")
} else if (!modelData.outSymbol && !!modelData.tokenOutAddress) {
return "%1 (%2)".arg(root.rootStore.currencyStore.formatCurrencyAmount(outCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenOutAddress, 4))
return "%1 (%2)".arg(root.currenciesStore.formatCurrencyAmount(outCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenOutAddress, 4))
}
return rootStore.currencyStore.formatCurrencyAmount(outCryptoValue, modelData.outSymbol)
return currenciesStore.formatCurrencyAmount(outCryptoValue, modelData.outSymbol)
}
readonly property string tokenImage: {
@ -235,7 +238,7 @@ StatusListItem {
const endl = "\n"
const endl2 = endl + endl
const type = d.txType
const feeEthValue = rootStore.currencyStore.getGasEthValue(detailsObj.totalFees.amount, 1)
const feeEthValue = currenciesStore.getGasEthValue(detailsObj.totalFees.amount, 1)
// TITLE
switch (type) {
@ -305,7 +308,7 @@ StatusListItem {
}
// PROGRESS
const networkLayer = SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainId, "layer")
const networkLayer = SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainId, "layer")
const isBridge = type === Constants.TransactionType.Bridge
switch(transactionStatus) {
@ -331,7 +334,7 @@ StatusListItem {
details += qsTr("Confirmed on %1").arg(root.networkName) + endl
details += LocaleUtils.formatDateTime(confirmationTimeStamp * 1000, Locale.LongFormat) + endl2
if (isBridge) {
const networkInLayer = SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainIdIn, "layer")
const networkInLayer = SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdIn, "layer")
const confirmationTimeStampIn = WalletUtils.calculateConfirmationTimestamp(networkInLayer, modelData.timestamp)
details += qsTr("Signed on %1").arg(root.networkNameIn) + endl + timestampString + endl2
details += qsTr("Confirmed on %1").arg(root.networkNameIn) + endl
@ -352,7 +355,7 @@ StatusListItem {
details += qsTr("Finalised on %1").arg(root.networkName) + endl
details += LocaleUtils.formatDateTime(finalisationTimeStamp * 1000, Locale.LongFormat) + endl2
if (isBridge) {
const networkInLayer = SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainIdIn, "layer")
const networkInLayer = SQUtils.ModelUtils.getByKey(flatNetworks, "chainId", modelData.chainIdIn, "layer")
const confirmationTimeStampIn = WalletUtils.calculateConfirmationTimestamp(networkInLayer, modelData.timestamp)
const finalisationTimeStampIn = WalletUtils.calculateFinalisationTimestamp(networkInLayer, modelData.timestamp)
const epochIn = Math.abs(walletRootStore.getEstimatedLatestBlockNumber(modelData.chainIdIn) - detailsObj.blockNumberIn)
@ -465,8 +468,8 @@ StatusListItem {
}
// VALUES
const fiatTransactionValue = rootStore.currencyStore.formatCurrencyAmount(isMultiTransaction ? root.outFiatValue : root.fiatValue, root.currentCurrency)
const feeFiatValue = rootStore.currencyStore.getFiatValue(feeEthValue, Constants.ethToken)
const fiatTransactionValue = currenciesStore.formatCurrencyAmount(isMultiTransaction ? root.outFiatValue : root.fiatValue, root.currentCurrency)
const feeFiatValue = currenciesStore.getFiatValue(feeEthValue, Constants.ethToken)
let valuesString = ""
if (!root.isNFT) {
switch(type) {
@ -481,14 +484,14 @@ StatusListItem {
break
}
if (type === Constants.TransactionType.Swap) {
const crypto = rootStore.currencyStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
const fiat = rootStore.currencyStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
const crypto = currenciesStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
const fiat = currenciesStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
} else if (type === Constants.TransactionType.Bridge) {
// Reduce crypto value by fee value
const valueInCrypto = rootStore.currencyStore.getCryptoValue(root.fiatValue - feeFiatValue, modelData.inSymbol)
const crypto = rootStore.currencyStore.formatCurrencyAmount(valueInCrypto, modelData.inSymbol)
const fiat = rootStore.currencyStore.formatCurrencyAmount(root.fiatValue - feeFiatValue, root.currentCurrency)
const valueInCrypto = currenciesStore.getCryptoValue(root.fiatValue - feeFiatValue, modelData.inSymbol)
const crypto = currenciesStore.formatCurrencyAmount(valueInCrypto, modelData.inSymbol)
const fiat = currenciesStore.formatCurrencyAmount(root.fiatValue - feeFiatValue, root.currentCurrency)
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
}
switch(type) {
@ -496,7 +499,7 @@ StatusListItem {
case Constants.TransactionType.Swap:
case Constants.TransactionType.Bridge:
const feeValue = LocaleUtils.currencyAmountToLocaleString(detailsObj.totalFees)
const feeFiat = rootStore.currencyStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
const feeFiat = currenciesStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
valuesString += qsTr("Fees %1 (%2)").arg(feeValue).arg(feeFiat) + endl2
break
default:
@ -506,25 +509,25 @@ StatusListItem {
if (!root.isNFT || type !== Constants.TransactionType.Receive) {
if (type === Constants.TransactionType.Destroy || root.isNFT) {
const feeCrypto = rootStore.currencyStore.formatCurrencyAmount(feeEthValue, "ETH")
const feeFiat = rootStore.currencyStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
const feeCrypto = currenciesStore.formatCurrencyAmount(feeEthValue, "ETH")
const feeFiat = currenciesStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
} else if (type === Constants.TransactionType.Receive || (type === Constants.TransactionType.Buy && networkLayer === 1)) {
valuesString += qsTr("Total %1 (%2)").arg(root.transactionValue).arg(fiatTransactionValue) + endl2
} else if (type === Constants.TransactionType.ContractDeployment) {
const isPending = root.transactionStatus === Constants.TransactionStatus.Pending
if (isPending) {
const maxFeeEthValue = rootStore.currencyStore.getFeeEthValue(detailsObj.maxTotalFees.amount)
const maxFeeCrypto = rootStore.currencyStore.formatCurrencyAmount(maxFeeEthValue, "ETH")
const maxFeeFiat = rootStore.currencyStore.formatCurrencyAmount(maxFeeCrypto, root.currentCurrency)
const maxFeeEthValue = currenciesStore.getFeeEthValue(detailsObj.maxTotalFees.amount)
const maxFeeCrypto = currenciesStore.formatCurrencyAmount(maxFeeEthValue, "ETH")
const maxFeeFiat = currenciesStore.formatCurrencyAmount(maxFeeCrypto, root.currentCurrency)
valuesString += qsTr("Estimated max fee %1 (%2)").arg(maxFeeCrypto).arg(maxFeeFiat) + endl2
} else {
const feeCrypto = rootStore.currencyStore.formatCurrencyAmount(feeEthValue, "ETH")
const feeFiat = rootStore.currencyStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
const feeCrypto = currenciesStore.formatCurrencyAmount(feeEthValue, "ETH")
const feeFiat = currenciesStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
}
} else {
const feeEth = rootStore.currencyStore.formatCurrencyAmount(feeEthValue, "ETH")
const feeEth = currenciesStore.formatCurrencyAmount(feeEthValue, "ETH")
const txValue = isMultiTransaction ? root.inTransactionValue : root.transactionValue
valuesString += qsTr("Total %1 + %2 (%3)").arg(txValue).arg(feeEth).arg(fiatTransactionValue) + endl2
}
@ -841,12 +844,12 @@ StatusListItem {
case Constants.TransactionType.Send:
case Constants.TransactionType.Sell:
case Constants.TransactionType.Buy:
return "" + root.rootStore.currencyStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
return "" + root.currenciesStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
case Constants.TransactionType.Receive:
return "+" + root.rootStore.currencyStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
return "+" + root.currenciesStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
case Constants.TransactionType.Swap:
return "-%1 / +%2".arg(root.rootStore.currencyStore.formatCurrencyAmount(root.outFiatValue, root.currentCurrency))
.arg(root.rootStore.currencyStore.formatCurrencyAmount(root.inFiatValue, root.currentCurrency))
return "-%1 / +%2".arg(root.currenciesStore.formatCurrencyAmount(root.outFiatValue, root.currentCurrency))
.arg(root.currenciesStore.formatCurrencyAmount(root.inFiatValue, root.currentCurrency))
case Constants.TransactionType.Bridge:
case Constants.TransactionType.Approve:
default:

View File

@ -22,7 +22,6 @@ QtObject {
property bool gifUnfurlingEnabled: !!accountSensitiveSettings ? accountSensitiveSettings.gifUnfurlingEnabled : false
property CurrenciesStore currencyStore: CurrenciesStore {}
property string currentCurrency: Global.appIsReady? walletSectionInst.currentCurrency : ""
readonly property var transactionActivityStatus: Global.appIsReady ? walletSectionInst.activityController.status : null

View File

@ -486,7 +486,8 @@ ColumnLayout {
Layout.fillWidth: true
modelData: transactionDelegate.model.activityEntry
timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000, true) : ""
rootStore: RootStore
flatNetworks: RootStore.flatNetworks
currenciesStore: RootStore.currencyStore
walletRootStore: WalletStores.RootStore
showAllAccounts: root.showAllAccounts
displayValues: root.displayValues
@ -549,7 +550,9 @@ ColumnLayout {
}
TransactionDelegate {
Layout.fillWidth: true
rootStore: RootStore
flatNetworks: RootStore.flatNetworks
currenciesStore: RootStore.currencyStore
walletRootStore: WalletStores.RootStore
loading: true
}