carbon-pump-swap-decoder 1.0.0

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

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

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

pub mod admin_set_coin_creator;
pub mod admin_update_token_incentives;
pub mod buy;
pub mod buy_exact_quote_in;
pub mod claim_cashback;
pub mod claim_token_incentives;
pub mod close_user_volume_accumulator;
pub mod collect_coin_creator_fee;
pub mod cpi_event;
pub mod create_config;
pub mod create_pool;
pub mod deposit;
pub mod disable;
pub mod extend_account;
pub mod init_user_volume_accumulator;
pub mod migrate_pool_coin_creator;
pub mod sell;
pub mod set_coin_creator;
pub mod set_reserved_fee_recipients;
pub mod sync_user_volume_accumulator;
pub mod toggle_cashback_enabled;
pub mod toggle_mayhem_mode;
pub mod transfer_creator_fees_to_pump;
pub mod update_admin;
pub mod update_fee_config;
pub mod withdraw;

pub use self::{
    admin_set_coin_creator::*, admin_update_token_incentives::*, buy::*, buy_exact_quote_in::*,
    claim_cashback::*, claim_token_incentives::*, close_user_volume_accumulator::*,
    collect_coin_creator_fee::*, cpi_event::*, create_config::*, create_pool::*, deposit::*,
    disable::*, extend_account::*, init_user_volume_accumulator::*, migrate_pool_coin_creator::*,
    sell::*, set_coin_creator::*, set_reserved_fee_recipients::*, sync_user_volume_accumulator::*,
    toggle_cashback_enabled::*, toggle_mayhem_mode::*, transfer_creator_fees_to_pump::*,
    update_admin::*, update_fee_config::*, withdraw::*,
};

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum PumpSwapInstruction {
    AdminSetCoinCreator {
        program_id: solana_pubkey::Pubkey,
        data: AdminSetCoinCreator,
        accounts: AdminSetCoinCreatorInstructionAccounts,
    },
    AdminUpdateTokenIncentives {
        program_id: solana_pubkey::Pubkey,
        data: AdminUpdateTokenIncentives,
        accounts: AdminUpdateTokenIncentivesInstructionAccounts,
    },
    Buy {
        program_id: solana_pubkey::Pubkey,
        data: Buy,
        accounts: BuyInstructionAccounts,
    },
    BuyExactQuoteIn {
        program_id: solana_pubkey::Pubkey,
        data: BuyExactQuoteIn,
        accounts: BuyExactQuoteInInstructionAccounts,
    },
    ClaimCashback {
        program_id: solana_pubkey::Pubkey,
        data: ClaimCashback,
        accounts: ClaimCashbackInstructionAccounts,
    },
    ClaimTokenIncentives {
        program_id: solana_pubkey::Pubkey,
        data: ClaimTokenIncentives,
        accounts: ClaimTokenIncentivesInstructionAccounts,
    },
    CloseUserVolumeAccumulator {
        program_id: solana_pubkey::Pubkey,
        data: CloseUserVolumeAccumulator,
        accounts: CloseUserVolumeAccumulatorInstructionAccounts,
    },
    CollectCoinCreatorFee {
        program_id: solana_pubkey::Pubkey,
        data: CollectCoinCreatorFee,
        accounts: CollectCoinCreatorFeeInstructionAccounts,
    },
    CreateConfig {
        program_id: solana_pubkey::Pubkey,
        data: CreateConfig,
        accounts: CreateConfigInstructionAccounts,
    },
    CreatePool {
        program_id: solana_pubkey::Pubkey,
        data: CreatePool,
        accounts: CreatePoolInstructionAccounts,
    },
    Deposit {
        program_id: solana_pubkey::Pubkey,
        data: Deposit,
        accounts: DepositInstructionAccounts,
    },
    Disable {
        program_id: solana_pubkey::Pubkey,
        data: Disable,
        accounts: DisableInstructionAccounts,
    },
    ExtendAccount {
        program_id: solana_pubkey::Pubkey,
        data: ExtendAccount,
        accounts: ExtendAccountInstructionAccounts,
    },
    InitUserVolumeAccumulator {
        program_id: solana_pubkey::Pubkey,
        data: InitUserVolumeAccumulator,
        accounts: InitUserVolumeAccumulatorInstructionAccounts,
    },
    MigratePoolCoinCreator {
        program_id: solana_pubkey::Pubkey,
        data: MigratePoolCoinCreator,
        accounts: MigratePoolCoinCreatorInstructionAccounts,
    },
    Sell {
        program_id: solana_pubkey::Pubkey,
        data: Sell,
        accounts: SellInstructionAccounts,
    },
    SetCoinCreator {
        program_id: solana_pubkey::Pubkey,
        data: SetCoinCreator,
        accounts: SetCoinCreatorInstructionAccounts,
    },
    SetReservedFeeRecipients {
        program_id: solana_pubkey::Pubkey,
        data: SetReservedFeeRecipients,
        accounts: SetReservedFeeRecipientsInstructionAccounts,
    },
    SyncUserVolumeAccumulator {
        program_id: solana_pubkey::Pubkey,
        data: SyncUserVolumeAccumulator,
        accounts: SyncUserVolumeAccumulatorInstructionAccounts,
    },
    ToggleCashbackEnabled {
        program_id: solana_pubkey::Pubkey,
        data: ToggleCashbackEnabled,
        accounts: ToggleCashbackEnabledInstructionAccounts,
    },
    ToggleMayhemMode {
        program_id: solana_pubkey::Pubkey,
        data: ToggleMayhemMode,
        accounts: ToggleMayhemModeInstructionAccounts,
    },
    TransferCreatorFeesToPump {
        program_id: solana_pubkey::Pubkey,
        data: TransferCreatorFeesToPump,
        accounts: TransferCreatorFeesToPumpInstructionAccounts,
    },
    UpdateAdmin {
        program_id: solana_pubkey::Pubkey,
        data: UpdateAdmin,
        accounts: UpdateAdminInstructionAccounts,
    },
    UpdateFeeConfig {
        program_id: solana_pubkey::Pubkey,
        data: UpdateFeeConfig,
        accounts: UpdateFeeConfigInstructionAccounts,
    },
    Withdraw {
        program_id: solana_pubkey::Pubkey,
        data: Withdraw,
        accounts: WithdrawInstructionAccounts,
    },
    CpiEvent {
        program_id: solana_pubkey::Pubkey,
        data: CpiEvent,
        accounts: CpiEventInstructionAccounts,
    },
}

