Skip to content

Commit

Permalink
fix: provide fallback rpcs (#2303)
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem authored Jan 3, 2025
1 parent 25803d9 commit 954284d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ui-config/wagmiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
networkConfigs,
} from 'src/utils/marketsAndNetworksConfig';
import { type Chain } from 'viem';
import { createConfig, CreateConfigParameters, injected } from 'wagmi';
import { createConfig, CreateConfigParameters, http, injected } from 'wagmi';
import {
arbitrum,
arbitrumSepolia,
Expand Down Expand Up @@ -88,9 +88,17 @@ const cypressConfig = createConfig(
})
);

const getTransport = (chainId: number) => {
return networkConfigs[chainId].publicJsonRPCUrl[0];
};

const buildTransports = (chains: CreateConfigParameters['chains']) =>
Object.fromEntries(chains.map((chain) => [chain.id, http(getTransport(chain.id))]));

const prodConfig = createConfig(
getDefaultConfig({
chains: ENABLE_TESTNET ? testnetChains : prodChains,
transports: ENABLE_TESTNET ? undefined : buildTransports(prodChains),
...defaultConfig,
})
);
Expand Down

1 comment on commit 954284d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.