Skip to content

feat(migration): implement legacy wallet migration flow#3475

Open
CharlVS wants to merge 14 commits intodevfrom
feat/legacy-wallet-migrator
Open

feat(migration): implement legacy wallet migration flow#3475
CharlVS wants to merge 14 commits intodevfrom
feat/legacy-wallet-migrator

Conversation

@CharlVS
Copy link
Copy Markdown
Collaborator

@CharlVS CharlVS commented Apr 2, 2026

Summary

End-to-end legacy wallet migration that detects native legacy wallets and guides users through a compatibility dialog before migrating them to KDF-managed wallets.

  • Legacy migration flow: detect legacy wallets at sign-in, present a compatibility dialog for KDF name/password entry, migrate seed + assets, and clean up legacy data
  • Auth hardening: non-critical restore steps (metadata, asset activation) are isolated so failures produce warnings instead of blocking login
  • Fiat preference persistence: selected fiat currency is stored in local storage and survives bloc resets / app restarts
  • Platform identifiers: Android package moved to com.gleec.gleecdex, iOS bundle identifier updated to com.GleecDEX.wallet

Commits

Commit Scope
feat(migration): implement legacy wallet migration with compatibility dialog AuthBloc, WalletsRepository, models, views, translations
feat(fiat): persist default fiat currency preference across sessions FiatFormBloc, storage helpers
chore(android): migrate MainActivity to com.gleec.gleecdex package Android
chore(ios): update bundle identifier to com.GleecDEX.wallet iOS
test: add unit tests for legacy migration and fiat preference 5 new test files

Key components

  • AuthLegacyMigrationRequested event with _onLegacyMigration handler in AuthBloc
  • LegacyMigrationCompatibilityDialog for name/password entry before migration
  • LegacyMigrationCleanupPlate in security settings for incomplete cleanup visibility
  • LegacyAppSettingsMigrationService for reading legacy shared-preference data
  • PreparedLegacyMigration model carrying migration parameters
  • zHTLC "recent transactions" sync policy option consumed during migration
  • FiatDefaultPreference load/persist helpers with BaseStorage

Test plan

  • Unit tests pass (test_units/)
  • Sign in to a legacy wallet triggers the compatibility dialog
  • Migration completes with correct KDF wallet name and new password
  • Post-migration, legacy wallet entry is removed from wallet list
  • Incomplete native cleanup shows the cleanup plate in security settings
  • Fiat currency selection persists after bloc reset and app restart
  • Android and iOS builds with updated identifiers

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 2, 2026

Visit the preview URL for this PR (updated for commit 612d9c2):

https://walletrc--pull-3475-merge-ysemtthd.web.app

