fix: pre-select all networks for eip1193-compatible requests - #45261
fix: pre-select all networks for eip1193-compatible requests#45261adonesky1 wants to merge 8 commits into
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (1 files, +12 -0)
|
Builds ready [3116631]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 16 warn · 🔴 1 fail)
Bundle size diffs
|
|
Closing the loop on these after digging in and discussing with the team (thanks for the thorough testing @ameliejyc!): Tron + Bitcoin still connected / "still connected after disconnect": root cause is that we grant broadly but revoke narrowly. This PR restores one-approval connects covering all enabled networks, but on disconnect each client only revokes its own ecosystem's scopes (connect-evm removes Missing network picker after disconnect: same zombie state. With only Bitcoin/Tron scopes left there's no connected EVM account, so no active EVM network to show. Goes away once revokes are broad. Flashing Solana prompt and the hover menu with switch options: both Uniswap UI, not ours. They already have a fix for the prompt on a preview deploy (verified working, not yet in prod), and with this PR it matters less anyway since Solana is granted in the first approval. Product also confirmed broad granting is the settled long-term direction (the connect flow redesign removes network info from the approval entirely), so broad grant + broad revoke is the durable model here, not a stopgap. |
Builds ready [be36130]
⚡ Performance Benchmarks (Total: 🟢 10 pass · 🟡 13 warn · 🔴 1 fail)
Bundle size diffs
|
Builds ready [be36130]
⚡ Performance Benchmarks (Total: 🟢 10 pass · 🟡 13 warn · 🔴 1 fail)
Bundle size diffs
|
Builds ready [5f914be]
⚡ Performance Benchmarks (Total: 🟢 13 pass · 🟡 11 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 44b9c46. Configure here.
Builds ready [44b9c46]
⚡ Performance Benchmarks (Total: 🟢 5 pass · 🟡 16 warn · 🔴 2 fail)
Bundle size diffs
|
Builds ready [44b9c46]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 16 warn · 🔴 2 fail)
Bundle size diffs
|
…egacy requests Legacy EIP-1193 requests are also tagged with the eip1193-compatible session property by getCaip25PermissionFromLegacyPermissions, so gating solely on the session property made wallet_requestPermissions calls with specific permitted chains pre-select all networks instead of just the requested chains.
|
Builds ready [005b449]
⚡ Performance Benchmarks (Total: 🟢 11 pass · 🟡 12 warn · 🔴 1 fail)
Bundle size diffs [🚀 Bundle size reduced!]
|
|
It'd be good to add some recordings/screenshots to the PR. |









Description
Summary
Pre-select all enabled networks on the connect screen for
wallet_createSessionrequests that carry theeip1193-compatiblesession property, matching the pre-selection behavior of legacy EIP-1193 (eth_requestAccounts) connection requests.Problem
Legacy EIP-1193 connection requests get all of the user's enabled networks (including non-EVM networks like Solana) pre-selected on the connect screen, so a single approval covers everything.
@metamask/connect-evmroutes the same kind of "ordinary dapp connection" through the Multichain API as awallet_createSessionrequest with expliciteip155:*scopes. Because specific chains are requested, the connect screen takes the request literally and pre-selects only those EVM chains. Non-EVM networks start unchecked, so dapps that previously got EVM + Solana in one approval (via the injected provider) now require a second, separate approval for Solana.This surfaced as a user-facing regression after Uniswap migrated to MetaMask Connect: their EVM + Solana connection flow went from one approval to two, and a dapp-side modal bug on the second step left users with no path to connect Solana at all.
connect-evmalready tags its sessions with theeip1193-compatiblesession property (KnownSessionProperties.Eip1193Compatiblefrom@metamask/chain-agnostic-permission). We currently use it to gate the dapp connection control bar's network picker (getIsEip1193CompatibleConnectioninui/selectors/dapp.ts), but it was never wired into the connect screen's network pre-selection.Solution
In
MultichainAccountsConnectPage, detect theeip1193-compatiblesession property on the requested CAIP-25 caveat value and include it in the existing condition that returns the default (all enabled networks) selection, alongside the legacy EIP-1193 branch and the Solana/Tron wallet adapter branches.This is pre-selection only: the user can still uncheck any network before approving, and requests without the property are unaffected.
Changelog
CHANGELOG entry: Fixed the connection screen to pre-select all enabled networks for MetaMask Connect (EIP-1193 compatible) connection requests, matching the behavior of injected provider connections
Related issues
Fixes:
Manual testing steps
@metamask/connect-evm(e.g. app.uniswap.org) with clean site storage.eip155chains were).eth_requestAccounts) and from a Solana wallet-standard-only dapp; pre-selection behavior should be unchanged.Screenshots/Recordings
Before
Connect prompt for a
connect-evmrequest pre-selects only the requested EVM chains; Solana starts unchecked.After
Connect prompt for a
connect-evmrequest pre-selects all enabled networks, including Solana.Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
UI pre-selection only on the connect screen; users can still change networks before approve, with explicit regression tests for legacy EIP-1193 behavior.
Overview
Connect screen network pre-selection now treats Multichain
wallet_createSessionrequests that carry theeip1193-compatiblesession property (e.g. from@metamask/connect-evm) like legacy injected-provider connects: all enabled default networks are pre-selected, even when the request lists specificeip155chains—so EVM + Solana can be approved in one step again.MultichainAccountsConnectPagederivesisEip1193CompatibleRequestfromKnownSessionProperties.Eip1193Compatibleand passes it intogetDefaultConnectChainIds. That helper adds an early-return branch:isEip1193CompatibleRequest && !isEip1193Requestuses the full default network list. Legacy EIP-1193 flows that also get the same session property fromgetCaip25PermissionFromLegacyPermissionsare excluded from that branch so specific-chain legacy requests (e.g. permitted-chains) still pre-select only requested chains.Unit tests cover compatible-only, legacy + compatible with specific chains, and legacy + compatible with no chains.
Reviewed by Cursor Bugbot for commit 005b449. Bugbot is set up for automated code reviews on this repo. Configure here.