import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import TransactionBreakdownRow from './transaction-breakdown-row' import Card from '../card' 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' import { getHexGasTotal } from '../../helpers/confirm-transaction/util' import { sumHexes } from '../../helpers/transactions.util' export default class TransactionBreakdown extends PureComponent { static contextTypes = { t: PropTypes.func, } static propTypes = { transaction: PropTypes.object, className: PropTypes.string, nativeCurrency: PropTypes.string.isRequired, } static defaultProps = { transaction: {}, } render () { const { t } = this.context const { transaction, className, nativeCurrency } = this.props const { txParams: { gas, gasPrice, value } = {}, txReceipt: { gasUsed } = {} } = transaction const gasLimit = typeof gasUsed === 'string' ? gasUsed : gas const hexGasTotal = getHexGasTotal({ gasLimit, gasPrice }) const totalInHex = sumHexes(hexGasTotal, value) return (
{ typeof gasUsed === 'string' && ( ) }
) } }