pub fn create(tag: Tag, note_type: NoteType, recipient: Recipient) -> NoteIdxExpand description
Creates a new output note and returns its index.
§Examples
Create a note and add a single asset to it:
ⓘ
// before using `Vec`/`vec!`.
extern crate alloc;
use miden::{felt, note, output_note, Asset, NoteType, Tag, Word};
// Values used to derive the note recipient.
let serial_num = Word::from_u64_unchecked(1, 2, 3, 4);
let note_script_root = Word::from_u64_unchecked(0, 0, 0, 0);
let storage = alloc::vec![felt!(0); 2];
let recipient = note::build_recipient(serial_num, note_script_root, storage);
let tag = Tag::from(felt!(0));
let note_type = NoteType::from(felt!(1)); // public note type (0b01)
let note_idx = output_note::create(tag, note_type, recipient);
output_note::add_asset(
Asset::new(
[felt!(0), felt!(0), felt!(0), felt!(1)],
[felt!(1), felt!(0), felt!(0), felt!(0)],
),
note_idx,
);