carbon-token-2022-decoder 2.0.0

Carbon Token 2022 Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod amount_to_ui_amount_schema;
pub mod apply_confidential_pending_balance_schema;
pub mod approve_checked_schema;
pub mod approve_confidential_transfer_account_schema;
pub mod approve_schema;
pub mod burn_checked_schema;
pub mod burn_schema;
pub mod close_account_schema;
pub mod confidential_deposit_schema;
pub mod confidential_transfer_schema;
pub mod confidential_transfer_with_fee_schema;
pub mod confidential_withdraw_schema;
pub mod configure_confidential_transfer_account_schema;
pub mod create_native_mint_schema;
pub mod disable_confidential_credits_schema;
pub mod disable_cpi_guard_schema;
pub mod disable_harvest_to_mint_schema;
pub mod disable_memo_transfers_schema;
pub mod disable_non_confidential_credits_schema;
pub mod emit_token_metadata_schema;
pub mod empty_confidential_transfer_account_schema;
pub mod enable_confidential_credits_schema;
pub mod enable_cpi_guard_schema;
pub mod enable_harvest_to_mint_schema;
pub mod enable_memo_transfers_schema;
pub mod enable_non_confidential_credits_schema;
pub mod freeze_account_schema;
pub mod get_account_data_size_schema;
pub mod harvest_withheld_tokens_to_mint_for_confidential_transfer_fee_schema;
pub mod harvest_withheld_tokens_to_mint_schema;
pub mod initialize_account2_schema;
pub mod initialize_account3_schema;
pub mod initialize_account_schema;
pub mod initialize_confidential_transfer_fee_schema;
pub mod initialize_confidential_transfer_mint_schema;
pub mod initialize_default_account_state_schema;
pub mod initialize_group_member_pointer_schema;
pub mod initialize_group_pointer_schema;
pub mod initialize_immutable_owner_schema;
pub mod initialize_interest_bearing_mint_schema;
pub mod initialize_metadata_pointer_schema;
pub mod initialize_mint2_schema;
pub mod initialize_mint_close_authority_schema;
pub mod initialize_mint_schema;
pub mod initialize_multisig2_schema;
pub mod initialize_multisig_schema;
pub mod initialize_non_transferable_mint_schema;
pub mod initialize_pausable_config_schema;
pub mod initialize_permanent_delegate_schema;
pub mod initialize_permissioned_burn_schema;
pub mod initialize_scaled_ui_amount_mint_schema;
pub mod initialize_token_group_member_schema;
pub mod initialize_token_group_schema;
pub mod initialize_token_metadata_schema;
pub mod initialize_transfer_fee_config_schema;
pub mod initialize_transfer_hook_schema;
pub mod mint_to_checked_schema;
pub mod mint_to_schema;
pub mod pause_schema;
pub mod permissioned_burn_checked_schema;
pub mod permissioned_burn_schema;
pub mod reallocate_schema;
pub mod remove_token_metadata_key_schema;
pub mod resume_schema;
pub mod revoke_schema;
pub mod set_authority_schema;
pub mod set_transfer_fee_schema;
pub mod sync_native_schema;
pub mod thaw_account_schema;
pub mod transfer_checked_schema;
pub mod transfer_checked_with_fee_schema;
pub mod transfer_schema;
pub mod ui_amount_to_amount_schema;
pub mod unwrap_lamports_schema;
pub mod update_confidential_transfer_mint_schema;
pub mod update_default_account_state_schema;
pub mod update_group_member_pointer_schema;
pub mod update_group_pointer_schema;
pub mod update_metadata_pointer_schema;
pub mod update_multiplier_scaled_ui_mint_schema;
pub mod update_rate_interest_bearing_mint_schema;
pub mod update_token_group_max_size_schema;
pub mod update_token_group_update_authority_schema;
pub mod update_token_metadata_field_schema;
pub mod update_token_metadata_update_authority_schema;
pub mod update_transfer_hook_schema;
pub mod withdraw_excess_lamports_schema;
pub mod withdraw_withheld_tokens_from_accounts_for_confidential_transfer_fee_schema;
pub mod withdraw_withheld_tokens_from_accounts_schema;
pub mod withdraw_withheld_tokens_from_mint_for_confidential_transfer_fee_schema;
pub mod withdraw_withheld_tokens_from_mint_schema;

