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