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.
28 lines
729 B
28 lines
729 B
import { connect } from 'react-redux'
|
|
import CurrencyInput from './currency-input.component'
|
|
import { ETH } from '../../constants/common'
|
|
|
|
const mapStateToProps = state => {
|
|
const { metamask: { nativeCurrency, currentCurrency, conversionRate } } = state
|
|
|
|
return {
|
|
nativeCurrency,
|
|
currentCurrency,
|
|
conversionRate,
|
|
}
|
|
}
|
|
|
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|
const { nativeCurrency, currentCurrency } = stateProps
|
|
const { useFiat } = ownProps
|
|
const suffix = useFiat ? currentCurrency.toUpperCase() : nativeCurrency || ETH
|
|
|
|
return {
|
|
...stateProps,
|
|
...dispatchProps,
|
|
...ownProps,
|
|
suffix,
|
|
}
|
|
}
|
|
|
|
export default connect(mapStateToProps, null, mergeProps)(CurrencyInput)
|
|
|