@gala-chain/launchpad-sdk 3.16.0 → 3.16.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,104 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.16.2
4
+
5
+ ### Patch Changes
6
+
7
+ - ## Enhancement: Token Format Validation for Price History (v3.16.2)
8
+
9
+ **Added validation** to ensure correct token ID format for DEX Backend API compatibility.
10
+
11
+ The price history API requires tokens to follow GalaChain's standard format where the token name
12
+ is stored in the `type` field:
13
+
14
+ ### Valid Formats
15
+
16
+ ✅ String format: `Token|Unit|{TOKEN_NAME}|{additionalKey}`
17
+
18
+ ```typescript
19
+ sdk.fetchPriceHistory({ tokenId: 'Token|Unit|GALA|none' });
20
+ sdk.fetchPriceHistory({ tokenId: 'Token|Unit|SILK|none' });
21
+ ```
22
+
23
+ ✅ Object format:
24
+ `{ collection: "Token", category: "Unit", type: "{TOKEN_NAME}", additionalKey: "{key}" }`
25
+
26
+ ```typescript
27
+ sdk.fetchPriceHistory({
28
+ tokenId: { collection: 'Token', category: 'Unit', type: 'GALA', additionalKey: 'none' },
29
+ });
30
+ ```
31
+
32
+ ### Invalid Formats (Now Rejected)
33
+
34
+ ❌ `GALA|Unit|none|none` - Token name in first field instead of third ❌ `Gala|Unit|none|none` -
35
+ Mixed case, ambiguous format ❌
36
+ `{ collection: 'GALA', category: 'Unit', type: 'none', additionalKey: 'none' }` - Wrong field
37
+ mapping
38
+
39
+ ### Error Messages
40
+
41
+ When invalid format is provided, users now get clear guidance:
42
+
43
+ ```
44
+ Invalid tokenId format for price history. Expected format: "Token|Unit|{TOKEN_NAME}|{additionalKey}"
45
+ (e.g., "Token|Unit|GALA|none"). Received: "GALA|Unit|none|none".
46
+ The token name must be in the third field (type), not the first field (collection).
47
+ ```
48
+
49
+ ### Changes
50
+ - Added comprehensive token format validation in `PriceHistoryService.validateOptions()`
51
+ - Validates both string and object token ID formats
52
+ - Provides clear error messages with examples
53
+ - Prevents silent failures from incorrect token format mapping
54
+ - Ensures DEX Backend API receives correctly formatted token identifiers
55
+
56
+ This prevents subtle bugs where tokens like `GALA|Unit|none|none` would be silently converted to
57
+ `none$Unit$none$none` (wrong).
58
+
59
+ ## 3.16.1
60
+
61
+ ### Patch Changes
62
+
63
+ - ## Fix: Price History Token Format Mapping (v3.16.1)
64
+
65
+ **Critical Fix:** Corrects token ID format conversion for DEX Backend API.
66
+
67
+ The DEX Backend API uses a different token format than GalaChain:
68
+ - API format: `tokenName$Unit$none$none` (e.g., `GALA$Unit$none$none`)
69
+ - SDK format: `collection|category|type|additionalKey` (e.g., `Token|Unit|GALA|none`)
70
+
71
+ ### Changes
72
+
73
+ **PriceHistoryService.ts:**
74
+ - Fixed token format conversion when calling DEX Backend API
75
+ - Now correctly maps GalaChain TokenInstanceKey fields to API format
76
+ - Token name is extracted from the `type` field (where it's stored in GalaChain)
77
+ - API always receives properly formatted: `{tokenName}$Unit$none$none`
78
+
79
+ ### Impact
80
+ - `fetchPriceHistory()` now returns historical price data correctly
81
+ - MCP tool `gala_launchpad_fetch_price_history` now works as expected
82
+ - All 30,000+ price snapshots now accessible for supported tokens
83
+
84
+ ### Before
85
+
86
+ ```typescript
87
+ // Input: Token|Unit|GALA|none
88
+ // Converted to: Token$Unit$GALA$none (WRONG - API expected GALA$Unit$none$none)
89
+ // Result: Empty response, no historical data
90
+ ```
91
+
92
+ ### After
93
+
94
+ ```typescript
95
+ // Input: Token|Unit|GALA|none
96
+ // Converted to: GALA$Unit$none$none (CORRECT)
97
+ // Result: Returns all 30,862 GALA price snapshots
98
+ ```
99
+
100
+ This is a critical fix for price history functionality.
101
+
3
102
  ## 3.16.0
4
103
 
5
104
  ### Minor Changes
@@ -3,5 +3,5 @@
3
3
  * This file is generated by scripts/inject-version.ts during build
4
4
  * DO NOT EDIT MANUALLY
5
5
  */
6
- export declare const SDK_VERSION = "3.16.0";
6
+ export declare const SDK_VERSION = "3.16.2";
7
7
  //# sourceMappingURL=version.generated.d.ts.map