chore(swift-sdk): define missing spv client event OnTransactionStatusChanged#3487
chore(swift-sdk): define missing spv client event OnTransactionStatusChanged#3487
Conversation
📝 WalkthroughWalkthroughThe changes introduce a new transaction status change event callback to the Swift SDK's SPV wallet event handling system, extending the protocol with Changes
Sequence DiagramsequenceDiagram
participant FFI as FFI Layer
participant Callback as C Callback Handler
participant Handler as SPVWalletEventsHandler
participant Service as WalletService Impl
FFI->>Callback: onSpvTransactionStatusChangedCallbackC(walletIdPtr, txIdPtr, status, userData)
Callback->>Callback: Resolve handler from userData
Callback->>Callback: Validate walletIdPtr
Callback->>Callback: Convert txIdPtr (32 bytes) to Data
Callback->>Callback: Convert status to TransactionContext
Callback->>Handler: onTransactionStatusChanged(walletId, txId, status)
Handler->>Service: onTransactionStatusChanged(walletId, txId, status)
Service-->>Handler: (completes)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 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 docstrings
🧪 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 |
Review GateCommit:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/Core/SPV/SPVEventHandler.swift`:
- Around line 547-569: The callback onSpvTransactionStatusChangedCallbackC
currently converts a nil txIdPtr into empty Data and still calls
handler.onTransactionStatusChanged, so guard txIdPtr before converting and
dispatching; inside onSpvTransactionStatusChangedCallbackC (which uses
rawPtrIntoSpvWalletEventsHandler, bytePtrIntoData and TransactionContext(ffi:)),
add a guard let txIdPtr else { assertionFailure("TransactionStatusChanged txId
pointer is nil"); return } before calling bytePtrIntoData and only call
handler.onTransactionStatusChanged(walletId, txId, status) when txId is valid.
🪄 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: 78c89766-cabf-4683-8651-593253ca5eb5
📒 Files selected for processing (2)
packages/swift-sdk/Sources/SwiftDashSDK/Core/SPV/SPVEventHandler.swiftpackages/swift-sdk/Sources/SwiftDashSDK/Core/Services/WalletService.swift
|
✅ 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: "588b895d6b2ca64d4b5ded9704c6516c16c383406528dddf978b964e907feb89"
)Xcode manual integration:
|
In this PR I am implementing a missing wrapper for the OnTransactionStatusChanged event in the SPVClient that was missing after PR #3414
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit