Use PendingTransactionEntity.internalAccount for shielding.
This commit is contained in:
parent
f5d7aa0f17
commit
36932a21dd
|
@ -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)
|
||||
)
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue