{
- if (areDappSuggestedAndTxParamGasFeesTheSame(transaction)) {
- return 'dappSuggested';
+ if (estimateToUse) {
+ return estimateToUse;
}
- return estimateToUse;
+ return PRIORITY_LEVELS.CUSTOM;
});
/**
@@ -118,9 +118,7 @@ export function useGasFeeInputs(
* so that transaction is source of truth whenever possible.
*/
useEffect(() => {
- if (areDappSuggestedAndTxParamGasFeesTheSame(transaction)) {
- setEstimateUsed('dappSuggested');
- } else if (transaction?.userFeeLevel) {
+ if (transaction?.userFeeLevel) {
setEstimateUsed(transaction?.userFeeLevel);
}
}, [setEstimateUsed, transaction]);
@@ -219,11 +217,6 @@ export function useGasFeeInputs(
const { updateTransactionUsingGasFeeEstimates } = useTransactionFunctions({
defaultEstimateToUse,
gasLimit,
- gasPrice,
- maxFeePerGas,
- maxPriorityFeePerGas,
- gasFeeEstimates,
- supportsEIP1559,
transaction,
});
diff --git a/ui/hooks/gasFeeInput/useTransactionFunctions.js b/ui/hooks/gasFeeInput/useTransactionFunctions.js
index ea891869a..d4f094240 100644
--- a/ui/hooks/gasFeeInput/useTransactionFunctions.js
+++ b/ui/hooks/gasFeeInput/useTransactionFunctions.js
@@ -2,16 +2,12 @@ import { useCallback } from 'react';
import { useDispatch } from 'react-redux';
import { PRIORITY_LEVELS } from '../../../shared/constants/gas';
-import {
- decGWEIToHexWEI,
- decimalToHex,
-} from '../../helpers/utils/conversions.util';
+import { decimalToHex } from '../../helpers/utils/conversions.util';
import { updateTransaction as updateTransactionFn } from '../../store/actions';
export const useTransactionFunctions = ({
defaultEstimateToUse,
gasLimit,
- gasFeeEstimates,
transaction,
}) => {
const dispatch = useDispatch();
@@ -23,9 +19,13 @@ export const useTransactionFunctions = ({
gasLimit: decimalToHex(gasLimit),
estimateSuggested: defaultEstimateToUse,
estimateUsed,
- maxFeePerGas,
- maxPriorityFeePerGas,
};
+ if (maxFeePerGas) {
+ newGasSettings.maxFeePerGas = maxFeePerGas;
+ }
+ if (maxPriorityFeePerGas) {
+ newGasSettings.maxPriorityFeePerGas = maxPriorityFeePerGas;
+ }
const updatedTxMeta = {
...transaction,
@@ -49,23 +49,15 @@ export const useTransactionFunctions = ({
maxPriorityFeePerGas,
} = transaction?.dappSuggestedGasFees;
updateTransaction(
- PRIORITY_LEVELS.CUSTOM,
+ PRIORITY_LEVELS.DAPP_SUGGESTED,
maxFeePerGas,
maxPriorityFeePerGas,
);
} else {
- const {
- suggestedMaxFeePerGas,
- suggestedMaxPriorityFeePerGas,
- } = gasFeeEstimates[gasFeeEstimateToUse];
- updateTransaction(
- gasFeeEstimateToUse,
- decGWEIToHexWEI(suggestedMaxFeePerGas),
- decGWEIToHexWEI(suggestedMaxPriorityFeePerGas),
- );
+ updateTransaction(gasFeeEstimateToUse);
}
},
- [gasFeeEstimates, transaction?.dappSuggestedGasFees, updateTransaction],
+ [transaction?.dappSuggestedGasFees, updateTransaction],
);
return { updateTransactionUsingGasFeeEstimates };
diff --git a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js
index 6de9074c9..8f611e870 100644
--- a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js
+++ b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js
@@ -514,22 +514,26 @@ export default class ConfirmTransactionBase extends Component {
}
subText={
- !isMultiLayerFeeNetwork &&
- t('editGasSubTextFee', [
- {t('editGasSubTextFeeLabel')},
-
- {renderHeartBeatIfNotInTest()}
-
-
,
- ])
+ !isMultiLayerFeeNetwork && (
+ <>
+
+ {t('editGasSubTextFeeLabel')}
+
+ ,
+
+ {renderHeartBeatIfNotInTest()}
+
+
+ >
+ )
}
subTitle={
<>
@@ -606,12 +610,14 @@ export default class ConfirmTransactionBase extends Component {
detailText={renderTotalDetailText()}
detailTotal={renderTotalDetailTotal()}
subTitle={t('transactionDetailGasTotalSubtitle')}
- subText={t('editGasSubTextAmount', [
-
- {t('editGasSubTextAmountLabel')}
- ,
- renderTotalMaxAmount(),
- ])}
+ subText={
+ <>
+
+ {t('editGasSubTextAmountLabel')}
+
+ {renderTotalMaxAmount()}
+ >
+ }
/>
),
]}
diff --git a/ui/pages/confirm-transaction-base/gas-details-item/gas-details-item.js b/ui/pages/confirm-transaction-base/gas-details-item/gas-details-item.js
index 91280266e..0c00be4e9 100644
--- a/ui/pages/confirm-transaction-base/gas-details-item/gas-details-item.js
+++ b/ui/pages/confirm-transaction-base/gas-details-item/gas-details-item.js
@@ -92,34 +92,36 @@ const GasDetailsItem = ({
/>
}
- subText={t('editGasSubTextFee', [
-
-
-
- {estimateUsed === 'high' && '⚠ '}
-
-
-
-
+
-
-
-
- ,
- ])}
+
+
+ {estimateUsed === 'high' && '⚠ '}
+
+
+
+
+
+
+
+
+ >
+ }
subTitle={