@gala-chain/launchpad-sdk 3.15.2 → 3.15.4
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 +45 -0
- package/README.md +69 -7
- 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/PriceHistoryService.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.15.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- docs: comprehensive documentation updates for price history methods
|
|
8
|
+
|
|
9
|
+
### SDK Documentation Updates
|
|
10
|
+
- Added complete documentation for all 4 price history methods in README.md
|
|
11
|
+
- fetchPriceHistory (paginated)
|
|
12
|
+
- fetchAllPriceHistory (auto-paginated)
|
|
13
|
+
- fetchPrices (paginated latest prices)
|
|
14
|
+
- fetchAllPrices (auto-paginated latest prices)
|
|
15
|
+
- Added comprehensive examples showing usage patterns, configuration, and workflows
|
|
16
|
+
- Updated MySQL configuration section with code examples for all 4 methods
|
|
17
|
+
- Added price history patterns documentation to CLAUDE.md
|
|
18
|
+
- Added latest token price queries section to CLAUDE.md with detailed examples
|
|
19
|
+
- Created comprehensive fetch-all-price-history-demo.ts example script
|
|
20
|
+
- Demonstrates statistical analysis, trend calculation, moving averages
|
|
21
|
+
- Shows CSV export, time period comparison, and multi-token analysis
|
|
22
|
+
- Includes volatility calculation and price statistics
|
|
23
|
+
|
|
24
|
+
### MCP Server Documentation Updates
|
|
25
|
+
- Updated tool count from 52 to 55 in README (includes 4 price history tools)
|
|
26
|
+
- Added "Price History & Analysis" section documenting 4 price history tools
|
|
27
|
+
- Updated MCP installation version references (1.12.3, SDK 3.15.3)
|
|
28
|
+
- Added complete price history tool descriptions with use cases and examples
|
|
29
|
+
|
|
30
|
+
### Agent Documentation Updates
|
|
31
|
+
- Updated @agent-galachain-launchpad-developer.md
|
|
32
|
+
- Updated SDK method count: 46 → 50 (includes price history)
|
|
33
|
+
- Updated MCP tool count: 51 → 55 (includes 4 price history tools)
|
|
34
|
+
- Updated version references: v3.11.0+ → v3.15.3+
|
|
35
|
+
- Added "Price History & Analysis" section to Complete Method Reference
|
|
36
|
+
- Updated service architecture to include PriceHistoryService
|
|
37
|
+
- Updated support section with latest version information
|
|
38
|
+
|
|
39
|
+
## 3.15.3
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Fix: Initialize connection pool in fetchPrices method
|
|
44
|
+
|
|
45
|
+
fetchPrices was using this.pool! without calling ensureConnection first, causing a "Cannot read
|
|
46
|
+
properties of null" error. Now properly initializes the connection pool before querying.
|
|
47
|
+
|
|
3
48
|
## 3.15.2
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -793,6 +793,30 @@ calculateSellAmountExternal(options): Promise<AmountCalculationResult>
|
|
|
793
793
|
// Explicit external calculation wrapper (same as calculateSellAmount)
|
|
794
794
|
|
|
795
795
|
// Note: Pass `calculateAmountMode: 'local' | 'external'` to override SDK default mode
|
|
796
|
+
|
|
797
|
+
// Price History Operations (MySQL-based, Node.js only)
|
|
798
|
+
fetchPriceHistory(options): Promise<PriceHistoryResult>
|
|
799
|
+
// Options: { tokenId, from?, to?, sortOrder?, page?, limit? }
|
|
800
|
+
// Returns: { snapshots, page, limit, total, totalPages, hasNext, hasPrevious }
|
|
801
|
+
// Fetches paginated historical price snapshots from MySQL database
|
|
802
|
+
|
|
803
|
+
fetchAllPriceHistory(options): Promise<PriceHistoryResult>
|
|
804
|
+
// Options: { tokenId, from?, to?, sortOrder? } (no pagination params)
|
|
805
|
+
// Returns: All matching snapshots with total count
|
|
806
|
+
// Convenience method with automatic pagination (returns ALL snapshots)
|
|
807
|
+
|
|
808
|
+
fetchPrices(options?): Promise<PricesResult>
|
|
809
|
+
// Options: { page?, limit?, sortByType? }
|
|
810
|
+
// Returns: { snapshots, page, limit, total, totalPages, hasNext, hasPrevious }
|
|
811
|
+
// Fetches latest price for each unique token (paginated)
|
|
812
|
+
|
|
813
|
+
fetchAllPrices(): Promise<PricesResult>
|
|
814
|
+
// No parameters
|
|
815
|
+
// Returns: All latest prices combined in single result
|
|
816
|
+
// Convenience method with automatic pagination (returns ALL latest prices)
|
|
817
|
+
|
|
818
|
+
// Note: Price history methods require MySQL connection string in SDK config
|
|
819
|
+
// See MySQL Configuration section below for setup details
|
|
796
820
|
```
|
|
797
821
|
|
|
798
822
|
## Performance Optimization
|
|
@@ -1353,7 +1377,7 @@ interface LaunchpadSDKConfig {
|
|
|
1353
1377
|
|
|
1354
1378
|
### MySQL Configuration (Price History)
|
|
1355
1379
|
|
|
1356
|
-
To use the
|
|
1380
|
+
To use the price history methods, you need to configure a MySQL connection string:
|
|
1357
1381
|
|
|
1358
1382
|
```typescript
|
|
1359
1383
|
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
@@ -1366,22 +1390,60 @@ const sdk = createLaunchpadSDK({
|
|
|
1366
1390
|
}
|
|
1367
1391
|
});
|
|
1368
1392
|
|
|
1369
|
-
//
|
|
1393
|
+
// 1. Fetch historical price snapshots (paginated)
|
|
1370
1394
|
const priceHistory = await sdk.fetchPriceHistory({
|
|
1371
|
-
|
|
1395
|
+
tokenId: 'Token|Unit|GUSDC|eth:9401b171307bE656f00F9e18DF756643FD3a91dE', // String format
|
|
1396
|
+
from: new Date('2024-01-01'),
|
|
1397
|
+
to: new Date('2024-01-31'),
|
|
1398
|
+
sortOrder: 'DESC',
|
|
1399
|
+
page: 1,
|
|
1400
|
+
limit: 20
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
console.log(`Found ${priceHistory.snapshots.length} snapshots`);
|
|
1404
|
+
console.log(`Total: ${priceHistory.total}, Page ${priceHistory.page} of ${priceHistory.totalPages}`);
|
|
1405
|
+
|
|
1406
|
+
// 2. Fetch ALL historical price snapshots (auto-paginated)
|
|
1407
|
+
const allHistory = await sdk.fetchAllPriceHistory({
|
|
1408
|
+
tokenId: { // Object format also supported
|
|
1372
1409
|
collection: 'Token',
|
|
1373
1410
|
category: 'Unit',
|
|
1374
1411
|
type: 'GUSDC',
|
|
1375
1412
|
additionalKey: 'eth:9401b171307bE656f00F9e18DF756643FD3a91dE'
|
|
1376
1413
|
},
|
|
1377
1414
|
from: new Date('2024-01-01'),
|
|
1378
|
-
to: new Date('2024-01-31')
|
|
1415
|
+
to: new Date('2024-01-31')
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
console.log(`Total snapshots: ${allHistory.total}`);
|
|
1419
|
+
|
|
1420
|
+
// 3. Fetch latest prices for all tokens (paginated)
|
|
1421
|
+
const latestPrices = await sdk.fetchPrices({
|
|
1379
1422
|
page: 1,
|
|
1380
|
-
limit: 20
|
|
1423
|
+
limit: 20,
|
|
1424
|
+
sortByType: 'ASC' // Optional: sort alphabetically by token type
|
|
1381
1425
|
});
|
|
1382
1426
|
|
|
1383
|
-
console.log(`Found ${
|
|
1384
|
-
|
|
1427
|
+
console.log(`Found ${latestPrices.snapshots.length} tokens with prices`);
|
|
1428
|
+
|
|
1429
|
+
// 4. Fetch all latest prices (auto-paginated)
|
|
1430
|
+
const allLatestPrices = await sdk.fetchAllPrices();
|
|
1431
|
+
|
|
1432
|
+
console.log(`Total tokens with prices: ${allLatestPrices.total}`);
|
|
1433
|
+
```
|
|
1434
|
+
|
|
1435
|
+
**Token Identification Formats:**
|
|
1436
|
+
```typescript
|
|
1437
|
+
// String format (pipe-delimited) - simpler
|
|
1438
|
+
tokenId: 'Token|Unit|GUSDC|eth:9401b171307bE656f00F9e18DF756643FD3a91dE'
|
|
1439
|
+
|
|
1440
|
+
// Object format (explicit) - for clarity
|
|
1441
|
+
tokenId: {
|
|
1442
|
+
collection: 'Token',
|
|
1443
|
+
category: 'Unit',
|
|
1444
|
+
type: 'GUSDC',
|
|
1445
|
+
additionalKey: 'eth:9401b171307bE656f00F9e18DF756643FD3a91dE'
|
|
1446
|
+
}
|
|
1385
1447
|
```
|
|
1386
1448
|
|
|
1387
1449
|
**Environment Configuration:**
|