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.
31 lines
910 B
31 lines
910 B
import { connect } from 'react-redux'
|
|
import CurrencyInput from './currency-input.component'
|
|
import { ETH } from '../../constants/common'
|
|
import {getIsMainnet, preferencesSelector} from '../../selectors'
|
|
|
|
const mapStateToProps = state => {
|
|
const { metamask: { nativeCurrency, currentCurrency, conversionRate } } = state
|
|
const { showFiatInTestnets } = preferencesSelector(state)
|
|
const isMainnet = getIsMainnet(state)
|
|
|
|
return {
|
|
nativeCurrency,
|
|
currentCurrency,
|
|
conversionRate,
|
|
hideFiat: (!isMainnet && !showFiatInTestnets),
|
|
}
|
|
}
|
|
|
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|
const { nativeCurrency, currentCurrency } = stateProps
|
|
|
|
return {
|
|
...stateProps,
|
|
...dispatchProps,
|
|
...ownProps,
|
|
nativeSuffix: nativeCurrency || ETH,
|
|
fiatSuffix: currentCurrency.toUpperCase(),
|
|
}
|
|
}
|
|
|
|
export default connect(mapStateToProps, null, mergeProps)(CurrencyInput)
|
|
|