fusionamm_client/generated/instructions/
set_limit_order_protocol_fee_rate.rs1use borsh::BorshSerialize;
9use borsh::BorshDeserialize;
10
11#[derive(Debug)]
13pub struct SetLimitOrderProtocolFeeRate {
14
15
16 pub fusion_pools_config: solana_program::pubkey::Pubkey,
17
18
19 pub fusion_pool: solana_program::pubkey::Pubkey,
20
21
22 pub fee_authority: solana_program::pubkey::Pubkey,
23 }
24
25impl SetLimitOrderProtocolFeeRate {
26 pub fn instruction(&self, args: SetLimitOrderProtocolFeeRateInstructionArgs) -> solana_program::instruction::Instruction {
27 self.instruction_with_remaining_accounts(args, &[])
28 }
29 #[allow(clippy::arithmetic_side_effects)]
30 #[allow(clippy::vec_init_then_push)]
31 pub fn instruction_with_remaining_accounts(&self, args: SetLimitOrderProtocolFeeRateInstructionArgs, remaining_accounts: &[solana_program::instruction::AccountMeta]) -> solana_program::instruction::Instruction {
32 let mut accounts = Vec::with_capacity(3+ remaining_accounts.len());
33 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
34 self.fusion_pools_config,
35 false
36 ));
37 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
38 self.fusion_pool,
39 false
40 ));
41 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
42 self.fee_authority,
43 true
44 ));
45 accounts.extend_from_slice(remaining_accounts);
46 let mut data = borsh::to_vec(&SetLimitOrderProtocolFeeRateInstructionData::new()).unwrap();
47 let mut args = borsh::to_vec(&args).unwrap();
48 data.append(&mut args);
49
50 solana_program::instruction::Instruction {
51 program_id: crate::FUSIONAMM_ID,
52 accounts,
53 data,
54 }
55 }
56}
57
58#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
59#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
60 pub struct SetLimitOrderProtocolFeeRateInstructionData {
61 discriminator: [u8; 8],
62 }
63
64impl SetLimitOrderProtocolFeeRateInstructionData {
65 pub fn new() -> Self {
66 Self {
67 discriminator: [208, 200, 255, 4, 18, 137, 43, 173],
68 }
69 }
70}
71
72impl Default for SetLimitOrderProtocolFeeRateInstructionData {
73 fn default() -> Self {
74 Self::new()
75 }
76}
77
78#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
79#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
80 pub struct SetLimitOrderProtocolFeeRateInstructionArgs {
81 pub order_protocol_fee_rate: u16,
82 }
83
84
85#[derive(Clone, Debug, Default)]
93pub struct SetLimitOrderProtocolFeeRateBuilder {
94 fusion_pools_config: Option<solana_program::pubkey::Pubkey>,
95 fusion_pool: Option<solana_program::pubkey::Pubkey>,
96 fee_authority: Option<solana_program::pubkey::Pubkey>,
97 order_protocol_fee_rate: Option<u16>,
98 __remaining_accounts: Vec<solana_program::instruction::AccountMeta>,
99}
100
101impl SetLimitOrderProtocolFeeRateBuilder {
102 pub fn new() -> Self {
103 Self::default()
104 }
105 #[inline(always)]
106 pub fn fusion_pools_config(&mut self, fusion_pools_config: solana_program::pubkey::Pubkey) -> &mut Self {
107 self.fusion_pools_config = Some(fusion_pools_config);
108 self
109 }
110 #[inline(always)]
111 pub fn fusion_pool(&mut self, fusion_pool: solana_program::pubkey::Pubkey) -> &mut Self {
112 self.fusion_pool = Some(fusion_pool);
113 self
114 }
115 #[inline(always)]
116 pub fn fee_authority(&mut self, fee_authority: solana_program::pubkey::Pubkey) -> &mut Self {
117 self.fee_authority = Some(fee_authority);
118 self
119 }
120 #[inline(always)]
121 pub fn order_protocol_fee_rate(&mut self, order_protocol_fee_rate: u16) -> &mut Self {
122 self.order_protocol_fee_rate = Some(order_protocol_fee_rate);
123 self
124 }
125 #[inline(always)]
127 pub fn add_remaining_account(&mut self, account: solana_program::instruction::AccountMeta) -> &mut Self {
128 self.__remaining_accounts.push(account);
129 self
130 }
131 #[inline(always)]
133 pub fn add_remaining_accounts(&mut self, accounts: &[solana_program::instruction::AccountMeta]) -> &mut Self {
134 self.__remaining_accounts.extend_from_slice(accounts);
135 self
136 }
137 #[allow(clippy::clone_on_copy)]
138 pub fn instruction(&self) -> solana_program::instruction::Instruction {
139 let accounts = SetLimitOrderProtocolFeeRate {
140 fusion_pools_config: self.fusion_pools_config.expect("fusion_pools_config is not set"),
141 fusion_pool: self.fusion_pool.expect("fusion_pool is not set"),
142 fee_authority: self.fee_authority.expect("fee_authority is not set"),
143 };
144 let args = SetLimitOrderProtocolFeeRateInstructionArgs {
145 order_protocol_fee_rate: self.order_protocol_fee_rate.clone().expect("order_protocol_fee_rate is not set"),
146 };
147
148 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
149 }
150}
151
152 pub struct SetLimitOrderProtocolFeeRateCpiAccounts<'a, 'b> {
154
155
156 pub fusion_pools_config: &'b solana_program::account_info::AccountInfo<'a>,
157
158
159 pub fusion_pool: &'b solana_program::account_info::AccountInfo<'a>,
160
161
162 pub fee_authority: &'b solana_program::account_info::AccountInfo<'a>,
163 }
164
165pub struct SetLimitOrderProtocolFeeRateCpi<'a, 'b> {
167 pub __program: &'b solana_program::account_info::AccountInfo<'a>,
169
170
171 pub fusion_pools_config: &'b solana_program::account_info::AccountInfo<'a>,
172
173
174 pub fusion_pool: &'b solana_program::account_info::AccountInfo<'a>,
175
176
177 pub fee_authority: &'b solana_program::account_info::AccountInfo<'a>,
178 pub __args: SetLimitOrderProtocolFeeRateInstructionArgs,
180 }
181
182impl<'a, 'b> SetLimitOrderProtocolFeeRateCpi<'a, 'b> {
183 pub fn new(
184 program: &'b solana_program::account_info::AccountInfo<'a>,
185 accounts: SetLimitOrderProtocolFeeRateCpiAccounts<'a, 'b>,
186 args: SetLimitOrderProtocolFeeRateInstructionArgs,
187 ) -> Self {
188 Self {
189 __program: program,
190 fusion_pools_config: accounts.fusion_pools_config,
191 fusion_pool: accounts.fusion_pool,
192 fee_authority: accounts.fee_authority,
193 __args: args,
194 }
195 }
196 #[inline(always)]
197 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
198 self.invoke_signed_with_remaining_accounts(&[], &[])
199 }
200 #[inline(always)]
201 pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)]) -> solana_program::entrypoint::ProgramResult {
202 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
203 }
204 #[inline(always)]
205 pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program::entrypoint::ProgramResult {
206 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
207 }
208 #[allow(clippy::arithmetic_side_effects)]
209 #[allow(clippy::clone_on_copy)]
210 #[allow(clippy::vec_init_then_push)]
211 pub fn invoke_signed_with_remaining_accounts(
212 &self,
213 signers_seeds: &[&[&[u8]]],
214 remaining_accounts: &[(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)]
215 ) -> solana_program::entrypoint::ProgramResult {
216 let mut accounts = Vec::with_capacity(3+ remaining_accounts.len());
217 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
218 *self.fusion_pools_config.key,
219 false
220 ));
221 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
222 *self.fusion_pool.key,
223 false
224 ));
225 accounts.push(solana_program::instruction::AccountMeta::new_readonly(
226 *self.fee_authority.key,
227 true
228 ));
229 remaining_accounts.iter().for_each(|remaining_account| {
230 accounts.push(solana_program::instruction::AccountMeta {
231 pubkey: *remaining_account.0.key,
232 is_signer: remaining_account.1,
233 is_writable: remaining_account.2,
234 })
235 });
236 let mut data = borsh::to_vec(&SetLimitOrderProtocolFeeRateInstructionData::new()).unwrap();
237 let mut args = borsh::to_vec(&self.__args).unwrap();
238 data.append(&mut args);
239
240 let instruction = solana_program::instruction::Instruction {
241 program_id: crate::FUSIONAMM_ID,
242 accounts,
243 data,
244 };
245 let mut account_infos = Vec::with_capacity(4 + remaining_accounts.len());
246 account_infos.push(self.__program.clone());
247 account_infos.push(self.fusion_pools_config.clone());
248 account_infos.push(self.fusion_pool.clone());
249 account_infos.push(self.fee_authority.clone());
250 remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
251
252 if signers_seeds.is_empty() {
253 solana_program::program::invoke(&instruction, &account_infos)
254 } else {
255 solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds)
256 }
257 }
258}
259
260#[derive(Clone, Debug)]
268pub struct SetLimitOrderProtocolFeeRateCpiBuilder<'a, 'b> {
269 instruction: Box<SetLimitOrderProtocolFeeRateCpiBuilderInstruction<'a, 'b>>,
270}
271
272impl<'a, 'b> SetLimitOrderProtocolFeeRateCpiBuilder<'a, 'b> {
273 pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self {
274 let instruction = Box::new(SetLimitOrderProtocolFeeRateCpiBuilderInstruction {
275 __program: program,
276 fusion_pools_config: None,
277 fusion_pool: None,
278 fee_authority: None,
279 order_protocol_fee_rate: None,
280 __remaining_accounts: Vec::new(),
281 });
282 Self { instruction }
283 }
284 #[inline(always)]
285 pub fn fusion_pools_config(&mut self, fusion_pools_config: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
286 self.instruction.fusion_pools_config = Some(fusion_pools_config);
287 self
288 }
289 #[inline(always)]
290 pub fn fusion_pool(&mut self, fusion_pool: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
291 self.instruction.fusion_pool = Some(fusion_pool);
292 self
293 }
294 #[inline(always)]
295 pub fn fee_authority(&mut self, fee_authority: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self {
296 self.instruction.fee_authority = Some(fee_authority);
297 self
298 }
299 #[inline(always)]
300 pub fn order_protocol_fee_rate(&mut self, order_protocol_fee_rate: u16) -> &mut Self {
301 self.instruction.order_protocol_fee_rate = Some(order_protocol_fee_rate);
302 self
303 }
304 #[inline(always)]
306 pub fn add_remaining_account(&mut self, account: &'b solana_program::account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
307 self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
308 self
309 }
310 #[inline(always)]
315 pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
316 self.instruction.__remaining_accounts.extend_from_slice(accounts);
317 self
318 }
319 #[inline(always)]
320 pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult {
321 self.invoke_signed(&[])
322 }
323 #[allow(clippy::clone_on_copy)]
324 #[allow(clippy::vec_init_then_push)]
325 pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program::entrypoint::ProgramResult {
326 let args = SetLimitOrderProtocolFeeRateInstructionArgs {
327 order_protocol_fee_rate: self.instruction.order_protocol_fee_rate.clone().expect("order_protocol_fee_rate is not set"),
328 };
329 let instruction = SetLimitOrderProtocolFeeRateCpi {
330 __program: self.instruction.__program,
331
332 fusion_pools_config: self.instruction.fusion_pools_config.expect("fusion_pools_config is not set"),
333
334 fusion_pool: self.instruction.fusion_pool.expect("fusion_pool is not set"),
335
336 fee_authority: self.instruction.fee_authority.expect("fee_authority is not set"),
337 __args: args,
338 };
339 instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
340 }
341}
342
343#[derive(Clone, Debug)]
344struct SetLimitOrderProtocolFeeRateCpiBuilderInstruction<'a, 'b> {
345 __program: &'b solana_program::account_info::AccountInfo<'a>,
346 fusion_pools_config: Option<&'b solana_program::account_info::AccountInfo<'a>>,
347 fusion_pool: Option<&'b solana_program::account_info::AccountInfo<'a>>,
348 fee_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
349 order_protocol_fee_rate: Option<u16>,
350 __remaining_accounts: Vec<(&'b solana_program::account_info::AccountInfo<'a>, bool, bool)>,
352}
353