import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import TransactionBreakdownRow from './transaction-breakdown-row' import CurrencyDisplay from '../currency-display' import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display' import HexToDecimal from '../hex-to-decimal' import { GWEI, PRIMARY, SECONDARY } from '../../constants/common' export default class TransactionBreakdown extends PureComponent { static contextTypes = { t: PropTypes.func, } static propTypes = { transaction: PropTypes.object, className: PropTypes.string, nativeCurrency: PropTypes.string.isRequired, showFiat: PropTypes.bool, gas: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), gasPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), gasUsed: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), totalInHex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), } static defaultProps = { transaction: {}, showFiat: true, } render () { const { t } = this.context const { gas, gasPrice, value, className, nativeCurrency, showFiat, totalInHex, gasUsed } = this.props return (
{ t('transaction') }
{typeof gas !== 'undefined' ? : '?' } { typeof gasUsed === 'string' && ( ) } {typeof gasPrice !== 'undefined' ? : '?' }
{ showFiat && ( ) }
) } }