feat: scaffold transaction presentation in bdk_demo active wallet flow#62
feat: scaffold transaction presentation in bdk_demo active wallet flow#62j-kon wants to merge 3 commits intobitcoindevkit:mainfrom
Conversation
|
@Johnosezele cc |
|
Nice improvement to the demo flow and the widget coverage is solid. I found one correctness issue before approval: TransactionDetailPage caches its future in initState, but go_router keys matched pages by the route pattern, so changing /transactions/:txid can reuse the same State and leave the screen showing the old transaction. Once that lifecycle case is handled, this is looking pretty good to merge. |
Good catch, that makes sense. I’ll update the page to handle route changes properly instead of caching in initState. |
|
Good catch on that — makes sense. I’ve fixed it by refreshing the cached future in Also added a widget test to cover this exact case (same page instance, different txid). Everything’s passing on my end. Happy to adjust if you prefer a different approach. CC @reez |
Johnosezele
left a comment
There was a problem hiding this comment.
Thanks for taking this on! Great changes in the UI side of things.
I recognize this as a scaffold pr but I think there's some mixup from the ground up
You're not fetching transaction details from CanonicalTx of bdk.dart where sent/received come from wallet.sentAndReceived().
For your changes on the wallet_service.dart file, you are mostly return hardcoded placeholder data, you're not making use of our bdk.dart bindings api, I can't see any of the related methods, can you take a look at this commit. By extension this has a huge impact on wallet_providers.dart
For the test section of your PR, We'd need to structure /bdk_demo/test because as our test suite grows things may begin to look tightly coupled, part of what I did in the /test section of this commit which is still draft.
@reez pls can you hold off on merging this just yet, there seem to be alot of parallel implementation conflict as this is a scaffold pr, it would need to be rebased due to lots of conflicting changes with [this](https://github.com/bitcoindevkit/bdk-dart/pull/61)
| # BDK-Dart Wallet (Flutter) | ||
|
|
||
| The _BDK-Dart Wallet_ is a wallet built as a reference app for the [bitcoindevkit](https://github.com/bitcoindevkit) on Flutter using [bdk-dart](https://github.com/bitcoindevkit/bdk-dart). This repository is not intended to produce a production-ready wallet, the app only works on Signet, Testnet 3, and Regtest. | ||
| The _BDK-Dart Wallet_ is a Flutter reference app for [bitcoindevkit](https://github.com/bitcoindevkit) using [bdk-dart](https://github.com/bitcoindevkit/bdk-dart). It is intentionally a demo and scaffold, not a production-ready wallet, and currently targets Signet, Testnet 3, and Regtest. |
There was a problem hiding this comment.
I see some change in description here that may not be related to this pr, is this intentional?
| The demo app is built with the following goals in mind: | ||
| 1. Be a reference application for the `bdk_dart` API on Flutter (iOS & Android). | ||
| 2. Showcase the core features of the bitcoindevkit library: wallet creation, recovery, Esplora/Electrum sync, send, receive, and transaction history. | ||
| 2. Sketch the wallet creation, recovery, sync, send, receive, and transaction-history flows the app can grow into over time. |
There was a problem hiding this comment.
same here as my comment above, if you can maybe add readme update as a separate commit.
| class _TransactionDetailPageState extends ConsumerState<TransactionDetailPage> { | ||
| late final Future<TxDetails?> _transactionFuture; | ||
|
|
||
| @override | ||
| void initState() { | ||
| super.initState(); | ||
| _transactionFuture = ref | ||
| .read(walletServiceProvider) | ||
| .loadTransactionByTxid(widget.txid); | ||
| } |
There was a problem hiding this comment.
_transactionFuture is cached in initState as late final. If go_router reuses the same state object with a different txid (which happens when navigating between /transactions/:txid1 and /transactions/:txid2), the page will show stale data.
There was a problem hiding this comment.
Could you consider moving shared helper widgets (_InfoCard, _LoadingCard, _DetailRow, _StatusChip) to features/shared/widgets/ since similar widgets are duplicated in transaction_detail_page.dart too.
_StatusChip and _DetailRow are defined almost identically in both active_wallets_page.dart and transaction_detail_page.dart. Can you extract them to a shared location.
| String get shortTxid => txid.length > 10 | ||
| ? '${txid.substring(0, 6)}...${txid.substring(txid.length - 4)}' |
There was a problem hiding this comment.
can you make shortTxid delegate to Formatters.abbreviateTxid(txid) or remove one, they are two impl of same logic.
| .read(walletServiceProvider) | ||
| .loadTransactionByTxid(widget.txid); | ||
| } | ||
|
|
There was a problem hiding this comment.
consider adding test verifying that navigating from one transaction to another correctly refreshes the detail page.
| return; | ||
| } | ||
|
|
||
| await Future<void>.delayed(Duration.zero); |
There was a problem hiding this comment.
nit: could this be removed? Is there a specific reason for it?
|
Thanks a lot for the detailed review — this really helps. I see what you mean about the mixup with using placeholder data instead of wiring through the bdk.dart APIs, and also the structure concerns around the demo/tests. I’ll take a step back and align this properly with the existing architecture, rework the service layer to use CanonicalTx / wallet APIs, and clean up the structure as suggested. Also noted on the README and shared widgets — I’ll split those changes out and refactor accordingly. Appreciate the guidance here 🙏 |
|
merged #61 so can rebase this branch |
Summary
Adds a transaction detail flow to the reference wallet scaffold.
What changed
TransactionDetailPageto display:WalletService.loadTransactionByTxidFakeWalletServiceNotes