refactor(ledger): add offscreen router and refactor legacy handler#43487
refactor(ledger): add offscreen router and refactor legacy handler#43487montelaidev wants to merge 6 commits into
Conversation
Introduce a central ledger-router that owns the chrome.runtime.onMessage listener and dispatches actions to handler implementations. Refactor the legacy offscreen handler to expose handleAction/init/destroy for router ownership, and add a DMK stub that delegates to legacy until the real DMK implementation lands in a follow-up PR. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (6 files, +865 -73)
🫰 @MetaMask/core-platform (1 files, +2 -2)
📜 @MetaMask/policy-reviewers (4 files, +4 -0)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. |
|
@metamaskbot update-policies |
|
Policies updated. Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. ✅ lavamoat/browserify/beta/policy.json changes match lavamoat/browserify/main/policy.json changes |
Builds ready [a83d44f] [reused from 072521d]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 10 warn · 🔴 0 fail)
Bundle size diffs
|
Builds ready [a6177ba]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 10 warn · 🔴 0 fail)
Bundle size diffs
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a6177ba. Configure here.
Builds ready [c9a1f08]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 7 warn · 🔴 0 fail)
Bundle size diffs
|

Description
Introduces a central
ledger-routerin the offscreen document that owns the singlechrome.runtime.onMessagelistener and dispatches Ledger actions to handler implementations. Refactors the legacy offscreen handler to exposeinit/destroy/handleActionfor router ownership.A temporary
LedgerDMKBridgeHandlerstub delegates to the legacy handler so the router can compile and unit-test DMK mode selection without shipping DMK dependencies yet.This is PR 1 of 3 in the Ledger DMK rollout split:
ledgerDmkfeature flag + runtime mode switching (stacked)Changelog Entry
CHANGELOG entry: null
Related Issues
Fixes: N/A
Manual Testing Steps
yarn startoryarn build:test).Pre-merge Author Checklist
Made with Cursor