carbon-zeta-decoder 2.0.0

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

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "ReferrerAccount")]
pub struct ReferrerAccountGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub nonce: U8,
    pub has_alias: bool,
    pub referrer: Pubkey,
    pub pending_rewards: U64,
    pub claimed_rewards: U64,
}

impl TryFrom<crate::accounts::postgres::ReferrerAccountRow> for ReferrerAccountGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::ReferrerAccountRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            nonce: carbon_core::graphql::primitives::U8((*row.nonce) as u8),
            has_alias: row.has_alias,
            referrer: carbon_core::graphql::primitives::Pubkey(row.referrer.0),
            pending_rewards: carbon_core::graphql::primitives::U64(*row.pending_rewards),
            claimed_rewards: carbon_core::graphql::primitives::U64(*row.claimed_rewards),
        })
    }
}