light_token_interface/instructions/mint_action/
mint_to_compressed.rs

1use light_compressed_account::{pubkey::AsPubkey, Pubkey};
2use light_zero_copy::ZeroCopy;
3
4use crate::{AnchorDeserialize, AnchorSerialize};
5
6#[repr(C)]
7#[derive(Debug, Clone, AnchorSerialize, AnchorDeserialize, ZeroCopy)]
8pub struct Recipient {
9    pub recipient: Pubkey,
10    pub amount: u64,
11}
12
13impl Recipient {
14    pub fn new(recipient: impl AsPubkey, amount: u64) -> Self {
15        Self {
16            recipient: recipient.to_light_pubkey(),
17            amount,
18        }
19    }
20}
21
22#[repr(C)]
23#[derive(Debug, Clone, AnchorSerialize, AnchorDeserialize, ZeroCopy)]
24pub struct MintToCompressedAction {
25    pub token_account_version: u8,
26    pub recipients: Vec<Recipient>,
27}
28
29impl MintToCompressedAction {
30    pub fn new(recipients: Vec<Recipient>) -> Self {
31        Self {
32            token_account_version: 3,
33            recipients,
34        }
35    }
36}