carbon-openbook-v2-decoder 2.0.0

Openbook V2 Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
pub mod book_side_schema;
pub mod event_heap_schema;
pub mod market_schema;
pub mod open_orders_account_schema;
pub mod open_orders_indexer_schema;
pub mod stub_oracle_schema;

use juniper::GraphQLObject;
pub use {
    book_side_schema::*, event_heap_schema::*, market_schema::*, open_orders_account_schema::*,
    open_orders_indexer_schema::*, stub_oracle_schema::*,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "AccountMetadata")]
pub struct AccountMetadataGraphQL {
    pub pubkey: carbon_core::graphql::primitives::Pubkey,
    pub slot: Option<carbon_core::graphql::primitives::U64>,
}

impl From<carbon_core::postgres::metadata::AccountRowMetadata> for AccountMetadataGraphQL {
    fn from(metadata: carbon_core::postgres::metadata::AccountRowMetadata) -> Self {
        Self {
            pubkey: carbon_core::graphql::primitives::Pubkey(*metadata.pubkey),
            slot: metadata
                .slot
                .map(|v| carbon_core::graphql::primitives::U64(*v)),
        }
    }
}