diff --git a/src/components/walletconnect/HeaderWidget/index.tsx b/src/components/walletconnect/HeaderWidget/index.tsx index 8696f68b65..577f6e2770 100644 --- a/src/components/walletconnect/HeaderWidget/index.tsx +++ b/src/components/walletconnect/HeaderWidget/index.tsx @@ -63,6 +63,14 @@ const WalletConnectHeaderWidget = (): ReactElement => { return walletConnect.onSessionAdd(onSuccess) }, [onSuccess, walletConnect]) + useEffect(() => { + if (!walletConnect) { + return + } + + return walletConnect.onSessionReject(clearUri) + }, [clearUri, walletConnect]) + return ( <>
diff --git a/src/components/walletconnect/WcInput/index.tsx b/src/components/walletconnect/WcInput/index.tsx index 0c75abe0e5..f230109838 100644 --- a/src/components/walletconnect/WcInput/index.tsx +++ b/src/components/walletconnect/WcInput/index.tsx @@ -4,7 +4,7 @@ import type { ReactElement } from 'react' import { WalletConnectContext } from '@/services/walletconnect/WalletConnectContext' import { asError } from '@/services/exceptions/utils' -import { getClipboard } from '@/utils/clipboard' +import { getClipboard, isPastingSupported } from '@/utils/clipboard' import css from '../SessionList/styles.module.css' @@ -14,10 +14,6 @@ const WcInput = ({ uri }: { uri: string }): ReactElement => { const [error, setError] = useState() const [connecting, setConnecting] = useState(false) - // readText is not supported by Firefox - // @see https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText#browser_compatibility - const isFirefox = navigator?.userAgent.includes('Firefox') - const onInput = useCallback( async (uri: string) => { if (!walletConnect) return @@ -66,7 +62,7 @@ const WcInput = ({ uri }: { uri: string }): ReactElement => { label={error ? error.message : 'Pairing UI'} placeholder="wc:" InputProps={{ - endAdornment: isFirefox ? undefined : ( + endAdornment: isPastingSupported() ? undefined : (