wevm / wagmi

React Hooks for Ethereum

Home Page:https://wagmi.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when signing a message via QR code with a device on a different chain

goshatravin opened this issue · comments

Describe the bug

When attempting to connect and sign a message to a wallet via QR code scanning, an error occurs if the scanning device's blockchain network is different from the networks configured in WAGMI's settings.

Expected: switching network prompt

Link to Minimal Reproducible Example

No response

Steps To Reproduce

  1. Configure wagmi with a specific set of blockchain networks.
  2. Attempt to connect a wallet using a QR code from a device that is on a different blockchain network.
  3. Click sign message
  4. Observe the error.

https://stackblitz.com/edit/new-wagmi-poptbs?file=src%2FApp.tsx

An error occurred when attempting to switch chain.

Details: Chain not configured.

Version: @wagmi/core@2.6.17
Version: viem@2.9.20

Wagmi Version

@wagmi/core@2.6.17

Viem Version

viem@2.9.20

TypeScript Version

5.1.6

Check existing issues

Anything else?

No response

Hello @goshatravin. Please provide a minimal reproduction using new.wagmi.sh for runtime issues or TypeScript Playground for type issues. Issues marked with "needs reproduction" will be closed if they have no activity within 3 days.

I'm also seeing a similar issue with the WalletConnect Connector. However, I'm seeing this error when using chains that are defined in my config (mainnet, and sepolia), and I'm connected to them in my Wallet (Metamask Mobile).

The reproduction of this error is very inconsistent, probably related to some interaction with WalletConnect.

error from useSignMessage

Details: undefined is not an object (evaluating
'(n=this.namespaces[il)!=null?
n:this.namespaces[${i}:${s}]).defaultChain=s') Version:
viem@2.9.31