stablebond_sdk/generated/instructions/
create_purchase_order_v2.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 CreatePurchaseOrderV2 {
13    pub kyc_account: solana_program::pubkey::Pubkey,
14
15    pub user_wallet: solana_program::pubkey::Pubkey,
16
17    pub bond_account: solana_program::pubkey::Pubkey,
18
19    pub issuance_account: solana_program::pubkey::Pubkey,
20
21    pub payment_account: solana_program::pubkey::Pubkey,
22
23    pub payment_token_account: solana_program::pubkey::Pubkey,
24
25    pub user_payment_token_account: solana_program::pubkey::Pubkey,
26
27    pub user_nft_token_account: solana_program::pubkey::Pubkey,
28
29    pub nft_mint_account: solana_program::pubkey::Pubkey,
30
31    pub nft_metadata_account: solana_program::pubkey::Pubkey,
32
33    pub nft_master_edition_account: solana_program::pubkey::Pubkey,
34
35    pub purchase_order_vault_account: solana_program::pubkey::Pubkey,
36
37    pub nft_collection_mint: solana_program::pubkey::Pubkey,
38
39    pub nft_collection_metadata_account: solana_program::pubkey::Pubkey,
40
41    pub nft_collection_master_edition_account: solana_program::pubkey::Pubkey,
42
43    pub payment_mint_account: solana_program::pubkey::Pubkey,
44
45    pub payment_feed_account: solana_program::pubkey::Pubkey,
46
47    pub payment_base_price_feed_account: solana_program::pubkey::Pubkey,
48
49    pub config_account: solana_program::pubkey::Pubkey,
50
51    pub associated_token_program: solana_program::pubkey::Pubkey,
52
53    pub token2022_program: solana_program::pubkey::Pubkey,
54
55    pub token_program: solana_program::pubkey::Pubkey,
56
57    pub system_program: solana_program::pubkey::Pubkey,
58
59    pub metadata_program: solana_program::pubkey::Pubkey,
60
61    pub sysvar_instructions: solana_program::pubkey::Pubkey,
62
63    pub payment_quote_price_feed_account: Option<solana_program::pubkey::Pubkey>,
64}
65
66impl CreatePurchaseOrderV2 {
67    pub fn instruction(
68        &self,
69        args: CreatePurchaseOrderV2InstructionArgs,
70    ) -> solana_program::instruction::Instruction {
71        self.instruction_with_remaining_accounts(args, &[])
72    }
73    #[allow(clippy::vec_init_then_push)]
74    pub fn instruction_with_remaining_accounts(
75        &self,
76        args: CreatePurchaseOrderV2InstructionArgs,
77        remaining_accounts: &[solana_program::instruction::AccountMeta],
78    ) -> solana_program::instruction::Instruction {
79        let mut accounts = Vec::with_capacity(26 + remaining_accounts.len());
80        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
81            self.kyc_account,
82            false,
83        ));
84        accounts.push(solana_program::instruction::AccountMeta::new(
85            self.user_wallet,
86            true,
87        ));
88        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
89            self.bond_account,
90            false,
91        ));
92        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
93            self.issuance_account,
94            false,
95        ));
96        accounts.push(solana_program::instruction::AccountMeta::new(
97            self.payment_account,
98            false,
99        ));
100        accounts.push(solana_program::instruction::AccountMeta::new(
101            self.payment_token_account,
102            false,
103        ));
104        accounts.push(solana_program::instruction::AccountMeta::new(
105            self.user_payment_token_account,
106            false,
107        ));
108        accounts.push(solana_program::instruction::AccountMeta::new(
109            self.user_nft_token_account,
110            false,
111        ));
112        accounts.push(solana_program::instruction::AccountMeta::new(
113            self.nft_mint_account,
114            true,
115        ));
116        accounts.push(solana_program::instruction::AccountMeta::new(
117            self.nft_metadata_account,
118            false,
119        ));
120        accounts.push(solana_program::instruction::AccountMeta::new(
121            self.nft_master_edition_account,
122            false,
123        ));
124        accounts.push(solana_program::instruction::AccountMeta::new(
125            self.purchase_order_vault_account,
126            false,
127        ));
128        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
129            self.nft_collection_mint,
130            false,
131        ));
132        accounts.push(solana_program::instruction::AccountMeta::new(
133            self.nft_collection_metadata_account,
134            false,
135        ));
136        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
137            self.nft_collection_master_edition_account,
138            false,
139        ));
140        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
141            self.payment_mint_account,
142            false,
143        ));
144        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
145            self.payment_feed_account,
146            false,
147        ));
148        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
149            self.payment_base_price_feed_account,
150            false,
151        ));
152        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
153            self.config_account,
154            false,
155        ));
156        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
157            self.associated_token_program,
158            false,
159        ));
160        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
161            self.token2022_program,
162            false,
163        ));
164        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
165            self.token_program,
166            false,
167        ));
168        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
169            self.system_program,
170            false,
171        ));
172        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
173            self.metadata_program,
174            false,
175        ));
176        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
177            self.sysvar_instructions,
178            false,
179        ));
180        if let Some(payment_quote_price_feed_account) = self.payment_quote_price_feed_account {
181            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
182                payment_quote_price_feed_account,
183                false,
184            ));
185        } else {
186            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
187                crate::STABLEBOND_ID,
188                false,
189            ));
190        }
191        accounts.extend_from_slice(remaining_accounts);
192        let mut data = CreatePurchaseOrderV2InstructionData::new()
193            .try_to_vec()
194            .unwrap();
195        let mut args = args.try_to_vec().unwrap();
196        data.append(&mut args);
197
198        solana_program::instruction::Instruction {
199            program_id: crate::STABLEBOND_ID,
200            accounts,
201            data,
202        }
203    }
204}
205
206#[derive(BorshDeserialize, BorshSerialize)]
207struct CreatePurchaseOrderV2InstructionData {
208    discriminator: u8,
209}
210
211impl CreatePurchaseOrderV2InstructionData {
212    fn new() -> Self {
213        Self { discriminator: 30 }
214    }
215}
216
217#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
218#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
219pub struct CreatePurchaseOrderV2InstructionArgs {
220    pub amount: u64,
221}
222
223/// Instruction builder for `CreatePurchaseOrderV2`.
224///
225/// ### Accounts:
226///
227///   0. `[]` kyc_account
228///   1. `[writable, signer]` user_wallet
229///   2. `[]` bond_account
230///   3. `[]` issuance_account
231///   4. `[writable]` payment_account
232///   5. `[writable]` payment_token_account
233///   6. `[writable]` user_payment_token_account
234///   7. `[writable]` user_nft_token_account
235///   8. `[writable, signer]` nft_mint_account
236///   9. `[writable]` nft_metadata_account
237///   10. `[writable]` nft_master_edition_account
238///   11. `[writable]` purchase_order_vault_account
239///   12. `[]` nft_collection_mint
240///   13. `[writable]` nft_collection_metadata_account
241///   14. `[]` nft_collection_master_edition_account
242///   15. `[]` payment_mint_account
243///   16. `[]` payment_feed_account
244///   17. `[]` payment_base_price_feed_account
245///   18. `[]` config_account
246///   19. `[]` associated_token_program
247///   20. `[]` token2022_program
248///   21. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`)
249///   22. `[optional]` system_program (default to `11111111111111111111111111111111`)
250///   23. `[]` metadata_program
251///   24. `[optional]` sysvar_instructions (default to `Sysvar1nstructions1111111111111111111111111`)
252///   25. `[optional]` payment_quote_price_feed_account
253#[derive(Default)]
254pub struct CreatePurchaseOrderV2Builder {
255    kyc_account: Option<solana_program::pubkey::Pubkey>,
256    user_wallet: Option<solana_program::pubkey::Pubkey>,
257    bond_account: Option<solana_program::pubkey::Pubkey>,
258    issuance_account: Option<solana_program::pubkey::Pubkey>,
259    payment_account: Option<solana_program::pubkey::Pubkey>,
260    payment_token_account: Option<solana_program::pubkey::Pubkey>,
261    user_payment_token_account: Option<solana_program::pubkey::Pubkey>,
262    user_nft_token_account: Option<solana_program::pubkey::Pubkey>,
263    nft_mint_account: Option<solana_program::pubkey::Pubkey>,
264    nft_metadata_account: Option<solana_program::pubkey::Pubkey>,
265    nft_master_edition_account: Option<solana_program::pubkey::Pubkey>,
266    purchase_order_vault_account: Option<solana_program::pubkey::Pubkey>,
267    nft_collection_mint: Option<solana_program::pubkey::Pubkey>,
268    nft_collection_metadata_account: Option<solana_program::pubkey::Pubkey>,
269    nft_collection_master_edition_account: Option<solana_program::pubkey::Pubkey>,
270    payment_mint_account: Option<solana_program::pubkey::Pubkey>,
271    payment_feed_account: Option<solana_program::pubkey::Pubkey>,
272    payment_base_price_feed_account: Option<solana_program::pubkey::Pubkey>,
273    config_account: Option<solana_program::pubkey::Pubkey>,
274    associated_token_program: Option<solana_program::pubkey::Pubkey>,
275    token2022_program: Option<solana_program::pubkey::Pubkey>,
276    token_program: Option<solana_program::pubkey::Pubkey>,
277    system_program: Option<solana_program::pubkey::Pubkey>,
278    metadata_program: Option<solana_program::pubkey::Pubkey>,
279    sysvar_instructions: Option<solana_program::pubkey::Pubkey>,
280    payment_quote_price_feed_account: Option<solana_program::pubkey::Pubkey>,
281    amount: Option<u64>,
282    __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
283}
284
285impl CreatePurchaseOrderV2Builder {
286    pub fn new() -> Self {
287        Self::default()
288    }
289    #[inline(always)]
290    pub fn kyc_account(&mut self, kyc_account: solana_program::pubkey::Pubkey) -> &mut Self {
291        self.kyc_account = Some(kyc_account);
292        self
293    }
294    #[inline(always)]
295    pub fn user_wallet(&mut self, user_wallet: solana_program::pubkey::Pubkey) -> &mut Self {
296        self.user_wallet = Some(user_wallet);
297        self
298    }
299    #[inline(always)]
300    pub fn bond_account(&mut self, bond_account: solana_program::pubkey::Pubkey) -> &mut Self {
301        self.bond_account = Some(bond_account);
302        self
303    }
304    #[inline(always)]
305    pub fn issuance_account(
306        &mut self,
307        issuance_account: solana_program::pubkey::Pubkey,
308    ) -> &mut Self {
309        self.issuance_account = Some(issuance_account);
310        self
311    }
312    #[inline(always)]
313    pub fn payment_account(
314        &mut self,
315        payment_account: solana_program::pubkey::Pubkey,
316    ) -> &mut Self {
317        self.payment_account = Some(payment_account);
318        self
319    }
320    #[inline(always)]
321    pub fn payment_token_account(
322        &mut self,
323        payment_token_account: solana_program::pubkey::Pubkey,
324    ) -> &mut Self {
325        self.payment_token_account = Some(payment_token_account);
326        self
327    }
328    #[inline(always)]
329    pub fn user_payment_token_account(
330        &mut self,
331        user_payment_token_account: solana_program::pubkey::Pubkey,
332    ) -> &mut Self {
333        self.user_payment_token_account = Some(user_payment_token_account);
334        self
335    }
336    #[inline(always)]
337    pub fn user_nft_token_account(
338        &mut self,
339        user_nft_token_account: solana_program::pubkey::Pubkey,
340    ) -> &mut Self {
341        self.user_nft_token_account = Some(user_nft_token_account);
342        self
343    }
344    #[inline(always)]
345    pub fn nft_mint_account(
346        &mut self,
347        nft_mint_account: solana_program::pubkey::Pubkey,
348    ) -> &mut Self {
349        self.nft_mint_account = Some(nft_mint_account);
350        self
351    }
352    #[inline(always)]
353    pub fn nft_metadata_account(
354        &mut self,
355        nft_metadata_account: solana_program::pubkey::Pubkey,
356    ) -> &mut Self {
357        self.nft_metadata_account = Some(nft_metadata_account);
358        self
359    }
360    #[inline(always)]
361    pub fn nft_master_edition_account(
362        &mut self,
363        nft_master_edition_account: solana_program::pubkey::Pubkey,
364    ) -> &mut Self {
365        self.nft_master_edition_account = Some(nft_master_edition_account);
366        self
367    }
368    #[inline(always)]
369    pub fn purchase_order_vault_account(
370        &mut self,
371        purchase_order_vault_account: solana_program::pubkey::Pubkey,
372    ) -> &mut Self {
373        self.purchase_order_vault_account = Some(purchase_order_vault_account);
374        self
375    }
376    #[inline(always)]
377    pub fn nft_collection_mint(
378        &mut self,
379        nft_collection_mint: solana_program::pubkey::Pubkey,
380    ) -> &mut Self {
381        self.nft_collection_mint = Some(nft_collection_mint);
382        self
383    }
384    #[inline(always)]
385    pub fn nft_collection_metadata_account(
386        &mut self,
387        nft_collection_metadata_account: solana_program::pubkey::Pubkey,
388    ) -> &mut Self {
389        self.nft_collection_metadata_account = Some(nft_collection_metadata_account);
390        self
391    }
392    #[inline(always)]
393    pub fn nft_collection_master_edition_account(
394        &mut self,
395        nft_collection_master_edition_account: solana_program::pubkey::Pubkey,
396    ) -> &mut Self {
397        self.nft_collection_master_edition_account = Some(nft_collection_master_edition_account);
398        self
399    }
400    #[inline(always)]
401    pub fn payment_mint_account(
402        &mut self,
403        payment_mint_account: solana_program::pubkey::Pubkey,
404    ) -> &mut Self {
405        self.payment_mint_account = Some(payment_mint_account);
406        self
407    }
408    #[inline(always)]
409    pub fn payment_feed_account(
410        &mut self,
411        payment_feed_account: solana_program::pubkey::Pubkey,
412    ) -> &mut Self {
413        self.payment_feed_account = Some(payment_feed_account);
414        self
415    }
416    #[inline(always)]
417    pub fn payment_base_price_feed_account(
418        &mut self,
419        payment_base_price_feed_account: solana_program::pubkey::Pubkey,
420    ) -> &mut Self {
421        self.payment_base_price_feed_account = Some(payment_base_price_feed_account);
422        self
423    }
424    #[inline(always)]
425    pub fn config_account(&mut self, config_account: solana_program::pubkey::Pubkey) -> &mut Self {
426        self.config_account = Some(config_account);
427        self
428    }
429    #[inline(always)]
430    pub fn associated_token_program(
431        &mut self,
432        associated_token_program: solana_program::pubkey::Pubkey,
433    ) -> &mut Self {
434        self.associated_token_program = Some(associated_token_program);
435        self
436    }
437    #[inline(always)]
438    pub fn token2022_program(
439        &mut self,
440        token2022_program: solana_program::pubkey::Pubkey,
441    ) -> &mut Self {
442        self.token2022_program = Some(token2022_program);
443        self
444    }
445    /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']`
446    #[inline(always)]
447    pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self {
448        self.token_program = Some(token_program);
449        self
450    }
451    /// `[optional account, default to '11111111111111111111111111111111']`
452    #[inline(always)]
453    pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self {
454        self.system_program = Some(system_program);
455        self
456    }
457    #[inline(always)]
458    pub fn metadata_program(
459        &mut self,
460        metadata_program: solana_program::pubkey::Pubkey,
461    ) -> &mut Self {
462        self.metadata_program = Some(metadata_program);
463        self
464    }
465    /// `[optional account, default to 'Sysvar1nstructions1111111111111111111111111']`
466    #[inline(always)]
467    pub fn sysvar_instructions(
468        &mut self,
469        sysvar_instructions: solana_program::pubkey::Pubkey,
470    ) -> &mut Self {
471        self.sysvar_instructions = Some(sysvar_instructions);
472        self
473    }
474    /// `[optional account]`
475    #[inline(always)]
476    pub fn payment_quote_price_feed_account(
477        &mut self,
478        payment_quote_price_feed_account: Option<solana_program::pubkey::Pubkey>,
479    ) -> &mut Self {
480        self.payment_quote_price_feed_account = payment_quote_price_feed_account;
481        self
482    }
483    #[inline(always)]
484    pub fn amount(&mut self, amount: u64) -> &mut Self {
485        self.amount = Some(amount);
486        self
487    }
488    /// Add an aditional account to the instruction.
489    #[inline(always)]
490    pub fn add_remaining_account(
491        &mut self,
492        account: solana_program::instruction::AccountMeta,
493    ) -> &mut Self {
494        self.__remaining_accounts.push(account);
495        self
496    }
497    /// Add additional accounts to the instruction.
498    #[inline(always)]
499    pub fn add_remaining_accounts(
500        &mut self,
501        accounts: &[solana_program::instruction::AccountMeta],
502    ) -> &mut Self {
503        self.__remaining_accounts.extend_from_slice(accounts);
504        self
505    }
506    #[allow(clippy::clone_on_copy)]
507    pub fn instruction(&self) -> solana_program::instruction::Instruction {
508        let accounts = CreatePurchaseOrderV2 {
509            kyc_account: self.kyc_account.expect("kyc_account is not set"),
510            user_wallet: self.user_wallet.expect("user_wallet is not set"),
511            bond_account: self.bond_account.expect("bond_account is not set"),
512            issuance_account: self.issuance_account.expect("issuance_account is not set"),
513            payment_account: self.payment_account.expect("payment_account is not set"),
514            payment_token_account: self
515                .payment_token_account
516                .expect("payment_token_account is not set"),
517            user_payment_token_account: self
518                .user_payment_token_account
519                .expect("user_payment_token_account is not set"),
520            user_nft_token_account: self
521                .user_nft_token_account
522                .expect("user_nft_token_account is not set"),
523            nft_mint_account: self.nft_mint_account.expect("nft_mint_account is not set"),
524            nft_metadata_account: self
525                .nft_metadata_account
526                .expect("nft_metadata_account is not set"),
527            nft_master_edition_account: self
528                .nft_master_edition_account
529                .expect("nft_master_edition_account is not set"),
530            purchase_order_vault_account: self
531                .purchase_order_vault_account
532                .expect("purchase_order_vault_account is not set"),
533            nft_collection_mint: self
534                .nft_collection_mint
535                .expect("nft_collection_mint is not set"),
536            nft_collection_metadata_account: self
537                .nft_collection_metadata_account
538                .expect("nft_collection_metadata_account is not set"),
539            nft_collection_master_edition_account: self
540                .nft_collection_master_edition_account
541                .expect("nft_collection_master_edition_account is not set"),
542            payment_mint_account: self
543                .payment_mint_account
544                .expect("payment_mint_account is not set"),
545            payment_feed_account: self
546                .payment_feed_account
547                .expect("payment_feed_account is not set"),
548            payment_base_price_feed_account: self
549                .payment_base_price_feed_account
550                .expect("payment_base_price_feed_account is not set"),
551            config_account: self.config_account.expect("config_account is not set"),
552            associated_token_program: self
553                .associated_token_program
554                .expect("associated_token_program is not set"),
555            token2022_program: self
556                .token2022_program
557                .expect("token2022_program is not set"),
558            token_program: self.token_program.unwrap_or(solana_program::pubkey!(
559                "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
560            )),
561            system_program: self
562                .system_program
563                .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")),
564            metadata_program: self.metadata_program.expect("metadata_program is not set"),
565            sysvar_instructions: self.sysvar_instructions.unwrap_or(solana_program::pubkey!(
566                "Sysvar1nstructions1111111111111111111111111"
567            )),
568            payment_quote_price_feed_account: self.payment_quote_price_feed_account,
569        };
570        let args = CreatePurchaseOrderV2InstructionArgs {
571            amount: self.amount.clone().expect("amount is not set"),
572        };
573
574        accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
575    }
576}
577
578/// `create_purchase_order_v2` CPI accounts.
579pub struct CreatePurchaseOrderV2CpiAccounts<'a, 'b> {
580    pub kyc_account: &'b solana_program::account_info::AccountInfo<'a>,
581
582    pub user_wallet: &'b solana_program::account_info::AccountInfo<'a>,
583
584    pub bond_account: &'b solana_program::account_info::AccountInfo<'a>,
585
586    pub issuance_account: &'b solana_program::account_info::AccountInfo<'a>,
587
588    pub payment_account: &'b solana_program::account_info::AccountInfo<'a>,
589
590    pub payment_token_account: &'b solana_program::account_info::AccountInfo<'a>,
591
592    pub user_payment_token_account: &'b solana_program::account_info::AccountInfo<'a>,
593
594    pub user_nft_token_account: &'b solana_program::account_info::AccountInfo<'a>,
595
596    pub nft_mint_account: &'b solana_program::account_info::AccountInfo<'a>,
597
598    pub nft_metadata_account: &'b solana_program::account_info::AccountInfo<'a>,
599
600    pub nft_master_edition_account: &'b solana_program::account_info::AccountInfo<'a>,
601
602    pub purchase_order_vault_account: &'b solana_program::account_info::AccountInfo<'a>,
603
604    pub nft_collection_mint: &'b solana_program::account_info::AccountInfo<'a>,
605
606    pub nft_collection_metadata_account: &'b solana_program::account_info::AccountInfo<'a>,
607
608    pub nft_collection_master_edition_account: &'b solana_program::account_info::AccountInfo<'a>,
609
610    pub payment_mint_account: &'b solana_program::account_info::AccountInfo<'a>,
611
612    pub payment_feed_account: &'b solana_program::account_info::AccountInfo<'a>,
613
614    pub payment_base_price_feed_account: &'b solana_program::account_info::AccountInfo<'a>,
615
616    pub config_account: &'b solana_program::account_info::AccountInfo<'a>,
617
618    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
619
620    pub token2022_program: &'b solana_program::account_info::AccountInfo<'a>,
621
622    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
623
624    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
625
626    pub metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
627
628    pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
629
630    pub payment_quote_price_feed_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
631}
632
633/// `create_purchase_order_v2` CPI instruction.
634pub struct CreatePurchaseOrderV2Cpi<'a, 'b> {
635    /// The program to invoke.
636    pub __program: &'b solana_program::account_info::AccountInfo<'a>,
637
638    pub kyc_account: &'b solana_program::account_info::AccountInfo<'a>,
639
640    pub user_wallet: &'b solana_program::account_info::AccountInfo<'a>,
641
642    pub bond_account: &'b solana_program::account_info::AccountInfo<'a>,
643
644    pub issuance_account: &'b solana_program::account_info::AccountInfo<'a>,
645
646    pub payment_account: &'b solana_program::account_info::AccountInfo<'a>,
647
648    pub payment_token_account: &'b solana_program::account_info::AccountInfo<'a>,
649
650    pub user_payment_token_account: &'b solana_program::account_info::AccountInfo<'a>,
651
652    pub user_nft_token_account: &'b solana_program::account_info::AccountInfo<'a>,
653
654    pub nft_mint_account: &'b solana_program::account_info::AccountInfo<'a>,
655
656    pub nft_metadata_account: &'b solana_program::account_info::AccountInfo<'a>,
657
658    pub nft_master_edition_account: &'b solana_program::account_info::AccountInfo<'a>,
659
660    pub purchase_order_vault_account: &'b solana_program::account_info::AccountInfo<'a>,
661
662    pub nft_collection_mint: &'b solana_program::account_info::AccountInfo<'a>,
663
664    pub nft_collection_metadata_account: &'b solana_program::account_info::AccountInfo<'a>,
665
666    pub nft_collection_master_edition_account: &'b solana_program::account_info::AccountInfo<'a>,
667
668    pub payment_mint_account: &'b solana_program::account_info::AccountInfo<'a>,
669
670    pub payment_feed_account: &'b solana_program::account_info::AccountInfo<'a>,
671
672    pub payment_base_price_feed_account: &'b solana_program::account_info::AccountInfo<'a>,
673
674    pub config_account: &'b solana_program::account_info::AccountInfo<'a>,
675
676    pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
677
678    pub token2022_program: &'b solana_program::account_info::AccountInfo<'a>,
679
680    pub token_program: &'b solana_program::account_info::AccountInfo<'a>,
681
682    pub system_program: &'b solana_program::account_info::AccountInfo<'a>,
683
684    pub metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
685
686    pub sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
687
688    pub payment_quote_price_feed_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
689    /// The arguments for the instruction.
690    pub __args: CreatePurchaseOrderV2InstructionArgs,
691}
692
693impl<'a, 'b> CreatePurchaseOrderV2Cpi<'a, 'b> {
694    pub fn new(
695        program: &'b solana_program::account_info::AccountInfo<'a>,
696        accounts: CreatePurchaseOrderV2CpiAccounts<'a, 'b>,
697        args: CreatePurchaseOrderV2InstructionArgs,
698    ) -> Self {
699        Self {
700            __program: program,
701            kyc_account: accounts.kyc_account,
702            user_wallet: accounts.user_wallet,
703            bond_account: accounts.bond_account,
704            issuance_account: accounts.issuance_account,
705            payment_account: accounts.payment_account,
706            payment_token_account: accounts.payment_token_account,
707            user_payment_token_account: accounts.user_payment_token_account,
708            user_nft_token_account: accounts.user_nft_token_account,
709            nft_mint_account: accounts.nft_mint_account,
710            nft_metadata_account: accounts.nft_metadata_account,
711            nft_master_edition_account: accounts.nft_master_edition_account,
712            purchase_order_vault_account: accounts.purchase_order_vault_account,
713            nft_collection_mint: accounts.nft_collection_mint,
714            nft_collection_metadata_account: accounts.nft_collection_metadata_account,
715            nft_collection_master_edition_account: accounts.nft_collection_master_edition_account,
716            payment_mint_account: accounts.payment_mint_account,
717            payment_feed_account: accounts.payment_feed_account,
718            payment_base_price_feed_account: accounts.payment_base_price_feed_account,
719            config_account: accounts.config_account,
720            associated_token_program: accounts.associated_token_program,
721            token2022_program: accounts.token2022_program,
722            token_program: accounts.token_program,
723            system_program: accounts.system_program,
724            metadata_program: accounts.metadata_program,
725            sysvar_instructions: accounts.sysvar_instructions,
726            payment_quote_price_feed_account: accounts.payment_quote_price_feed_account,
727            __args: args,
728        }
729    }
730    #[inline(always)]
731    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
732        self.invoke_signed_with_remaining_accounts(&[], &[])
733    }
734    #[inline(always)]
735    pub fn invoke_with_remaining_accounts(
736        &self,
737        remaining_accounts: &[(
738            &'b solana_program::account_info::AccountInfo<'a>,
739            bool,
740            bool,
741        )],
742    ) -> solana_program::entrypoint::ProgramResult {
743        self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
744    }
745    #[inline(always)]
746    pub fn invoke_signed(
747        &self,
748        signers_seeds: &[&[&[u8]]],
749    ) -> solana_program::entrypoint::ProgramResult {
750        self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
751    }
752    #[allow(clippy::clone_on_copy)]
753    #[allow(clippy::vec_init_then_push)]
754    pub fn invoke_signed_with_remaining_accounts(
755        &self,
756        signers_seeds: &[&[&[u8]]],
757        remaining_accounts: &[(
758            &'b solana_program::account_info::AccountInfo<'a>,
759            bool,
760            bool,
761        )],
762    ) -> solana_program::entrypoint::ProgramResult {
763        let mut accounts = Vec::with_capacity(26 + remaining_accounts.len());
764        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
765            *self.kyc_account.key,
766            false,
767        ));
768        accounts.push(solana_program::instruction::AccountMeta::new(
769            *self.user_wallet.key,
770            true,
771        ));
772        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
773            *self.bond_account.key,
774            false,
775        ));
776        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
777            *self.issuance_account.key,
778            false,
779        ));
780        accounts.push(solana_program::instruction::AccountMeta::new(
781            *self.payment_account.key,
782            false,
783        ));
784        accounts.push(solana_program::instruction::AccountMeta::new(
785            *self.payment_token_account.key,
786            false,
787        ));
788        accounts.push(solana_program::instruction::AccountMeta::new(
789            *self.user_payment_token_account.key,
790            false,
791        ));
792        accounts.push(solana_program::instruction::AccountMeta::new(
793            *self.user_nft_token_account.key,
794            false,
795        ));
796        accounts.push(solana_program::instruction::AccountMeta::new(
797            *self.nft_mint_account.key,
798            true,
799        ));
800        accounts.push(solana_program::instruction::AccountMeta::new(
801            *self.nft_metadata_account.key,
802            false,
803        ));
804        accounts.push(solana_program::instruction::AccountMeta::new(
805            *self.nft_master_edition_account.key,
806            false,
807        ));
808        accounts.push(solana_program::instruction::AccountMeta::new(
809            *self.purchase_order_vault_account.key,
810            false,
811        ));
812        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
813            *self.nft_collection_mint.key,
814            false,
815        ));
816        accounts.push(solana_program::instruction::AccountMeta::new(
817            *self.nft_collection_metadata_account.key,
818            false,
819        ));
820        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
821            *self.nft_collection_master_edition_account.key,
822            false,
823        ));
824        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
825            *self.payment_mint_account.key,
826            false,
827        ));
828        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
829            *self.payment_feed_account.key,
830            false,
831        ));
832        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
833            *self.payment_base_price_feed_account.key,
834            false,
835        ));
836        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
837            *self.config_account.key,
838            false,
839        ));
840        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
841            *self.associated_token_program.key,
842            false,
843        ));
844        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
845            *self.token2022_program.key,
846            false,
847        ));
848        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
849            *self.token_program.key,
850            false,
851        ));
852        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
853            *self.system_program.key,
854            false,
855        ));
856        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
857            *self.metadata_program.key,
858            false,
859        ));
860        accounts.push(solana_program::instruction::AccountMeta::new_readonly(
861            *self.sysvar_instructions.key,
862            false,
863        ));
864        if let Some(payment_quote_price_feed_account) = self.payment_quote_price_feed_account {
865            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
866                *payment_quote_price_feed_account.key,
867                false,
868            ));
869        } else {
870            accounts.push(solana_program::instruction::AccountMeta::new_readonly(
871                crate::STABLEBOND_ID,
872                false,
873            ));
874        }
875        remaining_accounts.iter().for_each(|remaining_account| {
876            accounts.push(solana_program::instruction::AccountMeta {
877                pubkey: *remaining_account.0.key,
878                is_signer: remaining_account.1,
879                is_writable: remaining_account.2,
880            })
881        });
882        let mut data = CreatePurchaseOrderV2InstructionData::new()
883            .try_to_vec()
884            .unwrap();
885        let mut args = self.__args.try_to_vec().unwrap();
886        data.append(&mut args);
887
888        let instruction = solana_program::instruction::Instruction {
889            program_id: crate::STABLEBOND_ID,
890            accounts,
891            data,
892        };
893        let mut account_infos = Vec::with_capacity(26 + 1 + remaining_accounts.len());
894        account_infos.push(self.__program.clone());
895        account_infos.push(self.kyc_account.clone());
896        account_infos.push(self.user_wallet.clone());
897        account_infos.push(self.bond_account.clone());
898        account_infos.push(self.issuance_account.clone());
899        account_infos.push(self.payment_account.clone());
900        account_infos.push(self.payment_token_account.clone());
901        account_infos.push(self.user_payment_token_account.clone());
902        account_infos.push(self.user_nft_token_account.clone());
903        account_infos.push(self.nft_mint_account.clone());
904        account_infos.push(self.nft_metadata_account.clone());
905        account_infos.push(self.nft_master_edition_account.clone());
906        account_infos.push(self.purchase_order_vault_account.clone());
907        account_infos.push(self.nft_collection_mint.clone());
908        account_infos.push(self.nft_collection_metadata_account.clone());
909        account_infos.push(self.nft_collection_master_edition_account.clone());
910        account_infos.push(self.payment_mint_account.clone());
911        account_infos.push(self.payment_feed_account.clone());
912        account_infos.push(self.payment_base_price_feed_account.clone());
913        account_infos.push(self.config_account.clone());
914        account_infos.push(self.associated_token_program.clone());
915        account_infos.push(self.token2022_program.clone());
916        account_infos.push(self.token_program.clone());
917        account_infos.push(self.system_program.clone());
918        account_infos.push(self.metadata_program.clone());
919        account_infos.push(self.sysvar_instructions.clone());
920        if let Some(payment_quote_price_feed_account) = self.payment_quote_price_feed_account {
921            account_infos.push(payment_quote_price_feed_account.clone());
922        }
923        remaining_accounts
924            .iter()
925            .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
926
927        if signers_seeds.is_empty() {
928            solana_program::program::invoke(&instruction, &account_infos)
929        } else {
930            solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
931        }
932    }
933}
934
935/// Instruction builder for `CreatePurchaseOrderV2` via CPI.
936///
937/// ### Accounts:
938///
939///   0. `[]` kyc_account
940///   1. `[writable, signer]` user_wallet
941///   2. `[]` bond_account
942///   3. `[]` issuance_account
943///   4. `[writable]` payment_account
944///   5. `[writable]` payment_token_account
945///   6. `[writable]` user_payment_token_account
946///   7. `[writable]` user_nft_token_account
947///   8. `[writable, signer]` nft_mint_account
948///   9. `[writable]` nft_metadata_account
949///   10. `[writable]` nft_master_edition_account
950///   11. `[writable]` purchase_order_vault_account
951///   12. `[]` nft_collection_mint
952///   13. `[writable]` nft_collection_metadata_account
953///   14. `[]` nft_collection_master_edition_account
954///   15. `[]` payment_mint_account
955///   16. `[]` payment_feed_account
956///   17. `[]` payment_base_price_feed_account
957///   18. `[]` config_account
958///   19. `[]` associated_token_program
959///   20. `[]` token2022_program
960///   21. `[]` token_program
961///   22. `[]` system_program
962///   23. `[]` metadata_program
963///   24. `[]` sysvar_instructions
964///   25. `[optional]` payment_quote_price_feed_account
965pub struct CreatePurchaseOrderV2CpiBuilder<'a, 'b> {
966    instruction: Box<CreatePurchaseOrderV2CpiBuilderInstruction<'a, 'b>>,
967}
968
969impl<'a, 'b> CreatePurchaseOrderV2CpiBuilder<'a, 'b> {
970    pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
971        let instruction = Box::new(CreatePurchaseOrderV2CpiBuilderInstruction {
972            __program: program,
973            kyc_account: None,
974            user_wallet: None,
975            bond_account: None,
976            issuance_account: None,
977            payment_account: None,
978            payment_token_account: None,
979            user_payment_token_account: None,
980            user_nft_token_account: None,
981            nft_mint_account: None,
982            nft_metadata_account: None,
983            nft_master_edition_account: None,
984            purchase_order_vault_account: None,
985            nft_collection_mint: None,
986            nft_collection_metadata_account: None,
987            nft_collection_master_edition_account: None,
988            payment_mint_account: None,
989            payment_feed_account: None,
990            payment_base_price_feed_account: None,
991            config_account: None,
992            associated_token_program: None,
993            token2022_program: None,
994            token_program: None,
995            system_program: None,
996            metadata_program: None,
997            sysvar_instructions: None,
998            payment_quote_price_feed_account: None,
999            amount: None,
1000            __remaining_accounts: Vec::new(),
1001        });
1002        Self { instruction }
1003    }
1004    #[inline(always)]
1005    pub fn kyc_account(
1006        &mut self,
1007        kyc_account: &'b solana_program::account_info::AccountInfo<'a>,
1008    ) -> &mut Self {
1009        self.instruction.kyc_account = Some(kyc_account);
1010        self
1011    }
1012    #[inline(always)]
1013    pub fn user_wallet(
1014        &mut self,
1015        user_wallet: &'b solana_program::account_info::AccountInfo<'a>,
1016    ) -> &mut Self {
1017        self.instruction.user_wallet = Some(user_wallet);
1018        self
1019    }
1020    #[inline(always)]
1021    pub fn bond_account(
1022        &mut self,
1023        bond_account: &'b solana_program::account_info::AccountInfo<'a>,
1024    ) -> &mut Self {
1025        self.instruction.bond_account = Some(bond_account);
1026        self
1027    }
1028    #[inline(always)]
1029    pub fn issuance_account(
1030        &mut self,
1031        issuance_account: &'b solana_program::account_info::AccountInfo<'a>,
1032    ) -> &mut Self {
1033        self.instruction.issuance_account = Some(issuance_account);
1034        self
1035    }
1036    #[inline(always)]
1037    pub fn payment_account(
1038        &mut self,
1039        payment_account: &'b solana_program::account_info::AccountInfo<'a>,
1040    ) -> &mut Self {
1041        self.instruction.payment_account = Some(payment_account);
1042        self
1043    }
1044    #[inline(always)]
1045    pub fn payment_token_account(
1046        &mut self,
1047        payment_token_account: &'b solana_program::account_info::AccountInfo<'a>,
1048    ) -> &mut Self {
1049        self.instruction.payment_token_account = Some(payment_token_account);
1050        self
1051    }
1052    #[inline(always)]
1053    pub fn user_payment_token_account(
1054        &mut self,
1055        user_payment_token_account: &'b solana_program::account_info::AccountInfo<'a>,
1056    ) -> &mut Self {
1057        self.instruction.user_payment_token_account = Some(user_payment_token_account);
1058        self
1059    }
1060    #[inline(always)]
1061    pub fn user_nft_token_account(
1062        &mut self,
1063        user_nft_token_account: &'b solana_program::account_info::AccountInfo<'a>,
1064    ) -> &mut Self {
1065        self.instruction.user_nft_token_account = Some(user_nft_token_account);
1066        self
1067    }
1068    #[inline(always)]
1069    pub fn nft_mint_account(
1070        &mut self,
1071        nft_mint_account: &'b solana_program::account_info::AccountInfo<'a>,
1072    ) -> &mut Self {
1073        self.instruction.nft_mint_account = Some(nft_mint_account);
1074        self
1075    }
1076    #[inline(always)]
1077    pub fn nft_metadata_account(
1078        &mut self,
1079        nft_metadata_account: &'b solana_program::account_info::AccountInfo<'a>,
1080    ) -> &mut Self {
1081        self.instruction.nft_metadata_account = Some(nft_metadata_account);
1082        self
1083    }
1084    #[inline(always)]
1085    pub fn nft_master_edition_account(
1086        &mut self,
1087        nft_master_edition_account: &'b solana_program::account_info::AccountInfo<'a>,
1088    ) -> &mut Self {
1089        self.instruction.nft_master_edition_account = Some(nft_master_edition_account);
1090        self
1091    }
1092    #[inline(always)]
1093    pub fn purchase_order_vault_account(
1094        &mut self,
1095        purchase_order_vault_account: &'b solana_program::account_info::AccountInfo<'a>,
1096    ) -> &mut Self {
1097        self.instruction.purchase_order_vault_account = Some(purchase_order_vault_account);
1098        self
1099    }
1100    #[inline(always)]
1101    pub fn nft_collection_mint(
1102        &mut self,
1103        nft_collection_mint: &'b solana_program::account_info::AccountInfo<'a>,
1104    ) -> &mut Self {
1105        self.instruction.nft_collection_mint = Some(nft_collection_mint);
1106        self
1107    }
1108    #[inline(always)]
1109    pub fn nft_collection_metadata_account(
1110        &mut self,
1111        nft_collection_metadata_account: &'b solana_program::account_info::AccountInfo<'a>,
1112    ) -> &mut Self {
1113        self.instruction.nft_collection_metadata_account = Some(nft_collection_metadata_account);
1114        self
1115    }
1116    #[inline(always)]
1117    pub fn nft_collection_master_edition_account(
1118        &mut self,
1119        nft_collection_master_edition_account: &'b solana_program::account_info::AccountInfo<'a>,
1120    ) -> &mut Self {
1121        self.instruction.nft_collection_master_edition_account =
1122            Some(nft_collection_master_edition_account);
1123        self
1124    }
1125    #[inline(always)]
1126    pub fn payment_mint_account(
1127        &mut self,
1128        payment_mint_account: &'b solana_program::account_info::AccountInfo<'a>,
1129    ) -> &mut Self {
1130        self.instruction.payment_mint_account = Some(payment_mint_account);
1131        self
1132    }
1133    #[inline(always)]
1134    pub fn payment_feed_account(
1135        &mut self,
1136        payment_feed_account: &'b solana_program::account_info::AccountInfo<'a>,
1137    ) -> &mut Self {
1138        self.instruction.payment_feed_account = Some(payment_feed_account);
1139        self
1140    }
1141    #[inline(always)]
1142    pub fn payment_base_price_feed_account(
1143        &mut self,
1144        payment_base_price_feed_account: &'b solana_program::account_info::AccountInfo<'a>,
1145    ) -> &mut Self {
1146        self.instruction.payment_base_price_feed_account = Some(payment_base_price_feed_account);
1147        self
1148    }
1149    #[inline(always)]
1150    pub fn config_account(
1151        &mut self,
1152        config_account: &'b solana_program::account_info::AccountInfo<'a>,
1153    ) -> &mut Self {
1154        self.instruction.config_account = Some(config_account);
1155        self
1156    }
1157    #[inline(always)]
1158    pub fn associated_token_program(
1159        &mut self,
1160        associated_token_program: &'b solana_program::account_info::AccountInfo<'a>,
1161    ) -> &mut Self {
1162        self.instruction.associated_token_program = Some(associated_token_program);
1163        self
1164    }
1165    #[inline(always)]
1166    pub fn token2022_program(
1167        &mut self,
1168        token2022_program: &'b solana_program::account_info::AccountInfo<'a>,
1169    ) -> &mut Self {
1170        self.instruction.token2022_program = Some(token2022_program);
1171        self
1172    }
1173    #[inline(always)]
1174    pub fn token_program(
1175        &mut self,
1176        token_program: &'b solana_program::account_info::AccountInfo<'a>,
1177    ) -> &mut Self {
1178        self.instruction.token_program = Some(token_program);
1179        self
1180    }
1181    #[inline(always)]
1182    pub fn system_program(
1183        &mut self,
1184        system_program: &'b solana_program::account_info::AccountInfo<'a>,
1185    ) -> &mut Self {
1186        self.instruction.system_program = Some(system_program);
1187        self
1188    }
1189    #[inline(always)]
1190    pub fn metadata_program(
1191        &mut self,
1192        metadata_program: &'b solana_program::account_info::AccountInfo<'a>,
1193    ) -> &mut Self {
1194        self.instruction.metadata_program = Some(metadata_program);
1195        self
1196    }
1197    #[inline(always)]
1198    pub fn sysvar_instructions(
1199        &mut self,
1200        sysvar_instructions: &'b solana_program::account_info::AccountInfo<'a>,
1201    ) -> &mut Self {
1202        self.instruction.sysvar_instructions = Some(sysvar_instructions);
1203        self
1204    }
1205    /// `[optional account]`
1206    #[inline(always)]
1207    pub fn payment_quote_price_feed_account(
1208        &mut self,
1209        payment_quote_price_feed_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1210    ) -> &mut Self {
1211        self.instruction.payment_quote_price_feed_account = payment_quote_price_feed_account;
1212        self
1213    }
1214    #[inline(always)]
1215    pub fn amount(&mut self, amount: u64) -> &mut Self {
1216        self.instruction.amount = Some(amount);
1217        self
1218    }
1219    /// Add an additional account to the instruction.
1220    #[inline(always)]
1221    pub fn add_remaining_account(
1222        &mut self,
1223        account: &'b solana_program::account_info::AccountInfo<'a>,
1224        is_writable: bool,
1225        is_signer: bool,
1226    ) -> &mut Self {
1227        self.instruction
1228            .__remaining_accounts
1229            .push((account, is_writable, is_signer));
1230        self
1231    }
1232    /// Add additional accounts to the instruction.
1233    ///
1234    /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
1235    /// and a `bool` indicating whether the account is a signer or not.
1236    #[inline(always)]
1237    pub fn add_remaining_accounts(
1238        &mut self,
1239        accounts: &[(
1240            &'b solana_program::account_info::AccountInfo<'a>,
1241            bool,
1242            bool,
1243        )],
1244    ) -> &mut Self {
1245        self.instruction
1246            .__remaining_accounts
1247            .extend_from_slice(accounts);
1248        self
1249    }
1250    #[inline(always)]
1251    pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
1252        self.invoke_signed(&[])
1253    }
1254    #[allow(clippy::clone_on_copy)]
1255    #[allow(clippy::vec_init_then_push)]
1256    pub fn invoke_signed(
1257        &self,
1258        signers_seeds: &[&[&[u8]]],
1259    ) -> solana_program::entrypoint::ProgramResult {
1260        let args = CreatePurchaseOrderV2InstructionArgs {
1261            amount: self.instruction.amount.clone().expect("amount is not set"),
1262        };
1263        let instruction = CreatePurchaseOrderV2Cpi {
1264            __program: self.instruction.__program,
1265
1266            kyc_account: self
1267                .instruction
1268                .kyc_account
1269                .expect("kyc_account is not set"),
1270
1271            user_wallet: self
1272                .instruction
1273                .user_wallet
1274                .expect("user_wallet is not set"),
1275
1276            bond_account: self
1277                .instruction
1278                .bond_account
1279                .expect("bond_account is not set"),
1280
1281            issuance_account: self
1282                .instruction
1283                .issuance_account
1284                .expect("issuance_account is not set"),
1285
1286            payment_account: self
1287                .instruction
1288                .payment_account
1289                .expect("payment_account is not set"),
1290
1291            payment_token_account: self
1292                .instruction
1293                .payment_token_account
1294                .expect("payment_token_account is not set"),
1295
1296            user_payment_token_account: self
1297                .instruction
1298                .user_payment_token_account
1299                .expect("user_payment_token_account is not set"),
1300
1301            user_nft_token_account: self
1302                .instruction
1303                .user_nft_token_account
1304                .expect("user_nft_token_account is not set"),
1305
1306            nft_mint_account: self
1307                .instruction
1308                .nft_mint_account
1309                .expect("nft_mint_account is not set"),
1310
1311            nft_metadata_account: self
1312                .instruction
1313                .nft_metadata_account
1314                .expect("nft_metadata_account is not set"),
1315
1316            nft_master_edition_account: self
1317                .instruction
1318                .nft_master_edition_account
1319                .expect("nft_master_edition_account is not set"),
1320
1321            purchase_order_vault_account: self
1322                .instruction
1323                .purchase_order_vault_account
1324                .expect("purchase_order_vault_account is not set"),
1325
1326            nft_collection_mint: self
1327                .instruction
1328                .nft_collection_mint
1329                .expect("nft_collection_mint is not set"),
1330
1331            nft_collection_metadata_account: self
1332                .instruction
1333                .nft_collection_metadata_account
1334                .expect("nft_collection_metadata_account is not set"),
1335
1336            nft_collection_master_edition_account: self
1337                .instruction
1338                .nft_collection_master_edition_account
1339                .expect("nft_collection_master_edition_account is not set"),
1340
1341            payment_mint_account: self
1342                .instruction
1343                .payment_mint_account
1344                .expect("payment_mint_account is not set"),
1345
1346            payment_feed_account: self
1347                .instruction
1348                .payment_feed_account
1349                .expect("payment_feed_account is not set"),
1350
1351            payment_base_price_feed_account: self
1352                .instruction
1353                .payment_base_price_feed_account
1354                .expect("payment_base_price_feed_account is not set"),
1355
1356            config_account: self
1357                .instruction
1358                .config_account
1359                .expect("config_account is not set"),
1360
1361            associated_token_program: self
1362                .instruction
1363                .associated_token_program
1364                .expect("associated_token_program is not set"),
1365
1366            token2022_program: self
1367                .instruction
1368                .token2022_program
1369                .expect("token2022_program is not set"),
1370
1371            token_program: self
1372                .instruction
1373                .token_program
1374                .expect("token_program is not set"),
1375
1376            system_program: self
1377                .instruction
1378                .system_program
1379                .expect("system_program is not set"),
1380
1381            metadata_program: self
1382                .instruction
1383                .metadata_program
1384                .expect("metadata_program is not set"),
1385
1386            sysvar_instructions: self
1387                .instruction
1388                .sysvar_instructions
1389                .expect("sysvar_instructions is not set"),
1390
1391            payment_quote_price_feed_account: self.instruction.payment_quote_price_feed_account,
1392            __args: args,
1393        };
1394        instruction.invoke_signed_with_remaining_accounts(
1395            signers_seeds,
1396            &self.instruction.__remaining_accounts,
1397        )
1398    }
1399}
1400
1401struct CreatePurchaseOrderV2CpiBuilderInstruction<'a, 'b> {
1402    __program: &'b solana_program::account_info::AccountInfo<'a>,
1403    kyc_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1404    user_wallet: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1405    bond_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1406    issuance_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1407    payment_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1408    payment_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1409    user_payment_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1410    user_nft_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1411    nft_mint_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1412    nft_metadata_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1413    nft_master_edition_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1414    purchase_order_vault_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1415    nft_collection_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1416    nft_collection_metadata_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1417    nft_collection_master_edition_account:
1418        Option<&'b solana_program::account_info::AccountInfo<'a>>,
1419    payment_mint_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1420    payment_feed_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1421    payment_base_price_feed_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1422    config_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1423    associated_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1424    token2022_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1425    token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1426    system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1427    metadata_program: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1428    sysvar_instructions: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1429    payment_quote_price_feed_account: Option<&'b solana_program::account_info::AccountInfo<'a>>,
1430    amount: Option<u64>,
1431    /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
1432    __remaining_accounts: Vec<(
1433        &'b solana_program::account_info::AccountInfo<'a>,
1434        bool,
1435        bool,
1436    )>,
1437}