tensor_amm/generated/instructions/
deposit_nft_t22.rs

1//! This code was AUTOGENERATED using the codama library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun codama to update it.
4//!
5//! <https://github.com/codama-idl/codama>
6//!
7
8use borsh::BorshDeserialize;
9use borsh::BorshSerialize;
10
11/// Accounts.
12pub struct DepositNftT22 {
13    /// The owner of the pool and the NFT.
14    pub owner: solana_program::pubkey::Pubkey,
15    /// The pool the NFT is being transferred to/from.
16    pub pool: solana_program::pubkey::Pubkey,
17    /// The whitelist that gatekeeps which NFTs can be deposited into the pool.
18    /// Must match the whitelist stored in the pool state.
19    pub whitelist: solana_program::pubkey::Pubkey,
20    /// Optional account which must be passed in if the NFT must be verified against a
21    /// merkle proof condition in the whitelist.
22    pub mint_proof: Option<solana_program::pubkey::Pubkey>,
23    /// The mint account of the NFT.
24    pub mint: solana_program::pubkey::Pubkey,
25    /// The NFT deposit receipt, which ties an NFT to the pool it was deposited to.
26    pub nft_receipt: solana_program::pubkey::Pubkey,
27    /// The TA of the owner, where the NFT will be transferred from.
28    pub owner_ta: solana_program::pubkey::Pubkey,
29    /// The TA of the pool, where the NFT will be escrowed.
30    pub pool_ta: solana_program::pubkey::Pubkey,
31    /// The SPL Token program for the Mint and ATAs.
32    pub token_program: solana_program::pubkey::Pubkey,
33    /// The SPL associated token program.
34    pub associated_token_program: solana_program::pubkey::Pubkey,
35    /// The Solana system program.
36    pub system_program: solana_program::pubkey::Pubkey,
37}
38
39impl DepositNftT22 {
40    pub fn instruction(&self) -> solana_program::instruction::Instruction {
41        self.instruction_with_remaining_accounts(&[])
42    }
43    #[allow(clippy::vec_init_then_push)]
44    pub fn instruction_with_remaining_accounts(
45        &self,
46        remaining_accounts: &[solana_program::instruction::AccountMeta],
47    ) -> solana_program::instruction::Instruction {
48        let mut accounts = Vec::with_capacity(11 + remaining_accounts.len());
49        accounts.push(solana_program::instruction::AccountMeta::new(
50            self.owner, true,
51        ));
52        accounts.push(solana_program::instruction::AccountMeta::new(
53            self.pool, false,
54        ));
55        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
56            self.whitelist,
57            false,
58        ));
59        if let Some(mint_proof) = self.mint_proof {
60            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
61                mint_proof, false,
62            ));
63        } else {
64            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
65                crate::TENSOR_AMM_ID,
66                false,
67            ));
68        }
69        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
70            self.mint, false,
71        ));
72        accounts.push(solana_program::instruction::AccountMeta::new(
73            self.nft_receipt,
74            false,
75        ));
76        accounts.push(solana_program::instruction::AccountMeta::new(
77            self.owner_ta,
78            false,
79        ));
80        accounts.push(solana_program::instruction::AccountMeta::new(
81            self.pool_ta,
82            false,
83        ));
84        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
85            self.token_program,
86            false,
87        ));
88        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
89            self.associated_token_program,
90            false,
91        ));
92        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
93            self.system_program,
94            false,
95        ));
96        accounts.extend_from_slice(remaining_accounts);
97        let data = DepositNftT22InstructionData::new().try_to_vec().unwrap();
98
99        solana_program::instruction::Instruction {
100            program_id: crate::TENSOR_AMM_ID,
101            accounts,
102            data,
103        }
104    }
105}
106
107#[derive(BorshDeserialize, BorshSerialize)]
108pub struct DepositNftT22InstructionData {
109    discriminator: [u8; 8],
110}
111
112impl DepositNftT22InstructionData {
113    pub fn new() -> Self {
114        Self {
115            discriminator: [208, 34, 6, 147, 95, 218, 49, 160],
116        }
117    }
118}
119
120impl Default for DepositNftT22InstructionData {
121    fn default() -> Self {
122        Self::new()
123    }
124}
125
126/// Instruction builder for `DepositNftT22`.
127///
128/// ### Accounts:
129///
130///   0. `[writable, signer]` owner
131///   1. `[writable]` pool
132///   2. `[]` whitelist
133///   3. `[optional]` mint_proof
134///   4. `[]` mint
135///   5. `[writable]` nft_receipt
136///   6. `[writable]` owner_ta
137///   7. `[writable]` pool_ta
138///   8. `[optional]` token_program (default to `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`)
139///   9. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
140///   10. `[optional]` system_program (default to `11111111111111111111111111111111`)
141#[derive(Clone, Debug, Default)]
142pub struct DepositNftT22Builder {
143    owner: Option<solana_program::pubkey::Pubkey>,
144    pool: Option<solana_program::pubkey::Pubkey>,
145    whitelist: Option<solana_program::pubkey::Pubkey>,
146    mint_proof: Option<solana_program::pubkey::Pubkey>,
147    mint: Option<solana_program::pubkey::Pubkey>,
148    nft_receipt: Option<solana_program::pubkey::Pubkey>,
149    owner_ta: Option<solana_program::pubkey::Pubkey>,
150    pool_ta: Option<solana_program::pubkey::Pubkey>,
151    token_program: Option<solana_program::pubkey::Pubkey>,
152    associated_token_program: Option<solana_program::pubkey::Pubkey>,
153    system_program: Option<solana_program::pubkey::Pubkey>,
154    __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
155}
156
157impl DepositNftT22Builder {
158    pub fn new() -> Self {
159        Self::default()
160    }
161    /// The owner of the pool and the NFT.
162    #[inline(always)]
163    pub fn owner(&mut self, owner: solana_program::pubkey::Pubkey) -> &mut Self {
164        self.owner = Some(owner);
165        self
166    }
167    /// The pool the NFT is being transferred to/from.
168    #[inline(always)]
169    pub fn pool(&mut self, pool: solana_program::pubkey::Pubkey) -> &mut Self {
170        self.pool = Some(pool);
171        self
172    }
173    /// The whitelist that gatekeeps which NFTs can be deposited into the pool.
174    /// Must match the whitelist stored in the pool state.
175    #[inline(always)]
176    pub fn whitelist(&mut self, whitelist: solana_program::pubkey::Pubkey) -> &mut Self {
177        self.whitelist = Some(whitelist);
178        self
179    }
180    /// `[optional account]`
181    /// Optional account which must be passed in if the NFT must be verified against a
182    /// merkle proof condition in the whitelist.
183    #[inline(always)]
184    pub fn mint_proof(&mut self, mint_proof: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
185        self.mint_proof = mint_proof;
186        self
187    }
188    /// The mint account of the NFT.
189    #[inline(always)]
190    pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self {
191        self.mint = Some(mint);
192        self
193    }
194    /// The NFT deposit receipt, which ties an NFT to the pool it was deposited to.
195    #[inline(always)]
196    pub fn nft_receipt(&mut self, nft_receipt: solana_program::pubkey::Pubkey) -> &mut Self {
197        self.nft_receipt = Some(nft_receipt);
198        self
199    }
200    /// The TA of the owner, where the NFT will be transferred from.
201    #[inline(always)]
202    pub fn owner_ta(&mut self, owner_ta: solana_program::pubkey::Pubkey) -> &mut Self {
203        self.owner_ta = Some(owner_ta);
204        self
205    }
206    /// The TA of the pool, where the NFT will be escrowed.
207    #[inline(always)]
208    pub fn pool_ta(&mut self, pool_ta: solana_program::pubkey::Pubkey) -> &mut Self {
209        self.pool_ta = Some(pool_ta);
210        self
211    }
212    /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']`
213    /// The SPL Token program for the Mint and ATAs.
214    #[inline(always)]
215    pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self {
216        self.token_program = Some(token_program);
217        self
218    }
219    /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']`
220    /// The SPL associated token program.
221    #[inline(always)]
222    pub fn associated_token_program(
223        &mut self,
224        associated_token_program: solana_program::pubkey::Pubkey,
225    ) -> &mut Self {
226        self.associated_token_program = Some(associated_token_program);
227        self
228    }
229    /// `[optional account, default to '11111111111111111111111111111111']`
230    /// The Solana system program.
231    #[inline(always)]
232    pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
233        self.system_program = Some(system_program);
234        self
235    }
236    /// Add an additional account to the instruction.
237    #[inline(always)]
238    pub fn add_remaining_account(
239        &mut self,
240        account: solana_program::instruction::AccountMeta,
241    ) -> &mut Self {
242        self.__remaining_accounts.push(account);
243        self
244    }
245    /// Add additional accounts to the instruction.
246    #[inline(always)]
247    pub fn add_remaining_accounts(
248        &mut self,
249        accounts: &[solana_program::instruction::AccountMeta],
250    ) -> &mut Self {
251        self.__remaining_accounts.extend_from_slice(accounts);
252        self
253    }
254    #[allow(clippy::clone_on_copy)]
255    pub fn instruction(&self) -> solana_program::instruction::Instruction {
256        let accounts = DepositNftT22 {
257            owner: self.owner.expect("owner is not set"),
258            pool: self.pool.expect("pool is not set"),
259            whitelist: self.whitelist.expect("whitelist is not set"),
260            mint_proof: self.mint_proof,
261            mint: self.mint.expect("mint is not set"),
262            nft_receipt: self.nft_receipt.expect("nft_receipt is not set"),
263            owner_ta: self.owner_ta.expect("owner_ta is not set"),
264            pool_ta: self.pool_ta.expect("pool_ta is not set"),
265            token_program: self.token_program.unwrap_or(solana_program::pubkey!(
266                "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
267            )),
268            associated_token_program: self.associated_token_program.unwrap_or(
269                solana_program::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),
270            ),
271            system_program: self
272                .system_program
273                .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
274        };
275
276        accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
277    }
278}
279
280/// `deposit_nft_t22` CPI accounts.
281pub struct DepositNftT22CpiAccounts<'a, 'b> {
282    /// The owner of the pool and the NFT.
283    pub owner: &'b solana_program::account_info::AccountInfo<'a>,
284    /// The pool the NFT is being transferred to/from.
285    pub pool: &'b solana_program::account_info::AccountInfo<'a>,
286    /// The whitelist that gatekeeps which NFTs can be deposited into the pool.
287    /// Must match the whitelist stored in the pool state.
288    pub whitelist: &'b solana_program::account_info::AccountInfo<'a>,
289    /// Optional account which must be passed in if the NFT must be verified against a
290    /// merkle proof condition in the whitelist.
291    pub mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
292    /// The mint account of the NFT.
293    pub mint: &'b solana_program::account_info::AccountInfo<'a>,
294    /// The NFT deposit receipt, which ties an NFT to the pool it was deposited to.
295    pub nft_receipt: &'b solana_program::account_info::AccountInfo<'a>,
296    /// The TA of the owner, where the NFT will be transferred from.
297    pub owner_ta: &'b solana_program::account_info::AccountInfo<'a>,
298    /// The TA of the pool, where the NFT will be escrowed.
299    pub pool_ta: &'b solana_program::account_info::AccountInfo<'a>,
300    /// The SPL Token program for the Mint and ATAs.
301    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
302    /// The SPL associated token program.
303    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
304    /// The Solana system program.
305    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
306}
307
308/// `deposit_nft_t22` CPI instruction.
309pub struct DepositNftT22Cpi<'a, 'b> {
310    /// The program to invoke.
311    pub __program: &'b solana_program::account_info::AccountInfo<'a>,
312    /// The owner of the pool and the NFT.
313    pub owner: &'b solana_program::account_info::AccountInfo<'a>,
314    /// The pool the NFT is being transferred to/from.
315    pub pool: &'b solana_program::account_info::AccountInfo<'a>,
316    /// The whitelist that gatekeeps which NFTs can be deposited into the pool.
317    /// Must match the whitelist stored in the pool state.
318    pub whitelist: &'b solana_program::account_info::AccountInfo<'a>,
319    /// Optional account which must be passed in if the NFT must be verified against a
320    /// merkle proof condition in the whitelist.
321    pub mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
322    /// The mint account of the NFT.
323    pub mint: &'b solana_program::account_info::AccountInfo<'a>,
324    /// The NFT deposit receipt, which ties an NFT to the pool it was deposited to.
325    pub nft_receipt: &'b solana_program::account_info::AccountInfo<'a>,
326    /// The TA of the owner, where the NFT will be transferred from.
327    pub owner_ta: &'b solana_program::account_info::AccountInfo<'a>,
328    /// The TA of the pool, where the NFT will be escrowed.
329    pub pool_ta: &'b solana_program::account_info::AccountInfo<'a>,
330    /// The SPL Token program for the Mint and ATAs.
331    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
332    /// The SPL associated token program.
333    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
334    /// The Solana system program.
335    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
336}
337
338impl<'a, 'b> DepositNftT22Cpi<'a, 'b> {
339    pub fn new(
340        program: &'b solana_program::account_info::AccountInfo<'a>,
341        accounts: DepositNftT22CpiAccounts<'a, 'b>,
342    ) -> Self {
343        Self {
344            __program: program,
345            owner: accounts.owner,
346            pool: accounts.pool,
347            whitelist: accounts.whitelist,
348            mint_proof: accounts.mint_proof,
349            mint: accounts.mint,
350            nft_receipt: accounts.nft_receipt,
351            owner_ta: accounts.owner_ta,
352            pool_ta: accounts.pool_ta,
353            token_program: accounts.token_program,
354            associated_token_program: accounts.associated_token_program,
355            system_program: accounts.system_program,
356        }
357    }
358    #[inline(always)]
359    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
360        self.invoke_signed_with_remaining_accounts(&[], &[])
361    }
362    #[inline(always)]
363    pub fn invoke_with_remaining_accounts(
364        &self,
365        remaining_accounts: &[(
366            &'b solana_program::account_info::AccountInfo<'a>,
367            bool,
368            bool,
369        )],
370    ) -> solana_program::entrypoint::ProgramResult {
371        self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
372    }
373    #[inline(always)]
374    pub fn invoke_signed(
375        &self,
376        signers_seeds: &[&[&[u8]]],
377    ) -> solana_program::entrypoint::ProgramResult {
378        self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
379    }
380    #[allow(clippy::clone_on_copy)]
381    #[allow(clippy::vec_init_then_push)]
382    pub fn invoke_signed_with_remaining_accounts(
383        &self,
384        signers_seeds: &[&[&[u8]]],
385        remaining_accounts: &[(
386            &'b solana_program::account_info::AccountInfo<'a>,
387            bool,
388            bool,
389        )],
390    ) -> solana_program::entrypoint::ProgramResult {
391        let mut accounts = Vec::with_capacity(11 + remaining_accounts.len());
392        accounts.push(solana_program::instruction::AccountMeta::new(
393            *self.owner.key,
394            true,
395        ));
396        accounts.push(solana_program::instruction::AccountMeta::new(
397            *self.pool.key,
398            false,
399        ));
400        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
401            *self.whitelist.key,
402            false,
403        ));
404        if let Some(mint_proof) = self.mint_proof {
405            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
406                *mint_proof.key,
407                false,
408            ));
409        } else {
410            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
411                crate::TENSOR_AMM_ID,
412                false,
413            ));
414        }
415        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
416            *self.mint.key,
417            false,
418        ));
419        accounts.push(solana_program::instruction::AccountMeta::new(
420            *self.nft_receipt.key,
421            false,
422        ));
423        accounts.push(solana_program::instruction::AccountMeta::new(
424            *self.owner_ta.key,
425            false,
426        ));
427        accounts.push(solana_program::instruction::AccountMeta::new(
428            *self.pool_ta.key,
429            false,
430        ));
431        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
432            *self.token_program.key,
433            false,
434        ));
435        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
436            *self.associated_token_program.key,
437            false,
438        ));
439        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
440            *self.system_program.key,
441            false,
442        ));
443        remaining_accounts.iter().for_each(|remaining_account| {
444            accounts.push(solana_program::instruction::AccountMeta {
445                pubkey: *remaining_account.0.key,
446                is_signer: remaining_account.1,
447                is_writable: remaining_account.2,
448            })
449        });
450        let data = DepositNftT22InstructionData::new().try_to_vec().unwrap();
451
452        let instruction = solana_program::instruction::Instruction {
453            program_id: crate::TENSOR_AMM_ID,
454            accounts,
455            data,
456        };
457        let mut account_infos = Vec::with_capacity(12 + remaining_accounts.len());
458        account_infos.push(self.__program.clone());
459        account_infos.push(self.owner.clone());
460        account_infos.push(self.pool.clone());
461        account_infos.push(self.whitelist.clone());
462        if let Some(mint_proof) = self.mint_proof {
463            account_infos.push(mint_proof.clone());
464        }
465        account_infos.push(self.mint.clone());
466        account_infos.push(self.nft_receipt.clone());
467        account_infos.push(self.owner_ta.clone());
468        account_infos.push(self.pool_ta.clone());
469        account_infos.push(self.token_program.clone());
470        account_infos.push(self.associated_token_program.clone());
471        account_infos.push(self.system_program.clone());
472        remaining_accounts
473            .iter()
474            .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
475
476        if signers_seeds.is_empty() {
477            solana_program::program::invoke(&instruction, &account_infos)
478        } else {
479            solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
480        }
481    }
482}
483
484/// Instruction builder for `DepositNftT22` via CPI.
485///
486/// ### Accounts:
487///
488///   0. `[writable, signer]` owner
489///   1. `[writable]` pool
490///   2. `[]` whitelist
491///   3. `[optional]` mint_proof
492///   4. `[]` mint
493///   5. `[writable]` nft_receipt
494///   6. `[writable]` owner_ta
495///   7. `[writable]` pool_ta
496///   8. `[]` token_program
497///   9. `[]` associated_token_program
498///   10. `[]` system_program
499#[derive(Clone, Debug)]
500pub struct DepositNftT22CpiBuilder<'a, 'b> {
501    instruction: Box<DepositNftT22CpiBuilderInstruction<'a, 'b>>,
502}
503
504impl<'a, 'b> DepositNftT22CpiBuilder<'a, 'b> {
505    pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
506        let instruction = Box::new(DepositNftT22CpiBuilderInstruction {
507            __program: program,
508            owner: None,
509            pool: None,
510            whitelist: None,
511            mint_proof: None,
512            mint: None,
513            nft_receipt: None,
514            owner_ta: None,
515            pool_ta: None,
516            token_program: None,
517            associated_token_program: None,
518            system_program: None,
519            __remaining_accounts: Vec::new(),
520        });
521        Self { instruction }
522    }
523    /// The owner of the pool and the NFT.
524    #[inline(always)]
525    pub fn owner(&mut self, owner: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
526        self.instruction.owner = Some(owner);
527        self
528    }
529    /// The pool the NFT is being transferred to/from.
530    #[inline(always)]
531    pub fn pool(&mut self, pool: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
532        self.instruction.pool = Some(pool);
533        self
534    }
535    /// The whitelist that gatekeeps which NFTs can be deposited into the pool.
536    /// Must match the whitelist stored in the pool state.
537    #[inline(always)]
538    pub fn whitelist(
539        &mut self,
540        whitelist: &'b solana_program::account_info::AccountInfo<'a>,
541    ) -> &mut Self {
542        self.instruction.whitelist = Some(whitelist);
543        self
544    }
545    /// `[optional account]`
546    /// Optional account which must be passed in if the NFT must be verified against a
547    /// merkle proof condition in the whitelist.
548    #[inline(always)]
549    pub fn mint_proof(
550        &mut self,
551        mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
552    ) -> &mut Self {
553        self.instruction.mint_proof = mint_proof;
554        self
555    }
556    /// The mint account of the NFT.
557    #[inline(always)]
558    pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
559        self.instruction.mint = Some(mint);
560        self
561    }
562    /// The NFT deposit receipt, which ties an NFT to the pool it was deposited to.
563    #[inline(always)]
564    pub fn nft_receipt(
565        &mut self,
566        nft_receipt: &'b solana_program::account_info::AccountInfo<'a>,
567    ) -> &mut Self {
568        self.instruction.nft_receipt = Some(nft_receipt);
569        self
570    }
571    /// The TA of the owner, where the NFT will be transferred from.
572    #[inline(always)]
573    pub fn owner_ta(
574        &mut self,
575        owner_ta: &'b solana_program::account_info::AccountInfo<'a>,
576    ) -> &mut Self {
577        self.instruction.owner_ta = Some(owner_ta);
578        self
579    }
580    /// The TA of the pool, where the NFT will be escrowed.
581    #[inline(always)]
582    pub fn pool_ta(
583        &mut self,
584        pool_ta: &'b solana_program::account_info::AccountInfo<'a>,
585    ) -> &mut Self {
586        self.instruction.pool_ta = Some(pool_ta);
587        self
588    }
589    /// The SPL Token program for the Mint and ATAs.
590    #[inline(always)]
591    pub fn token_program(
592        &mut self,
593        token_program: &'b solana_program::account_info::AccountInfo<'a>,
594    ) -> &mut Self {
595        self.instruction.token_program = Some(token_program);
596        self
597    }
598    /// The SPL associated token program.
599    #[inline(always)]
600    pub fn associated_token_program(
601        &mut self,
602        associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
603    ) -> &mut Self {
604        self.instruction.associated_token_program = Some(associated_token_program);
605        self
606    }
607    /// The Solana system program.
608    #[inline(always)]
609    pub fn system_program(
610        &mut self,
611        system_program: &'b solana_program::account_info::AccountInfo<'a>,
612    ) -> &mut Self {
613        self.instruction.system_program = Some(system_program);
614        self
615    }
616    /// Add an additional account to the instruction.
617    #[inline(always)]
618    pub fn add_remaining_account(
619        &mut self,
620        account: &'b solana_program::account_info::AccountInfo<'a>,
621        is_writable: bool,
622        is_signer: bool,
623    ) -> &mut Self {
624        self.instruction
625            .__remaining_accounts
626            .push((account, is_writable, is_signer));
627        self
628    }
629    /// Add additional accounts to the instruction.
630    ///
631    /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
632    /// and a `bool` indicating whether the account is a signer or not.
633    #[inline(always)]
634    pub fn add_remaining_accounts(
635        &mut self,
636        accounts: &[(
637            &'b solana_program::account_info::AccountInfo<'a>,
638            bool,
639            bool,
640        )],
641    ) -> &mut Self {
642        self.instruction
643            .__remaining_accounts
644            .extend_from_slice(accounts);
645        self
646    }
647    #[inline(always)]
648    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
649        self.invoke_signed(&[])
650    }
651    #[allow(clippy::clone_on_copy)]
652    #[allow(clippy::vec_init_then_push)]
653    pub fn invoke_signed(
654        &self,
655        signers_seeds: &[&[&[u8]]],
656    ) -> solana_program::entrypoint::ProgramResult {
657        let instruction = DepositNftT22Cpi {
658            __program: self.instruction.__program,
659
660            owner: self.instruction.owner.expect("owner is not set"),
661
662            pool: self.instruction.pool.expect("pool is not set"),
663
664            whitelist: self.instruction.whitelist.expect("whitelist is not set"),
665
666            mint_proof: self.instruction.mint_proof,
667
668            mint: self.instruction.mint.expect("mint is not set"),
669
670            nft_receipt: self
671                .instruction
672                .nft_receipt
673                .expect("nft_receipt is not set"),
674
675            owner_ta: self.instruction.owner_ta.expect("owner_ta is not set"),
676
677            pool_ta: self.instruction.pool_ta.expect("pool_ta is not set"),
678
679            token_program: self
680                .instruction
681                .token_program
682                .expect("token_program is not set"),
683
684            associated_token_program: self
685                .instruction
686                .associated_token_program
687                .expect("associated_token_program is not set"),
688
689            system_program: self
690                .instruction
691                .system_program
692                .expect("system_program is not set"),
693        };
694        instruction.invoke_signed_with_remaining_accounts(
695            signers_seeds,
696            &self.instruction.__remaining_accounts,
697        )
698    }
699}
700
701#[derive(Clone, Debug)]
702struct DepositNftT22CpiBuilderInstruction<'a, 'b> {
703    __program: &'b solana_program::account_info::AccountInfo<'a>,
704    owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
705    pool: Option<&'b solana_program::account_info::AccountInfo<'a>>,
706    whitelist: Option<&'b solana_program::account_info::AccountInfo<'a>>,
707    mint_proof: Option<&'b solana_program::account_info::AccountInfo<'a>>,
708    mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
709    nft_receipt: Option<&'b solana_program::account_info::AccountInfo<'a>>,
710    owner_ta: Option<&'b solana_program::account_info::AccountInfo<'a>>,
711    pool_ta: Option<&'b solana_program::account_info::AccountInfo<'a>>,
712    token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
713    associated_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
714    system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
715    /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
716    __remaining_accounts: Vec<(
717        &'b solana_program::account_info::AccountInfo<'a>,
718        bool,
719        bool,
720    )>,
721}