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.
41 lines
1.2 KiB
41 lines
1.2 KiB
4 years ago
|
import { connect } from 'react-redux';
|
||
4 years ago
|
import { NETWORK_TYPE_RPC } from '../../../../shared/constants/network';
|
||
4 years ago
|
import * as actions from '../../../store/actions';
|
||
4 years ago
|
import { getNetworkIdentifier, isNetworkLoading } from '../../../selectors';
|
||
4 years ago
|
import LoadingNetworkScreen from './loading-network-screen.component';
|
||
6 years ago
|
|
||
5 years ago
|
const mapStateToProps = (state) => {
|
||
4 years ago
|
const { loadingMessage } = state.appState;
|
||
4 years ago
|
const { provider } = state.metamask;
|
||
4 years ago
|
const { rpcUrl, chainId, ticker, nickname, type } = provider;
|
||
6 years ago
|
|
||
4 years ago
|
const setProviderArgs =
|
||
4 years ago
|
type === NETWORK_TYPE_RPC
|
||
|
? [rpcUrl, chainId, ticker, nickname]
|
||
4 years ago
|
: [provider.type];
|
||
6 years ago
|
|
||
|
return {
|
||
4 years ago
|
isNetworkLoading: isNetworkLoading(state),
|
||
6 years ago
|
loadingMessage,
|
||
|
setProviderArgs,
|
||
|
provider,
|
||
|
providerId: getNetworkIdentifier(state),
|
||
4 years ago
|
};
|
||
|
};
|
||
6 years ago
|
|
||
5 years ago
|
const mapDispatchToProps = (dispatch) => {
|
||
6 years ago
|
return {
|
||
|
setProviderType: (type) => {
|
||
4 years ago
|
dispatch(actions.setProviderType(type));
|
||
6 years ago
|
},
|
||
4 years ago
|
rollbackToPreviousProvider: () =>
|
||
|
dispatch(actions.rollbackToPreviousProvider()),
|
||
6 years ago
|
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
|
||
4 years ago
|
};
|
||
|
};
|
||
6 years ago
|
|
||
4 years ago
|
export default connect(
|
||
|
mapStateToProps,
|
||
|
mapDispatchToProps,
|
||
4 years ago
|
)(LoadingNetworkScreen);
|