carbon-solayer-restaking-program-decoder 1.0.0

Solayer Restaking Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use crate::{SolayerRestakingProgramDecoder, PROGRAM_ID};

#[cfg(feature = "postgres")]
pub mod postgres;

#[cfg(feature = "graphql")]
pub mod graphql;

pub mod batch_thaw_lst_accounts;
pub mod initialize;
pub mod restake;
pub mod unrestake;

pub use self::{batch_thaw_lst_accounts::*, initialize::*, restake::*, unrestake::*};

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum SolayerRestakingProgramInstruction {
    BatchThawLstAccounts {
        program_id: solana_pubkey::Pubkey,
        data: BatchThawLstAccounts,
        accounts: BatchThawLstAccountsInstructionAccounts,
    },
    Initialize {
        program_id: solana_pubkey::Pubkey,
        data: Initialize,
        accounts: InitializeInstructionAccounts,
    },
    Restake {
        program_id: solana_pubkey::Pubkey,
        data: Restake,
        accounts: RestakeInstructionAccounts,
    },
    Unrestake {
        program_id: solana_pubkey::Pubkey,
        data: Unrestake,
        accounts: UnrestakeInstructionAccounts,
    },
}

impl carbon_core::instruction::InstructionDecoder<'_> for SolayerRestakingProgramDecoder {
    type InstructionType = SolayerRestakingProgramInstruction;

    fn decode_instruction(
        &self,
        instruction: &solana_instruction::Instruction,
    ) -> Option<Self::InstructionType> {
        if instruction.program_id != PROGRAM_ID {
            return None;
        }

        carbon_core::try_decode_instructions!(
            instruction,
            PROGRAM_ID,
            SolayerRestakingProgramInstruction::BatchThawLstAccounts => BatchThawLstAccounts,
            SolayerRestakingProgramInstruction::Initialize => Initialize,
            SolayerRestakingProgramInstruction::Restake => Restake,
            SolayerRestakingProgramInstruction::Unrestake => Unrestake,
        )
    }
}