Skip to content

feat(sw): ServiceWorkerWallet.restore() with AggregateError round-trip#501

Open
pietro909 wants to merge 1 commit into
feat/wallet-restorefrom
feat/sw-wallet-restore
Open

feat(sw): ServiceWorkerWallet.restore() with AggregateError round-trip#501
pietro909 wants to merge 1 commit into
feat/wallet-restorefrom
feat/sw-wallet-restore

Conversation

@pietro909
Copy link
Copy Markdown
Contributor

Stacked on top of #492

Summary

Follow-up to #492. Adds ServiceWorkerWallet.restore({ gapLimit? }) so SW wallets reach parity with Wallet.restore().

  • New RESTORE_WALLET message; dispatcher runs wallet.restore() entirely worker-side (the materialize() callback never crosses the postMessage boundary).
  • Marked long-running on both sides so the bus deadline does not race the indexer-bound HD gap scan.
  • Explicit AggregateError round-trip: worker serializes to { name, message, errors: [{ name, message }] }, page reconstructs before rejecting. Non-Aggregate errors fall through the standard path.
  • Signing-only entrypoint. IWallet, IReadonlyWallet, ServiceWorkerReadonlyWallet, and ExpoWallet are untouched —
    readonly callers still hit ReadonlyWalletError. The scanContracts proxy rejection in the SW contract-manager stays as
    the low-level guardrail.

Out of scope

  • ServiceWorkerReadonlyWallet.restore() — needs a readonly variant of Wallet.restore() first.
  • Intermediate progress events — restore stays atomic from the caller's perspective.
  • Browser/SW e2e — existing regtest restore coverage is Node-only Wallet.restore() and does not exercise the worker transport.

Adds RESTORE_WALLET message, marked long-running so the bus deadline
does not race the worker-side gap scan. AggregateError is serialized
explicitly across postMessage and rebuilt on the page so callers can
inspect `.errors`. Signing-only entrypoint; readonly rejects.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • next-version

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c26fd507-209a-461f-ad3c-539d9b3fe3fb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sw-wallet-restore

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pietro909 pietro909 requested a review from Kukks May 21, 2026 22:38
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