Publish watch-only Bitcoin positions into existing Crypto accounts
Upstream native PR #5673 · Upstream tracker.
Part 4 of 5 in the upstream Bitcoin wallet tracker. Base stack/bitcoin-foundation · Head feat/bitcoin-wallet-publishing. This diff starts after we-promise/sure#4613 and we-promise/sure#4712.
Problem and behaviour
A complete Bitcoin wallet read gives Sure a quantity. An existing Crypto account may also have cash, trades, other assets and manual valuations. This change publishes only the BTC holding and records the wallet’s net movements as zero-cash trades. Spending 0.03001000 BTC including the network fee reduces that position by 0.03001000 BTC without changing the account’s fiat cash.
The first priced publication establishes the cash baseline. If the first price is unavailable, disconnecting preserves the previous manual valuation. Existing transactions establish the starting balance. Later confirmations, replaced transactions and chain reorganizations reconcile the journal. Adding a source changes coverage while the original connection date continues to protect published movements.
Review scope
- Start with
BitcoinWalletAccount#connect!,BitcoinWalletAccount::Processorand the shared holding and balance materializers. - Only the provider-managed security is protected against trade edits, removal and remapping. Connection status exposes counts and freshness for the API caller’s accessible accounts. Public keys and address lists stay out of that response.
- Connected wallets participate in hourly and family sync. A failure to schedule one wallet is handled independently.
- The tables and accounting migrations belong to the prerequisite PRs. This layer adds no migration.
Validation
- Rails suite on the rebased head passed with 18,657 tests, 114,134 assertions, 9 skips, zero failures or errors.
- Chromium system suite: 450 tests, 2527 assertions, 0 skips, zero failures or errors.
- RuboCop, full ERB lint, Biome and Brakeman passed.
- API documentation regenerated and verified. The request specs use the shared API-key authentication pattern.