@pump-fun/shared-contracts
Version:
Shared contracts for Pump.fun microservices.
54 lines (51 loc) • 1.67 kB
text/typescript
import { z } from "zod";
/**
* Unified trade event schema (matches the actual UnifiedTradeEvent interface)
*/
export const UnifiedTradeSchema = z.object({
/** Amount of SOL in the trade */
amountSol: z.string(),
/** Amount in USD */
amountUsd: z.string(),
/** Amount of base tokens (SPL token) */
baseAmount: z.string(),
/** Whether the trade occurred on a bonding curve */
isBondingCurve: z.boolean(),
/** Total liquidity in USD */
liquidityUSD: z.string(),
/** LP fee taken */
lpFee: z.string(),
/** LP fee in USD */
lpFeeUsd: z.string(),
/** Total market cap in USD */
marketCap: z.string(),
/** Token mint address */
mintAddress: z.string(),
/** Liquidity pool address */
poolAddress: z.string(),
/** Price ratio: base per quote */
priceBasePerQuote: z.string(),
/** Price ratio: quote per base */
priceQuotePerBase: z.string(),
/** Price in SOL */
priceSol: z.string(),
/** Token price in USD */
priceUsd: z.string(),
/** Protocol fee in SOL (may be absent in some events) */
protocolFeeSol: z.string().optional(),
/** Protocol fee in USD (may be absent in some events) */
protocolFeeUsd: z.string(),
/** Amount of quote tokens (SOL) */
quoteAmount: z.string(),
/** Unique identifier for the slot */
slotIndexId: z.string(),
/** ISO timestamp of the trade */
timestamp: z.string(),
/** Transaction hash/signature */
tx: z.string(),
/** Trade direction - buy or sell */
type: z.union([z.literal("buy"), z.literal("sell")]),
/** Address of the user who made the trade */
userAddress: z.string(),
});
export type UnifiedTradePayload = z.infer<typeof UnifiedTradeSchema>;