Skip to content

Add wallet-backed home page#77

Merged
reez merged 8 commits into
bitcoindevkit:mainfrom
Johnosezele:feat/bdk-demo-home-page
Jun 9, 2026
Merged

Add wallet-backed home page#77
reez merged 8 commits into
bitcoindevkit:mainfrom
Johnosezele:feat/bdk-demo-home-page

Conversation

@Johnosezele

@Johnosezele Johnosezele commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

This pr resolves #5

Replaces the home placeholder with a wallet-backed page that shows balance, sync status, a BTC/sats toggle, and offline gating for Send. It also auto-triggers sync for the current active wallet without retriggering on rebuilds, so the UI reflects the provider state.

To navigate to the Homepage tap on 'Use and Active Wallet' then 'Create a new wallet'.

Note to Reviewers:
Regtest wallets no longer show the sync card on HomePage. Regtest sync depends on local Esplora (localhost:3002), which fails on mobile and was surfacing misleading sync errors. Auto-sync stays off for regtest; Signet/Testnet behavior is unchanged. Pull-to-refresh still works. This is interim until we add a separate Developer Regtest flow with its own backend setup and wallet list.

@reez reez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, one comment

final WalletSyncResult result;
try {
result = await runner(request);
result = await runner(request).timeout(timeout);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future.timeout does not cancel the underlying sync; the Isolate.run can continue and persist the wallet DB after this controller marks timeout and releases _inFlight. Since the timeout UI immediately offers “Change server”, a retry can overlap with the old sync for the same wallet. So I think we can move the timeout into the backend/client layer or keep the controller serialized until the original runner is finished/cancelled, and add a retry-after-timeout test covering that overlap.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I removed the controller timeout and pushed it into the sync job instead... so _inFlight now stays locked until the real sync attempt finishes, and retries can’t overlap. I also map those near timeout Electrum failures into the same “Change server” UX.

@reez reez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing I'd ask is I think this attemptStopwatch can be removed to avoid leaving dead bookkeeping behind

but non-blocking, still approving

ACK c901001

await selectNetworkEndpoint(ref, network, url);
if (!context.mounted) return;
Navigator.of(context).pop();
await ref.read(syncActiveWalletTriggerProvider).call();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small async lifecycle nit: after Navigator.pop(), this bottom sheet widget may be disposed, so using this ref again can be fragile. Could we capture the sync callback before popping, then call the captured function after closing the sheet?

@j-kon j-kon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, nice work on the wallet-backed home page and the sync UX. One tiny lifecycle nit: after Navigator.pop(), the bottom sheet widget may be disposed, so using this ref again can be fragile. Could we capture the sync callback before popping, then call the captured function after closing the sheet?

@Johnosezele Johnosezele requested a review from j-kon June 9, 2026 13:24

@j-kon j-kon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my comment

ACK

@reez reez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1413dcc

great job!

@reez reez merged commit 2cec6bf into bitcoindevkit:main Jun 9, 2026
5 checks passed
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.

Example mobile app

3 participants