backport: feat(ui): show nonce column for Platform Payment addresses#637
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughPlatform Payment accounts now show a Nonce column (replacing UTXOs and Total Received); address table code was updated to include a Changes
Sequence Diagram(s)sequenceDiagram
participant UI as User Interface
participant Store as Wallet Store
participant API as Platform API
UI->>Store: Request account addresses (account_id)
Store->>Store: Determine account type (is_platform_account)
alt Platform Payment account
Store->>API: Fetch platform_info (nonce, credits) for addresses
API-->>Store: Return platform_info
Store-->>UI: Addresses with `nonce` and platform_credits
UI-->>User: Render table with Balance, Nonce, Actions
else Core account
Store-->>UI: Addresses with UTXO count and Total Received
UI-->>User: Render table with Balance, UTXOs, Total Received, Actions
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
LGTM, just waiting for ai review |
There was a problem hiding this comment.
Pull request overview
This PR adds support for displaying platform address nonces in the address table UI. For Platform Payment accounts, the table now shows a single "Nonce" column instead of the "UTXOs" and "Total Received" columns that are displayed for Core accounts.
Changes:
- Adds
nonce: u32field toAddressDatastruct populated fromPlatformAddressInfo - Implements conditional column rendering: Platform Payment accounts display a "Nonce" column, while Core accounts continue to show "UTXOs" and "Total Received" columns
- Includes comprehensive manual test scenarios documenting expected behavior across different account types and edge cases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/ui/wallets/wallets_screen/address_table.rs | Adds nonce field to AddressData, implements conditional column rendering based on account type (Platform Payment vs Core), and updates table headers and row rendering logic |
| docs/ai-design/2026-02-24-address-nonce-column/manual-test-scenarios.md | Provides comprehensive manual testing documentation covering all scenarios including account switching, nonce accuracy, table layout, and edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/ui/wallets/wallets_screen/address_table.rs (1)
219-307:⚠️ Potential issue | 🟡 MinorReset sorting when hidden columns are removed.
When switching to a Platform Payment account,
self.sort_columncan remainUTXOsorTotalReceived, so the table is sorted by a hidden column with no indicator. Consider resetting to a visible sort column whenis_platform_accountis true.💡 Suggested fix
let is_platform_account = self .selected_account .as_ref() .map(|(cat, _)| *cat == AccountCategory::PlatformPayment) .unwrap_or(false); + +if is_platform_account + && matches!(self.sort_column, SortColumn::UTXOs | SortColumn::TotalReceived) +{ + self.sort_column = SortColumn::Address; + self.sort_order = SortOrder::Ascending; +}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/wallets/wallets_screen/address_table.rs` around lines 219 - 307, When the account view toggles to a Platform Payment (is_platform_account) the current self.sort_column may still be SortColumn::UTXOs or SortColumn::TotalReceived which are not rendered; update the selection to a visible column in that case. Modify the code where is_platform_account is determined (use the same is_platform_account variable) to check self.sort_column and if it equals SortColumn::UTXOs or SortColumn::TotalReceived, set self.sort_column to a visible default (e.g. SortColumn::Address or SortColumn::Balance) and adjust self.sort_order as needed so the table no longer sorts by a hidden column; ensure this logic runs whenever the selected account changes (where selected_account / is_platform_account is computed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/ui/wallets/wallets_screen/address_table.rs`:
- Around line 219-307: When the account view toggles to a Platform Payment
(is_platform_account) the current self.sort_column may still be
SortColumn::UTXOs or SortColumn::TotalReceived which are not rendered; update
the selection to a visible column in that case. Modify the code where
is_platform_account is determined (use the same is_platform_account variable) to
check self.sort_column and if it equals SortColumn::UTXOs or
SortColumn::TotalReceived, set self.sort_column to a visible default (e.g.
SortColumn::Address or SortColumn::Balance) and adjust self.sort_order as needed
so the table no longer sorts by a hidden column; ensure this logic runs whenever
the selected account changes (where selected_account / is_platform_account is
computed).
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/ai-design/2026-02-24-address-nonce-column/manual-test-scenarios.mdsrc/ui/wallets/wallets_screen/address_table.rs
…ount When toggling to a Platform Payment account view, the sort column could remain set to UTXOs or TotalReceived which are not rendered for that account type. This resets it to Balance (descending) in that case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Skip get_platform_address_info() for non-platform addresses to avoid unnecessary linear scans in the fallback path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/ui/wallets/wallets_screen/address_table.rs (1)
294-297: Nonce column header is not sortable, unlike every other data column.All other columns use a button with ascending/descending indicators, but Nonce uses a plain
ui.label("Nonce"). If this is intentional, consider adding a brief comment explaining why. If not, aSortColumn::Noncevariant and correspondingsort_address_dataarm would make the UX consistent.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/wallets/wallets_screen/address_table.rs` around lines 294 - 297, The "Nonce" header in the address table (inside the header.col block) is rendered with ui.label("Nonce") and thus is not sortable like the other columns; add a SortColumn::Nonce enum variant and update the sort_address_data function to handle SortColumn::Nonce so the header uses the same sortable button widget used by other headers (matching their ascending/descending indicators), or if non-sortable by design, add a brief inline comment in the header.col explaining why. Update any places that build the header buttons to reference SortColumn::Nonce and ensure the sorting comparator in sort_address_data compares the nonce field accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/ui/wallets/wallets_screen/address_table.rs`:
- Around line 226-241: The reset of self.sort_column for platform accounts runs
after the data is sorted, causing a one-frame incorrect ordering; detect
is_platform_account and perform the sort-column reset (checking for
SortColumn::UTXOs | SortColumn::TotalReceived and setting to SortColumn::Balance
and SortOrder::Descending) before calling self.sort_address_data(...). Move the
is_platform_account detection and the if block that updates self.sort_column /
self.sort_order to immediately after the address_data collection block and
before the invocation of sort_address_data so the corrected sort is applied in
the same frame.
---
Nitpick comments:
In `@src/ui/wallets/wallets_screen/address_table.rs`:
- Around line 294-297: The "Nonce" header in the address table (inside the
header.col block) is rendered with ui.label("Nonce") and thus is not sortable
like the other columns; add a SortColumn::Nonce enum variant and update the
sort_address_data function to handle SortColumn::Nonce so the header uses the
same sortable button widget used by other headers (matching their
ascending/descending indicators), or if non-sortable by design, add a brief
inline comment in the header.col explaining why. Update any places that build
the header buttons to reference SortColumn::Nonce and ensure the sorting
comparator in sort_address_data compares the nonce field accordingly.
| let is_platform_account = self | ||
| .selected_account | ||
| .as_ref() | ||
| .map(|(cat, _)| *cat == AccountCategory::PlatformPayment) | ||
| .unwrap_or(false); | ||
|
|
||
| // Reset sort column if it refers to a column not visible for the current account type | ||
| if is_platform_account | ||
| && matches!( | ||
| self.sort_column, | ||
| SortColumn::UTXOs | SortColumn::TotalReceived | ||
| ) | ||
| { | ||
| self.sort_column = SortColumn::Balance; | ||
| self.sort_order = SortOrder::Descending; | ||
| } |
There was a problem hiding this comment.
Sort column reset executes after data is already sorted — one-frame ordering glitch.
The sort at line 197 runs with the stale sort_column (e.g., UTXOs), and then lines 233–241 reset it to Balance for the next frame. On the frame where a user switches to a platform account while sorted by an invisible column, the table briefly shows data in the wrong order.
Move the is_platform_account detection and the sort-column reset before self.sort_address_data(…) (e.g., right after the address_data collection block at line 193) so the reset takes effect on the same frame.
Proposed fix — reorder sort reset before sort
}; // The borrow of `wallet` ends here
+ let is_platform_account = self
+ .selected_account
+ .as_ref()
+ .map(|(cat, _)| *cat == AccountCategory::PlatformPayment)
+ .unwrap_or(false);
+
+ // Reset sort column if it refers to a column not visible for the current account type
+ if is_platform_account
+ && matches!(
+ self.sort_column,
+ SortColumn::UTXOs | SortColumn::TotalReceived
+ )
+ {
+ self.sort_column = SortColumn::Balance;
+ self.sort_order = SortOrder::Descending;
+ }
+
// Now you can use `self` mutably without conflict
// Sort the data
self.sort_address_data(&mut address_data);
if let Some((category, index)) = self.selected_account.clone() {
...
}
...
- let is_platform_account = self
- .selected_account
- .as_ref()
- .map(|(cat, _)| *cat == AccountCategory::PlatformPayment)
- .unwrap_or(false);
-
- // Reset sort column if it refers to a column not visible for the current account type
- if is_platform_account
- && matches!(
- self.sort_column,
- SortColumn::UTXOs | SortColumn::TotalReceived
- )
- {
- self.sort_column = SortColumn::Balance;
- self.sort_order = SortOrder::Descending;
- }
-
// Render the table🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/ui/wallets/wallets_screen/address_table.rs` around lines 226 - 241, The
reset of self.sort_column for platform accounts runs after the data is sorted,
causing a one-frame incorrect ordering; detect is_platform_account and perform
the sort-column reset (checking for SortColumn::UTXOs |
SortColumn::TotalReceived and setting to SortColumn::Balance and
SortOrder::Descending) before calling self.sort_address_data(...). Move the
is_platform_account detection and the if block that updates self.sort_column /
self.sort_order to immediately after the address_data collection block and
before the invocation of sort_address_data so the corrected sort is applied in
the same frame.
Summary
noncefield toAddressDatapopulated fromget_platform_address_info()Test plan
Manual test scenarios:
docs/ai-design/2026-02-24-address-nonce-column/manual-test-scenarios.md🤖 Co-authored by Claudius the Magnificent AI Agent
Summary by CodeRabbit
New Features
Documentation