Skip to content

feat: persist hardware activities#1044

Open
ovitrif wants to merge 1 commit into
masterfrom
refactor/core-hww-activities-1029
Open

feat: persist hardware activities#1044
ovitrif wants to merge 1 commit 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:

  1. Persists hardware-wallet watcher activities and Electrum transaction details in bitkit-core under the wallet ID already derived and stored by master.
  2. Uses the current bitkit-core activity model and the existing HwWalletId/KnownDevice identity path across watcher events, navigation, detail loading, tags, seen state, boost relationships, and deletion.
  3. Returns app and paired hardware-wallet activity through one sorted Core list while retaining wallet-scoped row identity, detail lookup, transaction lookup, tags, and UI keys.
  4. Reconciles each hardware watcher snapshot with Core, keeps live watcher state visible during persistence recovery, and emits received-transaction notifications after successful persistence.
  5. Preserves Transfer To Spending metadata on the hardware wallet activity so one blue Transfer / From Savings row represents the funding transaction.
  6. Deletes the removed device's Core activity scope and rebuilds that wallet's visible history from the watcher after re-pairing.

Preview

No visual redesign. Home, All Activity, Activity Detail, tag filtering, and Explore now render the wallet-scoped hardware activities supplied by bitkit-core.

QA Notes

Manual Tests

  • 1. Settings → Advanced → Dev Settings → Trezor → pair the Bridge emulator: Home shows the connected hardware wallet tile, balance, and blue hardware activities.
  • 2. Fund two hardware addresses with distinct amounts → mine a block → Home → Show All: both blue received rows appear once in the unified activity list.
  • 3. Blue hardware receive → Activity Detail → add a tag → back → reopen → Explore: the tag persists and Inputs plus Outputs contain the Electrum transaction details.
  • 4. All Activity → tag filter → select the hardware tag: the tagged blue row remains and untagged rows are absent.
  • 5. Hardware wallet → Transfer To Spending → 25% → Continue → Open Trezor Connect → approve Recipient, Amount, Locktime, and Summary → Continue Using Bitkit: Home shows exactly one new blue Transfer / From Savings row and its detail shows TO SPENDING.
  • 6. All Activity → switch Sent, Received, Other, and All: received hardware rows appear under Received, the hardware Transfer appears under Other, and All restores the combined list without a default-wallet duplicate.
  • 7. Settings → Hardware Wallets → remove the paired device → re-pair the same wallet: its scoped activity disappears on removal and rebuilds without duplicate rows after pairing.
  • 8. regression: app on-chain and LN activity → Activity Detail, tags, Explore, and wallet-specific lists: behavior matches master.

Automated Checks

  • Unit tests modified: HwWalletRepoTest.kt, ActivityRepoTest.kt, and TransferRepoTest.kt cover active watcher ownership, Core snapshot persistence, persistence recovery, wallet removal, transfer metadata, and activity/transaction ID collisions across wallet scopes.
  • Unit tests modified: ActivityDetailViewModelTest.kt, ActivityListViewModelTest.kt, AppViewModelSendFlowTest.kt, and TransferViewModelTest.kt cover scoped detail/tag calls, global unified listing, scoped navigation, hardware notification routing, and Transfer To Spending ownership.
  • Related unit fixtures updated: NotifyPaymentReceivedHandlerTest.kt and BoostTransactionViewModelTest.kt retain default-wallet behavior with the scoped repository API.
  • Hardware-wallet journeys updated: activity-blue-icons.xml and transfer-to-spending.xml; activity-detail-hw-tags.xml adds persisted tag and inputs/outputs coverage.
  • Product-level verification: the Android 17 emulator and deterministic T2T1 Bridge emulator completed pairing, two confirmed hardware receives, persisted tags, tag filtering, Core inputs/outputs, all activity-tab assertions, four-step device signing, and one wallet-scoped pending transfer row.
  • Local verification: just compile, just test (1,619 tests), and just lint passed; all hardware-wallet journey XML files passed xmllint.

@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

This comment was marked as outdated.

@ovitrif
ovitrif force-pushed the refactor/core-hww-activities-1029 branch 2 times, most recently from f3f9a2c to 435d9b0 Compare July 4, 2026 19:35
@ovitrif

ovitrif commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator Author

Status update:

  • This PR now consumes bitkit-core 0.3.9.
  • Local verification passed on c0274e311: just compile, just test, and just lint.
  • There are no unresolved review threads currently open.
  • Coordination note: feat: bump core to 0.3.9 and hw reliability #1062 touches much of the same Core/HW wallet surface. I’d recommend keeping this PR as the base for the Core hardware-activity refactor, then rebasing or splitting feat: bump core to 0.3.9 and hw reliability #1062 afterward so the hardware reliability fixes stay separately reviewable.

