carbon_stake_program_decoder/instructions/
mod.rs1use crate::{StakeProgramDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod authorize;
11pub mod authorize_checked;
12pub mod authorize_checked_with_seed;
13pub mod authorize_with_seed;
14pub mod deactivate;
15pub mod deactivate_delinquent;
16pub mod delegate_stake;
17pub mod get_minimum_delegation;
18pub mod initialize;
19pub mod initialize_checked;
20pub mod merge;
21pub mod move_lamports;
22pub mod move_stake;
23pub mod redelegate;
24pub mod set_lockup;
25pub mod set_lockup_checked;
26pub mod split;
27pub mod withdraw;
28
29pub use self::{
30 authorize::*, authorize_checked::*, authorize_checked_with_seed::*, authorize_with_seed::*,
31 deactivate::*, deactivate_delinquent::*, delegate_stake::*, get_minimum_delegation::*,
32 initialize::*, initialize_checked::*, merge::*, move_lamports::*, move_stake::*, redelegate::*,
33 set_lockup::*, set_lockup_checked::*, split::*, withdraw::*,
34};
35
36#[derive(Debug, Clone, PartialEq)]
37#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
38#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
39pub enum StakeProgramInstruction {
40 Authorize {
41 program_id: solana_pubkey::Pubkey,
42 data: Authorize,
43 accounts: AuthorizeInstructionAccounts,
44 },
45 AuthorizeChecked {
46 program_id: solana_pubkey::Pubkey,
47 data: AuthorizeChecked,
48 accounts: AuthorizeCheckedInstructionAccounts,
49 },
50 AuthorizeCheckedWithSeed {
51 program_id: solana_pubkey::Pubkey,
52 data: AuthorizeCheckedWithSeed,
53 accounts: AuthorizeCheckedWithSeedInstructionAccounts,
54 },
55 AuthorizeWithSeed {
56 program_id: solana_pubkey::Pubkey,
57 data: AuthorizeWithSeed,
58 accounts: AuthorizeWithSeedInstructionAccounts,
59 },
60 Deactivate {
61 program_id: solana_pubkey::Pubkey,
62 data: Deactivate,
63 accounts: DeactivateInstructionAccounts,
64 },
65 DeactivateDelinquent {
66 program_id: solana_pubkey::Pubkey,
67 data: DeactivateDelinquent,
68 accounts: DeactivateDelinquentInstructionAccounts,
69 },
70 DelegateStake {
71 program_id: solana_pubkey::Pubkey,
72 data: DelegateStake,
73 accounts: DelegateStakeInstructionAccounts,
74 },
75 GetMinimumDelegation {
76 program_id: solana_pubkey::Pubkey,
77 data: GetMinimumDelegation,
78 accounts: GetMinimumDelegationInstructionAccounts,
79 },
80 Initialize {
81 program_id: solana_pubkey::Pubkey,
82 data: Initialize,
83 accounts: InitializeInstructionAccounts,
84 },
85 InitializeChecked {
86 program_id: solana_pubkey::Pubkey,
87 data: InitializeChecked,
88 accounts: InitializeCheckedInstructionAccounts,
89 },
90 Merge {
91 program_id: solana_pubkey::Pubkey,
92 data: Merge,
93 accounts: MergeInstructionAccounts,
94 },
95 MoveLamports {
96 program_id: solana_pubkey::Pubkey,
97 data: MoveLamports,
98 accounts: MoveLamportsInstructionAccounts,
99 },
100 MoveStake {
101 program_id: solana_pubkey::Pubkey,
102 data: MoveStake,
103 accounts: MoveStakeInstructionAccounts,
104 },
105 Redelegate {
106 program_id: solana_pubkey::Pubkey,
107 data: Redelegate,
108 accounts: RedelegateInstructionAccounts,
109 },
110 SetLockup {
111 program_id: solana_pubkey::Pubkey,
112 data: SetLockup,
113 accounts: SetLockupInstructionAccounts,
114 },
115 SetLockupChecked {
116 program_id: solana_pubkey::Pubkey,
117 data: SetLockupChecked,
118 accounts: SetLockupCheckedInstructionAccounts,
119 },
120 Split {
121 program_id: solana_pubkey::Pubkey,
122 data: Split,
123 accounts: SplitInstructionAccounts,
124 },
125 Withdraw {
126 program_id: solana_pubkey::Pubkey,
127 data: Withdraw,
128 accounts: WithdrawInstructionAccounts,
129 },
130}
131
132impl carbon_core::instruction::InstructionDecoder<'_> for StakeProgramDecoder {
133 type InstructionType = StakeProgramInstruction;
134
135 fn decode_instruction(
136 &self,
137 instruction: &solana_instruction::Instruction,
138 ) -> Option<Self::InstructionType> {
139 if instruction.program_id != PROGRAM_ID {
140 return None;
141 }
142
143 carbon_core::try_decode_instructions!(
144 instruction,
145 PROGRAM_ID,
146 StakeProgramInstruction::Authorize => Authorize,
147 StakeProgramInstruction::AuthorizeChecked => AuthorizeChecked,
148 StakeProgramInstruction::AuthorizeCheckedWithSeed => AuthorizeCheckedWithSeed,
149 StakeProgramInstruction::AuthorizeWithSeed => AuthorizeWithSeed,
150 StakeProgramInstruction::Deactivate => Deactivate,
151 StakeProgramInstruction::DeactivateDelinquent => DeactivateDelinquent,
152 StakeProgramInstruction::DelegateStake => DelegateStake,
153 StakeProgramInstruction::GetMinimumDelegation => GetMinimumDelegation,
154 StakeProgramInstruction::Initialize => Initialize,
155 StakeProgramInstruction::InitializeChecked => InitializeChecked,
156 StakeProgramInstruction::Merge => Merge,
157 StakeProgramInstruction::MoveLamports => MoveLamports,
158 StakeProgramInstruction::MoveStake => MoveStake,
159 StakeProgramInstruction::Redelegate => Redelegate,
160 StakeProgramInstruction::SetLockup => SetLockup,
161 StakeProgramInstruction::SetLockupChecked => SetLockupChecked,
162 StakeProgramInstruction::Split => Split,
163 StakeProgramInstruction::Withdraw => Withdraw,
164 )
165 }
166}