You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.0 KiB
29 lines
1.0 KiB
import { connect } from 'react-redux'
|
|
import TransactionBreakdown from './transaction-breakdown.component'
|
|
import {getIsMainnet, getNativeCurrency, preferencesSelector} from '../../selectors'
|
|
import { getHexGasTotal } from '../../helpers/confirm-transaction/util'
|
|
import { sumHexes } from '../../helpers/transactions.util'
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
|
const { transaction } = ownProps
|
|
const { txParams: { gas, gasPrice, value } = {}, txReceipt: { gasUsed } = {} } = transaction
|
|
const { showFiatInTestnets } = preferencesSelector(state)
|
|
const isMainnet = getIsMainnet(state)
|
|
|
|
const gasLimit = typeof gasUsed === 'string' ? gasUsed : gas
|
|
|
|
const hexGasTotal = gasLimit && gasPrice && getHexGasTotal({ gasLimit, gasPrice }) || '0x0'
|
|
const totalInHex = sumHexes(hexGasTotal, value)
|
|
|
|
return {
|
|
nativeCurrency: getNativeCurrency(state),
|
|
showFiat: (isMainnet || !!showFiatInTestnets),
|
|
totalInHex,
|
|
gas,
|
|
gasPrice,
|
|
value,
|
|
gasUsed,
|
|
}
|
|
}
|
|
|
|
export default connect(mapStateToProps)(TransactionBreakdown)
|
|
|