@gala-chain/launchpad-sdk 3.31.2 → 4.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 (86) hide show
  1. package/API.md +524 -4
  2. package/CHANGELOG.md +92 -0
  3. package/EXAMPLES.md +845 -0
  4. package/README.md +421 -14
  5. package/dist/LaunchpadSDK.d.ts +435 -18
  6. package/dist/LaunchpadSDK.d.ts.map +1 -1
  7. package/dist/api/LaunchpadAPI.d.ts.map +1 -1
  8. package/dist/constants/version.generated.d.ts +1 -1
  9. package/dist/constants/version.generated.d.ts.map +1 -1
  10. package/dist/index.cjs.js +1 -1
  11. package/dist/index.d.ts +10 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.esm.js +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/services/CommentService.d.ts.map +1 -1
  16. package/dist/services/DexBackendClient.d.ts +46 -0
  17. package/dist/services/DexBackendClient.d.ts.map +1 -0
  18. package/dist/services/DexPoolService.d.ts +54 -12
  19. package/dist/services/DexPoolService.d.ts.map +1 -1
  20. package/dist/services/DexQuoteService.d.ts +288 -0
  21. package/dist/services/DexQuoteService.d.ts.map +1 -0
  22. package/dist/services/GSwapService.d.ts +468 -38
  23. package/dist/services/GSwapService.d.ts.map +1 -1
  24. package/dist/services/GalaChainGatewayClient.d.ts +89 -0
  25. package/dist/services/GalaChainGatewayClient.d.ts.map +1 -0
  26. package/dist/services/GalaChainService.d.ts +26 -0
  27. package/dist/services/GalaChainService.d.ts.map +1 -1
  28. package/dist/services/PoolStateManager.d.ts +176 -0
  29. package/dist/services/PoolStateManager.d.ts.map +1 -0
  30. package/dist/services/SignatureService.d.ts +13 -35
  31. package/dist/services/SignatureService.d.ts.map +1 -1
  32. package/dist/services/WebSocketService.d.ts +98 -0
  33. package/dist/services/WebSocketService.d.ts.map +1 -1
  34. package/dist/services/__mocks__/logger.mock.d.ts +17 -0
  35. package/dist/services/__mocks__/logger.mock.d.ts.map +1 -0
  36. package/dist/types/common.d.ts +2 -0
  37. package/dist/types/common.d.ts.map +1 -1
  38. package/dist/types/composite-pool.dto.d.ts +103 -0
  39. package/dist/types/composite-pool.dto.d.ts.map +1 -0
  40. package/dist/types/dex-pool.dto.d.ts +56 -5
  41. package/dist/types/dex-pool.dto.d.ts.map +1 -1
  42. package/dist/types/dto.d.ts +6 -6
  43. package/dist/types/dto.d.ts.map +1 -1
  44. package/dist/types/eip712-types.d.ts +140 -0
  45. package/dist/types/eip712-types.d.ts.map +1 -0
  46. package/dist/types/galachain-api.types.d.ts +206 -0
  47. package/dist/types/galachain-api.types.d.ts.map +1 -0
  48. package/dist/types/gswap-responses.types.d.ts +366 -0
  49. package/dist/types/gswap-responses.types.d.ts.map +1 -0
  50. package/dist/types/gswap.dto.d.ts +58 -3
  51. package/dist/types/gswap.dto.d.ts.map +1 -1
  52. package/dist/types/launchpad.dto.d.ts +57 -0
  53. package/dist/types/launchpad.dto.d.ts.map +1 -1
  54. package/dist/types/pool-state-delta.dto.d.ts +246 -0
  55. package/dist/types/pool-state-delta.dto.d.ts.map +1 -0
  56. package/dist/types/pool-state-manager-config.dto.d.ts +103 -0
  57. package/dist/types/pool-state-manager-config.dto.d.ts.map +1 -0
  58. package/dist/utils/auto-pagination.d.ts +74 -0
  59. package/dist/utils/auto-pagination.d.ts.map +1 -1
  60. package/dist/utils/bignumber-helpers.d.ts +75 -3
  61. package/dist/utils/bignumber-helpers.d.ts.map +1 -1
  62. package/dist/utils/bignumber-pool-cache.d.ts +169 -0
  63. package/dist/utils/bignumber-pool-cache.d.ts.map +1 -0
  64. package/dist/utils/composite-pool-converter.d.ts +121 -0
  65. package/dist/utils/composite-pool-converter.d.ts.map +1 -0
  66. package/dist/utils/errors.d.ts +86 -0
  67. package/dist/utils/errors.d.ts.map +1 -1
  68. package/dist/utils/http.d.ts.map +1 -1
  69. package/dist/utils/load-env.d.ts +31 -0
  70. package/dist/utils/load-env.d.ts.map +1 -0
  71. package/dist/utils/pool-pair-parser.d.ts +55 -0
  72. package/dist/utils/pool-pair-parser.d.ts.map +1 -0
  73. package/dist/utils/pool-state-validator.d.ts +207 -0
  74. package/dist/utils/pool-state-validator.d.ts.map +1 -0
  75. package/dist/utils/position-filters.d.ts +253 -0
  76. package/dist/utils/position-filters.d.ts.map +1 -0
  77. package/dist/utils/swap-delta-calculator.d.ts +231 -0
  78. package/dist/utils/swap-delta-calculator.d.ts.map +1 -0
  79. package/dist/utils/tick-crossing-handler.d.ts +250 -0
  80. package/dist/utils/tick-crossing-handler.d.ts.map +1 -0
  81. package/dist/utils/token-format-converter.d.ts +10 -3
  82. package/dist/utils/token-format-converter.d.ts.map +1 -1
  83. package/dist/utils/token-parser.d.ts +235 -0
  84. package/dist/utils/token-parser.d.ts.map +1 -0
  85. package/dist/utils/transfer-validation.d.ts.map +1 -1
  86. package/package.json +36 -15
