Expose APIs for working with transaction proposals
Closes Electric-Coin-Company/zcash-swift-wallet-sdk#1204.
This commit is contained in:
parent
7a263be3cc
commit
7753ac9d3f
21
CHANGELOG.md
21
CHANGELOG.md
|
@ -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
|
deprecated, and will be removed in 2.1.0 (which will create multiple transactions
|
||||||
at once for some recipients).
|
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
|
# 2.0.10 - 2024-02-12
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
|
@ -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(
|
public func proposeShielding(
|
||||||
accountIndex: Int,
|
accountIndex: Int,
|
||||||
shieldingThreshold: Zatoshi,
|
shieldingThreshold: Zatoshi,
|
||||||
|
|
Loading…
Reference in New Issue