Skip to content

fix(swift-sdk): label provider special txs instead of Self-Transfer#4109

Merged
QuantumExplorer merged 3 commits into
v4.1-devfrom
claude/sleepy-albattani-1c51d6
Jul 13, 2026
Merged

fix(swift-sdk): label provider special txs instead of Self-Transfer#4109
QuantumExplorer merged 3 commits into
v4.1-devfrom
claude/sleepy-albattani-1c51d6

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Jul 13, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Provider special transactions (ProRegTx / ProUpRegTx / ProUpServTx / ProUpRevTx) classify as direction=internal — the wallet only sees its own owner/voting/payout keys referenced in the payload — so SwiftExampleApp rendered them as "Self-Transfer" with a misleading "+0.00000000 DASH" amount.

Verified repro: mainnet wallet, Provider Owner Keys account, ProRegTx 5076f9ed731bcb7b5ddf47e21bf1262d22d99665ca89bb6329e6e706d605da85 (height 1030673).

What was done?

Extends the existing asset-lock/unlock display override pattern to provider special kinds (2–5):

  • PersistentTransaction (SwiftDashSDK): added isProviderSpecial and providerSpecialName helpers and wired them into displayDirection — Storage Explorer list/detail views pick up the correct label with no view changes.
  • TransactionDetailView: header shows the provider tx name instead of "Self-Transfer", uses a server.rack icon in orange, and hides the amount line entirely for payload-only provider txs (netAmount == 0).
  • TransactionRowView (TransactionListView.swift): same icon/color treatment; the amount slot shows the tx kind (e.g. "Provider Registration") instead of "+0.00000000 DASH" when no wallet value moved. A provider tx that does move value (e.g. wallet-funded collateral) still shows its real signed amount.

How Has This Been Tested?

  • Built SwiftExampleApp for the iPhone 16 simulator (xcodebuild -sdk iphonesimulator) with no errors.
  • Display-only change over an already-persisted transactionTypeKind discriminant; the mainnet repro row (kind 2) renders "Provider Registration" on relaunch without a rescan.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added clearer labels and dedicated icons/colors for provider-special transactions.
    • Provider-special transactions with no amount now display their transaction type instead of a zero-value amount.
    • Transaction details now show provider-special names and hide empty amount fields.
  • Bug Fixes

    • Preserved existing display behavior for asset lock and unlock transactions.
    • Added coverage to verify transaction classification and display labels.

ProRegTx / ProUp*Tx rows classify as direction=internal (the wallet
only sees its own owner/voting/payout keys in the payload), so the
transaction list and detail sheet rendered them as "Self-Transfer"
with a +0.00000000 DASH amount. Extend the asset-lock displayDirection
pattern to provider special kinds (2-5), give them a server.rack/orange
treatment, and replace the zero amount with the tx kind (row) or hide
it (detail) when no wallet value moved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v4.1.0 milestone Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@QuantumExplorer, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 394b5a09-aada-4e4f-9638-bfcf0b1a58aa

📥 Commits

Reviewing files that changed from the base of the PR and between 7633d96 and 8c92f53.

📒 Files selected for processing (1)
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift
📝 Walkthrough

Walkthrough

Provider-special transaction kinds now expose classification and display-name helpers. Transaction detail and list views use provider-specific labels, icons, colors, and zero-value amount handling, with tests covering provider and non-provider mappings.

Changes

Provider-special transaction presentation

Layer / File(s) Summary
Transaction classification and display overrides
packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentTransaction.swift, packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PersistentTransactionDisplayTests.swift
Provider-related kinds map to names and provider-special status, while display-direction precedence and fallback behavior are tested.
Transaction detail presentation
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift
Provider-special transactions use dedicated descriptions, icons, and colors; zero-value amounts are omitted.
Transaction list presentation
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
Provider-special rows use dedicated icons and colors and show the provider name for zero-value amounts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PersistentTransaction
  participant TransactionDetailView
  participant TransactionRowView
  PersistentTransaction->>TransactionDetailView: provide providerSpecialName and isProviderSpecial
  TransactionDetailView->>TransactionDetailView: choose description, icon, color, and amount visibility
  PersistentTransaction->>TransactionRowView: provide providerSpecialName and isProviderSpecial
  TransactionRowView->>TransactionRowView: choose row icon, color, and zero-value amount
Loading

Suggested reviewers: shumkov, llbartekll, zocolini

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: provider-special Swift SDK transactions are relabeled instead of showing Self-Transfer.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/sleepy-albattani-1c51d6

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.

@thepastaclaw

thepastaclaw commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit 7633d96)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

Small, well-scoped display-only fix that extends the existing asset-lock displayDirection override pattern to provider special transactions (kinds 2-5), replacing the misleading 'Self-Transfer' / '+0.00000000 DASH' labels with the tx kind name and a distinct orange/server.rack treatment. Logic is internally consistent across PersistentTransaction, TransactionDetailView, and TransactionRowView, correctly falls through to the real signed amount when a provider tx does move wallet value, and reuses the TransactionTypeKind enum (discriminants 2-5) that predates this PR. Only gap is missing unit test coverage for the new labeling logic.

Source: Sol reviewer gpt-5.6-sol (general), Sonnet reviewer claude-sonnet-5 (general); final verifier claude-sonnet-5. The Sol orchestrator openai/gpt-5.6-sol was orchestration-only and is not reviewer or verifier evidence.

🟡 1 suggestion(s)

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentTransaction.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentTransaction.swift:204-216: No test pins provider-special discriminants/labels
  `isProviderSpecial` and `providerSpecialName` now drive every changed UI branch (icon, color, amount fallback, direction label) across three files, but nothing in `SwiftTests/SwiftDashSDKTests` exercises the mapping. A table-driven test asserting `TransactionTypeKind(rawValue: 2...5)` maps to the expected `providerSpecialName` strings (and that other kinds return `nil`) would catch a future drift from Rust's `transaction_type_to_u8` discriminants or an accidental label typo without needing UI automation. The test target already exists (e.g. `TransactionDecoderTests.swift`), so this is a low-cost addition.

Table-driven coverage for isProviderSpecial / providerSpecialName /
displayDirection over all TransactionTypeKind discriminants, so a
drift from Rust's transaction_type_to_u8 or a label typo fails in
unit tests instead of needing UI automation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift (1)

38-50: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider delegating special-kind branches to displayDirection

The first three branches of typeDescription now duplicate PersistentTransaction.displayDirection exactly (asset lock, asset unlock, provider special). If a label changes in one place, the other can drift. Consider delegating the special-kind cases to displayDirection and keeping only the netAmount fallback local:

♻️ Optional refactor
 private var typeDescription: String {
-    if transaction.isAssetLock { return "Asset Lock" }
-    if transaction.isAssetUnlock { return "Asset Unlock" }
-    if let name = transaction.providerSpecialName { return name }
+    if transaction.isAssetLock || transaction.isAssetUnlock || transaction.isProviderSpecial {
+        return transaction.displayDirection
+    }
     switch transaction.netAmount {
     case let amount where amount > 0:
         return "Received"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift`
around lines 38 - 50, Update the typeDescription computed property to reuse
PersistentTransaction.displayDirection for asset locks, asset unlocks, and
provider-special transactions instead of duplicating those labels. Keep the
existing netAmount-based Received, Sent, and Self-Transfer fallback behavior
local.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift`:
- Around line 38-50: Update the typeDescription computed property to reuse
PersistentTransaction.displayDirection for asset locks, asset unlocks, and
provider-special transactions instead of duplicating those labels. Keep the
existing netAmount-based Received, Sent, and Self-Transfer fallback behavior
local.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1bafea8a-38f9-4179-a486-2f2b8f354d97

📥 Commits

Reviewing files that changed from the base of the PR and between 0c5eaa3 and 7633d96.

📒 Files selected for processing (4)
  • packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentTransaction.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PersistentTransactionDisplayTests.swift

typeDescription's asset-lock/unlock/provider branches duplicated
PersistentTransaction.displayDirection verbatim; delegate to it so a
label change can't drift between the detail sheet and list rows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@QuantumExplorer
QuantumExplorer merged commit 5b90fbd into v4.1-dev Jul 13, 2026
41 of 43 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/sleepy-albattani-1c51d6 branch July 13, 2026 10:32
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