Skip to content

Commit

Permalink
Merge pull request #1383 from LukasKorba/TCA-conformations
Browse files Browse the repository at this point in the history
TCA-conformations
  • Loading branch information
LukasKorba authored Feb 29, 2024
2 parents fffbd85 + a325213 commit 7a263be
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

# 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
Expand Down
19 changes: 17 additions & 2 deletions Sources/ZcashLightClientKit/Model/Proposal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@
import Foundation

/// A data structure that describes a series of transactions to be created.
public struct Proposal {
public struct Proposal: Equatable {
let inner: FfiProposal

/// Returns the total fee to be paid across all proposed transactions, in zatoshis.
public func totalFeeRequired() -> Zatoshi {
return Zatoshi(Int64(inner.balance.feeRequired))
Zatoshi(Int64(inner.balance.feeRequired))
}
}

public extension Proposal {
/// IMPORTANT: This function is for testing purposes only. It produces fake invalid
/// data that can be used to check UI elements, but will always produce an error when
/// passed to `Synchronizer.createProposedTransactions`. It should never be called in
/// production code.
static func testOnlyFakeProposal(totalFee: UInt64) -> Self {
var ffiProposal = FfiProposal()
var balance = FfiTransactionBalance()

balance.feeRequired = totalFee

return Self(inner: ffiProposal)
}
}
2 changes: 1 addition & 1 deletion Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let globalDBLock = NSLock()

actor ZcashRustBackend: ZcashRustBackendWelding {
let minimumConfirmations: UInt32 = 10
let useZIP317Fees = false
let useZIP317Fees = true

let dbData: (String, UInt)
let fsBlockDbRoot: (String, UInt)
Expand Down

0 comments on commit 7a263be

Please sign in to comment.