Connect multi-address Bitcoin wallets from a Crypto account

Draft
VL
13d ago
+6246-177

Superseded by #5674 in the native Bitcoin stack. Further review continues there on the same commit, 238acd591. This PR preserves the earlier discussion. Feature tracker.

Problem and behaviour

People who track a Bitcoin wallet in an existing Crypto account need to see which addresses and how much BTC Sure found before changing the account. The account menu opens a watch-only setup dialog for an admin with Preview enabled and owner or full-control access to that account.

The dialog accepts a public Bitcoin address or a supported xpub/zpub, shows discovery progress and confirmed/pending BTC, and lets the user connect the wallet. The same dialog supports adding or removing a source, syncing and disconnecting. Other account activity remains available. Turning off Preview hides management while a connected wallet continues syncing.

Review scope

  • Start with BitcoinWalletsController, the account menu and the wallet dialog. Direct requests go through the same authorization checks as the visible controls.
  • The account and holding views distinguish a managed BTC position from other assets. Generic unlink sends the user through the wallet management flow. Translated copy covers all eight supported locales.
  • Browser coverage exercises the account menu, polling without losing typed input, a narrow viewport, and retained holdings after disconnection. The existing single-address Bitcoin connection stays available during Preview.
  • No migration is added in this layer.

Validation

  • Rails suite on the rebased head passed with 18,680 tests, 114,281 assertions, 9 skips, zero failures or errors.
  • Chromium system suite: 454 tests, 2548 assertions, 0 skips, zero failures or errors.
  • RuboCop, full ERB lint, Biome and Brakeman passed.

Screenshots

Fixture wallet, shown before and after connection.

Bitcoin quantity preview

Connected Bitcoin wallet


Summary by cubic

Connects watch-only Bitcoin wallets to existing manual Crypto accounts, letting admins with Preview enabled see discovered addresses and balances before publishing a position. An admin with owner/full-control access can add a public address or BIP84 xpub/zpub, watch discovery progress, see confirmed and pending BTC, and manage sources, sync, and disconnect from the account menu. The existing single-address Bitcoin connection remains available; turning off Preview hides management while a connected wallet continues syncing.

This also adds cash-anchor accounting for manual accounts so a wallet's BTC position can be tracked without disturbing the rest of the account's ledger. All copy is localized into eight locales; no migration is required.

Notes

  • Addresses already tracked by another connected Bitcoin account in the same household are rejected to avoid double counting.
  • Connected positions are protected from direct edits; disconnect the wallet first to change the quantity.

Summary by CodeRabbit

  • New Features
    • Added Bitcoin wallet tracking from public addresses or extended public keys, with address discovery, sync status, balance details, and wallet management.
    • Wallet tracking can update Bitcoin positions in eligible crypto accounts while preserving other holdings and account history.
    • Added cash balance reconciliation for accounts using manual accounting.
    • Provider connection details now include accessible Bitcoin wallet status and summary information.
  • Improvements
    • Clearer trade and transfer activity, plus safeguards for provider-managed positions.
    • Improved balance and holding updates across account syncs and reconciliation.