Skip to content

Commit

Permalink
Handle pair errors
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Oct 23, 2023
1 parent 6719ef7 commit ddcdf5e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/walletconnect/WcInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const WcInput = ({ uri }: { uri: string }) => {

try {
await walletConnect.connect(val)
setValue('')
} catch (e) {
setError(asError(e))
}

setValue('')
setConnecting(false)
},
[walletConnect],
Expand Down
9 changes: 6 additions & 3 deletions src/components/walletconnect/index.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -33,9 +34,11 @@ const WalletConnectUi = () => {
}, [walletConnect, clearUri])

return (
<WcHeaderWidget isError={!!error} isOpen={open} onOpen={onOpen} onClose={onClose} sessions={sessions}>
<WcSessionManager sessions={sessions} uri={uri} />
</WcHeaderWidget>
<ErrorBoundary>
<WcHeaderWidget isError={!!error} isOpen={open} onOpen={onOpen} onClose={onClose} sessions={sessions}>
<WcSessionManager sessions={sessions} uri={uri} />
</WcHeaderWidget>
</ErrorBoundary>
)
}

Expand Down
3 changes: 1 addition & 2 deletions src/services/walletconnect/WalletConnectWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ddcdf5e

Please sign in to comment.