(expires Mon, 20 Apr 2026 09:38:29 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

CharlVS added 6 commits April 2, 2026 15:40
… dialog

Add end-to-end legacy wallet migration flow that detects native legacy
wallets and guides users through a compatibility dialog to set a valid
KDF wallet name and password before migrating.

Key changes:
- AuthBloc: add AuthLegacyMigrationRequested event with non-critical
  step isolation so metadata/asset failures don't block login
- WalletsRepository: legacy wallet detection, seed decryption, name
  sanitisation, native-secret extraction, and post-migration cleanup
- New PreparedLegacyMigration model and LegacyAppSettingsMigrationService
  for reading legacy shared-preference data
- IguanaWalletsManager: intercept legacy wallet sign-in and present the
  LegacyMigrationCompatibilityDialog before dispatching migration
- SecuritySettings: add LegacyMigrationCleanupPlate for incomplete
  native cleanup visibility
- zHTLC config dialog: expose "recent transactions" sync policy option
  consumed during migration
- Translation strings for all new migration UI copy
Store the user's selected fiat currency in local storage so it survives
bloc resets and app restarts. On initialisation the bloc hydrates from
storage; on selection it writes through immediately.

- Add fiat_default_preference.dart with load/persist helpers
- FiatFormBloc: hydrate on construction via new event, write on select
- FiatFormState.initial: accept optional pre-selected fiat currency
- Resolve selected fiat against the loaded fiat list to avoid stale refs
Move the Android MainActivity from the old com.komodoplatform.atomicdex
package to com.gleec.gleecdex to match the updated application ID.
Align the iOS PRODUCT_BUNDLE_IDENTIFIER across Debug, Profile, and
Release configurations to the new com.GleecDEX.wallet identifier.
Cover the new migration and fiat-preference features:
- LegacyAppSettingsMigrationService parsing and edge cases
- FiatDefaultPreference load/persist round-trip
- Legacy native wallet migration integration scenarios
- LegacyMigrationCleanupPlate widget rendering
- LegacyMigrationCompatibilityDialog validation and flow
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@CharlVS CharlVS changed the title chore(sdk): update submodule for legacy wallet migration scaffold feat(migration): implement legacy wallet migration flow Apr 10, 2026
CharlVS added 2 commits April 13, 2026 10:48
- move legacy migration handling into the parent app auth and
  wallet manager flows, including already-migrated wallet routing
- finalize restore and migration metadata in the background so
  login can complete without blocking on non-critical steps
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b9f7b02d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/bloc/auth_bloc/auth_bloc.dart Outdated
Comment thread lib/bloc/auth_bloc/auth_bloc.dart Outdated
P1: Make legacy linkage metadata write a hard requirement by removing
the try-catch that silently swallowed setMigratedLegacySource failures.
Failures now propagate to the outer catch, aborting the migration and
preventing the user from being logged into a wallet with no source-link
metadata (which would allow duplicate migrations).

P2: Fix cleanup status to reflect the actual outcome regardless of
wallet type. Previously, non-native legacy wallets always got 'complete'
status even on partial cleanup failure, suppressing follow-up handling.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4146cff057

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/bloc/auth_bloc/auth_bloc.dart
Comment thread lib/bloc/auth_bloc/auth_bloc.dart
CharlVS added 3 commits April 13, 2026 11:11
…ility

dargon2_flutter's web plugin uses JS interop APIs incompatible with
Flutter WASM builds. Replaced with pointycastle's pure-Dart Argon2
implementation which works on all platforms. Removes 7 transitive
dargon2 packages from the dependency tree.
…llback

P2: Allow metadata-enriched watcher updates through after optimistic
login. The early return in _onAuthChanged was suppressing all same-wallet
updates, including post-finalizer metadata changes (cleanup status,
activated coins). Now only suppresses when incoming metadata has no new
or changed values vs the current optimistic state.

P1: Roll back SDK session when pre-login migration metadata write fails.
After auth.register succeeds but linkage metadata write throws, sign out
the freshly registered user before emitting error state to avoid leaving
SDK auth and UI auth out of sync.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f7fa61155

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

required Future<void> Function() action,
}) async {
try {
await action().timeout(_postLoginStepTimeout);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid timeout wrappers that leave post-login tasks running

_runNonCriticalRestoreStep uses action().timeout(...), but Future.timeout does not cancel the underlying action. In _onLegacyMigration, if legacy cleanup takes more than 5 seconds, the timeout path persists cleanupStatus as incomplete, while the cleanup call can still finish successfully afterward. This creates incorrect persisted metadata (and warning UI) for wallets that were actually cleaned up, especially on slower devices or busy I/O conditions.

Useful? React with 👍 / 👎.

Replace timeout-wrapped cleanup-then-persist sequence in legacy
migration with inline try-catch so the persisted cleanup status
always reflects the actual outcome instead of racing against a
5-second Future.timeout that cannot cancel the underlying I/O.

Roll SDK submodule to af9c5b7 which hardens the RPC readiness
probe against transient transport errors and adds platform guards
to readWalletSecrets.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 612d9c2f0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +262 to +263
if (!cleanupOutcome.isComplete && !cleanupOutcome.sourceRemoved) {
throw AuthException(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fail native wallet deletion on any partial cleanup

The native-legacy delete path only throws when cleanup is partial and metadata was not removed. If deleteLegacyWalletData returns partial with sourceRemoved == true (for example, secure-storage keys fail to delete after metadata removal), this method returns success and removes the wallet from cache, leaving sensitive legacy residue with no user-visible failure or retry path.

Useful? React with 👍 / 👎.

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