feat: add trezor onchain event watcher#976
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4fd96a304
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 018feaca8b
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58f11e5f04
ℹ️ 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".
| isStarting = true, | ||
| activeWatcherId = null, | ||
| startingWatcherId = watcherId, |
There was a problem hiding this comment.
Reject overlapping watcher starts
When startWatcher() is triggered twice before the UI recomposes/disabled state takes effect (for example a rapid double tap), this update overwrites the first in-flight startingWatcherId with a new id. If the first native trezorRepo.startWatcher later succeeds, handleWatcherStartSuccess hits its mismatched-id guard and never calls stopWatcher for that first watcher, so it remains running while the UI only tracks/stops the second watcher. Add an early return while isStartingWatcher or activeWatcherId is set, or stop stale successful starts.
Useful? React with 👍 / 👎.
# Conflicts: # gradle/libs.versions.toml
Adds an Event Watcher section to the (dev-only) Trezor screen that consumes the new bitkit-core on-chain xpub watcher. Enter or populate an extended key, start/stop a live watcher, and observe streaming balance, transactions, connection status, and an event log.
Depends on bitkit-core
0.1.65Description
WatcherSectioncomposable: extended-key + gap-limit inputs, populate-from-xpub, start/stop controls, and a live view of balance, transactions, connection status, and an event log.TrezorViewModel:WatcherEvents from the repo and maps them into a newTrezorWatcherState(balance, transactions, tx count, block height, account type, connection status, event log).watcherId, validates the xpub/gap-limit inputs, and surfaces errors via toasts.onCleared()so no watcher thread is leaked.TrezorRepo: exposes a bufferedwatcherEventsSharedFlowbridged from a coreEventListener, plusstartWatcher/stopWatcher/stopAllWatchersreturningResult<Unit>.TrezorService: thin wrappers overonchainStartWatcher/onchainStopWatcher/onchainStopAllWatchers.bitkit-coreto0.1.65inlibs.versions.toml.QA Notes
0.1.65.onCleared)../gradlew compileDevDebugKotlin,./gradlew testDevDebugUnitTest --tests TrezorViewModelTest --tests TrezorRepoTest,./gradlew detekt— all pass.