1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/app/components/loading-network-screen/loading-network-screen.container.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

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)