carbon-raydium-launchpad-decoder 2.0.0

Raydium Launchpad Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use crate::{RaydiumLaunchpadDecoder, PROGRAM_ID};

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

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

pub mod buy_exact_in;
pub mod buy_exact_out;
pub mod claim_creator_fee;
pub mod claim_platform_fee;
pub mod claim_platform_fee_from_vault;
pub mod claim_vested_token;
pub mod close_platform_global_access;
pub mod collect_fee;
pub mod collect_migrate_fee;
pub mod cpi_event;
pub mod create_config;
pub mod create_platform_config;
pub mod create_platform_global_access;
pub mod create_platform_vesting_account;
pub mod create_vesting_account;
pub mod initialize;
pub mod initialize_v2;
pub mod initialize_with_token2022;
pub mod migrate_to_amm;
pub mod migrate_to_cpswap;
pub mod remove_platform_curve_param;
pub mod sell_exact_in;
pub mod sell_exact_out;
pub mod update_config;
pub mod update_platform_config;
pub mod update_platform_curve_param;

pub use self::{
    buy_exact_in::*, buy_exact_out::*, claim_creator_fee::*, claim_platform_fee::*,
    claim_platform_fee_from_vault::*, claim_vested_token::*, close_platform_global_access::*,
    collect_fee::*, collect_migrate_fee::*, cpi_event::*, create_config::*,
    create_platform_config::*, create_platform_global_access::*,
    create_platform_vesting_account::*, create_vesting_account::*, initialize::*, initialize_v2::*,
    initialize_with_token2022::*, migrate_to_amm::*, migrate_to_cpswap::*,
    remove_platform_curve_param::*, sell_exact_in::*, sell_exact_out::*, update_config::*,
    update_platform_config::*, update_platform_curve_param::*,
};

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum RaydiumLaunchpadInstruction {
    BuyExactIn {
        program_id: solana_pubkey::Pubkey,
        data: BuyExactIn,
        accounts: BuyExactInInstructionAccounts,
    },
    BuyExactOut {
        program_id: solana_pubkey::Pubkey,
        data: BuyExactOut,
        accounts: BuyExactOutInstructionAccounts,
    },
    ClaimCreatorFee {
        program_id: solana_pubkey::Pubkey,
        data: ClaimCreatorFee,
        accounts: ClaimCreatorFeeInstructionAccounts,
    },
    ClaimPlatformFee {
        program_id: solana_pubkey::Pubkey,
        data: ClaimPlatformFee,
        accounts: ClaimPlatformFeeInstructionAccounts,
    },
    ClaimPlatformFeeFromVault {
        program_id: solana_pubkey::Pubkey,
        data: ClaimPlatformFeeFromVault,
        accounts: ClaimPlatformFeeFromVaultInstructionAccounts,
    },
    ClaimVestedToken {
        program_id: solana_pubkey::Pubkey,
        data: ClaimVestedToken,
        accounts: ClaimVestedTokenInstructionAccounts,
    },
    ClosePlatformGlobalAccess {
        program_id: solana_pubkey::Pubkey,
        data: ClosePlatformGlobalAccess,
        accounts: ClosePlatformGlobalAccessInstructionAccounts,
    },
    CollectFee {
        program_id: solana_pubkey::Pubkey,
        data: CollectFee,
        accounts: CollectFeeInstructionAccounts,
    },
    CollectMigrateFee {
        program_id: solana_pubkey::Pubkey,
        data: CollectMigrateFee,
        accounts: CollectMigrateFeeInstructionAccounts,
    },
    CreateConfig {
        program_id: solana_pubkey::Pubkey,
        data: CreateConfig,
        accounts: CreateConfigInstructionAccounts,
    },
    CreatePlatformConfig {
        program_id: solana_pubkey::Pubkey,
        data: CreatePlatformConfig,
        accounts: CreatePlatformConfigInstructionAccounts,
    },
    CreatePlatformGlobalAccess {
        program_id: solana_pubkey::Pubkey,
        data: CreatePlatformGlobalAccess,
        accounts: CreatePlatformGlobalAccessInstructionAccounts,
    },
    CreatePlatformVestingAccount {
        program_id: solana_pubkey::Pubkey,
        data: CreatePlatformVestingAccount,
        accounts: CreatePlatformVestingAccountInstructionAccounts,
    },
    CreateVestingAccount {
        program_id: solana_pubkey::Pubkey,
        data: CreateVestingAccount,
        accounts: CreateVestingAccountInstructionAccounts,
    },
    Initialize {
        program_id: solana_pubkey::Pubkey,
        data: Initialize,
        accounts: InitializeInstructionAccounts,
    },
    InitializeV2 {
        program_id: solana_pubkey::Pubkey,
        data: InitializeV2,
        accounts: InitializeV2InstructionAccounts,
    },
    InitializeWithToken2022 {
        program_id: solana_pubkey::Pubkey,
        data: InitializeWithToken2022,
        accounts: InitializeWithToken2022InstructionAccounts,
    },
    MigrateToAmm {
        program_id: solana_pubkey::Pubkey,
        data: MigrateToAmm,
        accounts: MigrateToAmmInstructionAccounts,
    },
    MigrateToCpswap {
        program_id: solana_pubkey::Pubkey,
        data: MigrateToCpswap,
        accounts: MigrateToCpswapInstructionAccounts,
    },
    RemovePlatformCurveParam {
        program_id: solana_pubkey::Pubkey,
        data: RemovePlatformCurveParam,
        accounts: RemovePlatformCurveParamInstructionAccounts,
    },
    SellExactIn {
        program_id: solana_pubkey::Pubkey,
        data: SellExactIn,
        accounts: SellExactInInstructionAccounts,
    },
    SellExactOut {
        program_id: solana_pubkey::Pubkey,
        data: SellExactOut,
        accounts: SellExactOutInstructionAccounts,
    },
    UpdateConfig {
        program_id: solana_pubkey::Pubkey,
        data: UpdateConfig,
        accounts: UpdateConfigInstructionAccounts,
    },
    UpdatePlatformConfig {
        program_id: solana_pubkey::Pubkey,
        data: UpdatePlatformConfig,
        accounts: UpdatePlatformConfigInstructionAccounts,
    },
    UpdatePlatformCurveParam {
        program_id: solana_pubkey::Pubkey,
        data: UpdatePlatformCurveParam,
        accounts: UpdatePlatformCurveParamInstructionAccounts,
    },
    CpiEvent {
        program_id: solana_pubkey::Pubkey,
        data: CpiEvent,
        accounts: CpiEventInstructionAccounts,
    },
}

