carbon_mpl_core_decoder/instructions/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use super::MplCoreDecoder;
pub mod add_collection_plugin_v1;
pub mod add_plugin_v1;
pub mod approve_collection_plugin_authority_v1;
pub mod approve_plugin_authority_v1;
pub mod burn_collection_v1;
pub mod burn_v1;
pub mod collect;
pub mod compress_v1;
pub mod create_collection_v1;
pub mod create_v1;
pub mod decompress_v1;
pub mod remove_collection_plugin_v1;
pub mod remove_plugin_v1;
pub mod revoke_collection_plugin_authority_v1;
pub mod revoke_plugin_authority_v1;
pub mod transfer_v1;
pub mod update_collection_plugin_v1;
pub mod update_collection_v1;
pub mod update_plugin_v1;
pub mod update_v1;

#[derive(
    carbon_core::InstructionType,
    serde::Serialize,
    serde::Deserialize,
    PartialEq,
    Eq,
    Debug,
    Clone,
    Hash,
)]
pub enum MplCoreInstruction {
    CreateV1(create_v1::CreateV1),
    CreateCollectionV1(create_collection_v1::CreateCollectionV1),
    AddPluginV1(add_plugin_v1::AddPluginV1),
    AddCollectionPluginV1(add_collection_plugin_v1::AddCollectionPluginV1),
    RemovePluginV1(remove_plugin_v1::RemovePluginV1),
    RemoveCollectionPluginV1(remove_collection_plugin_v1::RemoveCollectionPluginV1),
    UpdatePluginV1(update_plugin_v1::UpdatePluginV1),
    UpdateCollectionPluginV1(update_collection_plugin_v1::UpdateCollectionPluginV1),
    ApprovePluginAuthorityV1(approve_plugin_authority_v1::ApprovePluginAuthorityV1),
    ApproveCollectionPluginAuthorityV1(
        approve_collection_plugin_authority_v1::ApproveCollectionPluginAuthorityV1,
    ),
    RevokePluginAuthorityV1(revoke_plugin_authority_v1::RevokePluginAuthorityV1),
    RevokeCollectionPluginAuthorityV1(
        revoke_collection_plugin_authority_v1::RevokeCollectionPluginAuthorityV1,
    ),
    BurnV1(burn_v1::BurnV1),
    BurnCollectionV1(burn_collection_v1::BurnCollectionV1),
    TransferV1(transfer_v1::TransferV1),
    UpdateV1(update_v1::UpdateV1),
    UpdateCollectionV1(update_collection_v1::UpdateCollectionV1),
    CompressV1(compress_v1::CompressV1),
    DecompressV1(decompress_v1::DecompressV1),
    Collect(collect::Collect),
}

impl<'a> carbon_core::instruction::InstructionDecoder<'a> for MplCoreDecoder {
    type InstructionType = MplCoreInstruction;

    fn decode_instruction(
        &self,
        instruction: &solana_sdk::instruction::Instruction,
    ) -> Option<carbon_core::instruction::DecodedInstruction<Self::InstructionType>> {
        carbon_core::try_decode_instructions!(instruction,
            MplCoreInstruction::CreateV1 => create_v1::CreateV1,
            MplCoreInstruction::CreateCollectionV1 => create_collection_v1::CreateCollectionV1,
            MplCoreInstruction::AddPluginV1 => add_plugin_v1::AddPluginV1,
            MplCoreInstruction::AddCollectionPluginV1 => add_collection_plugin_v1::AddCollectionPluginV1,
            MplCoreInstruction::RemovePluginV1 => remove_plugin_v1::RemovePluginV1,
            MplCoreInstruction::RemoveCollectionPluginV1 => remove_collection_plugin_v1::RemoveCollectionPluginV1,
            MplCoreInstruction::UpdatePluginV1 => update_plugin_v1::UpdatePluginV1,
            MplCoreInstruction::UpdateCollectionPluginV1 => update_collection_plugin_v1::UpdateCollectionPluginV1,
            MplCoreInstruction::ApprovePluginAuthorityV1 => approve_plugin_authority_v1::ApprovePluginAuthorityV1,
            MplCoreInstruction::ApproveCollectionPluginAuthorityV1 => approve_collection_plugin_authority_v1::ApproveCollectionPluginAuthorityV1,
            MplCoreInstruction::RevokePluginAuthorityV1 => revoke_plugin_authority_v1::RevokePluginAuthorityV1,
            MplCoreInstruction::RevokeCollectionPluginAuthorityV1 => revoke_collection_plugin_authority_v1::RevokeCollectionPluginAuthorityV1,
            MplCoreInstruction::BurnV1 => burn_v1::BurnV1,
            MplCoreInstruction::BurnCollectionV1 => burn_collection_v1::BurnCollectionV1,
            MplCoreInstruction::TransferV1 => transfer_v1::TransferV1,
            MplCoreInstruction::UpdateV1 => update_v1::UpdateV1,
            MplCoreInstruction::UpdateCollectionV1 => update_collection_v1::UpdateCollectionV1,
            MplCoreInstruction::CompressV1 => compress_v1::CompressV1,
            MplCoreInstruction::DecompressV1 => decompress_v1::DecompressV1,
            MplCoreInstruction::Collect => collect::Collect,
        )
    }
}