use crate::{MoonshotDecoder, PROGRAM_ID};
#[cfg(feature = "postgres")]
pub mod postgres;
#[cfg(feature = "graphql")]
pub mod graphql;
pub mod buy;
pub mod config_init;
pub mod config_update;
pub mod cpi_event;
pub mod migrate_funds;
pub mod sell;
pub mod token_mint;
pub use self::{
buy::*, config_init::*, config_update::*, cpi_event::*, migrate_funds::*, sell::*,
token_mint::*,
};
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum MoonshotInstruction {
Buy {
program_id: solana_pubkey::Pubkey,
data: Buy,
accounts: BuyInstructionAccounts,
},
ConfigInit {
program_id: solana_pubkey::Pubkey,
data: ConfigInit,
accounts: ConfigInitInstructionAccounts,
},
ConfigUpdate {
program_id: solana_pubkey::Pubkey,
data: ConfigUpdate,
accounts: ConfigUpdateInstructionAccounts,
},
MigrateFunds {
program_id: solana_pubkey::Pubkey,
data: MigrateFunds,
accounts: MigrateFundsInstructionAccounts,
},
Sell {
program_id: solana_pubkey::Pubkey,
data: Sell,
accounts: SellInstructionAccounts,
},
TokenMint {
program_id: solana_pubkey::Pubkey,
data: TokenMint,
accounts: TokenMintInstructionAccounts,
},
CpiEvent {
program_id: solana_pubkey::Pubkey,
data: CpiEvent,
accounts: CpiEventInstructionAccounts,
},
}
impl carbon_core::instruction::InstructionDecoder<'_> for MoonshotDecoder {
type InstructionType = MoonshotInstruction;
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,
MoonshotInstruction::Buy => Buy,
MoonshotInstruction::ConfigInit => ConfigInit,
MoonshotInstruction::ConfigUpdate => ConfigUpdate,
MoonshotInstruction::MigrateFunds => MigrateFunds,
MoonshotInstruction::Sell => Sell,
MoonshotInstruction::TokenMint => TokenMint,
MoonshotInstruction::CpiEvent => CpiEvent,
)
}
}