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