fix(walletconnect): attach eip155 accounts when proposal mixes eip155 with adapter namespaces - #33672
Conversation
… with adapter namespaces A WalletConnect session proposal combining eip155 with an adapter namespace (e.g. Tron) produced a permission request whose only chain scopes were the adapter's, so the approval UI pre-selected only that namespace, and manually checking EVM networks still settled the session with an empty eip155 accounts array. Two fixes: - Seed the proposal's requested eip155 chains into the CAIP-25 caveat value in onSessionProposal (mirroring adapter enrichCaveatValue), so the approval UI pre-selects the requested EVM networks. - Recompute selectedCaipAccountIds in handleNetworksSelected so scopes added via the edit-networks screen get accounts attached instead of being persisted with empty account lists. Fixes WPN-1704
|
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. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
| const selectedAccountGroups = Array.from( | ||
| new Set([ | ||
| ...supportedAccountGroups, | ||
| ...connectedAccountGroupWithRequested, |
There was a problem hiding this comment.
unfortunately this component is difficult to follow now. My thinking is that handleAccountGroupsSelected and handleNetworksSelected would look pretty much the same. I see some differences:
connectedAccountGroupWithRequestedis included inhandleNetworksSelectedbut not inhandleAccountGroupsSelectedsetSelectedAccountGroupIdsis included inhandleAccountGroupsSelectedbut not inhandleNetworksSelected
There was a problem hiding this comment.
great callout — addressed in 126eef62. selectedCaipAccountIds is now derived from the selected groups + chains, so both handlers are simpler and there’s a single source of truth.
… and chains Per review feedback: selectedCaipAccountIds was duplicated component state that every writer recomputed from (account groups x chain ids); the WPN-1704 bug existed because one writer (handleNetworksSelected) forgot. Derive it with useMemo instead so the granted accounts always follow the current group/chain selection, and collapse both selection handlers back to plain state setters.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
The changes are unit-tested but affect core dApp connection permission flows that could impact multiple user-facing scenarios. The risk is medium because the changes are targeted bug fixes with clear scope, but they touch the critical CAIP-25 permission path used by all dApp connections. Performance Test Selection: |
|
joaoloureirop
left a comment
There was a problem hiding this comment.
platform changes lgtm



Description
When a WalletConnect session proposal requests both
eip155and an adapter namespace (e.g.tron), two bugs combined so that the settled session'seip155namespace came back with the right chains and methods but an emptyaccountsarray, while Tron got a real account (reported by Reown, reproducible on lab.reown.commultichain-allwith any connect button since they all propose all chains):The permission request never contained the requested eip155 chains. In
WC2Manager.onSessionProposal, the CAIP-25 caveat value passed torequestPermissionsstarts as the default (wallet:eip155only) and is enriched only by registered non-EVM adapters (currently Tron). Since nothing seeded the proposal'seip155:*chains, the approval UI's "specifically requested chains" branch pre-selected only Tron, leaving EVM networks unchecked.Manually checking EVM networks didn't attach accounts.
handleNetworksSelectedinMultichainAccountConnectupdatedselectedChainIdsbut never recomputedselectedCaipAccountIds. Since the initial account IDs were derived from the Tron-only default chain list, the confirm path (setChainIdsInCaip25CaveatValue+setNonSCACaipAccountIdsInCaip25CaveatValue) persisted the newly addedeip155scopes withaccounts: []—setNonSCACaipAccountIdsInCaip25CaveatValueonly fills scopes whose namespace appears in the provided account IDs. The post-approvalupdatePermittedChains(channelId, ['eip155:<current>'])call then added the current EVM chain (which is why the namespace looked "correctly shaped"), but synced accounts from the caveat's existing (Tron-only) accounts, so eip155 stayed empty.Fixes:
enrichCaveatValueForEip155(wc-utils.ts), called fromonSessionProposalright afterenrichCaveatValueByAdapters. It reuses the existingenrichCaveatValueForNamespaceutil to seed the proposal's requestedeip155chains (filtered to configured networks, falling back to the wallet's current EVM chain) into the caveat'soptionalScopes, exactly mirroring what the Tron adapter does for its namespace. The approval UI now pre-selects the requested EVM networks alongside Tron.handleNetworksSelectednow recomputesselectedCaipAccountIdsfrom the currently selected account groups against the new chain selection (same logichandleAccountGroupsSelectedalready used), so any namespace added via the edit-networks screen gets accounts attached.Changelog
CHANGELOG entry: Fixed WalletConnect connections requesting both EVM and non-EVM chains (e.g. eip155 + tron) connecting without any EVM account attached
Related issues
Fixes: WPN-1704
Manual testing steps
Feature: WalletConnect multichain session proposal (eip155 + tron)
Scenario: dapp proposes eip155 and tron together
Given a build with the tron feature flag enabled
And a dapp (e.g. https://lab.reown.com/appkit/?name=multichain-all) configured for eip155 and tron
Scenario: user manually adds EVM networks on the permission screen
Given a WalletConnect connection request where only a non-EVM network is pre-selected
Screenshots/Recordings
Before
Session settles with
eip155: { chains: [...], methods: [...], accounts: [] }whiletrongets a real account. Permission screen pre-selects only Tron.Screen.Recording.2026-07-22.at.4.27.16.PM.mov
After
Permission screen pre-selects requested EVM networks and Tron; settled session attaches accounts to both namespaces.
Screen.Recording.2026-07-22.at.4.31.56.PM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes how CAIP-25 permissions are built for WalletConnect and multichain connect approval; incorrect logic could grant wrong or empty accounts, but scope is a targeted bugfix with regression tests.
Overview
Fixes WPN-1704, where WalletConnect sessions that request eip155 together with an adapter namespace (e.g. Tron) could settle with correct EVM chains but no eip155 accounts.
WalletConnect proposal handling now calls new
enrichCaveatValueForEip155after adapter enrichment so requested eip155 chains (limited to configured networks, with fallback to the active EVM chain) are added to the CAIP-25 caveat beforerequestPermissions. The connect UI can pre-select EVM networks alongside Tron instead of only the adapter scope.Connect approval UI no longer keeps
selectedCaipAccountIdsin separate state. It is derived from the selected account groups andselectedChainIds, so adding EVM networks in the network editor updates granted accounts for those scopes on approve.Regression tests cover mixed eip155+Tron proposals,
enrichCaveatValueForEip155, and the network-editor account sync path.Reviewed by Cursor Bugbot for commit 962e40b. Bugbot is set up for automated code reviews on this repo. Configure here.