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.
33 lines
958 B
33 lines
958 B
6 years ago
|
import { connect } from 'react-redux'
|
||
|
import Balance from './balance.component'
|
||
|
import {
|
||
|
getNativeCurrency,
|
||
|
getAssetImages,
|
||
|
conversionRateSelector,
|
||
|
getCurrentCurrency,
|
||
|
getMetaMaskAccounts,
|
||
6 years ago
|
getIsMainnet,
|
||
|
preferencesSelector,
|
||
6 years ago
|
} from '../../../selectors/selectors'
|
||
6 years ago
|
|
||
|
const mapStateToProps = state => {
|
||
6 years ago
|
const { showFiatInTestnets } = preferencesSelector(state)
|
||
|
const isMainnet = getIsMainnet(state)
|
||
6 years ago
|
const accounts = getMetaMaskAccounts(state)
|
||
|
const network = state.metamask.network
|
||
|
const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0]
|
||
|
const account = accounts[selectedAddress]
|
||
|
|
||
|
return {
|
||
|
account,
|
||
|
network,
|
||
|
nativeCurrency: getNativeCurrency(state),
|
||
|
conversionRate: conversionRateSelector(state),
|
||
|
currentCurrency: getCurrentCurrency(state),
|
||
|
assetImages: getAssetImages(state),
|
||
6 years ago
|
showFiat: (isMainnet || !!showFiatInTestnets),
|
||
6 years ago
|
}
|
||
|
}
|
||
|
|
||
|
export default connect(mapStateToProps)(Balance)
|