impl carbon_core::instruction::InstructionDecoder<'_> for RaydiumLaunchpadDecoder {
    type InstructionType = RaydiumLaunchpadInstruction;

    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,
            RaydiumLaunchpadInstruction::BuyExactIn => BuyExactIn,
            RaydiumLaunchpadInstruction::BuyExactOut => BuyExactOut,
            RaydiumLaunchpadInstruction::ClaimCreatorFee => ClaimCreatorFee,
            RaydiumLaunchpadInstruction::ClaimPlatformFee => ClaimPlatformFee,
            RaydiumLaunchpadInstruction::ClaimPlatformFeeFromVault => ClaimPlatformFeeFromVault,
            RaydiumLaunchpadInstruction::ClaimVestedToken => ClaimVestedToken,
            RaydiumLaunchpadInstruction::ClosePlatformGlobalAccess => ClosePlatformGlobalAccess,
            RaydiumLaunchpadInstruction::CollectFee => CollectFee,
            RaydiumLaunchpadInstruction::CollectMigrateFee => CollectMigrateFee,
            RaydiumLaunchpadInstruction::CreateConfig => CreateConfig,
            RaydiumLaunchpadInstruction::CreatePlatformConfig => CreatePlatformConfig,
            RaydiumLaunchpadInstruction::CreatePlatformGlobalAccess => CreatePlatformGlobalAccess,
            RaydiumLaunchpadInstruction::CreatePlatformVestingAccount => CreatePlatformVestingAccount,
            RaydiumLaunchpadInstruction::CreateVestingAccount => CreateVestingAccount,
            RaydiumLaunchpadInstruction::Initialize => Initialize,
            RaydiumLaunchpadInstruction::InitializeV2 => InitializeV2,
            RaydiumLaunchpadInstruction::InitializeWithToken2022 => InitializeWithToken2022,
            RaydiumLaunchpadInstruction::MigrateToAmm => MigrateToAmm,
            RaydiumLaunchpadInstruction::MigrateToCpswap => MigrateToCpswap,
            RaydiumLaunchpadInstruction::RemovePlatformCurveParam => RemovePlatformCurveParam,
            RaydiumLaunchpadInstruction::SellExactIn => SellExactIn,
            RaydiumLaunchpadInstruction::SellExactOut => SellExactOut,
            RaydiumLaunchpadInstruction::UpdateConfig => UpdateConfig,
            RaydiumLaunchpadInstruction::UpdatePlatformConfig => UpdatePlatformConfig,
            RaydiumLaunchpadInstruction::UpdatePlatformCurveParam => UpdatePlatformCurveParam,
            RaydiumLaunchpadInstruction::CpiEvent => CpiEvent,
        )
    }
}