From 4dca3c2c6c0c473aa7d87842e88195cae0cecf45 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Thu, 14 Sep 2023 18:08:09 +0700 Subject: [PATCH 1/2] fix: cant select ethereum on wrong network modal --- src/hooks/web3/useChangeNetwork.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index f9f8437e99..be40b293c3 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -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() @@ -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 } From 29f0098050d80f31823e6627409649d0d2b25ef7 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 18 Sep 2023 14:34:54 +0700 Subject: [PATCH 2/2] fix lint --- src/hooks/web3/useChangeNetwork.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index be40b293c3..156adef803 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -298,6 +298,7 @@ export function useChangeNetwork() { successCallback, failureCallback, addNewNetwork, + isWrongNetwork, ], )