carbon-token-program-decoder 1.0.0

Token Program 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 = "Multisig")]
pub struct MultisigGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub m: U8,
    pub n: U8,
    pub is_initialized: bool,
    pub signers: Vec<Pubkey>,
}

impl TryFrom<crate::accounts::postgres::MultisigRow> for MultisigGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(row: crate::accounts::postgres::MultisigRow) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            m: carbon_core::graphql::primitives::U8((*row.m) as u8),
            n: carbon_core::graphql::primitives::U8((*row.n) as u8),
            is_initialized: row.is_initialized,
            signers: row
                .signers
                .into_iter()
                .map(|item| carbon_core::graphql::primitives::Pubkey(item.0))
                .collect(),
        })
    }
}