fix(kyc): open BitBox connect sheet when linking shareholder wallet#720
Merged
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the KYC Add wallet step (
link_wallet), confirming a shareholder wallet while no BitBox is connected dead-ends:registerWalletthrowsBitboxNotConnectedException, the cubit emittedKycLinkWalletFailure, 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):KycLinkWalletBitboxRequired(userData).BitboxNotConnectedException, emitKycLinkWalletBitboxRequiredinstead ofFailure; addretrySubmit(userData).ConnectBitboxPagebottom sheet; on a successful connect it callsretrySubmit. 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:BitboxNotConnectedException→BitboxRequired(submit + retry), retry-success, generic exception still →Failure.Test plan