carbon-stake-program-decoder 2.0.0

Stake Program Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod authorize_checked_schema;
pub mod authorize_checked_with_seed_schema;
pub mod authorize_schema;
pub mod authorize_with_seed_schema;
pub mod deactivate_delinquent_schema;
pub mod deactivate_schema;
pub mod delegate_stake_schema;
pub mod get_minimum_delegation_schema;
pub mod initialize_checked_schema;
pub mod initialize_schema;
pub mod merge_schema;
pub mod move_lamports_schema;
pub mod move_stake_schema;
pub mod redelegate_schema;
pub mod set_lockup_checked_schema;
pub mod set_lockup_schema;
pub mod split_schema;
pub mod withdraw_schema;

use juniper::GraphQLObject;
pub use {
    authorize_checked_schema::*, authorize_checked_with_seed_schema::*, authorize_schema::*,
    authorize_with_seed_schema::*, deactivate_delinquent_schema::*, deactivate_schema::*,
    delegate_stake_schema::*, get_minimum_delegation_schema::*, initialize_checked_schema::*,
    initialize_schema::*, merge_schema::*, move_lamports_schema::*, move_stake_schema::*,
    redelegate_schema::*, set_lockup_checked_schema::*, set_lockup_schema::*, split_schema::*,
    withdraw_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)),
        }
    }
}