From e626a23abb0656ca2f91f533af2559b752c1255d Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Fri, 10 Apr 2026 16:45:48 +0200 Subject: [PATCH 1/2] feat(swift-sdk): expose rich transaction fields in WalletTransaction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The FFI's FFITransactionRecord already delivers input details, output details, transaction type, direction, and InstantSend lock status — but WalletTransaction was dropping them on the floor. This commit maps the remaining fields so downstream consumers (dashwallet-ios) can display full transaction details. - Add TxIO struct (address, amount, isMine) for input/output records - Extend WalletTransaction with inputs, outputs, txType, direction, instantSendLocked (all with defaults for backward compatibility) - Update getTransactions() mapping to read from ffiTx.input_details, ffiTx.output_details, ffiTx.transaction_type, ffiTx.direction, ffiTx.context.islock_data Note: FFIOutputDetail only has { index, role } — no address or amount. Output addresses are not available from the FFI yet. Input addresses are fully populated from FFIInputDetail. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../KeyWallet/ManagedAccount.swift | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift b/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift index eb3883a1c0e..e38044d3635 100644 --- a/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift +++ b/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift @@ -97,6 +97,26 @@ public class ManagedAccount { blockHashHex = nil } + // Convert input details + var inputs: [TxIO] = [] + if ffiTx.input_details_count > 0, let inputsPtr = ffiTx.input_details { + for j in 0.. 0, let outputsPtr = ffiTx.output_details { + for j in 0.. 0 ? ffiTx.fee : nil, + inputs: inputs, + outputs: outputs, + txType: ffiTx.transaction_type.rawValue, + direction: ffiTx.direction.rawValue, + instantSendLocked: ffiTx.context.islock_data != nil && ffiTx.context.islock_len > 0 ) transactions.append(transaction) @@ -156,6 +181,24 @@ public class ManagedAccount { } } +// MARK: - Transaction Input/Output + +/// Transaction input/output record with decoded address +public struct TxIO { + /// Address (empty string for non-standard scripts) + public let address: String + /// Amount in satoshis + public let amount: UInt64 + /// Whether this address belongs to the wallet + public let isMine: Bool + + public init(address: String, amount: UInt64, isMine: Bool) { + self.address = address + self.amount = amount + self.isMine = isMine + } +} + // MARK: - Wallet Transaction /// Information about a transaction from a managed account @@ -172,6 +215,16 @@ public struct WalletTransaction: Identifiable { public let timestamp: UInt32 /// Fee if known public let fee: UInt64? + /// Transaction inputs with decoded addresses + public let inputs: [TxIO] + /// Transaction outputs with roles + public let outputs: [TxIO] + /// Transaction type (FFITransactionType raw value: 0=standard, 1=coinJoin, 8=coinbase, etc.) + public let txType: UInt32 + /// Transaction direction (FFITransactionDirection raw value: 0=incoming, 1=outgoing, 2=internal, 3=coinJoin) + public let direction: UInt32 + /// Whether this transaction has an InstantSend lock + public let instantSendLocked: Bool public init( txid: String, @@ -180,6 +233,11 @@ public struct WalletTransaction: Identifiable { blockHash: String?, timestamp: UInt32, fee: UInt64?, + inputs: [TxIO] = [], + outputs: [TxIO] = [], + txType: UInt32 = 0, + direction: UInt32 = 0, + instantSendLocked: Bool = false ) { self.txid = txid self.netAmount = netAmount @@ -187,6 +245,11 @@ public struct WalletTransaction: Identifiable { self.blockHash = blockHash self.timestamp = timestamp self.fee = fee + self.inputs = inputs + self.outputs = outputs + self.txType = txType + self.direction = direction + self.instantSendLocked = instantSendLocked } /// Transaction date From 6015040bdb43c8438d87d24ee96c4765f0909560 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Mon, 13 Apr 2026 08:59:37 +0200 Subject: [PATCH 2/2] feat(swift-sdk): map output address and value from FFIOutputDetail FFIOutputDetail now includes address and value fields (added in rust-dashcore PR #640). Update the getTransactions() mapping to read them into TxIO, enabling dashwallet-ios to display "Received at" and "Sent to" addresses in the transaction detail screen. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift b/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift index e38044d3635..b994ef17dce 100644 --- a/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift +++ b/packages/swift-sdk/Sources/SwiftDashSDK/KeyWallet/ManagedAccount.swift @@ -112,8 +112,9 @@ public class ManagedAccount { if ffiTx.output_details_count > 0, let outputsPtr = ffiTx.output_details { for j in 0..