pub enum Output<N>where
N: Network,{
Constant(Field<N>, Option<Plaintext<N>>),
Public(Field<N>, Option<Plaintext<N>>),
Private(Field<N>, Option<Ciphertext<N>>),
Record(Field<N>, Field<N>, Option<Record<N, Ciphertext<N>>>, Option<Field<N>>),
ExternalRecord(Field<N>),
Future(Field<N>, Option<Future<N>>),
DynamicRecord(Field<N>),
RecordWithDynamicID(Field<N>, Field<N>, Option<Record<N, Ciphertext<N>>>, Option<Field<N>>, Field<N>),
ExternalRecordWithDynamicID(Field<N>, Field<N>),
}Expand description
The transition output.
Variants§
Constant(Field<N>, Option<Plaintext<N>>)
The plaintext hash and (optional) plaintext.
Public(Field<N>, Option<Plaintext<N>>)
The plaintext hash and (optional) plaintext.
Private(Field<N>, Option<Ciphertext<N>>)
The ciphertext hash and (optional) ciphertext.
Record(Field<N>, Field<N>, Option<Record<N, Ciphertext<N>>>, Option<Field<N>>)
The commitment, checksum, (optional) record ciphertext, and (optional) sender ciphertext.
ExternalRecord(Field<N>)
The hash of the external record’s (function_id, record, tvk, output index).
Future(Field<N>, Option<Future<N>>)
The future hash and (optional) future.
DynamicRecord(Field<N>)
The hash of the dynamic record’s (function_id, record, tvk, output index).
RecordWithDynamicID(Field<N>, Field<N>, Option<Record<N, Ciphertext<N>>>, Option<Field<N>>, Field<N>)
The commitment, checksum, (optional) record ciphertext, (optional) sender ciphertext, and dynamic ID.
ExternalRecordWithDynamicID(Field<N>, Field<N>)
The external record hash and dynamic ID.
Implementations§
Source§impl<N> Output<N>where
N: Network,
impl<N> Output<N>where
N: Network,
Sourcepub fn to_transition_leaf(&self, index: u8) -> TransitionLeaf<N>
pub fn to_transition_leaf(&self, index: u8) -> TransitionLeaf<N>
Returns the output as a transition leaf. Note: RecordWithDynamicID uses leaf variant 3 (same as Record) with version 2. Note: ExternalRecordWithDynamicID uses leaf variant 4 (same as ExternalRecord) with version 2.
Sourcepub const fn record(&self) -> Option<(&Field<N>, &Record<N, Ciphertext<N>>)>
pub const fn record(&self) -> Option<(&Field<N>, &Record<N, Ciphertext<N>>)>
Returns the commitment and record, if the output is a record.
Sourcepub fn into_record(self) -> Option<(Field<N>, Record<N, Ciphertext<N>>)>
pub fn into_record(self) -> Option<(Field<N>, Record<N, Ciphertext<N>>)>
Consumes self and returns the commitment and record, if the output is a record.
Sourcepub const fn commitment(&self) -> Option<&Field<N>>
pub const fn commitment(&self) -> Option<&Field<N>>
Returns the commitment, if the output is a record.
Sourcepub fn into_commitment(self) -> Option<Field<N>>
pub fn into_commitment(self) -> Option<Field<N>>
Returns the commitment, if the output is a record, and consumes self.
Sourcepub fn into_nonce(self) -> Option<Group<N>>
pub fn into_nonce(self) -> Option<Group<N>>
Returns the nonce, if the output is a record, and consumes self.
Sourcepub const fn checksum(&self) -> Option<&Field<N>>
pub const fn checksum(&self) -> Option<&Field<N>>
Returns the checksum, if the output is a record.
Sourcepub fn into_checksum(self) -> Option<Field<N>>
pub fn into_checksum(self) -> Option<Field<N>>
Returns the checksum, if the output is a record, and consumes self.
Sourcepub const fn sender_ciphertext(&self) -> Option<&Field<N>>
pub const fn sender_ciphertext(&self) -> Option<&Field<N>>
Returns the sender ciphertext, if the output is a record.
Sourcepub fn into_sender_ciphertext(self) -> Option<Field<N>>
pub fn into_sender_ciphertext(self) -> Option<Field<N>>
Returns the sender ciphertext, if the output is a record, and consumes self.
Source§impl<N> Output<N>where
N: Network,
impl<N> Output<N>where
N: Network,
Sourcepub fn decrypt_sender_ciphertext(
&self,
account_view_key: &ViewKey<N>,
) -> Result<Option<Address<N>>, Error>
pub fn decrypt_sender_ciphertext( &self, account_view_key: &ViewKey<N>, ) -> Result<Option<Address<N>>, Error>
Returns the sender address, given the account view key of the record owner.
If the output is not a record or does not contain a sender ciphertext, it returns Ok(None).
If the record does not belong to the given account view key, it returns Err.
If the sender ciphertext is malformed or cannot be decrypted, it returns Err.
Source§impl<N> Output<N>where
N: Network,
impl<N> Output<N>where
N: Network,
Sourcepub fn verifier_inputs(&self) -> impl Iterator<Item = <N as Environment>::Field>
pub fn verifier_inputs(&self) -> impl Iterator<Item = <N as Environment>::Field>
Returns the public verifier inputs for the proof.
Sourcepub const fn dynamic_id(&self) -> Option<&Field<N>>
pub const fn dynamic_id(&self) -> Option<&Field<N>>
Returns the dynamic ID, if the output carries one.
Sourcepub fn to_caller_output(&self) -> Output<N>
pub fn to_caller_output(&self) -> Output<N>
Returns the output from the caller’s perspective.
Sourcepub fn verify(
&self,
function_id: Field<N>,
tcm: &Field<N>,
index: usize,
) -> bool
pub fn verify( &self, function_id: Field<N>, tcm: &Field<N>, index: usize, ) -> bool
Returns true if the output is well-formed.
If the optional value exists, this method checks that it hashes to the output ID.
Sourcepub fn is_type(&self, expected_value_type: &ValueType<N>) -> bool
pub fn is_type(&self, expected_value_type: &ValueType<N>) -> bool
Returns true if the output matches the expected value type.
Sourcepub fn valid_as_output(
&self,
callee_value_type: &ValueType<N>,
is_dynamic: Option<bool>,
) -> bool
pub fn valid_as_output( &self, callee_value_type: &ValueType<N>, is_dynamic: Option<bool>, ) -> bool
Returns true if the output matches the given value type as produced by the callee.
Record, ExternalRecord, DynamicRecord, RecordWithDynamicID and
ExternalRecordWithDynamicID outputs are handled according to the value of is_dynamic:
Some(true)enforces type correspondence assuming the outputs refer to a dynamic call.Some(false)enforces it assuming a static call.Noneis flexible and makes no assumption about the type of call: both dynamic-call and static-call matching patterns returntrue.
For outputs of an invalid type according to is_dynamic, this function returns false
regardless of the value type.
Trait Implementations§
Source§impl<'de, N> Deserialize<'de> for Output<N>where
N: Network,
impl<'de, N> Deserialize<'de> for Output<N>where
N: Network,
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Output<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Output<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserializes the transition output from a string or bytes.
impl<N> Eq for Output<N>
Source§impl<N> FromBytes for Output<N>where
N: Network,
impl<N> FromBytes for Output<N>where
N: Network,
Source§fn read_le<R>(reader: R) -> Result<Output<N>, Error>where
R: Read,
fn read_le<R>(reader: R) -> Result<Output<N>, Error>where
R: Read,
Reads the output from a buffer.
Source§fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self from a byte array in little-endian order.Source§fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self::from_bytes_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
Self::read_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§impl<N> Serialize for Output<N>where
N: Network,
impl<N> Serialize for Output<N>where
N: Network,
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serializes the transition output into string or bytes.
impl<N> StructuralPartialEq for Output<N>
Auto Trait Implementations§
impl<N> !Freeze for Output<N>
impl<N> RefUnwindSafe for Output<N>where
Field<N>: RefUnwindSafe,
Option<Plaintext<N>>: RefUnwindSafe,
Option<Ciphertext<N>>: RefUnwindSafe,
Option<Record<N, Ciphertext<N>>>: RefUnwindSafe,
Option<Field<N>>: RefUnwindSafe,
Option<Future<N>>: RefUnwindSafe,
impl<N> Send for Output<N>
impl<N> Sync for Output<N>
impl<N> Unpin for Output<N>
impl<N> UnsafeUnpin for Output<N>where
Field<N>: UnsafeUnpin,
Option<Plaintext<N>>: UnsafeUnpin,
Option<Ciphertext<N>>: UnsafeUnpin,
Option<Record<N, Ciphertext<N>>>: UnsafeUnpin,
Option<Field<N>>: UnsafeUnpin,
Option<Future<N>>: UnsafeUnpin,
impl<N> UnwindSafe for Output<N>where
Field<N>: UnwindSafe,
Option<Plaintext<N>>: UnwindSafe,
Option<Ciphertext<N>>: UnwindSafe,
Option<Record<N, Ciphertext<N>>>: UnwindSafe,
Option<Field<N>>: UnwindSafe,
Option<Future<N>>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more