mpl_candy_machine_core/instructions/
mint.rs1use anchor_lang::prelude::*;
2use solana_program::sysvar;
3
4use super::mint_v2::{process_mint, MintAccounts};
5use crate::{constants::AUTHORITY_SEED, utils::*, AccountVersion, CandyError, CandyMachine};
6
7pub fn mint<'info>(ctx: Context<'_, '_, '_, 'info, Mint<'info>>) -> Result<()> {
8 msg!("(Deprecated as of 1.0.0) Use MintV2 instead");
9
10 if !matches!(ctx.accounts.candy_machine.version, AccountVersion::V1) {
11 return err!(CandyError::InvalidAccountVersion);
12 }
13
14 let accounts = MintAccounts {
15 spl_ata_program: None,
16 authority_pda: ctx.accounts.authority_pda.to_account_info(),
17 collection_delegate_record: ctx.accounts.collection_authority_record.to_account_info(),
18 collection_master_edition: ctx.accounts.collection_master_edition.to_account_info(),
19 collection_metadata: ctx.accounts.collection_metadata.to_account_info(),
20 collection_mint: ctx.accounts.collection_mint.to_account_info(),
21 collection_update_authority: ctx.accounts.collection_update_authority.to_account_info(),
22 nft_owner: ctx.accounts.nft_mint_authority.to_account_info(),
23 nft_master_edition: ctx.accounts.nft_master_edition.to_account_info(),
24 nft_metadata: ctx.accounts.nft_metadata.to_account_info(),
25 nft_mint: ctx.accounts.nft_mint.to_account_info(),
26 nft_mint_authority: ctx.accounts.nft_mint_authority.to_account_info(),
27 payer: ctx.accounts.payer.to_account_info(),
28 recent_slothashes: ctx.accounts.recent_slothashes.to_account_info(),
29 system_program: ctx.accounts.system_program.to_account_info(),
30 sysvar_instructions: None,
31 token: None,
32 token_metadata_program: ctx.accounts.token_metadata_program.to_account_info(),
33 spl_token_program: ctx.accounts.token_program.to_account_info(),
34 token_record: None,
35 };
36
37 process_mint(
38 &mut ctx.accounts.candy_machine,
39 accounts,
40 ctx.bumps["authority_pda"],
41 )
42}
43
44#[derive(Accounts)]
46pub struct Mint<'info> {
47 #[account(mut, has_one = mint_authority)]
49 candy_machine: Box<Account<'info, CandyMachine>>,
50
51 #[account(mut, seeds = [AUTHORITY_SEED.as_bytes(), candy_machine.key().as_ref()], bump)]
56 authority_pda: UncheckedAccount<'info>,
57
58 mint_authority: Signer<'info>,
60
61 #[account(mut)]
63 payer: Signer<'info>,
64
65 #[account(mut)]
69 nft_mint: UncheckedAccount<'info>,
70
71 nft_mint_authority: Signer<'info>,
73
74 #[account(mut)]
78 nft_metadata: UncheckedAccount<'info>,
79
80 #[account(mut)]
84 nft_master_edition: UncheckedAccount<'info>,
85
86 collection_authority_record: UncheckedAccount<'info>,
92
93 collection_mint: UncheckedAccount<'info>,
97
98 #[account(mut)]
102 collection_metadata: UncheckedAccount<'info>,
103
104 collection_master_edition: UncheckedAccount<'info>,
108
109 collection_update_authority: UncheckedAccount<'info>,
113
114 #[account(address = mpl_token_metadata::id())]
118 token_metadata_program: UncheckedAccount<'info>,
119
120 token_program: Program<'info, Token>,
122
123 system_program: Program<'info, System>,
125
126 #[account(address = sysvar::slot_hashes::id())]
130 recent_slothashes: UncheckedAccount<'info>,
131}