Skip to content

Commit

Permalink
fix: provider
Browse files Browse the repository at this point in the history
  • Loading branch information
whilefoo committed Oct 9, 2024
1 parent 394fea0 commit 3e6a1f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/get-fastest-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ function getHandler(networkId: number | string) {
networkName: null,
runtimeRpcs: null,
networkRpcs: null,
proxySettings: {
retryCount: 5,
},
};

return new RPCHandler(config as HandlerConstructorConfig);
Expand All @@ -18,8 +21,7 @@ function getHandler(networkId: number | string) {
export async function getFastestProvider(networkId: number | string): Promise<providers.JsonRpcProvider> {
try {
const handler = getHandler(networkId);
const provider = await handler.getFastestRpcProvider();
return new providers.JsonRpcProvider(provider.connection.url);
return await handler.getFastestRpcProvider();
} catch (e) {
throw new Error(`Failed to get fastest provider for networkId: ${networkId}`);
}
Expand Down

0 comments on commit 3e6a1f8

Please sign in to comment.