carbon-mpl-token-metadata-decoder 2.0.0

MPL Token Metadata Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
use {
    crate::types::graphql::KeyGraphQL,
    carbon_core::graphql::primitives::{Pubkey, U8},
    juniper::GraphQLObject,
};

#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "HolderDelegateRecord")]
pub struct HolderDelegateRecordGraphQL {
    pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
    pub key: KeyGraphQL,
    pub bump: U8,
    pub mint: Pubkey,
    pub delegate: Pubkey,
    pub update_authority: Pubkey,
}

impl TryFrom<crate::accounts::postgres::HolderDelegateRecordRow> for HolderDelegateRecordGraphQL {
    type Error = carbon_core::error::Error;
    fn try_from(
        row: crate::accounts::postgres::HolderDelegateRecordRow,
    ) -> Result<Self, Self::Error> {
        Ok(Self {
            account_metadata: row.account_metadata.into(),
            key: row.key.0.into(),
            bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
            mint: carbon_core::graphql::primitives::Pubkey(row.mint.0),
            delegate: carbon_core::graphql::primitives::Pubkey(row.delegate.0),
            update_authority: carbon_core::graphql::primitives::Pubkey(row.update_authority.0),
        })
    }
}