diff --git a/ui/components/app/cancel-speedup-popover/cancel-speedup-popover.js b/ui/components/app/cancel-speedup-popover/cancel-speedup-popover.js index 68611ab96..fdd18a420 100644 --- a/ui/components/app/cancel-speedup-popover/cancel-speedup-popover.js +++ b/ui/components/app/cancel-speedup-popover/cancel-speedup-popover.js @@ -54,7 +54,7 @@ const CancelSpeedupPopover = () => { const gasUsedLessThanMedium = gasFeeEstimates && gasEstimateGreaterThanGasUsedPlusTenPercent( - transaction, + transaction.txParams, gasFeeEstimates, PRIORITY_LEVELS.MEDIUM, ); diff --git a/ui/components/app/edit-gas-fee-popover/edit-gas-item/edit-gas-item.js b/ui/components/app/edit-gas-fee-popover/edit-gas-item/edit-gas-item.js index 7e8604405..cd2f8bd70 100644 --- a/ui/components/app/edit-gas-fee-popover/edit-gas-item/edit-gas-item.js +++ b/ui/components/app/edit-gas-fee-popover/edit-gas-item/edit-gas-item.js @@ -125,6 +125,7 @@ const EditGasItem = ({ priorityLevel }) => { backgroundColor={ priorityLevel === estimateUsed ? '#f2f3f4' : '#fff' } + estimateUsed={priorityLevel} /> { priorityLevel === PRIORITY_LEVELS.HIGH) ) { const estimateGreater = !gasEstimateGreaterThanGasUsedPlusTenPercent( - transaction, + transaction.previousGas || transaction.txParams, gasFeeEstimates, priorityLevel, ); diff --git a/ui/components/app/gas-details-item/gas-details-item.js b/ui/components/app/gas-details-item/gas-details-item.js index c0aeeb20f..c47b3a1dd 100644 --- a/ui/components/app/gas-details-item/gas-details-item.js +++ b/ui/components/app/gas-details-item/gas-details-item.js @@ -39,7 +39,7 @@ const GasDetailsItem = ({ userAcknowledgedGasMissing = false }) => { detailTitleColor={COLORS.BLACK} detailText={
- + { } detailTotal={
- + { 'gas-details-item__gas-fee-warning': estimateUsed === 'high', })} > - + {estimateUsed === 'high' && '⚠ '} @@ -77,7 +77,7 @@ const GasDetailsItem = ({ userAcknowledgedGasMissing = false }) => { key="editGasSubTextFeeValue" className="gas-details-item__currency-container" > - + { - let { maxFeePerGas: maxFeePerGasInTransaction } = transaction.txParams; + let { maxFeePerGas: maxFeePerGasInTransaction } = gasUsed; maxFeePerGasInTransaction = new BigNumber( hexWEIToDecGWEI(addTenPercentAndRound(maxFeePerGasInTransaction)), ); @@ -53,3 +54,11 @@ export function addTenPercent(hexStringValue, conversionOptions = {}) { export function addTenPercentAndRound(hexStringValue) { return addTenPercent(hexStringValue, { numberOfDecimals: 0 }); } + +export function isVolatileGasEstimate(estimate) { + return [ + GAS_RECOMMENDATIONS.HIGH, + GAS_RECOMMENDATIONS.MEDIUM, + GAS_RECOMMENDATIONS.LOW, + ].includes(estimate); +} diff --git a/ui/helpers/utils/gas.test.js b/ui/helpers/utils/gas.test.js index 2d13f4030..58aaaf38e 100644 --- a/ui/helpers/utils/gas.test.js +++ b/ui/helpers/utils/gas.test.js @@ -10,10 +10,8 @@ describe('Gas utils', () => { const compareGas = (estimateValues) => { return gasEstimateGreaterThanGasUsedPlusTenPercent( { - txParams: { - maxFeePerGas: '0x59682f10', - maxPriorityFeePerGas: '0x59682f00', - }, + maxFeePerGas: '0x59682f10', + maxPriorityFeePerGas: '0x59682f00', }, { medium: estimateValues, 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 d23912787..d9e4769d3 100644 --- a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js @@ -365,7 +365,7 @@ export default class ConfirmTransactionBase extends Component { ) { return (
- + - + - + {t('editGasSubTextAmountLabel')} {' '}