core
core copied to clipboard
chore: batch account creation
Explanation
This batches some calls during account creation after SRP import. It reduced time it took from ~35s to ~9s on my device for SRP with ~250 accounts.
I am not sure if this is worth merging because of https://github.com/MetaMask/core/pull/6654
References
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] Batches EVM account discovery/creation and debounces wallet/group syncs to cut redundant vault updates during large imports.
- MultichainAccountService:
- Add debounced sync pipeline (50ms) using
#pendingWalletSyncsand#pendingGroupSyncs; replace immediatewallet.sync()/group.sync()on account add with queued flush via#scheduleSync()and#flushSyncs().- MultichainAccountWallet:
- Optimize discovery: detect contiguous active EVM accounts, then batch-create them and skip sequential EVM discovery; update
maxGroupIndexaccordingly.- EvmAccountProvider:
- Add
findActiveAccountCount(checks activity viaeth_getTransactionCount),bulkCreateAccounts(single keyring write), and internal#createAccountsBatchhelper; expose address/tx-count helpers for discovery flow.Written by Cursor Bugbot for commit a9466cfd37cfb6846c54faa148528c48febf3300. This will update automatically on new commits. Configure here.