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 output note.
Implementations§
source§impl TransactionArgs
impl TransactionArgs
sourcepub fn new(
tx_script: Option<TransactionScript>,
note_args: Option<BTreeMap<NoteId, Word>>,
advice_map: AdviceMap,
) -> Self
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.
sourcepub fn with_tx_script(tx_script: TransactionScript) -> Self
pub fn with_tx_script(tx_script: TransactionScript) -> Self
Returns new TransactionArgs instantiated with the provided transaction script.
sourcepub fn with_note_args(note_args: BTreeMap<NoteId, Word>) -> Self
pub fn with_note_args(note_args: BTreeMap<NoteId, Word>) -> Self
Returns new TransactionArgs instantiated with the provided note arguments.
sourcepub fn tx_script(&self) -> Option<&TransactionScript>
pub fn tx_script(&self) -> Option<&TransactionScript>
Returns a reference to the transaction script.
sourcepub fn get_note_args(&self, note_id: NoteId) -> Option<&Word>
pub fn get_note_args(&self, note_id: NoteId) -> Option<&Word>
Returns a reference to a specific note argument.
sourcepub fn advice_map(&self) -> &AdviceMap
pub fn advice_map(&self) -> &AdviceMap
Returns a reference to the args AdviceMap.
sourcepub fn add_expected_output_note<T: Deref<Target = NoteDetails>>(
&mut self,
note: &T,
)
pub fn add_expected_output_note<T: Deref<Target = NoteDetails>>( &mut self, note: &T, )
Populates the advice inputs with the specified note details.
The advice 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.
sourcepub fn extend_expected_output_notes<T, L>(&mut self, notes: L)
pub fn extend_expected_output_notes<T, L>(&mut self, notes: L)
Populates the advice inputs with the specified note details.
The advice 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
sourcepub fn extend_advice_map<T: IntoIterator<Item = (Digest, Vec<Felt>)>>(
&mut self,
iter: T,
)
pub fn extend_advice_map<T: IntoIterator<Item = (Digest, Vec<Felt>)>>( &mut self, iter: T, )
Extends the internal advice map with the provided key-value pairs.
Trait Implementations§
source§impl Clone for TransactionArgs
impl Clone for TransactionArgs
source§fn clone(&self) -> TransactionArgs
fn clone(&self) -> TransactionArgs
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for TransactionArgs
impl Debug for TransactionArgs
source§impl Default for TransactionArgs
impl Default for TransactionArgs
source§fn default() -> TransactionArgs
fn default() -> TransactionArgs
Auto Trait Implementations§
impl Freeze for TransactionArgs
impl RefUnwindSafe for TransactionArgs
impl Send for TransactionArgs
impl Sync for TransactionArgs
impl Unpin for TransactionArgs
impl UnwindSafe for TransactionArgs
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)