carbon_mpl_core_decoder/instructions/
mod.rs

1use crate::PROGRAM_ID;
2
3use super::MplCoreProgramDecoder;
4pub mod add_collection_external_plugin_adapter_v1;
5pub mod add_collection_plugin_v1;
6pub mod add_external_plugin_adapter_v1;
7pub mod add_plugin_v1;
8pub mod approve_collection_plugin_authority_v1;
9pub mod approve_plugin_authority_v1;
10pub mod burn_collection_v1;
11pub mod burn_v1;
12pub mod collect;
13pub mod compress_v1;
14pub mod create_collection_v1;
15pub mod create_collection_v2;
16pub mod create_v1;
17pub mod create_v2;
18pub mod decompress_v1;
19pub mod execute_v1;
20pub mod remove_collection_external_plugin_adapter_v1;
21pub mod remove_collection_plugin_v1;
22pub mod remove_external_plugin_adapter_v1;
23pub mod remove_plugin_v1;
24pub mod revoke_collection_plugin_authority_v1;
25pub mod revoke_plugin_authority_v1;
26pub mod transfer_v1;
27pub mod update_collection_external_plugin_adapter_v1;
28pub mod update_collection_plugin_v1;
29pub mod update_collection_v1;
30pub mod update_external_plugin_adapter_v1;
31pub mod update_plugin_v1;
32pub mod update_v1;
33pub mod update_v2;
34pub mod write_collection_external_plugin_adapter_data_v1;
35pub mod write_external_plugin_adapter_data_v1;
36
37#[derive(
38    carbon_core::InstructionType,
39    serde::Serialize,
40    serde::Deserialize,
41    PartialEq,
42    Eq,
43    Debug,
44    Clone,
45    Hash,
46)]
47pub enum MplCoreProgramInstruction {
48    CreateV1(create_v1::CreateV1),
49    CreateCollectionV1(create_collection_v1::CreateCollectionV1),
50    AddPluginV1(add_plugin_v1::AddPluginV1),
51    AddCollectionPluginV1(add_collection_plugin_v1::AddCollectionPluginV1),
52    RemovePluginV1(remove_plugin_v1::RemovePluginV1),
53    RemoveCollectionPluginV1(remove_collection_plugin_v1::RemoveCollectionPluginV1),
54    UpdatePluginV1(update_plugin_v1::UpdatePluginV1),
55    UpdateCollectionPluginV1(update_collection_plugin_v1::UpdateCollectionPluginV1),
56    ApprovePluginAuthorityV1(approve_plugin_authority_v1::ApprovePluginAuthorityV1),
57    ApproveCollectionPluginAuthorityV1(approve_collection_plugin_authority_v1::ApproveCollectionPluginAuthorityV1),
58    RevokePluginAuthorityV1(revoke_plugin_authority_v1::RevokePluginAuthorityV1),
59    RevokeCollectionPluginAuthorityV1(revoke_collection_plugin_authority_v1::RevokeCollectionPluginAuthorityV1),
60    BurnV1(burn_v1::BurnV1),
61    BurnCollectionV1(burn_collection_v1::BurnCollectionV1),
62    TransferV1(transfer_v1::TransferV1),
63    UpdateV1(update_v1::UpdateV1),
64    UpdateCollectionV1(update_collection_v1::UpdateCollectionV1),
65    CompressV1(compress_v1::CompressV1),
66    DecompressV1(decompress_v1::DecompressV1),
67    Collect(collect::Collect),
68    CreateV2(create_v2::CreateV2),
69    CreateCollectionV2(create_collection_v2::CreateCollectionV2),
70    AddExternalPluginAdapterV1(add_external_plugin_adapter_v1::AddExternalPluginAdapterV1),
71    AddCollectionExternalPluginAdapterV1(add_collection_external_plugin_adapter_v1::AddCollectionExternalPluginAdapterV1),
72    RemoveExternalPluginAdapterV1(remove_external_plugin_adapter_v1::RemoveExternalPluginAdapterV1),
73    RemoveCollectionExternalPluginAdapterV1(remove_collection_external_plugin_adapter_v1::RemoveCollectionExternalPluginAdapterV1),
74    UpdateExternalPluginAdapterV1(update_external_plugin_adapter_v1::UpdateExternalPluginAdapterV1),
75    UpdateCollectionExternalPluginAdapterV1(update_collection_external_plugin_adapter_v1::UpdateCollectionExternalPluginAdapterV1),
76    WriteExternalPluginAdapterDataV1(write_external_plugin_adapter_data_v1::WriteExternalPluginAdapterDataV1),
77    WriteCollectionExternalPluginAdapterDataV1(write_collection_external_plugin_adapter_data_v1::WriteCollectionExternalPluginAdapterDataV1),
78    UpdateV2(update_v2::UpdateV2),
79    ExecuteV1(execute_v1::ExecuteV1),
80}
81
82impl carbon_core::instruction::InstructionDecoder<'_> for MplCoreProgramDecoder {
83    type InstructionType = MplCoreProgramInstruction;
84
85    fn decode_instruction(
86        &self,
87        instruction: &solana_instruction::Instruction,
88    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
89        if !instruction.program_id.eq(&PROGRAM_ID) {
90            return None;
91        }
92
93        carbon_core::try_decode_instructions!(instruction,
94            MplCoreProgramInstruction::CreateV1 => create_v1::CreateV1,
95            MplCoreProgramInstruction::CreateCollectionV1 => create_collection_v1::CreateCollectionV1,
96            MplCoreProgramInstruction::AddPluginV1 => add_plugin_v1::AddPluginV1,
97            MplCoreProgramInstruction::AddCollectionPluginV1 => add_collection_plugin_v1::AddCollectionPluginV1,
98            MplCoreProgramInstruction::RemovePluginV1 => remove_plugin_v1::RemovePluginV1,
99            MplCoreProgramInstruction::RemoveCollectionPluginV1 => remove_collection_plugin_v1::RemoveCollectionPluginV1,
100            MplCoreProgramInstruction::UpdatePluginV1 => update_plugin_v1::UpdatePluginV1,
101            MplCoreProgramInstruction::UpdateCollectionPluginV1 => update_collection_plugin_v1::UpdateCollectionPluginV1,
102            MplCoreProgramInstruction::ApprovePluginAuthorityV1 => approve_plugin_authority_v1::ApprovePluginAuthorityV1,
103            MplCoreProgramInstruction::ApproveCollectionPluginAuthorityV1 => approve_collection_plugin_authority_v1::ApproveCollectionPluginAuthorityV1,
104            MplCoreProgramInstruction::RevokePluginAuthorityV1 => revoke_plugin_authority_v1::RevokePluginAuthorityV1,
105            MplCoreProgramInstruction::RevokeCollectionPluginAuthorityV1 => revoke_collection_plugin_authority_v1::RevokeCollectionPluginAuthorityV1,
106            MplCoreProgramInstruction::BurnV1 => burn_v1::BurnV1,
107            MplCoreProgramInstruction::BurnCollectionV1 => burn_collection_v1::BurnCollectionV1,
108            MplCoreProgramInstruction::TransferV1 => transfer_v1::TransferV1,
109            MplCoreProgramInstruction::UpdateV1 => update_v1::UpdateV1,
110            MplCoreProgramInstruction::UpdateCollectionV1 => update_collection_v1::UpdateCollectionV1,
111            MplCoreProgramInstruction::CompressV1 => compress_v1::CompressV1,
112            MplCoreProgramInstruction::DecompressV1 => decompress_v1::DecompressV1,
113            MplCoreProgramInstruction::Collect => collect::Collect,
114            MplCoreProgramInstruction::CreateV2 => create_v2::CreateV2,
115            MplCoreProgramInstruction::CreateCollectionV2 => create_collection_v2::CreateCollectionV2,
116            MplCoreProgramInstruction::AddExternalPluginAdapterV1 => add_external_plugin_adapter_v1::AddExternalPluginAdapterV1,
117            MplCoreProgramInstruction::AddCollectionExternalPluginAdapterV1 => add_collection_external_plugin_adapter_v1::AddCollectionExternalPluginAdapterV1,
118            MplCoreProgramInstruction::RemoveExternalPluginAdapterV1 => remove_external_plugin_adapter_v1::RemoveExternalPluginAdapterV1,
119            MplCoreProgramInstruction::RemoveCollectionExternalPluginAdapterV1 => remove_collection_external_plugin_adapter_v1::RemoveCollectionExternalPluginAdapterV1,
120            MplCoreProgramInstruction::UpdateExternalPluginAdapterV1 => update_external_plugin_adapter_v1::UpdateExternalPluginAdapterV1,
121            MplCoreProgramInstruction::UpdateCollectionExternalPluginAdapterV1 => update_collection_external_plugin_adapter_v1::UpdateCollectionExternalPluginAdapterV1,
122            MplCoreProgramInstruction::WriteExternalPluginAdapterDataV1 => write_external_plugin_adapter_data_v1::WriteExternalPluginAdapterDataV1,
123            MplCoreProgramInstruction::WriteCollectionExternalPluginAdapterDataV1 => write_collection_external_plugin_adapter_data_v1::WriteCollectionExternalPluginAdapterDataV1,
124            MplCoreProgramInstruction::UpdateV2 => update_v2::UpdateV2,
125            MplCoreProgramInstruction::ExecuteV1 => execute_v1::ExecuteV1,
126        )
127    }
128}