mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
remove infura project_id from networks form field (#13539)
* remove infura project_id from networks form field
This commit is contained in:
parent
59b0ae4b40
commit
7148607906
@ -41,14 +41,14 @@ export const GOERLI_DISPLAY_NAME = 'Goerli';
|
|||||||
export const LOCALHOST_DISPLAY_NAME = 'Localhost 8545';
|
export const LOCALHOST_DISPLAY_NAME = 'Localhost 8545';
|
||||||
|
|
||||||
const infuraProjectId = process.env.INFURA_PROJECT_ID;
|
const infuraProjectId = process.env.INFURA_PROJECT_ID;
|
||||||
const getRpcUrl = (network) =>
|
export const getRpcUrl = ({ network, excludeProjectId = false }) =>
|
||||||
`https://${network}.infura.io/v3/${infuraProjectId}`;
|
`https://${network}.infura.io/v3/${excludeProjectId ? '' : infuraProjectId}`;
|
||||||
|
|
||||||
export const ROPSTEN_RPC_URL = getRpcUrl('ropsten');
|
export const ROPSTEN_RPC_URL = getRpcUrl({ network: ROPSTEN });
|
||||||
export const RINKEBY_RPC_URL = getRpcUrl('rinkeby');
|
export const RINKEBY_RPC_URL = getRpcUrl({ network: RINKEBY });
|
||||||
export const KOVAN_RPC_URL = getRpcUrl('kovan');
|
export const KOVAN_RPC_URL = getRpcUrl({ network: KOVAN });
|
||||||
export const MAINNET_RPC_URL = getRpcUrl('mainnet');
|
export const MAINNET_RPC_URL = getRpcUrl({ network: MAINNET });
|
||||||
export const GOERLI_RPC_URL = getRpcUrl('goerli');
|
export const GOERLI_RPC_URL = getRpcUrl({ network: GOERLI });
|
||||||
export const LOCALHOST_RPC_URL = 'http://localhost:8545';
|
export const LOCALHOST_RPC_URL = 'http://localhost:8545';
|
||||||
|
|
||||||
export const ETH_SYMBOL = 'ETH';
|
export const ETH_SYMBOL = 'ETH';
|
||||||
|
@ -75,8 +75,7 @@ describe('Stores custom RPC history', function () {
|
|||||||
await driver.press('#password', driver.Key.ENTER);
|
await driver.press('#password', driver.Key.ENTER);
|
||||||
|
|
||||||
// duplicate network
|
// duplicate network
|
||||||
const duplicateRpcUrl =
|
const duplicateRpcUrl = 'https://mainnet.infura.io/v3/';
|
||||||
'https://mainnet.infura.io/v3/00000000000000000000000000000000';
|
|
||||||
|
|
||||||
await driver.clickElement('.network-display');
|
await driver.clickElement('.network-display');
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { fireEvent, screen } from '@testing-library/react';
|
|||||||
import nock from 'nock';
|
import nock from 'nock';
|
||||||
import { renderWithProvider } from '../../../../../test/jest/rendering';
|
import { renderWithProvider } from '../../../../../test/jest/rendering';
|
||||||
import { defaultNetworksData } from '../networks-tab.constants';
|
import { defaultNetworksData } from '../networks-tab.constants';
|
||||||
import { MAINNET_RPC_URL } from '../../../../../shared/constants/network';
|
import { MAINNET, getRpcUrl } from '../../../../../shared/constants/network';
|
||||||
import NetworksForm from '.';
|
import NetworksForm from '.';
|
||||||
|
|
||||||
const renderComponent = (props) => {
|
const renderComponent = (props) => {
|
||||||
@ -169,7 +169,9 @@ describe('NetworkForm Component', () => {
|
|||||||
expect(await screen.findByText('Invalid RPC URL')).toBeInTheDocument();
|
expect(await screen.findByText('Invalid RPC URL')).toBeInTheDocument();
|
||||||
|
|
||||||
await fireEvent.change(rpcUrlField, {
|
await fireEvent.change(rpcUrlField, {
|
||||||
target: { value: MAINNET_RPC_URL },
|
target: {
|
||||||
|
value: getRpcUrl({ network: MAINNET, excludeProjectId: true }),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
|
@ -1,19 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
GOERLI,
|
GOERLI,
|
||||||
GOERLI_CHAIN_ID,
|
GOERLI_CHAIN_ID,
|
||||||
GOERLI_RPC_URL,
|
|
||||||
KOVAN,
|
KOVAN,
|
||||||
KOVAN_CHAIN_ID,
|
KOVAN_CHAIN_ID,
|
||||||
KOVAN_RPC_URL,
|
|
||||||
MAINNET,
|
MAINNET,
|
||||||
MAINNET_CHAIN_ID,
|
MAINNET_CHAIN_ID,
|
||||||
MAINNET_RPC_URL,
|
|
||||||
RINKEBY,
|
RINKEBY,
|
||||||
RINKEBY_CHAIN_ID,
|
RINKEBY_CHAIN_ID,
|
||||||
RINKEBY_RPC_URL,
|
|
||||||
ROPSTEN,
|
ROPSTEN,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
ROPSTEN_RPC_URL,
|
getRpcUrl,
|
||||||
} from '../../../../shared/constants/network';
|
} from '../../../../shared/constants/network';
|
||||||
|
|
||||||
const defaultNetworksData = [
|
const defaultNetworksData = [
|
||||||
@ -21,7 +17,7 @@ const defaultNetworksData = [
|
|||||||
labelKey: MAINNET,
|
labelKey: MAINNET,
|
||||||
iconColor: '#29B6AF',
|
iconColor: '#29B6AF',
|
||||||
providerType: MAINNET,
|
providerType: MAINNET,
|
||||||
rpcUrl: MAINNET_RPC_URL,
|
rpcUrl: getRpcUrl({ network: MAINNET, excludeProjectId: true }),
|
||||||
chainId: MAINNET_CHAIN_ID,
|
chainId: MAINNET_CHAIN_ID,
|
||||||
ticker: 'ETH',
|
ticker: 'ETH',
|
||||||
blockExplorerUrl: 'https://etherscan.io',
|
blockExplorerUrl: 'https://etherscan.io',
|
||||||
@ -30,7 +26,7 @@ const defaultNetworksData = [
|
|||||||
labelKey: ROPSTEN,
|
labelKey: ROPSTEN,
|
||||||
iconColor: '#FF4A8D',
|
iconColor: '#FF4A8D',
|
||||||
providerType: ROPSTEN,
|
providerType: ROPSTEN,
|
||||||
rpcUrl: ROPSTEN_RPC_URL,
|
rpcUrl: getRpcUrl({ network: ROPSTEN, excludeProjectId: true }),
|
||||||
chainId: ROPSTEN_CHAIN_ID,
|
chainId: ROPSTEN_CHAIN_ID,
|
||||||
ticker: 'ETH',
|
ticker: 'ETH',
|
||||||
blockExplorerUrl: 'https://ropsten.etherscan.io',
|
blockExplorerUrl: 'https://ropsten.etherscan.io',
|
||||||
@ -39,7 +35,7 @@ const defaultNetworksData = [
|
|||||||
labelKey: RINKEBY,
|
labelKey: RINKEBY,
|
||||||
iconColor: '#F6C343',
|
iconColor: '#F6C343',
|
||||||
providerType: RINKEBY,
|
providerType: RINKEBY,
|
||||||
rpcUrl: RINKEBY_RPC_URL,
|
rpcUrl: getRpcUrl({ network: RINKEBY, excludeProjectId: true }),
|
||||||
chainId: RINKEBY_CHAIN_ID,
|
chainId: RINKEBY_CHAIN_ID,
|
||||||
ticker: 'ETH',
|
ticker: 'ETH',
|
||||||
blockExplorerUrl: 'https://rinkeby.etherscan.io',
|
blockExplorerUrl: 'https://rinkeby.etherscan.io',
|
||||||
@ -48,7 +44,7 @@ const defaultNetworksData = [
|
|||||||
labelKey: GOERLI,
|
labelKey: GOERLI,
|
||||||
iconColor: '#3099f2',
|
iconColor: '#3099f2',
|
||||||
providerType: GOERLI,
|
providerType: GOERLI,
|
||||||
rpcUrl: GOERLI_RPC_URL,
|
rpcUrl: getRpcUrl({ network: GOERLI, excludeProjectId: true }),
|
||||||
chainId: GOERLI_CHAIN_ID,
|
chainId: GOERLI_CHAIN_ID,
|
||||||
ticker: 'ETH',
|
ticker: 'ETH',
|
||||||
blockExplorerUrl: 'https://goerli.etherscan.io',
|
blockExplorerUrl: 'https://goerli.etherscan.io',
|
||||||
@ -57,7 +53,7 @@ const defaultNetworksData = [
|
|||||||
labelKey: KOVAN,
|
labelKey: KOVAN,
|
||||||
iconColor: '#9064FF',
|
iconColor: '#9064FF',
|
||||||
providerType: KOVAN,
|
providerType: KOVAN,
|
||||||
rpcUrl: KOVAN_RPC_URL,
|
rpcUrl: getRpcUrl({ network: KOVAN, excludeProjectId: true }),
|
||||||
chainId: KOVAN_CHAIN_ID,
|
chainId: KOVAN_CHAIN_ID,
|
||||||
ticker: 'ETH',
|
ticker: 'ETH',
|
||||||
blockExplorerUrl: 'https://kovan.etherscan.io',
|
blockExplorerUrl: 'https://kovan.etherscan.io',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user