carbon-phoenix-v1-decoder 2.0.0

Phoenix V1 Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod cancel_all_orders_schema;
pub mod cancel_all_orders_with_free_funds_schema;
pub mod cancel_multiple_orders_by_id_schema;
pub mod cancel_multiple_orders_by_id_with_free_funds_schema;
pub mod cancel_up_to_schema;
pub mod cancel_up_to_with_free_funds_schema;
pub mod change_fee_recipient_schema;
pub mod change_market_status_schema;
pub mod change_seat_status_schema;
pub mod claim_authority_schema;
pub mod collect_fees_schema;
pub mod deposit_funds_schema;
pub mod evict_seat_schema;
pub mod force_cancel_orders_schema;
pub mod initialize_market_schema;
pub mod log_schema;
pub mod name_successor_schema;
pub mod place_limit_order_schema;
pub mod place_limit_order_with_free_funds_schema;
pub mod place_multiple_post_only_orders_schema;
pub mod place_multiple_post_only_orders_with_free_funds_schema;
pub mod reduce_order_schema;
pub mod reduce_order_with_free_funds_schema;
pub mod request_seat_authorized_schema;
pub mod request_seat_schema;
pub mod swap_schema;
pub mod swap_with_free_funds_schema;
pub mod withdraw_funds_schema;

use juniper::GraphQLObject;
pub use {
    cancel_all_orders_schema::*, cancel_all_orders_with_free_funds_schema::*,
    cancel_multiple_orders_by_id_schema::*, cancel_multiple_orders_by_id_with_free_funds_schema::*,
    cancel_up_to_schema::*, cancel_up_to_with_free_funds_schema::*, change_fee_recipient_schema::*,
    change_market_status_schema::*, change_seat_status_schema::*, claim_authority_schema::*,
    collect_fees_schema::*, deposit_funds_schema::*, evict_seat_schema::*,
    force_cancel_orders_schema::*, initialize_market_schema::*, log_schema::*,
    name_successor_schema::*, place_limit_order_schema::*,
    place_limit_order_with_free_funds_schema::*, place_multiple_post_only_orders_schema::*,
    place_multiple_post_only_orders_with_free_funds_schema::*, reduce_order_schema::*,
    reduce_order_with_free_funds_schema::*, request_seat_authorized_schema::*,
    request_seat_schema::*, swap_schema::*, swap_with_free_funds_schema::*,
    withdraw_funds_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)),
        }
    }
}