-
Notifications
You must be signed in to change notification settings - Fork 5.4k
refactor: migrate to @metamask/bridge-controller #31059
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the bridge-related functionality to use the centralized "@metamask/bridge-controller" library, removing legacy implementations and updating import paths throughout the codebase.
- Updated imports in metamask-controller and other modules to reference "@metamask/bridge-controller".
- Removed legacy bridge constants, types, and utility files/tests no longer needed with the consolidation.
- Adjusted configuration for the new BridgeController instantiation.
Reviewed Changes
Copilot reviewed 76 out of 77 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/scripts/metamask-controller.js | Updated controller to import and instantiate BridgeController with new clientId and fetchFn. |
| shared/constants/bridge.ts | Removed local definitions in favor of importing constant values from the new bridge controller. |
| app/scripts/lib/bridge-status/metrics.ts | Revised import paths to use new utilities from "@metamask/bridge-controller". |
| .eslintrc.js | Removed obsolete test file reference for bridge tests. |
| app/scripts/controllers/bridge/constants.ts, app/scripts/controllers/bridge/types.ts |
Entirely removed as part of deprecating the legacy bridge logic. |
| shared/modules/bridge-utils/*, shared/types/bridge.ts |
Legacy bridge utilities and types removed in favor of the external library. |
Files not reviewed (1)
- package.json: Language not supported
Comments suppressed due to low confidence (4)
app/scripts/metamask-controller.js:1777
- Verify that replacing 'NetworkController:getSelectedNetworkClient' with 'NetworkController:getState' aligns with the updated messaging API and does not break existing message handling.
'NetworkController:getState',
.eslintrc.js:355
- Confirm that the removal of the bridge test file reference is intentional and that appropriate tests exist for the new bridge controller integration.
- 'app/scripts/controllers/bridge.test.ts',
app/scripts/controllers/bridge/constants.ts:1
- Ensure that removing the legacy bridge constants file does not leave orphaned references or unintended side effects in the codebase.
Entire file removal
app/scripts/controllers/bridge/types.ts:1
- Verify that eliminating the legacy bridge controller types is safe and that all type references have been updated to use the types from '@metamask/bridge-controller'.
Entire file removal
9c06c19 to
1e00869
Compare
|
New and updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Some components use hex and some use caip so adding network name mappings for both chainId formats <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/31372?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
53ddea6
✨ Files requiring CODEOWNER review ✨🧩 @MetaMask/extension-devs
📜 @MetaMask/policy-reviewers
🔗 @MetaMask/supply-chain
🔄 @MetaMask/swaps-engineers
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving since this needs to make the release cut.
Builds ready [51f0f2d]
UI Startup Metrics (1174 ± 52 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
This PR removes the BridgeController class and shared bridge utils from the extension repo, and replaces them with @metamask/bridge-controller imports
See Copilot summary for more details
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist