carbon-mpl-token-metadata-decoder 1.0.0

MPL Token Metadata Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod approve_collection_authority_schema;
pub mod approve_use_authority_schema;
pub mod bubblegum_set_collection_size_schema;
pub mod burn_edition_nft_schema;
pub mod burn_nft_schema;
pub mod burn_schema;
pub mod close_accounts_schema;
pub mod close_escrow_account_schema;
pub mod collect_schema;
pub mod convert_master_edition_v1_to_v2_schema;
pub mod create_escrow_account_schema;
pub mod create_master_edition_schema;
pub mod create_master_edition_v3_schema;
pub mod create_metadata_account_schema;
pub mod create_metadata_account_v2_schema;
pub mod create_metadata_account_v3_schema;
pub mod create_schema;
pub mod delegate_schema;
pub mod deprecated_create_master_edition_schema;
pub mod deprecated_create_reservation_list_schema;
pub mod deprecated_mint_new_edition_from_master_edition_via_printing_token_schema;
pub mod deprecated_mint_printing_tokens_schema;
pub mod deprecated_mint_printing_tokens_via_token_schema;
pub mod deprecated_set_reservation_list_schema;
pub mod freeze_delegated_account_schema;
pub mod lock_schema;
pub mod migrate_schema;
pub mod mint_new_edition_from_master_edition_via_token_schema;
pub mod mint_new_edition_from_master_edition_via_vault_proxy_schema;
pub mod mint_schema;
pub mod print_schema;
pub mod puff_metadata_schema;
pub mod remove_creator_verification_schema;
pub mod resize_schema;
pub mod revoke_collection_authority_schema;
pub mod revoke_schema;
pub mod revoke_use_authority_schema;
pub mod set_and_verify_collection_schema;
pub mod set_and_verify_sized_collection_item_schema;
pub mod set_collection_size_schema;
pub mod set_token_standard_schema;
pub mod sign_metadata_schema;
pub mod thaw_delegated_account_schema;
pub mod transfer_out_of_escrow_schema;
pub mod transfer_schema;
pub mod unlock_schema;
pub mod unverify_collection_schema;
pub mod unverify_schema;
pub mod unverify_sized_collection_item_schema;
pub mod update_metadata_account_schema;
pub mod update_metadata_account_v2_schema;
pub mod update_primary_sale_happened_via_token_schema;
pub mod update_schema;
pub mod r#use_schema;
pub mod utilize_schema;
pub mod verify_collection_schema;
pub mod verify_schema;
pub mod verify_sized_collection_item_schema;

use juniper::GraphQLObject;
pub use {
    approve_collection_authority_schema::*, approve_use_authority_schema::*,
    bubblegum_set_collection_size_schema::*, burn_edition_nft_schema::*, burn_nft_schema::*,
    burn_schema::*, close_accounts_schema::*, close_escrow_account_schema::*, collect_schema::*,
    convert_master_edition_v1_to_v2_schema::*, create_escrow_account_schema::*,
    create_master_edition_schema::*, create_master_edition_v3_schema::*,
    create_metadata_account_schema::*, create_metadata_account_v2_schema::*,
    create_metadata_account_v3_schema::*, create_schema::*, delegate_schema::*,
    deprecated_create_master_edition_schema::*, deprecated_create_reservation_list_schema::*,
    deprecated_mint_new_edition_from_master_edition_via_printing_token_schema::*,
    deprecated_mint_printing_tokens_schema::*, deprecated_mint_printing_tokens_via_token_schema::*,
    deprecated_set_reservation_list_schema::*, freeze_delegated_account_schema::*, lock_schema::*,
    migrate_schema::*, mint_new_edition_from_master_edition_via_token_schema::*,
    mint_new_edition_from_master_edition_via_vault_proxy_schema::*, mint_schema::*,
    print_schema::*, puff_metadata_schema::*, r#use_schema::*,
    remove_creator_verification_schema::*, resize_schema::*, revoke_collection_authority_schema::*,
    revoke_schema::*, revoke_use_authority_schema::*, set_and_verify_collection_schema::*,
    set_and_verify_sized_collection_item_schema::*, set_collection_size_schema::*,
    set_token_standard_schema::*, sign_metadata_schema::*, thaw_delegated_account_schema::*,
    transfer_out_of_escrow_schema::*, transfer_schema::*, unlock_schema::*,
    unverify_collection_schema::*, unverify_schema::*, unverify_sized_collection_item_schema::*,
    update_metadata_account_schema::*, update_metadata_account_v2_schema::*,
    update_primary_sale_happened_via_token_schema::*, update_schema::*, utilize_schema::*,
    verify_collection_schema::*, verify_schema::*, verify_sized_collection_item_schema::*,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "InstructionMetadata")]
pub struct InstructionMetadataGraphQL {
    pub signature: String,
    pub instruction_index: carbon_core::graphql::primitives::U32,
    pub stack_height: carbon_core::graphql::primitives::U32,
    pub slot: Option<carbon_core::graphql::primitives::U64>,
}

impl From<carbon_core::postgres::metadata::InstructionRowMetadata> for InstructionMetadataGraphQL {
    fn from(metadata: carbon_core::postgres::metadata::InstructionRowMetadata) -> Self {
        Self {
            signature: metadata.signature,
            instruction_index: carbon_core::graphql::primitives::U32(
                (*metadata.instruction_index) as u32,
            ),
            stack_height: carbon_core::graphql::primitives::U32((*metadata.stack_height) as u32),
            slot: metadata
                .slot
                .map(|v| carbon_core::graphql::primitives::U64(*v)),
        }
    }
}