Skip to content

refactor: use core hw activities#1044

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

refactor: use core hw activities#1044
ovitrif wants to merge 8 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

Status

Blocked by upstream Bitkit Core work:

  1. refactor: move walletId to v2 activity models bitkit-core#112 — move walletId to v2 activity models instead of changing the current v1 activity schema.
  2. fix: add wallet-scoped backup migrations bitkit-core#113 — add wallet-scoped backup/restore migrations for Core-owned serialized models.

This PR should stay open as the Android integration branch for hardware-wallet activities, but it should not merge until the corrected Bitkit Core model/versioning and backup migration work is available and Android is rebased onto that release.

Description

This PR refactors hardware-wallet activity handling to use Bitkit Core's wallet-scoped activity model instead of keeping Trezor transactions as separate in-memory watch-only entries.

This PR:

  1. Bumps bitkit-core to 0.3.4 and threads wallet ids through activity reads, tags, transaction details, deletion, pre-activity metadata, and seen-state helpers.
  2. Adds a typed activity wallet identifier model so local Bitkit and Trezor wallet ids are derived from enum-backed values instead of passing raw wallet-type strings around.
  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 or Explore, removing the all-wallet activity lookup fallback and preventing duplicate txid collisions across wallets.
  6. Aggregates duplicate on-chain rows emitted by multiple hardware address-type watchers so hardware balances and activity rows use the wallet-level net amount.
  7. 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.

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. Settings → Hardware Wallets → remove the paired device: its hardware activities disappear; re-pairing rebuilds history from the watcher.
  • 6. regression: normal on-chain/LN activity → Activity Detail → tags and Explore: 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.
  • 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.

@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
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

1 participant