use {
crate::types::graphql::{AmmGraphQL, PoolHeaderGraphQL},
juniper::GraphQLObject,
};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "PoolAccount")]
pub struct PoolAccountGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub pool_header: PoolHeaderGraphQL,
pub amm: AmmGraphQL,
}
impl TryFrom<crate::accounts::postgres::PoolAccountRow> for PoolAccountGraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::PoolAccountRow) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
pool_header: row.pool_header.0.into(),
amm: row.amm.0.into(),
})
}
}