diff options
Diffstat (limited to 'ui/app/components/ui/token-input/token-input.container.js')
-rw-r--r-- | ui/app/components/ui/token-input/token-input.container.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ui/app/components/ui/token-input/token-input.container.js b/ui/app/components/ui/token-input/token-input.container.js new file mode 100644 index 000000000..981cb3598 --- /dev/null +++ b/ui/app/components/ui/token-input/token-input.container.js @@ -0,0 +1,30 @@ +import { connect } from 'react-redux' +import TokenInput from './token-input.component' +import {getIsMainnet, getSelectedToken, getSelectedTokenExchangeRate, preferencesSelector} from '../../../selectors/selectors' + +const mapStateToProps = state => { + const { metamask: { currentCurrency } } = state + const { showFiatInTestnets } = preferencesSelector(state) + const isMainnet = getIsMainnet(state) + + return { + currentCurrency, + selectedToken: getSelectedToken(state), + selectedTokenExchangeRate: getSelectedTokenExchangeRate(state), + hideConversion: (!isMainnet && !showFiatInTestnets), + } +} + +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) |