Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

bug: WalletConnectConnector throws uncaught error on switchNetwork init failure #188

Closed
1 task done
ryanberckmans opened this issue Mar 23, 2023 · 1 comment
Closed
1 task done

Comments

@ryanberckmans
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

With slingshot mobile wallet (that does not support the test network I'm trying to switch to), the following error occurs on useSwitchNetwork(...).switch construction:

image

Throw source: https://github.com/wagmi-dev/references/blob/main/packages/connectors/src/walletConnect.ts#L254

Expected Behavior

The error should be handled internally by wagmi, and result in setting useSwitchNetwork(...).isError to true, and useSwitchNetwork(...).error to a useful error.

Steps To Reproduce

  1. download slingshot mobile wallet
  2. ask it to switch to an unsupported network using useSwitchNetwork

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

In general, wagmi should consider hiring a plucky intern (perhaps from Waterloo to work on testing and bugfixing the matrix of (all popular wallets) x (wallet-specific error cases).

Of course, mobile wallet support is very important as we move into this next phase of growing crypto to global ubiquity.

Popular mobile wallets include

  • rainbow
  • coinbase wallet
  • metamask mobile
  • slingshot

Wallet-specific error cases for the intern to cover include

  • switch network construction
  • switch network rejection by user
  • add network rejection by user
  • transaction sign rejection by user
  • unaffordability of gas fee (note interaction with account abstraction)
@jxom
Copy link
Member

jxom commented Mar 28, 2023

I tried to reproduce this, but was successfully able to catch the error within useSwitchNetwork with isError, error, etc.

Mind creating a minimal reproducible example via https://new.wagmi.sh so we can look into it? Will re-open when done.

@jxom jxom closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants