Skip to content

fix(swift-sdk): fix transaction list view not showing new transactions#3574

Merged
QuantumExplorer merged 1 commit into
v3.1-devfrom
fix/tx-view
May 2, 2026
Merged

fix(swift-sdk): fix transaction list view not showing new transactions#3574
QuantumExplorer merged 1 commit into
v3.1-devfrom
fix/tx-view

Conversation

@ZocoLini

@ZocoLini ZocoLini commented May 1, 2026

Copy link
Copy Markdown
Collaborator
  • Updates the transaction list view to be correctly updated when a new transaction is created
  • Self sent transactions are represented with a new icon
  • pending transactions are shown in the top of the list

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

Summary by CodeRabbit

  • Bug Fixes

    • More accurate transaction list: duplicate transactions removed, reactive updates preserved, and items ordered to surface the most relevant entries first.
  • Style

    • Transaction row icons and colors updated to reflect explicit transaction directions (incoming, outgoing, internal, CoinJoin), with a default for unexpected cases.

@github-actions github-actions Bot added this to the v3.1.0 milestone May 1, 2026
@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 561489d4-b6ac-4450-82fe-0cc59f28df94

📥 Commits

Reviewing files that changed from the base of the PR and between 6f38b9a and 0af4acd.

📒 Files selected for processing (1)
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift

📝 Walkthrough

Walkthrough

TransactionListView now queries PersistentTxo by denormalized walletId and builds a deduplicated transaction list from TXOs; a second query keeps reactivity alive. Transactions are sorted with a context-biased comparator. TransactionRowView selects icon/color from transaction.direction instead of netAmount sign.

Changes

Transaction List Query Refactoring

Layer / File(s) Summary
Query Setup
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
Introduces @Query walletTxos: [PersistentTxo] using a FetchDescriptor filtered by walletId (set in init) and a secondary @Query transactionObservation: [PersistentTransaction] used only to keep reactive updates alive.
Transaction Composition
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
Adds computed transactions that iterates walletTxos, collects txo.transaction and txo.spendingTransaction, deduplicates by txid, and sorts with a comparator that prefers context == 0 then firstSeen descending.
UI Mapping / Row
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
TransactionRowView replaces icon/color selection based on transaction.netAmount sign with a switch on transaction.direction (incoming/outgoing/internal/coinJoin), providing a default fallback icon/color.
Manifest
Package.swift
Listed in diff context (no public API changes reported).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through TXOs, one by one,
I gathered transactions till the sort was done,
Context first, then newest in line,
Direction paints the row — icons align. 🥕

🚥 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 describes the main fix: addressing the issue of new transactions not displaying in the transaction list view.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tx-view

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@thepastaclaw

thepastaclaw commented May 1, 2026

Copy link
Copy Markdown
Collaborator

🕓 Ready for review (commit 0af4acd)

@ZocoLini ZocoLini changed the title fix transaction list view dont showing new transactions fix(swift-sdk): fix transaction list view dont showing new transactions May 1, 2026
@ZocoLini ZocoLini changed the title fix(swift-sdk): fix transaction list view dont showing new transactions fix(swift-sdk): fix transaction list view not showing new transactions May 1, 2026

@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.

Actionable comments posted: 1

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

33-50: ⚡ Quick win

Materialize the derived transaction list once per render.

transactions is rebuilt for the empty-state branch and then rebuilt again for List, so every update walks, dedupes, and sorts the same walletTxos twice. Caching it once in body keeps behavior unchanged and halves that work.

♻️ Proposed refactor
     var body: some View {
+        let visibleTransactions = transactions
         ZStack {
-            if transactions.isEmpty {
+            if visibleTransactions.isEmpty {
                 emptyStateView
             } else {
-                transactionsList
+                transactionsList(visibleTransactions)
             }
         }
         .navigationTitle("Transactions")
         .navigationBarTitleDisplayMode(.inline)
         .sheet(item: $selectedTransaction) { transaction in
@@
-    private var transactionsList: some View {
+    private func transactionsList(_ transactions: [PersistentTransaction]) -> some View {
         List(transactions) { transaction in
             Button {
                 selectedTransaction = transaction
             } label: {
                 TransactionRowView(transaction: transaction)

Also applies to: 53-59, 86-96

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`:
- Around line 21-22: The TransactionListView currently defines an unscoped
reactive query `@Query` private var transactionObservation:
[PersistentTransaction], which subscribes to all PersistentTransaction records
and breaks wallet isolation; add a walletId property to the
PersistentTransaction model (matching how PersistentTxo stores walletId) and
update the TransactionListView query to include a predicate that filters
PersistentTransaction by the current wallet's id (same walletId used by
walletTxos) so the view only observes transactions for that wallet, or
alternatively replace the global `@Query` with a wallet-scoped observer API that
fetches and watches PersistentTransaction rows filtered by walletId.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8cec3cde-8e36-43ec-9d20-788ca44ecda8

📥 Commits

Reviewing files that changed from the base of the PR and between 4b7c3b7 and 6f38b9a.

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

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

✅ DashSDKFFI.xcframework built for this PR.

SwiftPM (host the zip at a stable URL, then use):

.binaryTarget(
  name: "DashSDKFFI",
  url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
  checksum: "9eb7327a5ebd66f7de55c9477f56a6eebe1517fccb1cd1dc3a509f05b630a0eb"
)

Xcode manual integration:

  • Download 'DashSDKFFI.xcframework' artifact from the run link above.
  • Drag it into your app target (Frameworks, Libraries & Embedded Content) and set Embed & Sign.
  • If using the Swift wrapper package, point its binaryTarget to the xcframework location or add the package and place the xcframework at the expected path.

@QuantumExplorer QuantumExplorer merged commit 6bd92ed into v3.1-dev May 2, 2026
36 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/tx-view branch May 2, 2026 04:24
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.

3 participants