commerce_program_client/generated/instructions/
refund_payment.rs

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