1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 21:00:13 +01:00
metamask-extension/ui/app/pages/confirm-token-transaction-base/confirm-token-transaction-base.container.js

35 lines
1.1 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux'
import ConfirmTokenTransactionBase from './confirm-token-transaction-base.component'
import {
tokenAmountAndToAddressSelector,
contractExchangeRateSelector,
} from '../../selectors/confirm-transaction'
const mapStateToProps = (state, ownProps) => {
const { tokenAmount: ownTokenAmount } = ownProps
const { confirmTransaction, metamask: { currentCurrency, conversionRate } } = state
const {
txData: { txParams: { to: tokenAddress } = {} } = {},
tokenProps: { tokenSymbol } = {},
fiatTransactionTotal,
ethTransactionTotal,
} = confirmTransaction
const { tokenAmount, toAddress } = tokenAmountAndToAddressSelector(state)
const contractExchangeRate = contractExchangeRateSelector(state)
return {
toAddress,
tokenAddress,
tokenAmount: typeof ownTokenAmount !== 'undefined' ? ownTokenAmount : tokenAmount,
tokenSymbol,
currentCurrency,
conversionRate,
contractExchangeRate,
fiatTransactionTotal,
ethTransactionTotal,
}
}
export default connect(mapStateToProps)(ConfirmTokenTransactionBase)