Skip to main content

carbon_system_program_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::{SystemProgramDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod advance_nonce_account;
11pub mod allocate;
12pub mod allocate_with_seed;
13pub mod assign;
14pub mod assign_with_seed;
15pub mod authorize_nonce_account;
16pub mod create_account;
17pub mod create_account_with_seed;
18pub mod initialize_nonce_account;
19pub mod transfer_sol;
20pub mod transfer_sol_with_seed;
21pub mod upgrade_nonce_account;
22pub mod withdraw_nonce_account;
23
24pub use self::{
25    advance_nonce_account::*, allocate::*, allocate_with_seed::*, assign::*, assign_with_seed::*,
26    authorize_nonce_account::*, create_account::*, create_account_with_seed::*,
27    initialize_nonce_account::*, transfer_sol::*, transfer_sol_with_seed::*,
28    upgrade_nonce_account::*, withdraw_nonce_account::*,
29};
30
31#[derive(Debug, Clone, PartialEq)]
32#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
33#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
34pub enum SystemProgramInstruction {
35    AdvanceNonceAccount {
36        program_id: solana_pubkey::Pubkey,
37        data: AdvanceNonceAccount,
38        accounts: AdvanceNonceAccountInstructionAccounts,
39    },
40    Allocate {
41        program_id: solana_pubkey::Pubkey,
42        data: Allocate,
43        accounts: AllocateInstructionAccounts,
44    },
45    AllocateWithSeed {
46        program_id: solana_pubkey::Pubkey,
47        data: AllocateWithSeed,
48        accounts: AllocateWithSeedInstructionAccounts,
49    },
50    Assign {
51        program_id: solana_pubkey::Pubkey,
52        data: Assign,
53        accounts: AssignInstructionAccounts,
54    },
55    AssignWithSeed {
56        program_id: solana_pubkey::Pubkey,
57        data: AssignWithSeed,
58        accounts: AssignWithSeedInstructionAccounts,
59    },
60    AuthorizeNonceAccount {
61        program_id: solana_pubkey::Pubkey,
62        data: AuthorizeNonceAccount,
63        accounts: AuthorizeNonceAccountInstructionAccounts,
64    },
65    CreateAccount {
66        program_id: solana_pubkey::Pubkey,
67        data: CreateAccount,
68        accounts: CreateAccountInstructionAccounts,
69    },
70    CreateAccountWithSeed {
71        program_id: solana_pubkey::Pubkey,
72        data: CreateAccountWithSeed,
73        accounts: CreateAccountWithSeedInstructionAccounts,
74    },
75    InitializeNonceAccount {
76        program_id: solana_pubkey::Pubkey,
77        data: InitializeNonceAccount,
78        accounts: InitializeNonceAccountInstructionAccounts,
79    },
80    TransferSol {
81        program_id: solana_pubkey::Pubkey,
82        data: TransferSol,
83        accounts: TransferSolInstructionAccounts,
84    },
85    TransferSolWithSeed {
86        program_id: solana_pubkey::Pubkey,
87        data: TransferSolWithSeed,
88        accounts: TransferSolWithSeedInstructionAccounts,
89    },
90    UpgradeNonceAccount {
91        program_id: solana_pubkey::Pubkey,
92        data: UpgradeNonceAccount,
93        accounts: UpgradeNonceAccountInstructionAccounts,
94    },
95    WithdrawNonceAccount {
96        program_id: solana_pubkey::Pubkey,
97        data: WithdrawNonceAccount,
98        accounts: WithdrawNonceAccountInstructionAccounts,
99    },
100}
101
102impl carbon_core::instruction::InstructionDecoder<'_> for SystemProgramDecoder {
103    type InstructionType = SystemProgramInstruction;
104
105    fn decode_instruction(
106        &self,
107        instruction: &solana_instruction::Instruction,
108    ) -> Option<Self::InstructionType> {
109        if instruction.program_id != PROGRAM_ID {
110            return None;
111        }
112
113        carbon_core::try_decode_instructions!(
114            instruction,
115            PROGRAM_ID,
116            SystemProgramInstruction::AdvanceNonceAccount => AdvanceNonceAccount,
117            SystemProgramInstruction::Allocate => Allocate,
118            SystemProgramInstruction::AllocateWithSeed => AllocateWithSeed,
119            SystemProgramInstruction::Assign => Assign,
120            SystemProgramInstruction::AssignWithSeed => AssignWithSeed,
121            SystemProgramInstruction::AuthorizeNonceAccount => AuthorizeNonceAccount,
122            SystemProgramInstruction::CreateAccount => CreateAccount,
123            SystemProgramInstruction::CreateAccountWithSeed => CreateAccountWithSeed,
124            SystemProgramInstruction::InitializeNonceAccount => InitializeNonceAccount,
125            SystemProgramInstruction::TransferSol => TransferSol,
126            SystemProgramInstruction::TransferSolWithSeed => TransferSolWithSeed,
127            SystemProgramInstruction::UpgradeNonceAccount => UpgradeNonceAccount,
128            SystemProgramInstruction::WithdrawNonceAccount => WithdrawNonceAccount,
129        )
130    }
131}