Skip to content

Commit

Permalink
fix: cant select ethereum on wrong network modal
Browse files Browse the repository at this point in the history
  • Loading branch information
namgold committed Sep 14, 2023
1 parent 0f929f4 commit 4dca3c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/web3/useChangeNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { useLazyKyberswapConfig } from '../useKyberSwapConfig'

let latestChainId: ChainId
export function useChangeNetwork() {
const { chainId, walletEVM, walletSolana } = useActiveWeb3React()
const { chainId, walletEVM, walletSolana, isWrongNetwork } = useActiveWeb3React()
const { connector, library } = useWeb3React()
const fetchKyberswapConfig = useLazyKyberswapConfig()

Expand Down Expand Up @@ -234,7 +234,7 @@ export function useChangeNetwork() {
const wrappedSuccessCallback = () =>
successCallback(desiredChainId, waitUtilUpdatedChainId, customSuccessCallback)
// if connected, nothing todo, success return
if (desiredChainId === chainId) {
if (desiredChainId === chainId && !isWrongNetwork) {
customSuccessCallback?.()
return
}
Expand Down

0 comments on commit 4dca3c2

Please sign in to comment.