Expose APIs for working with transaction proposals

Closes Electric-Coin-Company/zcash-swift-wallet-sdk#1204.
This commit is contained in:
Jack Grigg 2024-02-21 00:54:34 +00:00 committed by Francisco Gindre
parent 7a263be3cc
commit 7753ac9d3f
No known key found for this signature in database
GPG Key ID: 6B61CD8DAA2862B4
2 changed files with 51 additions and 0 deletions

View File

@ -25,6 +25,27 @@ The old `Synchronizer.sendToAddress` and `Synchronizer.shieldFunds` APIs have be
deprecated, and will be removed in 2.1.0 (which will create multiple transactions
at once for some recipients).
# Unreleased
## Changed
### [#1186] Enable ZIP 317 fees
- The SDK now generates transactions using [ZIP 317](https://zips.z.cash/zip-0317) fees,
instead of a fixed fee of 10,000 Zatoshi. Use `Proposal.totalFeeRequired` to check the
total fee for a transfer before creating it.
## Added
### [#1204] Expose APIs for working with transaction proposals
New `Synchronizer` APIs that enable constructing a proposal for transferring or
shielding funds, and then creating transactions from a proposal. The intermediate
proposal can be used to determine the required fee, before committing to producing
transactions.
The old `Synchronizer.sendToAddress` and `Synchronizer.shieldFunds` APIs have been
deprecated, and will be removed in 2.1.0 (which will create multiple transactions
at once for some recipients).
# 2.0.10 - 2024-02-12
## Added

View File

@ -80,6 +80,36 @@ extension CombineSDKSynchronizer: CombineSynchronizer {
}
}
public func proposeShielding(
accountIndex: Int,
shieldingThreshold: Zatoshi,
memo: Memo
) -> SinglePublisher<Proposal, Error> {
AsyncToCombineGateway.executeThrowingAction() {
try await self.synchronizer.proposeShielding(accountIndex: accountIndex, shieldingThreshold: shieldingThreshold, memo: memo)
}
}
public func createProposedTransactions(
proposal: Proposal,
spendingKey: UnifiedSpendingKey
) -> SinglePublisher<AsyncThrowingStream<TransactionSubmitResult, Error>, Error> {
AsyncToCombineGateway.executeThrowingAction() {
try await self.synchronizer.createProposedTransactions(proposal: proposal, spendingKey: spendingKey)
}
}
public func proposeTransfer(
accountIndex: Int,
recipient: Recipient,
amount: Zatoshi,
memo: Memo?
) -> SinglePublisher<Proposal, Error> {
AsyncToCombineGateway.executeThrowingAction() {
try await self.synchronizer.proposeTransfer(accountIndex: accountIndex, recipient: recipient, amount: amount, memo: memo)
}
}
public func proposeShielding(
accountIndex: Int,
shieldingThreshold: Zatoshi,