carbon-pump-swap-decoder 1.0.0

PumpSwap Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    crate::types::graphql::{FeeTierGraphQL, FeesGraphQL},
    carbon_core::graphql::primitives::{Pubkey, U8},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "FeeConfig")]
pub struct FeeConfigGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub bump: U8,
    pub admin: Pubkey,
    pub flat_fees: FeesGraphQL,
    pub fee_tiers: Vec<FeeTierGraphQL>,
}

impl TryFrom<crate::accounts::postgres::FeeConfigRow> for FeeConfigGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::FeeConfigRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
            admin: carbon_core::graphql::primitives::Pubkey(row.admin.0),
            flat_fees: row.flat_fees.0.into(),
            fee_tiers: row
                .fee_tiers
                .0
                .into_iter()
                .map(|item| item.into())
                .collect(),
        })
    }
}