1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 13:47:06 +01:00
metamask-extension/ui/pages/settings/networks-tab/networks-tab.constants.js
ryanml a75092762f
Fix built-in networks switch-ethereum-chain, Including RPC url in switchEthereumChain requestData (#11268)
* Moving RPC Urls to network constants

* Including RPC url in switchEthereumChain requestData

* Setting project id to var

* Fix built-in networks switch-ethereum-chain

`switch-ethereum-chain` did not work correctly with built-in networks.
It was treating them as custom networks, rather than as built-in
networks. This affected how they were displayed in the network
dropdown, and resulted in slight differences to the network stack used
as well.

The problem was that `updateRpcTarget` was used, which was meant for
custom networks only. Now that `setProviderType` is used in the case of
a built-in network, the behaviour should match the network switcher
exactly.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-06-09 15:18:38 -07:00

68 lines
1.4 KiB
JavaScript

import {
GOERLI,
GOERLI_CHAIN_ID,
GOERLI_RPC_URL,
KOVAN,
KOVAN_CHAIN_ID,
KOVAN_RPC_URL,
MAINNET,
MAINNET_CHAIN_ID,
MAINNET_RPC_URL,
RINKEBY,
RINKEBY_CHAIN_ID,
RINKEBY_RPC_URL,
ROPSTEN,
ROPSTEN_CHAIN_ID,
ROPSTEN_RPC_URL,
} from '../../../../shared/constants/network';
const defaultNetworksData = [
{
labelKey: MAINNET,
iconColor: '#29B6AF',
providerType: MAINNET,
rpcUrl: MAINNET_RPC_URL,
chainId: MAINNET_CHAIN_ID,
ticker: 'ETH',
blockExplorerUrl: 'https://etherscan.io',
},
{
labelKey: ROPSTEN,
iconColor: '#FF4A8D',
providerType: ROPSTEN,
rpcUrl: ROPSTEN_RPC_URL,
chainId: ROPSTEN_CHAIN_ID,
ticker: 'ETH',
blockExplorerUrl: 'https://ropsten.etherscan.io',
},
{
labelKey: RINKEBY,
iconColor: '#F6C343',
providerType: RINKEBY,
rpcUrl: RINKEBY_RPC_URL,
chainId: RINKEBY_CHAIN_ID,
ticker: 'ETH',
blockExplorerUrl: 'https://rinkeby.etherscan.io',
},
{
labelKey: GOERLI,
iconColor: '#3099f2',
providerType: GOERLI,
rpcUrl: GOERLI_RPC_URL,
chainId: GOERLI_CHAIN_ID,
ticker: 'ETH',
blockExplorerUrl: 'https://goerli.etherscan.io',
},
{
labelKey: KOVAN,
iconColor: '#9064FF',
providerType: KOVAN,
rpcUrl: KOVAN_RPC_URL,
chainId: KOVAN_CHAIN_ID,
ticker: 'ETH',
blockExplorerUrl: 'https://kovan.etherscan.io',
},
];
export { defaultNetworksData };