Skip to content

Commit

Permalink
fix: chain mismatched (#2583)
Browse files Browse the repository at this point in the history
* fix: chain mismatched

* fix: chain mismatched

* fix: chain mismatched
  • Loading branch information
viet-nv authored Jan 24, 2025
1 parent 351b0cd commit 5082841
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useEffect, useMemo, useRef } from 'react'
import { useSelector } from 'react-redux'
import { useSearchParams } from 'react-router-dom'
import blackjackApi from 'services/blackjack'
import { useAccount as useAccountWagmi } from 'wagmi'

import { MOCK_ACCOUNT_EVM } from 'constants/env'
import { isSupportedChainId } from 'constants/networks'
Expand All @@ -22,7 +23,8 @@ export function useActiveWeb3React(): {
} {
const [searchParams] = useSearchParams()
const rawChainIdState = useSelector<AppState, ChainId>(state => state.user.chainId) || ChainId.MAINNET
const isWrongNetwork = !isSupportedChainId(rawChainIdState)
const { chainId } = useAccountWagmi()
const isWrongNetwork = !!chainId && !isSupportedChainId(chainId)
const { connector } = useAccount()
const chainIdState = isWrongNetwork ? ChainId.MAINNET : rawChainIdState

Expand Down

0 comments on commit 5082841

Please sign in to comment.