carbon_tcomp_decoder/instructions/
mod.rs

1//! This code was AUTOGENERATED using the Codama library.
2use crate::PROGRAM_ID;
3use crate::TcompDecoder;
4
5pub mod bid;
6pub mod buy;
7pub mod buy_core;
8pub mod buy_spl;
9pub mod cancel_bid;
10pub mod close_expired_bid;
11pub mod close_expired_listing;
12pub mod close_expired_listing_core;
13pub mod delist;
14pub mod delist_core;
15pub mod edit;
16pub mod list;
17pub mod list_core;
18pub mod take_bid_core;
19pub mod take_bid_full_meta;
20pub mod take_bid_legacy;
21pub mod take_bid_meta_hash;
22pub mod take_bid_t22;
23pub mod take_bid_wns;
24pub mod tcomp_noop;
25pub mod withdraw_fees;
26
27pub use self::bid::*;
28pub use self::buy::*;
29pub use self::buy_core::*;
30pub use self::buy_spl::*;
31pub use self::cancel_bid::*;
32pub use self::close_expired_bid::*;
33pub use self::close_expired_listing::*;
34pub use self::close_expired_listing_core::*;
35pub use self::delist::*;
36pub use self::delist_core::*;
37pub use self::edit::*;
38pub use self::list::*;
39pub use self::list_core::*;
40pub use self::take_bid_core::*;
41pub use self::take_bid_full_meta::*;
42pub use self::take_bid_legacy::*;
43pub use self::take_bid_meta_hash::*;
44pub use self::take_bid_t22::*;
45pub use self::take_bid_wns::*;
46pub use self::tcomp_noop::*;
47pub use self::withdraw_fees::*;
48
49#[derive(Debug, Clone, PartialEq, Eq, Hash)]
50#[cfg_attr(
51    feature = "serde",
52    derive(carbon_core::InstructionType, serde::Serialize, serde::Deserialize)
53)]
54#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
55pub enum TcompInstruction {
56    Bid(Bid),
57    Buy(Buy),
58    BuyCore(BuyCore),
59    BuySpl(BuySpl),
60    CancelBid(CancelBid),
61    CloseExpiredBid(CloseExpiredBid),
62    CloseExpiredListing(CloseExpiredListing),
63    CloseExpiredListingCore(CloseExpiredListingCore),
64    Delist(Delist),
65    DelistCore(DelistCore),
66    Edit(Edit),
67    List(List),
68    ListCore(ListCore),
69    TakeBidCore(TakeBidCore),
70    TakeBidFullMeta(TakeBidFullMeta),
71    TakeBidLegacy(TakeBidLegacy),
72    TakeBidMetaHash(TakeBidMetaHash),
73    TakeBidT22(TakeBidT22),
74    TakeBidWns(TakeBidWns),
75    TcompNoop(TcompNoop),
76    WithdrawFees(WithdrawFees),
77}
78
79impl carbon_core::instruction::InstructionDecoder<'_> for TcompDecoder {
80    type InstructionType = TcompInstruction;
81
82    fn decode_instruction(
83        &self,
84        instruction: &solana_instruction::Instruction,
85    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
86        if !instruction.program_id.eq(&PROGRAM_ID) {
87            return None;
88        }
89
90        let data = instruction.data.as_slice();
91
92        {
93            if let Some(decoded) = tcomp_noop::TcompNoop::decode(data) {
94                return Some(carbon_core::instruction::DecodedInstruction {
95                    program_id: instruction.program_id,
96                    data: TcompInstruction::TcompNoop(decoded),
97                    accounts: instruction.accounts.clone(),
98                });
99            }
100        }
101        {
102            if let Some(decoded) = withdraw_fees::WithdrawFees::decode(data) {
103                return Some(carbon_core::instruction::DecodedInstruction {
104                    program_id: instruction.program_id,
105                    data: TcompInstruction::WithdrawFees(decoded),
106                    accounts: instruction.accounts.clone(),
107                });
108            }
109        }
110        {
111            if let Some(decoded) = buy::Buy::decode(data) {
112                return Some(carbon_core::instruction::DecodedInstruction {
113                    program_id: instruction.program_id,
114                    data: TcompInstruction::Buy(decoded),
115                    accounts: instruction.accounts.clone(),
116                });
117            }
118        }
119        {
120            if let Some(decoded) = buy_spl::BuySpl::decode(data) {
121                return Some(carbon_core::instruction::DecodedInstruction {
122                    program_id: instruction.program_id,
123                    data: TcompInstruction::BuySpl(decoded),
124                    accounts: instruction.accounts.clone(),
125                });
126            }
127        }
128        {
129            if let Some(decoded) = buy_core::BuyCore::decode(data) {
130                return Some(carbon_core::instruction::DecodedInstruction {
131                    program_id: instruction.program_id,
132                    data: TcompInstruction::BuyCore(decoded),
133                    accounts: instruction.accounts.clone(),
134                });
135            }
136        }
137        {
138            if let Some(decoded) = list::List::decode(data) {
139                return Some(carbon_core::instruction::DecodedInstruction {
140                    program_id: instruction.program_id,
141                    data: TcompInstruction::List(decoded),
142                    accounts: instruction.accounts.clone(),
143                });
144            }
145        }
146        {
147            if let Some(decoded) = delist::Delist::decode(data) {
148                return Some(carbon_core::instruction::DecodedInstruction {
149                    program_id: instruction.program_id,
150                    data: TcompInstruction::Delist(decoded),
151                    accounts: instruction.accounts.clone(),
152                });
153            }
154        }
155        {
156            if let Some(decoded) = edit::Edit::decode(data) {
157                return Some(carbon_core::instruction::DecodedInstruction {
158                    program_id: instruction.program_id,
159                    data: TcompInstruction::Edit(decoded),
160                    accounts: instruction.accounts.clone(),
161                });
162            }
163        }
164        {
165            if let Some(decoded) = list_core::ListCore::decode(data) {
166                return Some(carbon_core::instruction::DecodedInstruction {
167                    program_id: instruction.program_id,
168                    data: TcompInstruction::ListCore(decoded),
169                    accounts: instruction.accounts.clone(),
170                });
171            }
172        }
173        {
174            if let Some(decoded) = delist_core::DelistCore::decode(data) {
175                return Some(carbon_core::instruction::DecodedInstruction {
176                    program_id: instruction.program_id,
177                    data: TcompInstruction::DelistCore(decoded),
178                    accounts: instruction.accounts.clone(),
179                });
180            }
181        }
182        {
183            if let Some(decoded) = bid::Bid::decode(data) {
184                return Some(carbon_core::instruction::DecodedInstruction {
185                    program_id: instruction.program_id,
186                    data: TcompInstruction::Bid(decoded),
187                    accounts: instruction.accounts.clone(),
188                });
189            }
190        }
191        {
192            if let Some(decoded) = cancel_bid::CancelBid::decode(data) {
193                return Some(carbon_core::instruction::DecodedInstruction {
194                    program_id: instruction.program_id,
195                    data: TcompInstruction::CancelBid(decoded),
196                    accounts: instruction.accounts.clone(),
197                });
198            }
199        }
200        {
201            if let Some(decoded) = close_expired_bid::CloseExpiredBid::decode(data) {
202                return Some(carbon_core::instruction::DecodedInstruction {
203                    program_id: instruction.program_id,
204                    data: TcompInstruction::CloseExpiredBid(decoded),
205                    accounts: instruction.accounts.clone(),
206                });
207            }
208        }
209        {
210            if let Some(decoded) = close_expired_listing::CloseExpiredListing::decode(data) {
211                return Some(carbon_core::instruction::DecodedInstruction {
212                    program_id: instruction.program_id,
213                    data: TcompInstruction::CloseExpiredListing(decoded),
214                    accounts: instruction.accounts.clone(),
215                });
216            }
217        }
218        {
219            if let Some(decoded) = close_expired_listing_core::CloseExpiredListingCore::decode(data)
220            {
221                return Some(carbon_core::instruction::DecodedInstruction {
222                    program_id: instruction.program_id,
223                    data: TcompInstruction::CloseExpiredListingCore(decoded),
224                    accounts: instruction.accounts.clone(),
225                });
226            }
227        }
228        {
229            if let Some(decoded) = take_bid_meta_hash::TakeBidMetaHash::decode(data) {
230                return Some(carbon_core::instruction::DecodedInstruction {
231                    program_id: instruction.program_id,
232                    data: TcompInstruction::TakeBidMetaHash(decoded),
233                    accounts: instruction.accounts.clone(),
234                });
235            }
236        }
237        {
238            if let Some(decoded) = take_bid_full_meta::TakeBidFullMeta::decode(data) {
239                return Some(carbon_core::instruction::DecodedInstruction {
240                    program_id: instruction.program_id,
241                    data: TcompInstruction::TakeBidFullMeta(decoded),
242                    accounts: instruction.accounts.clone(),
243                });
244            }
245        }
246        {
247            if let Some(decoded) = take_bid_legacy::TakeBidLegacy::decode(data) {
248                return Some(carbon_core::instruction::DecodedInstruction {
249                    program_id: instruction.program_id,
250                    data: TcompInstruction::TakeBidLegacy(decoded),
251                    accounts: instruction.accounts.clone(),
252                });
253            }
254        }
255        {
256            if let Some(decoded) = take_bid_t22::TakeBidT22::decode(data) {
257                return Some(carbon_core::instruction::DecodedInstruction {
258                    program_id: instruction.program_id,
259                    data: TcompInstruction::TakeBidT22(decoded),
260                    accounts: instruction.accounts.clone(),
261                });
262            }
263        }
264        {
265            if let Some(decoded) = take_bid_wns::TakeBidWns::decode(data) {
266                return Some(carbon_core::instruction::DecodedInstruction {
267                    program_id: instruction.program_id,
268                    data: TcompInstruction::TakeBidWns(decoded),
269                    accounts: instruction.accounts.clone(),
270                });
271            }
272        }
273        {
274            if let Some(decoded) = take_bid_core::TakeBidCore::decode(data) {
275                return Some(carbon_core::instruction::DecodedInstruction {
276                    program_id: instruction.program_id,
277                    data: TcompInstruction::TakeBidCore(decoded),
278                    accounts: instruction.accounts.clone(),
279                });
280            }
281        }
282
283        None
284    }
285}