carbon-bubblegum-decoder 2.0.0

Bubblegum Program Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    crate::types::graphql::DecompressibleStateGraphQL,
    carbon_core::graphql::primitives::{Pubkey, U64},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "TreeConfig")]
pub struct TreeConfigGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub tree_creator: Pubkey,
    pub tree_delegate: Pubkey,
    pub total_mint_capacity: U64,
    pub num_minted: U64,
    pub is_public: bool,
    pub is_decompressible: DecompressibleStateGraphQL,
}

impl TryFrom<crate::accounts::postgres::TreeConfigRow> for TreeConfigGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::TreeConfigRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            tree_creator: carbon_core::graphql::primitives::Pubkey(row.tree_creator.0),
            tree_delegate: carbon_core::graphql::primitives::Pubkey(row.tree_delegate.0),
            total_mint_capacity: carbon_core::graphql::primitives::U64(*row.total_mint_capacity),
            num_minted: carbon_core::graphql::primitives::U64(*row.num_minted),
            is_public: row.is_public,
            is_decompressible: row.is_decompressible.0.into(),
        })
    }
}