Skip to content

Commit aee7eb9

Browse files
authored
Merge pull request #513 from hypercerts-org/chore/deprecate-infura
chore: deprecate infura
2 parents 5f1241a + 78d3c9e commit aee7eb9

File tree

4 files changed

+4
-26
lines changed

4 files changed

+4
-26
lines changed

.env.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ NEXT_PUBLIC_ENVIRONMENT=test
22
NEXT_PUBLIC_WC_PROJECT_ID=<placeholder wc project id>
33
NEXT_PUBLIC_ALCHEMY_API_KEY="mock-alchemy-key"
44
NEXT_PUBLIC_DRPC_API_PKEY="mock-drpc-key"
5-
NEXT_PUBLIC_INFURA_API_KEY="mock-infura-key"
65
NEXT_PUBLIC_FILECOIN_API_KEY="mock-filecoin-key"

configs/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,4 @@ export const hypercertApiSigningDomainSafe = (
6767

6868
export const alchemyApiKey = process.env.NEXT_PUBLIC_ALCHEMY_API_KEY;
6969
export const drpcApiPkey = process.env.NEXT_PUBLIC_DRPC_API_PKEY;
70-
export const infuraApiKey = process.env.NEXT_PUBLIC_INFURA_API_KEY;
7170
export const filecoinApiKey = process.env.NEXT_PUBLIC_FILECOIN_API_KEY;

lib/evmClient.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { alchemyApiKey, drpcApiPkey, infuraApiKey } from "@/configs/constants";
1+
import { alchemyApiKey, drpcApiPkey } from "@/configs/constants";
22
import { PublicClient, createPublicClient, fallback } from "viem";
33
import { ChainFactory } from "./chainFactory";
44
import { UnifiedRpcClientFactory } from "./rpcClientFactory";
@@ -15,26 +15,14 @@ class AlchemyProvider implements RpcProvider {
1515
8453: `https://base-mainnet.g.alchemy.com/v2/${alchemyApiKey}`,
1616
42161: `https://arb-mainnet.g.alchemy.com/v2/${alchemyApiKey}`,
1717
421614: `https://arb-sepolia.g.alchemy.com/v2/${alchemyApiKey}`,
18+
42220: `https://celo-mainnet.g.alchemy.com/v2/${alchemyApiKey}`,
1819
84532: `https://base-sepolia.g.alchemy.com/v2/${alchemyApiKey}`,
1920
11155111: `https://eth-sepolia.g.alchemy.com/v2/${alchemyApiKey}`,
2021
};
2122
return urls[chainId];
2223
}
2324
}
2425

25-
class InfuraProvider implements RpcProvider {
26-
getUrl(chainId: number): string | undefined {
27-
if (!infuraApiKey) return undefined;
28-
const urls: Record<number, string> = {
29-
10: `https://optimism-mainnet.infura.io/v3/${infuraApiKey}`,
30-
42220: `https://celo-mainnet.infura.io/v3/${infuraApiKey}`,
31-
42161: `https://arbitrum-mainnet.infura.io/v3/${infuraApiKey}`,
32-
421614: `https://arbitrum-sepolia.infura.io/v3/${infuraApiKey}`,
33-
};
34-
return urls[chainId];
35-
}
36-
}
37-
3826
class DrpcProvider implements RpcProvider {
3927
getUrl(chainId: number): string | undefined {
4028
if (!drpcApiPkey) return undefined;
@@ -84,7 +72,6 @@ export class EvmClientFactory {
8472
private static readonly providers: RpcProvider[] = [
8573
new AlchemyProvider(),
8674
new AnkrProvider(),
87-
new InfuraProvider(),
8875
new FVMProvider(),
8976
new DrpcProvider(),
9077
];

test/lib/evmClient.test.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { describe, expect, it, vi } from "vitest";
33
vi.mock("@/utils/constants", () => ({
44
environment: "test",
55
alchemyApiKey: "mock-alchemy-key",
6-
infuraApiKey: "mock-infura-key",
76
drpcApiPkey: "mock-drpc-key",
87
filecoinApiKey: "mock-filecoin-key",
98
Environment: { TEST: "test", PROD: "prod" },
@@ -42,10 +41,9 @@ describe("EvmClient", () => {
4241
expect(sepoliaUrls[0]).toContain("alchemy.com");
4342

4443
const opUrls = EvmClientFactory.getAllAvailableUrls(10);
45-
expect(opUrls).toHaveLength(3); // Alchemy, Infura, DRPC for Optimism
44+
expect(opUrls).toHaveLength(2); // Alchemy, DRPC for Optimism
4645
expect(opUrls[0]).toContain("alchemy.com");
47-
expect(opUrls[1]).toContain("infura.io");
48-
expect(opUrls[2]).toContain("drpc.org");
46+
expect(opUrls[1]).toContain("drpc.org");
4947
});
5048

5149
it("returns empty array for unsupported chain", () => {
@@ -90,11 +88,6 @@ describe("RPC Providers", () => {
9088
expect(url).toContain("alchemy-key");
9189
});
9290

93-
it("should return Ankr URL when Alchemy is not available", () => {
94-
const url = EvmClientFactory.getRpcUrl(42220); // Celo
95-
expect(url).toContain("ankr.com");
96-
});
97-
9891
it("should return ankr.com URL for Filecoin", () => {
9992
const url = EvmClientFactory.getRpcUrl(314159);
10093
expect(url).toContain("https://rpc.ankr.com/");

0 commit comments

Comments
 (0)