@gala-chain/launchpad-mcp-server 2.0.1 → 2.0.2-beta.10

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 (185) hide show
  1. package/.eslintrc.json +68 -8
  2. package/CHANGELOG.md +10 -10
  3. package/README.md +24 -22
  4. package/dist/constants/mcpToolNames.d.ts +21 -2
  5. package/dist/constants/mcpToolNames.d.ts.map +1 -1
  6. package/dist/constants/mcpToolNames.js +17 -3
  7. package/dist/constants/mcpToolNames.js.map +1 -1
  8. package/dist/generated/version.d.ts +1 -1
  9. package/dist/generated/version.d.ts.map +1 -1
  10. package/dist/generated/version.js +1 -1
  11. package/dist/generated/version.js.map +1 -1
  12. package/dist/index.js +16 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/prompts/advanced-pools.d.ts.map +1 -1
  15. package/dist/prompts/advanced-pools.js.map +1 -1
  16. package/dist/prompts/dex-leaderboard.d.ts +40 -0
  17. package/dist/prompts/dex-leaderboard.d.ts.map +1 -0
  18. package/dist/prompts/dex-leaderboard.js +239 -0
  19. package/dist/prompts/dex-leaderboard.js.map +1 -0
  20. package/dist/prompts/dex-volume.d.ts +19 -0
  21. package/dist/prompts/dex-volume.d.ts.map +1 -0
  22. package/dist/prompts/dex-volume.js +74 -0
  23. package/dist/prompts/dex-volume.js.map +1 -0
  24. package/dist/prompts/index.d.ts +5 -2
  25. package/dist/prompts/index.d.ts.map +1 -1
  26. package/dist/prompts/index.js +11 -2
  27. package/dist/prompts/index.js.map +1 -1
  28. package/dist/prompts/locks.d.ts +16 -0
  29. package/dist/prompts/locks.d.ts.map +1 -0
  30. package/dist/prompts/locks.js +114 -0
  31. package/dist/prompts/locks.js.map +1 -0
  32. package/dist/prompts/monitoring.js.map +1 -1
  33. package/dist/prompts/pools.js +3 -3
  34. package/dist/prompts/pools.js.map +1 -1
  35. package/dist/schemas/common-schemas.d.ts +18 -16
  36. package/dist/schemas/common-schemas.d.ts.map +1 -1
  37. package/dist/schemas/common-schemas.js +8 -0
  38. package/dist/schemas/common-schemas.js.map +1 -1
  39. package/dist/server.d.ts.map +1 -1
  40. package/dist/server.js +3 -1
  41. package/dist/server.js.map +1 -1
  42. package/dist/tools/balance/index.js.map +1 -1
  43. package/dist/tools/creation/index.d.ts.map +1 -1
  44. package/dist/tools/creation/index.js +11 -8
  45. package/dist/tools/creation/index.js.map +1 -1
  46. package/dist/tools/dex/fetchAllDexPools.d.ts.map +1 -1
  47. package/dist/tools/dex/fetchAllDexPools.js +10 -6
  48. package/dist/tools/dex/fetchAllDexPools.js.map +1 -1
  49. package/dist/tools/dex/fetchDexPools.js.map +1 -1
  50. package/dist/tools/dex/index.d.ts +5 -0
  51. package/dist/tools/dex/index.d.ts.map +1 -1
  52. package/dist/tools/dex/index.js +238 -2
  53. package/dist/tools/dex/index.js.map +1 -1
  54. package/dist/tools/dex/leaderboard.d.ts +38 -0
  55. package/dist/tools/dex/leaderboard.d.ts.map +1 -0
  56. package/dist/tools/dex/leaderboard.js +153 -0
  57. package/dist/tools/dex/leaderboard.js.map +1 -0
  58. package/dist/tools/dex/liquidity-positions.d.ts.map +1 -1
  59. package/dist/tools/dex/liquidity-positions.js +13 -4
  60. package/dist/tools/dex/liquidity-positions.js.map +1 -1
  61. package/dist/tools/dex/volume.d.ts +19 -0
  62. package/dist/tools/dex/volume.d.ts.map +1 -0
  63. package/dist/tools/dex/volume.js +53 -0
  64. package/dist/tools/dex/volume.js.map +1 -0
  65. package/dist/tools/index.d.ts +6 -5
  66. package/dist/tools/index.d.ts.map +1 -1
  67. package/dist/tools/index.js +15 -8
  68. package/dist/tools/index.js.map +1 -1
  69. package/dist/tools/locks/index.d.ts +8 -0
  70. package/dist/tools/locks/index.d.ts.map +1 -0
  71. package/dist/tools/locks/index.js +79 -0
  72. package/dist/tools/locks/index.js.map +1 -0
  73. package/dist/tools/pools/fetchAllPools.d.ts.map +1 -1
  74. package/dist/tools/pools/fetchAllPools.js +8 -12
  75. package/dist/tools/pools/fetchAllPools.js.map +1 -1
  76. package/dist/tools/pools/fetchAllPriceHistory.js +1 -1
  77. package/dist/tools/pools/fetchAllPriceHistory.js.map +1 -1
  78. package/dist/tools/pools/fetchPoolDetails.js.map +1 -1
  79. package/dist/tools/pools/fetchPools.js.map +1 -1
  80. package/dist/tools/pools/fetchPriceHistory.js +1 -1
  81. package/dist/tools/pools/fetchPriceHistory.js.map +1 -1
  82. package/dist/tools/pools/fetchTokenDetails.js +1 -1
  83. package/dist/tools/pools/fetchTokenDetails.js.map +1 -1
  84. package/dist/tools/pools/index.js +1 -1
  85. package/dist/tools/pools/index.js.map +1 -1
  86. package/dist/tools/pools/onDexPoolCreation.d.ts.map +1 -1
  87. package/dist/tools/pools/onDexPoolCreation.js +1 -0
  88. package/dist/tools/pools/onDexPoolCreation.js.map +1 -1
  89. package/dist/tools/pools/onLaunchpadTokenCreation.d.ts.map +1 -1
  90. package/dist/tools/pools/onLaunchpadTokenCreation.js +1 -0
  91. package/dist/tools/pools/onLaunchpadTokenCreation.js.map +1 -1
  92. package/dist/tools/social/index.js.map +1 -1
  93. package/dist/tools/trading/index.js +2 -2
  94. package/dist/tools/trading/index.js.map +1 -1
  95. package/dist/tools/transfers/index.js.map +1 -1
  96. package/dist/tools/utils/cleanup.d.ts +2 -2
  97. package/dist/tools/utils/cleanup.d.ts.map +1 -1
  98. package/dist/tools/utils/cleanup.js +8 -35
  99. package/dist/tools/utils/cleanup.js.map +1 -1
  100. package/dist/tools/utils/clearCache.js.map +1 -1
  101. package/dist/tools/utils/explainSdkUsage.d.ts +10 -0
  102. package/dist/tools/utils/explainSdkUsage.d.ts.map +1 -1
  103. package/dist/tools/utils/explainSdkUsage.js +896 -10
  104. package/dist/tools/utils/explainSdkUsage.js.map +1 -1
  105. package/dist/tools/utils/index.d.ts.map +1 -1
  106. package/dist/tools/utils/index.js +4 -0
  107. package/dist/tools/utils/index.js.map +1 -1
  108. package/dist/tools/utils/retrieveFromFaucet.d.ts +9 -0
  109. package/dist/tools/utils/retrieveFromFaucet.d.ts.map +1 -0
  110. package/dist/tools/utils/retrieveFromFaucet.js +36 -0
  111. package/dist/tools/utils/retrieveFromFaucet.js.map +1 -0
  112. package/dist/types/mcp.d.ts +2 -2
  113. package/dist/types/mcp.d.ts.map +1 -1
  114. package/dist/utils/default-values.d.ts.map +1 -1
  115. package/dist/utils/default-values.js +3 -0
  116. package/dist/utils/default-values.js.map +1 -1
  117. package/dist/utils/response-formatter.d.ts.map +1 -1
  118. package/dist/utils/response-formatter.js +1 -0
  119. package/dist/utils/response-formatter.js.map +1 -1
  120. package/dist/utils/tool-factory.d.ts.map +1 -1
  121. package/dist/utils/tool-factory.js +1 -0
  122. package/dist/utils/tool-factory.js.map +1 -1
  123. package/eslint.config.js.bak +113 -0
  124. package/package.json +5 -4
  125. package/dist/prompts/__tests__/promptStructure.test.d.ts +0 -7
  126. package/dist/prompts/__tests__/promptStructure.test.d.ts.map +0 -1
  127. package/dist/prompts/__tests__/promptStructure.test.js +0 -106
  128. package/dist/prompts/__tests__/promptStructure.test.js.map +0 -1
  129. package/dist/prompts/__tests__/registry.test.d.ts +0 -7
  130. package/dist/prompts/__tests__/registry.test.d.ts.map +0 -1
  131. package/dist/prompts/__tests__/registry.test.js +0 -119
  132. package/dist/prompts/__tests__/registry.test.js.map +0 -1
  133. package/dist/scripts/test-all-prompts.d.ts +0 -6
  134. package/dist/scripts/test-all-prompts.d.ts.map +0 -1
  135. package/dist/scripts/test-all-prompts.js +0 -158
  136. package/dist/scripts/test-all-prompts.js.map +0 -1
  137. package/dist/tools/balance/all-assets.d.ts +0 -9
  138. package/dist/tools/balance/all-assets.d.ts.map +0 -1
  139. package/dist/tools/balance/all-assets.js +0 -104
  140. package/dist/tools/balance/all-assets.js.map +0 -1
  141. package/dist/tools/dex/advanced-dex.d.ts +0 -15
  142. package/dist/tools/dex/advanced-dex.d.ts.map +0 -1
  143. package/dist/tools/dex/advanced-dex.js +0 -239
  144. package/dist/tools/dex/advanced-dex.js.map +0 -1
  145. package/dist/tools/dex/pool-price.d.ts +0 -9
  146. package/dist/tools/dex/pool-price.d.ts.map +0 -1
  147. package/dist/tools/dex/pool-price.js +0 -78
  148. package/dist/tools/dex/pool-price.js.map +0 -1
  149. package/dist/tools/dex/pool-quote-calculation.d.ts +0 -9
  150. package/dist/tools/dex/pool-quote-calculation.d.ts.map +0 -1
  151. package/dist/tools/dex/pool-quote-calculation.js +0 -99
  152. package/dist/tools/dex/pool-quote-calculation.js.map +0 -1
  153. package/dist/tools/dex/pool-quote-external.d.ts +0 -10
  154. package/dist/tools/dex/pool-quote-external.d.ts.map +0 -1
  155. package/dist/tools/dex/pool-quote-external.js +0 -84
  156. package/dist/tools/dex/pool-quote-external.js.map +0 -1
  157. package/dist/tools/dex/pool-quote-local.d.ts +0 -10
  158. package/dist/tools/dex/pool-quote-local.d.ts.map +0 -1
  159. package/dist/tools/dex/pool-quote-local.js +0 -84
  160. package/dist/tools/dex/pool-quote-local.js.map +0 -1
  161. package/dist/tools/dex/position-direct.d.ts +0 -9
  162. package/dist/tools/dex/position-direct.d.ts.map +0 -1
  163. package/dist/tools/dex/position-direct.js +0 -65
  164. package/dist/tools/dex/position-direct.js.map +0 -1
  165. package/dist/tools/pools/composite-pool.d.ts +0 -9
  166. package/dist/tools/pools/composite-pool.d.ts.map +0 -1
  167. package/dist/tools/pools/composite-pool.js +0 -69
  168. package/dist/tools/pools/composite-pool.js.map +0 -1
  169. package/dist/tools/pools/fetchAllPrices.d.ts +0 -9
  170. package/dist/tools/pools/fetchAllPrices.d.ts.map +0 -1
  171. package/dist/tools/pools/fetchAllPrices.js +0 -38
  172. package/dist/tools/pools/fetchAllPrices.js.map +0 -1
  173. package/dist/tools/pools/fetchPrices.d.ts +0 -9
  174. package/dist/tools/pools/fetchPrices.d.ts.map +0 -1
  175. package/dist/tools/pools/fetchPrices.js +0 -51
  176. package/dist/tools/pools/fetchPrices.js.map +0 -1
  177. package/dist/tools/utils/faucet.d.ts +0 -10
  178. package/dist/tools/utils/faucet.d.ts.map +0 -1
  179. package/dist/tools/utils/faucet.js +0 -51
  180. package/dist/tools/utils/faucet.js.map +0 -1
  181. package/dist/utils/__tests__/validation.test.d.ts +0 -7
  182. package/dist/utils/__tests__/validation.test.d.ts.map +0 -1
  183. package/dist/utils/__tests__/validation.test.js +0 -122
  184. package/dist/utils/__tests__/validation.test.js.map +0 -1
  185. package/test-mcp.js +0 -89
