-
Notifications
You must be signed in to change notification settings - Fork 19
feat: load real transaction history in demo app #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
j-kon
wants to merge
17
commits into
bitcoindevkit:main
Choose a base branch
from
j-kon:feat/bdk-demo-real-transaction-history
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
71d07ad
docs: plan real transaction history
j-kon 3ae8a7d
refactor: rename transaction history model
j-kon 45141ad
feat: map wallet transactions for history
j-kon 8b46b1e
feat: load real wallet transaction history
j-kon 7cad683
chore: clean up PR 102, delete docs, fix UTC time, handle no wallet s…
j-kon db69a39
refactor: extract hasActiveWalletProvider and remove real BDK wallet …
j-kon af67b6a
test: rename helper parameter to hasActiveWallet in transactions_list…
j-kon 184bbfc
Scope transactions controller and details to active logical wallet ID
j-kon c1cb1bf
Merge remote-tracking branch 'upstream/main' into feat/bdk-demo-real-…
j-kon e4c458c
fix(demo): clean up transaction history resources
j-kon 969da23
fix(demo): scope transaction state by wallet ID
j-kon e9b32f0
feat: automatically load and refresh transaction history
j-kon 1958c9d
feat: auto-reload transactions in background after broadcast and sync…
j-kon 54114a7
fix: stabilize transaction history refresh lifecycle
j-kon aa1fe5a
ci: trigger fresh build on all platforms
j-kon 270a415
fix: queue pending transaction refreshes and resolve analyzer warning
j-kon 0986214
fix(demo): address transaction history review feedback
j-kon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
4 changes: 2 additions & 2 deletions
4
.../transactions/models/demo_tx_details.dart → ...ions/models/transaction_history_item.dart
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
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
50 changes: 50 additions & 0 deletions
50
bdk_demo/lib/features/transactions/transaction_history_mapper.dart
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import 'package:bdk_demo/features/transactions/models/transaction_history_item.dart'; | ||
|
|
||
| sealed class TransactionHistoryPosition { | ||
| const TransactionHistoryPosition(); | ||
| } | ||
|
|
||
| class ConfirmedTransactionPosition extends TransactionHistoryPosition { | ||
| final int blockHeight; | ||
| final int confirmationTime; | ||
|
|
||
| const ConfirmedTransactionPosition({ | ||
| required this.blockHeight, | ||
| required this.confirmationTime, | ||
| }); | ||
| } | ||
|
|
||
| class UnconfirmedTransactionPosition extends TransactionHistoryPosition { | ||
| const UnconfirmedTransactionPosition(); | ||
| } | ||
|
|
||
| class TransactionHistoryMapper { | ||
| const TransactionHistoryMapper._(); | ||
|
|
||
| static TransactionHistoryItem fromWalletData({ | ||
| required String txid, | ||
| required int sent, | ||
| required int received, | ||
| required TransactionHistoryPosition position, | ||
| }) { | ||
| return switch (position) { | ||
| ConfirmedTransactionPosition() => TransactionHistoryItem( | ||
| txid: txid, | ||
| sent: sent, | ||
| received: received, | ||
| pending: false, | ||
| blockHeight: position.blockHeight, | ||
| confirmationTime: DateTime.fromMillisecondsSinceEpoch( | ||
| position.confirmationTime * 1000, | ||
| isUtc: true, | ||
| ), | ||
| ), | ||
| UnconfirmedTransactionPosition() => TransactionHistoryItem( | ||
| txid: txid, | ||
| sent: sent, | ||
| received: received, | ||
| pending: true, | ||
| ), | ||
| }; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on detail, if there’s no active wallet the lookup comes back
null, and we show the same “Transaction not found” card as for a missing txid... that makes it look like the tx is gone, when the issue is there’s no wallet loaded.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in
0986214. The detail page now shows a dedicated no-active-wallet state before starting the transaction lookup, with widget coverage that keeps it distinct from a missing txid.