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
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<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 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 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
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more