carbon_bubblegum_decoder/instructions/
mod.rs1use crate::{BubblegumDecoder, PROGRAM_ID};
3
4#[cfg(feature = "postgres")]
5pub mod postgres;
6
7#[cfg(feature = "graphql")]
8pub mod graphql;
9
10pub mod burn;
11pub mod cancel_redeem;
12pub mod create_tree;
13pub mod decompress_v1;
14pub mod delegate;
15pub mod mint_to_collection_v1;
16pub mod mint_v1;
17pub mod redeem;
18pub mod set_and_verify_collection;
19pub mod set_decompressible_state;
20pub mod set_tree_delegate;
21pub mod transfer;
22pub mod unverify_collection;
23pub mod unverify_creator;
24pub mod update_metadata;
25pub mod verify_collection;
26pub mod verify_creator;
27
28pub use self::{
29 burn::*, cancel_redeem::*, create_tree::*, decompress_v1::*, delegate::*,
30 mint_to_collection_v1::*, mint_v1::*, redeem::*, set_and_verify_collection::*,
31 set_decompressible_state::*, set_tree_delegate::*, transfer::*, unverify_collection::*,
32 unverify_creator::*, update_metadata::*, verify_collection::*, verify_creator::*,
33};
34
35#[derive(Debug, Clone, PartialEq)]
36#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
37#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
38pub enum BubblegumInstruction {
39 Burn {
40 program_id: solana_pubkey::Pubkey,
41 data: Burn,
42 accounts: BurnInstructionAccounts,
43 },
44 CancelRedeem {
45 program_id: solana_pubkey::Pubkey,
46 data: CancelRedeem,
47 accounts: CancelRedeemInstructionAccounts,
48 },
49 CreateTree {
50 program_id: solana_pubkey::Pubkey,
51 data: CreateTree,
52 accounts: CreateTreeInstructionAccounts,
53 },
54 DecompressV1 {
55 program_id: solana_pubkey::Pubkey,
56 data: DecompressV1,
57 accounts: DecompressV1InstructionAccounts,
58 },
59 Delegate {
60 program_id: solana_pubkey::Pubkey,
61 data: Delegate,
62 accounts: DelegateInstructionAccounts,
63 },
64 MintToCollectionV1 {
65 program_id: solana_pubkey::Pubkey,
66 data: MintToCollectionV1,
67 accounts: MintToCollectionV1InstructionAccounts,
68 },
69 MintV1 {
70 program_id: solana_pubkey::Pubkey,
71 data: MintV1,
72 accounts: MintV1InstructionAccounts,
73 },
74 Redeem {
75 program_id: solana_pubkey::Pubkey,
76 data: Redeem,
77 accounts: RedeemInstructionAccounts,
78 },
79 SetAndVerifyCollection {
80 program_id: solana_pubkey::Pubkey,
81 data: SetAndVerifyCollection,
82 accounts: SetAndVerifyCollectionInstructionAccounts,
83 },
84 SetDecompressibleState {
85 program_id: solana_pubkey::Pubkey,
86 data: SetDecompressibleState,
87 accounts: SetDecompressibleStateInstructionAccounts,
88 },
89 SetTreeDelegate {
90 program_id: solana_pubkey::Pubkey,
91 data: SetTreeDelegate,
92 accounts: SetTreeDelegateInstructionAccounts,
93 },
94 Transfer {
95 program_id: solana_pubkey::Pubkey,
96 data: Transfer,
97 accounts: TransferInstructionAccounts,
98 },
99 UnverifyCollection {
100 program_id: solana_pubkey::Pubkey,
101 data: UnverifyCollection,
102 accounts: UnverifyCollectionInstructionAccounts,
103 },
104 UnverifyCreator {
105 program_id: solana_pubkey::Pubkey,
106 data: UnverifyCreator,
107 accounts: UnverifyCreatorInstructionAccounts,
108 },
109 UpdateMetadata {
110 program_id: solana_pubkey::Pubkey,
111 data: UpdateMetadata,
112 accounts: UpdateMetadataInstructionAccounts,
113 },
114 VerifyCollection {
115 program_id: solana_pubkey::Pubkey,
116 data: VerifyCollection,
117 accounts: VerifyCollectionInstructionAccounts,
118 },
119 VerifyCreator {
120 program_id: solana_pubkey::Pubkey,
121 data: VerifyCreator,
122 accounts: VerifyCreatorInstructionAccounts,
123 },
124}
125
126impl carbon_core::instruction::InstructionDecoder<'_> for BubblegumDecoder {
127 type InstructionType = BubblegumInstruction;
128
129 fn decode_instruction(
130 &self,
131 instruction: &solana_instruction::Instruction,
132 ) -> Option<Self::InstructionType> {
133 if instruction.program_id != PROGRAM_ID {
134 return None;
135 }
136
137 carbon_core::try_decode_instructions!(
138 instruction,
139 PROGRAM_ID,
140 BubblegumInstruction::Burn => Burn,
141 BubblegumInstruction::CancelRedeem => CancelRedeem,
142 BubblegumInstruction::CreateTree => CreateTree,
143 BubblegumInstruction::DecompressV1 => DecompressV1,
144 BubblegumInstruction::Delegate => Delegate,
145 BubblegumInstruction::MintToCollectionV1 => MintToCollectionV1,
146 BubblegumInstruction::MintV1 => MintV1,
147 BubblegumInstruction::Redeem => Redeem,
148 BubblegumInstruction::SetAndVerifyCollection => SetAndVerifyCollection,
149 BubblegumInstruction::SetDecompressibleState => SetDecompressibleState,
150 BubblegumInstruction::SetTreeDelegate => SetTreeDelegate,
151 BubblegumInstruction::Transfer => Transfer,
152 BubblegumInstruction::UnverifyCollection => UnverifyCollection,
153 BubblegumInstruction::UnverifyCreator => UnverifyCreator,
154 BubblegumInstruction::UpdateMetadata => UpdateMetadata,
155 BubblegumInstruction::VerifyCollection => VerifyCollection,
156 BubblegumInstruction::VerifyCreator => VerifyCreator,
157 )
158 }
159}