Skip to content

fix(swift-sdk): fixed ios app transaction display#3081

Open
ZocoLini wants to merge 1 commit intov3.1-devfrom
fix/ios-app-transaction-display
Open

fix(swift-sdk): fixed ios app transaction display#3081
ZocoLini wants to merge 1 commit intov3.1-devfrom
fix/ios-app-transaction-display

Conversation

@ZocoLini
Copy link
Collaborator

@ZocoLini ZocoLini commented Feb 12, 2026

The transactions list view was messy and trying to display information without following the FFI specification:

  • Made the UI more compact and elegant imo
  • if a transaction is confirmed is decided following the FFI documentation, removing in the process the half confirmed state, that's an information not provided by the FFI

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

  • Refactor

    • Confirmation shown as "Pending" or "Confirmed" instead of numeric counts
    • Transaction data model simplified with fewer metadata fields
    • Transaction retrieval flow simplified (no error throws)
  • UI

    • Transaction list streamlined to a tappable list, removing separate loading/error states
    • Transaction type, icon, and color now derive from amount sign (received/sent/self)
    • Fees and block height render only when applicable

@ZocoLini ZocoLini marked this pull request as draft February 12, 2026 19:25
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Simplifies the transaction model and API: removes confirmations and type, makes height non-optional, and changes getTransactions() to a non-throwing signature; UI updated to use netAmount for direction and isConfirmed for status, and the transaction list removes async/error states.

Changes

Cohort / File(s) Summary
Core SDK API & Data Model
packages/swift-sdk/Sources/SwiftDashSDK/Core/Wallet/CoreWalletManager.swift, packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift
ManagedAccount.getTransactions changed from throws with currentHeight parameter to a non-throwing getTransactions() without parameters. WalletTransaction simplified: height now non-optional UInt32, removed confirmations and type, updated initializer and isConfirmed to use blockHash + height > 0.
UI Transaction Display
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift, packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift
UI now derives direction (labels, icon, color) from netAmount instead of type. Confirmation display uses isConfirmed boolean. Transaction list removed loading/error states and now loads transactions synchronously from walletManager.getTransactions(for:). Layout and fee display adjusted accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐇 I nibble through the changed-up trees,
Net amounts whisper on the breeze,
Heights are certain, types are gone,
Confirmed or not, the hop goes on,
Fresh paths for wallets, quick and keen. 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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 accurately summarizes the main change: fixing iOS app transaction display by aligning UI logic with FFI specifications and removing unsupported confirmation states.

✏️ 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
  • Commit unit tests in branch fix/ios-app-transaction-display
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

✅ 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: "dd9438197021b4f1c87086a77a8c62e89555d089ab064b8fc1d8141a59f91842"
)

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.

Base automatically changed from feat/iOSSupport to v3.1-dev March 4, 2026 02:23
@github-actions github-actions bot added this to the v3.1.0 milestone Mar 4, 2026
@ZocoLini ZocoLini force-pushed the fix/ios-app-transaction-display branch 3 times, most recently from 17ecb5b to e3889aa Compare March 16, 2026 19:01
@ZocoLini ZocoLini marked this pull request as ready for review March 16, 2026 22:43
@ZocoLini ZocoLini requested a review from shumkov as a code owner March 16, 2026 22:43
Copy link
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift (1)

62-69: ⚠️ Potential issue | 🟠 Major

assert is stripped in release builds - FFI failure would be silent.

assert(success, ...) only triggers in debug builds. In release builds with optimization (-O), if managed_core_account_get_transactions returns false, the code continues silently with potentially invalid state. Consider using precondition (which is kept in release builds) or returning an empty array with a logged warning.

🔒 Recommended fix using precondition
         let success = managed_core_account_get_transactions(handle, &transactionsPtr, &count)

-        assert(success, "This can only fail if any pointer is nil")
+        guard success else {
+            // FFI contract: this can only fail if any pointer is nil, which shouldn't happen
+            // Return empty rather than crash, but log for debugging
+            assertionFailure("managed_core_account_get_transactions failed unexpectedly")
+            return []
+        }

Or if the failure truly indicates a programming error that should never occur:

-        assert(success, "This can only fail if any pointer is nil")
+        precondition(success, "managed_core_account_get_transactions failed - invalid handle state")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift`
around lines 62 - 69, Replace the debug-only assert on the FFI call so failures
aren’t ignored in release: in ManagedAccount.swift where you call
managed_core_account_get_transactions (and currently do assert(success, ...)),
either use precondition(success, ...) to ensure the program traps in release
builds or handle the false case by logging a warning and returning an empty
array; update the code around
managed_core_account_get_transactions/transactionsPtr/count to explicitly check
success and act accordingly instead of relying on assert.
🧹 Nitpick comments (3)
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift (2)

54-74: Consider extracting shared type logic to WalletTransaction.

The typeIcon and typeColor computed properties duplicate logic from TransactionDetailView. Moving these to a WalletTransaction extension would centralize the logic.

♻️ Optional refactor: Add to WalletTransaction
// In WalletTransaction extension or struct
public var typeIcon: String {
    switch netAmount {
    case let amount where amount > 0: return "arrow.down.circle.fill"
    case let amount where amount < 0: return "arrow.up.circle.fill"
    default: return "arrow.triangle.2.circlepath"
    }
}

public var typeColor: Color {
    switch netAmount {
    case let amount where amount > 0: return .green
    case let amount where amount < 0: return .red
    default: return .blue
    }
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`
around lines 54 - 74, Move the duplicated computed-property logic for icons and
colors out of TransactionListView and TransactionDetailView into
WalletTransaction so it's centralized: create public computed properties (e.g.,
typeIcon and typeColor) on WalletTransaction that use transaction.netAmount to
decide the icon and Color, then replace the local computed properties in
TransactionListView and any similar logic in TransactionDetailView to use the
new WalletTransaction.typeIcon and WalletTransaction.typeColor. Ensure you keep
the existing symbol names (typeIcon, typeColor) so callers need only switch to
accessing them on the WalletTransaction instance.

44-46: Synchronous FFI call on main thread.

loadTransactions() performs a synchronous FFI call directly on the main thread. For an example app with quick operations this is acceptable, but for production usage consider wrapping in a Task { @mainactor in } with the actual work dispatched to a background thread to prevent UI blocking during larger transaction sets.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`
around lines 44 - 46, loadTransactions currently calls
walletService.walletManager.getTransactions(for: wallet) synchronously on the
main thread; change it to perform the FFI call off the main thread and only
update self.transactions on the main actor — for example, wrap the operation in
Task { } or Task.detached to call getTransactions on a background thread, await
the result, then assign to self.transactions inside Task { `@MainActor` in ... }
(refer to loadTransactions, walletService, and walletManager.getTransactions) so
the heavy FFI work does not block the UI.
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift (1)

64-67: Consider simplifying the conditional for readability.

The double negation !transaction.isConfirmed ? "Pending" : "Confirmed" is correct but slightly harder to parse. Flipping the order improves clarity.

♻️ Suggested improvement
                         TransactionDetailRow(
                             label: "Status",
-                            value: !transaction.isConfirmed ? "Pending" : "Confirmed"
+                            value: transaction.isConfirmed ? "Confirmed" : "Pending"
                         )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift`
around lines 64 - 67, The ternary in TransactionDetailRow currently uses a
double negation (!transaction.isConfirmed ? "Pending" : "Confirmed"); replace it
with a direct check on transaction.isConfirmed (transaction.isConfirmed ?
"Confirmed" : "Pending") in the TransactionDetailView so the intent is clearer
and easier to read.
🤖 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/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift`:
- Around line 55-57: The docstring for the transactions getter in
ManagedAccount.swift mentions a removed parameter `currentHeight`; update the
comment for the method (the "Get all transactions for this account" docblock) to
remove or replace the `- Parameter currentHeight:` line so it matches the
current function signature (e.g., the method named getAllTransactions /
transactions retrieval function in ManagedAccount). Ensure the Returns
description remains accurate and no references to `currentHeight` remain in the
docblock.

---

Outside diff comments:
In `@packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift`:
- Around line 62-69: Replace the debug-only assert on the FFI call so failures
aren’t ignored in release: in ManagedAccount.swift where you call
managed_core_account_get_transactions (and currently do assert(success, ...)),
either use precondition(success, ...) to ensure the program traps in release
builds or handle the false case by logging a warning and returning an empty
array; update the code around
managed_core_account_get_transactions/transactionsPtr/count to explicitly check
success and act accordingly instead of relying on assert.

---

Nitpick comments:
In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift`:
- Around line 64-67: The ternary in TransactionDetailRow currently uses a double
negation (!transaction.isConfirmed ? "Pending" : "Confirmed"); replace it with a
direct check on transaction.isConfirmed (transaction.isConfirmed ? "Confirmed" :
"Pending") in the TransactionDetailView so the intent is clearer and easier to
read.

