Skip to main content

carbon_name_service_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::{NameServiceDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod create;
11pub mod delete;
12pub mod realloc;
13pub mod transfer;
14pub mod update;
15
16pub use self::{create::*, delete::*, realloc::*, transfer::*, update::*};
17
18#[derive(Debug, Clone, PartialEq)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
21pub enum NameServiceInstruction {
22    Create {
23        program_id: solana_pubkey::Pubkey,
24        data: Create,
25        accounts: CreateInstructionAccounts,
26    },
27    Delete {
28        program_id: solana_pubkey::Pubkey,
29        data: Delete,
30        accounts: DeleteInstructionAccounts,
31    },
32    Realloc {
33        program_id: solana_pubkey::Pubkey,
34        data: Realloc,
35        accounts: ReallocInstructionAccounts,
36    },
37    Transfer {
38        program_id: solana_pubkey::Pubkey,
39        data: Transfer,
40        accounts: TransferInstructionAccounts,
41    },
42    Update {
43        program_id: solana_pubkey::Pubkey,
44        data: Update,
45        accounts: UpdateInstructionAccounts,
46    },
47}
48
49impl carbon_core::instruction::InstructionDecoder<'_> for NameServiceDecoder {
50    type InstructionType = NameServiceInstruction;
51
52    fn decode_instruction(
53        &self,
54        instruction: &solana_instruction::Instruction,
55    ) -> Option<Self::InstructionType> {
56        if instruction.program_id != PROGRAM_ID {
57            return None;
58        }
59
60        carbon_core::try_decode_instructions!(
61            instruction,
62            PROGRAM_ID,
63            NameServiceInstruction::Create => Create,
64            NameServiceInstruction::Delete => Delete,
65            NameServiceInstruction::Realloc => Realloc,
66            NameServiceInstruction::Transfer => Transfer,
67            NameServiceInstruction::Update => Update,
68        )
69    }
70}