use {
carbon_core::graphql::primitives::{Pubkey, U128, U64, U8},
juniper::GraphQLObject,
};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "LockEscrow")]
pub struct LockEscrowGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub pool: Pubkey,
pub owner: Pubkey,
pub escrow_vault: Pubkey,
pub bump: U8,
pub total_locked_amount: U64,
pub lp_per_token: U128,
pub unclaimed_fee_pending: U64,
pub a_fee: U64,
pub b_fee: U64,
}
impl TryFrom<crate::accounts::postgres::LockEscrowRow> for LockEscrowGraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::LockEscrowRow) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
pool: carbon_core::graphql::primitives::Pubkey(row.pool.0),
owner: carbon_core::graphql::primitives::Pubkey(row.owner.0),
escrow_vault: carbon_core::graphql::primitives::Pubkey(row.escrow_vault.0),
bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
total_locked_amount: carbon_core::graphql::primitives::U64(*row.total_locked_amount),
lp_per_token: carbon_core::graphql::primitives::U128(*row.lp_per_token),
unclaimed_fee_pending: carbon_core::graphql::primitives::U64(
*row.unclaimed_fee_pending,
),
a_fee: carbon_core::graphql::primitives::U64(*row.a_fee),
b_fee: carbon_core::graphql::primitives::U64(*row.b_fee),
})
}
}