In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`:
- Around line 54-74: Move the duplicated computed-property logic for icons and
colors out of TransactionListView and TransactionDetailView into
WalletTransaction so it's centralized: create public computed properties (e.g.,
typeIcon and typeColor) on WalletTransaction that use transaction.netAmount to
decide the icon and Color, then replace the local computed properties in
TransactionListView and any similar logic in TransactionDetailView to use the
new WalletTransaction.typeIcon and WalletTransaction.typeColor. Ensure you keep
the existing symbol names (typeIcon, typeColor) so callers need only switch to
accessing them on the WalletTransaction instance.
- Around line 44-46: loadTransactions currently calls
walletService.walletManager.getTransactions(for: wallet) synchronously on the
main thread; change it to perform the FFI call off the main thread and only
update self.transactions on the main actor — for example, wrap the operation in
Task { } or Task.detached to call getTransactions on a background thread, await
the result, then assign to self.transactions inside Task { `@MainActor` in ... }
(refer to loadTransactions, walletService, and walletManager.getTransactions) so
the heavy FFI work does not block the UI.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0aa01f8b-3e09-44de-aee1-5fcf7fe132db

📥 Commits

Reviewing files that changed from the base of the PR and between 9ebc7e4 and e3889aa.

📒 Files selected for processing (4)
  • packages/swift-sdk/Sources/SwiftDashSDK/Core/Wallet/CoreWalletManager.swift
  • packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift

Comment on lines 55 to 57
/// Get all transactions for this account
/// - Parameter currentHeight: Current blockchain height for calculating confirmations
/// - Returns: Array of transactions
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Outdated docstring references removed parameter.

The docstring still mentions currentHeight parameter which no longer exists in the function signature.

📝 Update docstring
     // MARK: - Transactions

     /// Get all transactions for this account
-    /// - Parameter currentHeight: Current blockchain height for calculating confirmations
     /// - Returns: Array of transactions
     public func getTransactions() -> [WalletTransaction] {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift`
around lines 55 - 57, The docstring for the transactions getter in
ManagedAccount.swift mentions a removed parameter `currentHeight`; update the
comment for the method (the "Get all transactions for this account" docblock) to
remove or replace the `- Parameter currentHeight:` line so it matches the
current function signature (e.g., the method named getAllTransactions /
transactions retrieval function in ManagedAccount). Ensure the Returns
description remains accurate and no references to `currentHeight` remain in the
docblock.

Copy link
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

This PR correctly simplifies the transaction model to align with the FFI spec, removing client-side confirmation counting and derived type fields. The only real concern is replacing a guard/throw with an assert that is stripped in release builds, silently converting FFI failures into empty transaction lists. The codex-general agent hallucinated three blocking findings by flagging pre-existing code not changed in this PR.

Reviewed commit: e3889aa

