carbon-dflow-aggregator-v4-decoder 2.0.0

Dflow Aggregator V4 Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod close_empty_token_account_schema;
pub mod close_order_schema;
pub mod cpi_event_schema;
pub mod create_referral_token_account_idempotent_schema;
pub mod fill_order_schema;
pub mod init_market_ledger_idempotent_schema;
pub mod open_order_schema;
pub mod swap2_schema;
pub mod swap2_with_destination_native_schema;
pub mod swap2_with_destination_schema;
pub mod swap_schema;
pub mod swap_with_destination_native_schema;
pub mod swap_with_destination_schema;
pub mod transfer_fee_schema;
pub mod transfer_sol_schema;
pub mod transfer_to_sponsor_schema;
pub mod unwrap_sol_schema;
pub mod wrap_sol_schema;

use juniper::GraphQLObject;
pub use {
    close_empty_token_account_schema::*, close_order_schema::*, cpi_event_schema::*,
    create_referral_token_account_idempotent_schema::*, fill_order_schema::*,
    init_market_ledger_idempotent_schema::*, open_order_schema::*, swap2_schema::*,
    swap2_with_destination_native_schema::*, swap2_with_destination_schema::*, swap_schema::*,
    swap_with_destination_native_schema::*, swap_with_destination_schema::*,
    transfer_fee_schema::*, transfer_sol_schema::*, transfer_to_sponsor_schema::*,
    unwrap_sol_schema::*, wrap_sol_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)),
        }
    }
}