use {carbon_core::graphql::primitives::Pubkey, juniper::GraphQLObject};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "SignedMsgWsDelegates")]
pub struct SignedMsgWsDelegatesGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub delegates: Vec<Pubkey>,
}
impl TryFrom<crate::accounts::postgres::SignedMsgWsDelegatesRow> for SignedMsgWsDelegatesGraphQL {
type Error = carbon_core::error::Error;
fn try_from(
row: crate::accounts::postgres::SignedMsgWsDelegatesRow,
) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
delegates: row
.delegates
.into_iter()
.map(|item| carbon_core::graphql::primitives::Pubkey(item.0))
.collect(),
})
}
}