Skip to content

chore: remove MM_CHAIN_PERMISSIONS flag #16142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wenfix
Copy link
Contributor

@wenfix wenfix commented Jun 5, 2025

Description

Enables the behaviour gated by MM_CHAIN_PERMISSIONS feature flag to be available by default. Dapps requesting network changes via wallet_addEthereumChain or wallet_switchEthereumChain will prompt the user to add permission to access the specified chain IDs and, if granted, subsequent wallet_switchEthereumChain requests made to that chainId will not require user confirmation.

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/5026

Manual testing steps

  1. Navigate to a dapp and request a network switch to a chain ID not yet permitted.
  2. Observe that a permission prompt appears asking to grant access to the requested network.
  3. Approve the permission and verify that the network switch occurs successfully.
  4. Repeat the network switch request and confirm that no prompt appears, indicating the permission is saved.
  5. Attempt to switch to a different, unpermitted network and deny the permission. Verify that the network does not switch.

Screenshots/Recordings

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.

@wenfix wenfix added No QA Needed Apply this label when your PR does not need any QA effort. team-wallet-api-platform Run Smoke E2E Requires smoke E2E testing labels Jun 5, 2025
Copy link
Contributor

github-actions bot commented Jun 5, 2025

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.

Copy link
Contributor

github-actions bot commented Jun 5, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 02a4d35
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/21f9b205-cb05-46df-b239-53488041e0e7

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link

sonarqubecloud bot commented Jun 5, 2025

@wenfix wenfix marked this pull request as ready for review June 6, 2025 14:27
@wenfix wenfix requested review from a team as code owners June 6, 2025 14:27
@wenfix wenfix added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels Jun 6, 2025
@@ -319,7 +308,7 @@ export async function switchToNetwork({
}
}

if (!shouldShowRequestModal && !ethChainIds.includes(chainId)) {
if (!shouldShowRequestModal && !ethChainIds?.includes(chainId)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the optional chaining required now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ethChainIds can be either an array or undefined and I think previously the flag was preventing that condition to be reached when it was undefined. After the change, tests broke when entering that condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No QA Needed Apply this label when your PR does not need any QA effort. Run Smoke E2E Requires smoke E2E testing team-wallet-api-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants