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