carbon_crafting_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::CraftingDecoder;
3use crate::PROGRAM_ID;
4
5pub mod add_consumable_input_to_recipe;
6pub mod add_crafting_facility_recipe_category;
7pub mod add_non_consumable_input_to_recipe;
8pub mod add_output_to_recipe;
9pub mod add_recipe_ingredient;
10pub mod burn_consumable_ingredient;
11pub mod cancel_crafting_process;
12pub mod claim_non_consumable_ingredient;
13pub mod claim_recipe_output;
14pub mod close_crafting_process;
15pub mod create_crafting_process;
16pub mod deregister_crafting_facility;
17pub mod deregister_recipe_category;
18pub mod drain_craftable_item_bank;
19pub mod initialize_domain;
20pub mod legitimize_recipe_ingredient;
21pub mod register_craftable_item;
22pub mod register_crafting_facility;
23pub mod register_recipe;
24pub mod register_recipe_category;
25pub mod remove_consumable_input_from_recipe;
26pub mod remove_crafting_facility_recipe_category;
27pub mod remove_non_consumable_input_from_recipe;
28pub mod remove_output_from_recipe;
29pub mod remove_recipe_ingredient;
30pub mod start_crafting_process;
31pub mod stop_crafting_process;
32pub mod update_crafting_facility;
33pub mod update_domain;
34pub mod update_recipe;
35pub mod update_recipe_category;
36
37pub use self::add_consumable_input_to_recipe::*;
38pub use self::add_crafting_facility_recipe_category::*;
39pub use self::add_non_consumable_input_to_recipe::*;
40pub use self::add_output_to_recipe::*;
41pub use self::add_recipe_ingredient::*;
42pub use self::burn_consumable_ingredient::*;
43pub use self::cancel_crafting_process::*;
44pub use self::claim_non_consumable_ingredient::*;
45pub use self::claim_recipe_output::*;
46pub use self::close_crafting_process::*;
47pub use self::create_crafting_process::*;
48pub use self::deregister_crafting_facility::*;
49pub use self::deregister_recipe_category::*;
50pub use self::drain_craftable_item_bank::*;
51pub use self::initialize_domain::*;
52pub use self::legitimize_recipe_ingredient::*;
53pub use self::register_craftable_item::*;
54pub use self::register_crafting_facility::*;
55pub use self::register_recipe::*;
56pub use self::register_recipe_category::*;
57pub use self::remove_consumable_input_from_recipe::*;
58pub use self::remove_crafting_facility_recipe_category::*;
59pub use self::remove_non_consumable_input_from_recipe::*;
60pub use self::remove_output_from_recipe::*;
61pub use self::remove_recipe_ingredient::*;
62pub use self::start_crafting_process::*;
63pub use self::stop_crafting_process::*;
64pub use self::update_crafting_facility::*;
65pub use self::update_domain::*;
66pub use self::update_recipe::*;
67pub use self::update_recipe_category::*;
68
69#[derive(Debug, Clone, PartialEq, Eq, Hash)]
70#[cfg_attr(
71    feature = "serde",
72    derive(carbon_core::InstructionType, serde::Serialize, serde::Deserialize)
73)]
74#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
75pub enum CraftingInstruction {
76    AddConsumableInputToRecipe(AddConsumableInputToRecipe),
77    AddCraftingFacilityRecipeCategory(AddCraftingFacilityRecipeCategory),
78    AddNonConsumableInputToRecipe(AddNonConsumableInputToRecipe),
79    AddOutputToRecipe(AddOutputToRecipe),
80    AddRecipeIngredient(AddRecipeIngredient),
81    BurnConsumableIngredient(BurnConsumableIngredient),
82    CancelCraftingProcess(CancelCraftingProcess),
83    ClaimNonConsumableIngredient(ClaimNonConsumableIngredient),
84    ClaimRecipeOutput(ClaimRecipeOutput),
85    CloseCraftingProcess(CloseCraftingProcess),
86    CreateCraftingProcess(CreateCraftingProcess),
87    DeregisterCraftingFacility(DeregisterCraftingFacility),
88    DeregisterRecipeCategory(DeregisterRecipeCategory),
89    DrainCraftableItemBank(DrainCraftableItemBank),
90    InitializeDomain(InitializeDomain),
91    LegitimizeRecipeIngredient(LegitimizeRecipeIngredient),
92    RegisterCraftableItem(RegisterCraftableItem),
93    RegisterCraftingFacility(RegisterCraftingFacility),
94    RegisterRecipe(RegisterRecipe),
95    RegisterRecipeCategory(RegisterRecipeCategory),
96    RemoveConsumableInputFromRecipe(RemoveConsumableInputFromRecipe),
97    RemoveCraftingFacilityRecipeCategory(RemoveCraftingFacilityRecipeCategory),
98    RemoveNonConsumableInputFromRecipe(RemoveNonConsumableInputFromRecipe),
99    RemoveOutputFromRecipe(RemoveOutputFromRecipe),
100    RemoveRecipeIngredient(RemoveRecipeIngredient),
101    StartCraftingProcess(StartCraftingProcess),
102    StopCraftingProcess(StopCraftingProcess),
103    UpdateCraftingFacility(UpdateCraftingFacility),
104    UpdateDomain(UpdateDomain),
105    UpdateRecipe(UpdateRecipe),
106    UpdateRecipeCategory(UpdateRecipeCategory),
107}
108
109impl carbon_core::instruction::InstructionDecoder<'_> for CraftingDecoder {
110    type InstructionType = CraftingInstruction;
111
112    fn decode_instruction(
113        &self,
114        instruction: &solana_instruction::Instruction,
115    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
116        if !instruction.program_id.eq(&PROGRAM_ID) {
117            return None;
118        }
119
120        let data = instruction.data.as_slice();
121
122        {
123            if let Some(decoded) =
124                add_consumable_input_to_recipe::AddConsumableInputToRecipe::decode(data)
125            {
126                return Some(carbon_core::instruction::DecodedInstruction {
127                    program_id: instruction.program_id,
128                    data: CraftingInstruction::AddConsumableInputToRecipe(decoded),
129                    accounts: instruction.accounts.clone(),
130                });
131            }
132        }
133        {
134            if let Some(decoded) =
135                add_crafting_facility_recipe_category::AddCraftingFacilityRecipeCategory::decode(
136                    data,
137                )
138            {
139                return Some(carbon_core::instruction::DecodedInstruction {
140                    program_id: instruction.program_id,
141                    data: CraftingInstruction::AddCraftingFacilityRecipeCategory(decoded),
142                    accounts: instruction.accounts.clone(),
143                });
144            }
145        }
146        {
147            if let Some(decoded) =
148                add_non_consumable_input_to_recipe::AddNonConsumableInputToRecipe::decode(data)
149            {
150                return Some(carbon_core::instruction::DecodedInstruction {
151                    program_id: instruction.program_id,
152                    data: CraftingInstruction::AddNonConsumableInputToRecipe(decoded),
153                    accounts: instruction.accounts.clone(),
154                });
155            }
156        }
157        {
158            if let Some(decoded) = add_output_to_recipe::AddOutputToRecipe::decode(data) {
159                return Some(carbon_core::instruction::DecodedInstruction {
160                    program_id: instruction.program_id,
161                    data: CraftingInstruction::AddOutputToRecipe(decoded),
162                    accounts: instruction.accounts.clone(),
163                });
164            }
165        }
166        {
167            if let Some(decoded) = add_recipe_ingredient::AddRecipeIngredient::decode(data) {
168                return Some(carbon_core::instruction::DecodedInstruction {
169                    program_id: instruction.program_id,
170                    data: CraftingInstruction::AddRecipeIngredient(decoded),
171                    accounts: instruction.accounts.clone(),
172                });
173            }
174        }
175        {
176            if let Some(decoded) =
177                burn_consumable_ingredient::BurnConsumableIngredient::decode(data)
178            {
179                return Some(carbon_core::instruction::DecodedInstruction {
180                    program_id: instruction.program_id,
181                    data: CraftingInstruction::BurnConsumableIngredient(decoded),
182                    accounts: instruction.accounts.clone(),
183                });
184            }
185        }
186        {
187            if let Some(decoded) = cancel_crafting_process::CancelCraftingProcess::decode(data) {
188                return Some(carbon_core::instruction::DecodedInstruction {
189                    program_id: instruction.program_id,
190                    data: CraftingInstruction::CancelCraftingProcess(decoded),
191                    accounts: instruction.accounts.clone(),
192                });
193            }
194        }
195        {
196            if let Some(decoded) =
197                claim_non_consumable_ingredient::ClaimNonConsumableIngredient::decode(data)
198            {
199                return Some(carbon_core::instruction::DecodedInstruction {
200                    program_id: instruction.program_id,
201                    data: CraftingInstruction::ClaimNonConsumableIngredient(decoded),
202                    accounts: instruction.accounts.clone(),
203                });
204            }
205        }
206        {
207            if let Some(decoded) = claim_recipe_output::ClaimRecipeOutput::decode(data) {
208                return Some(carbon_core::instruction::DecodedInstruction {
209                    program_id: instruction.program_id,
210                    data: CraftingInstruction::ClaimRecipeOutput(decoded),
211                    accounts: instruction.accounts.clone(),
212                });
213            }
214        }
215        {
216            if let Some(decoded) = close_crafting_process::CloseCraftingProcess::decode(data) {
217                return Some(carbon_core::instruction::DecodedInstruction {
218                    program_id: instruction.program_id,
219                    data: CraftingInstruction::CloseCraftingProcess(decoded),
220                    accounts: instruction.accounts.clone(),
221                });
222            }
223        }
224        {
225            if let Some(decoded) = create_crafting_process::CreateCraftingProcess::decode(data) {
226                return Some(carbon_core::instruction::DecodedInstruction {
227                    program_id: instruction.program_id,
228                    data: CraftingInstruction::CreateCraftingProcess(decoded),
229                    accounts: instruction.accounts.clone(),
230                });
231            }
232        }
233        {
234            if let Some(decoded) =
235                deregister_crafting_facility::DeregisterCraftingFacility::decode(data)
236            {
237                return Some(carbon_core::instruction::DecodedInstruction {
238                    program_id: instruction.program_id,
239                    data: CraftingInstruction::DeregisterCraftingFacility(decoded),
240                    accounts: instruction.accounts.clone(),
241                });
242            }
243        }
244        {
245            if let Some(decoded) =
246                deregister_recipe_category::DeregisterRecipeCategory::decode(data)
247            {
248                return Some(carbon_core::instruction::DecodedInstruction {
249                    program_id: instruction.program_id,
250                    data: CraftingInstruction::DeregisterRecipeCategory(decoded),
251                    accounts: instruction.accounts.clone(),
252                });
253            }
254        }
255        {
256            if let Some(decoded) = drain_craftable_item_bank::DrainCraftableItemBank::decode(data) {
257                return Some(carbon_core::instruction::DecodedInstruction {
258                    program_id: instruction.program_id,
259                    data: CraftingInstruction::DrainCraftableItemBank(decoded),
260                    accounts: instruction.accounts.clone(),
261                });
262            }
263        }
264        {
265            if let Some(decoded) = initialize_domain::InitializeDomain::decode(data) {
266                return Some(carbon_core::instruction::DecodedInstruction {
267                    program_id: instruction.program_id,
268                    data: CraftingInstruction::InitializeDomain(decoded),
269                    accounts: instruction.accounts.clone(),
270                });
271            }
272        }
273        {
274            if let Some(decoded) =
275                legitimize_recipe_ingredient::LegitimizeRecipeIngredient::decode(data)
276            {
277                return Some(carbon_core::instruction::DecodedInstruction {
278                    program_id: instruction.program_id,
279                    data: CraftingInstruction::LegitimizeRecipeIngredient(decoded),
280                    accounts: instruction.accounts.clone(),
281                });
282            }
283        }
284        {
285            if let Some(decoded) = register_craftable_item::RegisterCraftableItem::decode(data) {
286                return Some(carbon_core::instruction::DecodedInstruction {
287                    program_id: instruction.program_id,
288                    data: CraftingInstruction::RegisterCraftableItem(decoded),
289                    accounts: instruction.accounts.clone(),
290                });
291            }
292        }
293        {
294            if let Some(decoded) =
295                register_crafting_facility::RegisterCraftingFacility::decode(data)
296            {
297                return Some(carbon_core::instruction::DecodedInstruction {
298                    program_id: instruction.program_id,
299                    data: CraftingInstruction::RegisterCraftingFacility(decoded),
300                    accounts: instruction.accounts.clone(),
301                });
302            }
303        }
304        {
305            if let Some(decoded) = register_recipe::RegisterRecipe::decode(data) {
306                return Some(carbon_core::instruction::DecodedInstruction {
307                    program_id: instruction.program_id,
308                    data: CraftingInstruction::RegisterRecipe(decoded),
309                    accounts: instruction.accounts.clone(),
310                });
311            }
312        }
313        {
314            if let Some(decoded) = register_recipe_category::RegisterRecipeCategory::decode(data) {
315                return Some(carbon_core::instruction::DecodedInstruction {
316                    program_id: instruction.program_id,
317                    data: CraftingInstruction::RegisterRecipeCategory(decoded),
318                    accounts: instruction.accounts.clone(),
319                });
320            }
321        }
322        {
323            if let Some(decoded) =
324                remove_consumable_input_from_recipe::RemoveConsumableInputFromRecipe::decode(data)
325            {
326                return Some(carbon_core::instruction::DecodedInstruction {
327                    program_id: instruction.program_id,
328                    data: CraftingInstruction::RemoveConsumableInputFromRecipe(decoded),
329                    accounts: instruction.accounts.clone(),
330                });
331            }
332        }
333        {
334            if let Some(decoded) = remove_crafting_facility_recipe_category::RemoveCraftingFacilityRecipeCategory::decode(data) {
335                return Some(carbon_core::instruction::DecodedInstruction {
336                    program_id: instruction.program_id,
337                    data: CraftingInstruction::RemoveCraftingFacilityRecipeCategory(decoded),
338                    accounts: instruction.accounts.clone(),
339                });
340            }
341        }
342        {
343            if let Some(decoded) =
344                remove_non_consumable_input_from_recipe::RemoveNonConsumableInputFromRecipe::decode(
345                    data,
346                )
347            {
348                return Some(carbon_core::instruction::DecodedInstruction {
349                    program_id: instruction.program_id,
350                    data: CraftingInstruction::RemoveNonConsumableInputFromRecipe(decoded),
351                    accounts: instruction.accounts.clone(),
352                });
353            }
354        }
355        {
356            if let Some(decoded) = remove_output_from_recipe::RemoveOutputFromRecipe::decode(data) {
357                return Some(carbon_core::instruction::DecodedInstruction {
358                    program_id: instruction.program_id,
359                    data: CraftingInstruction::RemoveOutputFromRecipe(decoded),
360                    accounts: instruction.accounts.clone(),
361                });
362            }
363        }
364        {
365            if let Some(decoded) = remove_recipe_ingredient::RemoveRecipeIngredient::decode(data) {
366                return Some(carbon_core::instruction::DecodedInstruction {
367                    program_id: instruction.program_id,
368                    data: CraftingInstruction::RemoveRecipeIngredient(decoded),
369                    accounts: instruction.accounts.clone(),
370                });
371            }
372        }
373        {
374            if let Some(decoded) = start_crafting_process::StartCraftingProcess::decode(data) {
375                return Some(carbon_core::instruction::DecodedInstruction {
376                    program_id: instruction.program_id,
377                    data: CraftingInstruction::StartCraftingProcess(decoded),
378                    accounts: instruction.accounts.clone(),
379                });
380            }
381        }
382        {
383            if let Some(decoded) = stop_crafting_process::StopCraftingProcess::decode(data) {
384                return Some(carbon_core::instruction::DecodedInstruction {
385                    program_id: instruction.program_id,
386                    data: CraftingInstruction::StopCraftingProcess(decoded),
387                    accounts: instruction.accounts.clone(),
388                });
389            }
390        }
391        {
392            if let Some(decoded) = update_crafting_facility::UpdateCraftingFacility::decode(data) {
393                return Some(carbon_core::instruction::DecodedInstruction {
394                    program_id: instruction.program_id,
395                    data: CraftingInstruction::UpdateCraftingFacility(decoded),
396                    accounts: instruction.accounts.clone(),
397                });
398            }
399        }
400        {
401            if let Some(decoded) = update_domain::UpdateDomain::decode(data) {
402                return Some(carbon_core::instruction::DecodedInstruction {
403                    program_id: instruction.program_id,
404                    data: CraftingInstruction::UpdateDomain(decoded),
405                    accounts: instruction.accounts.clone(),
406                });
407            }
408        }
409        {
410            if let Some(decoded) = update_recipe::UpdateRecipe::decode(data) {
411                return Some(carbon_core::instruction::DecodedInstruction {
412                    program_id: instruction.program_id,
413                    data: CraftingInstruction::UpdateRecipe(decoded),
414                    accounts: instruction.accounts.clone(),
415                });
416            }
417        }
418        {
419            if let Some(decoded) = update_recipe_category::UpdateRecipeCategory::decode(data) {
420                return Some(carbon_core::instruction::DecodedInstruction {
421                    program_id: instruction.program_id,
422                    data: CraftingInstruction::UpdateRecipeCategory(decoded),
423                    accounts: instruction.accounts.clone(),
424                });
425            }
426        }
427
428        None
429    }
430}