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, U8},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "PositionBundle")]
pub struct PositionBundleGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub position_bundle_mint: Pubkey,
    pub position_bitmap: Vec<U8>,
}

impl TryFrom<crate::accounts::postgres::PositionBundleRow> for PositionBundleGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::PositionBundleRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            position_bundle_mint: carbon_core::graphql::primitives::Pubkey(
                row.position_bundle_mint.0,
            ),
            position_bitmap: row
                .position_bitmap
                .into_iter()
                .map(carbon_core::graphql::primitives::U8)
                .collect(),
        })
    }
}