🟡 2 suggestion(s) | 💬 2 nitpick(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/KeyWallet/ManagedAccount.swift`:
- [SUGGESTION] lines 58-64: assert replaces guard/throw — FFI failures silently return empty array in release builds
  The old code used `guard success else { throw KeyWalletError.invalidState(...) }` which propagated FFI failures to callers. The new code uses `assert(success, ...)` which is stripped in optimized (release) builds, and the function signature changed from `throws -> [WalletTransaction]` to `-> [WalletTransaction]`, so callers can no longer handle the error at all.

In practice, because `transactionsPtr` is initialized to `nil` and `count` to `0`, the subsequent `guard count > 0, let ptr = transactionsPtr` will catch the failure and return `[]`. So there's no crash risk — but FFI failures are silently swallowed as empty results rather than surfaced as errors.

The developer comment suggests this path is believed to be impossible, but defensive coding would still handle it explicitly.

In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`:
- [SUGGESTION] lines 17-30: Empty-state view was removed — new wallets see a blank list
  The previous implementation had an `emptyStateView` with an icon ('doc.text.magnifyingglass'), heading ('No Transactions Yet'), and helper text. This was removed entirely; a new wallet with no transactions now shows an empty List with no user guidance. The PR description says the UI was made 'more compact and elegant', so this may be intentional — but the empty state provides important UX for first-time users.

Comment on lines +58 to +64
public func getTransactions() -> [WalletTransaction] {
var transactionsPtr: UnsafeMutablePointer<FFITransactionRecord>?
var count: size_t = 0

let success = managed_core_account_get_transactions(handle, &transactionsPtr, &count)

guard success else {
throw KeyWalletError.invalidState("Failed to get transactions from managed account")
}
assert(success, "This can only fail if any pointer is nil")
Copy link
Collaborator

Choose a reason for hiding this comment

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

🟡 Suggestion: assert replaces guard/throw — FFI failures silently return empty array in release builds

The old code used guard success else { throw KeyWalletError.invalidState(...) } which propagated FFI failures to callers. The new code uses assert(success, ...) which is stripped in optimized (release) builds, and the function signature changed from throws -> [WalletTransaction] to -> [WalletTransaction], so callers can no longer handle the error at all.

In practice, because transactionsPtr is initialized to nil and count to 0, the subsequent guard count > 0, let ptr = transactionsPtr will catch the failure and return []. So there's no crash risk — but FFI failures are silently swallowed as empty results rather than surfaced as errors.

The developer comment suggests this path is believed to be impossible, but defensive coding would still handle it explicitly.

Suggested change
public func getTransactions() -> [WalletTransaction] {
var transactionsPtr: UnsafeMutablePointer<FFITransactionRecord>?
var count: size_t = 0
let success = managed_core_account_get_transactions(handle, &transactionsPtr, &count)
guard success else {
throw KeyWalletError.invalidState("Failed to get transactions from managed account")
}
assert(success, "This can only fail if any pointer is nil")
public func getTransactions() -> [WalletTransaction] {
var transactionsPtr: UnsafeMutablePointer<FFITransactionRecord>?
var count: size_t = 0
let success = managed_core_account_get_transactions(handle, &transactionsPtr, &count)
guard success else {
// FFI docs say this can only fail if a pointer arg is nil, which
// cannot happen here. Return empty rather than crash.
return []
}

source: ['claude-general', 'claude-ffi-engineer', 'codex-ffi-engineer']

🤖 Fix this 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/KeyWallet/ManagedAccount.swift`:
- [SUGGESTION] lines 58-64: assert replaces guard/throw — FFI failures silently return empty array in release builds
  The old code used `guard success else { throw KeyWalletError.invalidState(...) }` which propagated FFI failures to callers. The new code uses `assert(success, ...)` which is stripped in optimized (release) builds, and the function signature changed from `throws -> [WalletTransaction]` to `-> [WalletTransaction]`, so callers can no longer handle the error at all.

In practice, because `transactionsPtr` is initialized to `nil` and `count` to `0`, the subsequent `guard count > 0, let ptr = transactionsPtr` will catch the failure and return `[]`. So there's no crash risk — but FFI failures are silently swallowed as empty results rather than surfaced as errors.

The developer comment suggests this path is believed to be impossible, but defensive coding would still handle it explicitly.

Comment on lines 55 to 57
/// Get all transactions for this account
/// - Parameter currentHeight: Current blockchain height for calculating confirmations
/// - Returns: Array of transactions
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Nitpick: Stale doc comment still references removed currentHeight parameter

The doc comment on line 56 says - Parameter currentHeight: Current blockchain height for calculating confirmations but the currentHeight parameter was removed from the function signature. This should be cleaned up.

Suggested change
/// Get all transactions for this account
/// - Parameter currentHeight: Current blockchain height for calculating confirmations
/// - Returns: Array of transactions
/// Get all transactions for this account
/// - Returns: Array of transactions

source: ['claude-general']

Comment on lines 17 to 30
var body: some View {
ZStack {
if isLoading {
ProgressView("Loading transactions...")
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else if transactions.isEmpty {
emptyStateView
} else {
transactionsList
List {
ForEach(sortedTransactions, id: \.txid) { transaction in
Button {
selectedTransaction = transaction
} label: {
TransactionRowView(transaction: transaction)
}
.buttonStyle(.plain)
}
}
.listStyle(.insetGrouped)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

🟡 Suggestion: Empty-state view was removed — new wallets see a blank list

The previous implementation had an emptyStateView with an icon ('doc.text.magnifyingglass'), heading ('No Transactions Yet'), and helper text. This was removed entirely; a new wallet with no transactions now shows an empty List with no user guidance. The PR description says the UI was made 'more compact and elegant', so this may be intentional — but the empty state provides important UX for first-time users.

source: ['claude-general']

🤖 Fix this 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/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`:
- [SUGGESTION] lines 17-30: Empty-state view was removed — new wallets see a blank list
  The previous implementation had an `emptyStateView` with an icon ('doc.text.magnifyingglass'), heading ('No Transactions Yet'), and helper text. This was removed entirely; a new wallet with no transactions now shows an empty List with no user guidance. The PR description says the UI was made 'more compact and elegant', so this may be intentional — but the empty state provides important UX for first-time users.

Comment on lines +44 to 46
private func loadTransactions() {
self.transactions = walletService.walletManager.getTransactions(for: wallet)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

💬 Nitpick: Inconsistent indentation in loadTransactions()

The body of loadTransactions() uses 2-space indentation while the rest of the file uses 4-space indentation.

Suggested change
private func loadTransactions() {
self.transactions = walletService.walletManager.getTransactions(for: wallet)
}
private func loadTransactions() {
self.transactions = walletService.walletManager.getTransactions(for: wallet)
}

source: ['claude-general']

@ZocoLini ZocoLini force-pushed the fix/ios-app-transaction-display branch from e3889aa to 9b05176 Compare March 17, 2026 02:54
Copy link
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.

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

36-41: Consider async wrapper for FFI-backed transaction loading.

loadTransactions() synchronously calls walletManager.getTransactions(for:) which performs FFI calls (see CoreWalletManager.swift:152-158). When invoked from .task or .refreshable, this runs on the main thread and may cause brief UI jank if the wallet has many transactions.

For the example app this is likely acceptable, but for production use you may want to wrap the call in a Task.detached or move it off the main thread.

♻️ Optional async wrapper
-    private func loadTransactions() {
-      self.transactions = walletService.walletManager.getTransactions(for: wallet)
+    private func loadTransactions() async {
+        let txs = await Task.detached { [walletService, wallet] in
+            walletService.walletManager.getTransactions(for: wallet)
+        }.value
+        self.transactions = txs
     }

Note: This requires marking the call sites as await loadTransactions().

Also applies to: 44-46

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`
around lines 36 - 41, loadTransactions() currently calls
walletManager.getTransactions(for:) synchronously (FFI-backed) from UI entry
points (.task and .refreshable), which can block the main thread; change the
call sites to invoke loadTransactions from a background task (e.g. Task.detached
{ await loadTransactions() } or Task { await loadTransactions() } depending on
desired priority) and make loadTransactions async so it awaits
walletManager.getTransactions(for:) off the main thread. Update the two call
sites shown (the .task and .refreshable blocks) to use await and ensure
loadTransactions(), and any callers, are marked async to propagate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift`:
- Around line 36-41: loadTransactions() currently calls
walletManager.getTransactions(for:) synchronously (FFI-backed) from UI entry
points (.task and .refreshable), which can block the main thread; change the
call sites to invoke loadTransactions from a background task (e.g. Task.detached
{ await loadTransactions() } or Task { await loadTransactions() } depending on
desired priority) and make loadTransactions async so it awaits
walletManager.getTransactions(for:) off the main thread. Update the two call
sites shown (the .task and .refreshable blocks) to use await and ensure
loadTransactions(), and any callers, are marked async to propagate the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6762219-371f-4e41-be84-c85bbf29441d

📥 Commits

Reviewing files that changed from the base of the PR and between e3889aa and 9b05176.

📒 Files selected for processing (4)
  • packages/swift-sdk/Sources/SwiftDashSDK/Core/Wallet/CoreWalletManager.swift
  • packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionDetailView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/TransactionListView.swift

Copy link
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

Incremental push adds only .codecov.yml coverage exclusion patterns for generated gRPC bindings, data contract crates, version tables, and simple-signer. No application logic, FFI, or Swift changes. Nothing to flag.

Reviewed commit: 9b05176

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