@gala-chain/launchpad-sdk 4.0.4-beta.0 → 4.0.5
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/EXAMPLES.md +96 -35
- package/README.md +2 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/LaunchpadSDK.d.ts +750 -72
- package/dist/src/LaunchpadSDK.d.ts.map +1 -1
- package/dist/src/constants/version.generated.d.ts +1 -1
- package/dist/src/constants/version.generated.d.ts.map +1 -1
- package/dist/src/services/DexBackendClient.d.ts +139 -10
- package/dist/src/services/DexBackendClient.d.ts.map +1 -1
- package/dist/src/services/DexQuoteService.d.ts +181 -22
- package/dist/src/services/DexQuoteService.d.ts.map +1 -1
- package/dist/src/services/DexService.d.ts +274 -38
- package/dist/src/services/DexService.d.ts.map +1 -1
- package/dist/src/services/GSwapService.d.ts +555 -246
- package/dist/src/services/GSwapService.d.ts.map +1 -1
- package/dist/src/services/GalaChainGatewayClient.d.ts +139 -41
- package/dist/src/services/GalaChainGatewayClient.d.ts.map +1 -1
- package/dist/src/services/ImageService.d.ts +101 -12
- package/dist/src/services/ImageService.d.ts.map +1 -1
- package/dist/src/services/PoolCacheManager.d.ts +125 -31
- package/dist/src/services/PoolCacheManager.d.ts.map +1 -1
- package/dist/src/services/SignatureService.d.ts +35 -5
- package/dist/src/services/SignatureService.d.ts.map +1 -1
- package/dist/src/services/SwapEventQueue.d.ts +79 -10
- package/dist/src/services/SwapEventQueue.d.ts.map +1 -1
- package/dist/src/services/TokenClassKeyService.d.ts +56 -10
- package/dist/src/services/TokenClassKeyService.d.ts.map +1 -1
- package/dist/src/services/TokenMetadataService.d.ts +407 -31
- package/dist/src/services/TokenMetadataService.d.ts.map +1 -1
- package/dist/src/services/TradeService.d.ts +168 -6
- package/dist/src/services/TradeService.d.ts.map +1 -1
- package/dist/src/services/UserService.d.ts +117 -15
- package/dist/src/services/UserService.d.ts.map +1 -1
- package/package.json +12 -2
- package/API.md +0 -1475
|
@@ -38,23 +38,48 @@ export declare class DexService {
|
|
|
38
38
|
* Fetch USD spot price for DEX tokens with tokenId
|
|
39
39
|
*
|
|
40
40
|
* Smart router that accepts either tokenName or tokenId (mutually exclusive).
|
|
41
|
-
* LaunchpadSDK handles
|
|
42
|
-
* -
|
|
43
|
-
* -
|
|
41
|
+
* LaunchpadSDK handles routing logic automatically:
|
|
42
|
+
* - tokenName: Routes to bonding curve calculation (launchpad tokens)
|
|
43
|
+
* - tokenId: Routes to DEX Backend API (graduated/DEX tokens)
|
|
44
|
+
*
|
|
45
|
+
* **Price Source:**
|
|
46
|
+
* - DEX Backend API `/v1/trade/price` endpoint
|
|
47
|
+
* - Real-time spot prices from active DEX trading
|
|
48
|
+
* - USD-denominated pricing (via GALA/USD base pair)
|
|
49
|
+
*
|
|
50
|
+
* **Token Format Support:**
|
|
51
|
+
* - Pipe-delimited: `Token|Unit|GDOG|eth:0x...`
|
|
52
|
+
* - Object format: `{ collection: 'Token', category: 'Unit', type: 'GDOG', additionalKey: 'eth:0x...' }`
|
|
53
|
+
* - Auto-converts to dollar-delimited for API: `Token$Unit$GDOG$eth:0x...`
|
|
44
54
|
*
|
|
45
55
|
* @param params Options with either tokenName or tokenId (mutually exclusive)
|
|
46
56
|
* @returns Promise<TokenSpotPrice> Token symbol and USD price
|
|
57
|
+
* @throws ValidationError if neither tokenName nor tokenId provided
|
|
58
|
+
* @throws ValidationError if both tokenName and tokenId provided
|
|
59
|
+
* @throws NetworkError if API request fails
|
|
60
|
+
* @category Spot Price
|
|
61
|
+
* @since 3.0.0
|
|
47
62
|
*
|
|
48
|
-
* @example
|
|
63
|
+
* @example DEX token pricing (tokenId)
|
|
49
64
|
* ```typescript
|
|
50
|
-
* const price = await
|
|
51
|
-
* tokenId: 'Token|Unit|GDOG|eth
|
|
65
|
+
* const price = await dexService.fetchTokenPrice({
|
|
66
|
+
* tokenId: 'Token|Unit|GDOG|eth:0x...'
|
|
52
67
|
* });
|
|
68
|
+
* console.log(`${price.symbol}: $${price.price}`);
|
|
69
|
+
* // Output: GDOG: $0.00123
|
|
53
70
|
* ```
|
|
54
71
|
*
|
|
55
|
-
* @
|
|
56
|
-
*
|
|
57
|
-
*
|
|
72
|
+
* @example Object format tokenId
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const price = await dexService.fetchTokenPrice({
|
|
75
|
+
* tokenId: {
|
|
76
|
+
* collection: 'Token',
|
|
77
|
+
* category: 'Unit',
|
|
78
|
+
* type: 'BENE',
|
|
79
|
+
* additionalKey: 'client:123'
|
|
80
|
+
* }
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
58
83
|
*
|
|
59
84
|
* @internal
|
|
60
85
|
*/
|
|
@@ -62,22 +87,64 @@ export declare class DexService {
|
|
|
62
87
|
/**
|
|
63
88
|
* Internal method: Fetch spot price from DEX Backend API
|
|
64
89
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
90
|
+
* Queries the DEX Backend API for real-time spot prices of tokens actively
|
|
91
|
+
* trading on GalaSwap. Includes intelligent caching for token symbols to reduce
|
|
92
|
+
* API calls by 50% on repeated queries.
|
|
93
|
+
*
|
|
94
|
+
* **Price Calculation:**
|
|
95
|
+
* - Fetches token/GALA pair price from DEX
|
|
96
|
+
* - Converts to USD using GALA/USD base rate
|
|
97
|
+
* - Returns final USD-denominated price
|
|
98
|
+
*
|
|
99
|
+
* **Symbol Resolution:**
|
|
100
|
+
* 1. Check TokenMetadataCache (if available) - instant
|
|
101
|
+
* 2. Fetch from GalaChain token registry - authoritative
|
|
102
|
+
* 3. Fallback to token format parsing - best effort
|
|
103
|
+
*
|
|
104
|
+
* **Caching Strategy:**
|
|
105
|
+
* - Cache hit: Symbol returned instantly (no API call)
|
|
106
|
+
* - Cache miss: Fetch from GalaChain, cache for future queries
|
|
107
|
+
* - 50% reduction in API calls for repeated token queries
|
|
67
108
|
*
|
|
68
109
|
* @internal
|
|
69
110
|
* @param tokenId Token ID in pipe-delimited or object format
|
|
70
111
|
* @returns Promise<TokenSpotPrice> Spot price with symbol and USD price
|
|
71
|
-
* @throws
|
|
72
|
-
* @throws
|
|
112
|
+
* @throws NetworkError if token not found on DEX
|
|
113
|
+
* @throws NetworkError if API request fails
|
|
114
|
+
* @category Spot Price
|
|
115
|
+
* @since 3.0.0
|
|
73
116
|
*/
|
|
74
117
|
private _fetchDexTokenSpotPrice;
|
|
75
118
|
/**
|
|
76
|
-
* Calculate spot price for a launchpad token using bonding curve
|
|
119
|
+
* Calculate spot price for a launchpad token using bonding curve mathematics
|
|
120
|
+
*
|
|
121
|
+
* Computes USD spot price for active bonding curve tokens by:
|
|
122
|
+
* 1. Calculating tokens received for 1 GALA (bonding curve)
|
|
123
|
+
* 2. Fetching GALA/USD spot price (DEX)
|
|
124
|
+
* 3. Computing token/USD price (GALA price ÷ tokens per GALA)
|
|
125
|
+
*
|
|
126
|
+
* **Graduation Detection:**
|
|
127
|
+
* - If token is graduated (saleStatus = 'Finished'), routes to DEX spot price
|
|
128
|
+
* - If token is active bonding curve, uses calculation above
|
|
129
|
+
* - Automatic routing ensures correct price source
|
|
130
|
+
*
|
|
131
|
+
* **Bonding Curve Pricing:**
|
|
132
|
+
* Uses exponential bonding curve: price = e^(k × supply)
|
|
133
|
+
* - Current supply determines current price point on curve
|
|
134
|
+
* - Higher supply = higher price (built-in scarcity)
|
|
135
|
+
* - 1 GALA buys fewer tokens as supply grows
|
|
77
136
|
*
|
|
78
137
|
* @deprecated Use LaunchpadSDK.fetchTokenPrice({tokenName}) instead. Will be removed in v4.0.0
|
|
79
138
|
* This method is kept for backward compatibility with existing code that calls it directly.
|
|
80
139
|
*
|
|
140
|
+
* @param tokenName Launchpad token name (e.g., 'anime', 'demonkpop')
|
|
141
|
+
* @param calculateBuyAmount Callback to calculate buy amount via bonding curve
|
|
142
|
+
* @param fetchPoolDetails Optional callback to check graduation status
|
|
143
|
+
* @returns Promise<TokenSpotPrice> Token symbol and USD spot price
|
|
144
|
+
* @throws NetworkError if calculation fails
|
|
145
|
+
* @throws ValidationError if token name is invalid
|
|
146
|
+
* @category Spot Price
|
|
147
|
+
* @since 2.0.0
|
|
81
148
|
* @internal
|
|
82
149
|
*/
|
|
83
150
|
fetchLaunchpadTokenSpotPrice(tokenName: string, calculateBuyAmount: (options: CalculateBuyAmountOptions) => Promise<AmountCalculationResult>, fetchPoolDetails?: (tokenName: string) => Promise<any>): Promise<TokenSpotPrice>;
|
|
@@ -126,14 +193,47 @@ export declare class DexService {
|
|
|
126
193
|
/**
|
|
127
194
|
* Fetch all available DEX leaderboard seasons
|
|
128
195
|
*
|
|
129
|
-
* Retrieves
|
|
130
|
-
*
|
|
196
|
+
* Retrieves complete list of competitive trading seasons with their time ranges
|
|
197
|
+
* and rule configurations. Use season IDs with `fetchDexLeaderboardBySeasonId()`
|
|
198
|
+
* to query rankings.
|
|
131
199
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
200
|
+
* **Season Structure:**
|
|
201
|
+
* - id: Unique season identifier (used for queries)
|
|
202
|
+
* - name: Display name (e.g., "Season 1", "Winter 2025")
|
|
203
|
+
* - start: Season start date (Date object)
|
|
204
|
+
* - end: Season end date (Date object)
|
|
205
|
+
* - rulesId: Rule set identifier (scoring multipliers, XP rates)
|
|
134
206
|
*
|
|
207
|
+
* **Response Handling:**
|
|
208
|
+
* Supports multiple API response formats:
|
|
209
|
+
* - Direct array: `[...seasons...]`
|
|
210
|
+
* - Wrapped: `{ data: [...seasons...] }`
|
|
211
|
+
* - Nested: `{ data: { seasons: [...] } }`
|
|
212
|
+
*
|
|
213
|
+
* @returns Promise<DexSeason[]> Array of all seasons with time ranges
|
|
214
|
+
* @throws NetworkError If API request fails
|
|
135
215
|
* @category DEX Leaderboard
|
|
136
|
-
* @since 3.
|
|
216
|
+
* @since 3.23.0
|
|
217
|
+
*
|
|
218
|
+
* @example List all seasons
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const seasons = await dexService.fetchAllDexSeasons();
|
|
221
|
+
* seasons.forEach(season => {
|
|
222
|
+
* console.log(`${season.name}: ${season.start.toISOString()} - ${season.end.toISOString()}`);
|
|
223
|
+
* });
|
|
224
|
+
* // Output:
|
|
225
|
+
* // Season 1: 2025-01-01T00:00:00Z - 2025-03-31T23:59:59Z
|
|
226
|
+
* // Season 2: 2025-04-01T00:00:00Z - 2025-06-30T23:59:59Z
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* @example Find specific season by name
|
|
230
|
+
* ```typescript
|
|
231
|
+
* const seasons = await dexService.fetchAllDexSeasons();
|
|
232
|
+
* const winterSeason = seasons.find(s => s.name.includes('Winter'));
|
|
233
|
+
* if (winterSeason) {
|
|
234
|
+
* const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(winterSeason.id);
|
|
235
|
+
* }
|
|
236
|
+
* ```
|
|
137
237
|
*
|
|
138
238
|
* @internal
|
|
139
239
|
*/
|
|
@@ -141,14 +241,36 @@ export declare class DexService {
|
|
|
141
241
|
/**
|
|
142
242
|
* Find the currently active DEX leaderboard season
|
|
143
243
|
*
|
|
144
|
-
* Determines which season is active by comparing current time with season start/end.
|
|
145
|
-
* Returns null if no season is currently active (between seasons).
|
|
244
|
+
* Determines which season is active by comparing current time with season start/end dates.
|
|
245
|
+
* Returns null if no season is currently active (between seasons or before first season).
|
|
146
246
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
247
|
+
* **Active Season Detection:**
|
|
248
|
+
* - Fetches all seasons via `fetchAllDexSeasons()`
|
|
249
|
+
* - Finds season where: `now >= season.start && now <= season.end`
|
|
250
|
+
* - Returns first matching season (should only be one)
|
|
251
|
+
* - Returns null if no match found
|
|
252
|
+
*
|
|
253
|
+
* **Use Cases:**
|
|
254
|
+
* - Display current leaderboard automatically
|
|
255
|
+
* - Show "No active season" message when null
|
|
256
|
+
* - Redirect users to current competition rankings
|
|
149
257
|
*
|
|
258
|
+
* @returns Promise<DexSeason | null> Current season or null if none active
|
|
259
|
+
* @throws NetworkError If API request fails
|
|
150
260
|
* @category DEX Leaderboard
|
|
151
|
-
* @since 3.
|
|
261
|
+
* @since 3.23.0
|
|
262
|
+
*
|
|
263
|
+
* @example Get current season and leaderboard
|
|
264
|
+
* ```typescript
|
|
265
|
+
* const currentSeason = await dexService.fetchCurrentDexSeason();
|
|
266
|
+
* if (currentSeason) {
|
|
267
|
+
* console.log(`Active season: ${currentSeason.name}`);
|
|
268
|
+
* const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(currentSeason.id);
|
|
269
|
+
* console.log(`Top trader: ${leaderboard.entries[0].wallet} with ${leaderboard.entries[0].totalXp} XP`);
|
|
270
|
+
* } else {
|
|
271
|
+
* console.log('No active season - check back later!');
|
|
272
|
+
* }
|
|
273
|
+
* ```
|
|
152
274
|
*
|
|
153
275
|
* @internal
|
|
154
276
|
*/
|
|
@@ -156,16 +278,64 @@ export declare class DexService {
|
|
|
156
278
|
/**
|
|
157
279
|
* Fetch DEX leaderboard for a specific season
|
|
158
280
|
*
|
|
159
|
-
* Returns complete leaderboard rankings with XP metrics
|
|
160
|
-
* Non-paginated response includes all entries
|
|
281
|
+
* Returns complete leaderboard rankings with XP metrics, achievement titles, and
|
|
282
|
+
* reward distribution percentages. Non-paginated response includes all entries
|
|
283
|
+
* (typically 100-200 participants).
|
|
284
|
+
*
|
|
285
|
+
* **Leaderboard Entry Structure:**
|
|
286
|
+
* - wallet: Participant wallet address (eth|0x...)
|
|
287
|
+
* - rank: Position (1 = top trader, 2 = second, etc.)
|
|
288
|
+
* - totalXp: Cumulative XP earned this season
|
|
289
|
+
* - distributionPercent: Share of prize pool (0-100)
|
|
290
|
+
* - liquidityXp: XP from providing liquidity
|
|
291
|
+
* - tradingXp: XP from trading actions
|
|
292
|
+
* - masteryTitles: Achievement badges (e.g., "Volume Master", "LP Whale")
|
|
293
|
+
*
|
|
294
|
+
* **XP Calculation (Standard Rules):**
|
|
295
|
+
* - Buy token: +10 XP per GALA spent
|
|
296
|
+
* - Sell token: +5 XP per GALA received
|
|
297
|
+
* - DEX swap: +1 XP per $1 USD volume
|
|
298
|
+
* - Add liquidity: +bonus XP based on pool tier and size
|
|
299
|
+
* - Hold liquidity: +passive XP over time
|
|
300
|
+
*
|
|
301
|
+
* **Mastery Titles:**
|
|
302
|
+
* - Type: 'liquidity' (LP achievements) or 'trade' (trading achievements)
|
|
303
|
+
* - Order: Priority for display (lower = more prestigious)
|
|
304
|
+
* - Example titles: "Liquidity Legend", "Volume King", "Diamond Hands"
|
|
161
305
|
*
|
|
162
306
|
* @param seasonId Season identifier number (must be positive integer)
|
|
163
307
|
* @returns Promise<LeaderboardResult> Complete leaderboard with rankings and metrics
|
|
164
|
-
* @throws
|
|
165
|
-
* @throws
|
|
166
|
-
*
|
|
308
|
+
* @throws RequiredFieldError If seasonId is invalid
|
|
309
|
+
* @throws NetworkError If API request fails
|
|
167
310
|
* @category DEX Leaderboard
|
|
168
|
-
* @since 3.
|
|
311
|
+
* @since 3.23.0
|
|
312
|
+
*
|
|
313
|
+
* @example Fetch season 3 leaderboard
|
|
314
|
+
* ```typescript
|
|
315
|
+
* const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(3);
|
|
316
|
+
* console.log(`Season ${leaderboard.seasonId} - ${leaderboard.totalEntries} traders`);
|
|
317
|
+
*
|
|
318
|
+
* // Display top 5
|
|
319
|
+
* leaderboard.entries.slice(0, 5).forEach(entry => {
|
|
320
|
+
* console.log(`#${entry.rank}: ${entry.wallet} - ${entry.totalXp} XP (${entry.distributionPercent}% rewards)`);
|
|
321
|
+
* entry.masteryTitles.forEach(title => console.log(` 🏆 ${title.name}`));
|
|
322
|
+
* });
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* @example Find your rank
|
|
326
|
+
* ```typescript
|
|
327
|
+
* const myWallet = 'eth|0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb';
|
|
328
|
+
* const leaderboard = await dexService.fetchDexLeaderboardBySeasonId(3);
|
|
329
|
+
* const myEntry = leaderboard.entries.find(e => e.wallet === myWallet);
|
|
330
|
+
*
|
|
331
|
+
* if (myEntry) {
|
|
332
|
+
* console.log(`Your rank: #${myEntry.rank}`);
|
|
333
|
+
* console.log(`Your XP: ${myEntry.totalXp} (Trading: ${myEntry.tradingXp}, LP: ${myEntry.liquidityXp})`);
|
|
334
|
+
* console.log(`Reward share: ${myEntry.distributionPercent}%`);
|
|
335
|
+
* } else {
|
|
336
|
+
* console.log('Not ranked this season - start trading!');
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
169
339
|
*
|
|
170
340
|
* @internal
|
|
171
341
|
*/
|
|
@@ -173,14 +343,37 @@ export declare class DexService {
|
|
|
173
343
|
/**
|
|
174
344
|
* Fetch leaderboard for the currently active season
|
|
175
345
|
*
|
|
176
|
-
* Convenience method
|
|
177
|
-
* and fetches its leaderboard. Returns null if no
|
|
346
|
+
* Convenience method combining `fetchCurrentDexSeason()` and `fetchDexLeaderboardBySeasonId()`.
|
|
347
|
+
* Automatically detects the current season and fetches its leaderboard. Returns null if no
|
|
348
|
+
* season is active (between seasons).
|
|
178
349
|
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
350
|
+
* **Use Cases:**
|
|
351
|
+
* - Display current leaderboard without knowing season ID
|
|
352
|
+
* - Homepage "Current Rankings" widget
|
|
353
|
+
* - "Live Competition" page
|
|
354
|
+
*
|
|
355
|
+
* **Workflow:**
|
|
356
|
+
* 1. Fetch all seasons → find active season by date
|
|
357
|
+
* 2. If active season found → fetch its leaderboard
|
|
358
|
+
* 3. If no active season → return null
|
|
181
359
|
*
|
|
360
|
+
* @returns Promise<LeaderboardResult | null> Current leaderboard or null if no active season
|
|
361
|
+
* @throws NetworkError If API request fails
|
|
182
362
|
* @category DEX Leaderboard
|
|
183
|
-
* @since 3.
|
|
363
|
+
* @since 3.23.0
|
|
364
|
+
*
|
|
365
|
+
* @example Display current leaderboard
|
|
366
|
+
* ```typescript
|
|
367
|
+
* const currentLeaderboard = await dexService.fetchCurrentDexLeaderboard();
|
|
368
|
+
* if (currentLeaderboard) {
|
|
369
|
+
* console.log(`Season ${currentLeaderboard.seasonId} Rankings:`);
|
|
370
|
+
* currentLeaderboard.entries.slice(0, 10).forEach(entry => {
|
|
371
|
+
* console.log(`${entry.rank}. ${entry.wallet}: ${entry.totalXp} XP`);
|
|
372
|
+
* });
|
|
373
|
+
* } else {
|
|
374
|
+
* console.log('No active season - next season coming soon!');
|
|
375
|
+
* }
|
|
376
|
+
* ```
|
|
184
377
|
*
|
|
185
378
|
* @internal
|
|
186
379
|
*/
|
|
@@ -188,12 +381,55 @@ export declare class DexService {
|
|
|
188
381
|
/**
|
|
189
382
|
* Fetch DEX aggregated volume summary with trend metrics
|
|
190
383
|
*
|
|
191
|
-
* Returns platform-wide trading volume statistics across all DEX pools
|
|
192
|
-
*
|
|
384
|
+
* Returns platform-wide trading volume statistics across all DEX pools with
|
|
385
|
+
* multi-timeframe comparisons. Shows total USD volume and percentage changes
|
|
386
|
+
* relative to previous periods.
|
|
387
|
+
*
|
|
388
|
+
* **Volume Metrics:**
|
|
389
|
+
* - volume1d: 24-hour trading volume (USD)
|
|
390
|
+
* - volume1dDelta: % change vs previous 24 hours
|
|
391
|
+
* - volume7d: 7-day rolling volume (USD)
|
|
392
|
+
* - volume7dDelta: % change vs previous 7 days
|
|
393
|
+
* - volume30d: 30-day rolling volume (USD)
|
|
394
|
+
* - volume30dDelta: % change vs previous 30 days
|
|
395
|
+
*
|
|
396
|
+
* **Delta Interpretation:**
|
|
397
|
+
* - Positive delta (+10.5): Volume increased by 10.5%
|
|
398
|
+
* - Negative delta (-5.2): Volume decreased by 5.2%
|
|
399
|
+
* - Zero delta (0): No change from previous period
|
|
400
|
+
*
|
|
401
|
+
* **Use Cases:**
|
|
402
|
+
* - Platform health dashboard
|
|
403
|
+
* - Volume trend charts
|
|
404
|
+
* - Market activity indicators
|
|
405
|
+
* - "Trading volume up/down X%" alerts
|
|
193
406
|
*
|
|
194
407
|
* @returns Promise<DexAggregatedVolumeSummary> Volume metrics and deltas
|
|
195
|
-
* @throws
|
|
408
|
+
* @throws NetworkError If API request fails
|
|
409
|
+
* @category Volume Analytics
|
|
196
410
|
* @since 4.0.0
|
|
411
|
+
*
|
|
412
|
+
* @example Display volume summary
|
|
413
|
+
* ```typescript
|
|
414
|
+
* const volumeSummary = await dexService.fetchDexAggregatedVolumeSummary();
|
|
415
|
+
*
|
|
416
|
+
* console.log(`24h Volume: $${volumeSummary.volume1d.toLocaleString()} (${volumeSummary.volume1dDelta > 0 ? '+' : ''}${volumeSummary.volume1dDelta.toFixed(2)}%)`);
|
|
417
|
+
* console.log(`7d Volume: $${volumeSummary.volume7d.toLocaleString()} (${volumeSummary.volume7dDelta > 0 ? '+' : ''}${volumeSummary.volume7dDelta.toFixed(2)}%)`);
|
|
418
|
+
* console.log(`30d Volume: $${volumeSummary.volume30d.toLocaleString()} (${volumeSummary.volume30dDelta > 0 ? '+' : ''}${volumeSummary.volume30dDelta.toFixed(2)}%)`);
|
|
419
|
+
* ```
|
|
420
|
+
*
|
|
421
|
+
* @example Volume trend indicator
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const volumeSummary = await dexService.fetchDexAggregatedVolumeSummary();
|
|
424
|
+
*
|
|
425
|
+
* if (volumeSummary.volume1dDelta > 10) {
|
|
426
|
+
* console.log('🚀 High trading activity - volume up ' + volumeSummary.volume1dDelta.toFixed(1) + '%');
|
|
427
|
+
* } else if (volumeSummary.volume1dDelta < -10) {
|
|
428
|
+
* console.log('📉 Low trading activity - volume down ' + Math.abs(volumeSummary.volume1dDelta).toFixed(1) + '%');
|
|
429
|
+
* } else {
|
|
430
|
+
* console.log('📊 Stable trading activity');
|
|
431
|
+
* }
|
|
432
|
+
* ```
|
|
197
433
|
*/
|
|
198
434
|
fetchDexAggregatedVolumeSummary(): Promise<DexAggregatedVolumeSummary>;
|
|
199
435
|
}
|
|
@@ -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;AAG3C,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,SAAS,EAET,iBAAiB,EACjB,0BAA0B,EAE3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAUjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,UAAU;IAInB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IALpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAGb,cAAc,CAAC,EAAE,UAAU,YAAA,EAC3B,KAAK,CAAC,EAAE,kBAAkB,YAAA,EAC1B,gBAAgB,CAAC,EAAE,gBAAgB,YAAA,EACpD,SAAS,GAAE,OAAe;IAQ5B
|
|
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;AAG3C,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,SAAS,EAET,iBAAiB,EACjB,0BAA0B,EAE3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM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