pub trait ActiveNote {
// Provided methods
fn get_initial_assets(&self) -> Vec<Asset> { ... }
fn get_sender(&self) -> AccountId { ... }
fn get_recipient(&self) -> Recipient { ... }
fn get_script_root(&self) -> Word { ... }
fn get_serial_number(&self) -> Word { ... }
fn get_metadata(&self) -> NoteMetadata { ... }
fn is_public(&self) -> bool { ... }
fn is_private(&self) -> bool { ... }
fn get_attachments_commitment(&self) -> Word { ... }
fn write_attachment_commitments_to_memory(&self) -> Vec<Word> { ... }
fn write_attachment_to_memory(&self, attachment_idx: u32) -> Vec<Word> { ... }
fn find_attachment(&self, attachment_scheme: Felt) -> Option<u32> { ... }
}Expand description
Trait that provides active-note operations for note scripts.
This trait is automatically implemented for the note input struct marked with the #[note]
macro, so a #[note_script] entrypoint can call the operations directly on self, e.g.
self.get_sender().
The operations read the note that is currently executing. Call them only during note-script
execution: a note value constructed outside of it (for example in a #[note_constructor])
has no active note, and the transaction kernel rejects the calls at run time.
get_storage is intentionally not part of this trait: the #[note] macro decodes the note
storage into the struct fields, so the values are available directly on self.
An inherent method of the note struct with the same name shadows the trait method; the trait
method stays reachable with UFCS, e.g. <MyNote as ActiveNote>::get_sender(¬e).
Provided Methods§
Sourcefn get_initial_assets(&self) -> Vec<Asset>
fn get_initial_assets(&self) -> Vec<Asset>
Get the initial assets of the currently executing note.
These are the note’s assets at creation time, unaffected by in-transaction removal.
Sourcefn get_sender(&self) -> AccountId
fn get_sender(&self) -> AccountId
Returns the sender AccountId of the note that is currently executing.
Sourcefn get_recipient(&self) -> Recipient
fn get_recipient(&self) -> Recipient
Returns the recipient of the note that is currently executing.
Sourcefn get_script_root(&self) -> Word
fn get_script_root(&self) -> Word
Returns the script root of the currently executing note.
Sourcefn get_serial_number(&self) -> Word
fn get_serial_number(&self) -> Word
Returns the serial number of the currently executing note.
Sourcefn get_metadata(&self) -> NoteMetadata
fn get_metadata(&self) -> NoteMetadata
Returns the metadata header of the note that is currently executing.
Sourcefn is_private(&self) -> bool
fn is_private(&self) -> bool
Returns whether the note currently executing is private.
Sourcefn get_attachments_commitment(&self) -> Word
fn get_attachments_commitment(&self) -> Word
Returns the commitment over all attachments of the note currently executing.
Sourcefn write_attachment_commitments_to_memory(&self) -> Vec<Word>
fn write_attachment_commitments_to_memory(&self) -> Vec<Word>
Writes attachment commitments to memory and returns them as protocol words.
Sourcefn write_attachment_to_memory(&self, attachment_idx: u32) -> Vec<Word>
fn write_attachment_to_memory(&self, attachment_idx: u32) -> Vec<Word>
Writes the selected attachment to memory and returns it as protocol words.
Sourcefn find_attachment(&self, attachment_scheme: Felt) -> Option<u32>
fn find_attachment(&self, attachment_scheme: Felt) -> Option<u32>
Searches the active note metadata for attachment_scheme.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".