diff --git a/Sources/ZcashLightClientKit/Synchronizer/SDKSynchronizer.swift b/Sources/ZcashLightClientKit/Synchronizer/SDKSynchronizer.swift index 5b8253f9..60311785 100644 --- a/Sources/ZcashLightClientKit/Synchronizer/SDKSynchronizer.swift +++ b/Sources/ZcashLightClientKit/Synchronizer/SDKSynchronizer.swift @@ -492,13 +492,7 @@ public class SDKSynchronizer: Synchronizer { throw ShieldFundsError.insuficientTransparentFunds } - // FIXME: Define who's the recipient of a shielding transaction #521 - // https://github.com/zcash/ZcashLightClientKit/issues/521 - guard let uAddr = self.getUnifiedAddress(accountIndex: accountIndex) else { - throw ShieldFundsError.shieldingFailed(underlyingError: KeyEncodingError.invalidEncoding) - } - - let shieldingSpend = try transactionManager.initSpend(zatoshi: tBalance.verified, recipient: .unified(uAddr), memo: try memo.asMemoBytes(), from: accountIndex) + let shieldingSpend = try transactionManager.initSpend(zatoshi: tBalance.verified, recipient: .internalAccount(spendingKey.account), memo: try memo.asMemoBytes(), from: accountIndex) // TODO: Task will be removed when this method is changed to async, issue 487, https://github.com/zcash/ZcashLightClientKit/issues/487 let transaction = try await transactionManager.encodeShieldingTransaction( @@ -521,7 +515,7 @@ public class SDKSynchronizer: Synchronizer { do { let spend = try transactionManager.initSpend( zatoshi: zatoshi, - recipient: recipient, + recipient: .address(recipient), memo: memo.asMemoBytes(), from: Int(spendingKey.account) ) diff --git a/Sources/ZcashLightClientKit/Transaction/PersistentTransactionManager.swift b/Sources/ZcashLightClientKit/Transaction/PersistentTransactionManager.swift index d1366179..a6495e4f 100644 --- a/Sources/ZcashLightClientKit/Transaction/PersistentTransactionManager.swift +++ b/Sources/ZcashLightClientKit/Transaction/PersistentTransactionManager.swift @@ -8,7 +8,7 @@ import Foundation enum TransactionManagerError: Error { - case couldNotCreateSpend(recipient: Recipient, account: Int, zatoshi: Zatoshi) + case couldNotCreateSpend(recipient: PendingTransactionRecipient, account: Int, zatoshi: Zatoshi) case encodingFailed(PendingTransactionEntity) case updateFailed(PendingTransactionEntity) case notPending(PendingTransactionEntity) @@ -41,7 +41,7 @@ class PersistentTransactionManager: OutboundTransactionManager { func initSpend( zatoshi: Zatoshi, - recipient: Recipient, + recipient: PendingTransactionRecipient, memo: MemoBytes, from accountIndex: Int ) throws -> PendingTransactionEntity { @@ -49,7 +49,7 @@ class PersistentTransactionManager: OutboundTransactionManager { by: try repository.create( PendingTransaction( value: zatoshi, - recipient: .address(recipient), + recipient: recipient, memo: memo, account: accountIndex ) diff --git a/Sources/ZcashLightClientKit/Transaction/TransactionManager.swift b/Sources/ZcashLightClientKit/Transaction/TransactionManager.swift index ab74d0a0..57a9395e 100644 --- a/Sources/ZcashLightClientKit/Transaction/TransactionManager.swift +++ b/Sources/ZcashLightClientKit/Transaction/TransactionManager.swift @@ -16,7 +16,7 @@ transactions through to completion. protocol OutboundTransactionManager { func initSpend( zatoshi: Zatoshi, - recipient: Recipient, + recipient: PendingTransactionRecipient, memo: MemoBytes, from accountIndex: Int ) throws -> PendingTransactionEntity