carbon_solayer_restaking_program_decoder/instructions/
mod.rs

1use {super::SolayerRestakingProgramDecoder, crate::PROGRAM_ID};
2pub mod batch_thaw_lst_accounts;
3pub mod initialize;
4pub mod restake;
5pub mod unrestake;
6
7#[derive(
8    carbon_core::InstructionType,
9    serde::Serialize,
10    serde::Deserialize,
11    PartialEq,
12    Eq,
13    Debug,
14    Clone,
15    Hash,
16)]
17pub enum SolayerRestakingProgramInstruction {
18    Initialize(initialize::Initialize),
19    Restake(restake::Restake),
20    Unrestake(unrestake::Unrestake),
21    BatchThawLstAccounts(batch_thaw_lst_accounts::BatchThawLstAccounts),
22}
23
24impl carbon_core::instruction::InstructionDecoder<'_> for SolayerRestakingProgramDecoder {
25    type InstructionType = SolayerRestakingProgramInstruction;
26
27    fn decode_instruction(
28        &self,
29        instruction: &solana_instruction::Instruction,
30    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
31        if !instruction.program_id.eq(&PROGRAM_ID) {
32            return None;
33        }
34        carbon_core::try_decode_instructions!(instruction,
35            SolayerRestakingProgramInstruction::Initialize => initialize::Initialize,
36            SolayerRestakingProgramInstruction::Restake => restake::Restake,
37            SolayerRestakingProgramInstruction::Unrestake => unrestake::Unrestake,
38            SolayerRestakingProgramInstruction::BatchThawLstAccounts => batch_thaw_lst_accounts::BatchThawLstAccounts,
39        )
40    }
41}