Skip to content

feat: extension wallet impl (wip)#53

Open
mverzilli wants to merge 9 commits intomainfrom
extension-wallet-impl
Open

feat: extension wallet impl (wip)#53
mverzilli wants to merge 9 commits intomainfrom
extension-wallet-impl

Conversation

@mverzilli
Copy link
Copy Markdown

No description provided.

mverzilli and others added 9 commits April 28, 2026 13:08
Move the host-agnostic browser-wallet session manager (PXE per
chainId-version, wallet pair per appId, RUNNING_SESSIONS map) out of the
web flavor and into shared so a future browser-extension wallet flavor
can consume it without dragging cookie-sync along.

Web-specific concerns (IS_IFRAME gate, encrypted-cookie bootstrap and
sync, passphrase state) stay in web/wallet-service.ts and are wired in
via a new wrapper, getOrCreateSessionWithCookieSync, which forwards to
the lifted getOrCreateSession and intercepts wallet-update events to
schedule the appropriate cookie syncs. Existing call sites in
IframeShell and wallet-api are updated to use the wrapper.

Adds shared/src/wallet/session/session.test.ts with three tests for
session keying and wallet-pair caching. The lifted module accepts test
seams (__setSharedResourcesFactoryForTests, __setNodeClientFactoryForTests)
so the routing logic can be exercised without a live Aztec node — the
plan's original test code would have required a real PXE init.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Restrict barrel to public API; test seams now require relative import
- getOrCreateSession returns resolved sessionId; drop version-0 fallback
  in getSharedResources
- Hoist module-level logger; drop unused chainInfo arg from factory

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move the full wallet UI shell from web/ into shared/ui/ so the
upcoming extension flavor's expanded view can share it. The web's
cookie-passphrase auth (hasAccountsCookie / readAccountsCookie /
setCookiePassphrase) and WalletApi transport are now injected via
props (hasExistingVault, verifyPin, setPin, walletApiFactory).

Also lifts PinDialog to shared/ui/components/ since the shared shell
needs it; PinDialog had no web-specific imports (just MUI). Updates
IframeShell to import PinDialog from @demo-wallet/shared/ui.
Forward-compat for the upcoming extension flavor where PIN/password
persistence will hit chrome.storage.local (async). Web wrapper still
passes a sync setCookiePassphrase; that's assignable to the new
union type without changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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