carbon-pump-fees-decoder 2.0.0

PumpFees Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    carbon_core::graphql::primitives::{Pubkey, U64, U8},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "FeeProgramGlobal")]
pub struct FeeProgramGlobalGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub bump: U8,
    pub authority: Pubkey,
    pub disable_flags: U8,
    pub social_claim_authority: Pubkey,
    pub claim_rate_limit: U64,
    pub reserved: Vec<U8>,
}

impl TryFrom<crate::accounts::postgres::FeeProgramGlobalRow> for FeeProgramGlobalGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::FeeProgramGlobalRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
            authority: carbon_core::graphql::primitives::Pubkey(row.authority.0),
            disable_flags: carbon_core::graphql::primitives::U8((*row.disable_flags) as u8),
            social_claim_authority: carbon_core::graphql::primitives::Pubkey(
                row.social_claim_authority.0,
            ),
            claim_rate_limit: carbon_core::graphql::primitives::U64(*row.claim_rate_limit),
            reserved: row
                .reserved
                .into_iter()
                .map(|x| carbon_core::graphql::primitives::U8((*x) as u8))
                .collect(),
        })
    }
}