Skip to content

Commit

Permalink
fix(website): add custom default rpcs (#1604)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjlescano authored Dec 27, 2024
1 parent 80e47ea commit e43b388
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion packages/website/src/providers/CannonProvidersProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ const cannonNetwork = {
name: 'Cannon',
} as viem.Chain;

// Some chains have default rpc urls that don't work properly with interact on the website.
// We use custom rpc urls for these chains.
const customDefaultRpcs: Record<number, viem.Chain['rpcUrls']> = {
[`${chains.sepolia.id}`]: {
default: {
http: ['https://gateway.tenderly.co/public/sepolia'],
},
},
};

// Service urls taken from https://docs.safe.global/learn/safe-core/safe-core-api/available-services
// shortNames taken from https://github.com/ethereum-lists/chains/blob/master/_data/chains
// export const chains = [
Expand Down Expand Up @@ -126,7 +136,16 @@ export const chainMetadata = {
},
} as const;

export const supportedChains = [cannonNetwork, ...Object.values(chains)];
export const supportedChains = [cannonNetwork, ...Object.values(chains)].map(
(c) => {
if (!customDefaultRpcs[`${c.id}`]) return c;

return {
...c,
rpcUrls: customDefaultRpcs[`${c.id}`],
};
}
);

export const defaultTransports = supportedChains.reduce((transports, chain) => {
transports[chain.id] = viem.http();
Expand Down

0 comments on commit e43b388

Please sign in to comment.