Skip to main content

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