Skip to content

Updates to facilitate Trezor integration in mobile #107

Description

@ovitrif

While reviewing the watch-only hardware-wallet layer on this branch, a few things stood out that would be better owned by core than reimplemented per-platform.

Note: I diffed against the local bitkit-core checkout, which is at 0.1.40 and predates the watcher / wallet-scoped-activity surface this PR consumes from 0.3.2 — so these are against the consumed 0.3.2 binary, not the source. Flagging in case the source needs a bump too.

Subtasks

  • 1. Core should own the wallet_id derivation
    The per-device id is improvised on the Swift side (HwWalletId.derive = "trezor:" + SHA256(sorted xpubs)) and the PR already flags it as interim pending agreement with Android. If iOS and Android derive it independently, the same physical device yields different ids and activity won't reconcile cross-platform. Suggest a core deriveWalletId(xpubs:) so both platforms are guaranteed identical by construction.
  • 2. Have the watcher emit Activity instead of HistoryTransaction
    HwWalletManager.onchainActivity() hand-reconstructs an Activity from HistoryTransaction — guessing direction from received > sent, netting the fee, and hardcoding feeRate: 1 / address: "". That's core's job, and the placeholder fee-rate will render wrong. Emitting Activity (or exposing a watchOnlyActivityFromHistory(walletId:txs:) mapper) removes a per-platform mapping that iOS and Android will otherwise drift on.
  • 3. gapLimit: 20 should be a core default
    instead of being duplicated in HwWalletManager and the watcher params on each platform.
  • 4. Core should own supported hardware-wallet metadata and capabilities
    Android currently carries supported-device display metadata in app code while Trezor is only one concrete implementation of the generic hardware-wallet layer. Expose the supported vendors/models/capabilities from core so Android and iOS can render supported devices generically instead of duplicating Trezor-specific supported-HW info per platform. Follow-up from feat: transfer to spending from hw wallet bitkit-android#1039.

Originally posted by @jvsena42 in synonymdev/bitkit-ios#605 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions