carbon-phoenix-v1-decoder 2.0.0

Phoenix V1 Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use crate::{PhoenixV1Decoder, PROGRAM_ID};

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

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

pub mod cancel_all_orders;
pub mod cancel_all_orders_with_free_funds;
pub mod cancel_multiple_orders_by_id;
pub mod cancel_multiple_orders_by_id_with_free_funds;
pub mod cancel_up_to;
pub mod cancel_up_to_with_free_funds;
pub mod change_fee_recipient;
pub mod change_market_status;
pub mod change_seat_status;
pub mod claim_authority;
pub mod collect_fees;
pub mod deposit_funds;
pub mod evict_seat;
pub mod force_cancel_orders;
pub mod initialize_market;
pub mod log;
pub mod name_successor;
pub mod place_limit_order;
pub mod place_limit_order_with_free_funds;
pub mod place_multiple_post_only_orders;
pub mod place_multiple_post_only_orders_with_free_funds;
pub mod reduce_order;
pub mod reduce_order_with_free_funds;
pub mod request_seat;
pub mod request_seat_authorized;
pub mod swap;
pub mod swap_with_free_funds;
pub mod withdraw_funds;

pub use self::{
    cancel_all_orders::*, cancel_all_orders_with_free_funds::*, cancel_multiple_orders_by_id::*,
    cancel_multiple_orders_by_id_with_free_funds::*, cancel_up_to::*,
    cancel_up_to_with_free_funds::*, change_fee_recipient::*, change_market_status::*,
    change_seat_status::*, claim_authority::*, collect_fees::*, deposit_funds::*, evict_seat::*,
    force_cancel_orders::*, initialize_market::*, log::*, name_successor::*, place_limit_order::*,
    place_limit_order_with_free_funds::*, place_multiple_post_only_orders::*,
    place_multiple_post_only_orders_with_free_funds::*, reduce_order::*,
    reduce_order_with_free_funds::*, request_seat::*, request_seat_authorized::*, swap::*,
    swap_with_free_funds::*, withdraw_funds::*,
};

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum PhoenixV1Instruction {
    CancelAllOrders {
        program_id: solana_pubkey::Pubkey,
        data: CancelAllOrders,
        accounts: CancelAllOrdersInstructionAccounts,
    },
    CancelAllOrdersWithFreeFunds {
        program_id: solana_pubkey::Pubkey,
        data: CancelAllOrdersWithFreeFunds,
        accounts: CancelAllOrdersWithFreeFundsInstructionAccounts,
    },
    CancelMultipleOrdersById {
        program_id: solana_pubkey::Pubkey,
        data: CancelMultipleOrdersById,
        accounts: CancelMultipleOrdersByIdInstructionAccounts,
    },
    CancelMultipleOrdersByIdWithFreeFunds {
        program_id: solana_pubkey::Pubkey,
        data: CancelMultipleOrdersByIdWithFreeFunds,
        accounts: CancelMultipleOrdersByIdWithFreeFundsInstructionAccounts,
    },
    CancelUpTo {
        program_id: solana_pubkey::Pubkey,
        data: CancelUpTo,
        accounts: CancelUpToInstructionAccounts,
    },
    CancelUpToWithFreeFunds {
        program_id: solana_pubkey::Pubkey,
        data: CancelUpToWithFreeFunds,
        accounts: CancelUpToWithFreeFundsInstructionAccounts,
    },
    ChangeFeeRecipient {
        program_id: solana_pubkey::Pubkey,
        data: ChangeFeeRecipient,
        accounts: ChangeFeeRecipientInstructionAccounts,
    },
    ChangeMarketStatus {
        program_id: solana_pubkey::Pubkey,
        data: ChangeMarketStatus,
        accounts: ChangeMarketStatusInstructionAccounts,
    },
    ChangeSeatStatus {
        program_id: solana_pubkey::Pubkey,
        data: ChangeSeatStatus,
        accounts: ChangeSeatStatusInstructionAccounts,
    },
    ClaimAuthority {
        program_id: solana_pubkey::Pubkey,
        data: ClaimAuthority,
        accounts: ClaimAuthorityInstructionAccounts,
    },
    CollectFees {
        program_id: solana_pubkey::Pubkey,
        data: CollectFees,
        accounts: CollectFeesInstructionAccounts,
    },
    DepositFunds {
        program_id: solana_pubkey::Pubkey,
        data: DepositFunds,
        accounts: DepositFundsInstructionAccounts,
    },
    EvictSeat {
        program_id: solana_pubkey::Pubkey,
        data: EvictSeat,
        accounts: EvictSeatInstructionAccounts,
    },
    ForceCancelOrders {
        program_id: solana_pubkey::Pubkey,
        data: ForceCancelOrders,
        accounts: ForceCancelOrdersInstructionAccounts,
    },
    InitializeMarket {
        program_id: solana_pubkey::Pubkey,
        data: InitializeMarket,
        accounts: InitializeMarketInstructionAccounts,
    },
    Log {
        program_id: solana_pubkey::Pubkey,
        data: Log,
        accounts: LogInstructionAccounts,
    },
    NameSuccessor {
        program_id: solana_pubkey::Pubkey,
        data: NameSuccessor,
        accounts: NameSuccessorInstructionAccounts,
    },
    PlaceLimitOrder {
        program_id: solana_pubkey::Pubkey,
        data: PlaceLimitOrder,
        accounts: PlaceLimitOrderInstructionAccounts,
    },
    PlaceLimitOrderWithFreeFunds {
        program_id: solana_pubkey::Pubkey,
        data: PlaceLimitOrderWithFreeFunds,
        accounts: PlaceLimitOrderWithFreeFundsInstructionAccounts,
    },
    PlaceMultiplePostOnlyOrders {
        program_id: solana_pubkey::Pubkey,
        data: PlaceMultiplePostOnlyOrders,
        accounts: PlaceMultiplePostOnlyOrdersInstructionAccounts,
    },
    PlaceMultiplePostOnlyOrdersWithFreeFunds {
        program_id: solana_pubkey::Pubkey,
        data: PlaceMultiplePostOnlyOrdersWithFreeFunds,
        accounts: PlaceMultiplePostOnlyOrdersWithFreeFundsInstructionAccounts,
    },
    ReduceOrder {
        program_id: solana_pubkey::Pubkey,
        data: ReduceOrder,
        accounts: ReduceOrderInstructionAccounts,
    },
    ReduceOrderWithFreeFunds {
        program_id: solana_pubkey::Pubkey,
        data: ReduceOrderWithFreeFunds,
        accounts: ReduceOrderWithFreeFundsInstructionAccounts,
    },
    RequestSeat {
        program_id: solana_pubkey::Pubkey,
        data: RequestSeat,
        accounts: RequestSeatInstructionAccounts,
    },
    RequestSeatAuthorized {
        program_id: solana_pubkey::Pubkey,
        data: RequestSeatAuthorized,
        accounts: RequestSeatAuthorizedInstructionAccounts,
    },
    Swap {
        program_id: solana_pubkey::Pubkey,
        data: Swap,
        accounts: SwapInstructionAccounts,
    },
    SwapWithFreeFunds {
        program_id: solana_pubkey::Pubkey,
        data: SwapWithFreeFunds,
        accounts: SwapWithFreeFundsInstructionAccounts,
    },
    WithdrawFunds {
        program_id: solana_pubkey::Pubkey,
        data: WithdrawFunds,
        accounts: WithdrawFundsInstructionAccounts,
    },
}

impl carbon_core::instruction::InstructionDecoder<'_> for PhoenixV1Decoder {
    type InstructionType = PhoenixV1Instruction;

    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,
            PhoenixV1Instruction::CancelAllOrders => CancelAllOrders,
            PhoenixV1Instruction::CancelAllOrdersWithFreeFunds => CancelAllOrdersWithFreeFunds,
            PhoenixV1Instruction::CancelMultipleOrdersById => CancelMultipleOrdersById,
            PhoenixV1Instruction::CancelMultipleOrdersByIdWithFreeFunds => CancelMultipleOrdersByIdWithFreeFunds,
            PhoenixV1Instruction::CancelUpTo => CancelUpTo,
            PhoenixV1Instruction::CancelUpToWithFreeFunds => CancelUpToWithFreeFunds,
            PhoenixV1Instruction::ChangeFeeRecipient => ChangeFeeRecipient,
            PhoenixV1Instruction::ChangeMarketStatus => ChangeMarketStatus,
            PhoenixV1Instruction::ChangeSeatStatus => ChangeSeatStatus,
            PhoenixV1Instruction::ClaimAuthority => ClaimAuthority,
            PhoenixV1Instruction::CollectFees => CollectFees,
            PhoenixV1Instruction::DepositFunds => DepositFunds,
            PhoenixV1Instruction::EvictSeat => EvictSeat,
            PhoenixV1Instruction::ForceCancelOrders => ForceCancelOrders,
            PhoenixV1Instruction::InitializeMarket => InitializeMarket,
            PhoenixV1Instruction::Log => Log,
            PhoenixV1Instruction::NameSuccessor => NameSuccessor,
            PhoenixV1Instruction::PlaceLimitOrder => PlaceLimitOrder,
            PhoenixV1Instruction::PlaceLimitOrderWithFreeFunds => PlaceLimitOrderWithFreeFunds,
            PhoenixV1Instruction::PlaceMultiplePostOnlyOrders => PlaceMultiplePostOnlyOrders,
            PhoenixV1Instruction::PlaceMultiplePostOnlyOrdersWithFreeFunds => PlaceMultiplePostOnlyOrdersWithFreeFunds,
            PhoenixV1Instruction::ReduceOrder => ReduceOrder,
            PhoenixV1Instruction::ReduceOrderWithFreeFunds => ReduceOrderWithFreeFunds,
            PhoenixV1Instruction::RequestSeat => RequestSeat,
            PhoenixV1Instruction::RequestSeatAuthorized => RequestSeatAuthorized,
            PhoenixV1Instruction::Swap => Swap,
            PhoenixV1Instruction::SwapWithFreeFunds => SwapWithFreeFunds,
            PhoenixV1Instruction::WithdrawFunds => WithdrawFunds,
        )
    }
}