1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-05 07:24:56 +01:00
metamask-extension/ui/components/app/loading-network-screen/loading-network-screen.container.js
ryanml 0bc1eeaf37
Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989)
* Deprecating Rinkeby, setting default debug network to Goerli

* Deprecating Ropsten and Kovan

* Conflict fix

* Remove unused localization, test fixes

* Add migration for moving used deprecated testnets to custom networks

* Fix migrator test

* Add more unit tests

* Migration updates provider type to rpc if deprecated network is selected

* Migration fully and correctly updates the provider if selected network is a deprecated testnet

* Continue to show deprecation warning on each of rinkeby, ropsten and kovan

* Add rpcUrl deprecation message to loading screen

* Removing mayBeFauceting prop

Co-authored-by: Dan Miller <danjm.com@gmail.com>
2022-09-28 20:26:01 -07:00

50 lines
1.5 KiB
JavaScript

import { connect } from 'react-redux';
import { NETWORK_TYPES } from '../../../../shared/constants/network';
import * as actions from '../../../store/actions';
import { getNetworkIdentifier, isNetworkLoading } from '../../../selectors';
import LoadingNetworkScreen from './loading-network-screen.component';
const DEPRECATED_TEST_NET_CHAINIDS = ['0x3', '0x2a', '0x4'];
const mapStateToProps = (state) => {
const { loadingMessage } = state.appState;
const { provider } = state.metamask;
const { rpcUrl, chainId, ticker, nickname, type } = provider;
const setProviderArgs =
type === NETWORK_TYPES.RPC
? [rpcUrl, chainId, ticker, nickname]
: [provider.type];
const providerChainId = provider?.chainId;
const isDeprecatedNetwork =
DEPRECATED_TEST_NET_CHAINIDS.includes(providerChainId);
const isInfuraRpcUrl = provider?.rpcUrl?.match('infura');
const showDeprecatedRpcUrlWarning = isDeprecatedNetwork && isInfuraRpcUrl;
return {
isNetworkLoading: isNetworkLoading(state),
loadingMessage,
setProviderArgs,
provider,
providerId: getNetworkIdentifier(state),
showDeprecatedRpcUrlWarning,
};
};
const mapDispatchToProps = (dispatch) => {
return {
setProviderType: (type) => {
dispatch(actions.setProviderType(type));
},
rollbackToPreviousProvider: () =>
dispatch(actions.rollbackToPreviousProvider()),
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
};
};
export default connect(
mapStateToProps,
mapDispatchToProps,
)(LoadingNetworkScreen);