Enum snarkvm_compiler::Transaction
source · [−]pub enum Transaction<N: Network> {
Deploy(N::TransactionID, Deployment<N>, AdditionalFee<N>),
Execute(N::TransactionID, Execution<N>, Option<AdditionalFee<N>>),
}
Variants
Deploy(N::TransactionID, Deployment<N>, AdditionalFee<N>)
The transaction deployment publishes an Aleo program to the network.
Execute(N::TransactionID, Execution<N>, Option<AdditionalFee<N>>)
The transaction execution represents a call to an Aleo program.
Implementations
sourceimpl<N: Network> Transaction<N>
impl<N: Network> Transaction<N>
sourcepub fn to_root(&self) -> Result<Field<N>>
pub fn to_root(&self) -> Result<Field<N>>
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>>
pub fn to_leaf(&self, id: &Field<N>) -> Result<TransactionLeaf<N>>
Returns the Merkle leaf for the given ID of a function or transition in the transaction.
sourcepub fn to_path(&self, leaf: &TransactionLeaf<N>) -> Result<TransactionPath<N>>
pub fn to_path(&self, leaf: &TransactionLeaf<N>) -> Result<TransactionPath<N>>
Returns the Merkle path for the transaction leaf.
sourceimpl<N: Network> Transaction<N>
impl<N: Network> Transaction<N>
sourcepub fn check_deployment_size(deployment: &Deployment<N>) -> Result<()>
pub fn check_deployment_size(deployment: &Deployment<N>) -> Result<()>
Returns true
if the deployment is within the size bounds.
sourcepub fn check_execution_size(execution: &Execution<N>) -> Result<()>
pub fn check_execution_size(execution: &Execution<N>) -> Result<()>
Returns true
if the execution is within the size bounds.
sourceimpl<N: Network> Transaction<N>
impl<N: Network> Transaction<N>
sourcepub fn from_deployment(
deployment: Deployment<N>,
additional_fee: AdditionalFee<N>
) -> Result<Self>
pub fn from_deployment(
deployment: Deployment<N>,
additional_fee: AdditionalFee<N>
) -> Result<Self>
Initializes a new deployment transaction.
sourcepub fn from_execution(
execution: Execution<N>,
additional_fee: Option<AdditionalFee<N>>
) -> Result<Self>
pub fn from_execution(
execution: Execution<N>,
additional_fee: Option<AdditionalFee<N>>
) -> Result<Self>
Initializes a new execution transaction.
sourceimpl<N: Network> Transaction<N>
impl<N: Network> Transaction<N>
sourcepub fn deploy<P: ProgramStorage<N>, R: Rng + CryptoRng>(
vm: &VM<N, P>,
private_key: &PrivateKey<N>,
program: &Program<N>,
(credits, additional_fee_in_gates): (Record<N, Plaintext<N>>, u64),
rng: &mut R
) -> Result<Self>
pub fn deploy<P: ProgramStorage<N>, R: Rng + CryptoRng>(
vm: &VM<N, P>,
private_key: &PrivateKey<N>,
program: &Program<N>,
(credits, additional_fee_in_gates): (Record<N, Plaintext<N>>, u64),
rng: &mut R
) -> Result<Self>
Initializes a new deployment transaction.
Initializes a new execution transaction from an authorization.
Initializes a new execution transaction from an authorization and additional fee.
sourcepub fn execute<P: ProgramStorage<N>, R: Rng + CryptoRng>(
vm: &VM<N, P>,
private_key: &PrivateKey<N>,
program_id: &ProgramID<N>,
function_name: Identifier<N>,
inputs: &[Value<N>],
additional_fee: Option<(Record<N, Plaintext<N>>, u64)>,
rng: &mut R
) -> Result<Self>
pub fn execute<P: ProgramStorage<N>, R: Rng + CryptoRng>(
vm: &VM<N, P>,
private_key: &PrivateKey<N>,
program_id: &ProgramID<N>,
function_name: Identifier<N>,
inputs: &[Value<N>],
additional_fee: Option<(Record<N, Plaintext<N>>, u64)>,
rng: &mut R
) -> Result<Self>
Initializes a new execution transaction.
sourceimpl<N: Network> Transaction<N>
impl<N: Network> Transaction<N>
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 transition_ids(&self) -> impl '_ + Iterator<Item = &N::TransitionID>
pub fn transition_ids(&self) -> impl '_ + Iterator<Item = &N::TransitionID>
Returns an iterator over the transition IDs, for 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 origins(&self) -> impl '_ + Iterator<Item = &Origin<N>>
pub fn origins(&self) -> impl '_ + Iterator<Item = &Origin<N>>
Returns an iterator over the origins, 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 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.
sourceimpl<N: Network> Transaction<N>
impl<N: Network> Transaction<N>
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_ids(self) -> impl Iterator<Item = N::TransitionID>
pub fn into_transition_ids(self) -> impl Iterator<Item = N::TransitionID>
Returns a consuming iterator over the transition IDs, for 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.
sourcepub fn into_origins(self) -> impl Iterator<Item = Origin<N>>
pub fn into_origins(self) -> impl Iterator<Item = Origin<N>>
Returns a consuming iterator over the origins, for all transition inputs that are records.
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_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
sourceimpl<N: Clone + Network> Clone for Transaction<N> where
N::TransactionID: Clone,
N::TransactionID: Clone,
impl<N: Clone + Network> Clone for Transaction<N> where
N::TransactionID: Clone,
N::TransactionID: Clone,
sourcefn clone(&self) -> Transaction<N>
fn clone(&self) -> Transaction<N>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<N: Network> Debug for Transaction<N>
impl<N: Network> Debug for Transaction<N>
sourceimpl<'de, N: Network> Deserialize<'de> for Transaction<N>
impl<'de, N: Network> Deserialize<'de> for Transaction<N>
sourcefn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the transaction from a JSON-string or buffer.
sourceimpl<N: Network> Display for Transaction<N>
impl<N: Network> Display for Transaction<N>
sourceimpl<N: Network> FromBytes for Transaction<N>
impl<N: Network> FromBytes for Transaction<N>
sourceimpl<'a, N: Network> FromIterator<&'a Transaction<N>> for Transactions<N>
impl<'a, N: Network> FromIterator<&'a Transaction<N>> for Transactions<N>
sourcefn from_iter<T: IntoIterator<Item = &'a Transaction<N>>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = &'a Transaction<N>>>(iter: T) -> Self
Initializes from an iterator of transactions.
sourceimpl<N: Network> FromIterator<Transaction<N>> for Transactions<N>
impl<N: Network> FromIterator<Transaction<N>> for Transactions<N>
sourcefn from_iter<T: IntoIterator<Item = Transaction<N>>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Transaction<N>>>(iter: T) -> Self
Initializes from an iterator of transactions.
sourceimpl<N: Network> FromStr for Transaction<N>
impl<N: Network> FromStr for Transaction<N>
sourceimpl<N: PartialEq + Network> PartialEq<Transaction<N>> for Transaction<N> where
N::TransactionID: PartialEq,
N::TransactionID: PartialEq,
impl<N: PartialEq + Network> PartialEq<Transaction<N>> for Transaction<N> where
N::TransactionID: PartialEq,
N::TransactionID: PartialEq,
sourcefn eq(&self, other: &Transaction<N>) -> bool
fn eq(&self, other: &Transaction<N>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl<N: Network> Serialize for Transaction<N>
impl<N: Network> Serialize for Transaction<N>
sourceimpl<N: Network> ToBytes for Transaction<N>
impl<N: Network> ToBytes for Transaction<N>
impl<N: Eq + Network> Eq for Transaction<N> where
N::TransactionID: Eq,
N::TransactionID: Eq,
impl<N: Network> StructuralEq for Transaction<N>
impl<N: Network> StructuralPartialEq for Transaction<N>
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>::PairingCurve as PairingEngine>::G2Affine: RefUnwindSafe,
<<<N as Environment>::PairingCurve as PairingEngine>::G2Affine as PairingCurve>::Prepared: 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>::PairingCurve as PairingEngine>::G2Affine: Unpin,
<<<N as Environment>::PairingCurve as PairingEngine>::G2Affine as PairingCurve>::Prepared: 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,
<<N as Environment>::PairingCurve as PairingEngine>::G2Affine: UnwindSafe,
<<<N as Environment>::PairingCurve as PairingEngine>::G2Affine as PairingCurve>::Prepared: UnwindSafe,
<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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more