@@ -6,17 +6,89 @@
6
6
  * Acts as a development reference showing how MCP tools map to SDK methods.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.explainSdkUsageTool = void 0;
9
+ exports.explainSdkUsageTool = exports.COMPOSITE_TOPICS = exports.TOPIC_METHOD_MAPPING = void 0;
10
10
  const error_handler_js_1 = require("../../utils/error-handler.js");
11
11
  const response_formatter_js_1 = require("../../utils/response-formatter.js");
12
+ /**
13
+ * Topic-to-method mapping for documentation validation
14
+ * Defines which SDK methods are covered by each documentation topic
15
+ */
16
+ exports.TOPIC_METHOD_MAPPING = {
17
+ // Trading Workflows
18
+ 'buy-tokens': ['calculateBuyAmount', 'buy'],
19
+ 'sell-tokens': ['calculateSellAmount', 'sell'],
20
+ 'pool-graduation': ['calculateBuyAmountForGraduation', 'graduateToken'],
21
+ // Pool Discovery
22
+ 'fetch-pools': [
23
+ 'fetchPools', 'fetchAllPools', 'fetchPoolDetails', 'fetchPoolDetailsForCalculation',
24
+ 'fetchVolumeData', 'fetchTokenPrice', 'fetchLaunchpadTokenSpotPrice',
25
+ 'fetchTokenDistribution', 'fetchTokenBadges', 'resolveVaultAddress', 'resolveTokenClassKey'
26
+ ],
27
+ 'balances': ['fetchGalaBalance', 'fetchTokenBalance', 'fetchTokensHeld', 'fetchTokensCreated'],
28
+ // Token Creation & Management
29
+ 'token-creation': ['isTokenNameAvailable', 'isTokenSymbolAvailable', 'fetchLaunchTokenFee', 'uploadTokenImage', 'launchToken'],
30
+ 'token-details': ['fetchTokenDetails'],
31
+ 'token-distribution': ['fetchTokenDistribution'],
32
+ // Portfolio Management
33
+ 'multi-wallet': [], // Composite workflow topic
34
+ 'transfers': ['transferGala', 'transferToken'],
35
+ 'locks': ['lockToken', 'unlockToken'],
36
+ // DEX Trading
37
+ 'dex-trading': ['getSwapQuoteExactInput', 'getSwapQuoteExactOutput', 'executeSwap', 'getSwapUserAssets', 'getAllSwapUserAssets', 'getSwapPoolInfo'],
38
+ 'error-handling': [], // Cross-cutting concern
39
+ // Developer Tools
40
+ 'installation': [], // Setup topic
41
+ 'local-calculations': ['calculateBuyAmountLocal', 'calculateSellAmountLocal', 'calculateBuyAmountExternal', 'calculateSellAmountExternal', 'calculateInitialBuyAmount'],
42
+ // Market Data
43
+ 'price-history': ['fetchPriceHistory', 'fetchAllPriceHistory'],
44
+ 'spot-prices-smart-routing': ['fetchTokenPrice', 'getSwapPoolPrice'],
45
+ // User Profile & Social
46
+ 'profile-management': ['fetchProfile', 'updateProfile', 'uploadProfileImage'],
47
+ 'social-features': ['fetchComments', 'postComment'],
48
+ // Liquidity Management
49
+ 'liquidity-positions': ['getSwapUserLiquidityPositions', 'getAllSwapUserLiquidityPositions', 'getSwapLiquidityPosition', 'getSwapLiquidityPositionById', 'addSwapLiquidityByPrice', 'addSwapLiquidityByTicks', 'getSwapEstimateRemoveLiquidity', 'removeSwapLiquidity', 'collectSwapPositionFees'],
50
+ // Advanced Analysis & Social
51
+ 'advanced-dex-analysis': ['fetchCompositePoolData', 'calculateDexPoolQuoteExactAmountLocal', 'calculateDexPoolQuoteExactAmountExternal', 'calculateDexPoolQuoteExactAmount'],
52
+ 'trading-analytics': ['fetchTrades'],
53
+ 'utilities-and-helpers': ['fetchGalaPrice', 'fetchTokenClassesWithSupply', 'calculateInitialBuyAmount', 'getBundlerTransactionResult', 'retrieveGalaFromFaucet', 'getSwapPoolPrice', 'fetchSwapPositionDirect', 'getAllSwapUserAssets', 'cleanup'],
54
+ // DEX Leaderboards & Metrics
55
+ 'fetch-all-dex-seasons': ['fetchAllDexSeasons', 'fetchCurrentDexSeason'],
56
+ 'fetch-dex-leaderboard-by-season-id': ['fetchDexLeaderboardBySeasonId', 'fetchCurrentDexLeaderboard'],
57
+ 'fetch-dex-aggregated-volume-summary': ['fetchDexAggregatedVolumeSummary'],
58
+ 'fetch-dex-pools': ['fetchDexPools', 'fetchAllDexPools'],
59
+ };
60
+ /**
61
+ * Composite topics that don't map 1:1 to SDK methods
62
+ * These are workflow-based topics that group multiple methods
63
+ */
64
+ exports.COMPOSITE_TOPICS = new Set([
65
+ 'buy-tokens', 'sell-tokens', 'pool-graduation', 'fetch-pools', 'balances',
66
+ 'token-creation', 'multi-wallet', 'transfers', 'locks', 'dex-trading', 'error-handling',
67
+ 'installation', 'local-calculations', 'price-history', 'token-details',
68
+ 'spot-prices-smart-routing', 'profile-management', 'token-distribution',
69
+ 'liquidity-positions', 'advanced-dex-analysis', 'social-features',
70
+ 'trading-analytics', 'utilities-and-helpers', 'fetch-all-dex-seasons',
71
+ 'fetch-dex-leaderboard-by-season-id', 'fetch-dex-aggregated-volume-summary',
72
+ 'fetch-dex-pools',
73
+ ]);
12
74
  /**
13
75
  * SDK code examples organized by topic
14
76
  */
