@gala-chain/launchpad-sdk 0.4.2 → 3.0.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 (136) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +358 -75
  3. package/dist/examples/complete-sdk-demo.d.ts +22 -0
  4. package/dist/examples/complete-sdk-demo.d.ts.map +1 -0
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/src/LaunchpadSDK.d.ts +755 -0
  9. package/dist/src/LaunchpadSDK.d.ts.map +1 -0
  10. package/dist/{api → src/api}/LaunchpadAPI.d.ts +101 -63
  11. package/dist/src/api/LaunchpadAPI.d.ts.map +1 -0
  12. package/dist/{api → src/api}/dto/BondingCurveDTOs.d.ts +8 -5
  13. package/dist/src/api/dto/BondingCurveDTOs.d.ts.map +1 -0
  14. package/dist/src/api/dto/TransferTokenDto.d.ts +76 -0
  15. package/dist/src/api/dto/TransferTokenDto.d.ts.map +1 -0
  16. package/dist/src/auth/SignatureAuth.d.ts.map +1 -0
  17. package/dist/src/auth/types.d.ts.map +1 -0
  18. package/dist/src/config/environments.d.ts +45 -0
  19. package/dist/src/config/environments.d.ts.map +1 -0
  20. package/dist/{helpers → src/helpers}/sdk.d.ts +23 -13
  21. package/dist/src/helpers/sdk.d.ts.map +1 -0
  22. package/dist/src/helpers/wallet.d.ts.map +1 -0
  23. package/dist/src/index.d.ts +25 -0
  24. package/dist/src/index.d.ts.map +1 -0
  25. package/dist/src/services/BundleService.d.ts +197 -0
  26. package/dist/src/services/BundleService.d.ts.map +1 -0
  27. package/dist/src/services/DexService.d.ts +84 -0
  28. package/dist/src/services/DexService.d.ts.map +1 -0
  29. package/dist/src/services/GalaChainService.d.ts +254 -0
  30. package/dist/src/services/GalaChainService.d.ts.map +1 -0
  31. package/dist/src/services/LaunchpadService.d.ts +479 -0
  32. package/dist/src/services/LaunchpadService.d.ts.map +1 -0
  33. package/dist/src/services/SignatureService.d.ts.map +1 -0
  34. package/dist/src/services/TokenClassKeyService.d.ts.map +1 -0
  35. package/dist/src/services/TokenResolverService.d.ts +154 -0
  36. package/dist/src/services/TokenResolverService.d.ts.map +1 -0
  37. package/dist/src/services/WebSocketManager.d.ts.map +1 -0
  38. package/dist/{api → src}/services/WebSocketService.d.ts +4 -1
  39. package/dist/src/services/WebSocketService.d.ts.map +1 -0
  40. package/dist/{types → src/types}/comment.dto.d.ts +14 -5
  41. package/dist/src/types/comment.dto.d.ts.map +1 -0
  42. package/dist/{types → src/types}/common.d.ts +36 -1
  43. package/dist/src/types/common.d.ts.map +1 -0
  44. package/dist/{types → src/types}/dto.d.ts +19 -0
  45. package/dist/src/types/dto.d.ts.map +1 -0
  46. package/dist/{types → src/types}/launchpad.dto.d.ts +216 -30
  47. package/dist/src/types/launchpad.dto.d.ts.map +1 -0
  48. package/dist/{types → src/types}/launchpad.validation.d.ts +8 -8
  49. package/dist/src/types/launchpad.validation.d.ts.map +1 -0
  50. package/dist/src/types/options.dto.d.ts +281 -0
  51. package/dist/src/types/options.dto.d.ts.map +1 -0
  52. package/dist/src/types/result.types.d.ts +120 -0
  53. package/dist/src/types/result.types.d.ts.map +1 -0
  54. package/dist/{types → src/types}/trade.dto.d.ts +46 -19
  55. package/dist/src/types/trade.dto.d.ts.map +1 -0
  56. package/dist/src/types/transfer.dto.d.ts +161 -0
  57. package/dist/src/types/transfer.dto.d.ts.map +1 -0
  58. package/dist/{types → src/types}/user.dto.d.ts +98 -38
  59. package/dist/src/types/user.dto.d.ts.map +1 -0
  60. package/dist/src/types/websocket.types.d.ts +82 -0
  61. package/dist/src/types/websocket.types.d.ts.map +1 -0
  62. package/dist/src/utils/Logger.d.ts +136 -0
  63. package/dist/src/utils/Logger.d.ts.map +1 -0
  64. package/dist/src/utils/SignatureHelper.d.ts +77 -0
  65. package/dist/src/utils/SignatureHelper.d.ts.map +1 -0
  66. package/dist/src/utils/adapters.d.ts.map +1 -0
  67. package/dist/src/utils/agent-config.d.ts.map +1 -0
  68. package/dist/src/utils/date-utils.d.ts +39 -0
  69. package/dist/src/utils/date-utils.d.ts.map +1 -0
  70. package/dist/src/utils/http.d.ts.map +1 -0
  71. package/dist/src/utils/multipart.d.ts.map +1 -0
  72. package/dist/src/utils/number-utils.d.ts +57 -0
  73. package/dist/src/utils/number-utils.d.ts.map +1 -0
  74. package/dist/src/utils/precision-math.d.ts.map +1 -0
  75. package/dist/src/utils/slippage-utils.d.ts +70 -0
  76. package/dist/src/utils/slippage-utils.d.ts.map +1 -0
  77. package/dist/src/utils/tokenNormalizer.d.ts +111 -0
  78. package/dist/src/utils/tokenNormalizer.d.ts.map +1 -0
  79. package/dist/{utils → src/utils}/validation.d.ts +4 -4
  80. package/dist/src/utils/validation.d.ts.map +1 -0
  81. package/dist/{utils → src/utils}/wallet.d.ts +2 -2
  82. package/dist/src/utils/wallet.d.ts.map +1 -0
  83. package/package.json +10 -12
  84. package/dist/LaunchpadSDK.d.ts +0 -573
  85. package/dist/LaunchpadSDK.d.ts.map +0 -1
  86. package/dist/api/CommentAPI.d.ts +0 -119
  87. package/dist/api/CommentAPI.d.ts.map +0 -1
  88. package/dist/api/LaunchpadAPI.d.ts.map +0 -1
  89. package/dist/api/TradeAPI.d.ts +0 -164
  90. package/dist/api/TradeAPI.d.ts.map +0 -1
  91. package/dist/api/Trading.d.ts +0 -176
  92. package/dist/api/Trading.d.ts.map +0 -1
  93. package/dist/api/UserAPI.d.ts +0 -426
  94. package/dist/api/UserAPI.d.ts.map +0 -1
  95. package/dist/api/WebSocketAPI.d.ts +0 -156
  96. package/dist/api/WebSocketAPI.d.ts.map +0 -1
  97. package/dist/api/dto/BondingCurveDTOs.d.ts.map +0 -1
  98. package/dist/api/services/BundleService.d.ts +0 -105
  99. package/dist/api/services/BundleService.d.ts.map +0 -1
  100. package/dist/api/services/SignatureService.d.ts.map +0 -1
  101. package/dist/api/services/TokenClassKeyService.d.ts.map +0 -1
  102. package/dist/api/services/WebSocketManager.d.ts.map +0 -1
  103. package/dist/api/services/WebSocketService.d.ts.map +0 -1
  104. package/dist/auth/SignatureAuth.d.ts.map +0 -1
  105. package/dist/auth/types.d.ts.map +0 -1
  106. package/dist/helpers/sdk.d.ts.map +0 -1
  107. package/dist/helpers/wallet.d.ts.map +0 -1
  108. package/dist/index.d.ts +0 -49
  109. package/dist/index.d.ts.map +0 -1
  110. package/dist/types/comment.dto.d.ts.map +0 -1
  111. package/dist/types/common.d.ts.map +0 -1
  112. package/dist/types/dto.d.ts.map +0 -1
  113. package/dist/types/launchpad.dto.d.ts.map +0 -1
  114. package/dist/types/launchpad.validation.d.ts.map +0 -1
  115. package/dist/types/trade.dto.d.ts.map +0 -1
  116. package/dist/types/user.dto.d.ts.map +0 -1
  117. package/dist/utils/VaultCache.d.ts +0 -73
  118. package/dist/utils/VaultCache.d.ts.map +0 -1
  119. package/dist/utils/adapters.d.ts.map +0 -1
  120. package/dist/utils/agent-config.d.ts.map +0 -1
  121. package/dist/utils/http.d.ts.map +0 -1
  122. package/dist/utils/multipart.d.ts.map +0 -1
  123. package/dist/utils/precision-math.d.ts.map +0 -1
  124. package/dist/utils/validation.d.ts.map +0 -1
  125. package/dist/utils/wallet.d.ts.map +0 -1
  126. /package/dist/{auth → src/auth}/SignatureAuth.d.ts +0 -0
  127. /package/dist/{auth → src/auth}/types.d.ts +0 -0
  128. /package/dist/{helpers → src/helpers}/wallet.d.ts +0 -0
  129. /package/dist/{api → src}/services/SignatureService.d.ts +0 -0
  130. /package/dist/{api → src}/services/TokenClassKeyService.d.ts +0 -0
  131. /package/dist/{api → src}/services/WebSocketManager.d.ts +0 -0
  132. /package/dist/{utils → src/utils}/adapters.d.ts +0 -0
  133. /package/dist/{utils → src/utils}/agent-config.d.ts +0 -0
  134. /package/dist/{utils → src/utils}/http.d.ts +0 -0
  135. /package/dist/{utils → src/utils}/multipart.d.ts +0 -0
  136. /package/dist/{utils → src/utils}/precision-math.d.ts +0 -0
@@ -1,573 +0,0 @@
1
- import { Wallet } from 'ethers';
2
- import { SDKConfig, AddressFormat } from './types/common';
3
- import { WebSocketAPI } from './api/WebSocketAPI';
4
- /**
5
- * Configuration for initializing the Launchpad SDK
6
- *
7
- * @category Configuration
8
- * @since 1.0.0
9
- * @agent-capability Enables SDK initialization with wallet authentication
10
- * @agent-prerequisites Valid ethers.js Wallet instance with private key
11
- * @agent-example
12
- * ```typescript
13
- * import { Wallet } from 'ethers';
14
- * import { LaunchpadSDK } from '@gala-chain/launchpad-sdk';
15
- *
16
- * const wallet = new Wallet(process.env.PRIVATE_KEY);
17
- * const config: LaunchpadSDKConfig = {
18
- * wallet,
19
- * baseUrl: 'https://lpad-backend-dev1.defi.gala.com',
20
- * timeout: 30000,
21
- * debug: false
22
- * };
23
- * ```
24
- */
25
- export interface LaunchpadSDKConfig extends SDKConfig {
26
- /** The ethers wallet for authentication - must be a valid ethers.js Wallet instance */
27
- wallet: Wallet;
28
- /** Optional GalaChain gateway URL override - defaults based on main API environment */
29
- galaChainBaseUrl?: string;
30
- /** Optional Bundle service URL override - defaults based on main API environment */
31
- bundleBaseUrl?: string;
32
- /** Optional WebSocket URL override for transaction monitoring - defaults based on main API environment */
33
- webSocketUrl?: string;
34
- }
35
- /**
36
- * Main Launchpad SDK class providing access to all Gala Launchpad functionality
37
- *
38
- * This is the primary entry point for interacting with the Gala Launchpad backend.
39
- * It provides a clean, type-safe interface for all API operations including pool creation,
40
- * token trading, and user management.
41
- *
42
- * Features:
43
- * - Automatic signature-based authentication
44
- * - Type-safe API interfaces
45
- * - Built-in error handling and retry logic
46
- * - Address format conversion (eth|xxx ↔ 0xxxx)
47
- * - Bonding curve trading for launchpad tokens
48
- * - EIP-712 signature generation for all wallet types
49
- * - Bundle transaction processing
50
- * - Real-time transaction monitoring via WebSocket
51
- * - Comprehensive validation
52
- *
53
- * @category Main SDK
54
- * @since 1.0.0
55
- * @agent-capability Primary interface for all Gala Launchpad operations including token creation, trading, and user management
56
- * @agent-prerequisites Initialized with valid LaunchpadSDKConfig containing wallet
57
- * @agent-errors
58
- * - WALLET_001: Invalid wallet configuration - Reinitialize with valid ethers.js Wallet
59
- * - NETWORK_001: Connection timeout - Check network and retry with higher timeout
60
- * - AUTH_001: Authentication failed - Verify wallet has valid private key
61
- * @agent-example
62
- * ```typescript
63
- * import { Wallet } from 'ethers';
64
- * import { LaunchpadSDK, WalletUtils } from '@gala-chain/launchpad-sdk';
65
- *
66
- * // Generate or import wallet
67
- * const wallet = WalletUtils.fromPrivateKey(process.env.PRIVATE_KEY);
68
- *
69
- * // Initialize SDK
70
- * const sdk = new LaunchpadSDK({
71
- * wallet: wallet.wallet,
72
- * debug: true
73
- * });
74
- *
75
- * // Verify setup
76
- * console.log('SDK Address:', sdk.getAddress()); // eth|{address}
77
- * console.log('Ethereum Address:', sdk.getEthereumAddress()); // 0x{address}
78
- *
79
- * // SDK is ready for operations
80
- * const balance = await sdk.user.getGalaBalance({ walletAddress: sdk.getAddress() });
81
- * ```
82
- *
83
- * @example Error handling pattern
84
- * ```typescript
85
- * try {
86
- * const result = await sdk.launchpad.createSale(tokenData);
87
- * if (!result.success) {
88
- * throw new Error(result.message);
89
- * }
90
- * return result.data;
91
- * } catch (error) {
92
- * console.error('Operation failed:', error.message);
93
- * // Implement retry logic or alternative action
94
- * }
95
- * ```
96
- */
97
- export declare class LaunchpadSDK {
98
- private readonly auth;
99
- private readonly http;
100
- private readonly galaChainHttp;
101
- private readonly bundleHttp;
102
- private readonly config;
103
- private readonly launchpad;
104
- private readonly trade;
105
- private readonly user;
106
- private readonly comment;
107
- private readonly trading;
108
- readonly websocket: WebSocketAPI;
109
- constructor(config: LaunchpadSDKConfig);
110
- /**
111
- * Gets the authenticated user's address in backend format
112
- *
113
- * Returns the wallet address formatted for backend API calls.
114
- * The backend expects addresses in the format "eth|{40-hex-chars}"
115
- * without the standard "0x" prefix.
116
- *
117
- * @category Address Management
118
- * @returns The address in eth|{40-hex-chars} format required by the backend
119
- * @since 1.0.0
120
- *
121
- * @example Get backend address format
122
- * ```typescript
123
- * const sdk = new LaunchpadSDK({ wallet });
124
- * const backendAddress = sdk.getAddress();
125
- * console.log(backendAddress); // "eth|742d35Cc6634C0532925a3b8D0Ea2c76f94C31C0"
126
- * ```
127
- *
128
- * @example Use in API calls
129
- * ```typescript
130
- * const address = sdk.getAddress();
131
- * const pools = await sdk.launchpad.fetchPools({
132
- * creatorAddress: address,
133
- * page: 1,
134
- * limit: 10
135
- * });
136
- * ```
137
- *
138
- * @see {@link getEthereumAddress} - Get standard Ethereum address format
139
- */
140
- getAddress(): AddressFormat;
141
- /**
142
- * Gets the authenticated user's Ethereum address in standard format
143
- *
144
- * Returns the wallet address in standard Ethereum format with "0x" prefix.
145
- * This is the format typically used in frontend displays and external tools.
146
- *
147
- * @category Address Management
148
- * @returns Standard Ethereum address with 0x prefix
149
- * @since 1.0.0
150
- *
151
- * @example Display user address
152
- * ```typescript
153
- * const sdk = new LaunchpadSDK({ wallet });
154
- * const ethAddress = sdk.getEthereumAddress();
155
- * console.log(`User: ${ethAddress}`); // "User: 0x742d35Cc6634C0532925a3b8D0Ea2c76f94C31C0"
156
- * ```
157
- *
158
- * @example Address consistency check
159
- * ```typescript
160
- * const ethAddr = sdk.getEthereumAddress();
161
- * const backendAddr = sdk.getAddress();
162
- *
163
- * // Verify they represent the same address
164
- * const ethHex = ethAddr.replace('0x', '');
165
- * const backendHex = backendAddr.replace('eth|', '');
166
- * console.log('Same address:', ethHex.toLowerCase() === backendHex.toLowerCase());
167
- * ```
168
- *
169
- * @see {@link getAddress} - Get backend-compatible address format
170
- */
171
- getEthereumAddress(): string;
172
- /**
173
- * Tests the connection to the API with authentication
174
- *
175
- * Performs a simple authenticated request to verify that:
176
- * - The API endpoint is reachable
177
- * - Authentication is working correctly
178
- * - The wallet can sign messages properly
179
- *
180
- * @category Connection Testing
181
- * @returns Promise that resolves to true if connection is successful, false otherwise
182
- * @since 1.0.0
183
- *
184
- * @example Basic connection test
185
- * ```typescript
186
- * const sdk = new LaunchpadSDK({ wallet });
187
- *
188
- * const isConnected = await sdk.testConnection();
189
- * if (isConnected) {
190
- * console.log('✅ Successfully connected to Launchpad API');
191
- * } else {
192
- * console.error('❌ Failed to connect - check wallet and network');
193
- * }
194
- * ```
195
- *
196
- * @example Connection test with error handling
197
- * ```typescript
198
- * try {
199
- * const connected = await sdk.testConnection();
200
- * if (!connected) {
201
- * throw new Error('Connection test failed');
202
- * }
203
- * // Proceed with API operations
204
- * const pools = await sdk.launchpad.fetchPools({ page: 1, limit: 5 });
205
- * } catch (error) {
206
- * console.error('Connection or API error:', error.message);
207
- * }
208
- * ```
209
- */
210
- testConnection(): Promise<boolean>;
211
- /**
212
- * Gets the current SDK configuration
213
- *
214
- * Returns a copy of the SDK configuration with sensitive data removed.
215
- * The wallet instance is excluded for security reasons.
216
- *
217
- * @category Configuration
218
- * @returns SDK configuration object without the wallet property
219
- * @since 1.0.0
220
- *
221
- * @example Inspect SDK configuration
222
- * ```typescript
223
- * const sdk = new LaunchpadSDK({
224
- * wallet,
225
- * baseUrl: 'https://api.example.com',
226
- * timeout: 45000,
227
- * debug: true
228
- * });
229
- *
230
- * const config = sdk.getConfig();
231
- * console.log('Base URL:', config.baseUrl);
232
- * console.log('Timeout:', config.timeout);
233
- * console.log('Debug mode:', config.debug);
234
- * // wallet property is not included for security
235
- * ```
236
- *
237
- * @example Configuration validation
238
- * ```typescript
239
- * const config = sdk.getConfig();
240
- * if (config.debug) {
241
- * console.log('Debug mode is enabled - detailed logging active');
242
- * }
243
- * if (config.timeout < 30000) {
244
- * console.warn('Timeout is quite low, consider increasing for stability');
245
- * }
246
- * ```
247
- */
248
- getConfig(): Omit<LaunchpadSDKConfig, 'wallet'>;
249
- /**
250
- * Makes a raw authenticated HTTP request
251
- *
252
- * This method provides direct access to the HTTP client for advanced use cases.
253
- * It automatically handles authentication, request signing, and error handling.
254
- * Most users should use the specific controller methods instead of this raw method.
255
- *
256
- * @category Advanced Usage
257
- * @template T The expected response type
258
- * @param method HTTP method - GET, POST, PUT, DELETE, or PATCH
259
- * @param url Request URL relative to the configured base URL
260
- * @param data Optional request body data (for POST, PUT, PATCH)
261
- * @param params Optional query parameters as key-value pairs
262
- * @returns Promise that resolves to the response data of type T
263
- * @throws {Error} Network errors, authentication failures, or API errors
264
- * @since 1.0.0
265
- *
266
- * @example Custom GET request
267
- * ```typescript
268
- * interface CustomResponse {
269
- * data: string[];
270
- * total: number;
271
- * }
272
- *
273
- * const response = await sdk.request<CustomResponse>(
274
- * 'GET',
275
- * '/custom/endpoint',
276
- * undefined,
277
- * { filter: 'active', limit: 20 }
278
- * );
279
- * console.log('Custom data:', response.data);
280
- * ```
281
- *
282
- * @example Custom POST request
283
- * ```typescript
284
- * const result = await sdk.request(
285
- * 'POST',
286
- * '/custom/action',
287
- * {
288
- * action: 'process',
289
- * data: { value: 123 }
290
- * }
291
- * );
292
- * console.log('Action result:', result);
293
- * ```
294
- *
295
- * @see {@link LaunchpadAPI} - Pool and launchpad operations
296
- * @see {@link DexAPI} - DEX token operations
297
- * @see {@link TradeAPI} - Trading operations
298
- * @see {@link UserAPI} - User account operations
299
- */
300
- request<T = any>(method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', url: string, data?: any, params?: Record<string, any>): Promise<T>;
301
- /**
302
- * Fetch pools with optional filters
303
- *
304
- * @param options Optional filters for pool fetching
305
- * @returns Promise<FetchPoolResponse>
306
- */
307
- fetchPools(options?: {
308
- type?: 'recent' | 'popular';
309
- search?: string;
310
- tokenName?: string;
311
- page?: number;
312
- limit?: number;
313
- }): Promise<import(".").FetchPoolResponse>;
314
- /**
315
- * Fetch token distribution information
316
- *
317
- * @param tokenName Token name to fetch distribution for
318
- * @returns Promise<GetTokenDistributionResponse>
319
- */
320
- fetchTokenDistribution(tokenName: string): Promise<import(".").GetTokenDistributionResponse>;
321
- /**
322
- * Fetch token badges
323
- *
324
- * @param tokenName Token name to fetch badges for
325
- * @returns Promise<GetTokenBadgesResponse>
326
- */
327
- fetchTokenBadges(tokenName: string): Promise<import(".").GetTokenBadgesResponse>;
328
- /**
329
- * Fetch sale details for a token
330
- *
331
- * @param tokenName Token name to fetch sale details for
332
- * @returns Promise<FetchSaleDetailsResponse>
333
- */
334
- fetchSaleDetails(tokenName: string): Promise<import("./types/trade.dto").FetchSaleDetailsResponse>;
335
- /**
336
- * Fetch graph data for a token
337
- *
338
- * @param options Graph data options with required tokenName
339
- * @returns Promise<GetGraphResponse>
340
- */
341
- fetchGraphData(options: {
342
- tokenName: string;
343
- from?: number;
344
- to?: number;
345
- resolution?: number;
346
- }): Promise<import(".").GetGraphResponse>;
347
- /**
348
- * Fetch trade history with filters
349
- *
350
- * @param options Trade fetching options with required tokenName
351
- * @returns Promise<GetTradesResponse>
352
- */
353
- fetchTrades(options: {
354
- tokenName: string;
355
- type?: 'buy' | 'sell';
356
- page?: number;
357
- limit?: number;
358
- }): Promise<import("./types/trade.dto").GetTradesResponse>;
359
- /**
360
- * Fetch GALA balance for a user
361
- *
362
- * @param walletAddress Optional wallet address, defaults to current user
363
- * @returns Promise<FetchGalaBalanceResponse>
364
- */
365
- fetchGalaBalance(walletAddress?: string): Promise<import(".").FetchGalaBalanceResponse>;
366
- /**
367
- * Fetch token balance for a user
368
- *
369
- * @param options Token balance options with required tokenName
370
- * @returns Promise<GetTokenBalanceResponse>
371
- */
372
- fetchTokenBalance(options: {
373
- tokenName: string;
374
- walletAddress?: string;
375
- type?: 'DEFI' | 'ASSET';
376
- }): Promise<import(".").GetTokenBalanceResponse>;
377
- /**
378
- * Fetch comments for a token
379
- *
380
- * @param options Comment fetching options with required tokenName
381
- * @returns Promise<GetCommentsResponse>
382
- */
383
- fetchComments(options: {
384
- tokenName: string;
385
- page?: number;
386
- limit?: number;
387
- }): Promise<import(".").GetCommentsResponse>;
388
- /**
389
- * Calculate buy amount for a token purchase
390
- *
391
- * @param options Calculation options with required tokenName
392
- * @returns Promise<GetAmountResponse>
393
- */
394
- calculateBuyAmount(options: {
395
- tokenName: string;
396
- amount: string;
397
- type: 'native' | 'exact';
398
- }): Promise<import(".").GetAmountResponse>;
399
- /**
400
- * Calculate sell amount for a token sale
401
- *
402
- * @param options Calculation options with required tokenName
403
- * @returns Promise<GetAmountResponse>
404
- */
405
- calculateSellAmount(options: {
406
- tokenName: string;
407
- amount: string;
408
- type: 'exact' | 'native';
409
- }): Promise<import(".").GetAmountResponse>;
410
- /**
411
- * Calculate initial buy amount (pre-mint phase)
412
- *
413
- * @param options Initial buy calculation options
414
- * @returns Promise<CalculatePreMintResponse>
415
- */
416
- calculateInitialBuyAmount(options: {
417
- nativeTokenQuantity: string;
418
- vaultAddress?: string;
419
- }): Promise<import("./types/trade.dto").CalculatePreMintResponse>;
420
- /**
421
- * Buy tokens with options bag
422
- *
423
- * @param options Buy options with required tokenName
424
- * @returns Promise<ApiResponse>
425
- */
426
- buy(options: {
427
- tokenName: string;
428
- amount: string;
429
- type: 'native' | 'exact';
430
- slippage?: number;
431
- buyerAddress?: string;
432
- }): Promise<import("./types/common").ApiResponse<any>>;
433
- /**
434
- * Sell tokens with options bag
435
- *
436
- * @param options Sell options with required tokenName
437
- * @returns Promise<ApiResponse>
438
- */
439
- sell(options: {
440
- tokenName: string;
441
- amount: string;
442
- type: 'exact' | 'native';
443
- slippage?: number;
444
- sellerAddress?: string;
445
- }): Promise<import("./types/common").ApiResponse<any>>;
446
- /**
447
- * Post a comment on a token
448
- *
449
- * @param options Comment options with required tokenName and content
450
- * @returns Promise<CreateCommentResponse>
451
- */
452
- postComment(options: {
453
- tokenName: string;
454
- content: string;
455
- }): Promise<import(".").CreateCommentResponse>;
456
- /**
457
- * Create a new token and pool
458
- *
459
- * @param data Token and pool creation data
460
- * @returns Promise<CreateSaleResponse>
461
- */
462
- createTokenAndPool(data: any): Promise<import(".").CreateSaleResponse>;
463
- /**
464
- * Upload an image for a token
465
- *
466
- * @param options Upload options with required tokenName
467
- * @returns Promise<ImageUploadResponse>
468
- */
469
- uploadTokenImage(options: {
470
- tokenName: string;
471
- file: File | Buffer;
472
- }): Promise<import(".").ImageUploadResponse>;
473
- /**
474
- * Check if token name is available
475
- *
476
- * @param tokenName Token name to check
477
- * @returns Promise<boolean>
478
- */
479
- isTokenNameAvailable(tokenName: string): Promise<boolean>;
480
- /**
481
- * Check if token symbol is available
482
- *
483
- * @param symbol Token symbol to check
484
- * @returns Promise<boolean>
485
- */
486
- isTokenSymbolAvailable(symbol: string): Promise<boolean>;
487
- /**
488
- * Get user profile information
489
- *
490
- * @param walletAddress Optional wallet address (defaults to SDK wallet address)
491
- * @returns Promise<any> User profile information
492
- */
493
- fetchProfile(walletAddress?: string): Promise<any>;
494
- /**
495
- * Update user profile information
496
- *
497
- * @param data Profile update data
498
- * @returns Promise<UpdateProfileResponse> Update result
499
- */
500
- updateProfile(data: any): Promise<import("./types/user.dto").UpdateProfileResponse>;
501
- /**
502
- * Upload a profile image
503
- *
504
- * @param options Profile image upload options
505
- * @returns Promise<UploadProfileImageResponse> Upload result with image URL
506
- */
507
- uploadProfileImage(options: any): Promise<import("./types/user.dto").UploadProfileImageResponse>;
508
- /**
509
- * Resolve vault address for a token name
510
- *
511
- * @param tokenName Token name to resolve
512
- * @returns Promise<string | null> Vault address or null if not found
513
- */
514
- resolveVaultAddress(tokenName: string): Promise<string | null>;
515
- /**
516
- * Cleanup SDK resources and connections
517
- *
518
- * Releases WebSocket references and performs cleanup of SDK resources.
519
- * Should be called when the SDK instance is no longer needed to prevent
520
- * memory leaks and ensure proper resource management.
521
- *
522
- * @category Resource Management
523
- * @since 2.1.0
524
- *
525
- * @example Basic cleanup
526
- * ```typescript
527
- * const sdk = new LaunchpadSDK({ wallet });
528
- *
529
- * // Use SDK for operations...
530
- * await sdk.launchpad.createSale({...});
531
- *
532
- * // Cleanup when done
533
- * await sdk.cleanup();
534
- * ```
535
- *
536
- * @example Cleanup in application shutdown
537
- * ```typescript
538
- * process.on('SIGINT', async () => {
539
- * console.log('Shutting down...');
540
- * await sdk.cleanup();
541
- * process.exit(0);
542
- * });
543
- * ```
544
- */
545
- cleanup(): Promise<void>;
546
- /**
547
- * Cleanup all SDK instances and shared resources
548
- *
549
- * Forces cleanup of all shared WebSocket connections and resources
550
- * across all SDK instances. Use this for application-wide cleanup
551
- * or testing teardown.
552
- *
553
- * @category Resource Management
554
- * @param debug Enable debug logging
555
- * @since 2.1.0
556
- *
557
- * @example Application shutdown
558
- * ```typescript
559
- * // Cleanup all SDK instances and shared resources
560
- * LaunchpadSDK.cleanupAll(true);
561
- * ```
562
- *
563
- * @example Test cleanup
564
- * ```typescript
565
- * afterEach(() => {
566
- * // Ensure clean state between tests
567
- * LaunchpadSDK.cleanupAll();
568
- * });
569
- * ```
570
- */
571
- static cleanupAll(debug?: boolean): void;
572
- }
573
- //# sourceMappingURL=LaunchpadSDK.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LaunchpadSDK.d.ts","sourceRoot":"","sources":["../src/LaunchpadSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKlD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0GAA0G;IAC1G,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;IACrC,OAAO,CAAC,QAAQ,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a,CAAC,IAAI,EAAE,GAAG;IAI7B;;;;;OAKG;IACG,kBAAkB,CAAC,OAAO,EAAE,GAAG;IAQrC;;;;;OAKG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IASpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB9B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;CAahD"}
@@ -1,119 +0,0 @@
1
- /**
2
- * Comment API Controller - TokenName Based API
3
- *
4
- * This controller provides a clean, intuitive interface for token comment operations:
5
- * - Getting comments for tokens using token names (e.g., 'dragnrkti', 'rocketri')
6
- * - Posting comments on tokens using token names
7
- *
8
- * The API automatically handles vault address resolution via single token fetch and user authentication.
9
- *
10
- * IMPORTANT: The endpoint uses /token/commment with double 'm' - this is intentional
11
- * and matches the real backend API exactly.
12
- */
13
- import { HttpClient } from '../utils/http';
14
- import type { LaunchpadAPI } from './LaunchpadAPI';
15
- import { GetCommentsResponse, CreateCommentResponse } from '../types/comment.dto';
16
- /**
17
- * Comment API controller for token comment operations
18
- *
19
- * Provides a simple, tokenName-based API for:
20
- * - Getting comments for any token by tokenName
21
- * - Posting comments on any token by tokenName
22
- *
23
- * @example
24
- * ```typescript
25
- * // Get comments for dragnrkti token
26
- * const comments = await sdk.comment.getCommentsByTokenName("dragnrkti");
27
- *
28
- * // Post comment on rocketri token
29
- * await sdk.comment.postCommentOnTokenName("rocketri", "Great project!");
30
- * ```
31
- */
32
- export declare class CommentAPI {
33
- private readonly http;
34
- private readonly launchpadAPI?;
35
- constructor(http: HttpClient, launchpadAPI?: LaunchpadAPI | undefined);
36
- /**
37
- * Gets comments for a token by its tokenName
38
- *
39
- * This method provides a clean, intuitive API for fetching token comments
40
- * using the token name. It automatically resolves the tokenName
41
- * to the correct vault address internally.
42
- *
43
- * @param tokenName Token name (e.g., "dragnrkti", "rocketri", "unicornri")
44
- * @param page Page number (1-based), defaults to 1
45
- * @param limit Items per page (10-20), defaults to 10
46
- * @returns Promise<GetCommentsResponse> Comments with pagination info
47
- * @throws ValidationError if token name is invalid or not found
48
- *
49
- * @example
50
- * ```typescript
51
- * // Get first page of comments for dragnrkti token
52
- * const comments = await sdk.comment.getCommentsByTokenName("dragnrkti");
53
- *
54
- * // Get specific page with more items
55
- * const moreComments = await sdk.comment.getCommentsByTokenName("dragnrkti", 2, 20);
56
- * ```
57
- */
58
- getCommentsByTokenName(tokenName: string, page?: number, limit?: number): Promise<GetCommentsResponse>;
59
- /**
60
- * Posts a comment on a token by its tokenName
61
- *
62
- * This method provides a clean, intuitive API for posting comments on tokens
63
- * using the token name. It automatically resolves the tokenName
64
- * to the correct vault address and uses the authenticated user's wallet address.
65
- *
66
- * @param tokenName Token name (e.g., "dragnrkti", "rocketri", "unicornri")
67
- * @param content Comment text content (1-500 characters)
68
- * @returns Promise<CreateCommentResponse> Created comment information
69
- * @throws ValidationError if token name is invalid, not found, or content is invalid
70
- *
71
- * @example
72
- * ```typescript
73
- * // Post comment on dragnrkti token
74
- * await sdk.comment.postCommentOnTokenName("dragnrkti", "Great project with solid fundamentals!");
75
- *
76
- * // Post shorter comment on rocketri token
77
- * await sdk.comment.postCommentOnTokenName("rocketri", "🚀 To the moon!");
78
- * ```
79
- */
80
- postCommentOnTokenName(tokenName: string, content: string): Promise<CreateCommentResponse>;
81
- /**
82
- * Resolves a token name to its vault address using cached resolution
83
- *
84
- * Uses the shared VaultCache for intelligent caching to eliminate
85
- * redundant API calls for the same tokenName.
86
- *
87
- * @private
88
- * @param tokenName Token name to resolve (e.g., 'dragnrkti', 'rocketri')
89
- * @returns Promise<string | null> Vault address if found, null otherwise
90
- */
91
- private resolveTokenNameToVault;
92
- /**
93
- * Builds query parameters for comment fetching
94
- * Note: Backend expects page/limit as STRINGS
95
- *
96
- * @private
97
- */
98
- private buildGetCommentsQueryParams;
99
- /**
100
- * Gets the authenticated user's address in backend format
101
- *
102
- * @returns Address in eth|{40-hex-chars} format
103
- */
104
- getAddress(): string;
105
- /**
106
- * Gets the authenticated user's address in standard Ethereum format
107
- *
108
- * @returns Address in 0x{40-hex-chars} format
109
- */
110
- getEthereumAddress(): string;
111
- /**
112
- * Validates comment content
113
- *
114
- * @param content Comment content to validate
115
- * @returns True if valid comment content
116
- */
117
- validateCommentContent(content: string): boolean;
118
- }
119
- //# sourceMappingURL=CommentAPI.d.ts.map