use {carbon_core::graphql::primitives::Pubkey, juniper::GraphQLObject};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "ProtocolOwnerState")]
pub struct ProtocolOwnerStateGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub current_protocol_owner: Pubkey,
}
impl TryFrom<crate::accounts::postgres::ProtocolOwnerStateRow> for ProtocolOwnerStateGraphQL {
type Error = carbon_core::error::Error;
fn try_from(
row: crate::accounts::postgres::ProtocolOwnerStateRow,
) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
current_protocol_owner: carbon_core::graphql::primitives::Pubkey(
row.current_protocol_owner.0,
),
})
}
}