Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

fix: ignore event if account was already removed #101

Merged
merged 3 commits into from
Sep 20, 2023

Conversation

danroc
Copy link
Contributor

@danroc danroc commented Sep 20, 2023

When an account is removed using MetaMask's UI, we remove the account from the keyring, and then we call the snap to delete the account. It's done this way to ensure that the account is always removed from MetaMask, even if the snap fails.

As a consequence, when the snap notifies the keyring that it has removed the account, the account no longer in the keyring, which throws an error.

This PR changes this behavior and ignores the AccountDeleted event in case the account doesn't exist in the keyring.

Fixes: MetaMask/accounts-planning#58

@gantunesr gantunesr added the team-accounts This should be handled by the Accounts Team label Sep 20, 2023
@danroc danroc enabled auto-merge (squash) September 20, 2023 13:28
@danroc danroc merged commit d6a6b31 into main Sep 20, 2023
14 checks passed
@danroc danroc deleted the feature/fix-remove-account branch September 20, 2023 13:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
team-accounts This should be handled by the Accounts Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants