Skip to main content

carbon_associated_token_account_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::{AssociatedTokenAccountDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod create;
11pub mod create_idempotent;
12pub mod recover_nested;
13
14pub use self::{create::*, create_idempotent::*, recover_nested::*};
15
16#[derive(Debug, Clone, PartialEq)]
17#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
18#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
19pub enum AssociatedTokenAccountInstruction {
20    Create {
21        program_id: solana_pubkey::Pubkey,
22        data: Create,
23        accounts: CreateInstructionAccounts,
24    },
25    CreateIdempotent {
26        program_id: solana_pubkey::Pubkey,
27        data: CreateIdempotent,
28        accounts: CreateIdempotentInstructionAccounts,
29    },
30    RecoverNested {
31        program_id: solana_pubkey::Pubkey,
32        data: RecoverNested,
33        accounts: RecoverNestedInstructionAccounts,
34    },
35}
36
37impl carbon_core::instruction::InstructionDecoder<'_> for AssociatedTokenAccountDecoder {
38    type InstructionType = AssociatedTokenAccountInstruction;
39
40    fn decode_instruction(
41        &self,
42        instruction: &solana_instruction::Instruction,
43    ) -> Option<Self::InstructionType> {
44        if instruction.program_id != PROGRAM_ID {
45            return None;
46        }
47
48        carbon_core::try_decode_instructions!(
49            instruction,
50            PROGRAM_ID,
51            AssociatedTokenAccountInstruction::Create => Create,
52            AssociatedTokenAccountInstruction::CreateIdempotent => CreateIdempotent,
53            AssociatedTokenAccountInstruction::RecoverNested => RecoverNested,
54        )
55    }
56}