diff --git a/src/components/walletconnect/WcInput/index.tsx b/src/components/walletconnect/WcInput/index.tsx index fcfa32a919..125695708d 100644 --- a/src/components/walletconnect/WcInput/index.tsx +++ b/src/components/walletconnect/WcInput/index.tsx @@ -79,7 +79,9 @@ const WcInput = ({ uri }: { uri: string }) => { error={!!error} label={error ? error.message : 'Pairing code'} placeholder="wc:" + spellCheck={false} InputProps={{ + autoComplete: 'off', endAdornment: isClipboardSupported() ? undefined : ( diff --git a/src/config/routes.ts b/src/config/routes.ts index 6090dbb7ad..27402a440f 100644 --- a/src/config/routes.ts +++ b/src/config/routes.ts @@ -1,7 +1,7 @@ export const AppRoutes = { '404': '/404', - _offline: '/_offline', welcome: '/welcome', + wc: '/wc', terms: '/terms', privacy: '/privacy', licenses: '/licenses', @@ -11,6 +11,7 @@ export const AppRoutes = { cookie: '/cookie', addressBook: '/address-book', addOwner: '/addOwner', + _offline: '/_offline', apps: { open: '/apps/open', index: '/apps', diff --git a/src/pages/wc.tsx b/src/pages/wc.tsx new file mode 100644 index 0000000000..02c41159db --- /dev/null +++ b/src/pages/wc.tsx @@ -0,0 +1,40 @@ +import { useEffect } from 'react' +import type { NextPage } from 'next' +import { useRouter } from 'next/router' +import useLastSafe from '@/hooks/useLastSafe' +import { AppRoutes } from '@/config/routes' +import { WC_URI_SEARCH_PARAM } from '@/services/walletconnect/useWalletConnectSearchParamUri' + +const WcPage: NextPage = () => { + const router = useRouter() + const lastSafe = useLastSafe() + + useEffect(() => { + if (!router.isReady || router.pathname !== AppRoutes.wc) { + return + } + + const { uri } = router.query + + router.replace( + lastSafe + ? { + pathname: AppRoutes.home, + query: { + safe: lastSafe, + [WC_URI_SEARCH_PARAM]: uri, + }, + } + : { + pathname: AppRoutes.welcome, + query: { + [WC_URI_SEARCH_PARAM]: uri, + }, + }, + ) + }, [router, lastSafe]) + + return <> +} + +export default WcPage diff --git a/src/services/walletconnect/constants.ts b/src/services/walletconnect/constants.ts index 435b964832..2206a0069c 100644 --- a/src/services/walletconnect/constants.ts +++ b/src/services/walletconnect/constants.ts @@ -36,8 +36,6 @@ export const EIP155 = 'eip155' as const // Bridges enforcing same address on destination chains export const BlockedBridges = [ 'app.chainport.io', - 'bridge.arbitrum.io', - 'bridge.base.org', 'cbridge.celer.network', 'www.orbiter.finance', 'zksync-era.l2scan.co', @@ -66,6 +64,8 @@ export const BlockedBridges = [ export const WarnedBridges = [ 'across.to', // doesn't send their URL in the session proposal 'app.allbridge.io', + 'bridge.arbitrum.io', + 'bridge.base.org', 'core.allbridge.io', 'bungee.exchange', 'www.carrier.so', diff --git a/src/services/walletconnect/useWalletConnectSearchParamUri.ts b/src/services/walletconnect/useWalletConnectSearchParamUri.ts index d21a1bc14a..41ed350120 100644 --- a/src/services/walletconnect/useWalletConnectSearchParamUri.ts +++ b/src/services/walletconnect/useWalletConnectSearchParamUri.ts @@ -1,16 +1,11 @@ import { useRouter } from 'next/router' import { useCallback } from 'react' -import { isPairingUri } from './utils' - -const WC_URI_SEARCH_PARAM = 'wc' +export const WC_URI_SEARCH_PARAM = 'wc' export function useWalletConnectSearchParamUri(): [string | null, (wcUri: string | null) => void] { const router = useRouter() - - const wcUriQuery = router.query[WC_URI_SEARCH_PARAM] - const value = wcUriQuery ? (Array.isArray(wcUriQuery) ? wcUriQuery[0] : wcUriQuery) : null - const wcUri = value && isPairingUri(value) ? value : null + const wcUri = (router.query[WC_URI_SEARCH_PARAM] || '').toString() || null const setWcUri = useCallback( (wcUri: string | null) => {