pub struct Bundle<T: Authorization, V> { /* private fields */ }Expand description
A bundle of actions to be applied to the ledger.
Implementations§
Source§impl<S: InProgressSignatures, V> Bundle<InProgress<Unproven, S>, V>
impl<S: InProgressSignatures, V> Bundle<InProgress<Unproven, S>, V>
Sourcepub fn create_proof(
self,
pk: &ProvingKey,
rng: impl RngCore,
) -> Result<Bundle<InProgress<Proof, S>, V>, BuildError>
Available on crate feature circuit only.
pub fn create_proof( self, pk: &ProvingKey, rng: impl RngCore, ) -> Result<Bundle<InProgress<Proof, S>, V>, BuildError>
circuit only.Creates the proof for this bundle.
Sourcepub fn prepare<R: RngCore + CryptoRng>(
self,
rng: R,
sighash: [u8; 32],
) -> Bundle<InProgress<P, PartiallyAuthorized>, V>
pub fn prepare<R: RngCore + CryptoRng>( self, rng: R, sighash: [u8; 32], ) -> Bundle<InProgress<P, PartiallyAuthorized>, V>
Loads the sighash into this bundle, preparing it for signing.
This API ensures that all signatures are created over the same sighash.
Sourcepub fn apply_signatures<R: RngCore + CryptoRng>(
self,
rng: R,
sighash: [u8; 32],
signing_keys: &[SpendAuthorizingKey],
) -> Result<Bundle<Authorized, V>, BuildError>
pub fn apply_signatures<R: RngCore + CryptoRng>( self, rng: R, sighash: [u8; 32], signing_keys: &[SpendAuthorizingKey], ) -> Result<Bundle<Authorized, V>, BuildError>
Applies signatures to this bundle, in order to authorize it.
This is a helper method that wraps Bundle::prepare, Bundle::sign, and
Bundle::finalize.
Source§impl<P: Debug, V> Bundle<InProgress<P, PartiallyAuthorized>, V>
impl<P: Debug, V> Bundle<InProgress<P, PartiallyAuthorized>, V>
Sourcepub fn sign<R: RngCore + CryptoRng>(
self,
rng: R,
ask: &SpendAuthorizingKey,
) -> Self
pub fn sign<R: RngCore + CryptoRng>( self, rng: R, ask: &SpendAuthorizingKey, ) -> Self
Signs this bundle with the given SpendAuthorizingKey.
This will apply signatures for all notes controlled by this spending key.
Sourcepub fn append_signatures(
self,
signatures: &[Signature<SpendAuth>],
) -> Result<Self, BuildError>
pub fn append_signatures( self, signatures: &[Signature<SpendAuth>], ) -> Result<Self, BuildError>
Appends externally computed Signatures.
Each signature will be applied to the one input for which it is valid. An error will be returned if the signature is not valid for any inputs, or if it is valid for more than one input.
Source§impl<V> Bundle<InProgress<Proof, PartiallyAuthorized>, V>
impl<V> Bundle<InProgress<Proof, PartiallyAuthorized>, V>
Sourcepub fn finalize(self) -> Result<Bundle<Authorized, V>, BuildError>
pub fn finalize(self) -> Result<Bundle<Authorized, V>, BuildError>
Finalizes this bundle, enabling it to be included in a transaction.
Returns an error if any signatures are missing.
Source§impl<T: Authorization, V> Bundle<T, V>
impl<T: Authorization, V> Bundle<T, V>
Sourcepub fn from_parts(
actions: NonEmpty<Action<T::SpendAuth>>,
flags: Flags,
value_balance: V,
anchor: Anchor,
authorization: T,
) -> Self
pub fn from_parts( actions: NonEmpty<Action<T::SpendAuth>>, flags: Flags, value_balance: V, anchor: Anchor, authorization: T, ) -> Self
Constructs a Bundle from its constituent parts.
Sourcepub fn actions(&self) -> &NonEmpty<Action<T::SpendAuth>>
pub fn actions(&self) -> &NonEmpty<Action<T::SpendAuth>>
Returns the list of actions that make up this bundle.
Sourcepub fn flags(&self) -> &Flags
pub fn flags(&self) -> &Flags
Returns the Orchard-specific transaction-level flags for this bundle.
Sourcepub fn value_balance(&self) -> &V
pub fn value_balance(&self) -> &V
Returns the net value moved into or out of the Orchard shielded pool.
This is the sum of Orchard spends minus the sum Orchard outputs.
Sourcepub fn anchor(&self) -> &Anchor
pub fn anchor(&self) -> &Anchor
Returns the root of the Orchard commitment tree that this bundle commits to.
Returns the authorization for this bundle.
In the case of a Bundle<Authorized>, this is the proof and binding signature.
Sourcepub fn try_map_value_balance<V0, E, F: FnOnce(V) -> Result<V0, E>>(
self,
f: F,
) -> Result<Bundle<T, V0>, E>
pub fn try_map_value_balance<V0, E, F: FnOnce(V) -> Result<V0, E>>( self, f: F, ) -> Result<Bundle<T, V0>, E>
Construct a new bundle by applying a transformation that might fail to the value balance.
Transitions this bundle from one authorization state to another.
Transitions this bundle from one authorization state to another.
Sourcepub fn decrypt_outputs_with_keys(
&self,
keys: &[IncomingViewingKey],
) -> Vec<(usize, IncomingViewingKey, Note, Address, [u8; 512])>
pub fn decrypt_outputs_with_keys( &self, keys: &[IncomingViewingKey], ) -> Vec<(usize, IncomingViewingKey, Note, Address, [u8; 512])>
Performs trial decryption of each action in the bundle with each of the specified incoming viewing keys, and returns a vector of each decrypted note plaintext contents along with the index of the action from which it was derived.
Sourcepub fn decrypt_output_with_key(
&self,
action_idx: usize,
key: &IncomingViewingKey,
) -> Option<(Note, Address, [u8; 512])>
pub fn decrypt_output_with_key( &self, action_idx: usize, key: &IncomingViewingKey, ) -> Option<(Note, Address, [u8; 512])>
Performs trial decryption of the action at action_idx in the bundle with the
specified incoming viewing key, and returns the decrypted note plaintext
contents if successful.
Sourcepub fn recover_outputs_with_ovks(
&self,
keys: &[OutgoingViewingKey],
) -> Vec<(usize, OutgoingViewingKey, Note, Address, [u8; 512])>
pub fn recover_outputs_with_ovks( &self, keys: &[OutgoingViewingKey], ) -> Vec<(usize, OutgoingViewingKey, Note, Address, [u8; 512])>
Performs trial decryption of each action in the bundle with each of the specified outgoing viewing keys, and returns a vector of each decrypted note plaintext contents along with the index of the action from which it was derived.
Sourcepub fn recover_output_with_ovk(
&self,
action_idx: usize,
key: &OutgoingViewingKey,
) -> Option<(Note, Address, [u8; 512])>
pub fn recover_output_with_ovk( &self, action_idx: usize, key: &OutgoingViewingKey, ) -> Option<(Note, Address, [u8; 512])>
Attempts to decrypt the action at the specified index with the specified outgoing viewing key, and returns the decrypted note plaintext contents if successful.
Source§impl<T: Authorization, V: Copy + Into<i64>> Bundle<T, V>
impl<T: Authorization, V: Copy + Into<i64>> Bundle<T, V>
Sourcepub fn commitment(&self) -> BundleCommitment
pub fn commitment(&self) -> BundleCommitment
Computes a commitment to the effects of this bundle, suitable for inclusion within a transaction ID.
Sourcepub fn binding_validating_key(&self) -> VerificationKey<Binding>
pub fn binding_validating_key(&self) -> VerificationKey<Binding>
Returns the transaction binding validating key for this bundle.
This can be used to validate the Authorized::binding_signature returned from
Bundle::authorization.
Source§impl<V> Bundle<Authorized, V>
impl<V> Bundle<Authorized, V>
Computes a commitment to the authorizing data within for this bundle.
This together with Bundle::commitment bind the entire bundle.
Sourcepub fn verify_proof(&self, vk: &VerifyingKey) -> Result<(), Error>
Available on crate feature circuit only.
pub fn verify_proof(&self, vk: &VerifyingKey) -> Result<(), Error>
circuit only.Verifies the proof for this bundle.
Source§impl<V> Bundle<Unbound, V>
impl<V> Bundle<Unbound, V>
Sourcepub fn apply_binding_signature<R: RngCore + CryptoRng>(
self,
sighash: [u8; 32],
rng: R,
) -> Option<Bundle<Authorized, V>>
pub fn apply_binding_signature<R: RngCore + CryptoRng>( self, sighash: [u8; 32], rng: R, ) -> Option<Bundle<Authorized, V>>
Verifies the given sighash with every spend_auth_sig, and then binds the bundle.
Returns None if the given sighash does not validate against every spend_auth_sig.
Trait Implementations§
Source§impl<V: DynamicUsage> DynamicUsage for Bundle<Authorized, V>
Available on crate feature std only.
impl<V: DynamicUsage> DynamicUsage for Bundle<Authorized, V>
std only.Auto Trait Implementations§
impl<T, V> Freeze for Bundle<T, V>
impl<T, V> RefUnwindSafe for Bundle<T, V>
impl<T, V> Send for Bundle<T, V>
impl<T, V> Sync for Bundle<T, V>
impl<T, V> Unpin for Bundle<T, V>
impl<T, V> UnsafeUnpin for Bundle<T, V>
impl<T, V> UnwindSafe for Bundle<T, V>
Blanket Implementations§
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,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§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 moreSource§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 moreSource§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
Source§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
Source§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.Source§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.Source§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.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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 moreSource§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.Source§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.Source§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.Source§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.Source§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.Source§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.Source§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.