impl carbon_core::instruction::InstructionDecoder<'_> for PumpSwapDecoder {
    type InstructionType = PumpSwapInstruction;

    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,
            PumpSwapInstruction::AdminSetCoinCreator => AdminSetCoinCreator,
            PumpSwapInstruction::AdminUpdateTokenIncentives => AdminUpdateTokenIncentives,
            PumpSwapInstruction::Buy => Buy,
            PumpSwapInstruction::BuyExactQuoteIn => BuyExactQuoteIn,
            PumpSwapInstruction::ClaimCashback => ClaimCashback,
            PumpSwapInstruction::ClaimTokenIncentives => ClaimTokenIncentives,
            PumpSwapInstruction::CloseUserVolumeAccumulator => CloseUserVolumeAccumulator,
            PumpSwapInstruction::CollectCoinCreatorFee => CollectCoinCreatorFee,
            PumpSwapInstruction::CreateConfig => CreateConfig,
            PumpSwapInstruction::CreatePool => CreatePool,
            PumpSwapInstruction::Deposit => Deposit,
            PumpSwapInstruction::Disable => Disable,
            PumpSwapInstruction::ExtendAccount => ExtendAccount,
            PumpSwapInstruction::InitUserVolumeAccumulator => InitUserVolumeAccumulator,
            PumpSwapInstruction::MigratePoolCoinCreator => MigratePoolCoinCreator,
            PumpSwapInstruction::Sell => Sell,
            PumpSwapInstruction::SetCoinCreator => SetCoinCreator,
            PumpSwapInstruction::SetReservedFeeRecipients => SetReservedFeeRecipients,
            PumpSwapInstruction::SyncUserVolumeAccumulator => SyncUserVolumeAccumulator,
            PumpSwapInstruction::ToggleCashbackEnabled => ToggleCashbackEnabled,
            PumpSwapInstruction::ToggleMayhemMode => ToggleMayhemMode,
            PumpSwapInstruction::TransferCreatorFeesToPump => TransferCreatorFeesToPump,
            PumpSwapInstruction::UpdateAdmin => UpdateAdmin,
            PumpSwapInstruction::UpdateFeeConfig => UpdateFeeConfig,
            PumpSwapInstruction::Withdraw => Withdraw,
            PumpSwapInstruction::CpiEvent => CpiEvent,
        )
    }
}