@@ -1,31 +1,51 @@
1
- /**
2
- * GSwapService - Wraps @gala-chain/gswap-sdk for DEX trading integration
3
- *
4
- * Provides high-level interface to GalaSwap SDK for:
5
- * - Token swapping with slippage protection
6
- * - Quote generation (exact input/output)
7
- * - User asset queries
8
- * - Pool information
9
- * - Real-time transaction monitoring
10
- */
11
1
  import { LoggerBase } from './BaseService';
12
2
  import { WebSocketService } from './WebSocketService';
13
- import type { SwapQuoteParams, SwapQuoteResult, ExecuteSwapParams, ExecuteSwapResult, UserAsset, PoolInfo, GSwapServiceConfig, GSwapPosition } from '../types/gswap.dto';
3
+ import { DexQuoteService } from './DexQuoteService';
4
+ import type { SwapQuoteParams, SwapQuoteResult, ExecuteSwapParams, ExecuteSwapResult, UserAsset, PoolInfo, GSwapServiceConfig, GSwapPosition, PoolSlot0Data, PoolPriceData, GetLiquidityPositionsOptions, GetLiquidityPositionsResult } from '../types/gswap.dto';
5
+ import type { TokenClassKey } from '../types/common';
14
6
  export declare class GSwapService extends LoggerBase {
15
- private gswap;
7
+ private gatewayClient;
8
+ private dexBackendClient;
16
9
  private tokenConverter;
17
10
  private webSocketService;
18
- constructor(config: GSwapServiceConfig, webSocketService: WebSocketService);
11
+ private dexQuoteService;
12
+ private getWalletAddress;
13
+ private galaChainBaseUrl;
14
+ private bundlerBaseUrl;
15
+ private gatewayBaseUrl;
16
+ private privateKey;
17
+ private pricingConcurrency;
18
+ constructor(config: GSwapServiceConfig, webSocketService: WebSocketService, dexQuoteService?: DexQuoteService);
19
+ /**
20
+ * Set the pricing concurrency level for liquidity position pricing operations
21
+ * This is set once at SDK initialization and applies to all pricing operations
22
+ * @param concurrency Number of concurrent pricing requests (default: 5, max recommended: 20)
23
+ */
24
+ setPricingConcurrency(concurrency: number): void;
19
25
  /**
20
26
  * Get swap quote for exact input (spending known amount)
27
+ *
28
+ * Uses DexQuoteService with dynamic fee tier discovery ([3000, 500, 10000]).
29
+ * NEVER falls back - if all fee tiers fail, throws loudly to expose the real problem.
30
+ *
31
+ * Guarantees: All quotes are ALWAYS fresh (never cached) to prevent MEV in volatile markets.
32
+ *
21
33
  * @param params Quote request with fromToken, toToken, and input amount
22
- * @returns Quote with estimated output and fees
34
+ * @returns Quote with estimated output, actual price impact, and fees
35
+ * @throws GSwapQuoteError if DexQuoteService not configured or all fee tiers fail
23
36
  */
24
37
  getSwapQuoteExactInput(params: SwapQuoteParams): Promise<SwapQuoteResult>;
25
38
  /**
26
39
  * Get swap quote for exact output (receive known amount)
40
+ *
41
+ * Uses DexQuoteService with dynamic fee tier discovery ([3000, 500, 10000]).
42
+ * NEVER falls back - if all fee tiers fail, throws loudly to expose the real problem.
43
+ *
44
+ * Guarantees: All quotes are ALWAYS fresh (never cached) to prevent MEV in volatile markets.
45
+ *
27
46
  * @param params Quote request with fromToken, toToken, and desired output
28
- * @returns Quote with required input and fees
47
+ * @returns Quote with required input, actual price impact, and fees
48
+ * @throws GSwapQuoteError if DexQuoteService not configured or all fee tiers fail
29
49
  */
30
50
  getSwapQuoteExactOutput(params: SwapQuoteParams): Promise<SwapQuoteResult>;
31
51
  /**
@@ -45,7 +65,13 @@ export declare class GSwapService extends LoggerBase {
45
65
  * @throws {GSwapAssetError} When the API call itself fails or wallet address is invalid
46
66
  * @since v3.30.0 Now gracefully skips unconvertible assets instead of throwing
47
67
  */
48
- getUserAssets(walletAddress: string): Promise<UserAsset[]>;
68
+ getUserAssets(walletAddress: string, page?: number, limit?: number): Promise<UserAsset[]>;
69
+ /**
70
+ * Get all user assets across all pages (auto-paginated)
71
+ * @param walletAddress Wallet address to fetch assets for
72
+ * @returns All user assets across all pages
73
+ */
74
+ getAllUserAssets(walletAddress: string): Promise<UserAsset[]>;
49
75
  /**
50
76
  * Get pool information for token pair
51
77
  * @param tokenA First token
@@ -60,7 +86,38 @@ export declare class GSwapService extends LoggerBase {
60
86
  * @param bookmark Pagination bookmark
61
87
  * @returns Array of liquidity positions with full type safety
62
88
  */
63
- getUserLiquidityPositions(ownerAddress: string, limit?: number, bookmark?: string): Promise<GSwapPosition[]>;
89
+ /**
90
+ * Chunk array into smaller batches for concurrent processing
91
+ * @private
92
+ */
93
+ private chunkArray;
94
+ /**
95
+ * Fetch real-time pricing for liquidity positions
96
+ * Deduplicates pools and processes in chunks for optimal performance
97
+ * @private
98
+ */
99
+ private fetchPositionPrices;
100
+ /**
101
+ * Normalize GSwap API position response to match LiquidityPosition interface
102
+ * Handles different field naming conventions from the API
103
+ */
104
+ private normalizePositionResponse;
105
+ /**
106
+ * Parse token string flexibly - supports both delimited and simple formats
107
+ * @param tokenString Token in format "GALA" or "GALA|Unit|none|none"
108
+ * @returns TokenClassKey object
109
+ */
110
+ private parseTokenFlexible;
111
+ getUserLiquidityPositions(ownerAddress: string, limit?: number, bookmark?: string, options?: GetLiquidityPositionsOptions): Promise<GetLiquidityPositionsResult>;
112
+ /**
113
+ * Get ALL user liquidity positions with automatic pagination
114
+ * Automatically fetches all pages of liquidity positions for a wallet
115
+ * Uses bookmark-based cursor pagination internally
116
+ * @param ownerAddress User's wallet address
117
+ * @param options Optional configuration for pricing enrichment
118
+ * @returns All liquidity positions combined from all pages, optionally with pricing data
119
+ */
120
+ getAllSwapUserLiquidityPositions(ownerAddress: string, options?: GetLiquidityPositionsOptions): Promise<GSwapPosition[] | GetLiquidityPositionsResult>;
64
121
  /**
65
122
  * Get a specific liquidity position
66
123
  * @param ownerAddress User's wallet address
@@ -81,6 +138,25 @@ export declare class GSwapService extends LoggerBase {
81
138
  * @returns Detailed position information with full type safety
82
139
  */
83
140
  getLiquidityPositionById(ownerAddress: string, positionId: string): Promise<GSwapPosition>;
141
+ /**
142
+ * Fetch a single liquidity position using ONLY the compound key (direct HTTP call)
143
+ * Most efficient when you already have all position parameters
144
+ * @param params Position parameters - token0, token1, fee, tickLower, tickUpper, owner (ALL REQUIRED)
145
+ * @returns Detailed position information with full type safety
146
+ * @remarks
147
+ * - Does NOT use positionId (not needed or accepted)
148
+ * - Single direct HTTP call to GalaChain (no GSwap SDK)
149
+ * - Best for cases where caller has full position parameters
150
+ * - Requires: token0, token1, fee (500|3000|10000), tickLower, tickUpper, owner
151
+ */
152
+ fetchSwapPositionDirect(params: {
153
+ token0: string;
154
+ token1: string;
155
+ fee: number;
156
+ tickLower: number;
157
+ tickUpper: number;
158
+ owner: string;
159
+ }): Promise<GSwapPosition>;
84
160
  /**
85
161
  * Estimate tokens received from removing liquidity
86
162
  * @param args Removal estimation parameters
@@ -111,13 +187,75 @@ export declare class GSwapService extends LoggerBase {
111
187
  amount1Min?: string;
112
188
  }): Promise<any>;
113
189
  /**
114
- * Add liquidity using tick ranges (advanced)
115
- * @param args Liquidity addition parameters with tick ranges
116
- * @returns Transaction result with position ID
190
+ * Add liquidity to GSwap pool using precise tick ranges (concentrated liquidity)
191
+ *
192
+ * **CRITICAL: WebSocket-First Pattern**
193
+ * This method ensures WebSocket connection is established BEFORE submitting the
194
+ * transaction to prevent race conditions where the transaction confirms before
195
+ * the listener becomes active. This is essential because:
196
+ *
197
+ * 1. WebSocket listener created IMMEDIATELY after transactionId received
198
+ * 2. Socket.IO buffers events for registered listeners
199
+ * 3. If listener not active when transaction confirms, confirmation is missed
200
+ * 4. Position discovery retry logic handles indexing delays (up to 11 seconds)
201
+ *
202
+ * **Position Discovery Flow**
203
+ * After bundler submits transaction:
204
+ * 1. WebSocket listener monitors for on-chain confirmation (~2-3 seconds)
205
+ * 2. Once confirmed, waits for backend position indexing (5-11 seconds)
206
+ * 3. Queries positions API up to 3 times with exponential backoff
207
+ * 4. Matches position by token pair + fee tier (handles multiple positions)
208
+ * 5. Fetches full position details for complete data
209
+ *
210
+ * **Token Format Support**
211
+ * - String tokens: 'GALA', 'GUSDC' → auto-converted to TokenClassKey
212
+ * - TokenClassKey: { collection, category, type, additionalKey }
213
+ * - Both formats normalized to TokenClassKey for bundler submission
214
+ *
215
+ * **Tick Range Details**
216
+ * - Supports negative ticks for full concentrated liquidity ranges
217
+ * - Example: tickLower: -1080, tickUpper: 900
218
+ * - Must be multiples of tickSpacing (determined by fee tier)
219
+ * - Fee 500bps: tickSpacing=10, Fee 3000bps: tickSpacing=60, Fee 10000bps: tickSpacing=200
220
+ *
221
+ * @param args Liquidity addition parameters
222
+ * @param args.token0 First token (string or TokenClassKey)
223
+ * @param args.token1 Second token (string or TokenClassKey)
224
+ * @param args.fee Fee tier in basis points (500, 3000, or 10000)
225
+ * @param args.tickLower Lower tick boundary (supports negative values)
226
+ * @param args.tickUpper Upper tick boundary
227
+ * @param args.amount0Desired Desired amount of token0
228
+ * @param args.amount1Desired Desired amount of token1
229
+ * @param args.amount0Min Optional minimum token0 (default: '0')
230
+ * @param args.amount1Min Optional minimum token1 (default: '0')
231
+ *
232
+ * @returns Promise<GSwapAddLiquidityResult> Transaction result with:
233
+ * - transactionId: Bundler transaction ID
234
+ * - positionId: GSwap position ID (discovered from on-chain data)
235
+ * - status: Transaction status from WebSocket
236
+ * - liquidity: Position liquidity amount
237
+ * - amount0/amount1: Actual amounts added
238
+ * - wait(): Async method to wait for confirmation
239
+ *
240
+ * @throws GSwapPositionError if private key unavailable or bundler submission fails
241
+ *
242
+ * @example
243
+ * // Add liquidity with explicit tick range
244
+ * const result = await sdk.addSwapLiquidityByTicks({
245
+ * token0: 'GALA',
246
+ * token1: 'GUSDC',
247
+ * fee: 3000,
248
+ * tickLower: -1080, // Supports negative ticks
249
+ * tickUpper: 900,
250
+ * amount0Desired: '100',
251
+ * amount1Desired: '100',
252
+ * });
253
+ * console.log('Position ID:', result.positionId);
254
+ * await result.wait(); // Wait for on-chain confirmation
117
255
  */
118
- addLiquidityByTicks(args: {
119
- token0: string;
120
- token1: string;
256
+ addSwapLiquidityByTicks(args: {
257
+ token0: string | TokenClassKey;
258
+ token1: string | TokenClassKey;
121
259
  fee: number;
122
260
  tickLower: number;
123
261
  tickUpper: number;
@@ -127,31 +265,202 @@ export declare class GSwapService extends LoggerBase {
127
265
  amount1Min?: string;
128
266
  }): Promise<any>;
129
267
  /**
130
- * Remove liquidity from a position
268
+ * Monitor a bundler transaction with graceful fallback on timeout
269
+ *
270
+ * **Pattern Overview**
271
+ * This helper consolidates the common error handling pattern used by all bundler-direct
272
+ * operations (removeSwapLiquidity, collectSwapPositionFees, etc.):
273
+ *
274
+ * 1. Set up WebSocket listener BEFORE bundler submission (already done by caller)
275
+ * 2. Try to await transaction confirmation via WebSocket
276
+ * 3. If timeout occurs: Return partial result with status: 'SUBMITTED'
277
+ * 4. If successful: Return confirmed result with on-chain status
278
+ * 5. Both cases include a .wait() method for retry/manual monitoring
279
+ *
280
+ * **Why This Pattern Matters**
281
+ * - Prevents race conditions (listener active before transaction confirmation)
282
+ * - Handles network timeouts gracefully (users still get transaction ID)
283
+ * - Provides flexibility (users can call .wait() again if needed)
284
+ * - Consistent error handling across all bundler operations
285
+ *
286
+ * @param transactionId Transaction ID from bundler submission
287
+ * @param transactionPromise WebSocket monitoring promise (already created before bundler call)
288
+ * @param operationName Operation name for logging context (e.g., 'liquidity removal')
289
+ * @returns Bundler operation result with status and wait() method
290
+ * @private
291
+ */
292
+ private monitorBundlerTransaction;
293
+ /**
294
+ * Remove liquidity from an existing concentrated liquidity position
295
+ *
296
+ * **CRITICAL: WebSocket-First Pattern**
297
+ * This method ensures WebSocket connection is established BEFORE submitting the
298
+ * transaction to prevent race conditions where the transaction confirms before
299
+ * the listener becomes active. This is essential because:
300
+ *
301
+ * 1. WebSocket listener created IMMEDIATELY after transactionId received
302
+ * 2. Socket.IO buffers events for registered listeners
303
+ * 3. If listener not active when transaction confirms, confirmation is missed
304
+ * 4. Graceful fallback returns partial result with transaction ID on timeout
305
+ *
306
+ * **Error Handling & Recovery**
307
+ * If WebSocket monitoring times out (after 60 seconds):
308
+ * - Returns `{ transactionId, status: 'SUBMITTED' }` indicating transaction was accepted
309
+ * - Transaction may still succeed on-chain even if monitoring fails
310
+ * - Users can call `.wait()` again to retry monitoring
311
+ * - Recommended: retry monitoring after waiting or check on-chain later
312
+ *
313
+ * **Partial vs Complete Removal**
314
+ * - Partial: Set liquidity to a fraction (e.g., 50% of current amount)
315
+ * - Complete: Set liquidity to the full amount to close the position
316
+ * - Retrieved from position details via `getSwapUserLiquidityPositions()`
317
+ *
318
+ * **Token Format Support**
319
+ * - String tokens: 'GALA', 'GUSDC' → auto-converted to TokenClassKey
320
+ * - TokenClassKey: { collection, category, type, additionalKey }
321
+ * - Both formats normalized to TokenClassKey for bundler submission
322
+ *
131
323
  * @param args Liquidity removal parameters
132
- * @returns Transaction result
324
+ * @param args.token0 First token (string or TokenClassKey)
325
+ * @param args.token1 Second token (string or TokenClassKey)
326
+ * @param args.fee Fee tier in basis points (500, 3000, or 10000)
327
+ * @param args.tickLower Lower tick boundary of the position
328
+ * @param args.tickUpper Upper tick boundary of the position
329
+ * @param args.liquidity Amount of liquidity to remove (partial or complete)
330
+ * @param args.amount0Min Optional minimum token0 to accept (default: '0')
331
+ * @param args.amount1Min Optional minimum token1 to accept (default: '0')
332
+ * @param args.positionId Optional position ID for tracking/verification
333
+ *
334
+ * @returns Promise<GSwapRemoveLiquidityResult> Transaction result with:
335
+ * - transactionId: Bundler transaction ID
336
+ * - status: Transaction status from WebSocket (or 'SUBMITTED' if timeout)
337
+ * - timestamp: When transaction was submitted
338
+ * - wait(): Async method to monitor or retry confirmation
339
+ *
340
+ * @throws GSwapPositionError if private key unavailable or bundler submission fails
341
+ *
342
+ * @example
343
+ * // Get position first
344
+ * const positions = await sdk.getSwapUserLiquidityPositions(walletAddress);
345
+ * const position = positions[0];
346
+ *
347
+ * // Remove 50% of liquidity
348
+ * const liquidityToRemove = (parseFloat(position.liquidity) * 50) / 100;
349
+ * const result = await sdk.removeSwapLiquidity({
350
+ * token0: 'GALA',
351
+ * token1: 'GUSDC',
352
+ * fee: 3000,
353
+ * tickLower: position.tickLower,
354
+ * tickUpper: position.tickUpper,
355
+ * liquidity: liquidityToRemove.toString(),
356
+ * amount0Min: '0',
357
+ * amount1Min: '0',
358
+ * positionId: position.positionId,
359
+ * });
360
+ *
361
+ * console.log('Removal submitted:', result.transactionId);
362
+ * await result.wait(); // Wait for on-chain confirmation
363
+ * console.log('Final status:', result.status);
133
364
  */
134
365
  removeLiquidity(args: {
135
- token0: string;
136
- token1: string;
366
+ token0: string | TokenClassKey;
367
+ token1: string | TokenClassKey;
137
368
  fee: number;
138
369
  tickLower: number;
139
370
  tickUpper: number;
140
371
  liquidity: string;
141
372
  amount0Min?: string;
142
373
  amount1Min?: string;
374
+ positionId?: string;
143
375
  }): Promise<any>;
144
376
  /**
145
- * Collect fees from a liquidity position
377
+ * Collect accumulated trading fees from a concentrated liquidity position
378
+ *
379
+ * **CRITICAL: WebSocket-First Pattern**
380
+ * This method ensures WebSocket connection is established BEFORE submitting the
381
+ * transaction to prevent race conditions where the transaction confirms before
382
+ * the listener becomes active. This is essential because:
383
+ *
384
+ * 1. WebSocket listener created IMMEDIATELY after transactionId received
385
+ * 2. Socket.IO buffers events for registered listeners
386
+ * 3. If listener not active when transaction confirms, confirmation is missed
387
+ * 4. Graceful fallback returns partial result with transaction ID on timeout
388
+ *
389
+ * **Error Handling & Recovery**
390
+ * If WebSocket monitoring times out (after 60 seconds):
391
+ * - Returns `{ transactionId, status: 'SUBMITTED' }` indicating transaction was accepted
392
+ * - Transaction may still succeed on-chain even if monitoring fails
393
+ * - Users can call `.wait()` again to retry monitoring
394
+ * - Recommended: retry monitoring after waiting or check position fees on-chain later
395
+ *
396
+ * **Fee Accumulation**
397
+ * Fees accumulate when your position is in-range and trades execute within your price range.
398
+ * - In-range fees: Actively accumulating (trading happens in your range)
399
+ * - Out-of-range fees: Not accumulating (current price outside your range)
400
+ * - Collect periodically for optimal capital efficiency (fees don't compound)
401
+ * - Fees are denominated in the two tokens of the pair (token0 and token1)
402
+ *
403
+ * **Partial vs Complete Collection**
404
+ * - Collect all: Set amount0Requested='0' and amount1Requested='0' (default)
405
+ * - Collect specific amount: Set amount0Requested/amount1Requested to desired amounts
406
+ * - Partial collection doesn't affect the position's liquidity
407
+ * - Current fees visible in position details via `getSwapUserLiquidityPositions()`
408
+ *
409
+ * **Token Format Support**
410
+ * - String tokens: 'GALA', 'GUSDC' → auto-converted to TokenClassKey
411
+ * - TokenClassKey: { collection, category, type, additionalKey }
412
+ * - Both formats normalized to TokenClassKey for bundler submission
413
+ *
146
414
  * @param args Fee collection parameters
147
- * @returns Transaction result with collected amounts
415
+ * @param args.token0 First token (string or TokenClassKey)
416
+ * @param args.token1 Second token (string or TokenClassKey)
417
+ * @param args.fee Fee tier in basis points (500, 3000, or 10000)
418
+ * @param args.tickLower Lower tick boundary of the position
419
+ * @param args.tickUpper Upper tick boundary of the position
420
+ * @param args.amount0Requested Optional amount of token0 fees to collect (default: '0' = all)
421
+ * @param args.amount1Requested Optional amount of token1 fees to collect (default: '0' = all)
422
+ * @param args.positionId Optional position ID for tracking/verification
423
+ *
424
+ * @returns Promise<GSwapCollectFeesResult> Transaction result with:
425
+ * - transactionId: Bundler transaction ID
426
+ * - status: Transaction status from WebSocket (or 'SUBMITTED' if timeout)
427
+ * - timestamp: When transaction was submitted
428
+ * - wait(): Async method to monitor or retry confirmation
429
+ *
430
+ * @throws GSwapPositionError if private key unavailable or bundler submission fails
431
+ *
432
+ * @example
433
+ * // Get position with accumulated fees
434
+ * const positions = await sdk.getSwapUserLiquidityPositions(walletAddress);
435
+ * const position = positions[0];
436
+ *
437
+ * if (parseFloat(position.feeAmount0) > 0 || parseFloat(position.feeAmount1) > 0) {
438
+ * // Collect all accumulated fees
439
+ * const result = await sdk.collectSwapPositionFees({
440
+ * token0: 'GALA',
441
+ * token1: 'GUSDC',
442
+ * fee: 3000,
443
+ * tickLower: position.tickLower,
444
+ * tickUpper: position.tickUpper,
445
+ * amount0Requested: '0', // Collect all token0 fees
446
+ * amount1Requested: '0', // Collect all token1 fees
447
+ * positionId: position.positionId,
448
+ * });
449
+ *
450
+ * console.log('Fee collection submitted:', result.transactionId);
451
+ * await result.wait(); // Wait for on-chain confirmation
452
+ * console.log('Fees collected successfully');
453
+ * }
148
454
  */
149
455
  collectPositionFees(args: {
150
- token0: string;
151
- token1: string;
456
+ token0: string | TokenClassKey;
457
+ token1: string | TokenClassKey;
152
458
  fee: number;
153
459
  tickLower: number;
154
460
  tickUpper: number;
461
+ amount0Requested?: string;
462
+ amount1Requested?: string;
463
+ positionId?: string;
155
464
  }): Promise<any>;
156
465
  /**
157
466
  * Get real-time pool state with liquidity depth and current price
@@ -227,27 +536,55 @@ export declare class GSwapService extends LoggerBase {
227
536
  * @private
228
537
  */
229
538
  private calculatePriceFromSqrtPriceX96;
539
+ /**
540
+ * Calculate price from sqrtPrice in decimal format (GetSlot0 API)
541
+ * Different from sqrtPriceX96 - GetSlot0 returns already-decoded decimal
542
+ * Formula: price = sqrtPrice²
543
+ * @private
544
+ */
545
+ private calculatePriceFromSqrtPriceDecimal;
546
+ /**
547
+ * Get current pool state (slot0 data) for a token pair
548
+ * Fetches sqrtPrice, tick, and liquidity from GalaChain Gateway
549
+ * @param token0 First token symbol or TokenClassKey
550
+ * Accepts: "GALA" (plain), "GALA|Unit|none|none" (pipe), "GALA$Unit$none$none" (dollar)
551
+ * @param token1 Second token symbol or TokenClassKey
552
+ * Accepts: "GALA" (plain), "GALA|Unit|none|none" (pipe), "GALA$Unit$none$none" (dollar)
553
+ * @param fee Fee tier in basis points (500, 3000, 10000)
554
+ * @returns PoolSlot0Data with current sqrtPrice, tick, liquidity, and feeGrowth
555
+ */
556
+ getPoolSlot0(token0: string | TokenClassKey, token1: string | TokenClassKey, fee: number): Promise<PoolSlot0Data>;
557
+ /**
558
+ * Get current price for a liquidity position's pool
559
+ * Fetches slot0 data and calculates token0/token1 price ratio
560
+ * @param position Position token pair and fee tier
561
+ */
562
+ getPositionCurrentPrice(position: {
563
+ token0: string;
564
+ token1: string;
565
+ feeTier: number;
566
+ }): Promise<PoolPriceData>;
230
567
  /**
231
568
  * Calculate liquidity from amount0 (Uniswap v3 math)
232
- * liquidity = amount0 * (sqrtRatioA * sqrtRatioB) / (sqrtRatioB - sqrtRatioA)
569
+ * Uses @gala-chain/dex liquidity0() function for production-accurate calculation
233
570
  * @private
234
571
  */
235
572
  private calculateLiquidityFromAmount0;
236
573
  /**
237
574
  * Calculate liquidity from amount1 (Uniswap v3 math)
238
- * liquidity = amount1 / (sqrtRatioB - sqrtRatioA)
575
+ * Uses @gala-chain/dex liquidity1() function for production-accurate calculation
239
576
  * @private
240
577
  */
241
578
  private calculateLiquidityFromAmount1;
242
579
  /**
243
580
  * Calculate amount0 from liquidity (Uniswap v3 math)
244
- * amount0 = liquidity * (sqrtRatioCurrent - sqrtRatioA) / (sqrtRatioA * sqrtRatioCurrent)
581
+ * Uses @gala-chain/dex getAmount0Delta() function for production-accurate calculation
245
582
  * @private
246
583
  */
247
584
  private calculateAmount0FromLiquidity;
248
585
  /**
249
586
  * Calculate amount1 from liquidity (Uniswap v3 math)
250
- * amount1 = liquidity * (sqrtRatioB - sqrtRatioCurrent)
587
+ * Uses @gala-chain/dex getAmount1Delta() function for production-accurate calculation
251
588
  * @private
252
589
  */
253
590
  private calculateAmount1FromLiquidity;
@@ -264,6 +601,94 @@ export declare class GSwapService extends LoggerBase {
264
601
  * @private
265
602
  */
266
603
  private convertTokenPair;
604
+ /**
605
+ * Send AddLiquidity transaction directly to bundler (bypassing gswap-sdk)
606
+ *
607
+ * Creates a liquidity position by signing a DTO and posting it directly to the
608
+ * GalaChain bundler. This method replaces the gswap-sdk wrapper with a direct
609
+ * implementation following the same pattern as CreateSale.
610
+ *
611
+ * @param params - AddLiquidity parameters including token pair, fee, tick range, and amounts
612
+ * @returns Transaction ID from bundler response
613
+ * @throws Error if not in full-access mode or if bundler request fails
614
+ *
615
+ * @private
616
+ */
617
+ private sendAddLiquidityToBundler;
618
+ /**
619
+ * Send RemoveLiquidity transaction directly to bundler
620
+ *
621
+ * Bypasses GSwap SDK and posts signed EIP-712 RemoveLiquidity DTO directly to bundler.
622
+ * Supports full tick ranges including negative values.
623
+ *
624
+ * @param tickLower Lower tick boundary (int256, supports negative)
625
+ * @param tickUpper Upper tick boundary (int256, supports negative)
626
+ * @param amount Liquidity amount to remove
627
+ * @param token0 First token class key
628
+ * @param token1 Second token class key
629
+ * @param fee Fee tier (500, 3000, or 10000)
630
+ * @param amount0Min Minimum amount0 to receive (slippage protection)
631
+ * @param amount1Min Minimum amount1 to receive (slippage protection)
632
+ * @param positionId Unique position identifier
633
+ * @returns Transaction ID from bundler response
634
+ *
635
+ * @private
636
+ * @throws Error if signing or bundler submission fails
637
+ */
638
+ private sendRemoveLiquidityToBundler;
639
+ /**
640
+ * Send CollectPositionFees transaction directly to bundler
641
+ *
642
+ * Bypasses GSwap SDK and posts signed EIP-712 CollectPositionFees DTO directly to bundler.
643
+ * Collects accumulated trading fees from a liquidity position independently of the position itself.
644
+ *
645
+ * @param token0 First token class key
646
+ * @param token1 Second token class key
647
+ * @param fee Fee tier (500, 3000, or 10000)
648
+ * @param amount0Requested Requested amount0 to collect (0 to collect all available)
649
+ * @param amount1Requested Requested amount1 to collect (0 to collect all available)
650
+ * @param tickLower Lower tick boundary (int256, supports negative)
651
+ * @param tickUpper Upper tick boundary (int256, supports negative)
652
+ * @param positionId Unique position identifier
653
+ * @returns Transaction ID from bundler response
654
+ *
655
+ * @private
656
+ * @throws Error if signing or bundler submission fails
657
+ */
658
+ private sendCollectPositionFeesToBundler;
659
+ /**
660
+ * Send Swap transaction directly to bundler
661
+ *
662
+ * Bypasses GSwap SDK and posts signed EIP-712 Swap DTO directly to bundler.
663
+ * Implements exact input swapping (sell exact amount of input token, receive output token).
664
+ *
665
+ * @param fromToken Input token (token being sold) in GSwap format
666
+ * @param toToken Output token (token being bought) in GSwap format
667
+ * @param inputAmount Amount of input token to sell
668
+ * @param minOutput Minimum amount of output token to receive (slippage protection)
669
+ * @param feeTier Fee tier (500, 3000, or 10000)
670
+ * @param walletAddress Wallet address executing the swap
671
+ * @returns Transaction ID from bundler response
672
+ *
673
+ * @private
674
+ * @throws Error if signing or bundler submission fails
675
+ */
676
+ private sendSwapToBundler;
677
+ /**
678
+ * Build strings instructions for AddLiquidity state locking
679
+ *
680
+ * Strings instructions are used by the bundler to lock the necessary state
681
+ * fields during transaction execution. This ensures atomicity of the operation.
682
+ *
683
+ * @param token0 First token class key
684
+ * @param token1 Second token class key
685
+ * @param fee Fee tier (500, 3000, or 10000 basis points)
686
+ * @param ownerAddress Wallet address creating the position
687
+ * @returns Array of strings instructions for state locking
688
+ *
689
+ * @private
690
+ */
691
+ private buildLiquidityStringsInstructions;
267
692
  /**
268
693
  * Handle GSwap SDK errors with consistent logging and error transformation
269
694
  *
@@ -305,11 +730,16 @@ export declare class GSwapService extends LoggerBase {
305
730
  */
306
731
  private ensureWebSocketConnected;
307
732
  /**
308
- * Get the Q96 constant for Uniswap V3 calculations (2^96)
309
- * Used in various liquidity and price calculations
733
+ * Calculate personal sign prefix for GalaChain compatibility
734
+ *
735
+ * Builds the prefix string required by GalaChain for EIP-712 signing.
736
+ * This matches the format used in production working payloads.
737
+ *
738
+ * @param payload The payload being signed
739
+ * @returns Prefix string for signing
310
740
  *
311
741
  * @private
312
742
  */
313
- private getQ96;
743
+ private calculatePersonalSignPrefix;
314
744
  }
315
745
  //# sourceMappingURL=GSwapService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GSwapService.d.ts","sourceRoot":"","sources":["../../src/services/GSwapService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAQtD,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,YAAa,SAAQ,UAAU;IAC1C,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB;IA0C1E;;;;OAIG;IACG,sBAAsB,CAC1B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,eAAe,CAAC;IAwC3B;;;;OAIG;IACG,uBAAuB,CAC3B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,eAAe,CAAC;IAuC3B;;;;OAIG;IACG,WAAW,CACf,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,CAAC;IAqF7B;;;;;;;;;;OAUG;IACG,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IA4DhE;;;;;OAKG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkEpE;;;;;;OAMG;IACG,yBAAyB,CAC7B,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,MAAY,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,EAAE,CAAC;IAmD3B;;;;;OAKG;IACG,oBA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