use {carbon_core::graphql::primitives::Pubkey, juniper::GraphQLObject};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "WhirlpoolsConfig")]
pub struct WhirlpoolsConfigGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub fee_authority: Pubkey,
pub collect_protocol_fees_authority: Pubkey,
pub reward_emissions_super_authority: Pubkey,
pub default_protocol_fee_rate: i32,
pub feature_flags: i32,
}
impl TryFrom<crate::accounts::postgres::WhirlpoolsConfigRow> for WhirlpoolsConfigGraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::WhirlpoolsConfigRow) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
fee_authority: carbon_core::graphql::primitives::Pubkey(row.fee_authority.0),
collect_protocol_fees_authority: carbon_core::graphql::primitives::Pubkey(
row.collect_protocol_fees_authority.0,
),
reward_emissions_super_authority: carbon_core::graphql::primitives::Pubkey(
row.reward_emissions_super_authority.0,
),
default_protocol_fee_rate: *row.default_protocol_fee_rate,
feature_flags: *row.feature_flags,
})
}
}