aztec-nr - noir_aztec::messages::message_delivery

Function do_private_message_delivery

pub fn do_private_message_delivery<Env, let MESSAGE_PLAINTEXT_LEN: u32>(
    context: &mut PrivateContext,
    encode_into_message_plaintext: fn[Env]() -> [Field; MESSAGE_PLAINTEXT_LEN],
    maybe_note_hash_counter: Option<u32>,
    recipient: AztecAddress,
    delivery_mode: u8,
)

Performs private delivery of a message to recipient according to delivery_mode.

The message is encoded into plaintext and then encrypted for recipient. This function takes a function that returns the plaintext instead of taking the plaintext directly in order to not waste constraints encoding the message in scenarios where the plaintext will be encrypted with unconstrained encryption.

maybe_note_hash_counter is only relevant for on-chain delivery modes (i.e. via protocol logs): if a newly created note hash's side effect counter is passed, then the log will be squashed alongside the note should its nullifier be emitted in the current transaction. This is typically only used for note messages: since the note will not actually be created, there is no point in delivering the message.

delivery_mode must be one of MessageDeliveryEnum.