1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 04:37:13 +01:00
metamask-extension/ui/components/app/loading-network-screen/loading-network-screen.container.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { NETWORK_TYPE_RPC } from '../../../../shared/constants/network';
import * as actions from '../../../store/actions';
import { getNetworkIdentifier, isNetworkLoading } from '../../../selectors';
import LoadingNetworkScreen from './loading-network-screen.component';
2020-02-15 21:34:12 +01:00
const mapStateToProps = (state) => {
const { loadingMessage } = state.appState;
const { provider } = state.metamask;
const { rpcUrl, chainId, ticker, nickname, type } = provider;
2020-11-03 00:41:28 +01:00
const setProviderArgs =
type === NETWORK_TYPE_RPC
? [rpcUrl, chainId, ticker, nickname]
: [provider.type];
return {
isNetworkLoading: isNetworkLoading(state),
loadingMessage,
setProviderArgs,
provider,
providerId: getNetworkIdentifier(state),
};
};
2020-02-15 21:34:12 +01:00
const mapDispatchToProps = (dispatch) => {
return {
setProviderType: (type) => {
dispatch(actions.setProviderType(type));
},
rollbackToPreviousProvider: () =>
dispatch(actions.rollbackToPreviousProvider()),
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
};
};
2020-11-03 00:41:28 +01:00
export default connect(
mapStateToProps,
mapDispatchToProps,
)(LoadingNetworkScreen);