Skip to main content

mpl_token_metadata/generated/instructions/
transfer_out_of_escrow.rs

1//! This code was AUTOGENERATED using the kinobi library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun kinobi to update it.
4//!
5//! [https://github.com/metaplex-foundation/kinobi]
6//!
7
8use borsh::BorshDeserialize;
9use borsh::BorshSerialize;
10
11/// Accounts.
12pub struct TransferOutOfEscrow {
13    /// Escrow account
14    pub escrow: solana_program::pubkey::Pubkey,
15    /// Metadata account
16    pub metadata: solana_program::pubkey::Pubkey,
17    /// Wallet paying for the transaction and new account
18    pub payer: solana_program::pubkey::Pubkey,
19    /// Mint account for the new attribute
20    pub attribute_mint: solana_program::pubkey::Pubkey,
21    /// Token account source for the new attribute
22    pub attribute_src: solana_program::pubkey::Pubkey,
23    /// Token account, owned by TM, destination for the new attribute
24    pub attribute_dst: solana_program::pubkey::Pubkey,
25    /// Mint account that the escrow is attached
26    pub escrow_mint: solana_program::pubkey::Pubkey,
27    /// Token account that holds the token the escrow is attached to
28    pub escrow_account: solana_program::pubkey::Pubkey,
29    /// System program
30    pub system_program: solana_program::pubkey::Pubkey,
31    /// Associated Token program
32    pub ata_program: solana_program::pubkey::Pubkey,
33    /// Token program
34    pub token_program: solana_program::pubkey::Pubkey,
35    /// Instructions sysvar account
36    pub sysvar_instructions: solana_program::pubkey::Pubkey,
37    /// Authority/creator of the escrow account
38    pub authority: Option<solana_program::pubkey::Pubkey>,
39}
40
41impl TransferOutOfEscrow {
42    pub fn instruction(
43        &self,
44        args: TransferOutOfEscrowInstructionArgs,
45    ) -> solana_program::instruction::Instruction {
46        self.instruction_with_remaining_accounts(args, &[])
47    }
48    #[allow(clippy::vec_init_then_push)]
49    pub fn instruction_with_remaining_accounts(
50        &self,
51        args: TransferOutOfEscrowInstructionArgs,
52        remaining_accounts: &[solana_program::instruction::AccountMeta],
53    ) -> solana_program::instruction::Instruction {
54        let mut accounts = Vec::with_capacity(13 + remaining_accounts.len());
55        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
56            self.escrow,
57            false,
58        ));
59        accounts.push(solana_program::instruction::AccountMeta::new(
60            self.metadata,
61            false,
62        ));
63        accounts.push(solana_program::instruction::AccountMeta::new(
64            self.payer, true,
65        ));
66        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
67            self.attribute_mint,
68            false,
69        ));
70        accounts.push(solana_program::instruction::AccountMeta::new(
71            self.attribute_src,
72            false,
73        ));
74        accounts.push(solana_program::instruction::AccountMeta::new(
75            self.attribute_dst,
76            false,
77        ));
78        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
79            self.escrow_mint,
80            false,
81        ));
82        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
83            self.escrow_account,
84            false,
85        ));
86        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
87            self.system_program,
88            false,
89        ));
90        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
91            self.ata_program,
92            false,
93        ));
94        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
95            self.token_program,
96            false,
97        ));
98        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
99            self.sysvar_instructions,
100            false,
101        ));
102        if let Some(authority) = self.authority {
103            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
104                authority, true,
105            ));
106        }
107        accounts.extend_from_slice(remaining_accounts);
108        let mut data = TransferOutOfEscrowInstructionData::new()
109            .try_to_vec()
110            .unwrap();
111        let mut args = args.try_to_vec().unwrap();
112        data.append(&mut args);
113
114        solana_program::instruction::Instruction {
115            program_id: crate::MPL_TOKEN_METADATA_ID,
116            accounts,
117            data,
118        }
119    }
120}
121
122#[derive(BorshDeserialize, BorshSerialize)]
123struct TransferOutOfEscrowInstructionData {
124    discriminator: u8,
125}
126
127impl TransferOutOfEscrowInstructionData {
128    fn new() -> Self {
129        Self { discriminator: 40 }
130    }
131}
132
133#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
134#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
135pub struct TransferOutOfEscrowInstructionArgs {
136    pub amount: u64,
137}
138
139/// Instruction builder for `TransferOutOfEscrow`.
140///
141/// ### Accounts:
142///
143///   0. `[]` escrow
144///   1. `[writable]` metadata
145///   2. `[writable, signer]` payer
146///   3. `[]` attribute_mint
147///   4. `[writable]` attribute_src
148///   5. `[writable]` attribute_dst
149///   6. `[]` escrow_mint
150///   7. `[]` escrow_account
151///   8. `[optional]` system_program (default to `11111111111111111111111111111111`)
152///   9. `[optional]` ata_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
153///   10. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`)
154///   11. `[optional]` sysvar_instructions (default to `Sysvar1nstructions1111111111111111111111111`)
155///   12. `[signer, optional]` authority
156#[derive(Default)]
157pub struct TransferOutOfEscrowBuilder {
158    escrow: Option<solana_program::pubkey::Pubkey>,
159    metadata: Option<solana_program::pubkey::Pubkey>,
160    payer: Option<solana_program::pubkey::Pubkey>,
161    attribute_mint: Option<solana_program::pubkey::Pubkey>,
162    attribute_src: Option<solana_program::pubkey::Pubkey>,
163    attribute_dst: Option<solana_program::pubkey::Pubkey>,
164    escrow_mint: Option<solana_program::pubkey::Pubkey>,
165    escrow_account: Option<solana_program::pubkey::Pubkey>,
166    system_program: Option<solana_program::pubkey::Pubkey>,
167    ata_program: Option<solana_program::pubkey::Pubkey>,
168    token_program: Option<solana_program::pubkey::Pubkey>,
169    sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
170    authority: Option<solana_program::pubkey::Pubkey>,
171    amount: Option<u64>,
172    __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
173}
174
175impl TransferOutOfEscrowBuilder {
176    pub fn new() -> Self {
177        Self::default()
178    }
179    /// Escrow account
180    #[inline(always)]
181    pub fn escrow(&mut self, escrow: solana_program::pubkey::Pubkey) -> &mut Self {
182        self.escrow = Some(escrow);
183        self
184    }
185    /// Metadata account
186    #[inline(always)]
187    pub fn metadata(&mut self, metadata: solana_program::pubkey::Pubkey) -> &mut Self {
188        self.metadata = Some(metadata);
189        self
190    }
191    /// Wallet paying for the transaction and new account
192    #[inline(always)]
193    pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self {
194        self.payer = Some(payer);
195        self
196    }
197    /// Mint account for the new attribute
198    #[inline(always)]
199    pub fn attribute_mint(&mut self, attribute_mint: solana_program::pubkey::Pubkey) -> &mut Self {
200        self.attribute_mint = Some(attribute_mint);
201        self
202    }
203    /// Token account source for the new attribute
204    #[inline(always)]
205    pub fn attribute_src(&mut self, attribute_src: solana_program::pubkey::Pubkey) -> &mut Self {
206        self.attribute_src = Some(attribute_src);
207        self
208    }
209    /// Token account, owned by TM, destination for the new attribute
210    #[inline(always)]
211    pub fn attribute_dst(&mut self, attribute_dst: solana_program::pubkey::Pubkey) -> &mut Self {
212        self.attribute_dst = Some(attribute_dst);
213        self
214    }
215    /// Mint account that the escrow is attached
216    #[inline(always)]
217    pub fn escrow_mint(&mut self, escrow_mint: solana_program::pubkey::Pubkey) -> &mut Self {
218        self.escrow_mint = Some(escrow_mint);
219        self
220    }
221    /// Token account that holds the token the escrow is attached to
222    #[inline(always)]
223    pub fn escrow_account(&mut self, escrow_account: solana_program::pubkey::Pubkey) -> &mut Self {
224        self.escrow_account = Some(escrow_account);
225        self
226    }
227    /// `[optional account, default to '11111111111111111111111111111111']`
228    /// System program
229    #[inline(always)]
230    pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
231        self.system_program = Some(system_program);
232        self
233    }
234    /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']`
235    /// Associated Token program
236    #[inline(always)]
237    pub fn ata_program(&mut self, ata_program: solana_program::pubkey::Pubkey) -> &mut Self {
238        self.ata_program = Some(ata_program);
239        self
240    }
241    /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']`
242    /// Token program
243    #[inline(always)]
244    pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self {
245        self.token_program = Some(token_program);
246        self
247    }
248    /// `[optional account, default to 'Sysvar1nstructions1111111111111111111111111']`
249    /// Instructions sysvar account
250    #[inline(always)]
251    pub fn sysvar_instructions(
252        &mut self,
253        sysvar_instructions: solana_program::pubkey::Pubkey,
254    ) -> &mut Self {
255        self.sysvar_instructions = Some(sysvar_instructions);
256        self
257    }
258    /// `[optional account]`
259    /// Authority/creator of the escrow account
260    #[inline(always)]
261    pub fn authority(&mut self, authority: Option<solana_program::pubkey::Pubkey>) -> &mut Self {
262        self.authority = authority;
263        self
264    }
265    /// `[optional argument, defaults to '1']`
266    #[inline(always)]
267    pub fn amount(&mut self, amount: u64) -> &mut Self {
268        self.amount = Some(amount);
269        self
270    }
271    /// Add an aditional account to the instruction.
272    #[inline(always)]
273    pub fn add_remaining_account(
274        &mut self,
275        account: solana_program::instruction::AccountMeta,
276    ) -> &mut Self {
277        self.__remaining_accounts.push(account);
278        self
279    }
280    /// Add additional accounts to the instruction.
281    #[inline(always)]
282    pub fn add_remaining_accounts(
283        &mut self,
284        accounts: &[solana_program::instruction::AccountMeta],
285    ) -> &mut Self {
286        self.__remaining_accounts.extend_from_slice(accounts);
287        self
288    }
289    #[allow(clippy::clone_on_copy)]
290    pub fn instruction(&self) -> solana_program::instruction::Instruction {
291        let accounts = TransferOutOfEscrow {
292            escrow: self.escrow.expect("escrow is not set"),
293            metadata: self.metadata.expect("metadata is not set"),
294            payer: self.payer.expect("payer is not set"),
295            attribute_mint: self.attribute_mint.expect("attribute_mint is not set"),
296            attribute_src: self.attribute_src.expect("attribute_src is not set"),
297            attribute_dst: self.attribute_dst.expect("attribute_dst is not set"),
298            escrow_mint: self.escrow_mint.expect("escrow_mint is not set"),
299            escrow_account: self.escrow_account.expect("escrow_account is not set"),
300            system_program: self
301                .system_program
302                .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
303            ata_program: self.ata_program.unwrap_or(solana_program::pubkey!(
304                "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
305            )),
306            token_program: self.token_program.unwrap_or(solana_program::pubkey!(
307                "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
308            )),
309            sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!(
310                "Sysvar1nstructions1111111111111111111111111"
311            )),
312            authority: self.authority,
313        };
314        let args = TransferOutOfEscrowInstructionArgs {
315            amount: self.amount.clone().unwrap_or(1),
316        };
317
318        accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
319    }
320}
321
322/// `transfer_out_of_escrow` CPI accounts.
323pub struct TransferOutOfEscrowCpiAccounts<'a, 'b> {
324    /// Escrow account
325    pub escrow: &'b solana_program::account_info::AccountInfo<'a>,
326    /// Metadata account
327    pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
328    /// Wallet paying for the transaction and new account
329    pub payer: &'b solana_program::account_info::AccountInfo<'a>,
330    /// Mint account for the new attribute
331    pub attribute_mint: &'b solana_program::account_info::AccountInfo<'a>,
332    /// Token account source for the new attribute
333    pub attribute_src: &'b solana_program::account_info::AccountInfo<'a>,
334    /// Token account, owned by TM, destination for the new attribute
335    pub attribute_dst: &'b solana_program::account_info::AccountInfo<'a>,
336    /// Mint account that the escrow is attached
337    pub escrow_mint: &'b solana_program::account_info::AccountInfo<'a>,
338    /// Token account that holds the token the escrow is attached to
339    pub escrow_account: &'b solana_program::account_info::AccountInfo<'a>,
340    /// System program
341    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
342    /// Associated Token program
343    pub ata_program: &'b solana_program::account_info::AccountInfo<'a>,
344    /// Token program
345    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
346    /// Instructions sysvar account
347    pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
348    /// Authority/creator of the escrow account
349    pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
350}
351
352/// `transfer_out_of_escrow` CPI instruction.
353pub struct TransferOutOfEscrowCpi<'a, 'b> {
354    /// The program to invoke.
355    pub __program: &'b solana_program::account_info::AccountInfo<'a>,
356    /// Escrow account
357    pub escrow: &'b solana_program::account_info::AccountInfo<'a>,
358    /// Metadata account
359    pub metadata: &'b solana_program::account_info::AccountInfo<'a>,
360    /// Wallet paying for the transaction and new account
361    pub payer: &'b solana_program::account_info::AccountInfo<'a>,
362    /// Mint account for the new attribute
363    pub attribute_mint: &'b solana_program::account_info::AccountInfo<'a>,
364    /// Token account source for the new attribute
365    pub attribute_src: &'b solana_program::account_info::AccountInfo<'a>,
366    /// Token account, owned by TM, destination for the new attribute
367    pub attribute_dst: &'b solana_program::account_info::AccountInfo<'a>,
368    /// Mint account that the escrow is attached
369    pub escrow_mint: &'b solana_program::account_info::AccountInfo<'a>,
370    /// Token account that holds the token the escrow is attached to
371    pub escrow_account: &'b solana_program::account_info::AccountInfo<'a>,
372    /// System program
373    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
374    /// Associated Token program
375    pub ata_program: &'b solana_program::account_info::AccountInfo<'a>,
376    /// Token program
377    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
378    /// Instructions sysvar account
379    pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
380    /// Authority/creator of the escrow account
381    pub authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
382    /// The arguments for the instruction.
383    pub __args: TransferOutOfEscrowInstructionArgs,
384}
385
386impl<'a, 'b> TransferOutOfEscrowCpi<'a, 'b> {
387    pub fn new(
388        program: &'b solana_program::account_info::AccountInfo<'a>,
389        accounts: TransferOutOfEscrowCpiAccounts<'a, 'b>,
390        args: TransferOutOfEscrowInstructionArgs,
391    ) -> Self {
392        Self {
393            __program: program,
394            escrow: accounts.escrow,
395            metadata: accounts.metadata,
396            payer: accounts.payer,
397            attribute_mint: accounts.attribute_mint,
398            attribute_src: accounts.attribute_src,
399            attribute_dst: accounts.attribute_dst,
400            escrow_mint: accounts.escrow_mint,
401            escrow_account: accounts.escrow_account,
402            system_program: accounts.system_program,
403            ata_program: accounts.ata_program,
404            token_program: accounts.token_program,
405            sysvar_instructions: accounts.sysvar_instructions,
406            authority: accounts.authority,
407            __args: args,
408        }
409    }
410    #[inline(always)]
411    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
412        self.invoke_signed_with_remaining_accounts(&[], &[])
413    }
414    #[inline(always)]
415    pub fn invoke_with_remaining_accounts(
416        &self,
417        remaining_accounts: &[(
418            &'b solana_program::account_info::AccountInfo<'a>,
419            bool,
420            bool,
421        )],
422    ) -> solana_program::entrypoint::ProgramResult {
423        self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
424    }
425    #[inline(always)]
426    pub fn invoke_signed(
427        &self,
428        signers_seeds: &[&[&[u8]]],
429    ) -> solana_program::entrypoint::ProgramResult {
430        self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
431    }
432    #[allow(clippy::clone_on_copy)]
433    #[allow(clippy::vec_init_then_push)]
434    pub fn invoke_signed_with_remaining_accounts(
435        &self,
436        signers_seeds: &[&[&[u8]]],
437        remaining_accounts: &[(
438            &'b solana_program::account_info::AccountInfo<'a>,
439            bool,
440            bool,
441        )],
442    ) -> solana_program::entrypoint::ProgramResult {
443        let mut accounts = Vec::with_capacity(13 + remaining_accounts.len());
444        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
445            *self.escrow.key,
446            false,
447        ));
448        accounts.push(solana_program::instruction::AccountMeta::new(
449            *self.metadata.key,
450            false,
451        ));
452        accounts.push(solana_program::instruction::AccountMeta::new(
453            *self.payer.key,
454            true,
455        ));
456        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
457            *self.attribute_mint.key,
458            false,
459        ));
460        accounts.push(solana_program::instruction::AccountMeta::new(
461            *self.attribute_src.key,
462            false,
463        ));
464        accounts.push(solana_program::instruction::AccountMeta::new(
465            *self.attribute_dst.key,
466            false,
467        ));
468        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
469            *self.escrow_mint.key,
470            false,
471        ));
472        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
473            *self.escrow_account.key,
474            false,
475        ));
476        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
477            *self.system_program.key,
478            false,
479        ));
480        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
481            *self.ata_program.key,
482            false,
483        ));
484        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
485            *self.token_program.key,
486            false,
487        ));
488        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
489            *self.sysvar_instructions.key,
490            false,
491        ));
492        if let Some(authority) = self.authority {
493            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
494                *authority.key,
495                true,
496            ));
497        }
498        remaining_accounts.iter().for_each(|remaining_account| {
499            accounts.push(solana_program::instruction::AccountMeta {
500                pubkey: *remaining_account.0.key,
501                is_signer: remaining_account.1,
502                is_writable: remaining_account.2,
503            })
504        });
505        let mut data = TransferOutOfEscrowInstructionData::new()
506            .try_to_vec()
507            .unwrap();
508        let mut args = self.__args.try_to_vec().unwrap();
509        data.append(&mut args);
510
511        let instruction = solana_program::instruction::Instruction {
512            program_id: crate::MPL_TOKEN_METADATA_ID,
513            accounts,
514            data,
515        };
516        let mut account_infos = Vec::with_capacity(13 + 1 + remaining_accounts.len());
517        account_infos.push(self.__program.clone());
518        account_infos.push(self.escrow.clone());
519        account_infos.push(self.metadata.clone());
520        account_infos.push(self.payer.clone());
521        account_infos.push(self.attribute_mint.clone());
522        account_infos.push(self.attribute_src.clone());
523        account_infos.push(self.attribute_dst.clone());
524        account_infos.push(self.escrow_mint.clone());
525        account_infos.push(self.escrow_account.clone());
526        account_infos.push(self.system_program.clone());
527        account_infos.push(self.ata_program.clone());
528        account_infos.push(self.token_program.clone());
529        account_infos.push(self.sysvar_instructions.clone());
530        if let Some(authority) = self.authority {
531            account_infos.push(authority.clone());
532        }
533        remaining_accounts
534            .iter()
535            .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
536
537        if signers_seeds.is_empty() {
538            solana_program::program::invoke(&instruction, &account_infos)
539        } else {
540            solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
541        }
542    }
543}
544
545/// Instruction builder for `TransferOutOfEscrow` via CPI.
546///
547/// ### Accounts:
548///
549///   0. `[]` escrow
550///   1. `[writable]` metadata
551///   2. `[writable, signer]` payer
552///   3. `[]` attribute_mint
553///   4. `[writable]` attribute_src
554///   5. `[writable]` attribute_dst
555///   6. `[]` escrow_mint
556///   7. `[]` escrow_account
557///   8. `[]` system_program
558///   9. `[]` ata_program
559///   10. `[]` token_program
560///   11. `[]` sysvar_instructions
561///   12. `[signer, optional]` authority
562pub struct TransferOutOfEscrowCpiBuilder<'a, 'b> {
563    instruction: Box<TransferOutOfEscrowCpiBuilderInstruction<'a, 'b>>,
564}
565
566impl<'a, 'b> TransferOutOfEscrowCpiBuilder<'a, 'b> {
567    pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
568        let instruction = Box::new(TransferOutOfEscrowCpiBuilderInstruction {
569            __program: program,
570            escrow: None,
571            metadata: None,
572            payer: None,
573            attribute_mint: None,
574            attribute_src: None,
575            attribute_dst: None,
576            escrow_mint: None,
577            escrow_account: None,
578            system_program: None,
579            ata_program: None,
580            token_program: None,
581            sysvar_instructions: None,
582            authority: None,
583            amount: None,
584            __remaining_accounts: Vec::new(),
585        });
586        Self { instruction }
587    }
588    /// Escrow account
589    #[inline(always)]
590    pub fn escrow(
591        &mut self,
592        escrow: &'b solana_program::account_info::AccountInfo<'a>,
593    ) -> &mut Self {
594        self.instruction.escrow = Some(escrow);
595        self
596    }
597    /// Metadata account
598    #[inline(always)]
599    pub fn metadata(
600        &mut self,
601        metadata: &'b solana_program::account_info::AccountInfo<'a>,
602    ) -> &mut Self {
603        self.instruction.metadata = Some(metadata);
604        self
605    }
606    /// Wallet paying for the transaction and new account
607    #[inline(always)]
608    pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
609        self.instruction.payer = Some(payer);
610        self
611    }
612    /// Mint account for the new attribute
613    #[inline(always)]
614    pub fn attribute_mint(
615        &mut self,
616        attribute_mint: &'b solana_program::account_info::AccountInfo<'a>,
617    ) -> &mut Self {
618        self.instruction.attribute_mint = Some(attribute_mint);
619        self
620    }
621    /// Token account source for the new attribute
622    #[inline(always)]
623    pub fn attribute_src(
624        &mut self,
625        attribute_src: &'b solana_program::account_info::AccountInfo<'a>,
626    ) -> &mut Self {
627        self.instruction.attribute_src = Some(attribute_src);
628        self
629    }
630    /// Token account, owned by TM, destination for the new attribute
631    #[inline(always)]
632    pub fn attribute_dst(
633        &mut self,
634        attribute_dst: &'b solana_program::account_info::AccountInfo<'a>,
635    ) -> &mut Self {
636        self.instruction.attribute_dst = Some(attribute_dst);
637        self
638    }
639    /// Mint account that the escrow is attached
640    #[inline(always)]
641    pub fn escrow_mint(
642        &mut self,
643        escrow_mint: &'b solana_program::account_info::AccountInfo<'a>,
644    ) -> &mut Self {
645        self.instruction.escrow_mint = Some(escrow_mint);
646        self
647    }
648    /// Token account that holds the token the escrow is attached to
649    #[inline(always)]
650    pub fn escrow_account(
651        &mut self,
652        escrow_account: &'b solana_program::account_info::AccountInfo<'a>,
653    ) -> &mut Self {
654        self.instruction.escrow_account = Some(escrow_account);
655        self
656    }
657    /// System program
658    #[inline(always)]
659    pub fn system_program(
660        &mut self,
661        system_program: &'b solana_program::account_info::AccountInfo<'a>,
662    ) -> &mut Self {
663        self.instruction.system_program = Some(system_program);
664        self
665    }
666    /// Associated Token program
667    #[inline(always)]
668    pub fn ata_program(
669        &mut self,
670        ata_program: &'b solana_program::account_info::AccountInfo<'a>,
671    ) -> &mut Self {
672        self.instruction.ata_program = Some(ata_program);
673        self
674    }
675    /// Token program
676    #[inline(always)]
677    pub fn token_program(
678        &mut self,
679        token_program: &'b solana_program::account_info::AccountInfo<'a>,
680    ) -> &mut Self {
681        self.instruction.token_program = Some(token_program);
682        self
683    }
684    /// Instructions sysvar account
685    #[inline(always)]
686    pub fn sysvar_instructions(
687        &mut self,
688        sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
689    ) -> &mut Self {
690        self.instruction.sysvar_instructions = Some(sysvar_instructions);
691        self
692    }
693    /// `[optional account]`
694    /// Authority/creator of the escrow account
695    #[inline(always)]
696    pub fn authority(
697        &mut self,
698        authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
699    ) -> &mut Self {
700        self.instruction.authority = authority;
701        self
702    }
703    /// `[optional argument, defaults to '1']`
704    #[inline(always)]
705    pub fn amount(&mut self, amount: u64) -> &mut Self {
706        self.instruction.amount = Some(amount);
707        self
708    }
709    /// Add an additional account to the instruction.
710    #[inline(always)]
711    pub fn add_remaining_account(
712        &mut self,
713        account: &'b solana_program::account_info::AccountInfo<'a>,
714        is_writable: bool,
715        is_signer: bool,
716    ) -> &mut Self {
717        self.instruction
718            .__remaining_accounts
719            .push((account, is_writable, is_signer));
720        self
721    }
722    /// Add additional accounts to the instruction.
723    ///
724    /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
725    /// and a `bool` indicating whether the account is a signer or not.
726    #[inline(always)]
727    pub fn add_remaining_accounts(
728        &mut self,
729        accounts: &[(
730            &'b solana_program::account_info::AccountInfo<'a>,
731            bool,
732            bool,
733        )],
734    ) -> &mut Self {
735        self.instruction
736            .__remaining_accounts
737            .extend_from_slice(accounts);
738        self
739    }
740    #[inline(always)]
741    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
742        self.invoke_signed(&[])
743    }
744    #[allow(clippy::clone_on_copy)]
745    #[allow(clippy::vec_init_then_push)]
746    pub fn invoke_signed(
747        &self,
748        signers_seeds: &[&[&[u8]]],
749    ) -> solana_program::entrypoint::ProgramResult {
750        let args = TransferOutOfEscrowInstructionArgs {
751            amount: self.instruction.amount.clone().unwrap_or(1),
752        };
753        let instruction = TransferOutOfEscrowCpi {
754            __program: self.instruction.__program,
755
756            escrow: self.instruction.escrow.expect("escrow is not set"),
757
758            metadata: self.instruction.metadata.expect("metadata is not set"),
759
760            payer: self.instruction.payer.expect("payer is not set"),
761
762            attribute_mint: self
763                .instruction
764                .attribute_mint
765                .expect("attribute_mint is not set"),
766
767            attribute_src: self
768                .instruction
769                .attribute_src
770                .expect("attribute_src is not set"),
771
772            attribute_dst: self
773                .instruction
774                .attribute_dst
775                .expect("attribute_dst is not set"),
776
777            escrow_mint: self
778                .instruction
779                .escrow_mint
780                .expect("escrow_mint is not set"),
781
782            escrow_account: self
783                .instruction
784                .escrow_account
785                .expect("escrow_account is not set"),
786
787            system_program: self
788                .instruction
789                .system_program
790                .expect("system_program is not set"),
791
792            ata_program: self
793                .instruction
794                .ata_program
795                .expect("ata_program is not set"),
796
797            token_program: self
798                .instruction
799                .token_program
800                .expect("token_program is not set"),
801
802            sysvar_instructions: self
803                .instruction
804                .sysvar_instructions
805                .expect("sysvar_instructions is not set"),
806
807            authority: self.instruction.authority,
808            __args: args,
809        };
810        instruction.invoke_signed_with_remaining_accounts(
811            signers_seeds,
812            &self.instruction.__remaining_accounts,
813        )
814    }
815}
816
817struct TransferOutOfEscrowCpiBuilderInstruction<'a, 'b> {
818    __program: &'b solana_program::account_info::AccountInfo<'a>,
819    escrow: Option<&'b solana_program::account_info::AccountInfo<'a>>,
820    metadata: Option<&'b solana_program::account_info::AccountInfo<'a>>,
821    payer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
822    attribute_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
823    attribute_src: Option<&'b solana_program::account_info::AccountInfo<'a>>,
824    attribute_dst: Option<&'b solana_program::account_info::AccountInfo<'a>>,
825    escrow_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
826    escrow_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
827    system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
828    ata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
829    token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
830    sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
831    authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
832    amount: Option<u64>,
833    /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
834    __remaining_accounts: Vec<(
835        &'b solana_program::account_info::AccountInfo<'a>,
836        bool,
837        bool,
838    )>,
839}