Struct miden_objects::transaction::TransactionArgs

source ·
pub struct TransactionArgs { /* private fields */ }
Expand description

A struct that represents optional transaction arguments.

  • Transaction script: a program that is executed in a transaction after all input notes scripts have been executed.
  • Note arguments: data put onto the stack right before a note script is executed. These are different from note inputs, as the user executing the transaction can specify arbitrary note args.
  • Advice map: Provides data needed by the runtime, like the details of a public note.

Implementations§

source§

impl TransactionArgs

source

pub fn new( tx_script: Option<TransactionScript>, note_args: Option<BTreeMap<NoteId, Word>>, advice_map: AdviceMap ) -> Self

Returns new TransactionArgs instantiated with the provided transaction script and note arguments.

If tx_script is provided, this also adds all mappings from the transaction script inputs to the advice map.

source

pub fn with_tx_script(tx_script: TransactionScript) -> Self

Returns new TransactionArgs instantiated with the provided transaction script.

source

pub fn with_note_args(note_args: BTreeMap<NoteId, Word>) -> Self

Returns new TransactionArgs instantiated with the provided note arguments.

source

pub fn add_expected_output_note<T: Deref<Target = NoteDetails>>( &mut self, note: &T )

Populates the advice inputs with the specified note details.

The map is extended with the following keys:

  • recipient |-> recipient details (inputs_hash, script_hash, serial_num).
  • inputs_key |-> inputs, where inputs_key is computed by taking note inputs commitment and adding ONE to its most significant element.
  • script_hash |-> script.
source

pub fn extend_expected_output_notes<T, L>(&mut self, notes: L)
where L: IntoIterator<Item = T>, T: Deref<Target = NoteDetails>,

Populates the advice inputs with the specified note details.

The map is extended with the following keys:

  • recipient |-> recipient details (inputs_hash, script_hash, serial_num)
  • inputs_key |-> inputs, where inputs_key is computed by taking note inputs commitment and adding ONE to its most significant element.
  • script_hash |-> script
source

pub fn tx_script(&self) -> Option<&TransactionScript>

Returns a reference to the transaction script.

source

pub fn get_note_args(&self, note_id: NoteId) -> Option<&Word>

Returns a reference to a specific note argument.

source

pub fn advice_map(&self) -> &AdviceMap

Returns a reference to the args AdviceMap.

Trait Implementations§

source§

impl Clone for TransactionArgs

source§

fn clone(&self) -> TransactionArgs

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TransactionArgs

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for TransactionArgs

source§

fn default() -> TransactionArgs

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more