Skip to content

feat: add support for keyring_deleteAccounts - #637

Open
ccharly wants to merge 6 commits into
mainfrom
cc/feat/delete-accounts
Open

ccharly wants to merge 6 commits into
mainfrom
cc/feat/delete-accounts

Conversation

@ccharly

@ccharly ccharly commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Changes how accounts are removed across keyrings and snaps, including partial-failure semantics and SnapKeyring’s “local remove first” behavior, which can desync wallet state from snap state if remote deletion fails.

Overview
Adds bulk account deletion to the v2 keyring surface: deleteAccounts(accountIds) on the Keyring interface, the keyring_deleteAccounts RPC (params { ids }), and DeleteAccountsError with a per-account failures map when any deletion fails after a best-effort pass.

KeyringWrapper now treats deleteAccounts as the primitive implementation and provides a default deleteAccount that calls it with a single ID; Ethereum keyring adapters implement bulk delete with Promise.allSettled plus toAccountsFailures / toErrorMessage from keyring-utils. HD deletes in descending derivation order so only “last account” rules still apply during multi-delete.

The snap path wires KeyringClient.deleteAccounts, an RPC handler, and DeleteAccountsSnapError for structured snap failures. SnapKeyring clears the local registry first (same as single delete), calls bulk RPC for v2 snaps, and falls back to per-account RPC for v1; snap-side errors are logged, not thrown. MoneyKeyring keeps deletion unsupported via a no-op bulk method.

Reviewed by Cursor Bugbot for commit ff5e42b. Bugbot is set up for automated code reviews on this repo. Configure here.

@ccharly
ccharly marked this pull request as ready for review September 23, 2026 09:48
@ccharly
ccharly requested a review from a team as a code owner September 23, 2026 09:48

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 321066f. Configure here.

Comment thread packages/keyring-snap-bridge/src/v2/SnapKeyring.ts

This branch has not been deployed

No deployments
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.

1 participant