carbon_virtuals_decoder/instructions/
mod.rs1use crate::{VirtualsDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod buy;
11pub mod claim_fees;
12pub mod cpi_event;
13pub mod create_meteora_pool;
14pub mod initialize;
15pub mod initialize_meteora_accounts;
16pub mod launch;
17pub mod sell;
18pub mod update_pool_creator;
19
20pub use self::{
21 buy::*, claim_fees::*, cpi_event::*, create_meteora_pool::*, initialize::*,
22 initialize_meteora_accounts::*, launch::*, sell::*, update_pool_creator::*,
23};
24
25#[derive(Debug, Clone, PartialEq)]
26#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
27#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
28pub enum VirtualsInstruction {
29 Buy {
30 program_id: solana_pubkey::Pubkey,
31 data: Buy,
32 accounts: BuyInstructionAccounts,
33 },
34 ClaimFees {
35 program_id: solana_pubkey::Pubkey,
36 data: ClaimFees,
37 accounts: ClaimFeesInstructionAccounts,
38 },
39 CreateMeteoraPool {
40 program_id: solana_pubkey::Pubkey,
41 data: CreateMeteoraPool,
42 accounts: CreateMeteoraPoolInstructionAccounts,
43 },
44 Initialize {
45 program_id: solana_pubkey::Pubkey,
46 data: Initialize,
47 accounts: InitializeInstructionAccounts,
48 },
49 InitializeMeteoraAccounts {
50 program_id: solana_pubkey::Pubkey,
51 data: InitializeMeteoraAccounts,
52 accounts: InitializeMeteoraAccountsInstructionAccounts,
53 },
54 Launch {
55 program_id: solana_pubkey::Pubkey,
56 data: Launch,
57 accounts: LaunchInstructionAccounts,
58 },
59 Sell {
60 program_id: solana_pubkey::Pubkey,
61 data: Sell,
62 accounts: SellInstructionAccounts,
63 },
64 UpdatePoolCreator {
65 program_id: solana_pubkey::Pubkey,
66 data: UpdatePoolCreator,
67 accounts: UpdatePoolCreatorInstructionAccounts,
68 },
69 CpiEvent {
70 program_id: solana_pubkey::Pubkey,
71 data: CpiEvent,
72 accounts: CpiEventInstructionAccounts,
73 },
74}
75
76impl carbon_core::instruction::InstructionDecoder<'_> for VirtualsDecoder {
77 type InstructionType = VirtualsInstruction;
78
79 fn decode_instruction(
80 &self,
81 instruction: &solana_instruction::Instruction,
82 ) -> Option<Self::InstructionType> {
83 if instruction.program_id != PROGRAM_ID {
84 return None;
85 }
86
87 carbon_core::try_decode_instructions!(
88 instruction,
89 PROGRAM_ID,
90 VirtualsInstruction::Buy => Buy,
91 VirtualsInstruction::ClaimFees => ClaimFees,
92 VirtualsInstruction::CreateMeteoraPool => CreateMeteoraPool,
93 VirtualsInstruction::Initialize => Initialize,
94 VirtualsInstruction::InitializeMeteoraAccounts => InitializeMeteoraAccounts,
95 VirtualsInstruction::Launch => Launch,
96 VirtualsInstruction::Sell => Sell,
97 VirtualsInstruction::UpdatePoolCreator => UpdatePoolCreator,
98 VirtualsInstruction::CpiEvent => CpiEvent,
99 )
100 }
101}