Skip to content

Commit

Permalink
chore: fix supported network check for Sepolia (#3581)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 authored Jan 8, 2024
1 parent e1f9054 commit 6428f65
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useMemo } from 'react'

import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { useWeb3React } from '@web3-react/core'

Expand All @@ -7,9 +9,13 @@ export function useIsProviderNetworkUnsupported(): boolean {
const { chainId } = useWeb3React()
const { isSepoliaEnabled } = useFeatureFlags()

if (chainId === SupportedChainId.SEPOLIA && !isSepoliaEnabled) {
return true
}
return useMemo(() => {
if (!chainId) return false

if (chainId === SupportedChainId.SEPOLIA) {
return !isSepoliaEnabled
}

return !!chainId && !(chainId in SupportedChainId)
return !(chainId in SupportedChainId)
}, [chainId, isSepoliaEnabled])
}
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/src/cow-react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ function Main() {
<Web3Provider>
<ThemeProvider>
<ThemedGlobalStyle />
<WalletUnsupportedNetworkBanner />
<BlockNumberProvider>
<WithLDProvider>
<WalletUnsupportedNetworkBanner />
<Updaters />

{!isInjectedWidgetMode && (
Expand Down

0 comments on commit 6428f65

Please sign in to comment.