tensor_marketplace/generated/instructions/
tcomp_noop.rs1use crate::generated::types::TcompEvent;
9use borsh::BorshDeserialize;
10use borsh::BorshSerialize;
11
12pub struct TcompNoop {
14 pub tcomp_signer: solana_program::pubkey::Pubkey,
15}
16
17impl TcompNoop {
18 pub fn instruction(
19 &self,
20 args: TcompNoopInstructionArgs,
21 ) -> solana_program::instruction::Instruction {
22 self.instruction_with_remaining_accounts(args, &[])
23 }
24 #[allow(clippy::vec_init_then_push)]
25 pub fn instruction_with_remaining_accounts(
26 &self,
27 args: TcompNoopInstructionArgs,
28 remaining_accounts: &[solana_program::instruction::AccountMeta],
29 ) -> solana_program::instruction::Instruction {
30 let mut accounts = Vec::with_capacity(1 + remaining_accounts.len());
31 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
32 self.tcomp_signer,
33 true,
34 ));
35 accounts.extend_from_slice(remaining_accounts);
36 let mut data = TcompNoopInstructionData::new().try_to_vec().unwrap();
37 let mut args = args.try_to_vec().unwrap();
38 data.append(&mut args);
39
40 solana_program::instruction::Instruction {
41 program_id: crate::TENSOR_MARKETPLACE_ID,
42 accounts,
43 data,
44 }
45 }
46}
47
48#[derive(BorshDeserialize, BorshSerialize)]
49pub struct TcompNoopInstructionData {
50 discriminator: [u8; 8],
51}
52
53impl TcompNoopInstructionData {
54 pub fn new() -> Self {
55 Self {
56 discriminator: [106, 162, 10, 226, 132, 68, 223, 21],
57 }
58 }
59}
60
61impl Default for TcompNoopInstructionData {
62 fn default() -> Self {
63 Self::new()
64 }
65}
66
67#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
68#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
69pub struct TcompNoopInstructionArgs {
70 pub event: TcompEvent,
71}
72
73#[derive(Clone, Debug, Default)]
79pub struct TcompNoopBuilder {
80 tcomp_signer: Option<solana_program::pubkey::Pubkey>,
81 event: Option<TcompEvent>,
82 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
83}
84
85impl TcompNoopBuilder {
86 pub fn new() -> Self {
87 Self::default()
88 }
89 #[inline(always)]
90 pub fn tcomp_signer(&mut self, tcomp_signer: solana_program::pubkey::Pubkey) -> &mut Self {
91 self.tcomp_signer = Some(tcomp_signer);
92 self
93 }
94 #[inline(always)]
95 pub fn event(&mut self, event: TcompEvent) -> &mut Self {
96 self.event = Some(event);
97 self
98 }
99 #[inline(always)]
101 pub fn add_remaining_account(
102 &mut self,
103 account: solana_program::instruction::AccountMeta,
104 ) -> &mut Self {
105 self.__remaining_accounts.push(account);
106 self
107 }
108 #[inline(always)]
110 pub fn add_remaining_accounts(
111 &mut self,
112 accounts: &[solana_program::instruction::AccountMeta],
113 ) -> &mut Self {
114 self.__remaining_accounts.extend_from_slice(accounts);
115 self
116 }
117 #[allow(clippy::clone_on_copy)]
118 pub fn instruction(&self) -> solana_program::instruction::Instruction {
119 let accounts = TcompNoop {
120 tcomp_signer: self.tcomp_signer.expect("tcomp_signer is not set"),
121 };
122 let args = TcompNoopInstructionArgs {
123 event: self.event.clone().expect("event is not set"),
124 };
125
126 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
127 }
128}
129
130pub struct TcompNoopCpiAccounts<'a, 'b> {
132 pub tcomp_signer: &'b solana_program::account_info::AccountInfo<'a>,
133}
134
135pub struct TcompNoopCpi<'a, 'b> {
137 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
139
140 pub tcomp_signer: &'b solana_program::account_info::AccountInfo<'a>,
141 pub __args: TcompNoopInstructionArgs,
143}
144
145impl<'a, 'b> TcompNoopCpi<'a, 'b> {
146 pub fn new(
147 program: &'b solana_program::account_info::AccountInfo<'a>,
148 accounts: TcompNoopCpiAccounts<'a, 'b>,
149 args: TcompNoopInstructionArgs,
150 ) -> Self {
151 Self {
152 __program: program,
153 tcomp_signer: accounts.tcomp_signer,
154 __args: args,
155 }
156 }
157 #[inline(always)]
158 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
159 self.invoke_signed_with_remaining_accounts(&[], &[])
160 }
161 #[inline(always)]
162 pub fn invoke_with_remaining_accounts(
163 &self,
164 remaining_accounts: &[(
165 &'b solana_program::account_info::AccountInfo<'a>,
166 bool,
167 bool,
168 )],
169 ) -> solana_program::entrypoint::ProgramResult {
170 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
171 }
172 #[inline(always)]
173 pub fn invoke_signed(
174 &self,
175 signers_seeds: &[&[&[u8]]],
176 ) -> solana_program::entrypoint::ProgramResult {
177 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
178 }
179 #[allow(clippy::clone_on_copy)]
180 #[allow(clippy::vec_init_then_push)]
181 pub fn invoke_signed_with_remaining_accounts(
182 &self,
183 signers_seeds: &[&[&[u8]]],
184 remaining_accounts: &[(
185 &'b solana_program::account_info::AccountInfo<'a>,
186 bool,
187 bool,
188 )],
189 ) -> solana_program::entrypoint::ProgramResult {
190 let mut accounts = Vec::with_capacity(1 + remaining_accounts.len());
191 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
192 *self.tcomp_signer.key,
193 true,
194 ));
195 remaining_accounts.iter().for_each(|remaining_account| {
196 accounts.push(solana_program::instruction::AccountMeta {
197 pubkey: *remaining_account.0.key,
198 is_signer: remaining_account.1,
199 is_writable: remaining_account.2,
200 })
201 });
202 let mut data = TcompNoopInstructionData::new().try_to_vec().unwrap();
203 let mut args = self.__args.try_to_vec().unwrap();
204 data.append(&mut args);
205
206 let instruction = solana_program::instruction::Instruction {
207 program_id: crate::TENSOR_MARKETPLACE_ID,
208 accounts,
209 data,
210 };
211 let mut account_infos = Vec::with_capacity(1 + 1 + remaining_accounts.len());
212 account_infos.push(self.__program.clone());
213 account_infos.push(self.tcomp_signer.clone());
214 remaining_accounts
215 .iter()
216 .for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
217
218 if signers_seeds.is_empty() {
219 solana_program::program::invoke(&instruction, &account_infos)
220 } else {
221 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
222 }
223 }
224}
225
226#[derive(Clone, Debug)]
232pub struct TcompNoopCpiBuilder<'a, 'b> {
233 instruction: Box<TcompNoopCpiBuilderInstruction<'a, 'b>>,
234}
235
236impl<'a, 'b> TcompNoopCpiBuilder<'a, 'b> {
237 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
238 let instruction = Box::new(TcompNoopCpiBuilderInstruction {
239 __program: program,
240 tcomp_signer: None,
241 event: None,
242 __remaining_accounts: Vec::new(),
243 });
244 Self { instruction }
245 }
246 #[inline(always)]
247 pub fn tcomp_signer(
248 &mut self,
249 tcomp_signer: &'b solana_program::account_info::AccountInfo<'a>,
250 ) -> &mut Self {
251 self.instruction.tcomp_signer = Some(tcomp_signer);
252 self
253 }
254 #[inline(always)]
255 pub fn event(&mut self, event: TcompEvent) -> &mut Self {
256 self.instruction.event = Some(event);
257 self
258 }
259 #[inline(always)]
261 pub fn add_remaining_account(
262 &mut self,
263 account: &'b solana_program::account_info::AccountInfo<'a>,
264 is_writable: bool,
265 is_signer: bool,
266 ) -> &mut Self {
267 self.instruction
268 .__remaining_accounts
269 .push((account, is_writable, is_signer));
270 self
271 }
272 #[inline(always)]
277 pub fn add_remaining_accounts(
278 &mut self,
279 accounts: &[(
280 &'b solana_program::account_info::AccountInfo<'a>,
281 bool,
282 bool,
283 )],
284 ) -> &mut Self {
285 self.instruction
286 .__remaining_accounts
287 .extend_from_slice(accounts);
288 self
289 }
290 #[inline(always)]
291 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
292 self.invoke_signed(&[])
293 }
294 #[allow(clippy::clone_on_copy)]
295 #[allow(clippy::vec_init_then_push)]
296 pub fn invoke_signed(
297 &self,
298 signers_seeds: &[&[&[u8]]],
299 ) -> solana_program::entrypoint::ProgramResult {
300 let args = TcompNoopInstructionArgs {
301 event: self.instruction.event.clone().expect("event is not set"),
302 };
303 let instruction = TcompNoopCpi {
304 __program: self.instruction.__program,
305
306 tcomp_signer: self
307 .instruction
308 .tcomp_signer
309 .expect("tcomp_signer is not set"),
310 __args: args,
311 };
312 instruction.invoke_signed_with_remaining_accounts(
313 signers_seeds,
314 &self.instruction.__remaining_accounts,
315 )
316 }
317}
318
319#[derive(Clone, Debug)]
320struct TcompNoopCpiBuilderInstruction<'a, 'b> {
321 __program: &'b solana_program::account_info::AccountInfo<'a>,
322 tcomp_signer: Option<&'b solana_program::account_info::AccountInfo<'a>>,
323 event: Option<TcompEvent>,
324 __remaining_accounts: Vec<(
326 &'b solana_program::account_info::AccountInfo<'a>,
327 bool,
328 bool,
329 )>,
330}