carbon_address_lookup_table_decoder/instructions/
mod.rs1use crate::{AddressLookupTableDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod close_lookup_table;
11pub mod create_lookup_table;
12pub mod deactivate_lookup_table;
13pub mod extend_lookup_table;
14pub mod freeze_lookup_table;
15
16pub use self::{
17 close_lookup_table::*, create_lookup_table::*, deactivate_lookup_table::*,
18 extend_lookup_table::*, freeze_lookup_table::*,
19};
20
21#[derive(Debug, Clone, PartialEq)]
22#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
23#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
24pub enum AddressLookupTableInstruction {
25 CloseLookupTable {
26 program_id: solana_pubkey::Pubkey,
27 data: CloseLookupTable,
28 accounts: CloseLookupTableInstructionAccounts,
29 },
30 CreateLookupTable {
31 program_id: solana_pubkey::Pubkey,
32 data: CreateLookupTable,
33 accounts: CreateLookupTableInstructionAccounts,
34 },
35 DeactivateLookupTable {
36 program_id: solana_pubkey::Pubkey,
37 data: DeactivateLookupTable,
38 accounts: DeactivateLookupTableInstructionAccounts,
39 },
40 ExtendLookupTable {
41 program_id: solana_pubkey::Pubkey,
42 data: ExtendLookupTable,
43 accounts: ExtendLookupTableInstructionAccounts,
44 },
45 FreezeLookupTable {
46 program_id: solana_pubkey::Pubkey,
47 data: FreezeLookupTable,
48 accounts: FreezeLookupTableInstructionAccounts,
49 },
50}
51
52impl carbon_core::instruction::InstructionDecoder<'_> for AddressLookupTableDecoder {
53 type InstructionType = AddressLookupTableInstruction;
54
55 fn decode_instruction(
56 &self,
57 instruction: &solana_instruction::Instruction,
58 ) -> Option<Self::InstructionType> {
59 if instruction.program_id != PROGRAM_ID {
60 return None;
61 }
62
63 carbon_core::try_decode_instructions!(
64 instruction,
65 PROGRAM_ID,
66 AddressLookupTableInstruction::CloseLookupTable => CloseLookupTable,
67 AddressLookupTableInstruction::CreateLookupTable => CreateLookupTable,
68 AddressLookupTableInstruction::DeactivateLookupTable => DeactivateLookupTable,
69 AddressLookupTableInstruction::ExtendLookupTable => ExtendLookupTable,
70 AddressLookupTableInstruction::FreezeLookupTable => FreezeLookupTable,
71 )
72 }
73}