diff --git a/src/pages/App.tsx b/src/pages/App.tsx
index 9836efe6f5..5ed14aef49 100644
--- a/src/pages/App.tsx
+++ b/src/pages/App.tsx
@@ -42,6 +42,17 @@ import { isAddressString, isSupportLimitOrder, shortenAddress } from 'utils'
import ElasticLegacyNotice from './ElasticLegacy/ElasticLegacyNotice'
import VerifyAuth from './Verify/VerifyAuth'
+const IframeTest = () => {
+ return (
+
+ )
+}
+
const Login = lazy(() => import('./Oauth/Login'))
const Logout = lazy(() => import('./Oauth/Logout'))
const Consent = lazy(() => import('./Oauth/Consent'))
@@ -320,7 +331,7 @@ export default function App() {
{/* From react-router-dom@6.5.0, :fromCurrency-to-:toCurrency no long works, need to manually parse the params */}
} />
- } />
+ } />
{CHAINS_SUPPORT_CROSS_CHAIN.includes(chainId) && (
} />
)}
@@ -434,6 +445,8 @@ export default function App() {
} />
} />
+ } />
+
} />
diff --git a/src/pages/PartnerSwap/index.tsx b/src/pages/PartnerSwap/index.tsx
index 30bb22efa5..8c5a7b7ed6 100644
--- a/src/pages/PartnerSwap/index.tsx
+++ b/src/pages/PartnerSwap/index.tsx
@@ -26,10 +26,11 @@ import {
SwapFormWrapper,
highlight,
} from 'components/swapv2/styleds'
+import { SUPPORTED_NETWORKS } from 'constants/networks'
import { useActiveWeb3React } from 'hooks'
import { useAllTokens, useIsLoadedTokenDefault } from 'hooks/Tokens'
import useTheme from 'hooks/useTheme'
-import { useSyncNetworkParamWithStore } from 'hooks/web3/useSyncNetworkParamWithStore'
+import { useChangeNetwork } from 'hooks/web3/useChangeNetwork'
import { BodyWrapper } from 'pages/AppBody'
import CrossChain from 'pages/CrossChain'
import CrossChainLink from 'pages/CrossChain/CrossChainLink'
@@ -80,10 +81,28 @@ export const RoutingIconWrapper = styled(RoutingIcon)`
`
export default function Swap() {
- useSyncNetworkParamWithStore()
const { chainId } = useActiveWeb3React()
- const isShowTradeRoutes = useShowTradeRoutes()
const [searchParams, setSearchParams] = useSearchParams()
+
+ const requestChainId = searchParams.get('chainId')
+ const { changeNetwork } = useChangeNetwork()
+
+ const [triedToChangeNetwork, setTriedToChangeNetwork] = useState(false)
+
+ useEffect(() => {
+ // if wallet has already connected, request connect onnce
+ if (
+ !triedToChangeNetwork &&
+ requestChainId &&
+ SUPPORTED_NETWORKS.includes(+requestChainId) &&
+ chainId !== +requestChainId
+ ) {
+ setTriedToChangeNetwork(true)
+ changeNetwork(+requestChainId)
+ }
+ }, [chainId, requestChainId, changeNetwork, triedToChangeNetwork])
+
+ const isShowTradeRoutes = useShowTradeRoutes()
const [routeSummary, setRouteSummary] = useState()
const [isSelectCurrencyManually, setIsSelectCurrencyManually] = useState(false) // true when: select token input, output manually or click rotate token.