Skip to content

fix: multichain account network permissions switch cp-7.57.0#21043

Merged
PatrykLucka merged 1 commit into
mainfrom
fix-dapp-network-permissions-switch
Oct 15, 2025
Merged

fix: multichain account network permissions switch cp-7.57.0#21043
PatrykLucka merged 1 commit into
mainfrom
fix-dapp-network-permissions-switch

Conversation

@PatrykLucka

@PatrykLucka PatrykLucka commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Description

This PR fixes following problem:

When a user changes network permissions for a connected dapp (by going to Permissions tab → "Use your enabled networks" → selecting different networks → Update), the dapp's provider doesn't get notified of the network change. Transactions continue to execute on the initial network instead of the newly permitted network.

Changelog

CHANGELOG entry: Fixed a bug preventing network switch when dapp network permissions changes

Related issues

Fixes: #20722

Manual testing steps

Feature: Dapp network permissions change

  Scenario: user changes network permissions
    Given user connected to the dapp with network A

    When user click on Account Icon on top right corner → goes to Permissions tab → "Use your enabled networks" → selecting different networks → Update
    Then after clicking Connect, network of the dapp should change

Screenshots/Recordings

dapp-network-permissions.mov

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Switches the active EVM network for a dapp when network permissions change and triggers a provider update notification.

  • MultichainAccountPermissions (MultichainAccountPermissions.tsx):
    • Implements async handleNetworksSelected to switch the dapp's active EVM network when the current permitted network is removed and another EVM chain is selected.
    • Uses isPerDappSelectedNetworkEnabled, useNetworkInfo, and selectEvmChainId to resolve current chain and per-dapp context.
    • Finds target network via networkConfigurations, extracts networkClientId, calls SelectedNetworkController.setNetworkClientIdForDomain, and triggers SelectedNetworkController.update to notify the dapp.
    • Adds CAIP helpers (parseChainId, KnownCaipNamespace, hasProperty) and types (NetworkConfiguration).
  • Tests (MultichainAccountPermissions.test.tsx):
    • Extends Engine and selectors mocks (Network/SelectedNetworkController, network configurations, per-dapp flag, network info).
    • Adds test for selecting a new network (e.g., Sepolia) and confirming update.
    • Retains and adjusts navigation and selection flow tests.

Written by Cursor Bugbot for commit ab6d187. This will update automatically on new commits. Configure here.

@PatrykLucka PatrykLucka self-assigned this Oct 10, 2025
@github-actions

Copy link
Copy Markdown
Contributor

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.

@PatrykLucka PatrykLucka added team-accounts-framework Accounts team team-accounts-deprecated DEPRECATED: please use "team-accounts-framework" instead and removed team-accounts-framework Accounts team team-accounts-deprecated DEPRECATED: please use "team-accounts-framework" instead labels Oct 10, 2025
@sonarqubecloud

Copy link
Copy Markdown

@PatrykLucka PatrykLucka marked this pull request as ready for review October 10, 2025 13:13
@PatrykLucka PatrykLucka requested a review from a team as a code owner October 10, 2025 13:13
@PatrykLucka PatrykLucka added the team-mobile-ux Mobile UX team label Oct 10, 2025
@shane-t shane-t changed the title fix: multichain account network permissions switch fix: multichain account network permissions switch cp-7.57.0 Oct 15, 2025
@PatrykLucka PatrykLucka added this pull request to the merge queue Oct 15, 2025
Merged via the queue into main with commit 9f95100 Oct 15, 2025
142 of 147 checks passed
@PatrykLucka PatrykLucka deleted the fix-dapp-network-permissions-switch branch October 15, 2025 15:10
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 15, 2025
@metamaskbot metamaskbot added the release-7.58.0 Issue or pull request that will be included in release 7.58.0 label Oct 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.58.0 Issue or pull request that will be included in release 7.58.0 size-M team-mobile-ux Mobile UX team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(mob)[Bug] Unable to change network on dApp

3 participants