File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ class AlchemyProvider implements RpcProvider {
2121 }
2222}
2323
24+ class AnkrProvider implements RpcProvider {
25+ getUrl ( chainId : number ) : string | undefined {
26+ const urls : Record < number , string > = {
27+ 42220 : `https://rpc.ankr.com/celo` ,
28+ } ;
29+ return urls [ chainId ] ;
30+ }
31+ }
32+
2433class InfuraProvider implements RpcProvider {
2534 getUrl ( chainId : number ) : string | undefined {
2635 const urls : Record < number , string > = {
@@ -62,6 +71,7 @@ class GlifProvider implements RpcProvider {
6271export class EvmClientFactory {
6372 private static readonly providers : RpcProvider [ ] = [
6473 new AlchemyProvider ( ) ,
74+ new AnkrProvider ( ) ,
6575 new InfuraProvider ( ) ,
6676 new DrpcProvider ( ) ,
6777 new GlifProvider ( ) ,
Original file line number Diff line number Diff line change @@ -71,10 +71,7 @@ describe("EvmClient", () => {
7171
7272 expect (
7373 vi . mocked ( UnifiedRpcClientFactory . createViemTransport ) ,
74- ) . toHaveBeenCalledWith (
75- 10 ,
76- expect . stringContaining ( "alchemy.com" ) ,
77- ) ;
74+ ) . toHaveBeenCalledWith ( 10 , expect . stringContaining ( "alchemy.com" ) ) ;
7875 expect (
7976 vi . mocked ( UnifiedRpcClientFactory . createViemTransport ) ,
8077 ) . toHaveBeenCalledWith ( 10 , expect . stringContaining ( "infura.io" ) ) ;
@@ -158,10 +155,9 @@ describe("RPC Providers", () => {
158155 expect ( url ) . toContain ( "alchemy-key" ) ;
159156 } ) ;
160157
161- it ( "should return Infura URL when Alchemy is not available" , ( ) => {
158+ it ( "should return Ankr URL when Alchemy is not available" , ( ) => {
162159 const url = getRpcUrl ( 42220 ) ; // Celo
163- expect ( url ) . toContain ( "infura.io" ) ;
164- expect ( url ) . toContain ( "infura-key" ) ;
160+ expect ( url ) . toContain ( "ankr.com" ) ;
165161 } ) ;
166162
167163 it ( "should return Glif URL for Filecoin" , ( ) => {
You can’t perform that action at this time.
0 commit comments