Skip to main content

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