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