15
77
  const SDK_EXAMPLES = {
16
- // Trading workflows
78
+ // ============================================================================
79
+ // TRADING WORKFLOWS: Bonding Curve Trading
80
+ // ============================================================================
81
+ // - buy-tokens: Purchase tokens from bonding curve pools
82
+ // - sell-tokens: Sell tokens back to bonding curve pools
83
+ // - pool-graduation: Transition pools to full DEX trading
84
+ // ============================================================================
17
85
  'buy-tokens': `
18
86
  ## Buying Tokens with SDK
19
87
 
88
+ **Covers Methods:**
89
+ - \`calculateBuyAmount()\`
90
+ - \`buy()\`
91
+
20
92
  \`\`\`typescript
21
93
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
22
94
 
@@ -59,6 +131,10 @@ async function buyTokens() {
59
131
  'sell-tokens': `
60
132
  ## Selling Tokens with SDK
61
133
 
134
+ **Covers Methods:**
135
+ - \`calculateSellAmount()\`
136
+ - \`sell()\`
137
+
62
138
  \`\`\`typescript
63
139
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
64
140
 
@@ -98,6 +174,10 @@ async function sellTokens() {
98
174
  'pool-graduation': `
99
175
  ## Pool Graduation with SDK
100
176
 
177
+ **Covers Methods:**
178
+ - \`calculateBuyAmountForGraduation()\`
179
+ - \`graduateToken()\`
180
+
101
181
  \`\`\`typescript
102
182
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
103
183
 
@@ -136,9 +216,28 @@ async function graduatePool() {
136
216
  - \`gala_launchpad_calculate_buy_amount_for_graduation\`
137
217
  - \`gala_launchpad_graduate_token\`
138
218
  `,
219
+ // ============================================================================
220
+ // POOL DISCOVERY: Launchpad Pool Queries
221
+ // ============================================================================
222
+ // - fetch-pools: Query bonding curve pools with pagination and filtering
223
+ // - balances: Check GALA and token balances in wallet
224
+ // ============================================================================
139
225
  'fetch-pools': `
140
226
  ## Fetching Pool Data with Advanced Methods
141
227
 
228
+ **Covers Methods:**
229
+ - \`fetchPools()\`
230
+ - \`fetchAllPools()\`
231
+ - \`fetchPoolDetails()\`
232
+ - \`fetchPoolDetailsForCalculation()\`
233
+ - \`fetchVolumeData()\`
234
+ - \`fetchTokenPrice()\`
235
+ - \`fetchLaunchpadTokenSpotPrice()\`
236
+ - \`fetchTokenDistribution()\`
237
+ - \`fetchTokenBadges()\`
238
+ - \`resolveVaultAddress()\`
239
+ - \`resolveTokenClassKey()\`
240
+
142
241
  \`\`\`typescript
143
242
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
144
243
 
@@ -297,6 +396,13 @@ async function analyzeToken(tokenName) {
297
396
  'balances': `
298
397
  ## Checking Balances with SDK
299
398
 
399
+ **Covers Methods:**
400
+ - \`fetchGalaBalance()\`
401
+ - \`fetchTokenBalance()\`
402
+ - \`fetchTokensHeld()\`
403
+ - \`fetchTokensCreated()\`
404
+ - \`fetchProfile()\`
405
+
300
406
  \`\`\`typescript
301
407
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
302
408
 
@@ -360,9 +466,23 @@ async function checkBalances() {
360
466
  - \`gala_launchpad_fetch_tokens_created\`
361
467
  - \`gala_launchpad_fetch_profile\`
362
468
  `,
469
+ // ============================================================================
470
+ // TOKEN CREATION & MANAGEMENT: Launch New Tokens
471
+ // ============================================================================
472
+ // - token-creation: Create new tokens and manage token metadata
473
+ // - token-details: Fetch comprehensive token information
474
+ // - token-distribution: Analyze token holder distribution
475
+ // ============================================================================
363
476
  'token-creation': `
364
477
  ## Creating Tokens with SDK
365
478
 
479
+ **Covers Methods:**
480
+ - \`isTokenNameAvailable()\`
481
+ - \`isTokenSymbolAvailable()\`
482
+ - \`fetchLaunchTokenFee()\`
483
+ - \`uploadTokenImage()\`
484
+ - \`launchToken()\`
485
+
366
486
  \`\`\`typescript
367
487
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
368
488
 
@@ -417,9 +537,19 @@ async function launchToken() {
417
537
  - \`gala_launchpad_launch_token\`
418
538
  - \`gala_launchpad_get_url_by_token_name\`
419
539
  `,
540
+ // ============================================================================
541
+ // PORTFOLIO MANAGEMENT: Multi-Wallet & Transfers
542
+ // ============================================================================
543
+ // - multi-wallet: Manage multiple wallets and sessions
544
+ // - transfers: Send GALA and tokens to other addresses
545
+ // ============================================================================
420
546
  'multi-wallet': `
421
547
  ## Multi-Wallet Support with SDK
422
548
 
549
+ **Covers Methods:**
550
+ - \`createWallet()\` (utility function)
551
+ - \`buy()\`, \`sell()\`, \`postComment()\` with privateKey override
552
+
423
553
  \`\`\`typescript
424
554
  import { createLaunchpadSDK, createWallet } from '@gala-chain/launchpad-sdk';
425
555
 
@@ -481,6 +611,10 @@ async function multiWalletExample() {
481
611
  'transfers': `
482
612
  ## Token Transfers with SDK
483
613
 
614
+ **Covers Methods:**
615
+ - \`transferGala()\`
616
+ - \`transferToken()\`
617
+
484
618
  \`\`\`typescript
485
619
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
486
620
 
@@ -521,9 +655,188 @@ async function transferTokens() {
521
655
  - \`gala_launchpad_transfer_gala\`
522
656
  - \`gala_launchpad_transfer_token\`
523
657
  `,
658
+ 'locks': `
659
+ ## Token Locking and Unlocking with SDK
660
+
661
+ **Covers Methods:**
662
+ - \`lockToken()\`
663
+ - \`unlockToken()\`
664
+
665
+ Lock and unlock tokens on GalaChain for staking, escrow, vesting, or governance.
666
+
667
+ \`\`\`typescript
668
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
669
+
670
+ async function tokenLocking() {
671
+ const sdk = createLaunchpadSDK({
672
+ wallet: 'your-private-key'
673
+ });
674
+
675
+ // ============================================================================
676
+ // LOCK TOKENS - Basic usage
677
+ // ============================================================================
678
+
679
+ // Lock 1000 tokens with default options (caller is lock authority)
680
+ const lockResult = await sdk.lockToken({
681
+ tokenName: 'anime',
682
+ amount: '1000'
683
+ });
684
+
685
+ console.log('Lock transaction ID:', lockResult.transactionId);
686
+ console.log('Lock status:', lockResult.status);
687
+
688
+ // ============================================================================
689
+ // LOCK TOKENS - Advanced options
690
+ // ============================================================================
691
+
692
+ // Lock with custom lock authority (another address can unlock)
693
+ const escrowLock = await sdk.lockToken({
694
+ tokenName: 'anime',
695
+ amount: '500',
696
+ lockAuthority: 'eth|0x1234...', // Escrow agent address
697
+ name: 'escrow-payment-001', // Identifier for matching during unlock
698
+ expires: Date.now() + 30 * 24 * 60 * 60 * 1000 // Auto-release in 30 days
699
+ });
700
+
701
+ console.log('Escrow lock created');
702
+
703
+ // Lock for time-based vesting
704
+ const vestingLock = await sdk.lockToken({
705
+ tokenName: 'anime',
706
+ amount: '10000',
707
+ name: 'vesting-q1-2025',
708
+ expires: new Date('2025-04-01').getTime() // Auto-unlock on April 1st
709
+ });
710
+
711
+ console.log('Vesting lock created with expiry');
712
+
713
+ // ============================================================================
714
+ // UNLOCK TOKENS - Release locked tokens
715
+ // ============================================================================
716
+
717
+ // Unlock tokens (must be called by lock authority)
718
+ const unlockResult = await sdk.unlockToken({
719
+ tokenName: 'anime',
720
+ amount: '500'
721
+ });
722
+
723
+ console.log('Unlock transaction ID:', unlockResult.transactionId);
724
+ console.log('Unlock status:', unlockResult.status);
725
+
726
+ // Unlock with matching name (for specific lock identification)
727
+ const namedUnlock = await sdk.unlockToken({
728
+ tokenName: 'anime',
729
+ amount: '1000',
730
+ name: 'escrow-payment-001' // Match the lock name used during lock
731
+ });
732
+
733
+ console.log('Named unlock completed');
734
+
735
+ // ============================================================================
736
+ // STAKING WORKFLOW EXAMPLE
737
+ // ============================================================================
738
+
739
+ async function stakingWorkflow() {
740
+ // Step 1: Lock tokens for staking period
741
+ const stake = await sdk.lockToken({
742
+ tokenName: 'anime',
743
+ amount: '5000',
744
+ name: 'staking-period-1',
745
+ expires: Date.now() + 90 * 24 * 60 * 60 * 1000 // 90-day staking period
746
+ });
747
+
748
+ console.log('Staked 5000 tokens for 90 days');
749
+
750
+ // Step 2: After staking period expires, unlock
751
+ // (This would happen after the expires timestamp)
752
+ const unstake = await sdk.unlockToken({
753
+ tokenName: 'anime',
754
+ amount: '5000',
755
+ name: 'staking-period-1'
756
+ });
757
+
758
+ console.log('Unstaked tokens after staking period');
759
+ return { stake, unstake };
760
+ }
761
+
762
+ // ============================================================================
763
+ // ESCROW WORKFLOW EXAMPLE
764
+ // ============================================================================
765
+
766
+ async function escrowWorkflow(buyerAddress: string, sellerAddress: string) {
767
+ // Step 1: Buyer locks payment in escrow (seller is lock authority)
768
+ const escrow = await sdk.lockToken({
769
+ tokenName: 'anime',
770
+ amount: '1000',
771
+ lockAuthority: sellerAddress, // Seller can release upon delivery
772
+ name: 'order-12345'
773
+ });
774
+
775
+ console.log('Escrow created: seller can release payment upon delivery');
776
+
777
+ // Step 2: Seller releases escrow after delivery (seller calls unlock)
778
+ // This would be executed by the seller's SDK instance
779
+ // const release = await sellerSdk.unlockToken({
780
+ // tokenName: 'anime',
781
+ // amount: '1000',
782
+ // name: 'order-12345'
783
+ // });
784
+
785
+ return escrow;
786
+ }
787
+ }
788
+ \`\`\`
789
+
790
+ **Key Features:**
791
+ - **Lock Authority**: Specify who can unlock (defaults to caller)
792
+ - **Expiration**: Optional auto-release timestamp for time-based vesting
793
+ - **Named Locks**: Use \`name\` to identify specific locks for targeted unlocks
794
+ - **EIP-712 Signatures**: Secure blockchain transactions
795
+ - **Error Handling**: \`LockError\` class with specific error types
796
+
797
+ **Lock Parameters:**
798
+ | Parameter | Required | Description |
799
+ |-----------|----------|-------------|
800
+ | \`tokenName\` | Yes | Token to lock (e.g., 'anime') |
801
+ | \`amount\` | Yes | Amount of tokens to lock |
802
+ | \`lockAuthority\` | No | Address that can unlock (defaults to caller) |
803
+ | \`expires\` | No | Timestamp in ms for auto-unlock |
804
+ | \`name\` | No | Identifier for matching during unlock |
805
+
806
+ **Unlock Parameters:**
807
+ | Parameter | Required | Description |
808
+ |-----------|----------|-------------|
809
+ | \`tokenName\` | Yes | Token to unlock (e.g., 'anime') |
810
+ | \`amount\` | Yes | Amount of tokens to unlock |
811
+ | \`name\` | No | Lock name to match (if used during lock) |
812
+
813
+ **Use Cases:**
814
+ - **Staking**: Lock tokens for rewards/governance
815
+ - **Escrow**: Third-party controlled releases
816
+ - **Vesting**: Time-based token releases
817
+ - **Governance**: Lock tokens for voting power
818
+
819
+ **MCP Tool Equivalents:**
820
+ - \`gala_launchpad_lock_token\`
821
+ - \`gala_launchpad_unlock_token\`
822
+ `,
823
+ // ============================================================================
824
+ // DEX TRADING: GalaSwap Integration
825
+ // ============================================================================
826
+ // - dex-trading: Execute trades, get quotes, manage assets on GalaSwap
827
+ // - error-handling: Handle transaction errors gracefully
828
+ // ============================================================================
524
829
  'dex-trading': `
525
830
  ## DEX Trading with SDK - GalaSwap Integration
526
831
 
832
+ **Covers Methods:**
833
+ - \`getSwapQuoteExactInput()\`
834
+ - \`getSwapQuoteExactOutput()\`
835
+ - \`executeSwap()\`
836
+ - \`getSwapUserAssets()\`
837
+ - \`getAllSwapUserAssets()\`
838
+ - \`getSwapPoolInfo()\`
839
+
527
840
  Trade graduated tokens on the GalaSwap DEX with real-time WebSocket monitoring:
528
841
 
529
842
  \`\`\`typescript
@@ -577,6 +890,17 @@ async function dexTradingExample() {
577
890
  console.log(' ' + asset.symbol + ': ' + asset.balance);
578
891
  });
579
892
 
893
+ // ============================================================================
894
+ // PORTFOLIO: Get ALL assets (auto-paginated)
895
+ // ============================================================================
896
+
897
+ const allAssets = await sdk.getAllSwapUserAssets(sdk.getEthereumAddress());
898
+ console.log('Complete asset portfolio:');
899
+ console.log('Total assets: ' + allAssets.length);
900
+ allAssets.forEach(asset => {
901
+ console.log(' ' + asset.symbol + ': ' + asset.balance);
902
+ });
903
+
580
904
  // ============================================================================
581
905
  // POOL INFO: Check liquidity before trading
582
906
  // ============================================================================
@@ -595,17 +919,22 @@ async function dexTradingExample() {
595
919
  - **Token Formats**: Supports simple names ('GALA') or full IDs ('GALA|Unit|none|none')
596
920
  - **Slippage Protection**: Always use quote values for execution
597
921
  - **Fee Tiers**: 500 (0.05%), 3000 (0.30%), 10000 (1.00%)
922
+ - **Auto-Pagination**: Use \`getAllSwapUserAssets()\` for complete portfolio
598
923
 
599
924
  **MCP Tool Equivalents:**
600
925
  - \`gala_launchpad_get_swap_quote_exact_input\`
601
926
  - \`gala_launchpad_get_swap_quote_exact_output\`
602
927
  - \`gala_launchpad_execute_swap\`
603
928
  - \`gala_launchpad_get_swap_user_assets\`
929
+ - \`gala_launchpad_get_all_swap_user_assets\`
604
930
  - \`gala_launchpad_get_swap_pool_info\`
605
931
  `,
606
932
  'error-handling': `
607
933
  ## Error Handling with SDK
608
934
 
935
+ **Covers Methods:**
936
+ - Error types from SDK (ValidationError, NetworkError, TransactionError, TokenNotFoundError, etc.)
937
+
609
938
  \`\`\`typescript
610
939
  import {
611
940
  createLaunchpadSDK,
@@ -664,9 +993,19 @@ async function errorHandlingExample() {
664
993
  - \`ConfigurationError\` - SDK misconfiguration
665
994
  - \`WebSocketError\` - Real-time connection issues
666
995
  `,
996
+ // ============================================================================
997
+ // DEVELOPER TOOLS & SETUP: Installation & Utilities
998
+ // ============================================================================
999
+ // - installation: Install and import the SDK
1000
+ // - local-calculations: Offline bonding curve calculations
1001
+ // - utilities-and-helpers: Helper functions and utilities
1002
+ // ============================================================================
667
1003
  'installation': `
668
1004
  ## Installing and Importing SDK
669
1005
 
1006
+ **Covers Methods:**
1007
+ - SDK installation, imports, and configuration
1008
+
670
1009
  ### NPM Installation
671
1010
 
672
1011
  \`\`\`bash
@@ -736,6 +1075,12 @@ const sdk = createLaunchpadSDK({
736
1075
  'local-calculations': `
737
1076
  ## Local Bonding Curve Calculations with SDK
738
1077
 
1078
+ **Covers Methods:**
1079
+ - \`calculateBuyAmountLocal()\`
1080
+ - \`calculateSellAmountLocal()\`
1081
+ - \`calculateBuyAmountExternal()\`
1082
+ - \`calculateSellAmountExternal()\`
1083
+
739
1084
  \`\`\`typescript
740
1085
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
741
1086
 
@@ -844,9 +1189,19 @@ async function localCalculationsExample() {
844
1189
  - \`gala_launchpad_calculate_sell_amount_local\`
845
1190
  - \`gala_launchpad_calculate_sell_amount_external\`
846
1191
  `,
1192
+ // ============================================================================
1193
+ // MARKET DATA: Prices & Historical Data
1194
+ // ============================================================================
1195
+ // - price-history: Fetch historical price data for tokens
1196
+ // - spot-prices-smart-routing: Get current token prices
1197
+ // ============================================================================
847
1198
  'price-history': `
848
1199
  ## Historical Price Analysis with SDK
849
1200
 
1201
+ **Covers Methods:**
1202
+ - \`fetchPriceHistory()\`
1203
+ - \`fetchAllPriceHistory()\`
1204
+
850
1205
  \`\`\`typescript
851
1206
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
852
1207
 
@@ -857,7 +1212,7 @@ async function analyzePriceHistory() {
857
1212
 
858
1213
  // Paginated price history
859
1214
  const history = await sdk.fetchPriceHistory({
860
- tokenId: 'Token|Unit|GUSDC|eth:0x...',
1215
+ tokenId: 'GUSDC|Unit|none|eth:0x...',
861
1216
  from: new Date('2025-01-01'),
862
1217
  to: new Date('2025-01-31'),
863
1218
  sortOrder: 'DESC',
@@ -909,7 +1264,7 @@ async function analyzePriceHistory() {
909
1264
  - Backtesting strategies
910
1265
 
911
1266
  **Token ID Formats:**
912
- - String: \`Token|Unit|GUSDC|eth:0x...\`
1267
+ - String: \`GUSDC|Unit|none|eth:0x...\`
913
1268
  - Object: \`{ collection, category, type, additionalKey }\`
914
1269
 
915
1270
  **MCP Tool Equivalents:**
@@ -919,6 +1274,9 @@ async function analyzePriceHistory() {
919
1274
  'token-details': `
920
1275
  ## Token Details and Metadata with SDK
921
1276
 
1277
+ **Covers Methods:**
1278
+ - \`fetchTokenDetails()\`
1279
+
922
1280
  \`\`\`typescript
923
1281
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
924
1282
 
@@ -928,7 +1286,7 @@ async function analyzeTokenDetails() {
928
1286
  });
929
1287
 
930
1288
  // Fetch token metadata
931
- const details = await sdk.fetchTokenDetails('Token|Unit|GUSDC|eth:0x...');
1289
+ const details = await sdk.fetchTokenDetails('GUSDC|Unit|none|eth:0x...');
932
1290
 
933
1291
  console.log('Token Information:');
934
1292
  console.log(\` Name: \${details.name}\`);
@@ -959,7 +1317,7 @@ async function analyzeTokenDetails() {
959
1317
  }
960
1318
 
961
1319
  // Batch token comparison
962
- const tokens = ['GALA|Unit|none|none', 'Token|Unit|GUSDC|eth:0x...'];
1320
+ const tokens = ['GALA|Unit|none|none', 'GUSDC|Unit|none|eth:0x...'];
963
1321
  const details_list = await Promise.all(
964
1322
  tokens.map(id => sdk.fetchTokenDetails(id).catch(() => null))
965
1323
  );
@@ -987,7 +1345,7 @@ async function analyzeTokenDetails() {
987
1345
  - Network compatibility checking
988
1346
 
989
1347
  **Token ID Formats:**
990
- - String: \`Token|Unit|GUSDC|eth:0x...\`
1348
+ - String: \`GUSDC|Unit|none|eth:0x...\`
991
1349
  - Object: \`{ collection, category, type, additionalKey }\`
992
1350
 
993
1351
  **MCP Tool Equivalent:** \`gala_launchpad_fetch_token_details\`
@@ -995,6 +1353,11 @@ async function analyzeTokenDetails() {
995
1353
  'spot-prices-smart-routing': `
996
1354
  ## Smart Spot Price Routing with DEX Fallback
997
1355
 
1356
+ **Covers Methods:**
1357
+ - \`fetchTokenPrice()\` (smart routing)
1358
+ - \`fetchLaunchpadTokenSpotPrice()\`
1359
+ - \`isTokenGraduated()\`
1360
+
998
1361
  The SDK intelligently routes pricing requests between DEX and Launchpad backends based on token graduation status - no need to know which backend a token uses!
999
1362
 
1000
1363
  \`\`\`typescript
@@ -1134,9 +1497,20 @@ async function safePriceQuery(tokenId: string) {
1134
1497
  - \`gala_launchpad_fetch_launchpad_token_spot_price\` - Launchpad-only
1135
1498
  - \`gala_launchpad_is_token_graduated\` - Check graduation status
1136
1499
  `,
1500
+ // ============================================================================
1501
+ // USER PROFILE & SOCIAL: Community Features
1502
+ // ============================================================================
1503
+ // - profile-management: Update user profile and images
1504
+ // - social-features: Community comments and interactions
1505
+ // ============================================================================
1137
1506
  'profile-management': `
1138
1507
  ## User Profile Management with SDK
1139
1508
 
1509
+ **Covers Methods:**
1510
+ - \`fetchProfile()\`
1511
+ - \`updateProfile()\`
1512
+ - \`uploadProfileImage()\`
1513
+
1140
1514
  \`\`\`typescript
1141
1515
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
1142
1516
 
@@ -1240,6 +1614,9 @@ async function manageUserProfiles() {
1240
1614
  'token-distribution': `
1241
1615
  ## Token Holder Distribution with SDK
1242
1616
 
1617
+ **Covers Methods:**
1618
+ - \`fetchTokenDistribution()\`
1619
+
1243
1620
  \`\`\`typescript
1244
1621
  import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
1245
1622
 
@@ -1322,14 +1699,30 @@ function calculateGini(holders: Array<{balance: string}>) {
1322
1699
 
1323
1700
  **MCP Tool Equivalent:** \`gala_launchpad_fetch_token_distribution\`
1324
1701
  `,
1702
+ // ============================================================================
1703
+ // LIQUIDITY MANAGEMENT: GalaSwap LP Positions
1704
+ // ============================================================================
1705
+ // - liquidity-positions: Manage concentrated liquidity positions
1706
+ // ============================================================================
1325
1707
  'liquidity-positions': `
1326
1708
  ## GSwap Liquidity Position Management
1327
1709
 
1710
+ **Covers Methods:**
1711
+ - \`getSwapUserLiquidityPositions()\`
1712
+ - \`getAllSwapUserLiquidityPositions()\`
1713
+ - \`getSwapLiquidityPosition()\`
1714
+ - \`getSwapLiquidityPositionById()\`
1715
+ - \`addSwapLiquidityByPrice()\`
1716
+ - \`addSwapLiquidityByTicks()\`
1717
+ - \`getSwapEstimateRemoveLiquidity()\`
1718
+ - \`removeSwapLiquidity()\`
1719
+ - \`collectSwapPositionFees()\`
1720
+
1328
1721
  Provide liquidity on GalaSwap DEX and earn passive trading fees from swaps.
1329
1722
 
1330
1723
  **Overview:** Concentrated liquidity allows capital deployment within specific price ranges. Liquidity providers earn fees when trades occur within their price range, making it an attractive passive income strategy.
1331
1724
 
1332
- **8 Core SDK Methods:**
1725
+ **9 Core SDK Methods:**
1333
1726
 
1334
1727
  1. **getSwapUserLiquidityPositions(ownerAddress, limit?, bookmark?)** - View all open positions for wallet
1335
1728
  - Returns: Array of positions with token pairs, amounts, accumulated fees
@@ -1370,7 +1763,489 @@ Provide liquidity on GalaSwap DEX and earn passive trading fees from swaps.
1370
1763
  - /galachain-launchpad:remove-liquidity - Close position
1371
1764
  - /galachain-launchpad:collect-fees - Harvest fees
1372
1765
 
1766
+ **Auto-Pagination Method:**
1767
+
1768
+ Use \`getAllSwapUserLiquidityPositions()\` to fetch all positions without manual pagination:
1769
+
1770
+ \`\`\`typescript
1771
+ // Fetch ALL positions automatically (handles pagination internally)
1772
+ const allPositions = await sdk.getAllSwapUserLiquidityPositions(ownerAddress);
1773
+
1774
+ console.log(\`Total positions: \${allPositions.length}\`);
1775
+ allPositions.forEach(position => {
1776
+ const fees = position.fees0 + position.fees1; // Total accumulated fees
1777
+ console.log(\`Position: \${position.token0}-\${position.token1}\`);
1778
+ console.log(\`Accumulated fees: \${fees}\`);
1779
+ });
1780
+ \`\`\`
1781
+
1373
1782
  **Demo Script:** See packages/sdk/examples/demo-liquidity-positions.ts for complete workflows
1783
+ `,
1784
+ // ============================================================================
1785
+ // ADVANCED ANALYSIS & SOCIAL: Complex Features
1786
+ // ============================================================================
1787
+ // - advanced-dex-analysis: Composite DEX analysis and pricing
1788
+ // - social-features: Community interactions
1789
+ // - trading-analytics: Trade history and metrics
1790
+ // ============================================================================
1791
+ 'advanced-dex-analysis': `
1792
+ ## Advanced DEX Pool Analysis with SDK
1793
+
1794
+ **Covers Methods:**
1795
+ - \`fetchCompositePoolData()\`
1796
+ - \`calculateDexPoolQuoteExactAmountLocal()\`
1797
+ - \`calculateDexPoolQuoteExactAmountExternal()\`
1798
+ - \`calculateDexPoolQuoteExactAmount()\`
1799
+
1800
+ This workflow demonstrates analyzing graduated tokens using composite data and price calculations.
1801
+
1802
+ **Use Cases:**
1803
+ - Arbitrage opportunity detection
1804
+ - Price impact analysis before large trades
1805
+ - Comparing bonding curve vs DEX pricing
1806
+ - Smart routing for best execution
1807
+
1808
+ \`\`\`typescript
1809
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
1810
+
1811
+ async function advancedDexAnalysis() {
1812
+ const sdk = createLaunchpadSDK({ environment: 'production' });
1813
+
1814
+ // Step 1: Get composite pool data (bonding curve + DEX if graduated)
1815
+ const composite = await sdk.fetchCompositePoolData('anime');
1816
+
1817
+ if (composite.isGraduated) {
1818
+ console.log('Token graduated to DEX!');
1819
+ console.log('DEX Pool TVL:', composite.dexPool.tvl);
1820
+ console.log('DEX 24h Volume:', composite.dexPool.volume1d);
1821
+ }
1822
+
1823
+ // Step 2: Compare local vs external price calculations
1824
+ const localQuote = await sdk.calculateDexPoolQuoteExactAmountLocal(
1825
+ 'GALA|Unit|none|none',
1826
+ 'anime|Unit|none|eth:0x...',
1827
+ '100'
1828
+ );
1829
+
1830
+ const externalQuote = await sdk.calculateDexPoolQuoteExactAmountExternal(
1831
+ 'GALA|Unit|none|none',
1832
+ 'anime|Unit|none|eth:0x...',
1833
+ '100'
1834
+ );
1835
+
1836
+ console.log('Local calculation:', localQuote.outputAmount);
1837
+ console.log('External API:', externalQuote.outputAmount);
1838
+ console.log('Price difference:',
1839
+ Math.abs(parseFloat(localQuote.outputAmount) - parseFloat(externalQuote.outputAmount))
1840
+ );
1841
+
1842
+ // Step 3: Use smart routing for best price
1843
+ const bestQuote = await sdk.calculateDexPoolQuoteExactAmount(
1844
+ 'GALA|Unit|none|none',
1845
+ 'anime|Unit|none|eth:0x...',
1846
+ '100'
1847
+ );
1848
+
1849
+ console.log('Best route:', bestQuote.route); // 'local' or 'external'
1850
+ console.log('Best price:', bestQuote.outputAmount);
1851
+ }
1852
+ \`\`\`
1853
+
1854
+ **MCP Tools:**
1855
+ - \`gala_launchpad_fetch_composite_pool_data\`
1856
+ - \`gala_launchpad_calculate_dex_pool_quote_exact_amount_local\`
1857
+ - \`gala_launchpad_calculate_dex_pool_quote_exact_amount_external\`
1858
+ - \`gala_launchpad_calculate_dex_pool_quote_exact_amount\`
1859
+ `,
1860
+ 'social-features': `
1861
+ ## Community Comments and Social Features
1862
+
1863
+ **Covers Methods:**
1864
+ - \`fetchComments()\`
1865
+ - \`postComment()\`
1866
+
1867
+ Interact with token communities through comments.
1868
+
1869
+ **Use Cases:**
1870
+ - Display community sentiment
1871
+ - Post analysis or updates
1872
+ - Moderate discussions
1873
+ - Track engagement
1874
+
1875
+ \`\`\`typescript
1876
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
1877
+
1878
+ async function socialFeatures() {
1879
+ // Read-only: Fetch comments
1880
+ const sdkReadOnly = createLaunchpadSDK({ environment: 'production' });
1881
+
1882
+ const comments = await sdkReadOnly.fetchComments({
1883
+ tokenName: 'anime',
1884
+ limit: 50,
1885
+ page: 1
1886
+ });
1887
+
1888
+ console.log(\`Found \${comments.total} comments\`);
1889
+ comments.comments.forEach(comment => {
1890
+ console.log(\`\${comment.author}: \${comment.content}\`);
1891
+ console.log(\` Posted: \${comment.createdAt}\`);
1892
+ });
1893
+
1894
+ // Write: Post a comment (requires wallet)
1895
+ const sdkWithWallet = createLaunchpadSDK({
1896
+ environment: 'production',
1897
+ wallet: process.env.WALLET_PRIVATE_KEY
1898
+ });
1899
+
1900
+ await sdkWithWallet.postComment({
1901
+ tokenName: 'anime',
1902
+ content: 'Great project! Just bought 1000 tokens.'
1903
+ });
1904
+
1905
+ console.log('Comment posted successfully!');
1906
+ }
1907
+ \`\`\`
1908
+
1909
+ **MCP Tools:**
1910
+ - \`gala_launchpad_fetch_comments\`
1911
+ - \`gala_launchpad_post_comment\`
1912
+ `,
1913
+ 'trading-analytics': `
1914
+ ## Trading History and Analytics
1915
+
1916
+ **Covers Methods:**
1917
+ - \`fetchTrades()\`
1918
+
1919
+ Analyze individual trades for technical analysis and bot development.
1920
+
1921
+ **Use Cases:**
1922
+ - Track recent trading activity
1923
+ - Calculate average trade size
1924
+ - Identify whale transactions
1925
+ - Build trading bots with historical data
1926
+
1927
+ \`\`\`typescript
1928
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
1929
+
1930
+ async function tradingAnalytics() {
1931
+ const sdk = createLaunchpadSDK({ environment: 'production' });
1932
+
1933
+ // Fetch recent trades
1934
+ const trades = await sdk.fetchTrades('anime', {
1935
+ limit: 100,
1936
+ page: 1
1937
+ });
1938
+
1939
+ console.log(\`Analyzing \${trades.total} trades\`);
1940
+
1941
+ // Calculate analytics
1942
+ const totalVolume = trades.trades.reduce((sum, t) => sum + parseFloat(t.galaAmount), 0);
1943
+ const averageTradeSize = totalVolume / trades.trades.length;
1944
+ const whaleTrades = trades.trades.filter(t => parseFloat(t.galaAmount) > 1000);
1945
+
1946
+ console.log(\`Total volume: \${totalVolume} GALA\`);
1947
+ console.log(\`Average trade size: \${averageTradeSize} GALA\`);
1948
+ console.log(\`Whale trades (>1000 GALA): \${whaleTrades.length}\`);
1949
+
1950
+ // Most recent trades
1951
+ trades.trades.slice(0, 10).forEach(trade => {
1952
+ console.log(\`\${trade.type}: \${trade.galaAmount} GALA at \${trade.timestamp}\`);
1953
+ });
1954
+ }
1955
+ \`\`\`
1956
+
1957
+ **Related Topics:**
1958
+ - See \`fetch-pools\` for volume data analysis
1959
+ - See \`dex-trading\` for executing trades
1960
+
1961
+ **MCP Tools:**
1962
+ - \`gala_launchpad_fetch_trades\`
1963
+ `,
1964
+ 'utilities-and-helpers': `
1965
+ ## Utility Methods and Helpers
1966
+
1967
+ **Covers Methods:**
1968
+ - \`fetchGalaPrice()\`
1969
+ - \`fetchTokenClassesWithSupply()\`
1970
+ - \`calculateInitialBuyAmount()\`
1971
+ - \`getBundlerTransactionResult()\`
1972
+ - \`retrieveGalaFromFaucet()\`
1973
+ - \`getSwapPoolPrice()\`
1974
+ - \`fetchSwapPositionDirect()\`
1975
+ - \`getAllSwapUserAssets()\`
1976
+ - \`cleanup()\`
1977
+
1978
+ Essential helper methods for development, debugging, and special use cases.
1979
+
1980
+ ### Price & Supply Queries
1981
+
1982
+ \`\`\`typescript
1983
+ // Get current GALA price in USD
1984
+ const galaPrice = await sdk.fetchGalaPrice();
1985
+ console.log(\`GALA: $\${galaPrice}\`);
1986
+
1987
+ // Get token supply metrics from GalaChain
1988
+ const supplies = await sdk.fetchTokenClassesWithSupply();
1989
+ supplies.forEach(token => {
1990
+ console.log(\`\${token.tokenClass}: \${token.totalSupply}\`);
1991
+ });
1992
+ \`\`\`
1993
+
1994
+ ### Transaction Monitoring
1995
+
1996
+ \`\`\`typescript
1997
+ // Check transaction status
1998
+ const status = await sdk.getBundlerTransactionResult('tx-id-123');
1999
+ console.log('Status:', status.status); // 'pending' | 'success' | 'failed'
2000
+ \`\`\`
2001
+
2002
+ ### Testing Utilities
2003
+
2004
+ \`\`\`typescript
2005
+ // Retrieve test GALA from faucet (development only)
2006
+ await sdk.retrieveGalaFromFaucet();
2007
+ console.log('Test GALA received!');
2008
+ \`\`\`
2009
+
2010
+ ### Advanced Swap Queries
2011
+
2012
+ \`\`\`typescript
2013
+ // Get pool price without full quote
2014
+ const price = await sdk.getSwapPoolPrice('GALA|Unit|none|none', 'GUSDC|Unit|none|none');
2015
+ console.log(\`Pool price: \${price}\`);
2016
+
2017
+ // Auto-paginated asset fetch
2018
+ const allAssets = await sdk.getAllSwapUserAssets('eth|0x...', { limit: 100 });
2019
+ console.log(\`Total assets: \${allAssets.length}\`);
2020
+
2021
+ // Direct position lookup (if you have compound key)
2022
+ const position = await sdk.fetchSwapPositionDirect({
2023
+ owner: 'eth|0x...',
2024
+ token0: 'GALA|Unit|none|none',
2025
+ token1: 'GUSDC|Unit|none|none',
2026
+ feeTier: 3000
2027
+ });
2028
+ \`\`\`
2029
+
2030
+ ### Launch Calculations
2031
+
2032
+ \`\`\`typescript
2033
+ // Calculate initial buy amount for token launch
2034
+ const buyAmount = await sdk.calculateInitialBuyAmount('100');
2035
+ console.log(\`Initial buy: \${buyAmount} tokens\`);
2036
+ \`\`\`
2037
+
2038
+ ### SDK Cleanup
2039
+
2040
+ \`\`\`typescript
2041
+ // Proper cleanup when done (closes connections)
2042
+ await sdk.cleanup();
2043
+ \`\`\`
2044
+
2045
+ **MCP Tools:**
2046
+ - \`gala_launchpad_fetch_gala_price\`
2047
+ - \`gala_launchpad_fetch_token_classes_with_supply\`
2048
+ - \`gala_launchpad_calculate_initial_buy_amount\`
2049
+ - \`gala_launchpad_get_bundler_transaction_result\`
2050
+ - \`gala_launchpad_retrieve_gala_from_faucet\`
2051
+ - \`gala_launchpad_get_swap_pool_price\`
2052
+ - \`gala_launchpad_fetch_swap_position_direct\`
2053
+ - \`gala_launchpad_get_all_swap_user_assets\`
2054
+ `,
2055
+ // ============================================================================
2056
+ // DEX LEADERBOARDS & METRICS: Competitive Features
2057
+ // ============================================================================
2058
+ // - fetch-all-dex-seasons: Query DEX leaderboard seasons
2059
+ // - fetch-dex-leaderboard-by-season-id: View season rankings
2060
+ // - fetch-dex-aggregated-volume-summary: Platform volume trends
2061
+ // - fetch-dex-pools: Discover and analyze liquidity pools
2062
+ // ============================================================================
2063
+ 'fetch-all-dex-seasons': `
2064
+ ## DEX Leaderboard Seasons Management
2065
+
2066
+ **Covers Methods:**
2067
+ - \`fetchAllDexSeasons()\`
2068
+ - \`fetchCurrentDexSeason()\`
2069
+
2070
+ Discover and manage DEX leaderboard seasons for competitive trading events.
2071
+
2072
+ \`\`\`typescript
2073
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
2074
+
2075
+ async function manageDexSeasons() {
2076
+ const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
2077
+
2078
+ // Fetch all available seasons
2079
+ const seasons = await sdk.fetchAllDexSeasons();
2080
+
2081
+ // Display season information
2082
+ seasons.forEach(season => {
2083
+ console.log(\`Season: \${season.name} (ID: \${season.id})\`);
2084
+ console.log(\`Duration: \${season.start} to \${season.end}\`);
2085
+ });
2086
+
2087
+ // Get current season
2088
+ const activeSeason = await sdk.fetchCurrentDexSeason();
2089
+ if (activeSeason) {
2090
+ console.log(\`Active: \${activeSeason.name}\`);
2091
+ } else {
2092
+ console.log('No active season (between seasons)');
2093
+ }
2094
+
2095
+ // Verify season is active
2096
+ const now = new Date();
2097
+ const isActive = activeSeason && now >= activeSeason.start && now <= activeSeason.end;
2098
+ console.log(\`Season active: \${isActive}\`);
2099
+ }
2100
+ \`\`\`
2101
+
2102
+ **MCP Tool Equivalents:**
2103
+ - \`gala_launchpad_fetch_all_dex_seasons\`
2104
+ - \`gala_launchpad_fetch_current_dex_season\`
2105
+ `,
2106
+ 'fetch-dex-leaderboard-by-season-id': `
2107
+ ## DEX Leaderboard Rankings by Season
2108
+
2109
+ **Covers Methods:**
2110
+ - \`fetchDexLeaderboardBySeasonId()\`
2111
+ - \`fetchCurrentDexLeaderboard()\`
2112
+
2113
+ Query leaderboard rankings for competitive DEX trading seasons.
2114
+
2115
+ \`\`\`typescript
2116
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
2117
+
2118
+ async function viewLeaderboards() {
2119
+ const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
2120
+
2121
+ // Option 1: Fetch leaderboard for specific season
2122
+ const leaderboard = await sdk.fetchDexLeaderboardBySeasonId(4);
2123
+
2124
+ // Display top 10 ranked players
2125
+ console.log(\`Season \${leaderboard.seasonId} - Top 10 Players:\`);
2126
+ leaderboard.entries.slice(0, 10).forEach(entry => {
2127
+ console.log(\` \${entry.rank}. \${entry.wallet}\`);
2128
+ console.log(\` XP: \${entry.totalXp} (Liquidity: \${entry.liquidityXp}, Trading: \${entry.tradingXp})\`);
2129
+ });
2130
+
2131
+ // Analyze mastery titles
2132
+ const topPlayer = leaderboard.entries[0];
2133
+ topPlayer.masteryTitles.forEach(title => {
2134
+ console.log(\` 🏆 \${title.name} (Type: \${title.type}, Tier: \${title.order})\`);
2135
+ });
2136
+
2137
+ // Option 2: Get current leaderboard (convenience method)
2138
+ const currentBoard = await sdk.fetchCurrentDexLeaderboard();
2139
+
2140
+ if (currentBoard) {
2141
+ console.log(\`Season \${currentBoard.seasonId} is active\`);
2142
+ console.log(\`Total participants: \${currentBoard.entries.length}\`);
2143
+
2144
+ // Top 3 performers
2145
+ const topThree = currentBoard.entries.slice(0, 3);
2146
+ topThree.forEach(entry => {
2147
+ console.log(\` #\${entry.rank}: \${entry.totalXp} XP\`);
2148
+ });
2149
+ }
2150
+ }
2151
+ \`\`\`
2152
+
2153
+ **MCP Tool Equivalents:**
2154
+ - \`gala_launchpad_fetch_dex_leaderboard_by_season_id\`
2155
+ - \`gala_launchpad_fetch_current_dex_leaderboard\`
2156
+ `,
2157
+ 'fetch-dex-aggregated-volume-summary': `
2158
+ ## DEX Aggregated Volume Summary and Trends
2159
+
2160
+ **Covers Methods:**
2161
+ - \`fetchDexAggregatedVolumeSummary()\`
2162
+
2163
+ Analyze DEX trading volume trends across different time periods.
2164
+
2165
+ \`\`\`typescript
2166
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
2167
+
2168
+ async function analyzeVolumeTrends() {
2169
+ const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
2170
+
2171
+ // Get volume summary with trend metrics
2172
+ const summary = await sdk.fetchDexAggregatedVolumeSummary();
2173
+
2174
+ // Display volumes
2175
+ console.log(\`1-Day Volume: $\${summary.volume1d.toLocaleString()}\`);
2176
+ console.log(\`7-Day Volume: $\${summary.volume7d.toLocaleString()}\`);
2177
+ console.log(\`30-Day Volume: $\${summary.volume30d.toLocaleString()}\`);
2178
+
2179
+ // Analyze trends
2180
+ const trend1d = summary.volume1dDelta > 0 ? '📈 UP' : '📉 DOWN';
2181
+ const trend7d = summary.volume7dDelta > 0 ? '📈 UP' : '📉 DOWN';
2182
+ const trend30d = summary.volume30dDelta > 0 ? '📈 UP' : '📉 DOWN';
2183
+
2184
+ console.log(\`1-Day Trend: \${trend1d} (\${(summary.volume1dDelta * 100).toFixed(2)}%)\`);
2185
+ console.log(\`7-Day Trend: \${trend7d} (\${(summary.volume7dDelta * 100).toFixed(2)}%)\`);
2186
+ console.log(\`30-Day Trend: \${trend30d} (\${(summary.volume30dDelta * 100).toFixed(2)}%)\`);
2187
+
2188
+ // Growth analysis
2189
+ if (summary.volume30dDelta > 0.1) {
2190
+ console.log('Strong growth - Platform adoption increasing');
2191
+ } else if (summary.volume30dDelta < -0.1) {
2192
+ console.log('Declining volume - Platform may be slowing');
2193
+ }
2194
+ }
2195
+ \`\`\`
2196
+
2197
+ **MCP Tool Equivalent:** \`gala_launchpad_fetch_dex_aggregated_volume_summary\`
2198
+ `,
2199
+ 'fetch-dex-pools': `
2200
+ ## Fetch DEX Pools with Pagination
2201
+
2202
+ **Covers Methods:**
2203
+ - \`fetchDexPools()\`
2204
+ - \`fetchAllDexPools()\`
2205
+
2206
+ Discover and query liquidity pools on GalaSwap with advanced filtering and pagination.
2207
+
2208
+ \`\`\`typescript
2209
+ import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
2210
+
2211
+ async function queryDexPools() {
2212
+ const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });
2213
+
2214
+ // Option 1: Fetch pools with pagination
2215
+ const pools = await sdk.fetchDexPools({
2216
+ search: 'GALA',
2217
+ sortBy: 'tvl', // Sort by: tvl, volume30d, volume1d
2218
+ limit: 20,
2219
+ page: 1
2220
+ });
2221
+
2222
+ console.log(\`Found \${pools.total} pools, page \${pools.page} of \${pools.totalPages}\`);
2223
+ pools.pools.forEach(pool => {
2224
+ console.log(\`\${pool.tokenName}: TVL \${pool.tvl}, 24h Volume: \${pool.volume1d}\`);
2225
+ });
2226
+
2227
+ // Option 2: Fetch ALL pools automatically (handles pagination)
2228
+ const allPools = await sdk.fetchAllDexPools({
2229
+ sortBy: 'tvl'
2230
+ });
2231
+
2232
+ console.log(\`Total pools: \${allPools.pools.length}\`);
2233
+
2234
+ // Analyze pool metrics
2235
+ const avgTvl = allPools.pools.reduce((sum, p) => sum + parseFloat(p.tvl), 0) / allPools.pools.length;
2236
+ console.log(\`Average TVL: $\${avgTvl.toFixed(2)}\`);
2237
+ }
2238
+ \`\`\`
2239
+
2240
+ **Key Features:**
2241
+ - **Sorting**: TVL (total value locked), volume30d (30-day volume), volume1d (24-hour volume)
2242
+ - **Pool Metrics**: Token prices, fee tiers, liquidity, 24h/30d volume, APR
2243
+ - **Auto-Pagination**: \`fetchAllDexPools()\` handles pagination automatically
2244
+ - **Search**: Filter by token name or pair
2245
+
2246
+ **MCP Tool Equivalents:**
2247
+ - \`gala_launchpad_fetch_dex_pools\`
2248
+ - \`gala_launchpad_fetch_all_dex_pools\`
1374
2249
  `,
1375
2250
  };
