Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit b4ab2b6

Browse files
authored
Add externalId to Wallet and migrate wallet IDs (#1623)
* Add externalId to Wallet and migrate wallet IDs Introduces an externalId field to the Wallet model and related records, updates all usages to support the new identifier, and adds a migration to convert existing wallet IDs to a new WalletIdentifier format. Also updates child table references and current wallet preference accordingly. AssetMarket and PriceRecord are updated to support new all-time high/low percentage fields. * Add keystoreId computed property to Wallet extension Introduces a keystoreId property to the Wallet extension, returning externalId if available, otherwise falling back to id. * Add WalletIdMigration tests and update migration logic Introduces comprehensive tests for WalletIdMigration covering various wallet types, duplicate handling, child table updates, and preference migration. Updates Wallet.mock to support externalId and refines migration logic to temporarily disable foreign key constraints during ID updates. * Add wallet externalId and migrate wallet IDs Registers migrations to add an externalId column to the wallet table and to migrate wallet IDs to the WalletIdentifier format. * Refactor WalletIdMigration to accept UserDefaults WalletIdMigration now takes a UserDefaults instance for preference migration, improving testability and flexibility. Tests updated to use a mock UserDefaults, and WalletStore gains a setOrder method for setting wallet order in tests. * Update core * Refactor wallet ID handling to use WalletIdentifier Replaces wallet type-based ID logic with WalletIdentifier throughout keystore and primitives. Updates import and migration flows to use the new identifier format, ensuring consistent wallet identification. Adjusts tests and migration logic to support the new ID scheme and migrates wallet preferences accordingly. * Update unit test targets in xctestplan Reordered and updated the list of test targets in unit_frameworks.xctestplan to reflect current project structure. Added, removed, and rearranged test targets for improved test coverage and organization. * Skip migration if wallet mappings are empty Adds a check to return early from the migrate function if no wallet mappings are found, preventing unnecessary execution of migration steps. * Refactor notification handling to simplify wallet ID usage Updated notification services and store to pass notifications directly without mapping wallet IDs, simplifying the API and reducing unnecessary transformations. Adjusted related methods and models to accommodate this change.
1 parent 553d03c commit b4ab2b6

File tree

23 files changed

+860
-193
lines changed

23 files changed

+860
-193
lines changed

Gem/Navigation/NavigationHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ extension NavigationHandler {
146146
}
147147

148148
private func navigateToTransaction(walletIndex: Int?, walletId: String, assetId: AssetId, transaction: Primitives.Transaction) async throws {
149-
guard let walletId = walletService.walletId(walletIndex: walletIndex, walletTypeId: walletId) else {
149+
guard let walletId = walletService.walletId(walletIndex: walletIndex, walletId: walletId) else {
150150
throw AnyError("Wallet not found")
151151
}
152152
let asset = try await assetsService.getOrFetchAsset(for: assetId)

0 commit comments

Comments
 (0)