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.
Tag:
Branch:
Tree:
ca343f3198
develop
feature/default_network_editable
v10.22.3
${ noResults }
41 lines
1.2 KiB
41 lines
1.2 KiB
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';
|
|||
|
|
||
|
const mapStateToProps = (state) => {
|
||
const { loadingMessage } = state.appState;
|
|||
const { provider } = state.metamask;
|
|||
const { rpcUrl, chainId, ticker, nickname, type } = provider;
|
|||
|
|
||
|
const setProviderArgs =
|
||
type === NETWORK_TYPE_RPC
|
|||
? [rpcUrl, chainId, ticker, nickname]
|
|||
: [provider.type];
|
|||
|
|
||
return {
|
|||
isNetworkLoading: isNetworkLoading(state),
|
|||
|
loadingMessage,
|
||
setProviderArgs,
|
|||
provider,
|
|||
providerId: getNetworkIdentifier(state),
|
|||
};
|
|||
};
|
|||
|
|
||
|
const mapDispatchToProps = (dispatch) => {
|
||
|
return {
|
||
setProviderType: (type) => {
|
|||
dispatch(actions.setProviderType(type));
|
|||
|
},
|
||
rollbackToPreviousProvider: () =>
|
|||
dispatch(actions.rollbackToPreviousProvider()),
|
|||
|
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
|
||
};
|
|||
};
|
|||
|
|
||
|
export default connect(
|
||
mapStateToProps,
|
|||
mapDispatchToProps,
|
|||
)(LoadingNetworkScreen);
|