carbon-mpl-core-decoder 1.0.0

MPL Core Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    crate::types::graphql::KeyGraphQL, carbon_core::graphql::primitives::U64,
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "PluginHeaderV1")]
pub struct PluginHeaderV1GraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub key: KeyGraphQL,
    pub plugin_registry_offset: U64,
}

impl TryFrom<crate::accounts::postgres::PluginHeaderV1Row> for PluginHeaderV1GraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::PluginHeaderV1Row) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            key: row.key.0.into(),
            plugin_registry_offset: carbon_core::graphql::primitives::U64(
                *row.plugin_registry_offset,
            ),
        })
    }
}