Enum aleo_rust::snarkvm_types::Transaction
source · pub enum Transaction<N>where
N: Network,{
Deploy(<N as Network>::TransactionID, ProgramOwner<N>, Box<Deployment<N>, Global>, Fee<N>),
Execute(<N as Network>::TransactionID, Execution<N>, Option<Fee<N>>),
Fee(<N as Network>::TransactionID, Fee<N>),
}
Variants§
Deploy(<N as Network>::TransactionID, ProgramOwner<N>, Box<Deployment<N>, Global>, Fee<N>)
The deploy transaction publishes an Aleo program to the network.
Execute(<N as Network>::TransactionID, Execution<N>, Option<Fee<N>>)
The execute transaction represents a call to an Aleo program.
Fee(<N as Network>::TransactionID, Fee<N>)
The fee transaction represents a fee paid to the network, used for rejected transactions.
Implementations§
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn to_root(&self) -> Result<Field<N>, Error>
pub fn to_root(&self) -> Result<Field<N>, Error>
Returns the transaction root, by computing the root for a Merkle tree of the transition IDs.
sourcepub fn to_leaf(&self, id: &Field<N>) -> Result<TransactionLeaf<N>, Error>
pub fn to_leaf(&self, id: &Field<N>) -> Result<TransactionLeaf<N>, Error>
Returns the Merkle leaf for the given ID of a function or transition in the transaction.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn deployment_tree(
deployment: &Deployment<N>,
fee: Option<&Fee<N>>
) -> Result<MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::TransactionTree::{constant#0}>, Error>
pub fn deployment_tree( deployment: &Deployment<N>, fee: Option<&Fee<N>> ) -> Result<MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::TransactionTree::{constant#0}>, Error>
Returns the Merkle tree for the given deployment.
sourcepub fn execution_tree(
execution: &Execution<N>,
fee: &Option<Fee<N>>
) -> Result<MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::TransactionTree::{constant#0}>, Error>
pub fn execution_tree( execution: &Execution<N>, fee: &Option<Fee<N>> ) -> Result<MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::TransactionTree::{constant#0}>, Error>
Returns the Merkle tree for the given execution.
sourcepub fn fee_tree(
fee: &Fee<N>
) -> Result<MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::TransactionTree::{constant#0}>, Error>
pub fn fee_tree( fee: &Fee<N> ) -> Result<MerkleTree<N, BHP<N, 8, 54>, BHP<N, 6, 43>, snarkvm_console_program::::state_path::configuration::TransactionTree::{constant#0}>, Error>
Returns the Merkle tree for the given fee.
sourcepub fn check_deployment_size(deployment: &Deployment<N>) -> Result<(), Error>
pub fn check_deployment_size(deployment: &Deployment<N>) -> Result<(), Error>
Returns true
if the deployment is within the size bounds.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn from_deployment(
owner: ProgramOwner<N>,
deployment: Deployment<N>,
fee: Fee<N>
) -> Result<Transaction<N>, Error>
pub fn from_deployment( owner: ProgramOwner<N>, deployment: Deployment<N>, fee: Fee<N> ) -> Result<Transaction<N>, Error>
Initializes a new deployment transaction.
sourcepub fn from_execution(
execution: Execution<N>,
fee: Option<Fee<N>>
) -> Result<Transaction<N>, Error>
pub fn from_execution( execution: Execution<N>, fee: Option<Fee<N>> ) -> Result<Transaction<N>, Error>
Initializes a new execution transaction.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn is_execute(&self) -> bool
pub fn is_execute(&self) -> bool
Returns true
if the transaction is an execute transaction.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn owner(&self) -> Option<&ProgramOwner<N>>
pub fn owner(&self) -> Option<&ProgramOwner<N>>
Returns Some(owner)
if the transaction is a deployment. Otherwise, returns None
.
sourcepub fn deployment(&self) -> Option<&Deployment<N>>
pub fn deployment(&self) -> Option<&Deployment<N>>
Returns Some(deployment)
if the transaction is a deployment. Otherwise, returns None
.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn contains_transition(
&self,
transition_id: &<N as Network>::TransitionID
) -> bool
pub fn contains_transition( &self, transition_id: &<N as Network>::TransitionID ) -> bool
Returns true
if the transaction contains the given transition ID.
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 transaction 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 transaction contains the given commitment.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn find_transition(
&self,
transition_id: &<N as Network>::TransitionID
) -> Option<&Transition<N>>
pub fn find_transition( &self, transition_id: &<N as Network>::TransitionID ) -> Option<&Transition<N>>
Returns the transition with the corresponding transition ID, if it exists.
sourcepub fn find_transition_for_serial_number(
&self,
serial_number: &Field<N>
) -> Option<&Transition<N>>
pub fn find_transition_for_serial_number( &self, serial_number: &Field<N> ) -> Option<&Transition<N>>
Returns the transition for the given serial number, if it exists.
sourcepub fn find_transition_for_commitment(
&self,
commitment: &Field<N>
) -> Option<&Transition<N>>
pub fn find_transition_for_commitment( &self, commitment: &Field<N> ) -> Option<&Transition<N>>
Returns the transition for the given commitment, if it exists.
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.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn transition_ids(
&self
) -> impl Iterator<Item = &<N as Network>::TransitionID>
pub fn transition_ids( &self ) -> impl Iterator<Item = &<N as Network>::TransitionID>
Returns an iterator over the transition IDs, for all transitions.
sourcepub fn transitions(&self) -> impl Iterator<Item = &Transition<N>>
pub fn transitions(&self) -> impl Iterator<Item = &Transition<N>>
Returns an iterator over all transitions.
sourcepub fn input_ids(&self) -> impl Iterator<Item = &Field<N>>
pub fn input_ids(&self) -> impl Iterator<Item = &Field<N>>
Returns an iterator over the input IDs, for all transition inputs that are records.
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 all transition inputs that are records.
Returns an iterator over the tags, for all transition inputs that are records.
sourcepub fn output_ids(&self) -> impl Iterator<Item = &Field<N>>
pub fn output_ids(&self) -> impl Iterator<Item = &Field<N>>
Returns an iterator over the output IDs, for all transition inputs that are records.
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 all transition outputs that are records.
sourcepub fn records(
&self
) -> impl Iterator<Item = (&Field<N>, &Record<N, Ciphertext<N>>)>
pub fn records( &self ) -> impl Iterator<Item = (&Field<N>, &Record<N, Ciphertext<N>>)>
Returns an iterator over the records, for all transition outputs that are records.
sourcepub fn nonces(&self) -> impl Iterator<Item = &Group<N>>
pub fn nonces(&self) -> impl Iterator<Item = &Group<N>>
Returns an iterator over the nonces, for all transition outputs that are records.
sourcepub fn transition_public_keys(&self) -> impl Iterator<Item = &Group<N>>
pub fn transition_public_keys(&self) -> impl Iterator<Item = &Group<N>>
Returns an iterator over the transition public keys, for all transitions.
sourcepub fn transition_commitments(&self) -> impl Iterator<Item = &Field<N>>
pub fn transition_commitments(&self) -> impl Iterator<Item = &Field<N>>
Returns an iterator over the transition commitments, for all transitions.
source§impl<N> Transaction<N>where
N: Network,
impl<N> Transaction<N>where N: Network,
sourcepub fn into_transition_ids(
self
) -> impl Iterator<Item = <N as Network>::TransitionID>
pub fn into_transition_ids( self ) -> impl Iterator<Item = <N as Network>::TransitionID>
Returns a consuming iterator over the transition IDs, for all transitions.
sourcepub fn into_transitions(self) -> impl Iterator<Item = Transition<N>>
pub fn into_transitions(self) -> impl Iterator<Item = Transition<N>>
Returns a consuming iterator over all transitions.
sourcepub fn into_transition_public_keys(self) -> impl Iterator<Item = Group<N>>
pub fn into_transition_public_keys(self) -> impl Iterator<Item = Group<N>>
Returns a consuming iterator over the transition public keys, for all transitions.
Returns a consuming iterator over the tags, for all transition inputs that are records.
sourcepub fn into_serial_numbers(self) -> impl Iterator<Item = Field<N>>
pub fn into_serial_numbers(self) -> impl Iterator<Item = Field<N>>
Returns a consuming iterator over the serial numbers, for all transition inputs that are records.
sourcepub fn into_commitments(self) -> impl Iterator<Item = Field<N>>
pub fn into_commitments(self) -> impl Iterator<Item = Field<N>>
Returns a consuming iterator over the commitments, for all transition outputs that are records.
sourcepub fn into_records(
self
) -> impl Iterator<Item = (Field<N>, Record<N, Ciphertext<N>>)>
pub fn into_records( self ) -> impl Iterator<Item = (Field<N>, Record<N, Ciphertext<N>>)>
Returns a consuming iterator over the records, for all transition outputs that are records.
sourcepub fn into_nonces(self) -> impl Iterator<Item = Group<N>>
pub fn into_nonces(self) -> impl Iterator<Item = Group<N>>
Returns a consuming iterator over the nonces, for all transition outputs that are records.
Trait Implementations§
source§impl<N> Clone for Transaction<N>where
N: Clone + Network,
<N as Network>::TransactionID: Clone,
impl<N> Clone for Transaction<N>where N: Clone + Network, <N as Network>::TransactionID: Clone,
source§fn clone(&self) -> Transaction<N>
fn clone(&self) -> Transaction<N>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<N> Debug for Transaction<N>where
N: Network,
impl<N> Debug for Transaction<N>where N: Network,
source§impl<'de, N> Deserialize<'de> for Transaction<N>where
N: Network,
impl<'de, N> Deserialize<'de> for Transaction<N>where N: Network,
source§fn deserialize<D>(
deserializer: D
) -> Result<Transaction<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<Transaction<N>, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserializes the transaction from a JSON-string or buffer.
source§impl<N> Display for Transaction<N>where
N: Network,
impl<N> Display for Transaction<N>where N: Network,
source§impl<N> FromBytes for Transaction<N>where
N: Network,
impl<N> FromBytes for Transaction<N>where N: Network,
source§impl<N> FromStr for Transaction<N>where
N: Network,
impl<N> FromStr for Transaction<N>where N: Network,
source§impl<N> PartialEq<Transaction<N>> for Transaction<N>where
N: PartialEq<N> + Network,
<N as Network>::TransactionID: PartialEq<<N as Network>::TransactionID>,
impl<N> PartialEq<Transaction<N>> for Transaction<N>where N: PartialEq<N> + Network, <N as Network>::TransactionID: PartialEq<<N as Network>::TransactionID>,
source§fn eq(&self, other: &Transaction<N>) -> bool
fn eq(&self, other: &Transaction<N>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<N> Serialize for Transaction<N>where
N: Network,
impl<N> Serialize for Transaction<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 transaction to a JSON-string or buffer.
source§impl<N> ToBytes for Transaction<N>where
N: Network,
impl<N> ToBytes for Transaction<N>where N: Network,
impl<N> Eq for Transaction<N>where N: Eq + Network, <N as Network>::TransactionID: Eq,
impl<N> StructuralEq for Transaction<N>where N: Network,
impl<N> StructuralPartialEq for Transaction<N>where N: Network,
Auto Trait Implementations§
impl<N> RefUnwindSafe for Transaction<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>::TransactionID: RefUnwindSafe, <N as Network>::TransitionID: RefUnwindSafe,
impl<N> Send for Transaction<N>
impl<N> Sync for Transaction<N>
impl<N> Unpin for Transaction<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>::TransactionID: Unpin, <N as Network>::TransitionID: Unpin,
impl<N> UnwindSafe for Transaction<N>where N: UnwindSafe, <N as Environment>::Field: UnwindSafe, <<N as Environment>::PairingCurve as PairingEngine>::G1Affine: UnwindSafe + RefUnwindSafe, <N as Environment>::Projective: UnwindSafe, <N as Environment>::Scalar: UnwindSafe, <N as Network>::StateRoot: UnwindSafe, <N as Network>::TransactionID: 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>,
source§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,
source§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 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.