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