@ -4,7 +4,12 @@ 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 } from '../../../helpers/constants/common' ;
import {
GWEI ,
PRIMARY ,
SECONDARY ,
ETH ,
} from '../../../helpers/constants/common' ;
import TransactionBreakdownRow from './transaction-breakdown-row' ;
export default class TransactionBreakdown extends PureComponent {
@ -25,7 +30,8 @@ export default class TransactionBreakdown extends PureComponent {
totalInHex : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
baseFee : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
priorityFee : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
effectiveGasPrice : PropTypes . number ,
hexGasTotal : PropTypes . string ,
supportsEIP1559 : PropTypes . bool ,
} ;
static defaultProps = {
@ -47,7 +53,8 @@ export default class TransactionBreakdown extends PureComponent {
isTokenApprove ,
baseFee ,
priorityFee ,
effectiveGasPrice ,
hexGasTotal ,
supportsEIP1559 ,
} = this . props ;
return (
< div className = { classnames ( 'transaction-breakdown' , className ) } >
@ -91,7 +98,7 @@ export default class TransactionBreakdown extends PureComponent {
/ >
< / T r a n s a c t i o n B r e a k d o w n R o w >
) }
{ process . env . SHOW _EIP _1559 _UI && (
{ process . env . SHOW _EIP _1559 _UI && supportsEIP1559 && (
< TransactionBreakdownRow title = { t ( 'transactionHistoryBaseFee' ) } >
{ typeof baseFee === 'undefined' ? (
'?'
@ -102,12 +109,13 @@ export default class TransactionBreakdown extends PureComponent {
currency = { nativeCurrency }
denomination = { GWEI }
value = { baseFee }
numberOfDecimals = { 10 }
hideLabel
/ >
) }
< / T r a n s a c t i o n B r e a k d o w n R o w >
) }
{ process . env . SHOW _EIP _1559 _UI && (
{ process . env . SHOW _EIP _1559 _UI && supportsEIP1559 && (
< TransactionBreakdownRow title = { t ( 'transactionHistoryPriorityFee' ) } >
{ typeof priorityFee === 'undefined' ? (
'?'
@ -118,12 +126,13 @@ export default class TransactionBreakdown extends PureComponent {
currency = { nativeCurrency }
denomination = { GWEI }
value = { priorityFee }
numberOfDecimals = { 10 }
hideLabel
/ >
) }
< / T r a n s a c t i o n B r e a k d o w n R o w >
) }
{ ! process . env . SHOW _EIP _1559 _UI && (
{ ( ! process . env . SHOW _EIP _1559 _UI || ! supportsEIP1559 ) && (
< TransactionBreakdownRow title = { t ( 'advancedGasPriceTitle' ) } >
{ typeof gasPrice === 'undefined' ? (
'?'
@ -139,22 +148,28 @@ export default class TransactionBreakdown extends PureComponent {
) }
< / T r a n s a c t i o n B r e a k d o w n R o w >
) }
< TransactionBreakdownRow
title = { t ( 'transactionHistoryEffectiveGasPrice' ) }
>
< UserPreferencedCurrencyDisplay
className = "transaction-breakdown__value transaction-breakdown__value--effective-gas-price"
type = { PRIMARY }
value = { effectiveGasPrice }
/ >
{ showFiat && (
{ process . env . SHOW _EIP _1559 _UI && supportsEIP1559 && (
< TransactionBreakdownRow
title = { t ( 'transactionHistoryEffectiveGasPrice' ) }
>
< UserPreferencedCurrencyDisplay
className = "transaction-breakdown__value"
type = { SECONDARY }
value = { effectiveGasPrice }
data - testid = "transaction-breakdown__effective-gas-price"
currency = { nativeCurrency }
denomination = { ETH }
numberOfDecimals = { 6 }
value = { hexGasTotal }
type = { PRIMARY }
/ >
) }
< / T r a n s a c t i o n B r e a k d o w n R o w >
{ showFiat && (
< UserPreferencedCurrencyDisplay
className = "transaction-breakdown__value"
type = { SECONDARY }
value = { hexGasTotal }
/ >
) }
< / T r a n s a c t i o n B r e a k d o w n R o w >
) }
< TransactionBreakdownRow title = { t ( 'total' ) } >
< UserPreferencedCurrencyDisplay
className = "transaction-breakdown__value transaction-breakdown__value--eth-total"