Skip to content

fix(kyc): open BitBox connect sheet when linking shareholder wallet#720

Merged
TaprootFreak merged 6 commits into
stagingfrom
fix/bitbox-connect-on-link-wallet
Jun 9, 2026
Merged

fix(kyc): open BitBox connect sheet when linking shareholder wallet#720
TaprootFreak merged 6 commits into
stagingfrom
fix/bitbox-connect-on-link-wallet

Conversation

@TaprootFreak

Copy link
Copy Markdown
Contributor

Problem

In the KYC Add wallet step (link_wallet), confirming a shareholder wallet while no BitBox is connected dead-ends: registerWallet throws BitboxNotConnectedException, the cubit emitted KycLinkWalletFailure, and the user only saw a red "BitBox is not connected" banner with no way forward.

Reproduced on device (iOS): "Wallet hinzufügen" → tap → red error, spinner stuck.

Fix

Mirror the already-correct sibling flow (KycRegistrationSubmitCubit / KycRegistrationPage):

  • State — new KycLinkWalletBitboxRequired(userData).
  • Cubit — on BitboxNotConnectedException, emit KycLinkWalletBitboxRequired instead of Failure; add retrySubmit(userData).
  • Page — the listener opens the shared ConnectBitboxPage bottom sheet; on a successful connect it calls retrySubmit. The builder renders the idle confirm body for the new state, so dismissing the sheet returns the user to the submit button (no spinner dead-end).

No new strings (reuses existing i18n + ConnectBitboxPage). Other states (Ready/Submitting/Success/Failure) are behaviorally unchanged.

Tests

  • kyc_link_wallet_cubit_test.dart: BitboxNotConnectedExceptionBitboxRequired (submit + retry), retry-success, generic exception still → Failure.
  • Existing page tests unchanged and green.

Test plan

  • CI: Analyze & Test, Coverage Floor Gate, Visual Regression, BitBox quirks audit green
  • On-device: Add-wallet without BitBox → connect sheet opens, connect device → registration completes
  • Dismiss sheet without connecting → lands back on submit button (no dead-end)

Confirming a shareholder wallet in the KYC "Add wallet" step without a
connected BitBox made registerWallet throw BitboxNotConnectedException,
which the page surfaced as a dead-end red "BitBox is not connected" error.

Mirror the registration flow: the cubit now emits a dedicated
KycLinkWalletBitboxRequired state instead of a failure, the page opens the
shared ConnectBitboxPage bottom sheet, and retrySubmit re-runs registration
once the device is linked. The idle confirm body is rendered underneath so
dismissing the sheet returns the user to the submit button.
@TaprootFreak TaprootFreak marked this pull request as ready for review June 9, 2026 16:52
TaprootFreak and others added 5 commits June 9, 2026 19:17
Add widget tests for the new BitboxRequired branch of KycLinkWalletView:
the connect sheet opens, a successful connect (sheet returns true) retries
registration, and dismissing the sheet does not retry. ConnectBitboxPage is
built against a mocked BitboxService (empty device list) so the sheet wiring
is asserted without driving the pairing ceremony.

Add a golden for the BitboxRequired state to lock that it renders the idle
confirm body rather than a spinner or error dead-end. Baseline regenerated
on the dfx01 runner.
The dfx01 golden regenerate re-rendered home_page_loaded.png (sub-pixel,
unrelated to this feature). Keep only the new link_wallet bitbox-required
baseline so the PR stays scoped.
Close the two remaining gaps in kyc_link_wallet_page.dart:
- onFinish closure (HomeBloc wallet-sync + context.pop(true) → retrySubmit):
  host the view in a GoRouter stack and invoke ConnectBitboxView.onFinish,
  exactly as the connect flow does on BitboxFinishSetup.
- the page's own BlocProvider wiring: render the real KycLinkWalletPage with
  userData so it builds its KycLinkWalletCubit from getIt.

Feature now at 100% lines (cubit, state, page).
…ct flow

Stitches the real KycLinkWalletCubit + real RealUnitRegistrationService +
real Eip712Signer + a FakeBitboxCredentials sign boundary + a MockClient HTTP
boundary. Pins the orchestration seam the unit/widget suites only cover in
isolation:
- a disconnected BitBox surfaces KycLinkWalletBitboxRequired without ever
  hitting the API (sign throws before the POST),
- after the device connects, retrySubmit signs and POSTs to
  /v1/realunit/register/wallet → KycLinkWalletSuccess,
- the end-to-end reconnect emits Submitting→BitboxRequired→Submitting→Success
  with exactly two sign attempts.

The pairing ceremony itself stays covered by connect_bitbox_flow_test.
@TaprootFreak TaprootFreak merged commit 64c8cde into staging Jun 9, 2026
6 checks passed
@TaprootFreak TaprootFreak deleted the fix/bitbox-connect-on-link-wallet branch June 9, 2026 21:37
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.

1 participant