carbon-boop-decoder 1.0.0

Boop program 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 = "AmmConfig")]
pub struct AmmConfigGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub bump: U8,
    pub disable_create_pool: bool,
    pub index: i32,
    pub trade_fee_rate: U64,
    pub protocol_fee_rate: U64,
    pub fund_fee_rate: U64,
    pub create_pool_fee: U64,
    pub protocol_owner: Pubkey,
    pub fund_owner: Pubkey,
    pub padding: Vec<U64>,
}

impl TryFrom<crate::accounts::postgres::AmmConfigRow> for AmmConfigGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::AmmConfigRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
            disable_create_pool: row.disable_create_pool,
            index: *row.index,
            trade_fee_rate: carbon_core::graphql::primitives::U64(*row.trade_fee_rate),
            protocol_fee_rate: carbon_core::graphql::primitives::U64(*row.protocol_fee_rate),
            fund_fee_rate: carbon_core::graphql::primitives::U64(*row.fund_fee_rate),
            create_pool_fee: carbon_core::graphql::primitives::U64(*row.create_pool_fee),
            protocol_owner: carbon_core::graphql::primitives::Pubkey(row.protocol_owner.0),
            fund_owner: carbon_core::graphql::primitives::Pubkey(row.fund_owner.0),
            padding: row
                .padding
                .into_iter()
                .map(|item| carbon_core::graphql::primitives::U64(*item))
                .collect(),
        })
    }
}