use {
carbon_core::graphql::primitives::{Pubkey, U8},
juniper::GraphQLObject,
};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "CrossOpenOrdersMap")]
pub struct CrossOpenOrdersMapGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub user_key: Pubkey,
pub subaccount_index: U8,
}
impl TryFrom<crate::accounts::postgres::CrossOpenOrdersMapRow> for CrossOpenOrdersMapGraphQL {
type Error = carbon_core::error::Error;
fn try_from(
row: crate::accounts::postgres::CrossOpenOrdersMapRow,
) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
user_key: carbon_core::graphql::primitives::Pubkey(row.user_key.0),
subaccount_index: carbon_core::graphql::primitives::U8((*row.subaccount_index) as u8),
})
}
}