UNPKG

@gala-chain/launchpad-sdk

Version:

TypeScript SDK for Gala Launchpad Backend API - Production-ready DeFi token launchpad integration with wallet-based authentication, GalaChain trading, and comprehensive user operations. 100% tested (22/22 endpoints working).

118 lines 3.72 kB
/** * WebSocket Types and Status Constants * * This module provides type-safe enums and mappings for WebSocket transaction * monitoring statuses. It defines both backend statuses (as received from the * WebSocket server) and SDK statuses (normalized for public API). * * @packageDocumentation */ /** * Status values received from the backend WebSocket server * * These are the actual string values sent by the bundle backend * WebSocket server for transaction status updates. * * @example * ```typescript * // Backend sends these statuses * socket.on('transactionId', (data) => { * console.log(data.status); // 'PROCESSED', 'COMPLETED', etc. * }); * ``` */ export declare enum BackendSocketStatus { /** Transaction has been processed successfully */ PROCESSED = "PROCESSED", /** Transaction completed successfully (alternative to PROCESSED) */ COMPLETED = "COMPLETED", /** Transaction succeeded (alternative completion status) */ SUCCESS = "SUCCESS", /** Transaction failed */ FAILED = "FAILED", /** Transaction encountered an error (alternative to FAILED) */ ERROR = "ERROR", /** Transaction is currently being processed */ PROCESSING = "PROCESSING", /** Transaction is pending processing */ PENDING = "PENDING" } /** * Normalized status values used by the SDK * * These are the standardized status values exposed in the public API. * All backend statuses are mapped to these normalized values. * * @example * ```typescript * const status: TransactionStatus = { * transactionId: '123', * status: SDKTransactionStatus.COMPLETED, * message: 'Transaction successful', * timestamp: Date.now() * }; * ``` */ export declare enum SDKTransactionStatus { /** Transaction is pending processing */ PENDING = "pending", /** Transaction is currently being processed */ PROCESSING = "processing", /** Transaction completed successfully */ COMPLETED = "completed", /** Transaction failed */ FAILED = "failed", /** Transaction monitoring timed out */ TIMEOUT = "timeout" } /** * Maps backend WebSocket statuses to SDK statuses * * This constant provides a centralized mapping from backend status values * to normalized SDK status values. Used by the WebSocketService to convert * incoming status updates to the public API format. * * @example * ```typescript * const backendStatus = 'PROCESSED'; * const sdkStatus = SOCKET_STATUS_MAP[backendStatus]; // 'completed' * ``` */ export declare const SOCKET_STATUS_MAP: Record<BackendSocketStatus, SDKTransactionStatus>; /** * WebSocket transaction response structure * * This interface defines the shape of WebSocket responses received from * transaction monitoring. It contains the normalized status, timing information, * and blockchain metadata. * * @example * ```typescript * const wsResponse: WebSocketResponse = { * transactionId: 'abc123', * status: SDKTransactionStatus.COMPLETED, * timestamp: Date.now(), * blockHash: '0x...', * gasUsed: '21000' * }; * ``` * * @since 3.7.2 */ export interface WebSocketResponse { /** Unique transaction identifier */ transactionId: string; /** Normalized transaction status */ status: SDKTransactionStatus; /** Optional status message or error description */ message?: string; /** Timestamp when the status update was received */ timestamp: number; /** Blockchain block hash (if transaction was mined) */ blockHash?: string; /** Gas used by the transaction */ gasUsed?: string; /** Additional data payload (trade, launch, transfer, etc.) */ data?: unknown; } //# sourceMappingURL=websocket.types.d.ts.map