Support multiple named wallets per app install in both demos - #63
Merged
Conversation
Port the web demo's App.tsx state machine (registry-backed wallet selection, pre-start list/setup/choose-network routing, legacy network re-guessing, mode-aware onboarding) into WalletApp.tsx. Real per-wallet deletion (stop, wipe the entry's data directory, drop the registry row) backs both the list's onRemove and the data-missing screen's onRemove; a new onWipeAll clears the whole registry, the shared data root and the legacy single-wallet markers for the list's footer wipe button. StoppedScreen and ErrorScreen gain a "back to wallets" affordance to match; the old single-form ConnectScreen is dropped along with the routing that used it.
WipeDataButton's copy understated the blast radius of the wallet-list footer's clear-all wipe. Give it a scope prop so the footer gets plural "Clear all data" copy while ErrorScreen keeps the singular per-wallet wording that matches its actual wipeCurrentEntry call. Append a manual verification checklist to the README covering the multi-wallet flows this app has no hermetic smoke test for.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The demos used to hard-bind one wallet per browser origin or device install: one dataDir, one passkey marker, and a network dropdown that silently rewired the same wallet between networks. This reworks both demo apps (web and React Native) around a wallet registry, so one install can hold many wallets side by side.
The user-facing shape, identical in both demos:
This is demo-layer only: no
packages/*source changes, no new SDK surface. The registry islocalStorageon web and AsyncStorage on React Native, deliberately app-local, since wallet bookkeeping is a host-app concern the SDK does not prescribe.Technical Notes
/wallets/<id>(web OPFS) or<defaultRoot>/<id>(RN) directory. A migrated legacy wallet keeps the bare default root it already lives in, which is why deletion guards below exist.expo-file-system. On both, a legacy root-dwelling entry skips the disk wipe so it can never take sibling wallets' data with it, and the confirm copy states the exception.?regtest=1on web and a long-press on the brand mark on RN, keeping the hosted-network demo path clean.Steps to Test
CI covers build, typecheck, and the unit suites. The end-to-end checks:
Web (hermetic, no regtest stack needed):
WAVELENGTH_DIR="$(cd ../wavelength && pwd)" pnpm --filter web-wallet-demo run wasm:localpnpm --filter web-wallet-demo run buildpnpm --filter web-wallet-demo run test- exercises create, two-wallet switching, legacy migration, removal, and the data-missing recovery path.React Native (manual, device-driven):
pnpm --filter @lightninglabs/wavelength-react-native run fetch-bindingscd apps/rn-wallet-demo && npx expo run:androidRelated Issues & Pull Requests
Depends on: