Struct snarkvm_ledger_block::transaction::Fee
source · pub struct Fee<N: Network> { /* private fields */ }
Implementations§
source§impl<N: Network> Fee<N>
impl<N: Network> Fee<N>
sourcepub fn from(
transition: Transition<N>,
global_state_root: N::StateRoot,
proof: Option<Proof<N>>
) -> Result<Self>
pub fn from( transition: Transition<N>, global_state_root: N::StateRoot, proof: Option<Proof<N>> ) -> Result<Self>
Initializes a new Fee
instance with the given transition, global state root, and proof.
sourcepub const fn from_unchecked(
transition: Transition<N>,
global_state_root: N::StateRoot,
proof: Option<Proof<N>>
) -> Self
pub const fn from_unchecked( transition: Transition<N>, global_state_root: N::StateRoot, proof: Option<Proof<N>> ) -> Self
Initializes a new Fee
instance with the given transition, global state root, and proof.
source§impl<N: Network> Fee<N>
impl<N: Network> Fee<N>
sourcepub fn is_fee_private(&self) -> bool
pub fn is_fee_private(&self) -> bool
Returns true
if this is a fee_private
transition.
sourcepub fn is_fee_public(&self) -> bool
pub fn is_fee_public(&self) -> bool
Returns true
if this is a fee_public
transition.
source§impl<N: Network> Fee<N>
impl<N: Network> Fee<N>
sourcepub fn base_amount(&self) -> Result<U64<N>>
pub fn base_amount(&self) -> Result<U64<N>>
Returns the base amount (in microcredits).
sourcepub fn priority_amount(&self) -> Result<U64<N>>
pub fn priority_amount(&self) -> Result<U64<N>>
Returns the base amount (in microcredits).
sourcepub fn deployment_or_execution_id(&self) -> Result<Field<N>>
pub fn deployment_or_execution_id(&self) -> Result<Field<N>>
Returns the deployment or execution ID.
sourcepub fn num_finalize_operations(&self) -> usize
pub fn num_finalize_operations(&self) -> usize
Returns the number of finalize operations.
sourcepub fn transition_id(&self) -> &N::TransitionID
pub fn transition_id(&self) -> &N::TransitionID
Returns the transition ID.
sourcepub const fn transition(&self) -> &Transition<N>
pub const fn transition(&self) -> &Transition<N>
Returns the transition.
sourcepub fn into_transition(self) -> Transition<N>
pub fn into_transition(self) -> Transition<N>
Returns the transition, consuming self in the process.
sourcepub const fn global_state_root(&self) -> N::StateRoot
pub const fn global_state_root(&self) -> N::StateRoot
Returns the global state root.
Methods from Deref<Target = Transition<N>>§
sourcepub fn to_root(&self) -> Result<Field<N>>
pub fn to_root(&self) -> Result<Field<N>>
Returns the transition root, by computing the root for a Merkle tree of the input and output IDs.
sourcepub fn to_path(&self, leaf: &TransitionLeaf<N>) -> Result<TransitionPath<N>>
pub fn to_path(&self, leaf: &TransitionLeaf<N>) -> Result<TransitionPath<N>>
Returns the Merkle path for the transition leaf.
sourcepub fn to_leaf(
&self,
id: &Field<N>,
is_input: bool
) -> Result<TransitionLeaf<N>>
pub fn to_leaf( &self, id: &Field<N>, is_input: bool ) -> Result<TransitionLeaf<N>>
Returns the Merkle leaf for the given input or output ID in the transition.
sourcepub fn to_tree(&self) -> Result<TransitionTree<N>>
pub fn to_tree(&self) -> Result<TransitionTree<N>>
The Merkle tree of input and output IDs for the transition.
sourcepub fn program_id(&self) -> &ProgramID<N>
pub fn program_id(&self) -> &ProgramID<N>
Returns the program ID.
sourcepub fn function_name(&self) -> &Identifier<N>
pub fn function_name(&self) -> &Identifier<N>
Returns the function name.
sourcepub fn is_fee_private(&self) -> bool
pub fn is_fee_private(&self) -> bool
Returns true
if this is a fee_private
transition.
sourcepub fn is_fee_public(&self) -> bool
pub fn is_fee_public(&self) -> bool
Returns true
if this is a fee_public
transition.
sourcepub fn contains_serial_number(&self, serial_number: &Field<N>) -> bool
pub fn contains_serial_number(&self, serial_number: &Field<N>) -> bool
Returns true
if the transition contains the given serial number.
sourcepub fn contains_commitment(&self, commitment: &Field<N>) -> bool
pub fn contains_commitment(&self, commitment: &Field<N>) -> bool
Returns true
if the transition contains the given commitment.
sourcepub fn find_record(
&self,
commitment: &Field<N>
) -> Option<&Record<N, Ciphertext<N>>>
pub fn find_record( &self, commitment: &Field<N> ) -> Option<&Record<N, Ciphertext<N>>>
Returns the record with the corresponding commitment, if it exists.
sourcepub fn input_ids(&self) -> impl '_ + ExactSizeIterator<Item = &Field<N>>
pub fn input_ids(&self) -> impl '_ + ExactSizeIterator<Item = &Field<N>>
Returns the input IDs.
sourcepub fn serial_numbers(&self) -> impl '_ + Iterator<Item = &Field<N>>
pub fn serial_numbers(&self) -> impl '_ + Iterator<Item = &Field<N>>
Returns an iterator over the serial numbers, for inputs that are records.
Returns an iterator over the tags, for inputs that are records.
sourcepub fn output_ids(&self) -> impl '_ + ExactSizeIterator<Item = &Field<N>>
pub fn output_ids(&self) -> impl '_ + ExactSizeIterator<Item = &Field<N>>
Returns the output IDs.
sourcepub fn commitments(&self) -> impl '_ + Iterator<Item = &Field<N>>
pub fn commitments(&self) -> impl '_ + Iterator<Item = &Field<N>>
Returns an iterator over the commitments, for outputs that are records.
Trait Implementations§
source§impl<'de, N: Network> Deserialize<'de> for Fee<N>
impl<'de, N: Network> Deserialize<'de> for Fee<N>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the fee from a string or bytes.
source§impl<N: PartialEq + Network> PartialEq for Fee<N>where
N::StateRoot: PartialEq,
impl<N: PartialEq + Network> PartialEq for Fee<N>where N::StateRoot: PartialEq,
impl<N: Eq + Network> Eq for Fee<N>where N::StateRoot: Eq,
impl<N: Network> StructuralEq for Fee<N>
impl<N: Network> StructuralPartialEq for Fee<N>
Auto Trait Implementations§
impl<N> RefUnwindSafe for Fee<N>where N: RefUnwindSafe, <N as Environment>::Field: RefUnwindSafe, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe, <N as Environment>::Projective: RefUnwindSafe, <N as Environment>::Scalar: RefUnwindSafe, <N as Network>::StateRoot: RefUnwindSafe, <N as Network>::TransitionID: RefUnwindSafe,
impl<N> Send for Fee<N>
impl<N> Sync for Fee<N>
impl<N> Unpin for Fee<N>where N: Unpin, <N as Environment>::Field: Unpin, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: Unpin, <N as Environment>::Projective: Unpin, <N as Environment>::Scalar: Unpin, <N as Network>::StateRoot: Unpin, <N as Network>::TransitionID: Unpin,
impl<N> UnwindSafe for Fee<N>where N: UnwindSafe, <N as Environment>::Field: UnwindSafe, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: UnwindSafe, <N as Environment>::Projective: UnwindSafe, <N as Environment>::Scalar: UnwindSafe, <N as Network>::StateRoot: UnwindSafe, <N as Network>::TransitionID: 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<'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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.