From ddcdf5ec1bfedd8adfab37a646e4aed0b0d48f67 Mon Sep 17 00:00:00 2001 From: katspaugh Date: Mon, 23 Oct 2023 11:32:34 +0200 Subject: [PATCH] Handle pair errors --- src/components/walletconnect/WcInput/index.tsx | 2 +- src/components/walletconnect/index.tsx | 9 ++++++--- src/services/walletconnect/WalletConnectWallet.ts | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/walletconnect/WcInput/index.tsx b/src/components/walletconnect/WcInput/index.tsx index 6279fbb42a..692ae64d80 100644 --- a/src/components/walletconnect/WcInput/index.tsx +++ b/src/components/walletconnect/WcInput/index.tsx @@ -24,11 +24,11 @@ const WcInput = ({ uri }: { uri: string }) => { try { await walletConnect.connect(val) - setValue('') } catch (e) { setError(asError(e)) } + setValue('') setConnecting(false) }, [walletConnect], diff --git a/src/components/walletconnect/index.tsx b/src/components/walletconnect/index.tsx index 575426dfdd..ef3571454d 100644 --- a/src/components/walletconnect/index.tsx +++ b/src/components/walletconnect/index.tsx @@ -1,6 +1,7 @@ import useSafeInfo from '@/hooks/useSafeInfo' import useWalletConnectSessions from '@/services/walletconnect/useWalletConnectSessions' import { WalletConnectContext } from '@/services/walletconnect/WalletConnectContext' +import { ErrorBoundary } from '@sentry/react' import { useCallback, useContext, useEffect } from 'react' import useWcUri from './useWcUri' import WcHeaderWidget from './WcHeaderWidget' @@ -33,9 +34,11 @@ const WalletConnectUi = () => { }, [walletConnect, clearUri]) return ( - - - + + + + + ) } diff --git a/src/services/walletconnect/WalletConnectWallet.ts b/src/services/walletconnect/WalletConnectWallet.ts index 9bcf0b18f3..c0974380b5 100644 --- a/src/services/walletconnect/WalletConnectWallet.ts +++ b/src/services/walletconnect/WalletConnectWallet.ts @@ -50,8 +50,7 @@ class WalletConnectWallet { */ public async connect(uri: string) { assertWeb3Wallet(this.web3Wallet) - - await this.web3Wallet.core.pairing.pair({ uri }) + return this.web3Wallet.core.pairing.pair({ uri }) } public async chainChanged(topic: string, chainId: string) {