Skip to content

refactor: use core hw activities#1044

Draft
ovitrif wants to merge 10 commits into
masterfrom
refactor/core-hww-activities-1029
Draft

refactor: use core hw activities#1044
ovitrif wants to merge 10 commits into
masterfrom
refactor/core-hww-activities-1029

Conversation

@ovitrif

@ovitrif ovitrif commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Closes #1029
Refs #998

Description

This PR refactors hardware-wallet activity handling to use bitkit-core wallet-scoped activities instead of keeping Trezor transactions as separate in-memory watch-only entries.

This PR:

  1. Bumps bitkit-core to 0.3.8 and keeps activity reads, tags, transaction details, deletion, metadata, and seen-state calls scoped by wallet id.
  2. Uses enum-backed wallet id helpers for Bitkit/Trezor ownership and preview/default values, avoiding raw wallet-type strings in the integration code.
  3. Derives stable hardware wallet ids from account xpubs and starts Trezor watchers with those ids so emitted activities are scoped to the correct wallet, including hidden-wallet/passphrase changes.
  4. Persists watcher-emitted hardware activities and transaction details into Core before exposing watcher state, and ignores watcher events that do not belong to an active wallet-scoped watcher.
  5. Keeps wallet scope attached when opening Activity Detail, Explore, and Boost flows, preventing duplicate txid/activity collisions across wallets.
  6. Projects Core activity and hardware-wallet values into ViewModel-owned stable UI types before they reach Compose screens, while repositories and ViewModels still use Core/domain models internally.
  7. Aggregates duplicate on-chain rows emitted by multiple hardware address-type watchers so hardware balances and activity rows use the wallet-level net amount.
  8. Deletes wallet-scoped hardware activity data when a paired hardware wallet is removed and surfaces purge failures instead of reporting removal success with stale Core activity data.
  9. Removes the stale LNURL-pay MetadataMismatch handling accidentally carried by this branch; the LNURL validation change is already on master and there is no replacement exception to map.

Out of scope for #1030:

  1. Backing up and restoring paired-device records.
  2. Adopting the new typed Trezor PIN, lock, and busy error types beyond the compile-time call-site updates included here.

Preview

QA Notes

Manual Tests

  • 1. Hardware seed distinct from Bitkit wallet seed → pair a Trezor → Wallet Home: hardware transactions appear with blue icons in the activity list.
  • 2. Wallet Home → Show All → switch activity tabs and apply a tag filter: hardware activities remain visible when they match the selected filter.
  • 3. Hardware activity → Activity Detail → Add Tag → back → reopen Activity Detail: tag persists.
  • 4. Hardware activity → Activity Detail → Explore: inputs and outputs render.
  • 5. Hardware activity → Activity Detail → Boost: sheet loads the wallet-scoped Core activity and does not fall back to all-wallet lookup.
  • 6. Settings → Hardware Wallets → remove the paired device: its hardware activities disappear; re-pairing rebuilds history from the watcher.
  • 7. regression: normal on-chain/LN activity → Activity Detail → tags, Explore, and Boost: behavior matches master.

Automated Checks

  • Unit tests modified: HwWalletRepoTest.kt covers active-watcher ownership, Core persistence ordering, duplicate address-type aggregation, wallet-id watcher restarts, and removal purge failures.
  • Unit tests modified: TrezorRepoTest.kt, ActivityRepoTest.kt, ActivityDetailViewModelTest.kt, ActivityListViewModelTest.kt, AppViewModelSendFlowTest.kt, NotifyPaymentReceivedHandlerTest.kt, and PreActivityMetadataRepoTest.kt cover deterministic hardware wallet id derivation, scoped activity lookup/navigation, hardware tag/filter behavior, sheet detail routing, and nullable wallet-scope defaults.
  • Unit tests modified: HomeViewModelTest.kt, HwWalletViewModelTest.kt, and BoostTransactionViewModelTest.kt cover the UI projections and the public boost setup path used by the sheet.
  • Journey coverage updated: activity-blue-icons.xml covers unified hardware activity list/tab behavior; activity-detail-hw-tags.xml covers hardware tags and Explore inputs/outputs.
  • Local verification: just compile, just test, and just lint passed on f3f9a2c.

@greptile-apps

This comment has been minimized.

greptile-apps[bot]

This comment was marked as resolved.

@ovitrif ovitrif self-assigned this Jun 24, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@ovitrif ovitrif marked this pull request as draft June 24, 2026 22:22
@ovitrif ovitrif changed the title feat: integrate hardware wallet activities with core refactor: use scoped hw activities Jun 24, 2026
@ovitrif ovitrif changed the title refactor: use scoped hw activities refactor: use core hw-scoped activities Jun 25, 2026
@ovitrif ovitrif changed the title refactor: use core hw-scoped activities refactor: use core hw activities Jun 25, 2026
@ovitrif

ovitrif commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Handoff note while I'm on PTO:

The core walletId/current activity work has landed. This PR is now waiting for the published Android package from the bitkit-core release path.

Current core state:

When core unblocks this:

  1. Fix any merge conflicts on this PR branch.
  2. Update gradle/libs.versions.toml to consume com.synonym:bitkit-core-android 0.3.8, or the next release if 0.3.8 publish fails and is replaced.
  3. Resolve any generated API changes in this PR branch.
  4. Run the normal PR checks: just compile, just test, just lint.
  5. Update this PR description/status with the consumed bitkit-core release.

@ovitrif ovitrif force-pushed the refactor/core-hww-activities-1029 branch from 16a9a54 to f3f9a2c Compare July 1, 2026 12:58
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.

Bitkit Core support for hardware wallet activities

2 participants