Conversation
show transaction details after broadcast
Fix coin group header balance in swap form dropdowns
…-broadcast use withdraw preview signed hex for broadcast
WalkthroughThis PR integrates MM2 API into the withdrawal flow, replacing Trezor-progress signaling with direct broadcast via MM2. UI improvements include transaction details display post-withdrawal, grouped coin balance visualization in orders table, and an optional trailing widget parameter for coin table items. A translation key is corrected. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant WithdrawForm as WithdrawForm UI
participant Bloc as WithdrawFormBloc
participant MM2 as MM2 API
participant TxDetails as TransactionDetails
User->>WithdrawForm: Initiate withdrawal
WithdrawForm->>Bloc: Submit withdrawal (new with mm2Api)
Bloc->>MM2: sendRawTransaction (broadcast)
MM2-->>Bloc: Success {txHash, balanceChanges, coin, fee, ...}
Bloc->>Bloc: Construct Transaction model
Bloc-->>WithdrawForm: Emit success state
WithdrawForm->>TxDetails: Display transaction details
User->>TxDetails: Review & close
TxDetails-->>WithdrawForm: onDone callback
WithdrawForm->>User: Return to previous screen
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| trailing: _GroupedCoinBalance( | ||
| coins: group.value | ||
| .map((item) => getCoin(context, item)) | ||
| .toList(), |
There was a problem hiding this comment.
Deduplicate coins before summing grouped balances
The header balance for grouped coins is built from group.value.map((item) => getCoin(context, item)).toList() and then summed in _GroupedCoinBalance. group.value contains every order in the group, so the same Coin object is inserted once per order. When a coin has multiple orders, its spendable and USD amounts are added repeatedly, inflating the totals in the group header. The list should be deduplicated by coin id before summing so each variant contributes its balance only once.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
assets/translations/en.json(1 hunks)lib/bloc/withdraw_form/withdraw_form_bloc.dart(3 hunks)lib/views/dex/simple/form/tables/coins_table/coins_table_item.dart(2 hunks)lib/views/dex/simple/form/tables/orders_table/grouped_list_view.dart(3 hunks)lib/views/wallet/coin_details/withdraw_form/withdraw_form.dart(10 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.dart
📄 CodeRabbit inference engine (AGENTS.md)
**/*.dart: Runflutter analyzeand resolve issues before committing code
Format Dart code withdart format(on changed files) before committing
Files:
lib/bloc/withdraw_form/withdraw_form_bloc.dartlib/views/dex/simple/form/tables/coins_table/coins_table_item.dartlib/views/wallet/coin_details/withdraw_form/withdraw_form.dartlib/views/dex/simple/form/tables/orders_table/grouped_list_view.dart
🧠 Learnings (3)
📚 Learning: 2025-04-01T15:51:37.060Z
Learnt from: takenagain
Repo: KomodoPlatform/komodo-wallet PR: 2566
File: lib/bloc/coins_bloc/coins_bloc.dart:10-10
Timestamp: 2025-04-01T15:51:37.060Z
Learning: In the Komodo Wallet project, part files share imports with their parent files. The import for `app_config.dart` in `coins_bloc.dart` is necessary because the part file `coins_state.dart` uses `excludedAssetList` from that package.
Applied to files:
lib/bloc/withdraw_form/withdraw_form_bloc.dartlib/views/wallet/coin_details/withdraw_form/withdraw_form.dartlib/views/dex/simple/form/tables/orders_table/grouped_list_view.dart
📚 Learning: 2025-04-01T15:51:37.060Z
Learnt from: takenagain
Repo: KomodoPlatform/komodo-wallet PR: 2566
File: lib/bloc/coins_bloc/coins_bloc.dart:10-10
Timestamp: 2025-04-01T15:51:37.060Z
Learning: The `excludedAssetList` from `app_config.dart` is used in the `_filterExcludedAssets` method in `coins_state.dart`. Since `coins_state.dart` is a part file of `coins_bloc.dart`, the import needs to be in the parent file even though it's not directly used there. In Dart, part files share the namespace and imports of their parent files.
Applied to files:
lib/bloc/withdraw_form/withdraw_form_bloc.dartlib/views/wallet/coin_details/withdraw_form/withdraw_form.dartlib/views/dex/simple/form/tables/orders_table/grouped_list_view.dart
📚 Learning: 2025-05-01T21:00:36.970Z
Learnt from: takenagain
Repo: KomodoPlatform/komodo-wallet PR: 2608
File: lib/bloc/fiat/fiat_onramp_form/fiat_form_bloc.dart:2-3
Timestamp: 2025-05-01T21:00:36.970Z
Learning: It's acceptable to use unconditional `dart:io` imports in the Komodo wallet codebase when the usage is guarded by `!kIsWeb` conditional checks that prevent the platform-specific code from being executed in web environments.
Applied to files:
lib/bloc/withdraw_form/withdraw_form_bloc.dartlib/views/wallet/coin_details/withdraw_form/withdraw_form.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Build Desktop (macos)
- GitHub Check: Build Desktop (linux)
- GitHub Check: Build Desktop (windows)
- GitHub Check: Test web-app-macos
- GitHub Check: Test web-app-linux-profile
- GitHub Check: Build Mobile (iOS)
- GitHub Check: Build Mobile (Android)
- GitHub Check: validate_code_guidelines
- GitHub Check: unit_tests
- GitHub Check: build_and_preview
| "transactionDenied": "Denied", | ||
| "coinDisableSpan1": "You can't disable {} while it has a swap in progress", | ||
| "confirmSending": "Confirm sending", | ||
| "confirmSending": "Confirm withdrawl", |
There was a problem hiding this comment.
Fix spelling in confirmation label.
“Confirm withdrawl” has a typo; please change it to “Confirm withdrawal” so the UI copy reads correctly.
- "confirmSending": "Confirm withdrawl",
+ "confirmSending": "Confirm withdrawal",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "confirmSending": "Confirm withdrawl", | |
| "confirmSending": "Confirm withdrawal", |
🤖 Prompt for AI Agents
In assets/translations/en.json at line 66, the confirmation label has a typo
"Confirm withdrawl"; update the string value to "Confirm withdrawal" so the UI
copy reads correctly (i.e., replace withdrawl with withdrawal).
| id: result.txHash, | ||
| internalId: result.txHash, | ||
| assetId: state.asset.id, | ||
| balanceChanges: result.balanceChanges, | ||
| // Show as unconfirmed initially | ||
| timestamp: DateTime.fromMillisecondsSinceEpoch(0), | ||
| confirmations: 0, | ||
| blockHeight: 0, | ||
| from: state.selectedSourceAddress != null | ||
| ? [state.selectedSourceAddress!.address] | ||
| : <String>[], | ||
| to: [result.toAddress], | ||
| txHash: result.txHash, | ||
| fee: result.fee, | ||
| memo: state.memo, | ||
| ); | ||
|
|
||
| return TransactionDetails( | ||
| transaction: tx, | ||
| coin: state.asset.toCoin(), | ||
| onClose: onDone, | ||
| ); |
There was a problem hiding this comment.
Avoid showing a 1970 timestamp in the success details.
Setting timestamp to DateTime.fromMillisecondsSinceEpoch(0) makes the TransactionDetails panel render “Jan 1, 1970” for a brand-new withdrawal, which is misleading for users. Feed a real timestamp (e.g., DateTime.now()) or adjust the widget to treat missing timestamps specially so the success view reflects the actual submission time.
- timestamp: DateTime.fromMillisecondsSinceEpoch(0),
+ timestamp: DateTime.now(),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| id: result.txHash, | |
| internalId: result.txHash, | |
| assetId: state.asset.id, | |
| balanceChanges: result.balanceChanges, | |
| // Show as unconfirmed initially | |
| timestamp: DateTime.fromMillisecondsSinceEpoch(0), | |
| confirmations: 0, | |
| blockHeight: 0, | |
| from: state.selectedSourceAddress != null | |
| ? [state.selectedSourceAddress!.address] | |
| : <String>[], | |
| to: [result.toAddress], | |
| txHash: result.txHash, | |
| fee: result.fee, | |
| memo: state.memo, | |
| ); | |
| return TransactionDetails( | |
| transaction: tx, | |
| coin: state.asset.toCoin(), | |
| onClose: onDone, | |
| ); | |
| id: result.txHash, | |
| internalId: result.txHash, | |
| assetId: state.asset.id, | |
| balanceChanges: result.balanceChanges, | |
| // Show as unconfirmed initially | |
| timestamp: DateTime.now(), | |
| confirmations: 0, | |
| blockHeight: 0, | |
| from: state.selectedSourceAddress != null | |
| ? [state.selectedSourceAddress!.address] | |
| : <String>[], | |
| to: [result.toAddress], | |
| txHash: result.txHash, | |
| fee: result.fee, | |
| memo: state.memo, | |
| ); | |
| return TransactionDetails( | |
| transaction: tx, | |
| coin: state.asset.toCoin(), | |
| onClose: onDone, | |
| ); |
🤖 Prompt for AI Agents
In lib/views/wallet/coin_details/withdraw_form/withdraw_form.dart around lines
728 to 749, the code creates a Transaction with timestamp set to
DateTime.fromMillisecondsSinceEpoch(0) which displays Jan 1, 1970; change the
timestamp to a real submission time (e.g., DateTime.now()) or supply null if
Transaction.timestamp is nullable and let TransactionDetails handle missing
timestamps; update the Transaction construction to pass DateTime.now() (or null)
and ensure any downstream types accept the change.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
UI/UX