@gala-chain/launchpad-sdk 3.19.1 → 3.20.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.
- package/CHANGELOG.md +122 -1
- package/README.md +132 -2
- package/dist/LaunchpadSDK.d.ts.map +1 -1
- package/dist/constants/version.generated.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/services/DexService.d.ts +58 -7
- package/dist/services/DexService.d.ts.map +1 -1
- package/dist/services/PriceHistoryService.d.ts +106 -17
- package/dist/services/PriceHistoryService.d.ts.map +1 -1
- package/dist/types/priceHistory.dto.d.ts +13 -6
- package/dist/types/priceHistory.dto.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -52,22 +52,62 @@ export declare class DexService {
|
|
|
52
52
|
* @throws Error if API request fails
|
|
53
53
|
*/
|
|
54
54
|
fetchTokenSpotPrice(symbols: string | string[]): Promise<TokenSpotPrice[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Fetch current USD spot price for a token trading on the DEX
|
|
57
|
+
*
|
|
58
|
+
* Uses the DEX Backend API `/v1/trade/price` endpoint to retrieve real-time
|
|
59
|
+
* spot prices for tokens actively trading on the DEX. This is the primary
|
|
60
|
+
* method for getting prices of graduated launchpad tokens.
|
|
61
|
+
*
|
|
62
|
+
* Accepts flexible token ID formats:
|
|
63
|
+
* - Pipe-delimited string: "Token|Unit|GDOG|eth:0x..."
|
|
64
|
+
* - Object: { collection, category, type, additionalKey }
|
|
65
|
+
*
|
|
66
|
+
* @param tokenId Token ID in pipe-delimited or object format
|
|
67
|
+
* @returns Promise<TokenSpotPrice> Spot price with symbol and USD price
|
|
68
|
+
*
|
|
69
|
+
* @example Using pipe-delimited format
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const price = await dexService.fetchDexTokenSpotPrice(
|
|
72
|
+
* 'Token|Unit|GDOG|eth:902Ef7566c8A8bEe5517FdEC0D7b5d1157942830'
|
|
73
|
+
* );
|
|
74
|
+
* console.log(`${price.symbol}: $${price.price.toFixed(6)}`);
|
|
75
|
+
* // Output: GDOG: $0.019110
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example Using object format
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const price = await dexService.fetchDexTokenSpotPrice({
|
|
81
|
+
* collection: 'Token',
|
|
82
|
+
* category: 'Unit',
|
|
83
|
+
* type: 'GDOG',
|
|
84
|
+
* additionalKey: 'eth:902Ef7566c8A8bEe5517FdEC0D7b5d1157942830'
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @throws Error if token not found on DEX
|
|
89
|
+
* @throws Error if API request fails
|
|
90
|
+
*/
|
|
91
|
+
fetchDexTokenSpotPrice(tokenId: TokenId): Promise<TokenSpotPrice>;
|
|
55
92
|
/**
|
|
56
93
|
* Calculate spot price for a launchpad token in USD
|
|
57
94
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
95
|
+
* Intelligently determines the best price source based on token graduation status:
|
|
96
|
+
* - **Active Pools** (bonding curve ongoing): Uses calculateBuyAmount to compute price from bonding curve
|
|
97
|
+
* - **Graduated Tokens** (DEX trading): Uses /v1/trade/price endpoint for real-time market price
|
|
98
|
+
*
|
|
99
|
+
* For graduated tokens, requires an optional fetchPoolDetails parameter to detect graduation status.
|
|
100
|
+
* If not provided, falls back to bonding curve calculation even for graduated tokens.
|
|
62
101
|
*
|
|
63
102
|
* **Note**: This method requires a reference to the LaunchpadAPI's calculateBuyAmount
|
|
64
103
|
* method to work. It should be called from the LaunchpadAPI context.
|
|
65
104
|
*
|
|
66
|
-
* @param tokenName Token name (e.g., 'dragnrkti', 'rocketri', 'unicornri')
|
|
105
|
+
* @param tokenName Token name (e.g., 'dragnrkti', 'rocketri', 'unicornri', 'galadog')
|
|
67
106
|
* @param calculateBuyAmount Reference to LaunchpadAPI's calculateBuyAmount method
|
|
107
|
+
* @param fetchPoolDetails Optional reference to LaunchpadAPI's fetchPoolDetails method (recommended for accurate pricing of graduated tokens)
|
|
68
108
|
* @returns Promise<TokenSpotPrice> Spot price with symbol and USD price
|
|
69
109
|
*
|
|
70
|
-
* @example
|
|
110
|
+
* @example Active token (bonding curve)
|
|
71
111
|
* ```typescript
|
|
72
112
|
* const price = await dexService.fetchLaunchpadTokenSpotPrice(
|
|
73
113
|
* 'dragnrkti',
|
|
@@ -77,11 +117,22 @@ export declare class DexService {
|
|
|
77
117
|
* // Output: DRAGNRKTI: $0.000123
|
|
78
118
|
* ```
|
|
79
119
|
*
|
|
120
|
+
* @example Graduated token (DEX market price)
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const price = await dexService.fetchLaunchpadTokenSpotPrice(
|
|
123
|
+
* 'galadog',
|
|
124
|
+
* (opts) => launchpadAPI.calculateBuyAmount(opts),
|
|
125
|
+
* (tokenName) => launchpadAPI.fetchPoolDetails(tokenName)
|
|
126
|
+
* );
|
|
127
|
+
* console.log(`${price.symbol}: $${price.price.toFixed(6)}`);
|
|
128
|
+
* // Output: GALADOG: $0.019110 (real DEX market price)
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
80
131
|
* @throws Error if token not found
|
|
81
132
|
* @throws Error if price calculation fails
|
|
82
133
|
* @throws Error if GALA price unavailable
|
|
83
134
|
*/
|
|
84
|
-
fetchLaunchpadTokenSpotPrice(tokenName: string, calculateBuyAmount: (options: CalculateBuyAmountOptions) => Promise<AmountCalculationResult>): Promise<TokenSpotPrice>;
|
|
135
|
+
fetchLaunchpadTokenSpotPrice(tokenName: string, calculateBuyAmount: (options: CalculateBuyAmountOptions) => Promise<AmountCalculationResult>, fetchPoolDetails?: (tokenName: string) => Promise<any>): Promise<TokenSpotPrice>;
|
|
85
136
|
/**
|
|
86
137
|
* Fetch comprehensive token details from DEX API platform
|
|
87
138
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DexService.d.ts","sourceRoot":"","sources":["../../src/services/DexService.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,cAAc,EAEd,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"DexService.d.ts","sourceRoot":"","sources":["../../src/services/DexService.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,cAAc,EAEd,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAUjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;GASG;AACH,qBAAa,UAAU;IAGT,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEH,IAAI,EAAE,UAAU,EAAE,SAAS,GAAE,OAAe;IAIzE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAsChF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACG,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IAmDvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACG,4BAA4B,CAChC,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,uBAAuB,CAAC,EAC5F,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,GACrD,OAAO,CAAC,cAAc,CAAC;IA4E1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC;CA6DjE"}
|
|
@@ -15,15 +15,20 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { FetchPriceHistoryOptions, PriceHistoryResult } from '../types/priceHistory.dto';
|
|
17
17
|
import { HttpClient } from '../utils/http';
|
|
18
|
+
import { TokenResolverService } from './TokenResolverService';
|
|
18
19
|
/**
|
|
19
20
|
* Price History Service Class
|
|
20
21
|
*
|
|
21
22
|
* Manages API-based price history queries via DEX Backend API.
|
|
23
|
+
* Supports optional token name resolution via TokenResolverService for convenience.
|
|
22
24
|
*
|
|
23
25
|
* @example
|
|
24
26
|
* ```typescript
|
|
25
27
|
* const httpClient = new HttpClient(config);
|
|
26
|
-
* const
|
|
28
|
+
* const tokenResolverService = new TokenResolverService(...);
|
|
29
|
+
* const service = new PriceHistoryService(httpClient, false, tokenResolverService);
|
|
30
|
+
*
|
|
31
|
+
* // Using tokenId
|
|
27
32
|
* const history = await service.fetchPriceHistory({
|
|
28
33
|
* tokenId: { collection: 'Token', category: 'Unit', type: 'GUSDC', additionalKey: 'eth:...' },
|
|
29
34
|
* from: new Date('2024-01-01'),
|
|
@@ -31,31 +36,75 @@ import { HttpClient } from '../utils/http';
|
|
|
31
36
|
* page: 1,
|
|
32
37
|
* limit: 20
|
|
33
38
|
* });
|
|
39
|
+
*
|
|
40
|
+
* // Using tokenName (auto-resolves to tokenId)
|
|
41
|
+
* const history = await service.fetchPriceHistory({
|
|
42
|
+
* tokenName: 'demonkpop',
|
|
43
|
+
* from: new Date('2024-01-01'),
|
|
44
|
+
* to: new Date('2024-01-31')
|
|
45
|
+
* });
|
|
34
46
|
* ```
|
|
35
47
|
*/
|
|
36
48
|
export declare class PriceHistoryService {
|
|
37
49
|
private readonly logger;
|
|
38
50
|
private readonly httpClient;
|
|
51
|
+
private readonly tokenResolverService;
|
|
39
52
|
/**
|
|
40
53
|
* Create a new PriceHistoryService instance
|
|
41
54
|
* @param httpClient HTTP client for DEX Backend API
|
|
42
55
|
* @param debugMode Enable debug logging
|
|
56
|
+
* @param tokenResolverService Optional TokenResolverService for token name resolution
|
|
57
|
+
*/
|
|
58
|
+
constructor(httpClient?: HttpClient, debugMode?: boolean, tokenResolverService?: TokenResolverService);
|
|
59
|
+
/**
|
|
60
|
+
* Helper method: Resolve a token name to its full token class key
|
|
61
|
+
*
|
|
62
|
+
* Uses TokenResolverService to resolve a token name to vault address, then extracts
|
|
63
|
+
* the complete token class key in pipe-delimited format for use with DEX Backend API.
|
|
64
|
+
*
|
|
65
|
+
* @param tokenName Simple token name (e.g., "demonkpop", "shoewars")
|
|
66
|
+
* @returns Promise<string> Full token class key: "collection|category|type|additionalKey"
|
|
67
|
+
* @throws ConfigurationError if TokenResolverService is not available
|
|
68
|
+
* @throws NetworkError if token resolution fails
|
|
69
|
+
* @throws ValidationError if token name is invalid
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const tokenClassKey = await service.fetchTokenClassKeyByTokenName('demonkpop');
|
|
74
|
+
* // Returns: "Token|Unit|DKP|eth:4A65D29213de2939373ff9eB63AC38730F192C84"
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @since 3.20.0
|
|
43
78
|
*/
|
|
44
|
-
|
|
79
|
+
fetchTokenClassKeyByTokenName(tokenName: string): Promise<string>;
|
|
45
80
|
/**
|
|
46
|
-
* Fetch price history for a token with pagination
|
|
81
|
+
* Fetch price history for a token with pagination (v3.20.0+)
|
|
47
82
|
*
|
|
48
|
-
* Fetches historical price snapshots from DEX Backend API.
|
|
83
|
+
* Fetches historical price snapshots from DEX Backend API with flexible token identification.
|
|
49
84
|
* Returns paginated results matching SDK conventions.
|
|
50
85
|
*
|
|
51
|
-
*
|
|
86
|
+
* Supports three token identification methods (choose exactly ONE):
|
|
87
|
+
* 1. tokenName: Simple token name (e.g., "demonkpop") - auto-resolves to full tokenId
|
|
88
|
+
* 2. tokenId string: Pipe-delimited format (e.g., "Token|Unit|USDC|eth:123...")
|
|
89
|
+
* 3. tokenId object: Explicit TokenClassKey object with collection, category, type, additionalKey
|
|
90
|
+
*
|
|
91
|
+
* @param options Fetch options including token ID (name or full), date range, and pagination
|
|
52
92
|
* @returns Promise<PriceHistoryResult> Price snapshots with pagination metadata
|
|
53
93
|
* @throws NetworkError if API request fails
|
|
54
|
-
* @throws ValidationError if parameters are invalid
|
|
94
|
+
* @throws ValidationError if parameters are invalid or both tokenName and tokenId are provided
|
|
55
95
|
*
|
|
56
96
|
* @example
|
|
57
97
|
* ```typescript
|
|
58
|
-
* // Using
|
|
98
|
+
* // NEW (v3.20.0+): Using simple token name (recommended for convenience)
|
|
99
|
+
* const result = await service.fetchPriceHistory({
|
|
100
|
+
* tokenName: 'demonkpop', // Simple, intuitive token name
|
|
101
|
+
* from: new Date('2024-01-01'),
|
|
102
|
+
* to: new Date('2024-01-31'),
|
|
103
|
+
* page: 1,
|
|
104
|
+
* limit: 20
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* // Using tokenId object format (explicit, no lookup required)
|
|
59
108
|
* const result = await service.fetchPriceHistory({
|
|
60
109
|
* tokenId: {
|
|
61
110
|
* collection: 'Token',
|
|
@@ -69,13 +118,24 @@ export declare class PriceHistoryService {
|
|
|
69
118
|
* limit: 20
|
|
70
119
|
* });
|
|
71
120
|
*
|
|
72
|
-
* // Using string format
|
|
121
|
+
* // Using tokenId string format (backward compatible)
|
|
73
122
|
* const result = await service.fetchPriceHistory({
|
|
74
123
|
* tokenId: 'Token|Unit|USDC|eth:123...',
|
|
75
124
|
* page: 1,
|
|
76
125
|
* limit: 20
|
|
77
126
|
* });
|
|
127
|
+
*
|
|
128
|
+
* // Analyzing volatility with date filtering
|
|
129
|
+
* const thirtyDays = await service.fetchPriceHistory({
|
|
130
|
+
* tokenName: 'demonkpop',
|
|
131
|
+
* from: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000),
|
|
132
|
+
* to: new Date(),
|
|
133
|
+
* sortOrder: 'ASC',
|
|
134
|
+
* limit: 50
|
|
135
|
+
* });
|
|
78
136
|
* ```
|
|
137
|
+
*
|
|
138
|
+
* @since 3.20.0 - Added tokenName parameter support with auto-resolution
|
|
79
139
|
*/
|
|
80
140
|
fetchPriceHistory(options: FetchPriceHistoryOptions): Promise<PriceHistoryResult>;
|
|
81
141
|
/**
|
|
@@ -84,33 +144,62 @@ export declare class PriceHistoryService {
|
|
|
84
144
|
*/
|
|
85
145
|
private transformApiResponseToPriceHistory;
|
|
86
146
|
/**
|
|
87
|
-
* Fetch all price history for a token with automatic pagination
|
|
147
|
+
* Fetch all price history for a token with automatic pagination (v3.20.0+)
|
|
88
148
|
*
|
|
89
149
|
* Convenience method that automatically iterates through all pages from DEX Backend API and combines results.
|
|
90
|
-
* Returns all available price snapshots matching the filter criteria.
|
|
150
|
+
* Returns all available price snapshots matching the filter criteria in a single response.
|
|
151
|
+
* No pagination parameters needed - this method handles it internally.
|
|
91
152
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
153
|
+
* Supports three token identification methods (choose exactly ONE):
|
|
154
|
+
* 1. tokenName: Simple token name (e.g., "demonkpop") - auto-resolves to full tokenId
|
|
155
|
+
* 2. tokenId string: Pipe-delimited format (e.g., "Token|Unit|USDC|eth:123...")
|
|
156
|
+
* 3. tokenId object: Explicit TokenClassKey object with collection, category, type, additionalKey
|
|
157
|
+
*
|
|
158
|
+
* @param options Fetch options including token ID (name or full), date range, and sort order
|
|
159
|
+
* @returns Promise<PriceHistoryResult> All price snapshots with combined total count
|
|
160
|
+
* @throws NetworkError if API request fails or exceeds maximum pages
|
|
161
|
+
* @throws ValidationError if parameters are invalid or both tokenName and tokenId are provided
|
|
96
162
|
*
|
|
97
163
|
* @example
|
|
98
164
|
* ```typescript
|
|
99
|
-
* //
|
|
165
|
+
* // NEW (v3.20.0+): Using simple token name with auto-pagination (recommended)
|
|
100
166
|
* const result = await service.fetchAllPriceHistory({
|
|
101
|
-
*
|
|
167
|
+
* tokenName: 'demonkpop', // Simple token name - auto-resolves
|
|
102
168
|
* from: new Date('2024-01-01'),
|
|
103
|
-
* to: new Date('2024-
|
|
169
|
+
* to: new Date('2024-12-31'),
|
|
104
170
|
* sortOrder: 'ASC'
|
|
105
171
|
* });
|
|
106
172
|
*
|
|
107
173
|
* console.log(`Total snapshots: ${result.total}`);
|
|
108
174
|
* console.log(`Snapshots returned: ${result.snapshots.length}`);
|
|
175
|
+
*
|
|
176
|
+
* // Using tokenId string format (backward compatible, no auto-resolution)
|
|
177
|
+
* const result = await service.fetchAllPriceHistory({
|
|
178
|
+
* tokenId: 'Token|Unit|USDC|eth:123...',
|
|
179
|
+
* from: new Date('2024-01-01'),
|
|
180
|
+
* to: new Date('2024-01-31'),
|
|
181
|
+
* sortOrder: 'DESC'
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* // Volatility analysis over full year (100+ snapshots with auto-pagination)
|
|
185
|
+
* const yearData = await service.fetchAllPriceHistory({
|
|
186
|
+
* tokenName: 'demonkpop',
|
|
187
|
+
* from: new Date('2023-01-01'),
|
|
188
|
+
* to: new Date('2023-12-31'),
|
|
189
|
+
* sortOrder: 'ASC'
|
|
190
|
+
* });
|
|
191
|
+
*
|
|
192
|
+
* const prices = yearData.snapshots.map(s => parseFloat(s.price));
|
|
193
|
+
* const avgPrice = prices.reduce((a, b) => a + b) / prices.length;
|
|
194
|
+
* console.log(`Average price over year: $${avgPrice.toFixed(8)}`);
|
|
109
195
|
* ```
|
|
196
|
+
*
|
|
197
|
+
* @since 3.20.0 - Added tokenName parameter support with auto-resolution
|
|
110
198
|
*/
|
|
111
199
|
fetchAllPriceHistory(options: Omit<FetchPriceHistoryOptions, 'page' | 'limit'>): Promise<PriceHistoryResult>;
|
|
112
200
|
/**
|
|
113
201
|
* Validate fetch options
|
|
202
|
+
* Ensures exactly one of tokenName or tokenId is provided (mutual exclusivity)
|
|
114
203
|
* @private
|
|
115
204
|
*/
|
|
116
205
|
private validateOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceHistoryService.d.ts","sourceRoot":"","sources":["../../src/services/PriceHistoryService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAGnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"PriceHistoryService.d.ts","sourceRoot":"","sources":["../../src/services/PriceHistoryService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAGnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAmC;IAExE;;;;;OAKG;gBACS,UAAU,CAAC,EAAE,UAAU,EAAE,SAAS,GAAE,OAAe,EAAE,oBAAoB,CAAC,EAAE,oBAAoB;IAM5G;;;;;;;;;;;;;;;;;;;OAmBG;IACG,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4EvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2DG;IACG,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAmFvF;;;OAGG;IACH,OAAO,CAAC,kCAAkC;IA+B1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACG,oBAAoB,CACxB,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,MAAM,GAAG,OAAO,CAAC,GACxD,OAAO,CAAC,kBAAkB,CAAC;IA8C9B;;;;OAIG;IACH,OAAO,CAAC,eAAe;CA+CxB"}
|
|
@@ -15,16 +15,23 @@ export type PriceSortOrder = 'ASC' | 'DESC';
|
|
|
15
15
|
/**
|
|
16
16
|
* Options for fetching price history
|
|
17
17
|
*
|
|
18
|
-
* Supports flexible token identification via
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
* - TokenInstanceKey object: { collection, category, type, additionalKey, instance }
|
|
18
|
+
* Supports flexible token identification via either:
|
|
19
|
+
* - `tokenName`: Simple launchpad token name (e.g., "demonkpop", "shoewars")
|
|
20
|
+
* - `tokenId`: Full token class key in format "collection|category|type|additionalKey"
|
|
22
21
|
*
|
|
23
|
-
*
|
|
22
|
+
* Exactly one of `tokenName` or `tokenId` must be provided (mutually exclusive).
|
|
23
|
+
*
|
|
24
|
+
* When `tokenName` is provided, the SDK automatically resolves it to the full tokenId
|
|
25
|
+
* by calling fetchPoolDetails() internally.
|
|
26
|
+
*
|
|
27
|
+
* @since 3.13.0 (tokenId parameter)
|
|
28
|
+
* @since 3.20.0 (tokenName parameter added)
|
|
24
29
|
*/
|
|
25
30
|
export interface FetchPriceHistoryOptions {
|
|
31
|
+
/** Simple token name for convenience (e.g., "demonkpop") - automatically resolves to full tokenId */
|
|
32
|
+
tokenName?: string;
|
|
26
33
|
/** Flexible token identifier - accepts string, TokenClassKey, or TokenInstanceKey */
|
|
27
|
-
tokenId
|
|
34
|
+
tokenId?: import('./common').TokenId;
|
|
28
35
|
/** Start date for filtering price snapshots (optional, defaults to 30 days ago) */
|
|
29
36
|
from?: Date;
|
|
30
37
|
/** End date for filtering price snapshots (optional, defaults to now) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceHistory.dto.d.ts","sourceRoot":"","sources":["../../src/types/priceHistory.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"priceHistory.dto.d.ts","sourceRoot":"","sources":["../../src/types/priceHistory.dto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,wBAAwB;IACvC,qGAAqG;IACrG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,UAAU,EAAE,OAAO,CAAC;IACrC,mFAAmF;IACnF,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,yEAAyE;IACzE,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,8DAA8D;IAC9D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,SAAS,EAAE,IAAI,CAAC;IAChB,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,8CAA8C;IAC9C,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,IAAI,EAAE;QACJ,+BAA+B;QAC/B,IAAI,EAAE,KAAK,CAAC;YACV,gDAAgD;YAChD,EAAE,EAAE,MAAM,CAAC;YACX,kCAAkC;YAClC,UAAU,EAAE,MAAM,CAAC;YACnB,gCAAgC;YAChC,QAAQ,EAAE,MAAM,CAAC;YACjB,4BAA4B;YAC5B,IAAI,EAAE,MAAM,CAAC;YACb,8CAA8C;YAC9C,aAAa,EAAE,MAAM,CAAC;YACtB,0CAA0C;YAC1C,KAAK,EAAE,MAAM,CAAC;YACd,6CAA6C;YAC7C,SAAS,EAAE,MAAM,CAAC;YAClB,2CAA2C;YAC3C,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC,CAAC;QACH,0BAA0B;QAC1B,IAAI,EAAE;YACJ,gDAAgD;YAChD,UAAU,EAAE,MAAM,CAAC;YACnB,oCAAoC;YACpC,WAAW,EAAE,MAAM,CAAC;YACpB,+BAA+B;YAC/B,QAAQ,EAAE,MAAM,CAAC;YACjB,sCAAsC;YACtC,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gala-chain/launchpad-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.0",
|
|
4
4
|
"description": "TypeScript SDK for Gala Launchpad Backend API - Production-ready DeFi token launchpad integration with wallet-based authentication, GalaChain trading, and comprehensive user operations. 100% tested (22/22 endpoints working).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|