diff --git a/ui/components/app/gas-timing/gas-timing.component.js b/ui/components/app/gas-timing/gas-timing.component.js
index 49ba84075..4bf3aa629 100644
--- a/ui/components/app/gas-timing/gas-timing.component.js
+++ b/ui/components/app/gas-timing/gas-timing.component.js
@@ -172,9 +172,7 @@ export default function GasTiming({
toHumanReadableTime(Number(customEstimatedTime?.upperTimeBound), t),
]);
}
- }
- // code below needs to cleaned-up once EIP_1559_V2 flag is removed
- else if (supportsEIP1559V2) {
+ } else if (supportsEIP1559V2) {
text = t('gasTimingNegative', [
toHumanReadableTime(low.maxWaitTimeEstimate, t),
]);
diff --git a/ui/components/app/transaction-detail/index.scss b/ui/components/app/transaction-detail/index.scss
index a24bd4ede..1e39d6078 100644
--- a/ui/components/app/transaction-detail/index.scss
+++ b/ui/components/app/transaction-detail/index.scss
@@ -31,6 +31,7 @@
background: transparent;
border: 0;
padding-inline-end: 0;
+ position: relative;
white-space: pre;
}
@@ -40,7 +41,18 @@
}
&__icon {
- font-size: 1rem;
+ @include Paragraph;
+
+ line-height: 1;
+ position: absolute;
+ left: -16px;
+ top: 0;
+
+ &-custom {
+ font-size: 1.35rem;
+ left: -12px;
+ top: -2px;
+ }
}
&__label {
diff --git a/ui/components/app/transaction-detail/transaction-detail.component.js b/ui/components/app/transaction-detail/transaction-detail.component.js
index 919d76dac..4cc13f442 100644
--- a/ui/components/app/transaction-detail/transaction-detail.component.js
+++ b/ui/components/app/transaction-detail/transaction-detail.component.js
@@ -7,7 +7,7 @@ import InfoTooltip from '../../ui/info-tooltip/info-tooltip';
import Typography from '../../ui/typography/typography';
import TransactionDetailItem from '../transaction-detail-item/transaction-detail-item.component';
-import { COLORS } from '../../../helpers/constants/design-system';
+import { COLORS, TYPOGRAPHY } from '../../../helpers/constants/design-system';
import { PRIORITY_LEVEL_ICON_MAP } from '../../../helpers/constants/gas';
import { useI18nContext } from '../../../hooks/useI18nContext';
@@ -36,7 +36,9 @@ export default function TransactionDetail({
diff --git a/ui/components/ui/typography/typography.js b/ui/components/ui/typography/typography.js
index 2d11ca3cc..0f42519fe 100644
--- a/ui/components/ui/typography/typography.js
+++ b/ui/components/ui/typography/typography.js
@@ -20,7 +20,6 @@ export default function Typography({
children,
fontWeight = 'normal',
fontStyle = 'normal',
- fontSize,
align,
boxProps = {},
margin = [1, 0],
@@ -34,7 +33,6 @@ export default function Typography({
{
[`typography--align-${align}`]: Boolean(align),
[`typography--color-${color}`]: Boolean(color),
- [`typography--size-${fontSize}`]: Boolean(fontSize),
},
);
@@ -69,7 +67,6 @@ Typography.propTypes = {
margin: MultipleSizes,
fontWeight: PropTypes.oneOf(Object.values(FONT_WEIGHT)),
fontStyle: PropTypes.oneOf(Object.values(FONT_STYLE)),
- fontSize: PropTypes.string,
tag: PropTypes.oneOf([
'p',
'h1',
diff --git a/ui/components/ui/typography/typography.scss b/ui/components/ui/typography/typography.scss
index ea1cbaff3..42f1294d0 100644
--- a/ui/components/ui/typography/typography.scss
+++ b/ui/components/ui/typography/typography.scss
@@ -33,12 +33,6 @@
}
}
- @each $size in design-system.$font-size {
- &--size-#{$size} {
- font-size: $size;
- }
- }
-
@each $alignment in design-system.$text-align {
&--align-#{$alignment} {
text-align: $alignment;
diff --git a/ui/css/design-system/attributes.scss b/ui/css/design-system/attributes.scss
index 4a187a949..e9f03e053 100644
--- a/ui/css/design-system/attributes.scss
+++ b/ui/css/design-system/attributes.scss
@@ -82,4 +82,3 @@ $display: block, grid, flex, inline-block, inline-grid, inline-flex, list-item;
$text-align: left, right, center, justify, end;
$font-weight: bold, normal, 100, 200, 300, 400, 500, 600, 700, 800, 900;
$font-style: normal, italic, oblique;
-$font-size: 10px, 12px;
diff --git a/ui/hooks/gasFeeInput/useGasFeeInputs.js b/ui/hooks/gasFeeInput/useGasFeeInputs.js
index 49864193b..a2c0b89b4 100644
--- a/ui/hooks/gasFeeInput/useGasFeeInputs.js
+++ b/ui/hooks/gasFeeInput/useGasFeeInputs.js
@@ -23,9 +23,6 @@ import { useMaxPriorityFeePerGasInput } from './useMaxPriorityFeePerGasInput';
import { useGasEstimates } from './useGasEstimates';
import { useTransactionFunctions } from './useTransactionFunctions';
-// eslint-disable-next-line prefer-destructuring
-const EIP_1559_V2 = process.env.EIP_1559_V2;
-
/**
* @typedef {Object} GasFeeInputReturnType
* @property {DecGweiString} [maxFeePerGas] - the maxFeePerGas input value.
@@ -85,6 +82,8 @@ export function useGasFeeInputs(
useSelector(checkNetworkAndAccountSupports1559) &&
!isLegacyTransaction(transaction?.txParams);
+ const supportsEIP1559V2 = supportsEIP1559 && EIP_1559_V2_ENABLED;
+
// We need the gas estimates from the GasFeeController in the background.
// Calling this hooks initiates polling for new gas estimates and returns the
// current estimate.
@@ -115,27 +114,31 @@ export function useGasFeeInputs(
return PRIORITY_LEVELS.CUSTOM;
});
+ const [gasLimit, setGasLimit] = useState(() =>
+ Number(hexToDecimal(transaction?.txParams?.gas ?? '0x0')),
+ );
+
/**
* In EIP-1559 V2 designs change to gas estimate is always updated to transaction
* Thus callback setEstimateToUse can be deprecate in favour of this useEffect
* so that transaction is source of truth whenever possible.
*/
useEffect(() => {
- if (EIP_1559_V2 && transaction?.userFeeLevel) {
- setEstimateUsed(transaction?.userFeeLevel);
- setInternalEstimateToUse(transaction?.userFeeLevel);
+ if (supportsEIP1559V2) {
+ if (transaction?.userFeeLevel) {
+ setEstimateUsed(transaction?.userFeeLevel);
+ setInternalEstimateToUse(transaction?.userFeeLevel);
+ }
+ setGasLimit(Number(hexToDecimal(transaction?.txParams?.gas ?? '0x0')));
}
}, [
setEstimateUsed,
+ setGasLimit,
setInternalEstimateToUse,
+ supportsEIP1559V2,
transaction,
- userPrefersAdvancedGas,
]);
- const [gasLimit, setGasLimit] = useState(() =>
- Number(hexToDecimal(transaction?.txParams?.gas ?? '0x0')),
- );
-
const {
gasPrice,
setGasPrice,
@@ -152,7 +155,7 @@ export function useGasFeeInputs(
maxFeePerGasFiat,
setMaxFeePerGas,
} = useMaxFeePerGasInput({
- EIP_1559_V2,
+ supportsEIP1559V2,
estimateToUse,
gasEstimateType,
gasFeeEstimates,
@@ -166,7 +169,7 @@ export function useGasFeeInputs(
maxPriorityFeePerGasFiat,
setMaxPriorityFeePerGas,
} = useMaxPriorityFeePerGasInput({
- EIP_1559_V2,
+ supportsEIP1559V2,
estimateToUse,
gasEstimateType,
gasFeeEstimates,
@@ -316,7 +319,7 @@ export function useGasFeeInputs(
hasGasErrors,
hasSimulationError,
supportsEIP1559,
- supportsEIP1559V2: supportsEIP1559 && EIP_1559_V2_ENABLED,
+ supportsEIP1559V2,
updateTransaction,
updateTransactionUsingGasFeeEstimates,
};
diff --git a/ui/hooks/gasFeeInput/useMaxFeePerGasInput.js b/ui/hooks/gasFeeInput/useMaxFeePerGasInput.js
index 452c0611e..7afc19cfc 100644
--- a/ui/hooks/gasFeeInput/useMaxFeePerGasInput.js
+++ b/ui/hooks/gasFeeInput/useMaxFeePerGasInput.js
@@ -34,7 +34,7 @@ const getMaxFeePerGasFromTransaction = (transaction) => {
* method to update the setMaxFeePerGas.
*/
export function useMaxFeePerGasInput({
- EIP_1559_V2,
+ supportsEIP1559V2,
estimateToUse,
gasEstimateType,
gasFeeEstimates,
@@ -67,10 +67,10 @@ export function useMaxFeePerGasInput({
});
useEffect(() => {
- if (EIP_1559_V2) {
+ if (supportsEIP1559V2) {
setMaxFeePerGas(maxFeePerGasFromTransaction);
}
- }, [EIP_1559_V2, maxFeePerGasFromTransaction, setMaxFeePerGas]);
+ }, [maxFeePerGasFromTransaction, setMaxFeePerGas, supportsEIP1559V2]);
let gasSettings = {
gasLimit: decimalToHex(gasLimit),
diff --git a/ui/hooks/gasFeeInput/useMaxPriorityFeePerGasInput.js b/ui/hooks/gasFeeInput/useMaxPriorityFeePerGasInput.js
index 54aeb1093..38e45a3bc 100644
--- a/ui/hooks/gasFeeInput/useMaxPriorityFeePerGasInput.js
+++ b/ui/hooks/gasFeeInput/useMaxPriorityFeePerGasInput.js
@@ -34,7 +34,7 @@ const getMaxPriorityFeePerGasFromTransaction = (transaction) => {
* method to update the maxPriorityFeePerGas.
*/
export function useMaxPriorityFeePerGasInput({
- EIP_1559_V2,
+ supportsEIP1559V2,
estimateToUse,
gasEstimateType,
gasFeeEstimates,
@@ -63,13 +63,13 @@ export function useMaxPriorityFeePerGasInput({
});
useEffect(() => {
- if (EIP_1559_V2) {
+ if (supportsEIP1559V2) {
setMaxPriorityFeePerGas(maxPriorityFeePerGasFromTransaction);
}
}, [
- EIP_1559_V2,
maxPriorityFeePerGasFromTransaction,
setMaxPriorityFeePerGas,
+ supportsEIP1559V2,
]);
const maxPriorityFeePerGasToUse =
diff --git a/ui/hooks/gasFeeInput/useTransactionFunctions.js b/ui/hooks/gasFeeInput/useTransactionFunctions.js
index ab3830266..9975555d6 100644
--- a/ui/hooks/gasFeeInput/useTransactionFunctions.js
+++ b/ui/hooks/gasFeeInput/useTransactionFunctions.js
@@ -11,13 +11,18 @@ import { updateTransaction as updateTransactionFn } from '../../store/actions';
export const useTransactionFunctions = ({
defaultEstimateToUse,
gasFeeEstimates,
- gasLimit,
+ gasLimit: gasLimitInTransaction,
transaction,
}) => {
const dispatch = useDispatch();
const updateTransaction = useCallback(
- (estimateUsed, maxFeePerGas, maxPriorityFeePerGas) => {
+ ({
+ estimateUsed,
+ maxFeePerGas,
+ maxPriorityFeePerGas,
+ gasLimit = gasLimitInTransaction,
+ }) => {
const newGasSettings = {
gas: decimalToHex(gasLimit),
gasLimit: decimalToHex(gasLimit),
@@ -42,7 +47,7 @@ export const useTransactionFunctions = ({
dispatch(updateTransactionFn(updatedTxMeta));
},
- [defaultEstimateToUse, dispatch, gasLimit, transaction],
+ [defaultEstimateToUse, dispatch, gasLimitInTransaction, transaction],
);
const updateTransactionUsingGasFeeEstimates = useCallback(
@@ -52,21 +57,21 @@ export const useTransactionFunctions = ({
maxFeePerGas,
maxPriorityFeePerGas,
} = transaction?.dappSuggestedGasFees;
- updateTransaction(
- PRIORITY_LEVELS.DAPP_SUGGESTED,
+ updateTransaction({
+ estimateUsed: PRIORITY_LEVELS.DAPP_SUGGESTED,
maxFeePerGas,
maxPriorityFeePerGas,
- );
+ });
} else {
const {
suggestedMaxFeePerGas,
suggestedMaxPriorityFeePerGas,
} = gasFeeEstimates[gasFeeEstimateToUse];
- updateTransaction(
- gasFeeEstimateToUse,
- decGWEIToHexWEI(suggestedMaxFeePerGas),
- decGWEIToHexWEI(suggestedMaxPriorityFeePerGas),
- );
+ updateTransaction({
+ estimateUsed: gasFeeEstimateToUse,
+ maxFeePerGas: decGWEIToHexWEI(suggestedMaxFeePerGas),
+ maxPriorityFeePerGas: decGWEIToHexWEI(suggestedMaxPriorityFeePerGas),
+ });
}
},
[gasFeeEstimates, transaction?.dappSuggestedGasFees, updateTransaction],
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 976bbeb3e..981debb24 100644
--- a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js
+++ b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js
@@ -429,9 +429,7 @@ export default class ConfirmTransactionBase extends Component {
) : null;
const renderGasDetailsItem = () => {
- return EIP_1559_V2_ENABLED &&
- supportsEIP1559 &&
- !isLegacyTransaction(txData) ? (
+ return this.supportsEIP1559V2 ? (
this.handleCloseEditGas()}
currentTransaction={txData}
- supportsEIP1559V2={
- EIP_1559_V2_ENABLED &&
- supportsEIP1559 &&
- !isLegacyTransaction(txData)
- }
+ supportsEIP1559V2={this.supportsEIP1559V2}
/>
);
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 2cdf2c5ea..5dc8ec487 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
@@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
-import { COLORS } from '../../../helpers/constants/design-system';
+import { COLORS, TYPOGRAPHY } from '../../../helpers/constants/design-system';
import { PRIMARY, SECONDARY } from '../../../helpers/constants/common';
import { hexWEIToDecGWEI } from '../../../helpers/utils/conversions.util';
import { useI18nContext } from '../../../hooks/useI18nContext';
@@ -47,15 +47,15 @@ const GasDetailsItem = ({
-
+
{t('transactionDetailGasTooltipIntro', [
isMainnet ? t('networkNameEthereum') : '',
])}
-
+
{t('transactionDetailGasTooltipExplanation')}
-
+
+
}