aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/token-input/token-input.container.js
blob: ec233b1b87a273e697ddfb421a7c0c7cf72500a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { connect } from 'react-redux'
import TokenInput from './token-input.component'
import { getSelectedToken, getSelectedTokenExchangeRate } from '../../selectors'

const mapStateToProps = state => {
  const { metamask: { currentCurrency } } = state

  return {
    currentCurrency,
    selectedToken: getSelectedToken(state),
    selectedTokenExchangeRate: getSelectedTokenExchangeRate(state),
  }
}

const mergeProps = (stateProps, dispatchProps, ownProps) => {
  const { selectedToken } = stateProps
  const suffix = selectedToken && selectedToken.symbol

  return {
    ...stateProps,
    ...dispatchProps,
    ...ownProps,
    suffix,
  }
}

export default connect(mapStateToProps, null, mergeProps)(TokenInput)