Skip to content

Commit

Permalink
Default to mainnet on prod
Browse files Browse the repository at this point in the history
  • Loading branch information
mudrila committed Jan 25, 2024
1 parent 3be743e commit 02c854d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/providers/NetworkConfig/NetworkConfigProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ export const supportedChains: NetworkConfig[] = isProd()
export const disconnectedChain: Chain = supportedChains[0].wagmiChain;

const getNetworkConfig = (chainId: number) => {
return supportedChains.find(chain => chain.chainId === chainId) || goerliConfig;
return supportedChains.find(chain => chain.chainId === chainId) || isProd()
? mainnetConfig
: goerliConfig;
};

export function NetworkConfigProvider({ children }: { children: ReactNode }) {
const provider = useProvider();
const [config, setConfig] = useState<NetworkConfig>(getNetworkConfig(provider.network.chainId));
const [config, setConfig] = useState<NetworkConfig>(
getNetworkConfig(
provider.network.chainId || isProd() ? mainnetConfig.chainId : goerliConfig.chainId
)
);

useEffect(() => {
setConfig(getNetworkConfig(provider.network.chainId));
Expand Down

0 comments on commit 02c854d

Please sign in to comment.