mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 03:20:23 +01:00
29 lines
729 B
JavaScript
29 lines
729 B
JavaScript
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)
|