Skip to content

Commit 9c2ffba

Browse files
committed
refactor: remove Infura
- Removed Infura API key references from .env.template, constants, and related files. - Updated CI workflow to exclude Infura API key. - Adjusted EvmClient to only use Alchemy and DRPC providers. - Updated tests to reflect the removal of Infura.
1 parent 882f8ac commit 9c2ffba

File tree

5 files changed

+4
-27
lines changed

5 files changed

+4
-27
lines changed

.env.template

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,5 @@ SENTRY_AUTH_TOKEN="" #disabled for local
3030
# https://www.alchemy.com/
3131
ALCHEMY_API_KEY=""
3232

33-
# https://www.infura.io/
34-
INFURA_API_KEY=""
35-
3633
# https://drpc.org/
3734
DRPC_API_KEY=""

.github/workflows/ci-test-unit.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818

1919
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
2020
DRPC_API_KEY: "test"
21-
INFURA_API_KEY: "test"
2221
FILECOIN_API_KEY: "test"
2322

2423
INDEXER_ENVIRONMENT: "test"

src/client/evmClient.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
alchemyApiKey,
3-
drpcApiPkey,
4-
infuraApiKey,
5-
} from "../utils/constants.js";
1+
import { alchemyApiKey, drpcApiPkey } from "../utils/constants.js";
62
import { PublicClient, createPublicClient, fallback } from "viem";
73
import { ChainFactory } from "./chainFactory.js";
84
import { RpcClientFactory } from "./rpcClientFactory.js";
@@ -17,6 +13,7 @@ class AlchemyProvider implements RpcProvider {
1713
const urls: Record<number, string> = {
1814
10: `https://opt-mainnet.g.alchemy.com/v2/${alchemyApiKey}`,
1915
8453: `https://base-mainnet.g.alchemy.com/v2/${alchemyApiKey}`,
16+
42220: `https://celo-mainnet.g.alchemy.com/v2/${alchemyApiKey}`,
2017
42161: `https://arb-mainnet.g.alchemy.com/v2/${alchemyApiKey}`,
2118
421614: `https://arb-sepolia.g.alchemy.com/v2/${alchemyApiKey}`,
2219
84532: `https://base-sepolia.g.alchemy.com/v2/${alchemyApiKey}`,
@@ -26,18 +23,6 @@ class AlchemyProvider implements RpcProvider {
2623
}
2724
}
2825

29-
class InfuraProvider implements RpcProvider {
30-
getUrl(chainId: number): string | undefined {
31-
const urls: Record<number, string> = {
32-
10: `https://optimism-mainnet.infura.io/v3/${infuraApiKey}`,
33-
42220: `https://celo-mainnet.infura.io/v3/${infuraApiKey}`,
34-
42161: `https://arbitrum-mainnet.infura.io/v3/${infuraApiKey}`,
35-
421614: `https://arbitrum-sepolia.infura.io/v3/${infuraApiKey}`,
36-
};
37-
return urls[chainId];
38-
}
39-
}
40-
4126
class DrpcProvider implements RpcProvider {
4227
getUrl(chainId: number): string | undefined {
4328
const networks: Record<number, string> = {
@@ -97,7 +82,6 @@ class LavaProvider implements RpcProvider {
9782
export class EvmClientFactory {
9883
private static readonly providers: RpcProvider[] = [
9984
new AlchemyProvider(),
100-
new InfuraProvider(),
10185
new DrpcProvider(),
10286
new GlifProvider(),
10387
new AnkrProvider(),

src/utils/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const web3upKey = getRequiredEnvVar("KEY", "WEB3UP Key");
1616
export const web3upProof = getRequiredEnvVar("PROOF", "WEB3UP Proof");
1717
export const indexerEnvironment = getRequiredEnvVar("INDEXER_ENVIRONMENT");
1818
export const alchemyApiKey = getRequiredEnvVar("ALCHEMY_API_KEY");
19-
export const infuraApiKey = getRequiredEnvVar("INFURA_API_KEY");
2019
export const drpcApiPkey = getRequiredEnvVar("DRPC_API_KEY");
2120
export const cachingDatabaseUrl = getRequiredEnvVar("CACHING_DATABASE_URL");
2221
export const dataDatabaseUrl = getRequiredEnvVar("DATA_DATABASE_URL");

test/client/evmClient.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { RpcClientFactory } from "../../src/client/rpcClientFactory.js";
66
vi.mock("@/utils/constants", () => ({
77
indexerEnvironment: "test",
88
alchemyApiKey: "mock-alchemy-key",
9-
infuraApiKey: "mock-infura-key",
109
drpcApiPkey: "mock-drpc-key",
1110
filecoinApiKey: "mock-filecoin-key",
1211
Environment: { TEST: "test", PROD: "prod" },
@@ -59,10 +58,9 @@ describe("EvmClientFactory", () => {
5958
expect(sepoliaUrls[0]).toContain("alchemy.com");
6059

6160
const opUrls = EvmClientFactory.getAllAvailableUrls(10);
62-
expect(opUrls).toHaveLength(3); // Alchemy, Infura, DRPC for Optimism
61+
expect(opUrls).toHaveLength(2); // Alchemy, DRPC for Optimism
6362
expect(opUrls[0]).toContain("alchemy.com");
64-
expect(opUrls[1]).toContain("infura.io");
65-
expect(opUrls[2]).toContain("drpc.org");
63+
expect(opUrls[1]).toContain("drpc.org");
6664
});
6765

6866
it("returns empty array for unsupported chain", () => {

0 commit comments

Comments
 (0)