Skip to content
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

Feat/bridge status controller #5317

Merged
merged 51 commits into from
Feb 20, 2025
Merged

Conversation

infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Feb 12, 2025

Explanation

This PR adds a new controller: BridgeStatusController.

This controller handles the bridge transaction status fetching and polling from the Bridge API.

References

This is a port of the BridgeStatusController from Extension: https://github.com/MetaMask/metamask-extension/tree/main/app/scripts/controllers/bridge-status

Some minor changes were needed to fill in the missing functions and variables from Extension.

This package will be consumed initially by the Metamask Mobile application first. Eventually, we wish to migrate the Extension to use this core/bridge-status-controller package.

Very closely related to the BridgeController: #5276

Changelog

@metamask/bridge-status-controller

  • ADDED: New BridgeStatusController!

@metamask/bridge-controller

  • CHANGED: BridgeController FeeType enum now exported as an enum, not just a type

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@infiniteflower infiniteflower force-pushed the feat/bridge-status-controller branch from 095dd8d to 618d362 Compare February 13, 2025 21:42
Base automatically changed from feat/bridge-controller to main February 13, 2025 22:28
@infiniteflower infiniteflower force-pushed the feat/bridge-status-controller branch 2 times, most recently from 027eb7a to ccabffd Compare February 13, 2025 22:36
@infiniteflower infiniteflower marked this pull request as ready for review February 13, 2025 22:37
@infiniteflower infiniteflower requested review from a team as code owners February 13, 2025 22:37
@infiniteflower infiniteflower force-pushed the feat/bridge-status-controller branch from b36e602 to b10c63e Compare February 18, 2025 16:14
@infiniteflower infiniteflower force-pushed the feat/bridge-status-controller branch from b687a31 to 7cf0f59 Compare February 18, 2025 22:09
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Had several comments on dependencies, exports, etc.

Would you mind re-running yarn update-readme-content? It looks like it might be missing updates to the dependency graph.

};

// Actions
type BridgeStatusControllerAction<
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also export this type? Otherwise if another controller wanted to just be able to call, say BridgeStatusController:startPollingForBridgeTxStatus, then it wouldn't be possible to set up the messenger.

Alternatively, what are your thoughts on explicitly defining the action types BridgeStatusControllerStartPollingForBridgeTxStatusAction and BridgeStatusControllerWipeBridgeStatusAction? This would be consistent with how action/event types work in other controllers.

Copy link
Contributor Author

@infiniteflower infiniteflower Feb 19, 2025

Choose a reason for hiding this comment

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

Done in 33dab2e, added BridgeStatusControllerResetStateAction as well

Choose a reason for hiding this comment

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

mcmir Thank you, please let me know if there is anything you need to add or add, thank you

@infiniteflower
Copy link
Contributor Author

yarn update-readme-content

Done in 0b09fa9

},
"peerDependencies": {
"@metamask/accounts-controller": "^24.0.0",
"@metamask/bridge-controller": "^0.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

For future reviewers: there seems to be a bug in the Yarn constraints which forces any controller packages added as dependencies to also be added as peer dependencies. We should fix this.

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

LGTM.

@infiniteflower infiniteflower enabled auto-merge (squash) February 20, 2025 17:04
@infiniteflower infiniteflower merged commit 935adeb into main Feb 20, 2025
136 checks passed
@infiniteflower infiniteflower deleted the feat/bridge-status-controller branch February 20, 2025 17:09
Copy link

@yalan2ny yalan2ny left a comment

Choose a reason for hiding this comment

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

I checked the merged file, the added features and changes cover and solve the problems in Metamask, especially the solution to the bridge problem, which was necessary, is available in the packages and will fix the bugs, thank you for the help and cooperation of all of you friends, who with your presence contribute to the development and progress of the community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants