carbon-mpl-token-metadata-decoder 1.0.0

MPL Token Metadata Decoder
Documentation
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
//! This code was AUTOGENERATED using the Codama library.
use crate::{MplTokenMetadataDecoder, PROGRAM_ID};

#[cfg(feature = "postgres")]
pub mod postgres;

#[cfg(feature = "graphql")]
pub mod graphql;

pub mod approve_collection_authority;
pub mod approve_use_authority;
pub mod bubblegum_set_collection_size;
pub mod burn;
pub mod burn_edition_nft;
pub mod burn_nft;
pub mod close_accounts;
pub mod close_escrow_account;
pub mod collect;
pub mod convert_master_edition_v1_to_v2;
pub mod create;
pub mod create_escrow_account;
pub mod create_master_edition;
pub mod create_master_edition_v3;
pub mod create_metadata_account;
pub mod create_metadata_account_v2;
pub mod create_metadata_account_v3;
pub mod delegate;
pub mod deprecated_create_master_edition;
pub mod deprecated_create_reservation_list;
pub mod deprecated_mint_new_edition_from_master_edition_via_printing_token;
pub mod deprecated_mint_printing_tokens;
pub mod deprecated_mint_printing_tokens_via_token;
pub mod deprecated_set_reservation_list;
pub mod freeze_delegated_account;
pub mod lock;
pub mod migrate;
pub mod mint;
pub mod mint_new_edition_from_master_edition_via_token;
pub mod mint_new_edition_from_master_edition_via_vault_proxy;
pub mod print;
pub mod puff_metadata;
pub mod remove_creator_verification;
pub mod resize;
pub mod revoke;
pub mod revoke_collection_authority;
pub mod revoke_use_authority;
pub mod set_and_verify_collection;
pub mod set_and_verify_sized_collection_item;
pub mod set_collection_size;
pub mod set_token_standard;
pub mod sign_metadata;
pub mod thaw_delegated_account;
pub mod transfer;
pub mod transfer_out_of_escrow;
pub mod unlock;
pub mod unverify;
pub mod unverify_collection;
pub mod unverify_sized_collection_item;
pub mod update;
pub mod update_metadata_account;
pub mod update_metadata_account_v2;
pub mod update_primary_sale_happened_via_token;
pub mod r#use;
pub mod utilize;
pub mod verify;
pub mod verify_collection;
pub mod verify_sized_collection_item;

pub use self::{
    approve_collection_authority::*, approve_use_authority::*, bubblegum_set_collection_size::*,
    burn::*, burn_edition_nft::*, burn_nft::*, close_accounts::*, close_escrow_account::*,
    collect::*, convert_master_edition_v1_to_v2::*, create::*, create_escrow_account::*,
    create_master_edition::*, create_master_edition_v3::*, create_metadata_account::*,
    create_metadata_account_v2::*, create_metadata_account_v3::*, delegate::*,
    deprecated_create_master_edition::*, deprecated_create_reservation_list::*,
    deprecated_mint_new_edition_from_master_edition_via_printing_token::*,
    deprecated_mint_printing_tokens::*, deprecated_mint_printing_tokens_via_token::*,
    deprecated_set_reservation_list::*, freeze_delegated_account::*, lock::*, migrate::*, mint::*,
    mint_new_edition_from_master_edition_via_token::*,
    mint_new_edition_from_master_edition_via_vault_proxy::*, print::*, puff_metadata::*, r#use::*,
    remove_creator_verification::*, resize::*, revoke::*, revoke_collection_authority::*,
    revoke_use_authority::*, set_and_verify_collection::*, set_and_verify_sized_collection_item::*,
    set_collection_size::*, set_token_standard::*, sign_metadata::*, thaw_delegated_account::*,
    transfer::*, transfer_out_of_escrow::*, unlock::*, unverify::*, unverify_collection::*,
    unverify_sized_collection_item::*, update::*, update_metadata_account::*,
    update_metadata_account_v2::*, update_primary_sale_happened_via_token::*, utilize::*,
    verify::*, verify_collection::*, verify_sized_collection_item::*,
};

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "data"))]
pub enum MplTokenMetadataInstruction {
    ApproveCollectionAuthority {
        program_id: solana_pubkey::Pubkey,
        data: ApproveCollectionAuthority,
        accounts: ApproveCollectionAuthorityInstructionAccounts,
    },
    ApproveUseAuthority {
        program_id: solana_pubkey::Pubkey,
        data: ApproveUseAuthority,
        accounts: ApproveUseAuthorityInstructionAccounts,
    },
    BubblegumSetCollectionSize {
        program_id: solana_pubkey::Pubkey,
        data: BubblegumSetCollectionSize,
        accounts: BubblegumSetCollectionSizeInstructionAccounts,
    },
    Burn {
        program_id: solana_pubkey::Pubkey,
        data: Burn,
        accounts: BurnInstructionAccounts,
    },
    BurnEditionNft {
        program_id: solana_pubkey::Pubkey,
        data: BurnEditionNft,
        accounts: BurnEditionNftInstructionAccounts,
    },
    BurnNft {
        program_id: solana_pubkey::Pubkey,
        data: BurnNft,
        accounts: BurnNftInstructionAccounts,
    },
    CloseAccounts {
        program_id: solana_pubkey::Pubkey,
        data: CloseAccounts,
        accounts: CloseAccountsInstructionAccounts,
    },
    CloseEscrowAccount {
        program_id: solana_pubkey::Pubkey,
        data: CloseEscrowAccount,
        accounts: CloseEscrowAccountInstructionAccounts,
    },
    Collect {
        program_id: solana_pubkey::Pubkey,
        data: Collect,
        accounts: CollectInstructionAccounts,
    },
    ConvertMasterEditionV1ToV2 {
        program_id: solana_pubkey::Pubkey,
        data: ConvertMasterEditionV1ToV2,
        accounts: ConvertMasterEditionV1ToV2InstructionAccounts,
    },
    Create {
        program_id: solana_pubkey::Pubkey,
        data: Create,
        accounts: CreateInstructionAccounts,
    },
    CreateEscrowAccount {
        program_id: solana_pubkey::Pubkey,
        data: CreateEscrowAccount,
        accounts: CreateEscrowAccountInstructionAccounts,
    },
    CreateMasterEdition {
        program_id: solana_pubkey::Pubkey,
        data: CreateMasterEdition,
        accounts: CreateMasterEditionInstructionAccounts,
    },
    CreateMasterEditionV3 {
        program_id: solana_pubkey::Pubkey,
        data: CreateMasterEditionV3,
        accounts: CreateMasterEditionV3InstructionAccounts,
    },
    CreateMetadataAccount {
        program_id: solana_pubkey::Pubkey,
        data: CreateMetadataAccount,
        accounts: CreateMetadataAccountInstructionAccounts,
    },
    CreateMetadataAccountV2 {
        program_id: solana_pubkey::Pubkey,
        data: CreateMetadataAccountV2,
        accounts: CreateMetadataAccountV2InstructionAccounts,
    },
    CreateMetadataAccountV3 {
        program_id: solana_pubkey::Pubkey,
        data: CreateMetadataAccountV3,
        accounts: CreateMetadataAccountV3InstructionAccounts,
    },
    Delegate {
        program_id: solana_pubkey::Pubkey,
        data: Delegate,
        accounts: DelegateInstructionAccounts,
    },
    DeprecatedCreateMasterEdition {
        program_id: solana_pubkey::Pubkey,
        data: DeprecatedCreateMasterEdition,
        accounts: DeprecatedCreateMasterEditionInstructionAccounts,
    },
    DeprecatedCreateReservationList {
        program_id: solana_pubkey::Pubkey,
        data: DeprecatedCreateReservationList,
        accounts: DeprecatedCreateReservationListInstructionAccounts,
    },
    DeprecatedMintNewEditionFromMasterEditionViaPrintingToken {
        program_id: solana_pubkey::Pubkey,
        data: DeprecatedMintNewEditionFromMasterEditionViaPrintingToken,
        accounts: DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionAccounts,
    },
    DeprecatedMintPrintingTokens {
        program_id: solana_pubkey::Pubkey,
        data: DeprecatedMintPrintingTokens,
        accounts: DeprecatedMintPrintingTokensInstructionAccounts,
    },
    DeprecatedMintPrintingTokensViaToken {
        program_id: solana_pubkey::Pubkey,
        data: DeprecatedMintPrintingTokensViaToken,
        accounts: DeprecatedMintPrintingTokensViaTokenInstructionAccounts,
    },
    DeprecatedSetReservationList {
        program_id: solana_pubkey::Pubkey,
        data: DeprecatedSetReservationList,
        accounts: DeprecatedSetReservationListInstructionAccounts,
    },
    FreezeDelegatedAccount {
        program_id: solana_pubkey::Pubkey,
        data: FreezeDelegatedAccount,
        accounts: FreezeDelegatedAccountInstructionAccounts,
    },
    Lock {
        program_id: solana_pubkey::Pubkey,
        data: Lock,
        accounts: LockInstructionAccounts,
    },
    Migrate {
        program_id: solana_pubkey::Pubkey,
        data: Migrate,
        accounts: MigrateInstructionAccounts,
    },
    Mint {
        program_id: solana_pubkey::Pubkey,
        data: Mint,
        accounts: MintInstructionAccounts,
    },
    MintNewEditionFromMasterEditionViaToken {
        program_id: solana_pubkey::Pubkey,
        data: MintNewEditionFromMasterEditionViaToken,
        accounts: MintNewEditionFromMasterEditionViaTokenInstructionAccounts,
    },
    MintNewEditionFromMasterEditionViaVaultProxy {
        program_id: solana_pubkey::Pubkey,
        data: MintNewEditionFromMasterEditionViaVaultProxy,
        accounts: MintNewEditionFromMasterEditionViaVaultProxyInstructionAccounts,
    },
    Print {
        program_id: solana_pubkey::Pubkey,
        data: Print,
        accounts: PrintInstructionAccounts,
    },
    PuffMetadata {
        program_id: solana_pubkey::Pubkey,
        data: PuffMetadata,
        accounts: PuffMetadataInstructionAccounts,
    },
    RemoveCreatorVerification {
        program_id: solana_pubkey::Pubkey,
        data: RemoveCreatorVerification,
        accounts: RemoveCreatorVerificationInstructionAccounts,
    },
    Resize {
        program_id: solana_pubkey::Pubkey,
        data: Resize,
        accounts: ResizeInstructionAccounts,
    },
    Revoke {
        program_id: solana_pubkey::Pubkey,
        data: Revoke,
        accounts: RevokeInstructionAccounts,
    },
    RevokeCollectionAuthority {
        program_id: solana_pubkey::Pubkey,
        data: RevokeCollectionAuthority,
        accounts: RevokeCollectionAuthorityInstructionAccounts,
    },
    RevokeUseAuthority {
        program_id: solana_pubkey::Pubkey,
        data: RevokeUseAuthority,
        accounts: RevokeUseAuthorityInstructionAccounts,
    },
    SetAndVerifyCollection {
        program_id: solana_pubkey::Pubkey,
        data: SetAndVerifyCollection,
        accounts: SetAndVerifyCollectionInstructionAccounts,
    },
    SetAndVerifySizedCollectionItem {
        program_id: solana_pubkey::Pubkey,
        data: SetAndVerifySizedCollectionItem,
        accounts: SetAndVerifySizedCollectionItemInstructionAccounts,
    },
    SetCollectionSize {
        program_id: solana_pubkey::Pubkey,
        data: SetCollectionSize,
        accounts: SetCollectionSizeInstructionAccounts,
    },
    SetTokenStandard {
        program_id: solana_pubkey::Pubkey,
        data: SetTokenStandard,
        accounts: SetTokenStandardInstructionAccounts,
    },
    SignMetadata {
        program_id: solana_pubkey::Pubkey,
        data: SignMetadata,
        accounts: SignMetadataInstructionAccounts,
    },
    ThawDelegatedAccount {
        program_id: solana_pubkey::Pubkey,
        data: ThawDelegatedAccount,
        accounts: ThawDelegatedAccountInstructionAccounts,
    },
    Transfer {
        program_id: solana_pubkey::Pubkey,
        data: Transfer,
        accounts: TransferInstructionAccounts,
    },
    TransferOutOfEscrow {
        program_id: solana_pubkey::Pubkey,
        data: TransferOutOfEscrow,
        accounts: TransferOutOfEscrowInstructionAccounts,
    },
    Unlock {
        program_id: solana_pubkey::Pubkey,
        data: Unlock,
        accounts: UnlockInstructionAccounts,
    },
    Unverify {
        program_id: solana_pubkey::Pubkey,
        data: Unverify,
        accounts: UnverifyInstructionAccounts,
    },
    UnverifyCollection {
        program_id: solana_pubkey::Pubkey,
        data: UnverifyCollection,
        accounts: UnverifyCollectionInstructionAccounts,
    },
    UnverifySizedCollectionItem {
        program_id: solana_pubkey::Pubkey,
        data: UnverifySizedCollectionItem,
        accounts: UnverifySizedCollectionItemInstructionAccounts,
    },
    Update {
        program_id: solana_pubkey::Pubkey,
        data: Update,
        accounts: UpdateInstructionAccounts,
    },
    UpdateMetadataAccount {
        program_id: solana_pubkey::Pubkey,
        data: UpdateMetadataAccount,
        accounts: UpdateMetadataAccountInstructionAccounts,
    },
    UpdateMetadataAccountV2 {
        program_id: solana_pubkey::Pubkey,
        data: UpdateMetadataAccountV2,
        accounts: UpdateMetadataAccountV2InstructionAccounts,
    },
    UpdatePrimarySaleHappenedViaToken {
        program_id: solana_pubkey::Pubkey,
        data: UpdatePrimarySaleHappenedViaToken,
        accounts: UpdatePrimarySaleHappenedViaTokenInstructionAccounts,
    },
    Use {
        program_id: solana_pubkey::Pubkey,
        data: Use,
        accounts: UseInstructionAccounts,
    },
    Utilize {
        program_id: solana_pubkey::Pubkey,
        data: Utilize,
        accounts: UtilizeInstructionAccounts,
    },
    Verify {
        program_id: solana_pubkey::Pubkey,
        data: Verify,
        accounts: VerifyInstructionAccounts,
    },
    VerifyCollection {
        program_id: solana_pubkey::Pubkey,
        data: VerifyCollection,
        accounts: VerifyCollectionInstructionAccounts,
    },
    VerifySizedCollectionItem {
        program_id: solana_pubkey::Pubkey,
        data: VerifySizedCollectionItem,
        accounts: VerifySizedCollectionItemInstructionAccounts,
    },
}

impl carbon_core::instruction::InstructionDecoder<'_> for MplTokenMetadataDecoder {
    type InstructionType = MplTokenMetadataInstruction;

    fn decode_instruction(
        &self,
        instruction: &solana_instruction::Instruction,
    ) -> Option<Self::InstructionType> {
        if instruction.program_id != PROGRAM_ID {
            return None;
        }

        carbon_core::try_decode_instructions!(
            instruction,
            PROGRAM_ID,
            MplTokenMetadataInstruction::ApproveCollectionAuthority => ApproveCollectionAuthority,
            MplTokenMetadataInstruction::ApproveUseAuthority => ApproveUseAuthority,
            MplTokenMetadataInstruction::BubblegumSetCollectionSize => BubblegumSetCollectionSize,
            MplTokenMetadataInstruction::Burn => Burn,
            MplTokenMetadataInstruction::BurnEditionNft => BurnEditionNft,
            MplTokenMetadataInstruction::BurnNft => BurnNft,
            MplTokenMetadataInstruction::CloseAccounts => CloseAccounts,
            MplTokenMetadataInstruction::CloseEscrowAccount => CloseEscrowAccount,
            MplTokenMetadataInstruction::Collect => Collect,
            MplTokenMetadataInstruction::ConvertMasterEditionV1ToV2 => ConvertMasterEditionV1ToV2,
            MplTokenMetadataInstruction::Create => Create,
            MplTokenMetadataInstruction::CreateEscrowAccount => CreateEscrowAccount,
            MplTokenMetadataInstruction::CreateMasterEdition => CreateMasterEdition,
            MplTokenMetadataInstruction::CreateMasterEditionV3 => CreateMasterEditionV3,
            MplTokenMetadataInstruction::CreateMetadataAccount => CreateMetadataAccount,
            MplTokenMetadataInstruction::CreateMetadataAccountV2 => CreateMetadataAccountV2,
            MplTokenMetadataInstruction::CreateMetadataAccountV3 => CreateMetadataAccountV3,
            MplTokenMetadataInstruction::Delegate => Delegate,
            MplTokenMetadataInstruction::DeprecatedCreateMasterEdition => DeprecatedCreateMasterEdition,
            MplTokenMetadataInstruction::DeprecatedCreateReservationList => DeprecatedCreateReservationList,
            MplTokenMetadataInstruction::DeprecatedMintNewEditionFromMasterEditionViaPrintingToken => DeprecatedMintNewEditionFromMasterEditionViaPrintingToken,
            MplTokenMetadataInstruction::DeprecatedMintPrintingTokens => DeprecatedMintPrintingTokens,
            MplTokenMetadataInstruction::DeprecatedMintPrintingTokensViaToken => DeprecatedMintPrintingTokensViaToken,
            MplTokenMetadataInstruction::DeprecatedSetReservationList => DeprecatedSetReservationList,
            MplTokenMetadataInstruction::FreezeDelegatedAccount => FreezeDelegatedAccount,
            MplTokenMetadataInstruction::Lock => Lock,
            MplTokenMetadataInstruction::Migrate => Migrate,
            MplTokenMetadataInstruction::Mint => Mint,
            MplTokenMetadataInstruction::MintNewEditionFromMasterEditionViaToken => MintNewEditionFromMasterEditionViaToken,
            MplTokenMetadataInstruction::MintNewEditionFromMasterEditionViaVaultProxy => MintNewEditionFromMasterEditionViaVaultProxy,
            MplTokenMetadataInstruction::Print => Print,
            MplTokenMetadataInstruction::PuffMetadata => PuffMetadata,
            MplTokenMetadataInstruction::RemoveCreatorVerification => RemoveCreatorVerification,
            MplTokenMetadataInstruction::Resize => Resize,
            MplTokenMetadataInstruction::Revoke => Revoke,
            MplTokenMetadataInstruction::RevokeCollectionAuthority => RevokeCollectionAuthority,
            MplTokenMetadataInstruction::RevokeUseAuthority => RevokeUseAuthority,
            MplTokenMetadataInstruction::SetAndVerifyCollection => SetAndVerifyCollection,
            MplTokenMetadataInstruction::SetAndVerifySizedCollectionItem => SetAndVerifySizedCollectionItem,
            MplTokenMetadataInstruction::SetCollectionSize => SetCollectionSize,
            MplTokenMetadataInstruction::SetTokenStandard => SetTokenStandard,
            MplTokenMetadataInstruction::SignMetadata => SignMetadata,
            MplTokenMetadataInstruction::ThawDelegatedAccount => ThawDelegatedAccount,
            MplTokenMetadataInstruction::Transfer => Transfer,
            MplTokenMetadataInstruction::TransferOutOfEscrow => TransferOutOfEscrow,
            MplTokenMetadataInstruction::Unlock => Unlock,
            MplTokenMetadataInstruction::Unverify => Unverify,
            MplTokenMetadataInstruction::UnverifyCollection => UnverifyCollection,
            MplTokenMetadataInstruction::UnverifySizedCollectionItem => UnverifySizedCollectionItem,
            MplTokenMetadataInstruction::Update => Update,
            MplTokenMetadataInstruction::UpdateMetadataAccount => UpdateMetadataAccount,
            MplTokenMetadataInstruction::UpdateMetadataAccountV2 => UpdateMetadataAccountV2,
            MplTokenMetadataInstruction::UpdatePrimarySaleHappenedViaToken => UpdatePrimarySaleHappenedViaToken,
            MplTokenMetadataInstruction::Use => Use,
            MplTokenMetadataInstruction::Utilize => Utilize,
            MplTokenMetadataInstruction::Verify => Verify,
            MplTokenMetadataInstruction::VerifyCollection => VerifyCollection,
            MplTokenMetadataInstruction::VerifySizedCollectionItem => VerifySizedCollectionItem,
        )
    }
}