carbon_profile_faction_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::PROGRAM_ID;
3use crate::ProfileFactionDecoder;
4
5pub mod choose_faction;
6
7pub use self::choose_faction::*;
8
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10#[cfg_attr(
11    feature = "serde",
12    derive(carbon_core::InstructionType, serde::Serialize, serde::Deserialize)
13)]
14#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
15pub enum ProfileFactionInstruction {
16    ChooseFaction(ChooseFaction),
17}
18
19impl carbon_core::instruction::InstructionDecoder<'_> for ProfileFactionDecoder {
20    type InstructionType = ProfileFactionInstruction;
21
22    fn decode_instruction(
23        &self,
24        instruction: &solana_instruction::Instruction,
25    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
26        if !instruction.program_id.eq(&PROGRAM_ID) {
27            return None;
28        }
29
30        let data = instruction.data.as_slice();
31
32        {
33            if let Some(decoded) = choose_faction::ChooseFaction::decode(data) {
34                return Some(carbon_core::instruction::DecodedInstruction {
35                    program_id: instruction.program_id,
36                    data: ProfileFactionInstruction::ChooseFaction(decoded),
37                    accounts: instruction.accounts.clone(),
38                });
39            }
40        }
41
42        None
43    }
44}