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