pub struct Proposal<FeeRuleT, NoteRef> { /* private fields */ }Expand description
A proposal for a series of transactions to be created.
Each step of the proposal represents a separate transaction to be created. At present, only transparent outputs of earlier steps may be spent in later steps; the ability to chain shielded transaction steps may be added in a future update.
Implementations§
Source§impl<FeeRuleT, NoteRef> Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT, NoteRef> Proposal<FeeRuleT, NoteRef>
Sourcepub fn multi_step(
fee_rule: FeeRuleT,
min_target_height: TargetHeight,
confirmations_policy: ConfirmationsPolicy,
steps: NonEmpty<Step<NoteRef>>,
) -> Result<Self, ProposalError>
pub fn multi_step( fee_rule: FeeRuleT, min_target_height: TargetHeight, confirmations_policy: ConfirmationsPolicy, steps: NonEmpty<Step<NoteRef>>, ) -> Result<Self, ProposalError>
Constructs a validated multi-step Proposal.
This operation validates the proposal for agreement between outputs and inputs in the case of multi-step proposals, and ensures that no double-spends are being proposed.
Parameters:
fee_rule: The fee rule observed by the proposed transaction.min_target_height: The minimum block height at which the transaction may be created.steps: A vector of steps that make up the proposal.
Sourcepub fn single_step(
transaction_request: TransactionRequest,
payment_pools: BTreeMap<usize, PoolType>,
transparent_inputs: Vec<WalletTransparentOutput<()>>,
shielded_inputs: Option<ShieldedInputs<NoteRef>>,
anchor_height: BlockHeight,
balance: TransactionBalance,
fee_rule: FeeRuleT,
min_target_height: TargetHeight,
confirmations_policy: ConfirmationsPolicy,
is_shielding: bool,
ironwood_active: bool,
) -> Result<Self, ProposalError>
pub fn single_step( transaction_request: TransactionRequest, payment_pools: BTreeMap<usize, PoolType>, transparent_inputs: Vec<WalletTransparentOutput<()>>, shielded_inputs: Option<ShieldedInputs<NoteRef>>, anchor_height: BlockHeight, balance: TransactionBalance, fee_rule: FeeRuleT, min_target_height: TargetHeight, confirmations_policy: ConfirmationsPolicy, is_shielding: bool, ironwood_active: bool, ) -> Result<Self, ProposalError>
Constructs a validated Proposal having only a single step from its constituent parts.
This operation validates the proposal for balance consistency and agreement between
the is_shielding flag and the structure of the proposal.
Parameters:
transaction_request: The ZIP 321 transaction request describing the payments to be made.payment_pools: A map from payment index to pool type.transparent_inputs: The set of previous transparent outputs to be spent.shielded_inputs: The sets of previous shielded outputs to be spent.anchor_height: SeeStep::from_parts.balance: The change outputs to be added the transaction and the fee to be paid.fee_rule: The fee rule observed by the proposed transaction.min_target_height: The minimum block height at which the transaction may be created.is_shielding: A flag that identifies whether this is a wallet-internal shielding transaction.ironwood_active: SeeStep::from_parts.
Sourcepub fn fee_rule(&self) -> &FeeRuleT
pub fn fee_rule(&self) -> &FeeRuleT
Returns the fee rule to be used by the transaction builder.
Sourcepub fn min_target_height(&self) -> TargetHeight
pub fn min_target_height(&self) -> TargetHeight
Returns the target height for which the proposal was prepared.
The chain must contain at least this many blocks in order for the proposal to be executed.
Sourcepub fn confirmations_policy(&self) -> ConfirmationsPolicy
pub fn confirmations_policy(&self) -> ConfirmationsPolicy
Returns the confirmations policy under which the proposal was constructed. It is used to
resolve the anchor for a step that carries no explicit anchor height (a purely transparent
step; see Step::anchor_height).
Sourcepub fn proposed_version(&self) -> Option<TxVersion>
pub fn proposed_version(&self) -> Option<TxVersion>
Returns the transaction version explicitly requested when the proposal was constructed, if
any. When None, the transaction is built at the version implied by the target height
(version 6 from NU6.3 onward).
Sourcepub fn with_proposed_version(self, proposed_version: Option<TxVersion>) -> Self
pub fn with_proposed_version(self, proposed_version: Option<TxVersion>) -> Self
Returns this proposal with its requested transaction version set to the given value.
This records the version passed to proposal construction so that it is carried through to transaction building; it does not re-validate the proposal against the version.
Sourcepub fn steps(&self) -> &NonEmpty<Step<NoteRef>>
pub fn steps(&self) -> &NonEmpty<Step<NoteRef>>
Returns the steps of the proposal. Each step corresponds to an independent transaction to be generated as a result of this proposal.
Sourcepub fn input_count_in_pool(&self, pool_type: PoolType) -> usize
pub fn input_count_in_pool(&self, pool_type: PoolType) -> usize
Returns the total number of inputs across all steps of this proposal that belong to the given pool.
For a shielded pool this is the number of spent notes of that pool (Ironwood notes are
counted for [PoolType::IRONWOOD], not [PoolType::ORCHARD]); for
[PoolType::Transparent] it is the number of transparent inputs. See
Step::input_count_in_pool.
Sourcepub fn estimated_serialized_size(&self) -> usize
pub fn estimated_serialized_size(&self) -> usize
Returns a conservative upper-bound estimate of the total serialized byte size
of all transactions this proposal describes, by summing the per-step estimates
(see Step::estimated_serialized_size). Each step is estimated independently,
so the total is the sum of the per-step serialized sizes, not the size of a
single transaction.
The estimate is conservative (it never under-counts). See
Step::estimated_serialized_size for the per-element costs and the
mineability caveat.
Sourcepub fn check_transaction_size(&self) -> Result<(), ProposalError>
pub fn check_transaction_size(&self) -> Result<(), ProposalError>
Checks whether every step’s estimated serialized size fits within the maximum
a Zcash block may carry, returning ProposalError::TransactionTooLarge for
the first step that does not.
This is called by the public propose_transfer / propose_shielding wrappers
and the create_proposed_transactions / create_pczt_from_proposal build
entry points, so it protects all input selectors (including third-party ones)
and all build paths. It is not called during proposal deserialization, so
previously-persisted proposals remain recoverable.
Trait Implementations§
impl<FeeRuleT: Eq, NoteRef: Eq> Eq for Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT: PartialEq, NoteRef: PartialEq> StructuralPartialEq for Proposal<FeeRuleT, NoteRef>
Auto Trait Implementations§
impl<FeeRuleT, NoteRef> Freeze for Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT, NoteRef> RefUnwindSafe for Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT, NoteRef> Send for Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT, NoteRef> Sync for Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT, NoteRef> Unpin for Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT, NoteRef> UnsafeUnpin for Proposal<FeeRuleT, NoteRef>
impl<FeeRuleT, NoteRef> UnwindSafe for Proposal<FeeRuleT, NoteRef>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PossiblyOption<T> for T
impl<T> PossiblyOption<T> for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.