shared/RootStore: remove duplicated methods of CurrenciesStore
This commit is contained in:
parent
0686552bc3
commit
afe1cd59c0
|
@ -86,27 +86,27 @@ Item {
|
||||||
readonly property string fiatValueFormatted: {
|
readonly property string fiatValueFormatted: {
|
||||||
if (!d.isTransactionValid || transactionHeader.isMultiTransaction || !symbol)
|
if (!d.isTransactionValid || transactionHeader.isMultiTransaction || !symbol)
|
||||||
return ""
|
return ""
|
||||||
return root.rootStore.formatCurrencyAmount(transactionHeader.fiatValue, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.fiatValue, root.rootStore.currentCurrency)
|
||||||
}
|
}
|
||||||
readonly property string cryptoValueFormatted: {
|
readonly property string cryptoValueFormatted: {
|
||||||
if (!d.isTransactionValid || transactionHeader.isMultiTransaction)
|
if (!d.isTransactionValid || transactionHeader.isMultiTransaction)
|
||||||
return ""
|
return ""
|
||||||
const formatted = root.rootStore.formatCurrencyAmount(transaction.amount, transaction.symbol)
|
const formatted = root.rootStore.currencyStore.formatCurrencyAmount(transaction.amount, transaction.symbol)
|
||||||
return symbol || (!d.isDetailsValid || !d.details.contract) ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenAddress, 4))
|
return symbol || (!d.isDetailsValid || !d.details.contract) ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenAddress, 4))
|
||||||
}
|
}
|
||||||
readonly property string outFiatValueFormatted: {
|
readonly property string outFiatValueFormatted: {
|
||||||
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction || !outSymbol)
|
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction || !outSymbol)
|
||||||
return ""
|
return ""
|
||||||
return root.rootStore.formatCurrencyAmount(transactionHeader.outFiatValue, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.outFiatValue, root.rootStore.currentCurrency)
|
||||||
}
|
}
|
||||||
readonly property string outCryptoValueFormatted: {
|
readonly property string outCryptoValueFormatted: {
|
||||||
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction)
|
if (!d.isTransactionValid || !transactionHeader.isMultiTransaction)
|
||||||
return ""
|
return ""
|
||||||
const formatted = root.rootStore.formatCurrencyAmount(transaction.outAmount, transaction.outSymbol)
|
const formatted = root.rootStore.currencyStore.formatCurrencyAmount(transaction.outAmount, transaction.outSymbol)
|
||||||
return outSymbol || !transaction.tokenOutAddress ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenOutAddress, 4))
|
return outSymbol || !transaction.tokenOutAddress ? formatted : "%1 (%2)".arg(formatted).arg(Utils.compactAddress(transaction.tokenOutAddress, 4))
|
||||||
}
|
}
|
||||||
readonly property real feeEthValue: d.details ? root.rootStore.getFeeEthValue(d.details.totalFees) : 0
|
readonly property real feeEthValue: d.details ? root.rootStore.currencyStore.getFeeEthValue(d.details.totalFees) : 0
|
||||||
readonly property real feeFiatValue: root.rootStore.getFiatValue(d.feeEthValue, Constants.ethToken)
|
readonly property real feeFiatValue: root.rootStore.currencyStore.getFiatValue(d.feeEthValue, Constants.ethToken)
|
||||||
readonly property int transactionType: d.isTransactionValid ? WalletStores.RootStore.transactionType(transaction) : Constants.TransactionType.Send
|
readonly property int transactionType: d.isTransactionValid ? WalletStores.RootStore.transactionType(transaction) : Constants.TransactionType.Send
|
||||||
readonly property bool isBridge: d.transactionType === Constants.TransactionType.Bridge
|
readonly property bool isBridge: d.transactionType === Constants.TransactionType.Bridge
|
||||||
|
|
||||||
|
@ -649,20 +649,20 @@ Item {
|
||||||
return ""
|
return ""
|
||||||
const type = d.transactionType
|
const type = d.transactionType
|
||||||
if (type === Constants.TransactionType.Swap) {
|
if (type === Constants.TransactionType.Swap) {
|
||||||
return root.rootStore.formatCurrencyAmount(transactionHeader.inCryptoValue, d.inSymbol)
|
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.inCryptoValue, d.inSymbol)
|
||||||
} else if (type === Constants.TransactionType.Bridge) {
|
} else if (type === Constants.TransactionType.Bridge) {
|
||||||
// Reduce crypto value by fee value
|
// Reduce crypto value by fee value
|
||||||
const valueInCrypto = root.rootStore.getCryptoValue(transactionHeader.outFiatValue - d.feeFiatValue, d.inSymbol)
|
const valueInCrypto = root.rootStore.currencyStore.getCryptoValue(transactionHeader.outFiatValue - d.feeFiatValue, d.inSymbol)
|
||||||
return root.rootStore.formatCurrencyAmount(valueInCrypto, d.inSymbol)
|
return root.rootStore.currencyStore.formatCurrencyAmount(valueInCrypto, d.inSymbol)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
tertiaryTitle: {
|
tertiaryTitle: {
|
||||||
const type = d.transactionType
|
const type = d.transactionType
|
||||||
if (type === Constants.TransactionType.Swap) {
|
if (type === Constants.TransactionType.Swap) {
|
||||||
return root.rootStore.formatCurrencyAmount(transactionHeader.inFiatValue, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.inFiatValue, root.rootStore.currentCurrency)
|
||||||
} else if (type === Constants.TransactionType.Bridge) {
|
} else if (type === Constants.TransactionType.Bridge) {
|
||||||
return root.rootStore.formatCurrencyAmount(transactionHeader.outFiatValue - d.feeFiatValue, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(transactionHeader.outFiatValue - d.feeFiatValue, root.rootStore.currentCurrency)
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -676,8 +676,8 @@ Item {
|
||||||
if (!d.isTransactionValid || transactionHeader.isNFT || !d.isDetailsValid)
|
if (!d.isTransactionValid || transactionHeader.isNFT || !d.isDetailsValid)
|
||||||
return ""
|
return ""
|
||||||
if (!d.symbol) {
|
if (!d.symbol) {
|
||||||
const maxFeeEth = root.rootStore.getFeeEthValue(d.details.maxTotalFees)
|
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
|
||||||
return root.rootStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
|
return root.rootStore.currencyStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(d.transactionType) {
|
switch(d.transactionType) {
|
||||||
|
@ -694,12 +694,12 @@ Item {
|
||||||
return ""
|
return ""
|
||||||
let fiatValue
|
let fiatValue
|
||||||
if (!d.symbol) {
|
if (!d.symbol) {
|
||||||
const maxFeeEth = root.rootStore.getFeeEthValue(d.details.maxTotalFees)
|
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
|
||||||
fiatValue = root.rootStore.getFiatValue(maxFeeEth, Constants.ethToken)
|
fiatValue = root.rootStore.currencyStore.getFiatValue(maxFeeEth, Constants.ethToken)
|
||||||
} else {
|
} else {
|
||||||
fiatValue = d.feeFiatValue
|
fiatValue = d.feeFiatValue
|
||||||
}
|
}
|
||||||
return root.rootStore.formatCurrencyAmount(fiatValue, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(fiatValue, root.rootStore.currentCurrency)
|
||||||
}
|
}
|
||||||
visible: !!subTitle
|
visible: !!subTitle
|
||||||
}
|
}
|
||||||
|
@ -723,30 +723,30 @@ Item {
|
||||||
if (fieldIsHidden)
|
if (fieldIsHidden)
|
||||||
return ""
|
return ""
|
||||||
if (showMaxFee) {
|
if (showMaxFee) {
|
||||||
const maxFeeEth = root.rootStore.getFeeEthValue(d.details.maxTotalFees)
|
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
|
||||||
return root.rootStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
|
return root.rootStore.currencyStore.formatCurrencyAmount(maxFeeEth, Constants.ethToken)
|
||||||
} else if (showFee) {
|
} else if (showFee) {
|
||||||
return root.rootStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken)
|
return root.rootStore.currencyStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken)
|
||||||
} else if (showValue) {
|
} else if (showValue) {
|
||||||
return d.cryptoValueFormatted
|
return d.cryptoValueFormatted
|
||||||
}
|
}
|
||||||
const cryptoValue = transactionHeader.isMultiTransaction ? d.outCryptoValueFormatted : d.cryptoValueFormatted
|
const cryptoValue = transactionHeader.isMultiTransaction ? d.outCryptoValueFormatted : d.cryptoValueFormatted
|
||||||
return "%1 + %2".arg(cryptoValue).arg(root.rootStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken))
|
return "%1 + %2".arg(cryptoValue).arg(root.rootStore.currencyStore.formatCurrencyAmount(d.feeEthValue, Constants.ethToken))
|
||||||
}
|
}
|
||||||
tertiaryTitle: {
|
tertiaryTitle: {
|
||||||
if (fieldIsHidden)
|
if (fieldIsHidden)
|
||||||
return ""
|
return ""
|
||||||
if (showMaxFee) {
|
if (showMaxFee) {
|
||||||
const maxFeeEth = root.rootStore.getFeeEthValue(d.details.maxTotalFees)
|
const maxFeeEth = root.rootStore.currencyStore.getFeeEthValue(d.details.maxTotalFees)
|
||||||
const maxFeeFiat = root.rootStore.getFiatValue(d.feeEthValue, Constants.ethToken)
|
const maxFeeFiat = root.rootStore.currencyStore.getFiatValue(d.feeEthValue, Constants.ethToken)
|
||||||
return root.rootStore.formatCurrencyAmount(maxFeeFiat, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(maxFeeFiat, root.rootStore.currentCurrency)
|
||||||
} else if (showFee) {
|
} else if (showFee) {
|
||||||
return root.rootStore.formatCurrencyAmount(d.feeFiatValue, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(d.feeFiatValue, root.rootStore.currentCurrency)
|
||||||
} else if (showValue) {
|
} else if (showValue) {
|
||||||
return d.fiatValueFormatted
|
return d.fiatValueFormatted
|
||||||
}
|
}
|
||||||
const fiatValue = transactionHeader.isMultiTransaction ? transactionHeader.outFiatValue : transactionHeader.fiatValue
|
const fiatValue = transactionHeader.isMultiTransaction ? transactionHeader.outFiatValue : transactionHeader.fiatValue
|
||||||
return root.rootStore.formatCurrencyAmount(fiatValue + d.feeFiatValue, root.rootStore.currentCurrency)
|
return root.rootStore.currencyStore.formatCurrencyAmount(fiatValue + d.feeFiatValue, root.rootStore.currentCurrency)
|
||||||
}
|
}
|
||||||
visible: !!subTitle
|
visible: !!subTitle
|
||||||
highlighted: true
|
highlighted: true
|
||||||
|
|
|
@ -58,11 +58,11 @@ StatusListItem {
|
||||||
readonly property bool isMultiTransaction: isModelDataValid && modelData.isMultiTransaction
|
readonly property bool isMultiTransaction: isModelDataValid && modelData.isMultiTransaction
|
||||||
readonly property string currentCurrency: rootStore.currentCurrency
|
readonly property string currentCurrency: rootStore.currentCurrency
|
||||||
readonly property double cryptoValue: isModelDataValid ? modelData.amount : 0.0
|
readonly property double cryptoValue: isModelDataValid ? modelData.amount : 0.0
|
||||||
readonly property double fiatValue: isModelDataValid && !isMultiTransaction ? rootStore.getFiatValue(cryptoValue, modelData.symbol) : 0.0
|
readonly property double fiatValue: isModelDataValid && !isMultiTransaction ? rootStore.currencyStore.getFiatValue(cryptoValue, modelData.symbol) : 0.0
|
||||||
readonly property double inCryptoValue: isModelDataValid ? modelData.inAmount : 0.0
|
readonly property double inCryptoValue: isModelDataValid ? modelData.inAmount : 0.0
|
||||||
readonly property double inFiatValue: isModelDataValid && isMultiTransaction ? rootStore.getFiatValue(inCryptoValue, modelData.inSymbol): 0.0
|
readonly property double inFiatValue: isModelDataValid && isMultiTransaction ? rootStore.currencyStore.getFiatValue(inCryptoValue, modelData.inSymbol): 0.0
|
||||||
readonly property double outCryptoValue: isModelDataValid ? modelData.outAmount : 0.0
|
readonly property double outCryptoValue: isModelDataValid ? modelData.outAmount : 0.0
|
||||||
readonly property double outFiatValue: isModelDataValid && isMultiTransaction ? rootStore.getFiatValue(outCryptoValue, modelData.outSymbol): 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 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 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 networkNameIn: isMultiTransaction ? SQUtils.ModelUtils.getByKey(rootStore.flatNetworks, "chainId", modelData.chainIdIn, "chainName") : ""
|
||||||
|
@ -105,26 +105,26 @@ StatusListItem {
|
||||||
value += (modelData.nftName ? modelData.nftName : "#" + modelData.tokenID)
|
value += (modelData.nftName ? modelData.nftName : "#" + modelData.tokenID)
|
||||||
return value
|
return value
|
||||||
} else if (!modelData.symbol && !!modelData.tokenAddress) {
|
} else if (!modelData.symbol && !!modelData.tokenAddress) {
|
||||||
return "%1 (%2)".arg(root.rootStore.formatCurrencyAmount(cryptoValue, "")).arg(Utils.compactAddress(modelData.tokenAddress, 4))
|
return "%1 (%2)".arg(root.rootStore.currencyStore.formatCurrencyAmount(cryptoValue, "")).arg(Utils.compactAddress(modelData.tokenAddress, 4))
|
||||||
}
|
}
|
||||||
return root.rootStore.formatCurrencyAmount(cryptoValue, modelData.symbol)
|
return root.rootStore.currencyStore.formatCurrencyAmount(cryptoValue, modelData.symbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property string inTransactionValue: {
|
readonly property string inTransactionValue: {
|
||||||
if (!isModelDataValid || !isMultiTransaction) {
|
if (!isModelDataValid || !isMultiTransaction) {
|
||||||
return qsTr("N/A")
|
return qsTr("N/A")
|
||||||
} else if (!modelData.inSymbol && !!modelData.tokenInAddress) {
|
} else if (!modelData.inSymbol && !!modelData.tokenInAddress) {
|
||||||
return "%1 (%2)".arg(root.rootStore.formatCurrencyAmount(inCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenInAddress, 4))
|
return "%1 (%2)".arg(root.rootStore.currencyStore.formatCurrencyAmount(inCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenInAddress, 4))
|
||||||
}
|
}
|
||||||
return rootStore.formatCurrencyAmount(inCryptoValue, modelData.inSymbol)
|
return rootStore.currencyStore.formatCurrencyAmount(inCryptoValue, modelData.inSymbol)
|
||||||
}
|
}
|
||||||
readonly property string outTransactionValue: {
|
readonly property string outTransactionValue: {
|
||||||
if (!isModelDataValid || !isMultiTransaction) {
|
if (!isModelDataValid || !isMultiTransaction) {
|
||||||
return qsTr("N/A")
|
return qsTr("N/A")
|
||||||
} else if (!modelData.outSymbol && !!modelData.tokenOutAddress) {
|
} else if (!modelData.outSymbol && !!modelData.tokenOutAddress) {
|
||||||
return "%1 (%2)".arg(root.rootStore.formatCurrencyAmount(outCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenOutAddress, 4))
|
return "%1 (%2)".arg(root.rootStore.currencyStore.formatCurrencyAmount(outCryptoValue, "")).arg(Utils.compactAddress(modelData.tokenOutAddress, 4))
|
||||||
}
|
}
|
||||||
return rootStore.formatCurrencyAmount(outCryptoValue, modelData.outSymbol)
|
return rootStore.currencyStore.formatCurrencyAmount(outCryptoValue, modelData.outSymbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property string tokenImage: {
|
readonly property string tokenImage: {
|
||||||
|
@ -235,7 +235,7 @@ StatusListItem {
|
||||||
const endl = "\n"
|
const endl = "\n"
|
||||||
const endl2 = endl + endl
|
const endl2 = endl + endl
|
||||||
const type = d.txType
|
const type = d.txType
|
||||||
const feeEthValue = rootStore.getGasEthValue(detailsObj.totalFees.amount, 1)
|
const feeEthValue = rootStore.currencyStore.getGasEthValue(detailsObj.totalFees.amount, 1)
|
||||||
|
|
||||||
// TITLE
|
// TITLE
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -465,8 +465,8 @@ StatusListItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VALUES
|
// VALUES
|
||||||
const fiatTransactionValue = rootStore.formatCurrencyAmount(isMultiTransaction ? root.outFiatValue : root.fiatValue, root.currentCurrency)
|
const fiatTransactionValue = rootStore.currencyStore.formatCurrencyAmount(isMultiTransaction ? root.outFiatValue : root.fiatValue, root.currentCurrency)
|
||||||
const feeFiatValue = rootStore.getFiatValue(feeEthValue, Constants.ethToken)
|
const feeFiatValue = rootStore.currencyStore.getFiatValue(feeEthValue, Constants.ethToken)
|
||||||
let valuesString = ""
|
let valuesString = ""
|
||||||
if (!root.isNFT) {
|
if (!root.isNFT) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
@ -481,14 +481,14 @@ StatusListItem {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (type === Constants.TransactionType.Swap) {
|
if (type === Constants.TransactionType.Swap) {
|
||||||
const crypto = rootStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
|
const crypto = rootStore.currencyStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
|
||||||
const fiat = rootStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
|
const fiat = rootStore.currencyStore.formatCurrencyAmount(root.inCryptoValue, modelData.inSymbol)
|
||||||
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
|
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
|
||||||
} else if (type === Constants.TransactionType.Bridge) {
|
} else if (type === Constants.TransactionType.Bridge) {
|
||||||
// Reduce crypto value by fee value
|
// Reduce crypto value by fee value
|
||||||
const valueInCrypto = rootStore.getCryptoValue(root.fiatValue - feeFiatValue, modelData.inSymbol)
|
const valueInCrypto = rootStore.currencyStore.getCryptoValue(root.fiatValue - feeFiatValue, modelData.inSymbol)
|
||||||
const crypto = rootStore.formatCurrencyAmount(valueInCrypto, modelData.inSymbol)
|
const crypto = rootStore.currencyStore.formatCurrencyAmount(valueInCrypto, modelData.inSymbol)
|
||||||
const fiat = rootStore.formatCurrencyAmount(root.fiatValue - feeFiatValue, root.currentCurrency)
|
const fiat = rootStore.currencyStore.formatCurrencyAmount(root.fiatValue - feeFiatValue, root.currentCurrency)
|
||||||
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
|
valuesString += qsTr("Amount received %1 (%2)").arg(crypto).arg(fiat) + endl2
|
||||||
}
|
}
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
@ -496,7 +496,7 @@ StatusListItem {
|
||||||
case Constants.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
case Constants.TransactionType.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
const feeValue = LocaleUtils.currencyAmountToLocaleString(detailsObj.totalFees)
|
const feeValue = LocaleUtils.currencyAmountToLocaleString(detailsObj.totalFees)
|
||||||
const feeFiat = rootStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
const feeFiat = rootStore.currencyStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
||||||
valuesString += qsTr("Fees %1 (%2)").arg(feeValue).arg(feeFiat) + endl2
|
valuesString += qsTr("Fees %1 (%2)").arg(feeValue).arg(feeFiat) + endl2
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
@ -506,25 +506,25 @@ StatusListItem {
|
||||||
|
|
||||||
if (!root.isNFT || type !== Constants.TransactionType.Receive) {
|
if (!root.isNFT || type !== Constants.TransactionType.Receive) {
|
||||||
if (type === Constants.TransactionType.Destroy || root.isNFT) {
|
if (type === Constants.TransactionType.Destroy || root.isNFT) {
|
||||||
const feeCrypto = rootStore.formatCurrencyAmount(feeEthValue, "ETH")
|
const feeCrypto = rootStore.currencyStore.formatCurrencyAmount(feeEthValue, "ETH")
|
||||||
const feeFiat = rootStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
const feeFiat = rootStore.currencyStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
||||||
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
|
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
|
||||||
} else if (type === Constants.TransactionType.Receive || (type === Constants.TransactionType.Buy && networkLayer === 1)) {
|
} else if (type === Constants.TransactionType.Receive || (type === Constants.TransactionType.Buy && networkLayer === 1)) {
|
||||||
valuesString += qsTr("Total %1 (%2)").arg(root.transactionValue).arg(fiatTransactionValue) + endl2
|
valuesString += qsTr("Total %1 (%2)").arg(root.transactionValue).arg(fiatTransactionValue) + endl2
|
||||||
} else if (type === Constants.TransactionType.ContractDeployment) {
|
} else if (type === Constants.TransactionType.ContractDeployment) {
|
||||||
const isPending = root.transactionStatus === Constants.TransactionStatus.Pending
|
const isPending = root.transactionStatus === Constants.TransactionStatus.Pending
|
||||||
if (isPending) {
|
if (isPending) {
|
||||||
const maxFeeEthValue = rootStore.getFeeEthValue(detailsObj.maxTotalFees.amount)
|
const maxFeeEthValue = rootStore.currencyStore.getFeeEthValue(detailsObj.maxTotalFees.amount)
|
||||||
const maxFeeCrypto = rootStore.formatCurrencyAmount(maxFeeEthValue, "ETH")
|
const maxFeeCrypto = rootStore.currencyStore.formatCurrencyAmount(maxFeeEthValue, "ETH")
|
||||||
const maxFeeFiat = rootStore.formatCurrencyAmount(maxFeeCrypto, root.currentCurrency)
|
const maxFeeFiat = rootStore.currencyStore.formatCurrencyAmount(maxFeeCrypto, root.currentCurrency)
|
||||||
valuesString += qsTr("Estimated max fee %1 (%2)").arg(maxFeeCrypto).arg(maxFeeFiat) + endl2
|
valuesString += qsTr("Estimated max fee %1 (%2)").arg(maxFeeCrypto).arg(maxFeeFiat) + endl2
|
||||||
} else {
|
} else {
|
||||||
const feeCrypto = rootStore.formatCurrencyAmount(feeEthValue, "ETH")
|
const feeCrypto = rootStore.currencyStore.formatCurrencyAmount(feeEthValue, "ETH")
|
||||||
const feeFiat = rootStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
const feeFiat = rootStore.currencyStore.formatCurrencyAmount(feeFiatValue, root.currentCurrency)
|
||||||
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
|
valuesString += qsTr("Fees %1 (%2)").arg(feeCrypto).arg(feeFiat) + endl2
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const feeEth = rootStore.formatCurrencyAmount(feeEthValue, "ETH")
|
const feeEth = rootStore.currencyStore.formatCurrencyAmount(feeEthValue, "ETH")
|
||||||
const txValue = isMultiTransaction ? root.inTransactionValue : root.transactionValue
|
const txValue = isMultiTransaction ? root.inTransactionValue : root.transactionValue
|
||||||
valuesString += qsTr("Total %1 + %2 (%3)").arg(txValue).arg(feeEth).arg(fiatTransactionValue) + endl2
|
valuesString += qsTr("Total %1 + %2 (%3)").arg(txValue).arg(feeEth).arg(fiatTransactionValue) + endl2
|
||||||
}
|
}
|
||||||
|
@ -841,12 +841,12 @@ StatusListItem {
|
||||||
case Constants.TransactionType.Send:
|
case Constants.TransactionType.Send:
|
||||||
case Constants.TransactionType.Sell:
|
case Constants.TransactionType.Sell:
|
||||||
case Constants.TransactionType.Buy:
|
case Constants.TransactionType.Buy:
|
||||||
return "−" + root.rootStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
return "−" + root.rootStore.currencyStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
||||||
case Constants.TransactionType.Receive:
|
case Constants.TransactionType.Receive:
|
||||||
return "+" + root.rootStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
return "+" + root.rootStore.currencyStore.formatCurrencyAmount(root.fiatValue, root.currentCurrency)
|
||||||
case Constants.TransactionType.Swap:
|
case Constants.TransactionType.Swap:
|
||||||
return "-%1 / +%2".arg(root.rootStore.formatCurrencyAmount(root.outFiatValue, root.currentCurrency))
|
return "-%1 / +%2".arg(root.rootStore.currencyStore.formatCurrencyAmount(root.outFiatValue, root.currentCurrency))
|
||||||
.arg(root.rootStore.formatCurrencyAmount(root.inFiatValue, root.currentCurrency))
|
.arg(root.rootStore.currencyStore.formatCurrencyAmount(root.inFiatValue, root.currentCurrency))
|
||||||
case Constants.TransactionType.Bridge:
|
case Constants.TransactionType.Bridge:
|
||||||
case Constants.TransactionType.Approve:
|
case Constants.TransactionType.Approve:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -67,6 +67,12 @@ QtObject {
|
||||||
return parseFloat(amount)
|
return parseFloat(amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFeeEthValue(feeCurrency) {
|
||||||
|
if (!feeCurrency || feeCurrency.symbol !== "Gwei")
|
||||||
|
return 0
|
||||||
|
return getGasEthValue(feeCurrency.amount / Math.pow(10, feeCurrency.displayDecimals), 1)
|
||||||
|
}
|
||||||
|
|
||||||
function getCurrentCurrencyAmount(amount) {
|
function getCurrentCurrencyAmount(amount) {
|
||||||
return getCurrencyAmount(amount, currentCurrency)
|
return getCurrencyAmount(amount, currentCurrency)
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,32 +64,6 @@ QtObject {
|
||||||
walletSectionInst.activityController.updateFilter()
|
walletSectionInst.activityController.updateFilter()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrencyAmount(amount, symbol) {
|
|
||||||
return currencyStore.getCurrencyAmount(amount, symbol)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFiatValue(balance, cryptoSymbol) {
|
|
||||||
return currencyStore.getFiatValue(balance, cryptoSymbol)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCryptoValue(balance, cryptoSymbol) {
|
|
||||||
return currencyStore.getCryptoValue(balance, cryptoSymbol)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getGasEthValue(gweiValue, gasLimit) {
|
|
||||||
return currencyStore.getGasEthValue(gweiValue, gasLimit)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFeeEthValue(feeCurrency) {
|
|
||||||
if (!feeCurrency || feeCurrency.symbol !== "Gwei")
|
|
||||||
return 0
|
|
||||||
return currencyStore.getGasEthValue(feeCurrency.amount / Math.pow(10, feeCurrency.displayDecimals), 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatCurrencyAmount(amount, symbol, options = null, locale = null) {
|
|
||||||
return currencyStore.formatCurrencyAmount(amount, symbol, options, locale)
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHistoricalDataForToken(symbol, currency) {
|
function getHistoricalDataForToken(symbol, currency) {
|
||||||
if (Global.appIsReady)
|
if (Global.appIsReady)
|
||||||
walletSectionAllTokens.getHistoricalDataForToken(symbol,currency)
|
walletSectionAllTokens.getHistoricalDataForToken(symbol,currency)
|
||||||
|
|
Loading…
Reference in New Issue