use juniper::GraphQLObject;
pub use {
    amount_to_ui_amount_schema::*, apply_confidential_pending_balance_schema::*,
    approve_checked_schema::*, approve_confidential_transfer_account_schema::*, approve_schema::*,
    burn_checked_schema::*, burn_schema::*, close_account_schema::*,
    confidential_deposit_schema::*, confidential_transfer_schema::*,
    confidential_transfer_with_fee_schema::*, confidential_withdraw_schema::*,
    configure_confidential_transfer_account_schema::*, create_native_mint_schema::*,
    disable_confidential_credits_schema::*, disable_cpi_guard_schema::*,
    disable_harvest_to_mint_schema::*, disable_memo_transfers_schema::*,
    disable_non_confidential_credits_schema::*, emit_token_metadata_schema::*,
    empty_confidential_transfer_account_schema::*, enable_confidential_credits_schema::*,
    enable_cpi_guard_schema::*, enable_harvest_to_mint_schema::*, enable_memo_transfers_schema::*,
    enable_non_confidential_credits_schema::*, freeze_account_schema::*,
    get_account_data_size_schema::*,
    harvest_withheld_tokens_to_mint_for_confidential_transfer_fee_schema::*,
    harvest_withheld_tokens_to_mint_schema::*, initialize_account2_schema::*,
    initialize_account3_schema::*, initialize_account_schema::*,
    initialize_confidential_transfer_fee_schema::*,
    initialize_confidential_transfer_mint_schema::*, initialize_default_account_state_schema::*,
    initialize_group_member_pointer_schema::*, initialize_group_pointer_schema::*,
    initialize_immutable_owner_schema::*, initialize_interest_bearing_mint_schema::*,
    initialize_metadata_pointer_schema::*, initialize_mint2_schema::*,
    initialize_mint_close_authority_schema::*, initialize_mint_schema::*,
    initialize_multisig2_schema::*, initialize_multisig_schema::*,
    initialize_non_transferable_mint_schema::*, initialize_pausable_config_schema::*,
    initialize_permanent_delegate_schema::*, initialize_permissioned_burn_schema::*,
    initialize_scaled_ui_amount_mint_schema::*, initialize_token_group_member_schema::*,
    initialize_token_group_schema::*, initialize_token_metadata_schema::*,
    initialize_transfer_fee_config_schema::*, initialize_transfer_hook_schema::*,
    mint_to_checked_schema::*, mint_to_schema::*, pause_schema::*,
    permissioned_burn_checked_schema::*, permissioned_burn_schema::*, reallocate_schema::*,
    remove_token_metadata_key_schema::*, resume_schema::*, revoke_schema::*,
    set_authority_schema::*, set_transfer_fee_schema::*, sync_native_schema::*,
    thaw_account_schema::*, transfer_checked_schema::*, transfer_checked_with_fee_schema::*,
    transfer_schema::*, ui_amount_to_amount_schema::*, unwrap_lamports_schema::*,
    update_confidential_transfer_mint_schema::*, update_default_account_state_schema::*,
    update_group_member_pointer_schema::*, update_group_pointer_schema::*,
    update_metadata_pointer_schema::*, update_multiplier_scaled_ui_mint_schema::*,
    update_rate_interest_bearing_mint_schema::*, update_token_group_max_size_schema::*,
    update_token_group_update_authority_schema::*, update_token_metadata_field_schema::*,
    update_token_metadata_update_authority_schema::*, update_transfer_hook_schema::*,
    withdraw_excess_lamports_schema::*,
    withdraw_withheld_tokens_from_accounts_for_confidential_transfer_fee_schema::*,
    withdraw_withheld_tokens_from_accounts_schema::*,
    withdraw_withheld_tokens_from_mint_for_confidential_transfer_fee_schema::*,
    withdraw_withheld_tokens_from_mint_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)),
        }
    }
}