@ovitrif

This comment was marked as outdated.

@piotr-iohk

This comment was marked as outdated.

@ovitrif

ovitrif commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Decouple UI from persist — update watcher state even if Core persist fails; log error separately.

Addressed this Android-side gating issue: watcher state now updates before Core persistence, so the Trezor balance/activity UI stays live even if a Core upsert fails. Persistence failures are still logged with the watcher id, and received-transaction emission remains behind successful persistence.

Validation: just compile, just test, just lint.

The migration/collision and transfer dedup points remain broader draft follow-ups outside this scoped fix.

Resolved in f546f58

@ovitrif ovitrif added this to the 2.5.0 milestone Jul 6, 2026
@ovitrif

ovitrif commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Set milestone to 2.5.0 for clarity 👍🏻 , thanks for review & checks @piotr-iohk 🙏🏻

github-advanced-security[bot]

This comment was marked as resolved.

@ovitrif
ovitrif changed the base branch from master to feat/wallet-scoped-core-0.3.9 July 7, 2026 12:13
@ovitrif
ovitrif force-pushed the refactor/core-hww-activities-1029 branch from 708cd21 to 794722a Compare July 7, 2026 12:13
Base automatically changed from feat/wallet-scoped-core-0.3.9 to master July 9, 2026 08:53
@ovitrif
ovitrif force-pushed the refactor/core-hww-activities-1029 branch from ea9a252 to 5ae816a Compare July 9, 2026 20:35
@ovitrif

ovitrif commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Trezor shows 0 balance + empty activity list

Transfer shows duplicate rows - Transfer + Sent

Scope ahead of 2.4.0

The branch is now rebased on the merged #1062 and latest master, and consumes bitkit-core 0.4.0. The old pre-release database state from this report is no longer the branch/base under review. Wallet-scoped persistence is the source of truth, and watcher state is published only after the matching activities and transaction details are available for list/detail navigation.

I reran the full Bridge flow on the current head with two independently funded and mined hardware receives. Both appeared once with the correct wallet scope, and list tabs, tags, tag filtering, Activity Detail, and Explore all used the persisted entries.

Transfer-to-spending now reconciles the watcher-created sent activity with the transfer metadata. The Bridge run showed one pending Transfer / From Savings row, then the same row confirmed after mining while Spending increased by the transferred amount. Device removal purged that wallet's activities, and re-pairing rebuilt its confirmed history.

This work remains scoped to 2.5.0 / #1029. just compile, just test, and just lint all pass on the current head.

Resolved in 5ae816a

@ovitrif
ovitrif marked this pull request as ready for review July 9, 2026 20:39
@chatgpt-codex-connector

This comment has been minimized.

Comment thread app/src/main/java/to/bitkit/models/ActivityWalletType.kt Outdated
@ovitrif

ovitrif commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

AFAIU this needs a new agent run to make sure it builds correctly on top of latest merges into master and doesn't try to reinvent wheels that have been added in the meantime.
I can give it a go once master and Trezor v1 PRs settle

@ovitrif
ovitrif force-pushed the refactor/core-hww-activities-1029 branch from 0d7d218 to 15b80fa Compare July 14, 2026 15:50
@jvsena42

Copy link
Copy Markdown
Member

AFAIU this needs a new agent run to make sure it builds correctly on top of latest merges into master and doesn't try to reinvent wheels that have been added in the meantime. I can give it a go once master and Trezor v1 PRs settle

Indeed, most of these changes were already implemented

@jvsena42
jvsena42 marked this pull request as draft July 15, 2026 09:35
@ovitrif
ovitrif force-pushed the refactor/core-hww-activities-1029 branch from 15b80fa to b4bbc26 Compare July 22, 2026 18:30
@ovitrif ovitrif changed the title refactor: use core hw activities feat: persist hardware activities Jul 22, 2026
@ovitrif

ovitrif commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator Author

Indeed, most of these changes were already implemented

I rebuilt the branch from current master and retained the missing bitkit-core persistence and unified activity integration. The Trezor lifecycle, wallet identity, watcher APIs, and hardware-wallet foundation now come directly from master; the branch-local type and identity implementations are removed. The full repository checks and Bridge-backed hardware journeys pass on the reconstructed head.

Resolved in b4bbc26

@ovitrif
ovitrif marked this pull request as ready for review July 22, 2026 18:31
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

4 participants