Skip to content

feat: add insertMany to repository API (Batch accounts 2/5)#609

Open
gantunesr wants to merge 4 commits into
gar/feat/batch-accounts/part-1from
gar/feat/batch-accounts/part-2
Open

feat: add insertMany to repository API (Batch accounts 2/5)#609
gantunesr wants to merge 4 commits into
gar/feat/batch-accounts/part-1from
gar/feat/batch-accounts/part-2

Conversation

@gantunesr
Copy link
Copy Markdown
Member

@gantunesr gantunesr commented May 14, 2026

Stack part 2 of 5 split from #601. Adds repository-level batch lookup and insert APIs, nullable account tombstones, and derivation-path index repair. This does not expose keyring_createAccounts yet.


Note

Medium Risk
Touches snap persistent state and account repository behavior (batch writes and derivation-path index repair), which could affect account discovery or persistence if edge cases are missed. Changes are localized but involve data-shape tweaks (accounts tombstones) and new staged-changeset semantics.

Overview
Adds repository-level batching: BitcoinAccountRepository now supports getByDerivationPaths (single read per namespace, returns results in input order) and insertMany (writes accounts and derivationPaths in two bulk updates).

Introduces tombstone-aware state by allowing SnapState.accounts values to be null, and adds derivation-path index repair when lookups fall back to scanning accounts.

Extends BitcoinAccount with hasStaged() and updates BdkAccountAdapter to preserve/merge staged ChangeSets so batch insertion can validate staged data without consuming it; adds corresponding unit tests and updates the changelog.

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

@gantunesr gantunesr requested a review from a team as a code owner May 14, 2026 21:02
@gantunesr gantunesr changed the title [Batch accounts 2/6] Add batch account repository APIs chore: add batch account repository APIs (Batch accounts 2/6) May 14, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 8e646ab. Configure here.

Comment thread packages/snap/src/store/BdkAccountRepository.ts
@gantunesr gantunesr changed the title chore: add batch account repository APIs (Batch accounts 2/6) chore: add batch account repository APIs (Batch accounts 2/5) May 14, 2026
@gantunesr gantunesr changed the title chore: add batch account repository APIs (Batch accounts 2/5) feat: add insertMany repository APIs (Batch accounts 2/5) May 14, 2026
@gantunesr gantunesr changed the title feat: add insertMany repository APIs (Batch accounts 2/5) feat: add insertMany to repository API (Batch accounts 2/5) May 14, 2026
@gantunesr gantunesr force-pushed the gar/feat/batch-accounts/part-2 branch from 16a6861 to 4670591 Compare May 14, 2026 23:50
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