Skip to content

Commit

Permalink
chore: adding multiple providers for getViemClient fn
Browse files Browse the repository at this point in the history
  • Loading branch information
AtelyPham committed Jul 29, 2023
1 parent 5637b61 commit 7f5058b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libs/web3-api-provider/src/utils/getViemClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parseTypedChainId } from '@webb-tools/sdk-core';
import { PublicClient, createPublicClient, http } from 'viem';
import { PublicClient, createPublicClient, fallback, http } from 'viem';
import {
VIEM_NOT_SUPPORTED_MULTICALL_CHAINS,
defineViemChain,
Expand All @@ -19,7 +19,9 @@ function getViemClient(typedChainId: number): PublicClient {
batch: {
multicall: !!chain.contracts?.multicall3,
},
transport: http(undefined, { timeout: 60_000 }),
transport: fallback(
chain.rpcUrls.public.http.map((url) => http(url, { timeout: 60_000 }))
),
});
}

Expand Down

0 comments on commit 7f5058b

Please sign in to comment.