UNPKG

@pump-fun/shared-contracts

Version:

Shared contracts for Pump.fun microservices.

38 lines (31 loc) 1.22 kB
/** * Redis key constants for consistent key naming across all services * Used for user P&L tracking and notification systems */ export const REDIS_KEYS = { /** Key pattern for new user tracking: `new_user:${walletAddress}` */ NEW_USER: (walletAddress: string) => `new_user:${walletAddress}`, /** Search pattern for finding positions by coin: `position:*:${coinId}` */ POSITION_BY_COIN_PATTERN: (coinId: string) => `position:*:${coinId}`, /** Key for tracked coins set */ TRACKED_COINS: "tracked_coins", /** Key pattern for user positions: `position:${walletAddress}:${coinId}` */ USER_POSITION: (walletAddress: string, coinId: string) => `position:${walletAddress}:${coinId}`, } as const; /** * Redis TTL constants in seconds * Centralized TTL values for consistent expiration across services */ export const REDIS_TTL = { /** Last price TTL: 1 hour (default) */ LAST_PRICE_DEFAULT: 3600, /** New user tracking TTL: 7 days */ NEW_USER: 7 * 24 * 60 * 60, /** User position TTL: 7 days */ USER_POSITION: 7 * 24 * 60 * 60, } as const; /** * Type definitions for Redis key functions */ export type RedisKeyPatterns = typeof REDIS_KEYS; export type RedisTTLValues = typeof REDIS_TTL;