Skip to content

feat(wallet): EIP-6963 multi-wallet discovery in the browser bridge#392

Merged
MuncleUscles merged 1 commit into
v0.40-devfrom
feat/eip6963-provider-discovery
Jul 10, 2026
Merged

feat(wallet): EIP-6963 multi-wallet discovery in the browser bridge#392
MuncleUscles merged 1 commit into
v0.40-devfrom
feat/eip6963-provider-discovery

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

What

The browser-wallet bridge page grabbed the single injected window.ethereum, which is ambiguous when multiple wallet extensions are installed (they clobber each other on that global). Adopt the standard EIP-6963 discovery mechanism.

On load the page dispatches eip6963:requestProvider and collects each eip6963:announceProvider ({info:{name,icon,rdns,uuid}, provider}) into a list, then routes every provider call — eth_requestAccounts, eth_chainId, wallet_switchEthereumChain, wallet_addEthereumChain, eth_sendTransaction, accountsChanged — through one selected active provider instead of window.ethereum.

Behavior

  • 1 wallet announced → auto-select (no picker friction).
  • ≥2 wallets → a hand-rolled picker (icon + name), styled to match the existing page.
  • 0 announced → fall back to window.ethereum (older wallets that don't speak 6963), else a clear "no wallet detected" message.
  • Also subscribes chainChanged (the page only heard accountsChanged) to warn on a mid-session network switch; ensureChain() still corrects it before each tx.

Scope

  • Only src/lib/wallet/bridgePage.ts (the inline page) + the Playwright mock. Transport, session daemon, and the /api/* contract are untouched — the active-provider layer only funnels the same calls through a chosen object.
  • The Tier-2 mock (e2e/fixtures/mockProvider.ts) now announces via eip6963:announceProvider (and keeps window.ethereum) so the browser-signing lanes discover it.

Test

Local Tier-2 browser-signing suite: 9 passed / 1 skipped (the skip is the nightly Docker deploy lane) — staking (validator-join + session reuse), config-default walletMode, reject (4001) + tab-closed error lanes, and the full wallet-session lifecycle. tsc clean; build inlines the page.

The bridge page grabbed the single injected `window.ethereum`, which is
ambiguous when several wallet extensions are installed. Adopt EIP-6963: on load
dispatch `eip6963:requestProvider` and collect each `eip6963:announceProvider`
({info:{name,icon,rdns,uuid}, provider}) into a list; route every provider call
(eth_requestAccounts / eth_chainId / wallet_switch|addEthereumChain /
eth_sendTransaction / accountsChanged) through one selected active provider.

- 1 wallet → auto-select; >=2 → hand-rolled picker (icon+name); 0 announced →
  fall back to window.ethereum (older wallets), else a clear no-wallet message.
- Also subscribe chainChanged (page only heard accountsChanged) to warn on a
  mid-session network switch; ensureChain still corrects it before each tx.
- Transport / session daemon / /api contract untouched.
- Playwright mock now announces via eip6963:announceProvider (keeps
  window.ethereum too) so the Tier-2 lanes discover it.

Verified: Tier-2 browser-signing suite 9 passed / 1 skipped (nightly deploy).
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce7ca2ec-564d-4161-9025-28a47b4851cc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/eip6963-provider-discovery

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.

@MuncleUscles
MuncleUscles merged commit 74952bd into v0.40-dev Jul 10, 2026
9 of 10 checks passed
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.

1 participant