-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(4144): per-dapp-selected-networks #14539
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
base: main
Are you sure you want to change the base?
feat(4144): per-dapp-selected-networks #14539
Conversation
…ature can work when its feature flags are enabled make sure to include all env vars: export MM_MULTICHAIN_V1_ENABLED="true" export MM_CHAIN_PERMISSIONS="true" export MM_PER_DAPP_SELECTED_NETWORK="1" export MULTICHAIN_V1="true"
- Replace direct checks of process.env.MM_PER_DAPP_SELECTED_NETWORK in AccountPermissionsConnected.tsx with the isPerDappSelectedNetworkEnabled function. - Update ethereum-chain-utils.js to use isPerDappSelectedNetworkEnabled when switching networks. - Modify selectedNetworkController selectors to use isPerDappSelectedNetworkEnabled for feature flag checks. - Add the isPerDappSelectedNetworkEnabled utility in util/networks/index.js. This change centralizes the per-DApp network logic for better consistency and maintainability.
Add a touchable favicon to the permission summary header that enables network switching for dapps. This combines the dapp's identity (favicon/token) with network selection in a single interactive component. - Replace static WebsiteIcon with touchable BadgeWrapper pattern - Add network badge to indicate current network - Enable network switching via network selector bottom sheet - Add fallback to AvatarToken when favicon unavailable - Guard implementation behind per-dapp network selection feature flag - Preserve original WebsiteIcon when feature disabled This matches the interaction pattern from AccountPermissionsConnected, providing a consistent way to manage dapp-specific networks across the app.
…flag The domain logo container view was incorrectly placed outside the per-dapp network feature flag check. This change moves the container view inside the feature flag condition to ensure consistent UI behavior when the feature is enabled/disabled. - Moved View wrapper inside isPerDappSelectedNetworkEnabled() check - Simplified conditional rendering logic - Maintains existing functionality but with proper feature flag control
…permission sumamry is displayed, keep showing the WebsiteIcon rather than the AvatarFavicon.
…1Enabled rather than its 'corresponding' env variable MULTICHAIN_V1
Remove the permission check for non-permitted network flows in dapps, paving the way for the per-dapp-selected-network feature. Temporary screens handling these flows are pending removal upon feature completion.
- Replace global network selectors with origin-specific useNetworkInfo hook - Update network name and image source to be origin-aware - Update test snapshot for network name changes
- Add origin prop to AccountFromToInfoCard for per-dapp network info - Add debug logs for transaction review flow
… the per-dapp-selected-network enabled feature
… dapp chain if there is a hostname (if its a transaction from a dapp)
… confirming tx from dapp while stx is enabled
…ctNetworkConfigurations - and fix lint errors
…on notifications The commit updates the ticker selection to use the transaction's specific chainId instead of the global network state, ensuring correct token symbol is displayed in the TransactionSummary when openned from the TransactionNotification for per-dapp-selected-network transactions.
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. |
…f per-dapp-selected-networks. Tests were fixed mostly by adding missing mocks.
… of per-dapp-selected-networks. Tests were fixed mostly by adding missing mocks. The rest of the changes seems mostly like code formatter changes.
…should be enabled locally per dev using env variables. Otherwise QA gets builds with these chains which are not ready to QA and then log bugs on features still in development.
…of per-dapp-selected-networks.
… and the snapshot of two other tests. The previous mock failed because the selector could not find the expected NetworkConfiguration in state, with this fix it passes. For the snapshots, it seems the previous version contained only an Amount label, while this version contains all other labels and fields we usually see in the transaction detail screen, therefore this new snapshot does seem relevant.
This can be a permanent or temporary fix just intended for the PR before review. I did message someone from the stx team who had written that line to see if the change is expected or required a deeper dive and this PR would be adjusted as needed.
These changes are more likely related to stx changes in this per dapp selected network PR.
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
I have read the CLA Document and I hereby sign the CLA |
|
|
Description
Issue: All dapps are connected on the same chain, if one switches, others as well. Most likely the user would prefer to have his selected networks to be specific to each dapp (aka per-dapp).
Solution: Add per-dapp-selected-network, Add a touchable favicon to the permission summary header that enables network switching for dapps.
Note to devs:
@metamask/selected-network-controller
& integrate #10788 which dated from Sept. 2024 and never used since hidden behind feature flag.Per-DApp Selected Network Implementation
Key Changes
Features
Fixes
Refactoring
isPerDappSelectedNetworkEnabled
helperCode Quality
Related issues
Contributes to: https://github.com/MetaMask/MetaMask-planning/issues/4104
Manual testing steps
Testing:
Make sure to include all env vars:
Screenshots/Recordings
Pre-merge author checklist
Pre-merge reviewer checklist