miden_standards/note/standard_note_attachment.rs
1use miden_protocol::note::NoteAttachmentScheme;
2
3/// The [`NoteAttachmentScheme`]s of standard note attachments.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5#[non_exhaustive]
6pub enum StandardNoteAttachment {
7 /// See [`NetworkAccountTarget`](crate::note::NetworkAccountTarget) for details.
8 NetworkAccountTarget,
9 /// The attachment scheme used by both PSWAP output notes (payback P2ID + remainder PSWAP).
10 /// Carries the word `[amount, order_id, depth, 0]`. See
11 /// [`PswapNote`](crate::note::PswapNote) for details.
12 PswapAttachment,
13 /// The USDCx mint attachment carrying the attestation and deposit intent.
14 UsdcxMint,
15 /// The USDCx burn attachment carrying the withdrawal destination.
16 UsdcxBurn,
17 /// See [`AccountCodeUpgradeAttachment`](crate::note::AccountCodeUpgradeAttachment) for
18 /// details.
19 AccountCodeUpgrade,
20}
21
22impl StandardNoteAttachment {
23 /// Returns the [`NoteAttachmentScheme`] of the standard attachment.
24 pub const fn attachment_scheme(&self) -> NoteAttachmentScheme {
25 match self {
26 StandardNoteAttachment::NetworkAccountTarget => NoteAttachmentScheme::new_const(2u16),
27 StandardNoteAttachment::PswapAttachment => NoteAttachmentScheme::new_const(3u16),
28 StandardNoteAttachment::UsdcxMint => NoteAttachmentScheme::new_const(4u16),
29 StandardNoteAttachment::UsdcxBurn => NoteAttachmentScheme::new_const(5u16),
30 StandardNoteAttachment::AccountCodeUpgrade => NoteAttachmentScheme::new_const(7u16),
31 }
32 }
33}