Skip to content

backport: feat(ui): show nonce column for Platform Payment addresses#637

Merged
lklimek merged 6 commits into
v1.0-devfrom
zk-extract/address-nonce-column
Feb 24, 2026
Merged

backport: feat(ui): show nonce column for Platform Payment addresses#637
lklimek merged 6 commits into
v1.0-devfrom
zk-extract/address-nonce-column

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented Feb 24, 2026

Summary

  • For Platform Payment accounts, replaces UTXOs and Total Received columns with a single "Nonce" column
  • Adds nonce field to AddressData populated from get_platform_address_info()
  • Non-platform accounts continue to show UTXOs and Total Received as before

Test plan

Manual test scenarios: docs/ai-design/2026-02-24-address-nonce-column/manual-test-scenarios.md

  • Platform Payment account shows Nonce column
  • Core account shows UTXOs and Total Received columns
  • Switching between account types swaps columns correctly
  • Nonce values match on-chain state
  • Table layout at various window sizes

🤖 Co-authored by Claudius the Magnificent AI Agent

Summary by CodeRabbit

  • New Features

    • Address table shows a Nonce column for Platform Payment accounts (replacing UTXOs and Total Received there); Core accounts keep UTXOs and Total Received with sortable headers.
    • Sorting adapts when switching account types and supports sorting by Nonce for Platform accounts.
  • Documentation

    • Added manual test scenarios covering display, sorting, edge cases, and responsiveness for the Address Nonce column feature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lklimek lklimek self-assigned this Feb 24, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

Platform Payment accounts now show a Nonce column (replacing UTXOs and Total Received); address table code was updated to include a nonce on address rows, detect platform accounts, adjust column layout, sorting, and rendering. New manual test scenarios document added.

Changes

Cohort / File(s) Summary
Documentation
docs/ai-design/2026-02-24-address-nonce-column/manual-test-scenarios.md
Added a new manual test scenarios document describing the Nonce column feature, eight test scenarios, preconditions, and edge cases for Platform Payment vs Core accounts.
Address Table Implementation
src/ui/wallets/wallets_screen/address_table.rs
Added nonce: u32 to AddressData; added platform-account detection (is_platform_account) and platform-specific retrieval of platform_credits/nonce; conditional header/column layout and rendering to show Nonce for Platform accounts and UTXOs/Total Received for Core accounts; updated sorting logic to reset unsupported columns and enable sorting by Nonce.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through rows both new and old,

Replaced two columns with a number bold.
Platform hops show nonce with pride,
Core keeps UTXOs at its side.
A tiny rabbit cheers the stride!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: displaying a nonce column for Platform Payment addresses in the UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch zk-extract/address-nonce-column

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lklimek lklimek marked this pull request as ready for review February 24, 2026 17:28
@lklimek lklimek requested review from Copilot February 24, 2026 17:28
@lklimek
Copy link
Copy Markdown
Contributor Author

lklimek commented Feb 24, 2026

LGTM, just waiting for ai review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: u32 field to AddressData struct populated from PlatformAddressInfo
  • 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟡 Minor

Reset sorting when hidden columns are removed.

When switching to a Platform Payment account, self.sort_column can remain UTXOs or TotalReceived, so the table is sorted by a hidden column with no indicator. Consider resetting to a visible sort column when is_platform_account is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 79e1479 and 6d74add.

📒 Files selected for processing (2)
  • docs/ai-design/2026-02-24-address-nonce-column/manual-test-scenarios.md
  • src/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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/ui/wallets/wallets_screen/address_table.rs Outdated
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>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, a SortColumn::Nonce variant and corresponding sort_address_data arm 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.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d74add and 741d6ab.

📒 Files selected for processing (1)
  • src/ui/wallets/wallets_screen/address_table.rs

Comment on lines +226 to +241
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;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

@lklimek lklimek merged commit 513cc87 into v1.0-dev Feb 24, 2026
6 checks passed
@lklimek lklimek deleted the zk-extract/address-nonce-column branch February 24, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants