@gala-chain/launchpad-sdk 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +628 -0
  3. package/dist/LaunchpadSDK.d.ts +573 -0
  4. package/dist/LaunchpadSDK.d.ts.map +1 -0
  5. package/dist/api/CommentAPI.d.ts +119 -0
  6. package/dist/api/CommentAPI.d.ts.map +1 -0
  7. package/dist/api/LaunchpadAPI.d.ts +440 -0
  8. package/dist/api/LaunchpadAPI.d.ts.map +1 -0
  9. package/dist/api/TradeAPI.d.ts +164 -0
  10. package/dist/api/TradeAPI.d.ts.map +1 -0
  11. package/dist/api/Trading.d.ts +176 -0
  12. package/dist/api/Trading.d.ts.map +1 -0
  13. package/dist/api/UserAPI.d.ts +426 -0
  14. package/dist/api/UserAPI.d.ts.map +1 -0
  15. package/dist/api/WebSocketAPI.d.ts +156 -0
  16. package/dist/api/WebSocketAPI.d.ts.map +1 -0
  17. package/dist/api/dto/BondingCurveDTOs.d.ts +142 -0
  18. package/dist/api/dto/BondingCurveDTOs.d.ts.map +1 -0
  19. package/dist/api/services/BundleService.d.ts +105 -0
  20. package/dist/api/services/BundleService.d.ts.map +1 -0
  21. package/dist/api/services/SignatureService.d.ts +71 -0
  22. package/dist/api/services/SignatureService.d.ts.map +1 -0
  23. package/dist/api/services/TokenClassKeyService.d.ts +116 -0
  24. package/dist/api/services/TokenClassKeyService.d.ts.map +1 -0
  25. package/dist/api/services/WebSocketManager.d.ts +99 -0
  26. package/dist/api/services/WebSocketManager.d.ts.map +1 -0
  27. package/dist/api/services/WebSocketService.d.ts +66 -0
  28. package/dist/api/services/WebSocketService.d.ts.map +1 -0
  29. package/dist/auth/SignatureAuth.d.ts +92 -0
  30. package/dist/auth/SignatureAuth.d.ts.map +1 -0
  31. package/dist/auth/types.d.ts +41 -0
  32. package/dist/auth/types.d.ts.map +1 -0
  33. package/dist/helpers/sdk.d.ts +75 -0
  34. package/dist/helpers/sdk.d.ts.map +1 -0
  35. package/dist/helpers/wallet.d.ts +60 -0
  36. package/dist/helpers/wallet.d.ts.map +1 -0
  37. package/dist/index.cjs.js +1 -0
  38. package/dist/index.d.ts +49 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.esm.js +1 -0
  41. package/dist/index.js +1 -0
  42. package/dist/types/comment.dto.d.ts +160 -0
  43. package/dist/types/comment.dto.d.ts.map +1 -0
  44. package/dist/types/common.d.ts +108 -0
  45. package/dist/types/common.d.ts.map +1 -0
  46. package/dist/types/dto.d.ts +145 -0
  47. package/dist/types/dto.d.ts.map +1 -0
  48. package/dist/types/launchpad.dto.d.ts +517 -0
  49. package/dist/types/launchpad.dto.d.ts.map +1 -0
  50. package/dist/types/launchpad.validation.d.ts +40 -0
  51. package/dist/types/launchpad.validation.d.ts.map +1 -0
  52. package/dist/types/trade.dto.d.ts +446 -0
  53. package/dist/types/trade.dto.d.ts.map +1 -0
  54. package/dist/types/user.dto.d.ts +330 -0
  55. package/dist/types/user.dto.d.ts.map +1 -0
  56. package/dist/utils/VaultCache.d.ts +73 -0
  57. package/dist/utils/VaultCache.d.ts.map +1 -0
  58. package/dist/utils/adapters.d.ts +111 -0
  59. package/dist/utils/adapters.d.ts.map +1 -0
  60. package/dist/utils/agent-config.d.ts +206 -0
  61. package/dist/utils/agent-config.d.ts.map +1 -0
  62. package/dist/utils/http.d.ts +85 -0
  63. package/dist/utils/http.d.ts.map +1 -0
  64. package/dist/utils/multipart.d.ts +60 -0
  65. package/dist/utils/multipart.d.ts.map +1 -0
  66. package/dist/utils/precision-math.d.ts +37 -0
  67. package/dist/utils/precision-math.d.ts.map +1 -0
  68. package/dist/utils/validation.d.ts +131 -0
  69. package/dist/utils/validation.d.ts.map +1 -0
  70. package/dist/utils/wallet.d.ts +174 -0
  71. package/dist/utils/wallet.d.ts.map +1 -0
  72. package/package.json +151 -0
@@ -0,0 +1,206 @@
1
+ /**
2
+ * 🤖 Agent Configuration Helper Utility
3
+ *
4
+ * Simplified configuration and setup utilities designed specifically for AI agents.
5
+ * Provides intelligent defaults, environment detection, and streamlined setup patterns.
6
+ *
7
+ * @category Agent Utilities
8
+ * @since 1.0.0
9
+ * @agent-capability Simplifies SDK setup and configuration for AI agents
10
+ * @agent-prerequisites Environment variables or configuration parameters
11
+ * @agent-example
12
+ * ```typescript
13
+ * import { AgentConfig } from '@gala-chain/launchpad-sdk';
14
+ *
15
+ * // Quick setup with intelligent defaults
16
+ * const { sdk, config } = await AgentConfig.quickSetup();
17
+ *
18
+ * // Verify everything is working
19
+ * const status = await AgentConfig.validateSetup(sdk);
20
+ * if (!status.ready) {
21
+ * console.error('Setup issues:', status.issues);
22
+ * }
23
+ * ```
24
+ */
25
+ import { LaunchpadSDK, LaunchpadSDKConfig } from '../LaunchpadSDK';
26
+ import { GeneratedWallet } from './wallet';
27
+ /**
28
+ * Environment types for different use cases
29
+ */
30
+ export type AgentEnvironment = 'production' | 'development' | 'testing';
31
+ /**
32
+ * Agent-specific configuration options
33
+ */
34
+ export interface AgentSDKConfig {
35
+ /** Environment type - affects default URLs and settings */
36
+ environment?: AgentEnvironment;
37
+ /** Custom private key or 'generate' to create new wallet */
38
+ privateKey?: string | 'generate';
39
+ /** Custom base URL override */
40
+ baseUrl?: string;
41
+ /** Request timeout in milliseconds */
42
+ timeout?: number;
43
+ /** Enable debug logging */
44
+ debug?: boolean;
45
+ /** Agent identifier for logging and analytics */
46
+ agentId?: string;
47
+ /** Automatically validate setup after initialization */
48
+ autoValidate?: boolean;
49
+ }
50
+ /**
51
+ * Setup validation result
52
+ */
53
+ export interface SetupValidation {
54
+ ready: boolean;
55
+ sdk: LaunchpadSDK;
56
+ wallet: GeneratedWallet;
57
+ issues: string[];
58
+ warnings: string[];
59
+ capabilities: {
60
+ canTrade: boolean;
61
+ canCreateTokens: boolean;
62
+ hasBalance: boolean;
63
+ connectionHealthy: boolean;
64
+ };
65
+ }
66
+ /**
67
+ * Agent configuration utility class
68
+ */
69
+ export declare class AgentConfig {
70
+ /**
71
+ * Quick setup with intelligent defaults for AI agents
72
+ *
73
+ * This method provides the fastest path to a working SDK instance by:
74
+ * - Auto-detecting environment from NODE_ENV
75
+ * - Using PRIVATE_KEY env var or generating new wallet
76
+ * - Setting appropriate timeouts and debug levels
77
+ * - Validating the setup automatically
78
+ *
79
+ * @param config Optional configuration overrides
80
+ * @returns Promise resolving to SDK instance and configuration details
81
+ * @since 1.0.0
82
+ *
83
+ * @example Quick start for any environment
84
+ * ```typescript
85
+ * const { sdk, wallet, config } = await AgentConfig.quickSetup();
86
+ * console.log('Ready to trade with address:', sdk.getAddress());
87
+ * ```
88
+ *
89
+ * @example Production setup with existing wallet
90
+ * ```typescript
91
+ * const { sdk } = await AgentConfig.quickSetup({
92
+ * environment: 'production',
93
+ * privateKey: process.env.PRODUCTION_WALLET_KEY,
94
+ * agentId: 'trading-bot-v1'
95
+ * });
96
+ * ```
97
+ *
98
+ * @example Development with auto-generated wallet
99
+ * ```typescript
100
+ * const { sdk, wallet } = await AgentConfig.quickSetup({
101
+ * environment: 'development',
102
+ * privateKey: 'generate',
103
+ * debug: true
104
+ * });
105
+ * console.log('Save this key:', wallet.privateKey);
106
+ * ```
107
+ */
108
+ static quickSetup(config?: AgentSDKConfig): Promise<{
109
+ sdk: LaunchpadSDK;
110
+ wallet: GeneratedWallet;
111
+ config: LaunchpadSDKConfig;
112
+ validation?: SetupValidation;
113
+ }>;
114
+ /**
115
+ * Comprehensive setup validation for AI agents
116
+ *
117
+ * Performs thorough checks to ensure the SDK is ready for agent operations:
118
+ * - Network connectivity
119
+ * - Wallet authentication
120
+ * - Balance availability
121
+ * - API endpoint accessibility
122
+ * - Trading capabilities
123
+ *
124
+ * @param sdk Initialized SDK instance
125
+ * @param wallet Optional wallet for additional checks
126
+ * @returns Validation result with capabilities and issues
127
+ * @since 1.0.0
128
+ *
129
+ * @example Validate existing setup
130
+ * ```typescript
131
+ * const status = await AgentConfig.validateSetup(sdk);
132
+ * if (!status.ready) {
133
+ * console.error('Issues found:', status.issues);
134
+ * // Handle setup problems before proceeding
135
+ * }
136
+ * ```
137
+ *
138
+ * @example Check specific capabilities
139
+ * ```typescript
140
+ * const status = await AgentConfig.validateSetup(sdk);
141
+ * if (status.capabilities.canTrade) {
142
+ * console.log('Trading operations available');
143
+ * }
144
+ * if (status.capabilities.canCreateTokens) {
145
+ * console.log('Token creation available');
146
+ * }
147
+ * ```
148
+ */
149
+ static validateSetup(sdk: LaunchpadSDK, wallet?: GeneratedWallet): Promise<SetupValidation>;
150
+ /**
151
+ * Generate environment-specific configuration recommendations
152
+ *
153
+ * Provides tailored configuration suggestions based on intended use:
154
+ * - Production: Conservative timeouts, minimal logging
155
+ * - Development: Debug enabled, longer timeouts
156
+ * - Testing: Fast timeouts, comprehensive logging
157
+ *
158
+ * @param environment Target environment
159
+ * @param useCase Specific use case (trading, creation, monitoring)
160
+ * @returns Recommended configuration object
161
+ * @since 1.0.0
162
+ *
163
+ * @example Get production trading config
164
+ * ```typescript
165
+ * const config = AgentConfig.getRecommendedConfig('production', 'trading');
166
+ * const { sdk } = await AgentConfig.quickSetup(config);
167
+ * ```
168
+ */
169
+ static getRecommendedConfig(environment: AgentEnvironment, useCase?: 'trading' | 'creation' | 'monitoring' | 'general'): AgentSDKConfig;
170
+ /**
171
+ * Create configuration for multi-wallet scenarios
172
+ *
173
+ * Helps agents manage multiple wallets for different purposes:
174
+ * - Trading wallet with moderate balance
175
+ * - Creation wallet with high balance
176
+ * - Monitoring wallet (read-only)
177
+ *
178
+ * @param wallets Map of wallet names to private keys
179
+ * @param environment Target environment
180
+ * @returns Map of configured SDK instances
181
+ * @since 1.0.0
182
+ *
183
+ * @example Multi-wallet setup
184
+ * ```typescript
185
+ * const wallets = {
186
+ * trader: process.env.TRADER_WALLET,
187
+ * creator: process.env.CREATOR_WALLET,
188
+ * monitor: 'generate' // Read-only operations
189
+ * };
190
+ *
191
+ * const sdks = await AgentConfig.multiWalletSetup(wallets, 'production');
192
+ *
193
+ * // Use appropriate wallet for each operation
194
+ * await sdks.trader.trade.buyTokens(...);
195
+ * await sdks.creator.launchpad.createSale(...);
196
+ * const pools = await sdks.monitor.launchpad.fetchPools(...);
197
+ * ```
198
+ */
199
+ static multiWalletSetup(wallets: Record<string, string>, environment?: AgentEnvironment): Promise<Record<string, LaunchpadSDK>>;
200
+ private static detectEnvironment;
201
+ private static setupWallet;
202
+ private static getDefaultBaseUrl;
203
+ private static getDefaultTimeout;
204
+ private static getEnvironmentDefaults;
205
+ }
206
+ //# sourceMappingURL=agent-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-config.d.ts","sourceRoot":"","sources":["../../src/utils/agent-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAe,eAAe,EAAE,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACjC,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,E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AM,CAAC,sBAAsB;CAmBtC"}
@@ -0,0 +1,85 @@
1
+ import { SignatureAuth } from '../auth/SignatureAuth';
2
+ import { RequestConfig, SDKConfig } from '../types/common';
3
+ import { SigningType } from '@gala-chain/connect';
4
+ /**
5
+ * HTTP client with automatic signature authentication
6
+ *
7
+ * This client automatically adds the `Sign` header to every request
8
+ * using wallet signatures generated by SignatureAuth.
9
+ */
10
+ export declare class HttpClient {
11
+ private readonly axios;
12
+ private readonly auth;
13
+ private readonly debug;
14
+ constructor(auth: SignatureAuth, config?: SDKConfig);
15
+ /**
16
+ * Makes an authenticated HTTP request
17
+ *
18
+ * @param config Request configuration
19
+ * @returns Promise<T> Response data
20
+ */
21
+ request<T = any>(config: RequestConfig): Promise<T>;
22
+ /**
23
+ * Makes a GET request
24
+ */
25
+ get<T = any>(url: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
26
+ /**
27
+ * Makes a POST request
28
+ */
29
+ post<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
30
+ /**
31
+ * Makes a PUT request
32
+ */
33
+ put<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
34
+ /**
35
+ * Makes a DELETE request
36
+ */
37
+ delete<T = any>(url: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
38
+ /**
39
+ * Makes a PATCH request
40
+ */
41
+ patch<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
42
+ /**
43
+ * Gets the authenticated user's address in backend format (eth|address)
44
+ */
45
+ getAddress(): string;
46
+ /**
47
+ * Gets the authenticated user's Ethereum address (0x prefixed)
48
+ */
49
+ getEthereumAddress(): string;
50
+ /**
51
+ * Signs a message using the authenticated wallet
52
+ */
53
+ signMessage(message: string): Promise<string>;
54
+ /**
55
+ * Signs typed data using EIP-712 standard
56
+ */
57
+ signTypedData(domain: any, types: any, message: any): Promise<string>;
58
+ /**
59
+ * Signs a custom message (for endpoint-specific authentication)
60
+ *
61
+ * @param message The message to sign
62
+ * @returns Promise<{ signature: string; address: string; ethereumAddress: string }> Signature data
63
+ * @throws Error If signature generation fails
64
+ */
65
+ signCustomMessage(message: string): Promise<{
66
+ signature: string;
67
+ address: string;
68
+ ethereumAddress: string;
69
+ }>;
70
+ /**
71
+ * Signs a DTO using @gala-chain/connect SigningClient
72
+ * This automatically handles prefix calculation and EIP-712 signing
73
+ */
74
+ signWithGalaChain<T extends object>(method: string, dto: T, signingType?: SigningType): Promise<T & {
75
+ signature: string;
76
+ prefix?: string;
77
+ types: any;
78
+ domain: any;
79
+ }>;
80
+ /**
81
+ * Sets up axios interceptors for authentication and error handling
82
+ */
83
+ private setupInterceptors;
84
+ }
85
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAiB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAiB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;gBAEpB,IAAI,EAAE,aAAa,EAAE,MAAM,GAAE,SAAc;IAiBvD;;;;;OAKG;IACG,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;IA2DzD;;OAEG;IACG,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAA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AAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC;IA6BlH;;;OAGG;IACG,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,GAAE,WAAyC,GAAG,OAAO,CAAC,CAAC,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,CAAC;IAWvM;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAkF1B"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Utilities for handling multipart/form-data uploads
3
+ *
4
+ * This module provides cross-platform file upload support for both
5
+ * browser and Node.js environments.
6
+ */
7
+ /**
8
+ * Error thrown when file validation fails
9
+ */
10
+ export declare class FileValidationError extends Error {
11
+ filename?: string | undefined;
12
+ mimeType?: string | undefined;
13
+ constructor(message: string, filename?: string | undefined, mimeType?: string | undefined);
14
+ }
15
+ /**
16
+ * Validates a file against upload constraints
17
+ *
18
+ * @param file File or Buffer to validate
19
+ * @param filename Original filename (required for Buffer validation)
20
+ * @param mimeType MIME type (required for Buffer validation)
21
+ * @throws FileValidationError if validation fails
22
+ */
23
+ export declare function validateFile(file: File | Buffer, filename?: string, mimeType?: string): void;
24
+ /**
25
+ * Gets the file extension from a filename
26
+ *
27
+ * @param filename The filename to extract extension from
28
+ * @returns File extension including the dot (e.g., '.png')
29
+ */
30
+ export declare function getFileExtension(filename: string): string;
31
+ /**
32
+ * Creates FormData for browser environments
33
+ *
34
+ * @param file File object to upload
35
+ * @param data Additional form fields
36
+ * @returns FormData object ready for upload
37
+ */
38
+ export declare function createFormData(file: File, data?: Record<string, any>): FormData;
39
+ /**
40
+ * Creates multipart form data for Node.js environments
41
+ *
42
+ * @param buffer Buffer containing file data
43
+ * @param filename Original filename
44
+ * @param mimeType MIME type of the file
45
+ * @param data Additional form fields
46
+ * @returns Object with data buffer and headers
47
+ */
48
+ export declare function createMultipartFormData(buffer: Buffer, filename: string, mimeType: string, data?: Record<string, any>): {
49
+ data: Buffer;
50
+ headers: Record<string, string>;
51
+ };
52
+ /**
53
+ * Detects if this is a browser environment
54
+ */
55
+ export declare function isBrowserEnvironment(): boolean;
56
+ /**
57
+ * Detects if this is a Node.js environment
58
+ */
59
+ export declare function isNodeEnvironment(): boolean;
60
+ //# sourceMappingURL=multipart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../src/utils/multipart.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IACR,QAAQ,CAAC,EAAE,MAAM;IAAS,QAAQ,CAAC,EAAE,MAAM;gBAAnE,OAAO,EAAE,MAAM,EAAS,QAAQ,CAAC,EAAE,MAAM,YAAA,EAAS,QAAQ,CAAC,EAAE,MAAM,YAAA;CAIhF;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAyJ5F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CASzD;AA0BD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,QAAQ,CAiB/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAoCnD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAkB9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Precision-safe mathematical operations for cryptocurrency calculations
3
+ *
4
+ * This utility handles both decimal token amounts and wei values without
5
+ * losing precision in financial calculations. Critical for slippage protection
6
+ * and other DeFi operations where every wei matters.
7
+ */
8
+ /**
9
+ * Safely calculates percentage adjustments on token amounts
10
+ * Handles both decimal values ("0.0005149") and wei values ("500000000000000000")
11
+ *
12
+ * @param value - Token amount as string (decimal or wei format)
13
+ * @param slippagePercent - Percentage to apply (e.g., 5 for 5%)
14
+ * @param increase - True to increase by percentage, false to decrease
15
+ * @returns Adjusted value as string, maintaining original precision
16
+ */
17
+ export declare function calculateSlippageAmount(value: string, slippagePercent: number, increase: boolean): string;
18
+ /**
19
+ * Utility to check if a value appears to be in wei format
20
+ * Wei values are typically large integers without decimal points
21
+ */
22
+ export declare function isWeiFormat(value: string): boolean;
23
+ /**
24
+ * Utility to check if a value appears to be in decimal format
25
+ * Decimal values contain a decimal point
26
+ */
27
+ export declare function isDecimalFormat(value: string): boolean;
28
+ /**
29
+ * Validates that a string represents a valid positive number
30
+ */
31
+ export declare function isValidAmount(value: string): boolean;
32
+ /**
33
+ * Safe conversion from any numeric string to a standardized format
34
+ * Handles edge cases and provides validation
35
+ */
36
+ export declare function normalizeAmount(value: string): string;
37
+ //# sourceMappingURL=precision-math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precision-math.d.ts","sourceRoot":"","sources":["../../src/utils/precision-math.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CA2BzG;AAkED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAcpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAkBrD"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Validation utilities for Launchpad API operations
3
+ *
4
+ * This module provides input validation to catch issues before making API calls,
5
+ * improving error messages and reducing unnecessary network requests.
6
+ */
7
+ import { TokenUrls, CheckPoolOptions, FetchPoolOptions, GetAmountOptions, GetGraphOptions } from '../types/launchpad.dto';
8
+ import { AddressFormat, EthereumAddress } from '../types/common';
9
+ /**
10
+ * Error thrown when validation fails
11
+ */
12
+ export declare class ValidationError extends Error {
13
+ field?: string | undefined;
14
+ code?: string | undefined;
15
+ constructor(message: string, field?: string | undefined, code?: string | undefined);
16
+ }
17
+ /**
18
+ * Validates a token name according to constraints
19
+ *
20
+ * @param tokenName Token name to validate
21
+ * @throws ValidationError if validation fails
22
+ */
23
+ export declare function validateTokenName(tokenName: string): void;
24
+ /**
25
+ * Validates pagination parameters
26
+ *
27
+ * @param options Pagination options to validate
28
+ * @throws ValidationError if validation fails
29
+ */
30
+ export declare function validatePagination(options: FetchPoolOptions): void;
31
+ /**
32
+ * Validates address format
33
+ *
34
+ * @param address Address to validate
35
+ * @param fieldName Name of the field being validated
36
+ * @throws ValidationError if validation fails
37
+ */
38
+ export declare function validateAddressFormat(address: string, fieldName?: string): void;
39
+ /**
40
+ * Validates social media URLs
41
+ *
42
+ * @param urls URLs object to validate
43
+ * @throws ValidationError if validation fails
44
+ */
45
+ export declare function validateSocialUrls(urls: TokenUrls): void;
46
+ /**
47
+ * Validates options for pool checking
48
+ *
49
+ * @param options Options to validate
50
+ * @throws ValidationError if validation fails
51
+ */
52
+ export declare function validateCheckPoolOptions(options: CheckPoolOptions): void;
53
+ /**
54
+ * Validates options for amount calculation
55
+ *
56
+ * @param options Options to validate
57
+ * @throws ValidationError if validation fails
58
+ */
59
+ export declare function validateGetAmountOptions(options: GetAmountOptions): void;
60
+ /**
61
+ * Validates options for graph data
62
+ *
63
+ * @param options Options to validate
64
+ * @throws ValidationError if validation fails
65
+ */
66
+ export declare function validateGetGraphOptions(options: GetGraphOptions): void;
67
+ /**
68
+ * Validates create pool data (supports both CreatePoolData and CreateSaleData formats)
69
+ *
70
+ * @param data Pool creation data to validate
71
+ * @throws ValidationError if validation fails
72
+ */
73
+ export declare function validateCreatePoolData(data: any): void;
74
+ /**
75
+ * Converts Ethereum address to backend format
76
+ *
77
+ * @param ethereumAddress Standard Ethereum address (0x...)
78
+ * @returns Address in backend format (eth|...)
79
+ */
80
+ export declare function toBackendAddressFormat(ethereumAddress: string): AddressFormat;
81
+ /**
82
+ * Converts backend address format to standard Ethereum address
83
+ *
84
+ * @param backendAddress Backend address format (eth|...)
85
+ * @returns Standard Ethereum address (0x...)
86
+ */
87
+ export declare function fromBackendAddressFormat(backendAddress: string): string;
88
+ /**
89
+ * Validates create sale data (for bundle backend)
90
+ *
91
+ * @param data Sale creation data to validate
92
+ * @throws ValidationError if validation fails
93
+ */
94
+ export declare function validateCreateSaleData(data: any): void;
95
+ export declare function isValidEthereumAddress(address: string): boolean;
96
+ export declare function isValidAddressFormat(address: string): address is AddressFormat;
97
+ export declare function formatAddressForBackend(address: EthereumAddress): AddressFormat;
98
+ export declare function formatAddressForEthereum(formattedAddress: AddressFormat): EthereumAddress;
99
+ /**
100
+ * Generates a vault address for commenting on tokens
101
+ *
102
+ * Format: service|Token$Unit$[SYMBOL]$eth:[CREATOR_ADDRESS]$launchpad
103
+ *
104
+ * @param tokenSymbol Token symbol (e.g., "BOBA", "CMPASY")
105
+ * @param creatorAddress Creator's wallet address (without 0x prefix)
106
+ * @returns Vault address string for comment operations
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * const vaultAddress = generateTokenVaultAddress("BOBA", "9401b171307be656f00f9e18df756643fd3a91de");
111
+ * // Returns: "service|Token$Unit$BOBA$eth:9401b171307be656f00f9e18df756643fd3a91de$launchpad"
112
+ * ```
113
+ */
114
+ export declare function generateTokenVaultAddress(tokenSymbol: string, creatorAddress: string): string;
115
+ /**
116
+ * Extracts token symbol and creator address from a vault address
117
+ *
118
+ * @param vaultAddress Vault address to parse
119
+ * @returns Object with tokenSymbol and creatorAddress, or null if invalid format
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * const parsed = parseTokenVaultAddress("service|Token$Unit$BOBA$eth:9401b171307be656f00f9e18df756643fd3a91de$launchpad");
124
+ * // Returns: { tokenSymbol: "BOBA", creatorAddress: "9401b171307be656f00f9e18df756643fd3a91de" }
125
+ * ```
126
+ */
127
+ export declare function parseTokenVaultAddress(vaultAddress: string): {
128
+ tokenSymbol: string;
129
+ creatorAddress: string;
130
+ } | null;
131
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACJ,KAAK,CAAC,EAAE,MAAM;IAAS,IAAI,CAAC,EAAE,MAAM;gBAA5D,OAAO,EAAE,MAAM,EAAS,KAAK,CAAC,EAAE,MAAM,YAAA,EAAS,IAAI,CAAC,EAAE,MAAM,YAAA;CAIzE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,I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