@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
@@ -0,0 +1,169 @@
1
+ import BigNumber from 'bignumber.js';
2
+ /**
3
+ * Singleton BigNumber cache for performance optimization.
4
+ *
5
+ * Caches BigNumber instances to avoid repeated parsing of the same values.
6
+ * Typical savings: 2-5ms per swap operation by reusing instances.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Use pre-cached constants
11
+ * const zero = BigNumberPoolCache.ZERO;
12
+ * const minLimit = BigNumberPoolCache.MIN_SQRT_RATIO;
13
+ *
14
+ * // Cache dynamic values
15
+ * const amount = BigNumberPoolCache.getCached('1000000');
16
+ * const amount2 = BigNumberPoolCache.getCached('1000000'); // Same instance!
17
+ *
18
+ * // Memory management (call periodically in long-running processes)
19
+ * BigNumberPoolCache.trimCache(1000); // Keep 1000 most recent entries
20
+ * ```
21
+ *
22
+ * @remarks
23
+ * Thread-safe for read operations (Map is thread-safe for reads).
24
+ * Cache grows unbounded unless trimCache() is called periodically.
25
+ *
26
+ * @see {@link https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/TickMath.sol | Uniswap V3 TickMath}
27
+ */
28
+ export declare class BigNumberPoolCache {
29
+ /**
30
+ * Internal cache storage (string key → BigNumber instance)
31
+ * @internal
32
+ */
33
+ private static readonly CACHE;
34
+ /**
35
+ * Pre-cached zero constant (most frequently used value)
36
+ * @constant
37
+ */
38
+ static readonly ZERO: BigNumber;
39
+ /**
40
+ * Pre-cached one constant (used in arithmetic operations)
41
+ * @constant
42
+ */
43
+ static readonly ONE: BigNumber;
44
+ /**
45
+ * Fee denominator for Uniswap V3 (1,000,000 = 1,000,000 pips)
46
+ * Used for fee calculations: actualFee = feeAmount / FEE_PIPS
47
+ * @constant
48
+ * @example
49
+ * ```typescript
50
+ * // Calculate 0.3% fee (3000 fee tier)
51
+ * const fee = new BigNumber(3000).div(BigNumberPoolCache.FEE_PIPS);
52
+ * // fee = 0.003 (0.3%)
53
+ * ```
54
+ */
55
+ static readonly FEE_PIPS: BigNumber;
56
+ /**
57
+ * Minimum sqrt price ratio (corresponds to tick -887272)
58
+ * Uniswap V3 boundary: sqrtPriceX96 cannot go below this value
59
+ * @constant
60
+ * @see {@link https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/TickMath.sol#L10 | Uniswap V3 MIN_TICK}
61
+ */
62
+ static readonly MIN_SQRT_RATIO: BigNumber;
63
+ /**
64
+ * Maximum sqrt price ratio (corresponds to tick 887272)
65
+ * Uniswap V3 boundary: sqrtPriceX96 cannot exceed this value
66
+ * @constant
67
+ * @see {@link https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/TickMath.sol#L13 | Uniswap V3 MAX_TICK}
68
+ */
69
+ static readonly MAX_SQRT_RATIO: BigNumber;
70
+ /**
71
+ * Get or create cached BigNumber instance.
72
+ *
73
+ * Returns the same instance for identical values (referential equality).
74
+ * Avoids redundant parsing overhead for frequently used values.
75
+ *
76
+ * @param value - Numeric value (string or number)
77
+ * @returns Cached BigNumber instance
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const a = BigNumberPoolCache.getCached('1000');
82
+ * const b = BigNumberPoolCache.getCached('1000');
83
+ * console.log(a === b); // true (same instance)
84
+ *
85
+ * const c = BigNumberPoolCache.getCached(1000);
86
+ * console.log(a === c); // true (number coerced to string key)
87
+ * ```
88
+ *
89
+ * @remarks
90
+ * - Keys are normalized to strings via `.toString()`
91
+ * - Cache grows unbounded unless `trimCache()` is called
92
+ * - O(1) lookup complexity (Map hash table)
93
+ */
94
+ static getCached(value: string | number): BigNumber;
95
+ /**
96
+ * Clear the entire cache (removes all entries).
97
+ *
98
+ * Pre-cached constants (ZERO, ONE, etc.) remain unaffected as they
99
+ * are static properties, not cache entries.
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * BigNumberPoolCache.clearCache();
104
+ * console.log(BigNumberPoolCache.getCacheStats().size); // 0
105
+ *
106
+ * // Constants still work
107
+ * console.log(BigNumberPoolCache.ZERO.toString()); // "0"
108
+ * ```
109
+ *
110
+ * @remarks
111
+ * Use sparingly as it discards all cached performance benefits.
112
+ * Prefer `trimCache()` for periodic memory management.
113
+ */
114
+ static clearCache(): void;
115
+ /**
116
+ * Get cache statistics for monitoring and debugging.
117
+ *
118
+ * @returns Object containing cache size and entry keys
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * const stats = BigNumberPoolCache.getCacheStats();
123
+ * console.log(`Cache size: ${stats.size}`);
124
+ * console.log(`Keys: ${stats.entries.join(', ')}`);
125
+ * ```
126
+ *
127
+ * @remarks
128
+ * Useful for performance profiling and memory leak detection.
129
+ */
130
+ static getCacheStats(): {
131
+ size: number;
132
+ entries: string[];
133
+ };
134
+ /**
135
+ * Trim cache to maximum size (FIFO eviction strategy).
136
+ *
137
+ * Keeps the N most recently inserted entries, removes oldest entries.
138
+ * Designed for long-running processes (arbitrage bots, market makers).
139
+ *
140
+ * @param maxSize - Maximum cache entries to retain (default: 1000)
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // Arbitrage bot memory management pattern
145
+ * let swapCount = 0;
146
+ * async function executeSwap(params: SwapParams) {
147
+ * // ... swap logic using cached BigNumbers ...
148
+ *
149
+ * swapCount++;
150
+ * if (swapCount % 100 === 0) {
151
+ * BigNumberPoolCache.trimCache(1000); // Keep 1000 hot values
152
+ * }
153
+ * }
154
+ * ```
155
+ *
156
+ * @remarks
157
+ * - Evicts oldest entries first (Map insertion order preserved)
158
+ * - Recommended maxSize: 500-2000 for typical trading bots
159
+ * - Call after every 100-500 operations in hot loops
160
+ * - Does not affect pre-cached constants
161
+ */
162
+ static trimCache(maxSize?: number): void;
163
+ }
164
+ /**
165
+ * Default export for convenience
166
+ * @see {@link BigNumberPoolCache}
167
+ */
168
+ export default BigNumberPoolCache;
169
+ //# sourceMappingURL=bignumber-pool-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bignumber-pool-cache.d.ts","sourceRoot":"","sources":["../../src/utils/bignumber-pool-cache.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,kBAAkB;IAC7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAqC;IAElE;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,YAAoB;IAExC;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,GAAG,YAAoB;IAEvC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,YAA0B;IAElD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,YAA+B;IAE7D;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,YAE5B;IAEF;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUnD;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,UAAU,IAAI,IAAI;IAIzB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;IAO3D;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,GAAE,MAAa,GAAG,IAAI;CAU/C;AAED;;;GAGG;AACH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Composite Pool Data Converter
3
+ *
4
+ * Converts raw GalaChain GetCompositePool API responses into properly
5
+ * typed objects with BigNumber conversions for offline calculations.
6
+ *
7
+ * Ported from offline-quote-example/quote-local.mjs createCompositePoolDtoFromResponse()
8
+ *
9
+ * ## Runtime Validation Strategy for Type Assertions
10
+ *
11
+ * This module uses strategic `as any` type assertions to work around dependency
12
+ * version conflicts between @gala-chain/api and @gala-chain/dex. To mitigate
13
+ * risks from type assertions, we employ the following validation strategy:
14
+ *
15
+ * ### Type Assertion Patterns Used
16
+ * 1. **TokenBalance Construction** (lines 78-79, 82-83)
17
+ * - Assertion: `new TokenBalance(data as any)`
18
+ * - Reason: SDK may have different @gala-chain/api version than @gala-chain/dex
19
+ * - Runtime Validation: BigNumber.js validates numeric conversions on line 79
20
+ *
21
+ * 2. **TickData Property Assignment** (lines 67-72)
22
+ * - Assertion: `(tickDataInstance as any).propertyName = value`
23
+ * - Reason: TickData constructor only accepts 2 params; properties are set after
24
+ * - Runtime Validation: All values are either boolean or BigNumber conversions
25
+ *
26
+ * 3. **CompositePoolDto Construction** (lines 87-91)
27
+ * - Assertion: `token0Balance as any` and `token1Balance as any`
28
+ * - Reason: TokenBalance versions may differ between dependencies
29
+ * - Runtime Validation: BigNumber.js automatically validates during conversions
30
+ *
31
+ * ### Validation Guarantees
32
+ * - **Numeric Conversions**: BigNumber.js throws when parsing invalid numbers (NaN checks)
33
+ * - **Object Construction**: Pool, TickData, TokenBalance throw on constructor errors
34
+ * - **Property Access**: Type assertions limited to isolated property assignments
35
+ * - **API Contract**: Response structure validated via TypeScript type inference
36
+ *
37
+ * ### When This Strategy Breaks
38
+ * If API response structure changes or contains unexpected data types, errors
39
+ * will occur during BigNumber conversion or object construction with clear
40
+ * error messages indicating what data was invalid.
41
+ *
42
+ * @packageDocumentation
43
+ */
44
+ import { CompositePoolDto } from '@gala-chain/dex';
45
+ import type { GetCompositePoolResponse, CompositePoolDataResult } from '../types/composite-pool.dto';
46
+ /**
47
+ * Convert GetCompositePool API response to CompositePoolDto
48
+ *
49
+ * Critical conversions:
50
+ * - All numeric string fields → BigNumber
51
+ * - Raw tick data → TickData instances
52
+ * - Raw balances → TokenBalance instances
53
+ *
54
+ * ## BigNumber Precision Strategy
55
+ *
56
+ * All numeric fields are converted to BigNumber.js for arbitrary precision arithmetic.
57
+ * This is critical for DeFi operations where precision loss causes calculation errors.
58
+ *
59
+ * **Key Fields Converted:**
60
+ * - Pool properties: sqrtPrice, grossPoolLiquidity, liquidity, feeGrowthGlobal0/1, protocolFees, maxLiquidityPerTick
61
+ * - Tick data: liquidityNet, liquidityGross, feeGrowthOutside0/1
62
+ * - Token balances: quantity field
63
+ *
64
+ * **Precision Characteristics:**
65
+ * - BigNumber.js maintains arbitrary precision (no floating-point errors)
66
+ * - Supports numbers beyond JavaScript's safe integer limit (2^53-1)
67
+ * - Suitable for token amounts with 18+ decimals (GALA, GUSDC, etc.)
68
+ * - No rounding errors in conversions between formats
69
+ *
70
+ * **Use Cases:**
71
+ * - Bonding curve calculations (exponential formulas)
72
+ * - Swap quote computations (multiplication/division intensive)
73
+ * - Tick-based liquidity calculations (high precision required)
74
+ * - Multi-step DeFi operations (error accumulation must be prevented)
75
+ *
76
+ * @param responseData Raw API response data
77
+ * @returns Fully typed CompositePoolDto with BigNumber conversions
78
+ * @throws Error if response data is invalid or missing required fields
79
+ *
80
+ * @example Offline quote calculation with BigNumber precision
81
+ * ```typescript
82
+ * const response = await axios.post(GCP_URL, getCompositePoolDto);
83
+ * const compositePool = createCompositePoolDtoFromResponse(response.data.Data);
84
+ *
85
+ * // All numeric values are BigNumber instances
86
+ * const sqrtPrice = compositePool.pool.sqrtPrice; // BigNumber - no precision loss
87
+ * const liquidity = compositePool.pool.liquidity; // BigNumber - preserves full precision
88
+ *
89
+ * // Safe calculations without floating-point errors
90
+ * const calculatedAmount = liquidity.times(sqrtPrice).dividedBy(someNumber);
91
+ * // Result is still BigNumber with full precision
92
+ * ```
93
+ *
94
+ * @example Accessing pool data safely
95
+ * ```typescript
96
+ * const pool = compositePool.pool;
97
+ *
98
+ * // All these are BigNumber instances - safe for math operations
99
+ * console.log(pool.sqrtPrice.toString()); // Full precision string representation
100
+ * console.log(pool.liquidity.toFixed(0)); // Fixed decimal format
101
+ * console.log(pool.feeGrowthGlobal0.multipliedBy(2)); // Precise multiplication
102
+ * ```
103
+ */
104
+ /**
105
+ * RUNTIME VALIDATION NOTES:
106
+ * This function uses `as any` type assertions only where necessary for dependency
107
+ * compatibility. All type assertions are followed by runtime validation through:
108
+ * - BigNumber construction (throws on NaN or invalid numbers)
109
+ * - Object instantiation (Pool, TickData, TokenBalance throw on errors)
110
+ * - Numeric field assignments (guaranteed via BigNumber.js precision)
111
+ */
112
+ export declare function createCompositePoolDtoFromResponse(responseData: GetCompositePoolResponse['Data']): CompositePoolDto;
113
+ /**
114
+ * Wrap CompositePoolDto with additional metadata
115
+ *
116
+ * @param compositePoolDto Converted CompositePoolDto
117
+ * @param rawResponse Raw response data for reference
118
+ * @returns CompositePoolDataResult with full metadata
119
+ */
120
+ export declare function wrapCompositePoolData(compositePoolDto: CompositePoolDto, _rawResponse: GetCompositePoolResponse['Data']): CompositePoolDataResult;
121
+ //# sourceMappingURL=composite-pool-converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-pool-converter.d.ts","sourceRoot":"","sources":["../../src/utils/composite-pool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAkB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInE,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAErG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,YAAY,EAAE,wBAAwB,CAAC,MAAM,CAAC,GAC7C,gBAAgB,CAkElB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,wBAAwB,CAAC,MAAM,CAAC,GAC7C,uBAAuB,CAWzB"}
@@ -389,4 +389,90 @@ export declare class GSwapPositionError extends Error {
389
389
  */
390
390
  constructor(message: string, originalError: unknown, code?: string | undefined);
391
391
  }
