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

Added multichain api notifications #25869

Merged
merged 41 commits into from
Aug 19, 2024

Conversation

shanejonas
Copy link
Contributor

@shanejonas shanejonas commented Jul 16, 2024

Description

Added multichain api notifications

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

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.

@shanejonas shanejonas requested a review from a team as a code owner July 16, 2024 17:08
Copy link
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.

@shanejonas shanejonas changed the title Added initial WIP Added multichain api notifications Jul 18, 2024
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added multichain API notifications to enhance the handling of notifications across multiple blockchain networks.

  • New Unit Tests: Added app/scripts/lib/multichain-api/multicainSubscriptionManager.test.ts for MultichainSubscriptionManager and createMultichainMiddlewareManager.
  • Subscription Manager: Introduced app/scripts/lib/multichain-api/multichainSubscriptionManager.ts for managing multichain subscriptions and middleware.
  • Provider Authorization: Updated app/scripts/lib/multichain-api/provider-authorize.js to handle multichain API notifications with new logging and scope management.
  • Request Handling: Modified app/scripts/lib/multichain-api/provider-request.js to include a scope parameter for determining network client ID.
  • Notification Support: Added eth_subscription to supported notifications in app/scripts/lib/multichain-api/scope/supported.ts.

8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

The recent changes focus on enhancing the multichain API notifications and managing subscriptions across different blockchain networks.

  • Subscription Management: Introduced MultichainSubscriptionManager in app/scripts/lib/multichain-api/multichainSubscriptionManager.ts for handling subscriptions and notifications.
  • Debug Logging: Added console logs in createMultichainMiddlewareManager for debugging, which should be replaced with a proper logging mechanism before production.
  • Chain Change Notifications: Commented out _notifyChainChange in app/scripts/metamask-controller.js, potentially affecting chain change notifications. Thorough testing is recommended to ensure no regressions.

2 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

The recent changes introduce multichain API notifications, enhancing the MetaMask extension's ability to handle notifications across different blockchain networks.

  • New Class and Tests: Added app/scripts/lib/multichain-api/MultichainMiddlewareManager.ts and MultichainMiddlewareManager.test.ts to manage and test JSON-RPC middleware for different scopes and domains.
  • Subscription Management: Updated app/scripts/lib/multichain-api/multichainSubscriptionManager.ts to improve multichain API notifications, including a new SubscriptionManager type and better subscription handling.
  • Refactored Tests: Renamed and refocused app/scripts/lib/multichain-api/MultichainSubscriptionManager.test.ts to exclusively test MultichainSubscriptionManager.
  • Logging Enhancements: Added error logging in app/scripts/lib/multichain-api/provider-authorize.js for better debugging during the authorization process.
  • Controller Initialization: Simplified initialization in app/scripts/metamask-controller.js by directly instantiating MultichainMiddlewareManager and updating import paths.

6 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

socket-security bot commented Aug 19, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Network access npm/[email protected] 🚫
Network access npm/[email protected] 🚫

View full report↗︎

Next steps

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@shanejonas
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@metamaskbot metamaskbot requested review from a team as code owners August 19, 2024 20:01
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM! Lets merge it

@adonesky1 adonesky1 merged commit 2d05d3c into caip-multichain Aug 19, 2024
62 of 68 checks passed
@adonesky1 adonesky1 deleted the sj/caip-multichain-notifications branch August 19, 2024 22:36
@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants