From 9b2be559cd93d717779f0f6e189578273ce5e01b Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 7 Mar 2024 18:50:31 +0000 Subject: [PATCH] Add `Proposal.transactionCount` --- Sources/ZcashLightClientKit/Model/Proposal.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/ZcashLightClientKit/Model/Proposal.swift b/Sources/ZcashLightClientKit/Model/Proposal.swift index 6a238f66..c462b79c 100644 --- a/Sources/ZcashLightClientKit/Model/Proposal.swift +++ b/Sources/ZcashLightClientKit/Model/Proposal.swift @@ -11,6 +11,16 @@ import Foundation public struct Proposal: Equatable { let inner: FfiProposal + /// Returns the number of transactions that this proposal will create. + /// + /// This is equal to the number of `TransactionSubmitResult`s that will be returned + /// from `Synchronizer.createProposedTransactions`. + /// + /// Proposals always create at least one transaction. + public func transactionCount() -> Int { + inner.steps.count + } + /// Returns the total fee to be paid across all proposed transactions, in zatoshis. public func totalFeeRequired() -> Zatoshi { inner.steps.reduce(Zatoshi.zero) { acc, step in