mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 23:58:06 +01:00
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
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)
|