From ede338d29279654873f0f8677d6e09ca2e41686f Mon Sep 17 00:00:00 2001 From: Anxo Rodriguez Date: Tue, 7 Nov 2023 14:58:15 +0000 Subject: [PATCH] fix: fix issue with RPC env (#3353) --- libs/common-const/src/networks.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/common-const/src/networks.ts b/libs/common-const/src/networks.ts index cb31e100ff..d3a0cc8189 100644 --- a/libs/common-const/src/networks.ts +++ b/libs/common-const/src/networks.ts @@ -3,6 +3,12 @@ import { JsonRpcProvider } from '@ethersproject/providers' const INFURA_KEY = process.env.REACT_APP_INFURA_KEY || '2af29cd5ac554ae3b8d991afe1ba4b7d' // Default rate-limited infura key (should be overridden, not reliable to use) +const RPC_URL_ENVS: Record = { + [SupportedChainId.MAINNET]: process.env.REACT_APP_NETWORK_URL_1 || undefined, + [SupportedChainId.GNOSIS_CHAIN]: process.env.REACT_APP_NETWORK_URL_100 || undefined, + [SupportedChainId.GOERLI]: process.env.REACT_APP_NETWORK_URL_5 || undefined, +} + const DEFAULT_RPC_URL: Record = { [SupportedChainId.MAINNET]: { url: `https://mainnet.infura.io/v3/${INFURA_KEY}`, usesInfura: true }, [SupportedChainId.GNOSIS_CHAIN]: { url: `https://rpc.gnosis.gateway.fm`, usesInfura: false }, @@ -22,7 +28,7 @@ export const MAINNET_PROVIDER = new JsonRpcProvider(RPC_URLS[SupportedChainId.MA function getRpcUrl(chainId: SupportedChainId): string { const envKey = `REACT_APP_NETWORK_URL_${chainId}` - const rpcUrl = process.env[envKey] + const rpcUrl = RPC_URL_ENVS[chainId] if (rpcUrl) { return rpcUrl