use {
crate::types::graphql::LpPositionGraphQL,
carbon_core::graphql::primitives::{Pubkey, U64},
juniper::GraphQLObject,
};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "LpPositionAccount")]
pub struct LpPositionAccountGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub authority: Pubkey,
pub pool: Pubkey,
pub status: U64,
pub lp_position: LpPositionGraphQL,
}
impl TryFrom<crate::accounts::postgres::LpPositionAccountRow> for LpPositionAccountGraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::LpPositionAccountRow) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
authority: carbon_core::graphql::primitives::Pubkey(row.authority.0),
pool: carbon_core::graphql::primitives::Pubkey(row.pool.0),
status: carbon_core::graphql::primitives::U64(*row.status),
lp_position: row.lp_position.0.into(),
})
}
}