feat: implement keyring_createAccounts#601
Conversation
- Route KeyringRpcMethod.CreateAccounts and validate with CreateAccountsRequestStruct - Support Bip44DeriveIndex and Bip44DeriveIndexRange on mainnet P2WPKH via AccountUseCases.create - Bump @metamask/keyring-api to ^22.0.0 and @metamask/keyring-snap-sdk to ^8.0.0 - Add unit tests and changelog; release snap 1.11.0 Made-with: Cursor
keyring_createAccounts
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@metamaskbot publish-preview |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
7238495 to
fa702f3
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
8ac45b4 to
e8b9ff2
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 b88ce08. Configure here.
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |

Explanation
Batch account creation via
keyring_createAccounts.What changed
AccountUseCases.createMany, which accepts a list of account creation requests and handles the batch as a single operation.getByDerivationPathsinsertManyBdkAccountRepositoryso batch account creation can:derivationPathsnamespace once,accountsnamespace once,accountswrite,derivationPathswrite.KeyringHandler.createAccountsto callcreateManyonce instead of invokingAccountUseCases.createonce per account.console.log.References
keyring_createAccounts(multiple accounts) support snap-solana-wallet#599Note
Medium Risk
Adds a new keyring RPC for batch account creation and changes account persistence/read paths to support bulk operations and cached metadata, which could affect state consistency and account loading behavior.
Overview
Implements the
keyring_createAccountsRPC, addingKeyringHandler.createAccountsto validate index ranges, enforce P2WPKH-only v1 constraints, trace batch creation, and internally split large requests into 100-account chunks.Adds
AccountUseCases.createManyplus repository batch APIs (getByDerivationPaths,insertMany) to reuse existing accounts, dedupe duplicate derivation paths, limit creation concurrency, and bulk-persist new accounts with fewer state reads/writes.Extends persisted
AccountStatewith optional cachedmetadataand introducesStoredAccountAdapterso lookups can returnKeyringAccount-relevant fields without loading full BDK wallets; also bumps@metamask/keyring-api/keyring-snap-sdkto the versions that include the new RPC structs.Reviewed by Cursor Bugbot for commit 947d0ea. Bugbot is set up for automated code reviews on this repo. Configure here.