Skip to content

fix: errors related to unavailable Snap keyring#8196

Draft
david0xd wants to merge 1 commit intomainfrom
dd/fix-snap-keyring-errors
Draft

fix: errors related to unavailable Snap keyring#8196
david0xd wants to merge 1 commit intomainfrom
dd/fix-snap-keyring-errors

Conversation

@david0xd
Copy link
Contributor

Explanation

This PR adds a fix for errors appearing in the background console when Snap keyring is not yet available. Waiting mechanism is added for the Snap keyring to become available and ready for use.

References

Fixes: MetaMask/metamask-extension#40543

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

@david0xd david0xd self-assigned this Mar 12, 2026
Comment on lines +86 to +91
const keyrings = this.#messenger.call(
'KeyringController:getKeyringsByType',
KeyringTypes.snap,
);

return Array.isArray(keyrings) && keyrings.length > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably just use the KeyringController's state directly like with :getState. So the logic between this method and #waitForSnapKeyringViaStateChange would be pretty similar.

The other reason is because :getKeyringsByType is "deprecated" (even though we're still using it all over the place yes 🙃)

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.

[Bug]: Reset Wallet - Throws multiple errors related to accounts and keyring operations

2 participants