carbon-bonkswap-decoder 2.0.0

Carbon BonkSwap 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 = "State")]
pub struct StateGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub admin: Pubkey,
    pub program_authority: Pubkey,
    pub bump: U8,
    pub nonce: U8,
}

impl TryFrom<crate::accounts::postgres::StateRow> for StateGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::StateRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            admin: carbon_core::graphql::primitives::Pubkey(row.admin.0),
            program_authority: carbon_core::graphql::primitives::Pubkey(row.program_authority.0),
            bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
            nonce: carbon_core::graphql::primitives::U8((*row.nonce) as u8),
        })
    }
}