carbon-orca-whirlpool-decoder 1.0.0

Orca Whirlpool Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {carbon_core::graphql::primitives::Pubkey, juniper::GraphQLObject};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "TokenBadge")]
pub struct TokenBadgeGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub whirlpools_config: Pubkey,
    pub token_mint: Pubkey,
    pub attribute_require_non_transferable_position: bool,
}

impl TryFrom<crate::accounts::postgres::TokenBadgeRow> for TokenBadgeGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::TokenBadgeRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            whirlpools_config: carbon_core::graphql::primitives::Pubkey(row.whirlpools_config.0),
            token_mint: carbon_core::graphql::primitives::Pubkey(row.token_mint.0),
            attribute_require_non_transferable_position: row
                .attribute_require_non_transferable_position,
        })
    }
}