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 = "PlatformGlobalAccess")]
pub struct PlatformGlobalAccessGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub bump: U8,
    pub global_config: Pubkey,
    pub platform_config: Pubkey,
    pub padding: Vec<U64>,
}

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