Make transaction sending fully async so the UI only reports success after broadcast completes
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift and trace the send flow through BuildTransactionViewModel.swift and BuildTransactionView.swift. Update the flow so signing and broadcasting complete before success is reported, remove the fixed-delay heuristic, and verify that failures stay on the send screen while successful broadcasts show success afterward.
Written by the indexing model from the issue text.
Description
Summary
The current send flow can report success before the transaction has actually been broadcast.
BDKClient.send is exposed as a synchronous throwing API, but the live implementation immediately starts an internal Task and returns without waiting for the async broadcast to finish. Because of that, the UI continues as if the send succeeded even though the real network operation is still in progress.
Why This Matters
This creates a user-facing correctness bug:
- The app can show a success state before the transaction is actually broadcast.
- Broadcast failures may be surfaced too late, or not in the right screen context.
- The user can be navigated away from the send screen even if the transaction was rejected.
- A wallet app should never optimistically confirm a send before the backend confirms success.
Current Behavior
BuildTransactionViewModel.send()callsbdkClient.send(...).- The live
BDKClient.sendimplementation starts a backgroundTaskand returns immediately. BuildTransactionViewModelthen postsTransactionSentright away.BuildTransactionViewwaits one second and assumes success if no error has appeared yet.
This means success is based on timing, not on the actual result of the broadcast.
Expected Behavior
The send flow should only report success after signing and broadcasting have completed successfully.
Proposed Fix
- Change the send API from synchronous to
async throwsacross the stack. - Make
BDKClient.sendawaitBDKService.send(...)directly instead of wrapping it in a detachedTask. - Update
BuildTransactionViewModel.send()to beasync. - In
BuildTransactionView, await the send call and only show the success UI after it returns successfully. - Remove the one-second timer-based success heuristic.
- Post wallet update notifications only after the async send has actually succeeded.
Suggested Acceptance Criteria
- A failed broadcast does not show the success checkmark.
- The user remains on the send screen when send fails.
- A successful broadcast shows success only after the async operation completes.
- No send-related state depends on fixed delays or race-prone background fire-and-forget tasks.
References
BDKSwiftExampleWallet/Service/BDK Service/BDKService.swiftBDKSwiftExampleWallet/View Model/Send/BuildTransactionViewModel.swiftBDKSwiftExampleWallet/View/Send/BuildTransactionView.swift
- Dominant language
- Swift
- Stars
- 31
- Forks
- 16
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bitcoindevkit/BDKSwiftExampleWallet
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
bitcoindevkit/BDKSwiftExampleWallet#352 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
bitcoindevkit/BDKSwiftExampleWallet#351 · 1 comment ·
-
experimental: events Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
bitcoindevkit/BDKSwiftExampleWallet#350 · 1 comment ·
All issues in bitcoindevkit/BDKSwiftExampleWallet
Similar issues
-
area:dictation documentation P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
uttrflow/uttrflow-swift#1180 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·