Skip to content

fix: Snap Platform Watcher throwing error after wallet reset#8124

Open
david0xd wants to merge 11 commits intomainfrom
dd/fix-snap-platform-watcher
Open

fix: Snap Platform Watcher throwing error after wallet reset#8124
david0xd wants to merge 11 commits intomainfrom
dd/fix-snap-platform-watcher

Conversation

@david0xd
Copy link

@david0xd david0xd commented Mar 5, 2026

Explanation

This PR fixes the Snap platform cannot be used now error by modifying Snap Platform Watcher.

References

Related ticket: MetaMask/metamask-extension#40114
Extension PR that applies the fix: TBD

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 communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes the Snap platform readiness gate by optionally awaiting an external onboarding-completion callback, which can affect when Snap-based operations unblock and could introduce new waiting/failure modes if misused.

Overview
Adds an optional onboarding gate for Snap usage. MultichainAccountService now accepts an optional ensureOnboardingComplete callback and passes it into SnapPlatformWatcher.

SnapPlatformWatcher.ensureCanUseSnapPlatform() now awaits ensureOnboardingComplete (when provided) before waiting for SnapController readiness, preventing Snap operations from proceeding until re-onboarding completes after a wallet reset.

Tests are expanded to cover the new option (including ordering when the platform is already ready) and a race-guard case where readiness flips back to not-ready before the awaiting continuation runs; CHANGELOG.md is updated accordingly.

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

@david0xd david0xd self-assigned this Mar 5, 2026
@david0xd david0xd marked this pull request as ready for review March 6, 2026 15:45
@david0xd david0xd requested review from a team as code owners March 6, 2026 15:45
);
});

it('resolves immediately if platform is already ready', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could add a similar test case than this one when the Snap platform is ready but that the promise is not ready yet?

Making sure we wait for ensureOnboardingComplete to be fulfilled first?

Testing async stuff can be tricky, but that sounds like a good test case. WDYT?

Copy link
Author

Choose a reason for hiding this comment

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

Added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants