1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

fix(18709): fix error when switching to linea testnet using wallet_sw… (#18710)

* fix(18709): fix error when switching to linea testnet using wallet_switchEthereumChain

* fix: update condition to get network config
This commit is contained in:
Victorien Gauch 2023-04-28 14:34:10 +02:00 committed by GitHub
parent 26f0cbe293
commit 7f585a19b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ import {
NETWORK_TO_NAME_MAP,
CHAIN_ID_TO_RPC_URL_MAP,
CURRENCY_SYMBOLS,
NETWORK_TYPES,
BUILT_IN_INFURA_NETWORKS,
} from '../../../../../shared/constants/network';
import {
isPrefixedFormattedHexString,
@ -27,7 +27,11 @@ const switchEthereumChain = {
export default switchEthereumChain;
function findExistingNetwork(chainId, findNetworkConfigurationBy) {
if (chainId in CHAIN_ID_TO_TYPE_MAP) {
if (
Object.values(BUILT_IN_INFURA_NETWORKS)
.map(({ chainId: id }) => id)
.includes(chainId)
) {
return {
chainId,
ticker: CURRENCY_SYMBOLS.ETH,
@ -109,9 +113,9 @@ async function switchEthereumChainHandler(
requestData,
});
if (
chainId in CHAIN_ID_TO_TYPE_MAP &&
approvedRequestData.type !== NETWORK_TYPES.LOCALHOST &&
approvedRequestData.type !== NETWORK_TYPES.LINEA_TESTNET
Object.values(BUILT_IN_INFURA_NETWORKS)
.map(({ chainId: id }) => id)
.includes(chainId)
) {
await setProviderType(approvedRequestData.type);
} else {