392
+ /**
393
+ * Error thrown when DEX quote operations fail
394
+ *
395
+ * This error is thrown during DEX quote calculations (local and external),
396
+ * composite pool data fetching, and related operations. It captures the
397
+ * operation context for debugging and recovery.
398
+ *
399
+ * @example Quote calculation failure
400
+ * ```typescript
401
+ * throw new DexQuoteError(
402
+ * 'Failed to calculate quote for GALA/BENE swap',
403
+ * {
404
+ * fromToken: 'GALA|Unit|none|none',
405
+ * toToken: 'Token|Unit|BENE|client:123',
406
+ * amount: '1000'
407
+ * }
408
+ * );
409
+ * ```
410
+ *
411
+ * @example Catching quote errors
412
+ * ```typescript
413
+ * try {
414
+ * const quote = await sdk.calculateDexPoolQuoteExactAmountLocal({
415
+ * compositePoolData: composite,
416
+ * fromToken: 'GALA|Unit|none|none',
417
+ * toToken: 'Token|Unit|BENE|client:123',
418
+ * amount: '1000'
419
+ * });
420
+ * } catch (error) {
421
+ * if (error instanceof DexQuoteError) {
422
+ * console.log(`Quote failed: ${error.message}`);
423
+ * if (error.context) {
424
+ * console.log(`Tokens: ${error.context.fromToken} → ${error.context.toToken}`);
425
+ * }
426
+ * }
427
+ * }
428
+ * ```
429
+ */
430
+ export declare class DexQuoteError extends ValidationError {
431
+ context?: any | undefined;
432
+ /**
433
+ * Creates a new DexQuoteError
434
+ *
435
+ * @param message - Human-readable error message describing what failed
436
+ * @param context - Optional context object with operation details (tokens, amounts, etc.)
437
+ */
438
+ constructor(message: string, context?: any | undefined);
439
+ }
440
+ /**
441
+ * Error thrown when a DEX pool is not found
442
+ *
443
+ * This error is thrown when attempting to access or fetch data for a DEX pool
444
+ * that does not exist, typically during composite pool data retrieval or pool
445
+ * discovery operations.
446
+ *
447
+ * @example Pool not found
448
+ * ```typescript
449
+ * throw new DexPoolNotFoundError(
450
+ * 'Pool not found: GALA/BENE with fee 3000'
451
+ * );
452
+ * ```
453
+ *
454
+ * @example Catching pool not found errors
455
+ * ```typescript
456
+ * try {
457
+ * const composite = await sdk.fetchCompositePoolData({
458
+ * token0: 'GALA|Unit|none|none',
459
+ * token1: 'Token|Unit|BENE|client:123',
460
+ * fee: 3000
461
+ * });
462
+ * } catch (error) {
463
+ * if (error instanceof DexPoolNotFoundError) {
464
+ * console.log('Pool does not exist. Create it first with liquidity.');
465
+ * // Implement pool creation or alternative routing
466
+ * }
467
+ * }
468
+ * ```
469
+ */
470
+ export declare class DexPoolNotFoundError extends ValidationError {
471
+ /**
472
+ * Creates a new DexPoolNotFoundError
473
+ *
474
+ * @param message - Human-readable error message describing which pool was not found
475
+ */
476
+ constructor(message: string);
477
+ }
392
478
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IAU/B,KAAK,CAAC,EAAE,MAAM;IACd,IAAI,CAAC,EAAE,MAAM;IAVtB;;;;;;OAMG;gBAED,OAAO,EAAE,MAAM,EACR,KAAK,CAAC,EAAE,MAAM,YAAA,EACd,IAAI,CAAC,EAAE,MAAM,YAAA;CAKvB;AAED;;;;;;;;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M,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC;IAyB3E;;;OAGG;IACG,iBAAiB,CAAC,CAAC,SAAS,MAAM,EACtC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,CAAC,EACN,WAAW,GAAE,WAAyC,GACrD,OAAO,CACR,CAAC,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,CACrF;IAaD;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAkFzB;;;OAGG;IACH,OAAO,IAAI,IAAI;CAahB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Environment variable loader that checks both root and local .env files
3
+ * Useful for demo scripts and CLI tools that need wallet configuration
4
+ */
5
+ /**
6
+ * Load environment variables from root .env and local .env files
7
+ * Root .env is loaded first, then local .env (local overrides root)
8
+ *
9
+ * Usage in demo scripts:
10
+ * ```typescript
11
+ * import { loadEnvWithFallback } from '../src/utils/load-env';
12
+ *
13
+ * loadEnvWithFallback();
14
+ *
15
+ * const privateKey = process.env.WALLET_PRIVATE_KEY;
16
+ * if (!privateKey) {
17
+ * throw new Error('WALLET_PRIVATE_KEY not set in root or local .env');
18
+ * }
19
+ * ```
20
+ */
21
+ export declare function loadEnvWithFallback(): void;
22
+ /**
23
+ * Get a specific environment variable with detailed error message
24
+ * Checks both root and local .env files
25
+ */
26
+ export declare function getEnvOrThrow(varName: string, context?: string): string;
27
+ /**
28
+ * Get environment variable with optional default
29
+ */
30
+ export declare function getEnv(varName: string, defaultValue?: string): string | undefined;
31
+ //# sourceMappingURL=load-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-env.d.ts","sourceRoot":"","sources":["../../src/utils/load-env.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAY1C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CASvE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjF"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Pool Pair Parser
3
+ *
4
+ * Utilities for parsing poolPair strings from DEX pool discovery into components
5
+ * and converting pipe-delimited token formats to TypeClass objects.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { TokenClassKey } from '../types/common';
10
+ /**
11
+ * Parse poolPair string from fetchDexPools() into token0, token1, and fee components
12
+ *
13
+ * Format: "token0/token1/fee"
14
+ * Example: "GALA|Unit|none|none/Token|Unit|BENE|client:5c806869e7fd0e2384461ce9/3000"
15
+ *
16
+ * Each token is in pipe-delimited format: "collection|category|type|additionalKey"
17
+ *
18
+ * @param poolPair Pool pair string from fetchDexPools() result
19
+ * @returns Object with token0, token1 (both in pipe-delimited format), and fee tier
20
+ * @throws Error if poolPair format is invalid
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const { token0, token1, fee } = parsePoolPair(
25
+ * 'GALA|Unit|none|none/Token|Unit|BENE|client:123/3000'
26
+ * );
27
+ * // → { token0: 'GALA|Unit|none|none', token1: 'Token|Unit|BENE|client:123', fee: 3000 }
28
+ * ```
29
+ */
30
+ export declare function parsePoolPair(poolPair: string): {
31
+ token0: string;
32
+ token1: string;
33
+ fee: number;
34
+ };
35
+ /**
36
+ * Convert pipe-delimited token string to TokenClassKey object
37
+ *
38
+ * Format: "collection|category|type|additionalKey"
39
+ * Example: "GALA|Unit|none|none" or "Token|Unit|BENE|client:5c806869e7fd0e2384461ce9"
40
+ *
41
+ * @param pipeDelimitedToken Token string in pipe-delimited format
42
+ * @returns TokenClassKey object with all components
43
+ * @throws Error if token format is invalid
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const tokenClass = pipeDelimitedToTokenClassKey('GALA|Unit|none|none');
48
+ * // → { collection: 'GALA', category: 'Unit', type: 'none', additionalKey: 'none' }
49
+ *
50
+ * const tokenClass2 = pipeDelimitedToTokenClassKey('Token|Unit|BENE|client:123');
51
+ * // → { collection: 'Token', category: 'Unit', type: 'BENE', additionalKey: 'client:123' }
52
+ * ```
53
+ */
54
+ export declare function pipeDelimitedToTokenClassKey(pipeDelimitedToken: string): TokenClassKey;
55
+ //# sourceMappingURL=pool-pair-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-pair-parser.d.ts","sourceRoot":"","sources":["../../src/utils/pool-pair-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb,CA2CA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,4BAA4B,CAAC,kBAAkB,EAAE,MAAM,GAAG,aAAa,CAyCtF"}