refactor: abstract into DEFAULT_INFURA_ID

This commit is contained in:
Ben Kremer 2022-02-14 16:58:57 +01:00
parent ca5b9674d7
commit 9172b368b9
3 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,4 @@
REACT_APP_PROJECT_ID=39bc93c4affb2e20cb6f8d36ca107dd9
REACT_APP_INFURA_ID=5dc0df...
REACT_APP_RELAY_URL=wss://relay.dev.walletconnect.com

View File

@ -21,6 +21,8 @@ export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS];
export const DEFAULT_PROJECT_ID = process.env.REACT_APP_PROJECT_ID;
export const DEFAULT_INFURA_ID = process.env.REACT_APP_INFURA_ID;
export const DEFAULT_RELAY_URL = process.env.REACT_APP_RELAY_URL;
export const DEFAULT_EIP155_METHODS = ["eth_sendTransaction", "personal_sign", "eth_signTypedData"];

View File

@ -10,7 +10,12 @@ import {
useMemo,
useState,
} from "react";
import { DEFAULT_LOGGER, DEFAULT_PROJECT_ID, DEFAULT_RELAY_URL } from "../constants";
import {
DEFAULT_INFURA_ID,
DEFAULT_LOGGER,
DEFAULT_PROJECT_ID,
DEFAULT_RELAY_URL,
} from "../constants";
import { ERROR } from "@walletconnect/utils";
import EthereumProvider from "@walletconnect/ethereum-provider";
import { providers, utils } from "ethers";
@ -138,7 +143,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
const ethereumProvider = new EthereumProvider({
chainId: Number(chainId),
rpc: {
infuraId: "5dc0df7abe4645dfb06a9a8c39ede422",
infuraId: DEFAULT_INFURA_ID,
},
// FIXME: `signer-connection` sub-dep is already specifying beta.23 -> typings mismatch.
// @ts-ignore