@@ -23,7 +23,7 @@ final class AdamantCoinStorageService: NSObject, CoinStorageService {
2323 private var subscriptions = Set < AnyCancellable > ( )
2424
2525 @ObservableValue private var transactions : [ TransactionDetails ] = [ ]
26-
26+
2727 var transactionsPublisher : any Observable < [ TransactionDetails ] > {
2828 $transactions
2929 }
@@ -107,7 +107,7 @@ private extension AdamantCoinStorageService {
107107 )
108108 . sink { [ weak self] notification in
109109 let changes = notification. managedObjectContextChanges ( of: CoinTransaction . self)
110-
110+
111111 guard self != nil , self ? . coinId != nil && self ? . coinAddress != nil else {
112112 return
113113 }
@@ -130,7 +130,26 @@ private extension AdamantCoinStorageService {
130130 } )
131131 else { return }
132132
133- self ? . transactions [ index] = coinTransaction
133+ /*
134+ Workaround to correctly set isOutgoing when multiple transactions share the same txId across different accounts.
135+
136+ This situation can happen when sending funds from a regular account to a secret one — technically two different transactions, but with the same txId.
137+ Currently, there's no reliable way to assign a truly unique ID to each TransactionDetails instance, so this workaround helps distinguish them for now.
138+ PR - https://github.com/Adamant-im/adamant-iOS/pull/741
139+ */
140+ self ? . transactions [ index] = SimpleTransactionDetails (
141+ defaultCurrencySymbol: coinTransaction. defaultCurrencySymbol,
142+ txId: coinTransaction. txId,
143+ senderAddress: coinTransaction. senderAddress,
144+ recipientAddress: coinTransaction. recipientAddress,
145+ dateValue: coinTransaction. dateValue,
146+ amountValue: coinTransaction. amountValue,
147+ feeValue: coinTransaction. feeValue,
148+ confirmationsValue: coinTransaction. confirmationsValue,
149+ blockValue: coinTransaction. blockValue,
150+ isOutgoing: self ? . coinAddress == coinTransaction. senderAddress ? true : false ,
151+ transactionStatus: coinTransaction. transactionStatus,
152+ nonceRaw: coinTransaction. nonceRaw)
134153 }
135154 }
136155 }
0 commit comments