2021-02-04 19:15:23 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { compose } from 'redux';
|
2023-03-09 22:00:28 +01:00
|
|
|
import { pickBy } from 'lodash';
|
2021-10-28 21:31:05 +02:00
|
|
|
import Button from '../../ui/button';
|
2021-02-04 19:15:23 +01:00
|
|
|
import * as actions from '../../../store/actions';
|
|
|
|
import { openAlert as displayInvalidCustomNetworkAlert } from '../../../ducks/alerts/invalid-custom-network';
|
2021-11-22 17:24:42 +01:00
|
|
|
import {
|
|
|
|
LOCALHOST_RPC_URL,
|
2022-09-14 16:55:31 +02:00
|
|
|
NETWORK_TYPES,
|
2021-11-22 17:24:42 +01:00
|
|
|
} from '../../../../shared/constants/network';
|
2021-04-28 21:53:59 +02:00
|
|
|
import { isPrefixedFormattedHexString } from '../../../../shared/modules/network.utils';
|
2020-10-29 00:10:41 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
import ColorIndicator from '../../ui/color-indicator';
|
2023-02-02 21:15:26 +01:00
|
|
|
import { IconColor, Size } from '../../../helpers/constants/design-system';
|
2021-10-28 21:31:05 +02:00
|
|
|
import { getShowTestNetworks } from '../../../selectors';
|
|
|
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
|
|
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app';
|
2022-08-16 18:39:23 +02:00
|
|
|
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
2021-11-08 21:58:23 +01:00
|
|
|
import {
|
2022-06-30 18:19:07 +02:00
|
|
|
ADD_POPULAR_CUSTOM_NETWORK,
|
2021-11-08 21:58:23 +01:00
|
|
|
ADVANCED_ROUTE,
|
|
|
|
} from '../../../helpers/constants/routes';
|
2023-02-27 17:42:02 +01:00
|
|
|
import {
|
|
|
|
Icon,
|
|
|
|
ButtonIcon,
|
|
|
|
ICON_NAMES,
|
|
|
|
ICON_SIZES,
|
|
|
|
} from '../../component-library';
|
2021-03-16 22:00:08 +01:00
|
|
|
import { Dropdown, DropdownMenuItem } from './dropdown';
|
2017-12-01 23:19:53 +01:00
|
|
|
|
|
|
|
// classes from nodes of the toggle element.
|
|
|
|
const notToggleElementClassnames = [
|
|
|
|
'menu-icon',
|
|
|
|
'network-name',
|
|
|
|
'network-indicator',
|
|
|
|
'network-caret',
|
|
|
|
'network-component',
|
2021-03-11 00:43:34 +01:00
|
|
|
'modal-container__footer-button',
|
2021-02-04 19:15:23 +01:00
|
|
|
];
|
2017-08-13 19:49:41 +02:00
|
|
|
|
2021-01-27 17:51:59 +01:00
|
|
|
const DROP_DOWN_MENU_ITEM_STYLE = {
|
|
|
|
fontSize: '16px',
|
|
|
|
lineHeight: '20px',
|
2022-03-16 15:49:25 +01:00
|
|
|
padding: '16px',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2021-01-27 17:51:59 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function mapStateToProps(state) {
|
2017-08-13 19:49:41 +02:00
|
|
|
return {
|
2017-08-13 22:15:21 +02:00
|
|
|
provider: state.metamask.provider,
|
2021-10-28 21:31:05 +02:00
|
|
|
shouldShowTestNetworks: getShowTestNetworks(state),
|
2023-03-09 22:00:28 +01:00
|
|
|
networkConfigurations: state.metamask.networkConfigurations,
|
2017-08-13 22:15:21 +02:00
|
|
|
networkDropdownOpen: state.appState.networkDropdownOpen,
|
2021-11-16 23:22:01 +01:00
|
|
|
showTestnetMessageInDropdown: state.metamask.showTestnetMessageInDropdown,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2017-08-13 19:49:41 +02:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function mapDispatchToProps(dispatch) {
|
2017-08-13 19:49:41 +02:00
|
|
|
return {
|
2017-08-13 22:15:21 +02:00
|
|
|
setProviderType: (type) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(actions.setProviderType(type));
|
2017-08-13 22:15:21 +02:00
|
|
|
},
|
2023-03-09 22:00:28 +01:00
|
|
|
setActiveNetwork: (networkConfigurationId) => {
|
|
|
|
dispatch(actions.setActiveNetwork(networkConfigurationId));
|
2017-08-13 22:15:21 +02:00
|
|
|
},
|
2017-12-01 23:19:53 +01:00
|
|
|
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
|
2020-10-06 19:57:02 +02:00
|
|
|
displayInvalidCustomNetworkAlert: (networkName) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(displayInvalidCustomNetworkAlert(networkName));
|
2020-10-06 19:57:02 +02:00
|
|
|
},
|
2020-10-30 20:22:21 +01:00
|
|
|
showConfirmDeleteNetworkModal: ({ target, onConfirm }) => {
|
2020-11-03 00:41:28 +01:00
|
|
|
return dispatch(
|
|
|
|
actions.showModal({
|
|
|
|
name: 'CONFIRM_DELETE_NETWORK',
|
|
|
|
target,
|
|
|
|
onConfirm,
|
|
|
|
}),
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-10-30 20:22:21 +01:00
|
|
|
},
|
2021-11-18 22:14:03 +01:00
|
|
|
hideTestNetMessage: () => actions.hideTestNetMessage(),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2017-08-13 19:49:41 +02:00
|
|
|
}
|
|
|
|
|
2020-01-10 15:03:47 +01:00
|
|
|
class NetworkDropdown extends Component {
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2017-08-13 19:49:41 +02:00
|
|
|
|
2020-01-10 15:03:47 +01:00
|
|
|
static propTypes = {
|
|
|
|
provider: PropTypes.shape({
|
2020-02-24 19:54:35 +01:00
|
|
|
nickname: PropTypes.string,
|
2020-10-06 19:57:02 +02:00
|
|
|
rpcUrl: PropTypes.string,
|
2020-01-10 15:03:47 +01:00
|
|
|
type: PropTypes.string,
|
|
|
|
ticker: PropTypes.string,
|
|
|
|
}).isRequired,
|
|
|
|
setProviderType: PropTypes.func.isRequired,
|
2023-03-09 22:00:28 +01:00
|
|
|
setActiveNetwork: PropTypes.func.isRequired,
|
2020-01-10 15:03:47 +01:00
|
|
|
hideNetworkDropdown: PropTypes.func.isRequired,
|
2023-03-09 22:00:28 +01:00
|
|
|
networkConfigurations: PropTypes.object.isRequired,
|
2021-10-28 21:31:05 +02:00
|
|
|
shouldShowTestNetworks: PropTypes.bool,
|
2020-01-10 15:03:47 +01:00
|
|
|
networkDropdownOpen: PropTypes.bool.isRequired,
|
2020-10-06 19:57:02 +02:00
|
|
|
displayInvalidCustomNetworkAlert: PropTypes.func.isRequired,
|
2020-10-30 20:22:21 +01:00
|
|
|
showConfirmDeleteNetworkModal: PropTypes.func.isRequired,
|
2021-11-08 21:58:23 +01:00
|
|
|
showTestnetMessageInDropdown: PropTypes.bool.isRequired,
|
|
|
|
hideTestNetMessage: PropTypes.func.isRequired,
|
2021-10-28 21:31:05 +02:00
|
|
|
history: PropTypes.object,
|
2022-12-08 17:42:23 +01:00
|
|
|
dropdownStyles: PropTypes.object,
|
|
|
|
hideElementsForOnboarding: PropTypes.bool,
|
|
|
|
onAddClick: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2017-08-13 19:49:41 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
handleClick(newProviderType) {
|
|
|
|
const {
|
|
|
|
provider: { type: providerType },
|
|
|
|
setProviderType,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = this.props;
|
2022-03-29 15:46:24 +02:00
|
|
|
const { trackEvent } = this.context;
|
2018-03-29 17:00:44 +02:00
|
|
|
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent({
|
2022-04-22 18:09:10 +02:00
|
|
|
category: EVENT.CATEGORIES.NAVIGATION,
|
2022-08-16 18:39:23 +02:00
|
|
|
event: EVENT_NAMES.NAV_NETWORK_SWITCHED,
|
2022-03-29 15:46:24 +02:00
|
|
|
properties: {
|
2022-08-16 18:39:23 +02:00
|
|
|
from_network: providerType,
|
|
|
|
to_network: newProviderType,
|
2020-01-10 15:03:47 +01:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
setProviderType(newProviderType);
|
2020-01-10 15:03:47 +01:00
|
|
|
}
|
2017-08-13 22:18:08 +02:00
|
|
|
|
2021-10-28 21:31:05 +02:00
|
|
|
renderAddCustomButton() {
|
2022-12-08 17:42:23 +01:00
|
|
|
const { onAddClick } = this.props;
|
2021-10-28 21:31:05 +02:00
|
|
|
return (
|
2022-03-16 15:49:25 +01:00
|
|
|
<div className="network__add-network-button">
|
|
|
|
<Button
|
|
|
|
type="secondary"
|
|
|
|
onClick={() => {
|
2022-12-08 17:42:23 +01:00
|
|
|
if (onAddClick) {
|
|
|
|
onAddClick();
|
|
|
|
} else {
|
|
|
|
getEnvironmentType() === ENVIRONMENT_TYPE_POPUP
|
|
|
|
? global.platform.openExtensionInBrowser(
|
|
|
|
ADD_POPULAR_CUSTOM_NETWORK,
|
|
|
|
)
|
|
|
|
: this.props.history.push(ADD_POPULAR_CUSTOM_NETWORK);
|
|
|
|
}
|
2022-03-16 15:49:25 +01:00
|
|
|
this.props.hideNetworkDropdown();
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.context.t('addNetwork')}
|
|
|
|
</Button>
|
|
|
|
</div>
|
2021-10-28 21:31:05 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-03-09 22:00:28 +01:00
|
|
|
renderCustomRpcList(networkConfigurations, provider, opts = {}) {
|
|
|
|
return Object.entries(networkConfigurations).map(
|
|
|
|
([networkConfigurationId, networkConfiguration]) => {
|
|
|
|
const { rpcUrl, chainId, nickname = '', id } = networkConfiguration;
|
|
|
|
const isCurrentRpcTarget =
|
|
|
|
provider.type === NETWORK_TYPES.RPC && rpcUrl === provider.rpcUrl;
|
|
|
|
return (
|
|
|
|
<DropdownMenuItem
|
|
|
|
key={`common${rpcUrl}`}
|
|
|
|
closeMenu={() => this.props.hideNetworkDropdown()}
|
|
|
|
onClick={() => {
|
|
|
|
if (isPrefixedFormattedHexString(chainId)) {
|
|
|
|
this.props.setActiveNetwork(networkConfigurationId);
|
|
|
|
} else {
|
|
|
|
this.props.displayInvalidCustomNetworkAlert(nickname || rpcUrl);
|
|
|
|
}
|
|
|
|
}}
|
2020-01-10 15:03:47 +01:00
|
|
|
style={{
|
2023-03-09 22:00:28 +01:00
|
|
|
fontSize: '16px',
|
|
|
|
lineHeight: '20px',
|
|
|
|
padding: '16px',
|
2020-01-10 15:03:47 +01:00
|
|
|
}}
|
|
|
|
>
|
2023-03-09 22:00:28 +01:00
|
|
|
{isCurrentRpcTarget ? (
|
|
|
|
<Icon name={ICON_NAMES.CHECK} color={IconColor.successDefault} />
|
|
|
|
) : (
|
|
|
|
<div className="network-check__transparent">✓</div>
|
|
|
|
)}
|
|
|
|
<ColorIndicator
|
|
|
|
color={opts.isLocalHost ? 'localhost' : IconColor.iconMuted}
|
|
|
|
size={Size.LG}
|
|
|
|
type={ColorIndicator.TYPES.FILLED}
|
2020-11-03 00:41:28 +01:00
|
|
|
/>
|
2023-03-09 22:00:28 +01:00
|
|
|
<span
|
|
|
|
className="network-name-item"
|
|
|
|
data-testid={`${nickname}-network-item`}
|
|
|
|
style={{
|
|
|
|
color: isCurrentRpcTarget
|
|
|
|
? 'var(--color-text-default)'
|
|
|
|
: 'var(--color-text-alternative)',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{nickname || rpcUrl}
|
|
|
|
</span>
|
|
|
|
{isCurrentRpcTarget ? null : (
|
|
|
|
<ButtonIcon
|
|
|
|
className="delete"
|
|
|
|
iconName={ICON_NAMES.CLOSE}
|
|
|
|
size={ICON_SIZES.SM}
|
|
|
|
ariaLabel={this.context.t('delete')}
|
|
|
|
onClick={(e) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
this.props.showConfirmDeleteNetworkModal({
|
|
|
|
target: id,
|
|
|
|
onConfirm: () => undefined,
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</DropdownMenuItem>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
2020-01-10 15:03:47 +01:00
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
getNetworkName() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { provider } = this.props;
|
|
|
|
const providerName = provider.type;
|
2022-09-21 22:10:34 +02:00
|
|
|
const { t } = this.context;
|
2017-08-13 19:49:41 +02:00
|
|
|
|
2022-09-21 22:10:34 +02:00
|
|
|
switch (providerName) {
|
|
|
|
case NETWORK_TYPES.MAINNET:
|
|
|
|
return t('mainnet');
|
|
|
|
case NETWORK_TYPES.GOERLI:
|
|
|
|
return t('goerli');
|
|
|
|
case NETWORK_TYPES.SEPOLIA:
|
|
|
|
return t('sepolia');
|
|
|
|
case NETWORK_TYPES.LOCALHOST:
|
|
|
|
return t('localhost');
|
|
|
|
default:
|
|
|
|
return provider.nickname || t('unknownNetwork');
|
2020-01-10 15:03:47 +01:00
|
|
|
}
|
2017-08-13 19:49:41 +02:00
|
|
|
}
|
|
|
|
|
2021-01-27 17:51:59 +01:00
|
|
|
renderNetworkEntry(network) {
|
|
|
|
const {
|
|
|
|
provider: { type: providerType },
|
2021-02-04 19:15:23 +01:00
|
|
|
} = this.props;
|
2021-01-27 17:51:59 +01:00
|
|
|
return (
|
|
|
|
<DropdownMenuItem
|
|
|
|
key={network}
|
|
|
|
closeMenu={this.props.hideNetworkDropdown}
|
|
|
|
onClick={() => this.handleClick(network)}
|
|
|
|
style={DROP_DOWN_MENU_ITEM_STYLE}
|
|
|
|
>
|
|
|
|
{providerType === network ? (
|
2023-02-23 14:19:28 +01:00
|
|
|
<Icon name={ICON_NAMES.CHECK} color={IconColor.successDefault} />
|
2021-01-27 17:51:59 +01:00
|
|
|
) : (
|
|
|
|
<div className="network-check__transparent">✓</div>
|
|
|
|
)}
|
|
|
|
<ColorIndicator
|
|
|
|
color={network}
|
2023-02-02 21:15:26 +01:00
|
|
|
size={Size.LG}
|
2021-01-27 17:51:59 +01:00
|
|
|
type={ColorIndicator.TYPES.FILLED}
|
|
|
|
/>
|
|
|
|
<span
|
|
|
|
className="network-name-item"
|
2022-08-03 22:30:43 +02:00
|
|
|
data-testid={`${network}-network-item`}
|
2021-01-27 17:51:59 +01:00
|
|
|
style={{
|
2022-03-16 15:49:25 +01:00
|
|
|
color:
|
|
|
|
providerType === network
|
|
|
|
? 'var(--color-text-default)'
|
|
|
|
: 'var(--color-text-alternative)',
|
2021-01-27 17:51:59 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.context.t(network)}
|
|
|
|
</span>
|
|
|
|
</DropdownMenuItem>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2021-01-27 17:51:59 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2021-11-08 21:58:23 +01:00
|
|
|
const {
|
|
|
|
history,
|
2022-12-08 17:42:23 +01:00
|
|
|
hideElementsForOnboarding,
|
2021-11-08 21:58:23 +01:00
|
|
|
hideNetworkDropdown,
|
|
|
|
shouldShowTestNetworks,
|
|
|
|
showTestnetMessageInDropdown,
|
|
|
|
hideTestNetMessage,
|
2023-03-09 22:00:28 +01:00
|
|
|
networkConfigurations,
|
2021-11-08 21:58:23 +01:00
|
|
|
} = this.props;
|
2023-03-09 22:00:28 +01:00
|
|
|
|
|
|
|
const rpcListDetailWithoutLocalHost = pickBy(
|
|
|
|
networkConfigurations,
|
|
|
|
(config) => config.rpcUrl !== LOCALHOST_RPC_URL,
|
2021-11-22 17:24:42 +01:00
|
|
|
);
|
2023-03-09 22:00:28 +01:00
|
|
|
const rpcListDetailForLocalHost = pickBy(
|
|
|
|
networkConfigurations,
|
|
|
|
(config) => config.rpcUrl === LOCALHOST_RPC_URL,
|
2021-11-22 17:24:42 +01:00
|
|
|
);
|
2023-03-09 22:00:28 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const isOpen = this.props.networkDropdownOpen;
|
2021-11-08 21:58:23 +01:00
|
|
|
const { t } = this.context;
|
2017-08-13 19:49:41 +02:00
|
|
|
|
2020-01-10 15:03:47 +01:00
|
|
|
return (
|
|
|
|
<Dropdown
|
|
|
|
isOpen={isOpen}
|
|
|
|
onClickOutside={(event) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { classList } = event.target;
|
|
|
|
const isInClassList = (className) => classList.contains(className);
|
2022-07-31 20:26:40 +02:00
|
|
|
const notToggleElementIndex =
|
|
|
|
notToggleElementClassnames.findIndex(isInClassList);
|
2018-08-19 19:25:33 +02:00
|
|
|
|
2020-01-10 15:03:47 +01:00
|
|
|
if (notToggleElementIndex === -1) {
|
2021-02-04 19:15:23 +01:00
|
|
|
event.stopPropagation();
|
2021-11-08 21:58:23 +01:00
|
|
|
hideNetworkDropdown();
|
2020-01-10 15:03:47 +01:00
|
|
|
}
|
|
|
|
}}
|
|
|
|
containerClassName="network-droppo"
|
|
|
|
zIndex={55}
|
2022-12-08 17:42:23 +01:00
|
|
|
style={
|
|
|
|
this.props.dropdownStyles || {
|
|
|
|
position: 'absolute',
|
|
|
|
top: '58px',
|
|
|
|
width: '309px',
|
|
|
|
zIndex: '55',
|
|
|
|
}
|
|
|
|
}
|
2020-01-10 15:03:47 +01:00
|
|
|
innerStyle={{
|
2022-03-16 15:49:25 +01:00
|
|
|
padding: '16px 0',
|
2020-01-10 15:03:47 +01:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
<div className="network-dropdown-header">
|
2022-12-08 17:42:23 +01:00
|
|
|
{hideElementsForOnboarding ? null : (
|
|
|
|
<div className="network-dropdown-title">{t('networks')}</div>
|
|
|
|
)}
|
|
|
|
{hideElementsForOnboarding ? null : (
|
|
|
|
<div className="network-dropdown-divider" />
|
|
|
|
)}
|
|
|
|
{showTestnetMessageInDropdown && !hideElementsForOnboarding ? (
|
2021-11-08 21:58:23 +01:00
|
|
|
<div className="network-dropdown-content">
|
2021-11-16 21:32:40 +01:00
|
|
|
{t('toggleTestNetworks', [
|
2021-11-08 21:58:23 +01:00
|
|
|
<a
|
|
|
|
href="#"
|
|
|
|
key="advancedSettingsLink"
|
|
|
|
className="network-dropdown-content--link"
|
|
|
|
onClick={(e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
hideNetworkDropdown();
|
2021-11-16 01:00:23 +01:00
|
|
|
history.push(`${ADVANCED_ROUTE}#show-testnets`);
|
2021-11-08 21:58:23 +01:00
|
|
|
}}
|
|
|
|
>
|
2021-11-16 21:32:40 +01:00
|
|
|
{t('showHide')}
|
2021-11-08 21:58:23 +01:00
|
|
|
</a>,
|
|
|
|
])}
|
2022-03-16 15:49:25 +01:00
|
|
|
<Button
|
2021-11-08 21:58:23 +01:00
|
|
|
onClick={hideTestNetMessage}
|
2021-11-16 21:32:40 +01:00
|
|
|
className="network-dropdown-content--dismiss"
|
|
|
|
>
|
|
|
|
{t('dismiss')}
|
2022-03-16 15:49:25 +01:00
|
|
|
</Button>
|
2021-11-08 21:58:23 +01:00
|
|
|
</div>
|
|
|
|
) : null}
|
2020-01-10 15:03:47 +01:00
|
|
|
</div>
|
2021-01-27 17:51:59 +01:00
|
|
|
|
2021-11-15 21:19:14 +01:00
|
|
|
<div className="network-dropdown-list">
|
2022-09-21 22:10:34 +02:00
|
|
|
{this.renderNetworkEntry(NETWORK_TYPES.MAINNET)}
|
2021-10-28 21:31:05 +02:00
|
|
|
|
2021-11-22 17:24:42 +01:00
|
|
|
{this.renderCustomRpcList(
|
|
|
|
rpcListDetailWithoutLocalHost,
|
|
|
|
this.props.provider,
|
|
|
|
)}
|
2021-11-15 21:19:14 +01:00
|
|
|
|
2022-01-05 20:04:34 +01:00
|
|
|
{shouldShowTestNetworks && (
|
|
|
|
<>
|
2022-09-21 22:10:34 +02:00
|
|
|
{this.renderNetworkEntry(NETWORK_TYPES.GOERLI)}
|
|
|
|
{this.renderNetworkEntry(NETWORK_TYPES.SEPOLIA)}
|
2022-01-05 20:04:34 +01:00
|
|
|
{this.renderCustomRpcList(
|
|
|
|
rpcListDetailForLocalHost,
|
|
|
|
this.props.provider,
|
|
|
|
{ isLocalHost: true },
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)}
|
2021-11-08 21:58:23 +01:00
|
|
|
</div>
|
2021-10-28 21:31:05 +02:00
|
|
|
|
|
|
|
{this.renderAddCustomButton()}
|
2020-01-10 15:03:47 +01:00
|
|
|
</Dropdown>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2017-08-13 19:49:41 +02:00
|
|
|
}
|
|
|
|
}
|
2020-01-10 15:03:47 +01:00
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2020-07-14 17:20:41 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2021-02-04 19:15:23 +01:00
|
|
|
)(NetworkDropdown);
|