import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; 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 TransactionBreakdownRow from './transaction-breakdown-row'; export default class TransactionBreakdown extends PureComponent { static contextTypes = { t: PropTypes.func, }; static propTypes = { className: PropTypes.string, nativeCurrency: PropTypes.string, showFiat: PropTypes.bool, nonce: PropTypes.string, primaryCurrency: PropTypes.string, isTokenApprove: PropTypes.bool, gas: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), gasPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), maxFeePerGas: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), gasUsed: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), totalInHex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), baseFee: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), priorityFee: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), hexGasTotal: PropTypes.string, isEIP1559Transaction: PropTypes.bool, isMultiLayerFeeNetwork: PropTypes.bool, l1HexGasTotal: PropTypes.string, }; static defaultProps = { showFiat: true, }; render() { const { t } = this.context; const { gas, gasPrice, maxFeePerGas, primaryCurrency, className, nonce, nativeCurrency, showFiat, totalInHex, gasUsed, isTokenApprove, baseFee, priorityFee, hexGasTotal, isEIP1559Transaction, isMultiLayerFeeNetwork, l1HexGasTotal, } = this.props; return (
{t('transaction')}
{typeof nonce === 'undefined' ? null : ( )} {primaryCurrency} {typeof gas === 'undefined' ? ( '?' ) : ( )} {typeof gasUsed === 'string' && ( )} {isEIP1559Transaction && typeof baseFee !== 'undefined' ? ( ) : null} {isEIP1559Transaction && typeof priorityFee !== 'undefined' ? ( ) : null} {!isEIP1559Transaction && ( {typeof gasPrice === 'undefined' ? ( '?' ) : ( )} )} {isEIP1559Transaction && ( {showFiat && ( )} )} {isEIP1559Transaction && ( {showFiat && ( )} )} {isMultiLayerFeeNetwork && ( {showFiat && ( )} )} {showFiat && ( )}
); } }