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 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
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 add_expected_output_note(&mut self, note: &Note)
pub fn add_expected_output_note(&mut self, note: &Note)
Populates the advice inputs with the details of Notes.
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.
sourcepub fn extend_expected_output_notes<T>(&mut self, notes: T)where
T: IntoIterator<Item = Note>,
pub fn extend_expected_output_notes<T>(&mut self, notes: T)where
T: IntoIterator<Item = Note>,
Populates the advice inputs with the details of Notes.
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
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.
Trait Implementations§
source§impl Clone for TransactionArgs
impl Clone for TransactionArgs
source§fn clone(&self) -> TransactionArgs
fn clone(&self) -> TransactionArgs
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Returns the “default value” for a type. Read more
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
Mutably borrows from an owned value. Read more