carbon-raydium-launchpad-decoder 2.0.0

Raydium Launchpad 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 = "GlobalConfig")]
pub struct GlobalConfigGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub epoch: U64,
    pub curve_type: U8,
    pub index: i32,
    pub migrate_fee: U64,
    pub trade_fee_rate: U64,
    pub max_share_fee_rate: U64,
    pub min_base_supply: U64,
    pub max_lock_rate: U64,
    pub min_base_sell_rate: U64,
    pub min_base_migrate_rate: U64,
    pub min_quote_fund_raising: U64,
    pub quote_mint: Pubkey,
    pub protocol_fee_owner: Pubkey,
    pub migrate_fee_owner: Pubkey,
    pub migrate_to_amm_wallet: Pubkey,
    pub migrate_to_cpswap_wallet: Pubkey,
    pub requires_platform_auth: U8,
    pub padding_alignment: Vec<U8>,
    pub padding: Vec<U64>,
}

impl TryFrom<crate::accounts::postgres::GlobalConfigRow> for GlobalConfigGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::GlobalConfigRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            epoch: carbon_core::graphql::primitives::U64(*row.epoch),
            curve_type: carbon_core::graphql::primitives::U8((*row.curve_type) as u8),
            index: *row.index,
            migrate_fee: carbon_core::graphql::primitives::U64(*row.migrate_fee),
            trade_fee_rate: carbon_core::graphql::primitives::U64(*row.trade_fee_rate),
            max_share_fee_rate: carbon_core::graphql::primitives::U64(*row.max_share_fee_rate),
            min_base_supply: carbon_core::graphql::primitives::U64(*row.min_base_supply),
            max_lock_rate: carbon_core::graphql::primitives::U64(*row.max_lock_rate),
            min_base_sell_rate: carbon_core::graphql::primitives::U64(*row.min_base_sell_rate),
            min_base_migrate_rate: carbon_core::graphql::primitives::U64(
                *row.min_base_migrate_rate,
            ),
            min_quote_fund_raising: carbon_core::graphql::primitives::U64(
                *row.min_quote_fund_raising,
            ),
            quote_mint: carbon_core::graphql::primitives::Pubkey(row.quote_mint.0),
            protocol_fee_owner: carbon_core::graphql::primitives::Pubkey(row.protocol_fee_owner.0),
            migrate_fee_owner: carbon_core::graphql::primitives::Pubkey(row.migrate_fee_owner.0),
            migrate_to_amm_wallet: carbon_core::graphql::primitives::Pubkey(
                row.migrate_to_amm_wallet.0,
            ),
            migrate_to_cpswap_wallet: carbon_core::graphql::primitives::Pubkey(
                row.migrate_to_cpswap_wallet.0,
            ),
            requires_platform_auth: carbon_core::graphql::primitives::U8(
                (*row.requires_platform_auth) as u8,
            ),
            padding_alignment: row
                .padding_alignment
                .into_iter()
                .map(carbon_core::graphql::primitives::U8)
                .collect(),
            padding: row
                .padding
                .into_iter()
                .map(|item| carbon_core::graphql::primitives::U64(*item))
                .collect(),
        })
    }
}