Compare commits

..

1 Commits

Author SHA1 Message Date
Nico 2cdd6aaf08 Update 'README.md' 2 years ago
  1. 14
      README.md
  2. 53
      app/scripts/first-time-state.js
  3. 49
      ui/components/app/dropdowns/network-dropdown.js
  4. 22
      ui/components/app/network-display/network-display.js
  5. 6
      ui/pages/settings/networks-tab/networks-list-item/networks-list-item.js
  6. 15
      ui/pages/settings/networks-tab/networks-tab.js

@ -1,16 +1,6 @@
# MetaMask Browser Extension
# CipherMask Browser Extension
You can find the latest version of MetaMask on [our official website](https://metamask.io/). For help using MetaMask, visit our [User Support Site](https://metamask.zendesk.com/hc/en-us).
For [general questions](https://community.metamask.io/c/learn/26), [feature requests](https://community.metamask.io/c/feature-requests-ideas/13), or [developer questions](https://community.metamask.io/c/developer-questions/11), visit our [Community Forum](https://community.metamask.io/).
MetaMask supports Firefox, Google Chrome, and Chromium-based browsers. We recommend using the latest available browser version.
For up to the minute news, follow our [Twitter](https://twitter.com/metamask) or [Medium](https://medium.com/metamask) pages.
To learn how to develop MetaMask-compatible applications, visit our [Developer Docs](https://metamask.github.io/metamask-docs/).
To learn how to contribute to the MetaMask project itself, visit our [Internal Docs](https://github.com/MetaMask/metamask-extension/tree/develop/docs).
A fork of MetaMask with Infura Removed
## Building locally

@ -4,14 +4,6 @@
* @property {object} NetworkController Network controller state
*/
import {
NETWORK_TYPES,
getRpcUrl,
TEST_NETWORK_TICKER_MAP,
CURRENCY_SYMBOLS,
CHAIN_IDS,
} from '../../shared/constants/network';
/**
* @type {FirstTimeState}
*/
@ -20,54 +12,11 @@ const initialState = {
PreferencesController: {
frequentRpcListDetail: [
{
label: NETWORK_TYPES.MAINNET,
nickname: 'Ethereum Mainnet',
iconColor: '#29B6AF',
providerType: NETWORK_TYPES.MAINNET,
rpcUrl: getRpcUrl({
network: NETWORK_TYPES.MAINNET,
excludeProjectId: true,
}),
chainId: CHAIN_IDS.MAINNET,
ticker: CURRENCY_SYMBOLS.ETH,
blockExplorerUrl: 'https://etherscan.io',
},
{
label: NETWORK_TYPES.GOERLI,
nickname: 'Georli test network',
iconColor: '#3099f2',
providerType: NETWORK_TYPES.GOERLI,
rpcUrl: getRpcUrl({
network: NETWORK_TYPES.GOERLI,
excludeProjectId: true,
}),
chainId: CHAIN_IDS.GOERLI,
ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.GOERLI],
blockExplorerUrl: 'https://goerli.etherscan.io',
},
{
label: NETWORK_TYPES.SEPOLIA,
nickname: 'Sepolia test network',
iconColor: '#CFB5F0',
providerType: NETWORK_TYPES.SEPOLIA,
rpcUrl: getRpcUrl({
network: NETWORK_TYPES.SEPOLIA,
excludeProjectId: true,
}),
chainId: CHAIN_IDS.SEPOLIA,
ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.SEPOLIA],
blockExplorerUrl: 'https://sepolia.etherscan.io',
},
{
label: 'Localhost 8545',
nickname: 'Localhost 8545',
rpcUrl: 'http://localhost:8545',
chainId: '0x539',
ticker: 'ETH',
iconColor: 'var(--color-icon-alternative)',
providerType: NETWORK_TYPES.LOCALHOST,
nickname: 'Localhost 8545',
rpcPrefs: {},
blockExplorerUrl: '',
},
],
},

@ -9,7 +9,6 @@ import { openAlert as displayInvalidCustomNetworkAlert } from '../../../ducks/al
import {
LOCALHOST_RPC_URL,
NETWORK_TYPES,
TEST_CHAINS,
} from '../../../../shared/constants/network';
import { isPrefixedFormattedHexString } from '../../../../shared/modules/network.utils';
@ -142,20 +141,11 @@ class NetworkDropdown extends Component {
);
}
renderCustomRpcList(rpcListDetail, provider, shouldShowTestNetworks) {
// const reversedRpcListDetail = rpcListDetail.slice().reverse();
renderCustomRpcList(rpcListDetail, provider, opts = {}) {
const reversedRpcListDetail = rpcListDetail.slice().reverse();
return rpcListDetail.filter((entry) => shouldShowTestNetworks ? true : !TEST_CHAINS.includes(entry.chainId)).map((entry) => {
const {
rpcUrl,
chainId,
ticker = 'ETH',
nickname = '',
providerType,
} = entry;
const isDefaultNetworks =
Object.values(NETWORK_TYPES).includes(providerType);
return reversedRpcListDetail.map((entry) => {
const { rpcUrl, chainId, ticker = 'ETH', nickname = '' } = entry;
const isCurrentRpcTarget =
provider.type === NETWORK_TYPES.RPC && rpcUrl === provider.rpcUrl;
@ -170,7 +160,11 @@ class NetworkDropdown extends Component {
this.props.displayInvalidCustomNetworkAlert(nickname || rpcUrl);
}
}}
style={DROP_DOWN_MENU_ITEM_STYLE}
style={{
fontSize: '16px',
lineHeight: '20px',
padding: '16px',
}}
>
{isCurrentRpcTarget ? (
<IconCheck color="var(--color-success-default)" />
@ -178,13 +172,13 @@ class NetworkDropdown extends Component {
<div className="network-check__transparent"></div>
)}
<ColorIndicator
color={isDefaultNetworks ? providerType : COLORS.ICON_MUTED}
color={opts.isLocalHost ? 'localhost' : COLORS.ICON_MUTED}
size={SIZES.LG}
type={ColorIndicator.TYPES.FILLED}
/>
<span
className="network-name-item"
data-testid={`${providerType ?? nickname}-network-item`}
data-testid={`${nickname}-network-item`}
style={{
color: isCurrentRpcTarget
? 'var(--color-text-default)'
@ -275,12 +269,12 @@ class NetworkDropdown extends Component {
hideTestNetMessage,
} = this.props;
const rpcListDetail = this.props.frequentRpcListDetail;
// const rpcListDetailWithoutLocalHost = rpcListDetail.filter(
// (rpc) => rpc.rpcUrl !== LOCALHOST_RPC_URL,
// );
// const rpcListDetailForLocalHost = rpcListDetail.filter(
// (rpc) => rpc.rpcUrl === LOCALHOST_RPC_URL,
// );
const rpcListDetailWithoutLocalHost = rpcListDetail.filter(
(rpc) => rpc.rpcUrl !== LOCALHOST_RPC_URL,
);
const rpcListDetailForLocalHost = rpcListDetail.filter(
(rpc) => rpc.rpcUrl === LOCALHOST_RPC_URL,
);
const isOpen = this.props.networkDropdownOpen;
const { t } = this.context;
@ -340,15 +334,14 @@ class NetworkDropdown extends Component {
</div>
<div className="network-dropdown-list">
{/* {this.renderNetworkEntry(NETWORK_TYPES.MAINNET)} */}
{this.renderNetworkEntry(NETWORK_TYPES.MAINNET)}
{this.renderCustomRpcList(
rpcListDetail,
rpcListDetailWithoutLocalHost,
this.props.provider,
shouldShowTestNetworks,
)}
{/* {shouldShowTestNetworks && (
{shouldShowTestNetworks && (
<>
{this.renderNetworkEntry(NETWORK_TYPES.GOERLI)}
{this.renderNetworkEntry(NETWORK_TYPES.SEPOLIA)}
@ -358,7 +351,7 @@ class NetworkDropdown extends Component {
{ isLocalHost: true },
)}
</>
)} */}
)}
</div>
{this.renderAddCustomButton()}

@ -5,7 +5,6 @@ import { useSelector } from 'react-redux';
import {
NETWORK_TYPES,
BUILT_IN_NETWORKS,
CHAIN_IDS,
} from '../../../../shared/constants/network';
import LoadingIndicator from '../../ui/loading-indicator';
@ -31,23 +30,11 @@ export default function NetworkDisplay({
const currentNetwork = useSelector((state) => ({
nickname: state.metamask.provider.nickname,
type: state.metamask.provider.type,
chainId: state.metamask.provider.chainId,
}));
let networkType;
if (currentNetwork.chainId === CHAIN_IDS.MAINNET) {
networkType = NETWORK_TYPES.MAINNET;
} else if (currentNetwork.chainId === CHAIN_IDS.GOERLI) {
networkType = NETWORK_TYPES.GOERLI;
} else if (currentNetwork.chainId === CHAIN_IDS.SEPOLIA) {
networkType = NETWORK_TYPES.SEPOLIA;
} else {
networkType = NETWORK_TYPES.RPC;
}
const t = useI18nContext();
const { nickname: networkNickname } = targetNetwork ?? currentNetwork;
const { nickname: networkNickname, type: networkType } =
targetNetwork ?? currentNetwork;
return (
<Chip
@ -81,7 +68,10 @@ export default function NetworkDisplay({
<IconCaretDown size={16} className="network-display__icon" />
) : null
}
label={networkNickname ?? t('privateNetwork')
label={
networkType === NETWORK_TYPES.RPC
? networkNickname ?? t('privateNetwork')
: t(networkType)
}
className={classnames('network-display', {
'network-display--disabled': disabled,

@ -115,9 +115,15 @@ const NetworksListItem = ({
className={classnames('networks-tab__networks-list-name', {
'networks-tab__networks-list-name--selected':
displayNetworkListItemAsSelected,
'networks-tab__networks-list-name--disabled':
currentProviderType !== NETWORK_TYPES.RPC &&
!displayNetworkListItemAsSelected,
})}
>
{label || t(labelKey)}
{currentProviderType !== NETWORK_TYPES.RPC && (
<LockIcon width="14px" height="17px" fill="var(--color-icon-muted)" />
)}
</div>
</div>
);

@ -26,6 +26,12 @@ import NetworksTabContent from './networks-tab-content';
import NetworksForm from './networks-form';
import NetworksFormSubheader from './networks-tab-subheader';
const defaultNetworks = defaultNetworksData.map((network) => ({
...network,
viewOnly: true,
isATestNetwork: TEST_CHAINS.includes(network.chainId),
}));
const NetworksTab = ({ addNewNetwork }) => {
const t = useI18nContext();
const dispatch = useDispatch();
@ -45,20 +51,19 @@ const NetworksTab = ({ addNewNetwork }) => {
const frequentRpcNetworkListDetails = frequentRpcListDetail.map((rpc) => {
return {
label: rpc.label,
iconColor: rpc.iconColor,
label: rpc.nickname,
iconColor: 'var(--color-icon-alternative)',
providerType: NETWORK_TYPES.RPC,
rpcUrl: rpc.rpcUrl,
chainId: rpc.chainId,
ticker: rpc.ticker,
blockExplorerUrl:
rpc.blockExplorerUrl ?? (rpc.rpcPrefs?.blockExplorerUrl || ''),
blockExplorerUrl: rpc.rpcPrefs?.blockExplorerUrl || '',
isATestNetwork: TEST_CHAINS.includes(rpc.chainId),
};
});
const networksToRender = [
// ...defaultNetworks,
...defaultNetworks,
...frequentRpcNetworkListDetails,
];
let selectedNetwork =

Loading…
Cancel
Save