carbon-meteora-dbc-decoder 1.0.0

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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "Operator")]
pub struct OperatorGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub whitelisted_address: Pubkey,
    pub permission: U128,
    pub padding: Vec<U64>,
}

impl TryFrom<crate::accounts::postgres::OperatorRow> for OperatorGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::OperatorRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            whitelisted_address: carbon_core::graphql::primitives::Pubkey(
                row.whitelisted_address.0,
            ),
            permission: carbon_core::graphql::primitives::U128(*row.permission),
            padding: row
                .padding
                .into_iter()
                .map(|item| carbon_core::graphql::primitives::U64(*item))
                .collect(),
        })
    }
}