1376
2251
  /**
@@ -1378,7 +2253,7 @@ Provide liquidity on GalaSwap DEX and earn passive trading fees from swaps.
1378
2253
  */
1379
2254
  exports.explainSdkUsageTool = {
1380
2255
  name: 'gala_launchpad_explain_sdk_usage',
1381
- description: 'Get detailed SDK code examples for: buy-tokens, sell-tokens, pool-graduation, fetch-pools, balances, dex-trading, liquidity-positions, price-history, token-details, token-distribution, token-creation, profile-management, multi-wallet, transfers, error-handling, installation, local-calculations, mcp-to-sdk-mapping',
2256
+ description: 'Get detailed SDK code examples for all 78 SDK methods organized into 28 composite workflow topics covering: buy-tokens, sell-tokens, pool-graduation, fetch-pools, balances, dex-trading, liquidity-positions, advanced-dex-analysis, price-history, token-details, token-distribution, token-creation, profile-management, multi-wallet, transfers, locks, social-features, trading-analytics, utilities-and-helpers, error-handling, installation, local-calculations, spot-prices-smart-routing, and more',
1382
2257
  inputSchema: {
1383
2258
  type: 'object',
1384
2259
  properties: {
@@ -1392,6 +2267,7 @@ exports.explainSdkUsageTool = {
1392
2267
  'balances',
1393
2268
  'dex-trading',
1394
2269
  'liquidity-positions',
2270
+ 'advanced-dex-analysis',
1395
2271
  'price-history',
1396
2272
  'token-details',
1397
2273
  'token-distribution',
@@ -1399,10 +2275,20 @@ exports.explainSdkUsageTool = {
1399
2275
  'profile-management',
1400
2276
  'multi-wallet',
1401
2277
  'transfers',
2278
+ 'locks',
2279
+ 'social-features',
2280
+ 'trading-analytics',
2281
+ 'utilities-and-helpers',
1402
2282
  'error-handling',
1403
2283
  'installation',
1404
2284
  'local-calculations',
2285
+ 'spot-prices-smart-routing',
1405
2286
  'mcp-to-sdk-mapping',
2287
+ 'fetch-all-dex-seasons',
2288
+ 'fetch-current-dex-season',
2289
+ 'fetch-dex-leaderboard-by-season-id',
2290
+ 'fetch-current-dex-leaderboard',
2291
+ 'fetch-dex-aggregated-volume-summary',
1406
2292
  ],
1407
2293
  description: 'The SDK usage topic to explain',
1408
2294
  },
@@ -1417,7 +2303,7 @@ exports.explainSdkUsageTool = {
1417
2303
  return (0, response_formatter_js_1.formatSuccess)({
1418
2304
  topic: args.topic,
1419
2305
  explanation: example,
1420
- sdkVersion: '3.19.0',
2306
+ sdkVersion: '4.0.0',
1421
2307
  packageName: '@gala-chain/launchpad-sdk',
1422
2308
  documentation: 'https://www.npmjs.com/package/@gala-chain/launchpad-sdk',
1423
2309
  });