Skip to content

fix(walletconnect): advertise the required chain in optionalNamespaces - #12540

Merged
kaladinlight merged 2 commits into
developfrom
fix/walletconnect-bridge-wallet
Aug 7, 2026
Merged

fix(walletconnect): advertise the required chain in optionalNamespaces#12540
kaladinlight merged 2 commits into
developfrom
fix/walletconnect-bridge-wallet

Conversation

@kaladinlight

@kaladinlight kaladinlight commented Aug 7, 2026

Copy link
Copy Markdown
Member

Description

Bridge Wallet could not pair over WalletConnect whenever its selected network was Ethereum. It rejected the session proposal with UNSUPPORTED_CHAINS (code 5100) and showed "The chain Ethereum is not supported", while the same wallet on any other network paired fine.

Root cause is in what we advertise. eip155:1 was sent only as a required chain:

requiredNamespaces: { eip155: { chains: ["eip155:1"], ... } }
optionalNamespaces: { eip155: { chains: ["eip155:10","eip155:56","eip155:100", ...] } }  // no eip155:1

Bridge Wallet resolves its selected network against optionalNamespaces, doesn't find eip155:1 there, and rejects the entire session — ignoring requiredNamespaces. That is non-conformant on their side (optionalNamespaces exists so wallets can ignore what they don't support), but it's cheap for us to accommodate, and @walletconnect/ethereum-provider already mirrors required chains into optional under some configurations.

Confirmed by bisecting the advertised chain list against a real device:

Bridge Wallet on optional chains result
Ethereum 12 rejected
Ethereum 12, no bip122 rejected
Ethereum 0 connected
Gnosis 12 connected
Ethereum 12 + eip155:1 connected

The fix sends the required chain in both namespaces. chains (and therefore requiredNamespaces) is untouched, so setChainIds() still pins the session to mainnet and behaviour for conformant wallets is unchanged.

Issue (if applicable)

closes #12531

Closes SS-5720 — Trying to connect to bridge wallet via wallet connect on eth network

Risk

Low.

Scope is a single field in the WalletConnect session proposal — it widens what we advertise as acceptable, without changing what we require or what we default to. No transaction construction, signing, or broadcast path is touched.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

WalletConnect v2 pairing only. Every WalletConnect wallet sees eip155:1 added to the optional chain list; @walletconnect/ethereum-provider de-dupes it via new Set, and the resulting proposal is the same shape the SDK produces natively when its m flag is set. No effect on injected wallets, Ledger, KeepKey, or native.

Testing

Engineering

  1. pnpm dev:web and open the WalletConnect connect flow.
  2. With any WalletConnect wallet, confirm pairing still succeeds and the session lands on Ethereum.
  3. To inspect the proposal, temporarily add logger: 'debug' to walletConnectV2ProviderConfig. optionalNamespaces.eip155.chains should now lead with eip155:1 followed by the other 12; requiredNamespaces should be unchanged at ["eip155:1"].
  4. Regression check on the Bitcoin namespace: patchSignerForNonEvmNamespaces still grafts bip122 onto the proposal, so a wallet supporting BTC over WalletConnect should still expose it (_supportsBTC).

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Not behind a flag — user-facing.

  1. Install Bridge Wallet (Mt Pelerin) on a phone and select the Ethereum network in the app.
  2. On a preview build, connect via WalletConnect and scan the QR.
  3. Expected: pairing succeeds and an Ethereum account connects. Before this change it failed with "An error occurred during authentication, please retry. The chain Ethereum is not supported".
  4. Repeat with the wallet on Gnosis (previously working) to confirm no regression.
  5. Sanity-check one mainstream wallet — MetaMask mobile, Trust, or Rainbow — to confirm normal pairing is unaffected.

Screenshots (if applicable)

n/a

Follow-ups (not in this PR)

Found while investigating, deliberately left out to keep this surgical:

  1. Pairing errors are swallowed. packages/hdwallet-walletconnectv2/src/adapter.ts:41 logs 'Could not pair WalletConnectV2' without the error object, and useWalletConnectV2Pairing.ts:63-66 flattens everything to a generic i18n string with no logging. The wallet's actual rejection reason never reaches the console, which is what made this bug hard to diagnose.
  2. Sei has no rpcMap entry. eip155:1329 is advertised in optionalChains but has no URL in rpcMap — the only advertised chain in that state.
  3. ethVerifyMessage is not a JSON-RPC method. It appears in optionalMethods but is hdwallet-core's local message-verification API, not something any wallet implements over the wire.

Some wallets resolve their currently selected network against optionalNamespaces
and reject the whole session with UNSUPPORTED_CHAINS (5100) when it isn't listed
there, ignoring requiredNamespaces entirely.

eip155:1 was only ever sent as a required chain, never an optional one, so
Bridge Wallet users sitting on Ethereum could not pair at all, while every other
network connected fine. Sending the required chain in both namespaces keeps
those wallets connectable.

requiredNamespaces is unchanged, so the session still defaults to mainnet for
conformant wallets.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kaladinlight
kaladinlight requested a review from a team as a code owner August 7, 2026 18:35
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

WalletConnect V2 now includes both required and optional chain IDs in optionalChains. Comments document compatibility with wallets that validate selected networks against optionalNamespaces.

Changes

WalletConnect chain advertisement

Layer / File(s) Summary
Combine required and optional chains
src/context/WalletProvider/WalletConnectV2/config.ts
optionalChains now concatenates required chain IDs with optional chain IDs. Comments describe compatibility with wallets that validate selected networks against optionalNamespaces.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: 0xapotheosis

Poem

I’m a rabbit with chains in a row,
Required and optional now flow.
Wallets check with care,
ETH finds its share,
And connections can hop where they go.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change adds eip155:1 to optionalNamespaces and directly addresses the Bridge Wallet ETH pairing failure in issue #12531.
Out of Scope Changes check ✅ Passed The change is limited to WalletConnect v2 namespace advertisement and supports the linked Bridge Wallet ETH pairing fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: advertising the required WalletConnect chain in optionalNamespaces.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/walletconnect-bridge-wallet

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kaladinlight
kaladinlight enabled auto-merge (squash) August 7, 2026 18:49
@kaladinlight
kaladinlight merged commit f016182 into develop Aug 7, 2026
4 checks passed
@kaladinlight
kaladinlight deleted the fix/walletconnect-bridge-wallet branch August 7, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trying to connect to Bridge Wallet via Wallet Connect on ETH network fails

1 participant