diff --git a/ui/components/app/currency-input/currency-input.js b/ui/components/app/currency-input/currency-input.js index 0d5ea0873..564a9ee01 100644 --- a/ui/components/app/currency-input/currency-input.js +++ b/ui/components/app/currency-input/currency-input.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import UnitInput from '../../ui/unit-input'; import CurrencyDisplay from '../../ui/currency-display'; -import { ETH } from '../../../helpers/constants/common'; import { I18nContext } from '../../../contexts/i18n'; import { getConversionRate, @@ -14,6 +13,7 @@ import { getValueFromWeiHex, getWeiHexFromDecimalValue, } from '../../../../shared/modules/conversion.utils'; +import { EtherDenomination } from '../../../../shared/constants/common'; /** * Component that allows user to enter currency values as a number, and props receive a converted @@ -39,7 +39,7 @@ export default function CurrencyInput({ const conversionRate = useSelector(getConversionRate); const showFiat = useSelector(getShouldShowFiat); const hideSecondary = !showFiat; - const primarySuffix = preferredCurrency || ETH; + const primarySuffix = preferredCurrency || EtherDenomination.ETH; const secondarySuffix = secondaryCurrency.toUpperCase(); const [isSwapped, setSwapped] = useState(false); @@ -57,7 +57,7 @@ export default function CurrencyInput({ }) : getValueFromWeiHex({ value: hexValue, - toCurrency: ETH, + toCurrency: EtherDenomination.ETH, numberOfDecimals: 8, }); @@ -82,8 +82,8 @@ export default function CurrencyInput({ }) : getWeiHexFromDecimalValue({ value: newDecimalValue, - fromCurrency: ETH, - fromDenomination: ETH, + fromCurrency: EtherDenomination.ETH, + fromDenomination: EtherDenomination.ETH, conversionRate, }); @@ -116,7 +116,7 @@ export default function CurrencyInput({ if (shouldUseFiat) { // Display ETH - currency = preferredCurrency || ETH; + currency = preferredCurrency || EtherDenomination.ETH; numberOfDecimals = 8; } else { // Display Fiat diff --git a/ui/components/app/transaction-breakdown/transaction-breakdown.component.js b/ui/components/app/transaction-breakdown/transaction-breakdown.component.js index 821a3da70..331706032 100644 --- a/ui/components/app/transaction-breakdown/transaction-breakdown.component.js +++ b/ui/components/app/transaction-breakdown/transaction-breakdown.component.js @@ -4,12 +4,8 @@ import classnames from 'classnames'; import CurrencyDisplay from '../../ui/currency-display'; import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display'; import HexToDecimal from '../../ui/hex-to-decimal'; -import { - GWEI, - PRIMARY, - SECONDARY, - ETH, -} from '../../../helpers/constants/common'; +import { PRIMARY, SECONDARY } from '../../../helpers/constants/common'; +import { EtherDenomination } from '../../../../shared/constants/common'; import TransactionBreakdownRow from './transaction-breakdown-row'; export default class TransactionBreakdown extends PureComponent { @@ -114,7 +110,7 @@ export default class TransactionBreakdown extends PureComponent { className="transaction-breakdown__value" data-testid="transaction-breakdown__base-fee" currency={nativeCurrency} - denomination={GWEI} + denomination={EtherDenomination.GWEI} value={baseFee} numberOfDecimals={10} hideLabel @@ -127,7 +123,7 @@ export default class TransactionBreakdown extends PureComponent { className="transaction-breakdown__value" data-testid="transaction-breakdown__priority-fee" currency={nativeCurrency} - denomination={GWEI} + denomination={EtherDenomination.GWEI} value={priorityFee} numberOfDecimals={10} hideLabel @@ -149,7 +145,7 @@ export default class TransactionBreakdown extends PureComponent { className="transaction-breakdown__value" data-testid="transaction-breakdown__gas-price" currency={nativeCurrency} - denomination={GWEI} + denomination={EtherDenomination.GWEI} value={gasPrice} numberOfDecimals={9} hideLabel @@ -163,7 +159,7 @@ export default class TransactionBreakdown extends PureComponent { className="transaction-breakdown__value" data-testid="transaction-breakdown__effective-gas-price" currency={nativeCurrency} - denomination={ETH} + denomination={EtherDenomination.ETH} numberOfDecimals={6} value={hexGasTotal} type={PRIMARY} @@ -185,7 +181,7 @@ export default class TransactionBreakdown extends PureComponent { { return ( - currency === ETH && + currency === EtherDenomination.ETH && showEthLogo && (