Skip to content

Commit

Permalink
feat(rpc): add new RPC providers for Filecoin networks
Browse files Browse the repository at this point in the history
Adds Ankr, ChainUp, and Lava RPC providers to the EvmClientFactory for improved Filecoin network connectivity
  • Loading branch information
Jipperism committed Feb 20, 2025
1 parent 1f3beb6 commit d4863b7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/client/evmClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,45 @@ class GlifProvider implements RpcProvider {
}
}

class AnkrProvider implements RpcProvider {
getUrl(chainId: number): string | undefined {
const urls: Record<number, string> = {
314: "https://rpc.ankr.com/filecoin",
314159: "https://rpc.ankr.com/filecoin_testnet",
};
return urls[chainId];
}
}

class ChainUpProvider implements RpcProvider {
getUrl(chainId: number): string | undefined {
const urls: Record<number, string> = {
314: "https://filecoin.chainup.net/rpc/v1",
314159: "https://filecoin-calibration.chainup.net/rpc/v1",
};
return urls[chainId];
}
}

class LavaProvider implements RpcProvider {
getUrl(chainId: number): string | undefined {
const urls: Record<number, string> = {
314: "https://filecoin.lava.build",
314159: "https://filecoin-testnet.lava.build",
};
return urls[chainId];
}
}

export class EvmClientFactory {
private static readonly providers: RpcProvider[] = [
new AlchemyProvider(),
new InfuraProvider(),
new DrpcProvider(),
new GlifProvider(),
new AnkrProvider(),
new ChainUpProvider(),
new LavaProvider(),
];

static createViemClient(chainId: number): PublicClient {
Expand Down

0 comments on commit d4863b7

Please sign in to comment.