pub struct TransactionArgs { /* private fields */ }Expand description
Optional transaction arguments.
- Transaction script: a program that is executed in a transaction after all input notes scripts have been executed.
- Transaction script arguments: a
Word, which will be pushed to the operand stack before the transaction script execution. If these arguments are not specified, theEMPTY_WORDwould be used as a default value. If the AdviceInputs are propagated with some user defined map entries, this script arguments word could be used as a key to access the corresponding value. - 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 inputs: provides data needed by the runtime, like the details of public output notes.
- Foreign account inputs: provides foreign account data that will be used during the foreign procedure invocation (FPI).
- Auth arguments: data put onto the stack right before authentication procedure execution. If
this argument is not specified, the
EMPTY_WORDwould be used as a default value. If the AdviceInputs are propagated with some user defined map entries, this argument could be used as a key to access the corresponding value.
Implementations§
Source§impl TransactionArgs
impl TransactionArgs
Sourcepub fn new(advice_map: AdviceMap) -> Self
pub fn new(advice_map: AdviceMap) -> Self
Returns new TransactionArgs instantiated with the provided transaction script, advice map and foreign account inputs.
Sourcepub fn with_tx_script(self, tx_script: TransactionScript) -> Self
pub fn with_tx_script(self, tx_script: TransactionScript) -> Self
Returns new TransactionArgs instantiated with the provided transaction script.
If the transaction script is already set, it will be overwritten with the newly provided one.
Sourcepub fn with_tx_script_and_args(
self,
tx_script: TransactionScript,
tx_script_args: Word,
) -> Self
pub fn with_tx_script_and_args( self, tx_script: TransactionScript, tx_script_args: Word, ) -> Self
Returns new TransactionArgs instantiated with the provided transaction script and its arguments.
If the transaction script and arguments are already set, they will be overwritten with the newly provided ones.
Sourcepub fn with_note_args(self, note_args: BTreeMap<NoteId, Word>) -> Self
pub fn with_note_args(self, note_args: BTreeMap<NoteId, Word>) -> Self
Returns new TransactionArgs instantiated with the provided note arguments.
If the note arguments were already set, they will be overwritten with the newly provided ones.
Sourcepub fn with_auth_args(self, auth_args: Word) -> Self
pub fn with_auth_args(self, auth_args: Word) -> Self
Returns new TransactionArgs instantiated with the provided auth arguments.
Sourcepub fn tx_script(&self) -> Option<&TransactionScript>
pub fn tx_script(&self) -> Option<&TransactionScript>
Returns a reference to the transaction script.
Sourcepub fn tx_script_args(&self) -> Word
pub fn tx_script_args(&self) -> Word
Returns the transaction script arguments, or EMPTY_WORD if the arguments were not
specified.
These arguments could be potentially used as a key to access the advice map during the
transaction script execution. Notice that the corresponding map entry should be provided
separately during the creation with the TransactionArgs::new or using the
TransactionArgs::extend_advice_map method.
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_inputs(&self) -> &AdviceInputs
pub fn advice_inputs(&self) -> &AdviceInputs
Returns a reference to the internal AdviceInputs.
Sourcepub fn auth_args(&self) -> Word
pub fn auth_args(&self) -> Word
Returns a reference to the authentication procedure argument, or EMPTY_WORD if the
argument was not specified.
This argument could be potentially used as a key to access the advice map during the
transaction script execution. Notice that the corresponding map entry should be provided
separately during the creation with the TransactionArgs::new or using the
TransactionArgs::extend_advice_map method.
Sourcepub fn add_output_note_recipient<T: AsRef<NoteRecipient>>(
&mut self,
note_recipient: T,
)
pub fn add_output_note_recipient<T: AsRef<NoteRecipient>>( &mut self, note_recipient: T, )
Populates the advice inputs with the expected recipient data for creating output notes.
The advice inputs’ map is extended with the following entries:
- RECIPIENT: [SERIAL_SCRIPT_HASH, INPUTS_COMMITMENT]
- SERIAL_SCRIPT_HASH: [SERIAL_HASH, SCRIPT_ROOT]
- SERIAL_HASH: [SERIAL_NUM, EMPTY_WORD]
- inputs_commitment |-> inputs.
- script_root |-> script.
Sourcepub fn add_signature(
&mut self,
pub_key: PublicKeyCommitment,
message: Word,
signature: Signature,
)
pub fn add_signature( &mut self, pub_key: PublicKeyCommitment, message: Word, signature: Signature, )
Adds the signature corresponding to pub_key on message to the advice inputs’ map.
The advice inputs’ map is extended with the following key:
- hash(pub_key, message) |-> signature (prepared for VM execution).
Sourcepub fn extend_output_note_recipients<T, L>(&mut self, notes: L)
pub fn extend_output_note_recipients<T, L>(&mut self, notes: L)
Populates the advice inputs with the specified note recipient details.
The advice inputs’ map is extended with the following keys:
- recipient |-> recipient details (inputs_hash, script_root, serial_num).
- inputs_commitment |-> inputs.
- script_root |-> script.
Sourcepub fn extend_advice_map<T: IntoIterator<Item = (Word, Vec<Felt>)>>(
&mut self,
iter: T,
)
pub fn extend_advice_map<T: IntoIterator<Item = (Word, Vec<Felt>)>>( &mut self, iter: T, )
Extends the internal advice inputs’ map with the provided key-value pairs.
Sourcepub fn extend_merkle_store<I: Iterator<Item = InnerNodeInfo>>(
&mut self,
iter: I,
)
pub fn extend_merkle_store<I: Iterator<Item = InnerNodeInfo>>( &mut self, iter: I, )
Extends the internal advice inputs’ merkle store with the provided nodes.
Sourcepub fn extend_advice_inputs(&mut self, advice_inputs: AdviceInputs)
pub fn extend_advice_inputs(&mut self, advice_inputs: AdviceInputs)
Extends the advice inputs in self with the provided ones.
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§impl Deserializable for TransactionArgs
impl Deserializable for TransactionArgs
Source§fn read_from<R: ByteReader>(
source: &mut R,
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R, ) -> Result<Self, DeserializationError>
source, attempts to deserialize these bytes
into Self, and returns the result. Read moreSource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
Source§impl PartialEq for TransactionArgs
impl PartialEq for TransactionArgs
Source§impl Serializable for TransactionArgs
impl Serializable for TransactionArgs
Source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
self into bytes and writes these bytes into the target.Source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
impl Eq for TransactionArgs
impl StructuralPartialEq for 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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more