Skip to content

Commit b7008d7

Browse files
committed
fix(fees): fixed issue with absent gas fee (#18704)
* Fixed issue with absent gas fee * function reanamed to improve readability * argument renamed accordingly to pr review
1 parent e8083a0 commit b7008d7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

ui/imports/shared/popups/send/controls/GasSelector.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ Item {
6161
}
6262
property double decimalTotalGasAmountL1: {
6363
const l1FeeInGWei = modelData.gasFees.l1GasFee
64-
const l1FeeInEth = Utils.getGasDecimalValue(modelData.fromNetwork, l1FeeInGWei, modelData.gasAmount)
64+
const l1FeeInEth = Utils.calculateGasCost(modelData.fromNetwork, l1FeeInGWei, modelData.gasAmount)
6565
return l1FeeInEth
6666
}
6767

6868
property double decimalTotalGasAmount: {
6969
let maxFees = modelData.gasFees.maxFeePerGasM
7070
let gasPrice = modelData.gasFees.eip1559Enabled ? maxFees : modelData.gasFees.gasPrice
71-
return root.getGasNativeCryptoValue(gasPrice , modelData.gasAmount)
71+
return root.getGasNativeCryptoValue(gasPrice, modelData.gasAmount, modelData.fromNetwork)
7272
}
7373

7474
property double totalGasAmountFiat: root.getFiatValue(decimalTotalGasAmount, gasSymbol) + root.getFiatValue(decimalTotalGasAmountL1, gasSymbol)

ui/imports/shared/popups/send/views/FeesView.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ Rectangle {
7171
GasSelector {
7272
id: gasSelector
7373
width: parent.width
74-
getGasNativeCryptoValue: function(gasPrice, gasAmount) {
75-
return Utils.getGasDecimalValue(root.selectedAsset.chainId, gasPrice, gasAmount)
74+
getGasNativeCryptoValue: function(gasPrice, gasAmount, chainId) {
75+
return Utils.calculateGasCost(chainId, gasPrice, gasAmount)
7676
}
7777
getFiatValue: root.currencyStore.getFiatValue
7878
formatCurrencyAmount: root.currencyStore.formatCurrencyAmount

ui/imports/utils/Utils.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,10 @@ QtObject {
851851
StatusQUtils.AmountsArithmetic.fromNumber(1, rawDecimals - gasDecimals))
852852
}
853853

854-
function getGasDecimalValue(chainID, gasValue, gasLimit) {
855-
let rawValue = nativeTokenGasToRaw(chainID, gasValue)
856-
rawValue = StatusQUtils.AmountsArithmetic.times(rawValue, StatusQUtils.AmountsArithmetic.fromNumber(1, gasLimit))
857-
return nativeTokenRawToDecimal(chainID, rawValue)
854+
function calculateGasCost(chainID, gasPriceInGasUnit, gasAmount) {
855+
let rawGasPrice = nativeTokenGasToRaw(chainID, gasPriceInGasUnit)
856+
rawGasPrice = StatusQUtils.AmountsArithmetic.times(rawGasPrice, StatusQUtils.AmountsArithmetic.fromNumber(gasAmount))
857+
return nativeTokenRawToDecimal(chainID, rawGasPrice)
858858
}
859859

860860
// Leave this function at the bottom of the file as QT Creator messes up the code color after this

0 commit comments

Comments
 (0)