Skip to content

Commit

Permalink
Expose APIs for working with transaction proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d authored and pacu committed Feb 29, 2024
1 parent 7a263be commit 7753ac9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7753ac9

Please # to comment.