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.
42 lines
1.1 KiB
42 lines
1.1 KiB
6 years ago
|
import { connect } from 'react-redux'
|
||
|
import LoadingNetworkScreen from './loading-network-screen.component'
|
||
|
import actions from '../../actions'
|
||
|
import { getNetworkIdentifier } from '../../selectors'
|
||
|
|
||
|
const mapStateToProps = state => {
|
||
|
const {
|
||
|
loadingMessage,
|
||
|
currentView,
|
||
|
} = state.appState
|
||
|
const {
|
||
|
provider,
|
||
|
lastSelectedProvider,
|
||
|
network,
|
||
|
} = state.metamask
|
||
|
const { rpcTarget, chainId, ticker, nickname, type } = provider
|
||
|
|
||
|
const setProviderArgs = type === 'rpc'
|
||
|
? [rpcTarget, chainId, ticker, nickname]
|
||
|
: [provider.type]
|
||
|
|
||
|
return {
|
||
|
isLoadingNetwork: network === 'loading' && currentView.name !== 'config',
|
||
|
loadingMessage,
|
||
|
lastSelectedProvider,
|
||
|
setProviderArgs,
|
||
|
provider,
|
||
|
providerId: getNetworkIdentifier(state),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const mapDispatchToProps = dispatch => {
|
||
|
return {
|
||
|
setProviderType: (type) => {
|
||
|
dispatch(actions.setProviderType(type))
|
||
|
},
|
||
|
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default connect(mapStateToProps, mapDispatchToProps)(LoadingNetworkScreen)
|