create_mint_note

Function create_mint_note 

Source
pub fn create_mint_note<R: FeltRng>(
    faucet_id: AccountId,
    sender: AccountId,
    target_recipient: Word,
    output_note_tag: Felt,
    amount: Felt,
    aux: Felt,
    output_note_aux: Felt,
    rng: &mut R,
) -> Result<Note, NoteError>
Expand description

Generates a MINT note - a note that instructs a network faucet to mint fungible assets.

This script enables the creation of a PUBLIC note that, when consumed by a network faucet, will mint the specified amount of fungible assets and create a PRIVATE note with the given RECIPIENT. The MINT note uses note-based authentication, checking if the note sender equals the faucet owner to authorize minting.

MINT notes are always PUBLIC (for network execution) and output notes are always PRIVATE (TODO: enable public output note creation from MINT note consumption).

The passed-in rng is used to generate a serial number for the note. The note’s tag is automatically set to the faucet’s account ID for proper routing.

§Parameters

  • faucet_id: The account ID of the network faucet that will mint the assets
  • sender: The account ID of the note creator (must be the faucet owner)
  • target_recipient: The recipient digest for the output P2ID note that will receive the minted assets
  • output_note_tag: The tag for the output P2ID note
  • amount: The amount of fungible assets to mint
  • aux: Auxiliary data for the MINT note
  • output_note_aux: Auxiliary data for the output P2ID note
  • rng: Random number generator for creating the serial number

§Errors

Returns an error if note creation fails.