Skip to content

Fix metamask extension detection#1371

Merged
chakra-guy merged 4 commits into
mainfrom
ts/fix-metamask-detection
Oct 15, 2025
Merged

Fix metamask extension detection#1371
chakra-guy merged 4 commits into
mainfrom
ts/fix-metamask-detection

Conversation

@chakra-guy

@chakra-guy chakra-guy commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator

Explanation

This PR refactor the extension detection code to use EIP-6963

References

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

Note

Switches MetaMask extension detection to async EIP-6963 flow and updates SDK logic to await it; also improves MWP transport focus listener handling and adds a test platform mock.

  • Platform (src/domain/platform):
    • Implement EIP-6963-based detection started at module load; expose hasExtension(): Promise<boolean> backed by a shared detectionPromise.
  • SDK (src/multichain):
    • Await hasExtension() in transport selection (getStoredTransport) and connection flow (connect), including isDesktopPreferred logic.
  • Transport (src/multichain/transports/mwp):
    • Track window focus listener with a saved handler and remove it on disconnect; minor cleanup.
  • Tests:
    • Add tests/mocks/platform.ts to mock async hasExtension; include in tests/mocks/index.ts.

Written by Cursor Bugbot for commit 4845d17. This will update automatically on new commits. Configure here.

@chakra-guy chakra-guy requested a review from a team as a code owner October 15, 2025 08:46
cursor[bot]

This comment was marked as outdated.

Comment thread packages/sdk-multichain/src/multichain/index.ts
Comment thread packages/sdk-multichain/src/multichain/index.ts Outdated
Comment thread packages/sdk-multichain/src/multichain/index.ts Outdated
@chakra-guy chakra-guy requested a review from wenfix October 15, 2025 08:56
wenfix
wenfix previously approved these changes Oct 15, 2025
@codecov

codecov Bot commented Oct 15, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.99%. Comparing base (74f90c1) to head (4845d17).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1371   +/-   ##
=======================================
  Coverage   74.99%   74.99%           
=======================================
  Files         184      184           
  Lines        4519     4519           
  Branches     1108     1108           
=======================================
  Hits         3389     3389           
  Misses       1130     1130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

Copy link
Copy Markdown

@chakra-guy chakra-guy merged commit 0ac34cd into main Oct 15, 2025
44 checks passed
@chakra-guy chakra-guy deleted the ts/fix-metamask-detection branch October 15, 2025 10:08
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.

2 participants