@gala-chain/launchpad-mcp-server 5.0.4-beta.2 → 5.0.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.
Files changed (258) hide show
  1. package/dist/generated/version.d.ts +1 -1
  2. package/dist/generated/version.d.ts.map +1 -1
  3. package/dist/generated/version.js +1 -1
  4. package/dist/generated/version.js.map +1 -1
  5. package/dist/index.js +3 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/prompts/analysis.js +12 -12
  8. package/dist/prompts/analysis.js.map +1 -1
  9. package/dist/prompts/api-keys.js +6 -6
  10. package/dist/prompts/api-keys.js.map +1 -1
  11. package/dist/prompts/balances.js +5 -5
  12. package/dist/prompts/balances.js.map +1 -1
  13. package/dist/prompts/bans.js +2 -2
  14. package/dist/prompts/bans.js.map +1 -1
  15. package/dist/prompts/bridge.js +4 -4
  16. package/dist/prompts/bridge.js.map +1 -1
  17. package/dist/prompts/burns.d.ts.map +1 -1
  18. package/dist/prompts/burns.js +6 -2
  19. package/dist/prompts/burns.js.map +1 -1
  20. package/dist/prompts/chat-messages.js +2 -2
  21. package/dist/prompts/chat-messages.js.map +1 -1
  22. package/dist/prompts/chat.js +1 -1
  23. package/dist/prompts/chat.js.map +1 -1
  24. package/dist/prompts/content-flags.js +9 -9
  25. package/dist/prompts/content-flags.js.map +1 -1
  26. package/dist/prompts/create-token.js +5 -5
  27. package/dist/prompts/create-token.js.map +1 -1
  28. package/dist/prompts/creation-utils.js +1 -1
  29. package/dist/prompts/creation-utils.js.map +1 -1
  30. package/dist/prompts/dex-leaderboard.js +1 -1
  31. package/dist/prompts/dex-leaderboard.js.map +1 -1
  32. package/dist/prompts/dex-trading.js +3 -3
  33. package/dist/prompts/dex-trading.js.map +1 -1
  34. package/dist/prompts/discover-tokens.js +5 -5
  35. package/dist/prompts/discover-tokens.js.map +1 -1
  36. package/dist/prompts/event-subscriptions.js +4 -4
  37. package/dist/prompts/event-subscriptions.js.map +1 -1
  38. package/dist/prompts/factories/balance-prompt-factory.js +2 -2
  39. package/dist/prompts/factories/balance-prompt-factory.js.map +1 -1
  40. package/dist/prompts/factories/ban-management-factory.js +14 -14
  41. package/dist/prompts/factories/ban-management-factory.js.map +1 -1
  42. package/dist/prompts/factories/calculation-prompt-factory.d.ts.map +1 -1
  43. package/dist/prompts/factories/calculation-prompt-factory.js +13 -8
  44. package/dist/prompts/factories/calculation-prompt-factory.js.map +1 -1
  45. package/dist/prompts/factories/discovery-prompt-factory.js +12 -12
  46. package/dist/prompts/factories/discovery-prompt-factory.js.map +1 -1
  47. package/dist/prompts/factories/event-subscription-factory.js +8 -8
  48. package/dist/prompts/factories/event-subscription-factory.js.map +1 -1
  49. package/dist/prompts/factories/filtered-list-prompt-factory.js +8 -8
  50. package/dist/prompts/factories/filtered-list-prompt-factory.js.map +1 -1
  51. package/dist/prompts/factories/invite-management-factory.d.ts.map +1 -1
  52. package/dist/prompts/factories/invite-management-factory.js +9 -8
  53. package/dist/prompts/factories/invite-management-factory.js.map +1 -1
  54. package/dist/prompts/factories/simple-operation-factory.d.ts.map +1 -1
  55. package/dist/prompts/factories/simple-operation-factory.js +17 -11
  56. package/dist/prompts/factories/simple-operation-factory.js.map +1 -1
  57. package/dist/prompts/liquidity-positions.js +4 -4
  58. package/dist/prompts/locks.js +4 -4
  59. package/dist/prompts/locks.js.map +1 -1
  60. package/dist/prompts/nft.js +16 -16
  61. package/dist/prompts/nft.js.map +1 -1
  62. package/dist/prompts/overseers.js +3 -3
  63. package/dist/prompts/overseers.js.map +1 -1
  64. package/dist/prompts/pools.js +8 -8
  65. package/dist/prompts/pools.js.map +1 -1
  66. package/dist/prompts/portfolio.js +6 -6
  67. package/dist/prompts/portfolio.js.map +1 -1
  68. package/dist/prompts/prompt-factories.d.ts.map +1 -1
  69. package/dist/prompts/prompt-factories.js +13 -10
  70. package/dist/prompts/prompt-factories.js.map +1 -1
  71. package/dist/prompts/referrals.js +12 -12
  72. package/dist/prompts/referrals.js.map +1 -1
  73. package/dist/prompts/streaming.js +3 -3
  74. package/dist/prompts/streaming.js.map +1 -1
  75. package/dist/prompts/tier1-bridge-operations.js +16 -16
  76. package/dist/prompts/tier1-bridge-operations.js.map +1 -1
  77. package/dist/prompts/tier1-liquidity-management.js +9 -9
  78. package/dist/prompts/tier1-liquidity-management.js.map +1 -1
  79. package/dist/prompts/tier1-pool-discovery.js +5 -5
  80. package/dist/prompts/tier1-pool-discovery.js.map +1 -1
  81. package/dist/prompts/tier1-price-history.js +6 -6
  82. package/dist/prompts/tier1-price-history.js.map +1 -1
  83. package/dist/prompts/tier1-token-analysis.js +4 -4
  84. package/dist/prompts/tier1-token-analysis.js.map +1 -1
  85. package/dist/prompts/tier2-account-setup.js +2 -2
  86. package/dist/prompts/tier2-account-setup.js.map +1 -1
  87. package/dist/prompts/tier2-advanced-liquidity.js +3 -3
  88. package/dist/prompts/tier2-asset-management.js +3 -3
  89. package/dist/prompts/tier2-asset-management.js.map +1 -1
  90. package/dist/prompts/tier2-token-lifecycle.js +2 -2
  91. package/dist/prompts/tier2-token-lifecycle.js.map +1 -1
  92. package/dist/prompts/tier3-community-engagement.js +2 -2
  93. package/dist/prompts/tier3-community-engagement.js.map +1 -1
  94. package/dist/prompts/tier3-moderation-workflows.js +1 -1
  95. package/dist/prompts/tier3-moderation-workflows.js.map +1 -1
  96. package/dist/prompts/trades.js +3 -3
  97. package/dist/prompts/trades.js.map +1 -1
  98. package/dist/prompts/trading-calculations.js +3 -3
  99. package/dist/prompts/trading-calculations.js.map +1 -1
  100. package/dist/prompts/trading.js +12 -12
  101. package/dist/prompts/trading.js.map +1 -1
  102. package/dist/prompts/utility-tools.js +2 -2
  103. package/dist/prompts/utility-tools.js.map +1 -1
  104. package/dist/prompts/utility.js +2 -2
  105. package/dist/prompts/utility.js.map +1 -1
  106. package/dist/prompts/utils/textTemplates.js +1 -1
  107. package/dist/prompts/utils/textTemplates.js.map +1 -1
  108. package/dist/prompts/utils/workflowTemplates.js +17 -17
  109. package/dist/prompts/utils/workflowTemplates.js.map +1 -1
  110. package/dist/prompts/wallet.js +1 -1
  111. package/dist/prompts/wallet.js.map +1 -1
  112. package/dist/schemas/common-schemas.d.ts +26 -4
  113. package/dist/schemas/common-schemas.d.ts.map +1 -1
  114. package/dist/schemas/common-schemas.js +25 -11
  115. package/dist/schemas/common-schemas.js.map +1 -1
  116. package/dist/scripts/test-all-prompts.d.ts +22 -0
  117. package/dist/scripts/test-all-prompts.d.ts.map +1 -0
  118. package/dist/scripts/test-all-prompts.js +205 -0
  119. package/dist/scripts/test-all-prompts.js.map +1 -0
  120. package/dist/server.d.ts.map +1 -1
  121. package/dist/server.js +43 -36
  122. package/dist/server.js.map +1 -1
  123. package/dist/tools/api-keys/index.js +3 -3
  124. package/dist/tools/api-keys/index.js.map +1 -1
  125. package/dist/tools/balance/index.js +2 -2
  126. package/dist/tools/balance/index.js.map +1 -1
  127. package/dist/tools/ban/index.js +1 -1
  128. package/dist/tools/ban/index.js.map +1 -1
  129. package/dist/tools/bridge/index.js +1 -1
  130. package/dist/tools/bridge/index.js.map +1 -1
  131. package/dist/tools/chat-messages/index.js +1 -1
  132. package/dist/tools/chat-messages/index.js.map +1 -1
  133. package/dist/tools/comments/index.js +1 -1
  134. package/dist/tools/comments/index.js.map +1 -1
  135. package/dist/tools/content-flags/index.js +2 -2
  136. package/dist/tools/content-flags/index.js.map +1 -1
  137. package/dist/tools/creation/index.d.ts.map +1 -1
  138. package/dist/tools/creation/index.js +16 -8
  139. package/dist/tools/creation/index.js.map +1 -1
  140. package/dist/tools/dex/helpers.d.ts +14 -14
  141. package/dist/tools/dex/helpers.d.ts.map +1 -1
  142. package/dist/tools/dex/helpers.js +54 -33
  143. package/dist/tools/dex/helpers.js.map +1 -1
  144. package/dist/tools/dex/index.js +1 -1
  145. package/dist/tools/dex-liquidity/index.d.ts.map +1 -1
  146. package/dist/tools/dex-liquidity/index.js +30 -19
  147. package/dist/tools/dex-liquidity/index.js.map +1 -1
  148. package/dist/tools/dex-pools/index.js +3 -3
  149. package/dist/tools/dex-pools/index.js.map +1 -1
  150. package/dist/tools/handler-factories.d.ts +1 -1
  151. package/dist/tools/handler-factories.js +16 -16
  152. package/dist/tools/handler-factories.js.map +1 -1
  153. package/dist/tools/moderators/index.js +2 -2
  154. package/dist/tools/moderators/index.js.map +1 -1
  155. package/dist/tools/nft/index.d.ts.map +1 -1
  156. package/dist/tools/nft/index.js.map +1 -1
  157. package/dist/tools/overseers/index.js +2 -2
  158. package/dist/tools/overseers/index.js.map +1 -1
  159. package/dist/tools/pagination-handler-factory.d.ts +2 -2
  160. package/dist/tools/pagination-handler-factory.d.ts.map +1 -1
  161. package/dist/tools/pagination-handler-factory.js +5 -5
  162. package/dist/tools/pagination-handler-factory.js.map +1 -1
  163. package/dist/tools/pools/fetchAllPools.d.ts.map +1 -1
  164. package/dist/tools/pools/fetchAllPools.js +6 -4
  165. package/dist/tools/pools/fetchAllPools.js.map +1 -1
  166. package/dist/tools/pools/fetchPools.js +3 -3
  167. package/dist/tools/pools/fetchPools.js.map +1 -1
  168. package/dist/tools/pools/fetchPriceHistory.js +2 -2
  169. package/dist/tools/pools/fetchPriceHistory.js.map +1 -1
  170. package/dist/tools/referrals/index.js +2 -2
  171. package/dist/tools/referrals/index.js.map +1 -1
  172. package/dist/tools/streaming/index.js +1 -1
  173. package/dist/tools/streaming/index.js.map +1 -1
  174. package/dist/tools/token-ban/index.js +3 -3
  175. package/dist/tools/token-ban/index.js.map +1 -1
  176. package/dist/tools/tool-factory.js +1 -1
  177. package/dist/tools/tool-factory.js.map +1 -1
  178. package/dist/tools/trades/index.d.ts.map +1 -1
  179. package/dist/tools/trades/index.js +4 -3
  180. package/dist/tools/trades/index.js.map +1 -1
  181. package/dist/tools/trading/helpers/arg-extractors.d.ts +2 -2
  182. package/dist/tools/trading/helpers/arg-extractors.d.ts.map +1 -1
  183. package/dist/tools/trading/helpers/arg-extractors.js +2 -2
  184. package/dist/tools/trading/helpers/arg-extractors.js.map +1 -1
  185. package/dist/tools/trading/index.js +1 -1
  186. package/dist/tools/trading/index.js.map +1 -1
  187. package/dist/tools/utils/clearCache.js +2 -2
  188. package/dist/tools/utils/clearCache.js.map +1 -1
  189. package/dist/tools/utils/explainSdkUsage.js +1 -1
  190. package/dist/tools/utils/explainSdkUsage.js.map +1 -1
  191. package/dist/tools/utils/getConfig.d.ts.map +1 -1
  192. package/dist/tools/utils/getConfig.js +3 -2
  193. package/dist/tools/utils/getConfig.js.map +1 -1
  194. package/dist/tools/utils/getEnvironment.d.ts.map +1 -1
  195. package/dist/tools/utils/getEnvironment.js +3 -2
  196. package/dist/tools/utils/getEnvironment.js.map +1 -1
  197. package/dist/tools/utils/getEthereumAddressFromPrivateKey.js.map +1 -1
  198. package/dist/tools/utils/getPublicKeyFromPrivateKey.js.map +1 -1
  199. package/dist/tools/utils/setWallet.js.map +1 -1
  200. package/dist/tools/utils/switchEnvironment.js +1 -1
  201. package/dist/tools/utils/switchEnvironment.js.map +1 -1
  202. package/dist/utils/date-converter.js +5 -5
  203. package/dist/utils/date-converter.js.map +1 -1
  204. package/dist/utils/default-values.d.ts +6 -6
  205. package/dist/utils/default-values.d.ts.map +1 -1
  206. package/dist/utils/default-values.js +5 -5
  207. package/dist/utils/default-values.js.map +1 -1
  208. package/dist/utils/error-templates.js +1 -1
  209. package/dist/utils/error-templates.js.map +1 -1
  210. package/dist/utils/pool-filter-builder.js +10 -10
  211. package/dist/utils/pool-filter-builder.js.map +1 -1
  212. package/dist/utils/response-formatter.js +1 -1
  213. package/dist/utils/tool-factory.d.ts.map +1 -1
  214. package/dist/utils/tool-factory.js +12 -4
  215. package/dist/utils/tool-factory.js.map +1 -1
  216. package/dist/utils/tool-registry.js +9 -9
  217. package/dist/utils/tool-registry.js.map +1 -1
  218. package/dist/utils/validation.js +1 -1
  219. package/dist/utils/validation.js.map +1 -1
  220. package/package.json +3 -3
  221. package/dist/ai-docs.json +0 -7714
  222. package/dist/explain-sdk-usage-ai.json +0 -3539
  223. package/dist/prompts/uploads.d.ts +0 -19
  224. package/dist/prompts/uploads.d.ts.map +0 -1
  225. package/dist/prompts/uploads.js +0 -114
  226. package/dist/prompts/uploads.js.map +0 -1
  227. package/dist/prompts/utils/index.d.ts +0 -21
  228. package/dist/prompts/utils/index.d.ts.map +0 -1
  229. package/dist/prompts/utils/index.js +0 -38
  230. package/dist/prompts/utils/index.js.map +0 -1
  231. package/dist/tools/bridge/helpers/bridgeable-token-tools.d.ts +0 -87
  232. package/dist/tools/bridge/helpers/bridgeable-token-tools.d.ts.map +0 -1
  233. package/dist/tools/bridge/helpers/bridgeable-token-tools.js +0 -130
  234. package/dist/tools/bridge/helpers/bridgeable-token-tools.js.map +0 -1
  235. package/dist/tools/dex/fetchAllDexPools.d.ts +0 -9
  236. package/dist/tools/dex/fetchAllDexPools.d.ts.map +0 -1
  237. package/dist/tools/dex/fetchAllDexPools.js +0 -38
  238. package/dist/tools/dex/fetchAllDexPools.js.map +0 -1
  239. package/dist/tools/dex/fetchDexPools.d.ts +0 -9
  240. package/dist/tools/dex/fetchDexPools.d.ts.map +0 -1
  241. package/dist/tools/dex/fetchDexPools.js +0 -41
  242. package/dist/tools/dex/fetchDexPools.js.map +0 -1
  243. package/dist/tools/dex/leaderboard.d.ts +0 -38
  244. package/dist/tools/dex/leaderboard.d.ts.map +0 -1
  245. package/dist/tools/dex/leaderboard.js +0 -88
  246. package/dist/tools/dex/leaderboard.js.map +0 -1
  247. package/dist/tools/dex/liquidity-positions.d.ts +0 -22
  248. package/dist/tools/dex/liquidity-positions.d.ts.map +0 -1
  249. package/dist/tools/dex/liquidity-positions.js +0 -599
  250. package/dist/tools/dex/liquidity-positions.js.map +0 -1
  251. package/dist/tools/dex/volume.d.ts +0 -19
  252. package/dist/tools/dex/volume.d.ts.map +0 -1
  253. package/dist/tools/dex/volume.js +0 -38
  254. package/dist/tools/dex/volume.js.map +0 -1
  255. package/dist/tools/pools/priceHistoryFactory.d.ts +0 -44
  256. package/dist/tools/pools/priceHistoryFactory.d.ts.map +0 -1
  257. package/dist/tools/pools/priceHistoryFactory.js +0 -154
  258. package/dist/tools/pools/priceHistoryFactory.js.map +0 -1
@@ -1,3539 +0,0 @@
1
- {
2
- "meta": {
3
- "version": "5.0.4-beta.2",
4
- "generatedAt": "2026-01-13T03:28:59.193Z",
5
- "topicCount": 49,
6
- "methodCount": 241
7
- },
8
- "topics": {
9
- "buy-tokens": {
10
- "key": "buy-tokens",
11
- "label": "Buy tokens",
12
- "description": "Buy tokens operations",
13
- "category": "trading",
14
- "methods": [
15
- "calculateBuyAmount",
16
- "buy"
17
- ],
18
- "mcpTools": [
19
- "gala_launchpad_calculate_buy_amount",
20
- "gala_launchpad_buy"
21
- ],
22
- "explanation": "\n## Buying Tokens with SDK\n\n**Covers Methods:**\n- `calculateBuyAmount()`\n- `buy()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function buyTokens() {\n // 1. Create SDK instance\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // 2. Calculate expected amounts FIRST (REQUIRED)\n const calculation = await sdk.calculateBuyAmount({\n tokenName: 'dragnrkti',\n amount: '100', // Spending 100 GALA\n type: 'native' // 'native' = GALA amount, 'exact' = token amount\n });\n\n console.log('Expected tokens:', calculation.amount);\n console.log('RBC Fee:', calculation.reverseBondingCurveFee);\n console.log('Transaction fee:', calculation.transactionFee);\n\n // 3. Execute buy with slippage protection\n const result = await sdk.buy({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native',\n expectedAmount: calculation.amount, // REQUIRED: from step 2\n maxAcceptableReverseBondingCurveFee: calculation.reverseBondingCurveFee, // RECOMMENDED\n slippageToleranceFactor: 0.01 // 1% slippage tolerance (REQUIRED)\n });\n\n console.log('Transaction ID:', result.transactionId);\n console.log('GALA spent:', result.inputAmount);\n console.log('Tokens received:', result.outputAmount);\n console.log('Total fees:', result.totalFees);\n}\n```\n\n**MCP Tool Equivalent:** `gala_launchpad_buy_tokens`\n",
23
- "samplePrompts": [
24
- "How do I buy tokens?",
25
- "Show me how to buy tokens with the SDK",
26
- "Explain the buy tokens workflow",
27
- "What methods do I need for buy tokens?"
28
- ]
29
- },
30
- "sell-tokens": {
31
- "key": "sell-tokens",
32
- "label": "Sell tokens",
33
- "description": "Sell tokens operations",
34
- "category": "trading",
35
- "methods": [
36
- "calculateSellAmount",
37
- "sell"
38
- ],
39
- "mcpTools": [
40
- "gala_launchpad_calculate_sell_amount",
41
- "gala_launchpad_sell"
42
- ],
43
- "explanation": "\n## Selling Tokens with SDK\n\n**Covers Methods:**\n- `calculateSellAmount()`\n- `sell()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function sellTokens() {\n // 1. Create SDK instance\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // 2. Calculate expected GALA FIRST (REQUIRED)\n const calculation = await sdk.calculateSellAmount({\n tokenName: 'dragnrkti',\n amount: '1000', // Selling 1000 tokens\n type: 'exact' // 'exact' = exact tokens, 'native' = target GALA amount\n });\n\n console.log('Expected GALA:', calculation.amount);\n console.log('RBC Fee:', calculation.reverseBondingCurveFee);\n\n // 3. Execute sell with slippage protection\n const result = await sdk.sell({\n tokenName: 'dragnrkti',\n amount: '1000',\n type: 'exact',\n expectedAmount: calculation.amount, // REQUIRED: from step 2\n maxAcceptableReverseBondingCurveFee: calculation.reverseBondingCurveFee, // RECOMMENDED\n slippageToleranceFactor: 0.01 // 1% slippage\n });\n\n console.log('Tokens sold:', result.inputAmount);\n console.log('GALA received:', result.outputAmount);\n}\n```\n\n**MCP Tool Equivalent:** `gala_launchpad_sell_tokens`\n",
44
- "samplePrompts": [
45
- "How do I sell tokens?",
46
- "Show me how to sell tokens with the SDK",
47
- "Explain the sell tokens workflow",
48
- "What methods do I need for sell tokens?"
49
- ]
50
- },
51
- "pool-graduation": {
52
- "key": "pool-graduation",
53
- "label": "Pool graduation",
54
- "description": "Pool graduation operations",
55
- "category": "trading",
56
- "methods": [
57
- "calculateBuyAmountForGraduation",
58
- "graduateToken"
59
- ],
60
- "mcpTools": [
61
- "gala_launchpad_calculate_buy_amount_for_graduation",
62
- "gala_launchpad_graduate_token"
63
- ],
64
- "explanation": "\n## Pool Graduation with SDK\n\n**Covers Methods:**\n- `calculateBuyAmountForGraduation()`\n- `graduateToken()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function graduatePool() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Option 1: Calculate graduation cost first (recommended)\n const calculation = await sdk.calculateBuyAmountForGraduation('dragnrkti');\n\n console.log('GALA cost to graduate:', calculation.amount);\n console.log('RBC Fee:', calculation.reverseBondingCurveFee);\n console.log('Transaction fee:', calculation.transactionFee);\n\n // Check if you have enough balance\n const balance = await sdk.fetchGalaBalance();\n // Use compareAmounts() instead of parseFloat for precision with currency amounts\n if (compareAmounts(balance.balance, calculation.amount) < 0) {\n throw new Error('Insufficient GALA balance');\n }\n\n // Option 2: One-step graduation (convenience method)\n const result = await sdk.graduateToken({\n tokenName: 'dragnrkti',\n slippageToleranceFactor: 0.01 // Optional: defaults to SDK config\n });\n\n console.log('Pool graduated!');\n console.log('Transaction ID:', result.transactionId);\n console.log('Total GALA spent:', result.inputAmount);\n console.log('Tokens received:', result.outputAmount);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_calculate_buy_amount_for_graduation`\n- `gala_launchpad_graduate_token`\n",
65
- "samplePrompts": [
66
- "How do I graduate token pools?",
67
- "Show me how to graduate token pools with the SDK",
68
- "Explain the graduate token pools workflow",
69
- "What methods do I need for graduate token pools?"
70
- ]
71
- },
72
- "fetch-pools": {
73
- "key": "fetch-pools",
74
- "label": "Fetch pools",
75
- "description": "Fetch pools operations",
76
- "category": "pools",
77
- "methods": [
78
- "fetchPools",
79
- "fetchAllPools",
80
- "fetchPoolDetails",
81
- "fetchPoolDetailsForCalculation",
82
- "fetchVolumeData",
83
- "fetchTokenPrice",
84
- "fetchTokenDistribution",
85
- "fetchTokenBadges",
86
- "resolveVaultAddress",
87
- "resolveTokenClassKey"
88
- ],
89
- "mcpTools": [
90
- "gala_launchpad_fetch_pools",
91
- "gala_launchpad_fetch_all_pools",
92
- "gala_launchpad_fetch_pool_details",
93
- "gala_launchpad_fetch_pool_details_for_calculation",
94
- "gala_launchpad_fetch_volume_data",
95
- "gala_launchpad_fetch_token_distribution",
96
- "gala_launchpad_fetch_token_badges",
97
- "gala_launchpad_resolve_vault_address",
98
- "gala_launchpad_resolve_token_class_key"
99
- ],
100
- "explanation": "\n## Fetching Pool Data with Advanced Methods\n\n**Covers Methods:**\n- `fetchPools()`\n- `fetchAllPools()`\n- `fetchPoolDetails()`\n- `fetchPoolDetailsForCalculation()`\n- `fetchVolumeData()`\n- `fetchTokenPrice()`\n- `fetchTokenDistribution()`\n- `fetchTokenBadges()`\n- `resolveVaultAddress()`\n- `resolveTokenClassKey()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\n// 1. BASIC POOL FETCHING - With Pagination\nasync function basicPoolFetching() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch recent pools with pagination\n const pools = await sdk.fetchPools({\n type: 'recent',\n limit: 10,\n page: 1\n });\n\n console.log(`Found ${pools.total} pools, page ${pools.page} of ${pools.totalPages}`);\n pools.pools.forEach(pool => {\n console.log(`${pool.tokenName}: ${pool.tokenSymbol}`);\n });\n}\n\n// 2. AUTO-PAGINATED FETCHING - Get ALL Pools\nasync function fetchAllPools() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Auto-paginated - returns all pools without manual pagination\n const allPools = await sdk.fetchAllPools({\n type: 'recent'\n });\n\n console.log(`Total pools: ${allPools.pools.length}`);\n}\n\n// 3. POOL DETAILS - Complete information\nasync function getPoolDetails(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const details = await sdk.fetchPoolDetails(tokenName);\n\n console.log('Sale status:', details.saleStatus); // 'Ongoing' or 'Completed'\n console.log('Base price:', details.basePrice);\n console.log('Max supply:', details.maxSupply);\n console.log('Remaining tokens:', details.sellingTokenQuantity);\n}\n\n// 4. POOL DETAILS FOR CALCULATIONS - Optimized for math\nasync function getOptimizedPoolDetails(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Returns only fields needed for bonding curve calculations\n const poolData = await sdk.fetchPoolDetailsForCalculation(tokenName);\n\n console.log('Current supply:', poolData.currentSupply);\n console.log('Remaining tokens:', poolData.remainingTokens);\n console.log('Max supply:', poolData.maxSupply);\n console.log('Reverse bonding curve max fee:', poolData.reverseBondingCurveMaxFeeFactor);\n}\n\n// 5. VOLUME & OHLCV DATA - Historical candlestick data\nasync function getVolumeData(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Different resolutions: '1m', '5m', '15m', '1h', '4h', '1d'\n const volumeData = await sdk.fetchVolumeData({\n tokenName: tokenName,\n from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), // Last 7 days\n to: new Date(),\n resolution: '1h' // 1-hour candlesticks\n });\n\n volumeData.forEach(candle => {\n console.log(`${candle.time}: O:${candle.open} H:${candle.high} L:${candle.low} C:${candle.close} V:${candle.volume}`);\n });\n}\n\n// 6. SPOT PRICES - DEX tokens (GALA, SILK, MUSIC)\nasync function getDexTokenPrices() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch prices for multiple DEX tokens\n const prices = await sdk.fetchTokenPrice(['GALA', 'SILK', 'MUSIC']);\n\n console.log(`GALA: $${prices.GALA}`);\n console.log(`SILK: $${prices.SILK}`);\n console.log(`MUSIC: $${prices.MUSIC}`);\n}\n\n// 7. LAUNCHPAD TOKEN SPOT PRICES (via smart router)\nasync function getLaunchpadTokenPrice(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get USD spot price for a launchpad token (anime, woohoo, etc.)\n const price = await sdk.fetchTokenPrice({ tokenName });\n\n console.log(`${tokenName} price: $${price.price}`);\n}\n\n// 8. RESOLVE UTILITY ADDRESSES\nasync function resolveAddresses(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get GalaChain vault address for token\n const vaultAddress = await sdk.resolveVaultAddress(tokenName);\n console.log(`Vault address: ${vaultAddress}`);\n\n // Get TokenClassKey for token\n const tokenClassKey = await sdk.resolveTokenClassKey(tokenName);\n console.log(`TokenClassKey: ${tokenClassKey}`);\n}\n\n// 9. COMPLETE INVESTMENT ANALYSIS WORKFLOW\nasync function analyzeToken(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get all token data in parallel\n const [details, volumeData, distribution, badges] = await Promise.all([\n sdk.fetchPoolDetails(tokenName),\n sdk.fetchVolumeData({ tokenName, resolution: '1d' }),\n sdk.fetchTokenDistribution(tokenName),\n sdk.fetchTokenBadges(tokenName)\n ]);\n\n // Analyze status\n console.log(`Pool Status: ${details.saleStatus}`);\n console.log(`Supply: ${details.currentSupply} / ${details.maxSupply}`);\n\n // Analyze volume trend\n // Note: For analytics/aggregation, we use safeParseFloat for performance. For trades, use BigNumber via SDK\n const volumes = volumeData.map(v => safeParseFloat(v.volume, 0));\n const avgVolume = volumes.reduce((a, b) => a + b, 0) / volumes.length;\n console.log(`Avg daily volume: $${toBigNumberFixed(avgVolume, 2)}`);\n\n // Analyze distribution\n // Use compareAmounts for precise balance comparisons\n const top5Ownership = distribution.holders\n .sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)\n .slice(0, 5)\n .reduce((sum, h) => sum + h.percentage, 0);\n console.log(`Top 5 holders: ${toBigNumberFixed(top5Ownership, 2)}%`);\n\n // Check badges\n console.log(`Badges: ${badges.join(', ')}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_pools` - Paginated pool list\n- `gala_launchpad_fetch_all_pools` - Auto-paginated all pools\n- `gala_launchpad_fetch_pool_details` - Complete pool information\n- `gala_launchpad_fetch_pool_details_for_calculation` - Optimized for calculations\n- `gala_launchpad_fetch_volume_data` - OHLCV candlestick data\n- `gala_launchpad_fetch_token_spot_price` - DEX token prices (GALA, SILK, MUSIC)\n- `gala_launchpad_fetch_launchpad_token_spot_price` - Launchpad token USD prices\n- `gala_launchpad_fetch_token_distribution` - Token holder analysis\n- `gala_launchpad_fetch_token_badges` - Achievement badges\n- `gala_launchpad_resolve_vault_address` - Get vault address\n- `gala_launchpad_resolve_token_class_key` - Get TokenClassKey\n",
101
- "samplePrompts": [
102
- "How do I fetch and search token pools?",
103
- "Show me how to fetch and search token pools with the SDK",
104
- "Explain the fetch and search token pools workflow",
105
- "What methods do I need for fetch and search token pools?"
106
- ]
107
- },
108
- "balances": {
109
- "key": "balances",
110
- "label": "Balances",
111
- "description": "Balances operations",
112
- "category": "balance",
113
- "methods": [
114
- "fetchGalaBalance",
115
- "fetchTokenBalance",
116
- "fetchTokensHeld",
117
- "fetchTokensCreated",
118
- "fetchAvailableBalance"
119
- ],
120
- "mcpTools": [
121
- "gala_launchpad_fetch_gala_balance",
122
- "gala_launchpad_fetch_token_balance",
123
- "gala_launchpad_fetch_tokens_held",
124
- "gala_launchpad_fetch_tokens_created",
125
- "gala_launchpad_fetch_available_balance"
126
- ],
127
- "explanation": "\n## Checking Balances with SDK\n\n**Covers Methods:**\n- `fetchGalaBalance()`\n- `fetchTokenBalance()`\n- `fetchTokensHeld()`\n- `fetchTokensCreated()`\n- `fetchProfile()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function checkBalances() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Check GALA balance\n const galaBalance = await sdk.fetchGalaBalance();\n console.log(`GALA: ${galaBalance.balance}`);\n console.log(`Decimals: ${galaBalance.decimals}`);\n console.log(`Last updated: ${galaBalance.lastUpdated.toISOString()}`);\n\n // Check specific token balance\n const tokenBalance = await sdk.fetchTokenBalance({\n tokenName: 'dragnrkti',\n address: sdk.getAddress()\n });\n\n console.log(`Token: ${tokenBalance.quantity}`);\n console.log(`USD value: $${tokenBalance.holdingPriceUsd}`);\n console.log(`GALA value: ${tokenBalance.holdingPriceGala}`);\n\n // Check all tokens held\n const portfolio = await sdk.fetchTokensHeld({\n address: sdk.getAddress(),\n limit: 20\n });\n\n console.log(`Holding ${portfolio.total} different tokens`);\n portfolio.tokens.forEach(token => {\n console.log(`${token.name}: ${token.quantity}`);\n });\n\n // Check tokens created by this wallet\n const createdTokens = await sdk.fetchTokensCreated({\n address: sdk.getAddress(),\n limit: 10\n });\n\n console.log(`Created ${createdTokens.total} tokens`);\n createdTokens.tokens.forEach(token => {\n console.log(` ${token.symbol}: ${token.name}`);\n });\n\n // Get user profile\n const profile = await sdk.fetchProfile();\n console.log(`Profile: ${profile.fullName}`);\n\n // Check profile of another user\n const otherProfile = await sdk.fetchProfile('eth|0x...');\n console.log(`Other user: ${otherProfile.fullName}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_gala_balance`\n- `gala_launchpad_fetch_token_balance`\n- `gala_launchpad_fetch_tokens_held`\n- `gala_launchpad_fetch_tokens_created`\n- `gala_launchpad_fetch_profile`\n- `gala_launchpad_fetch_available_balance`\n- `gala_launchpad_fetch_locked_tokens`\n\n### Available vs Locked Balance\n\n```typescript\n// Get available balance (excludes locked/escrowed tokens)\nconst available = await sdk.fetchAvailableBalance({\n tokenName: 'anime',\n address: walletAddress\n});\n\n// Get locked tokens with details\nconst locked = await sdk.fetchLockedTokens({\n tokenName: 'anime',\n address: walletAddress\n});\n\nconsole.log('Available:', available.quantity);\nconsole.log('Locked:', locked.lockedQuantity);\n```\n",
128
- "samplePrompts": [
129
- "How do I check token balances?",
130
- "Show me how to check token balances with the SDK",
131
- "Explain the check token balances workflow",
132
- "What methods do I need for check token balances?"
133
- ]
134
- },
135
- "token-creation": {
136
- "key": "token-creation",
137
- "label": "Token creation",
138
- "description": "Token creation operations",
139
- "category": "utils",
140
- "methods": [
141
- "isTokenNameAvailable",
142
- "isTokenSymbolAvailable",
143
- "fetchLaunchTokenFee",
144
- "uploadTokenImage",
145
- "launchToken"
146
- ],
147
- "mcpTools": [
148
- "gala_launchpad_fetch_launch_token_fee",
149
- "gala_launchpad_upload_token_image",
150
- "gala_launchpad_launch_token"
151
- ],
152
- "explanation": "\n## Creating Tokens with SDK\n\n**Covers Methods:**\n- `isTokenNameAvailable()`\n- `isTokenSymbolAvailable()`\n- `fetchLaunchTokenFee()`\n- `uploadTokenImage()`\n- `launchToken()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function launchToken() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // 1. Check if name/symbol available\n const nameAvailable = await sdk.isTokenNameAvailable('mytoken');\n const symbolAvailable = await sdk.isTokenSymbolAvailable('MTK');\n\n if (!nameAvailable || !symbolAvailable) {\n throw new Error('Name or symbol already taken');\n }\n\n // 2. Check launch fee\n const launchFee = await sdk.fetchLaunchTokenFee();\n console.log(`Launch fee: ${launchFee} GALA`);\n\n // 3. Upload token image (Node.js only)\n const imageUpload = await sdk.uploadTokenImage({\n tokenName: 'mytoken',\n imagePath: '/path/to/image.png'\n });\n\n // 4. Launch the token\n const result = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'My awesome token',\n tokenImage: imageUpload.imageUrl,\n websiteUrl: 'https://mytoken.com',\n twitterUrl: 'https://twitter.com/mytoken',\n preBuyQuantity: '100' // Optional: pre-buy with GALA\n });\n\n console.log('Token launched!');\n console.log('Transaction ID:', result.transactionId);\n\n // Get frontend URL\n const url = sdk.getUrlByTokenName('mytoken');\n console.log(`View at: ${url}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_check_token_name`\n- `gala_launchpad_check_token_symbol`\n- `gala_launchpad_fetch_launch_token_fee`\n- `gala_launchpad_upload_token_image`\n- `gala_launchpad_launch_token`\n- `gala_launchpad_get_url_by_token_name`\n",
153
- "samplePrompts": [
154
- "How do I create and launch new tokens?",
155
- "Show me how to create and launch new tokens with the SDK",
156
- "Explain the create and launch new tokens workflow",
157
- "What methods do I need for create and launch new tokens?"
158
- ]
159
- },
160
- "token-details": {
161
- "key": "token-details",
162
- "label": "Token details",
163
- "description": "Token details operations",
164
- "category": "pools",
165
- "methods": [
166
- "fetchTokenDetails"
167
- ],
168
- "mcpTools": [
169
- "gala_launchpad_fetch_token_details"
170
- ],
171
- "explanation": "\n## Token Details and Metadata with SDK\n\n**Covers Methods:**\n- `fetchTokenDetails()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function analyzeTokenDetails() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Fetch token metadata\n const details = await sdk.fetchTokenDetails('GUSDC|Unit|none|eth:0x...');\n\n console.log('Token Information:');\n console.log(` Name: ${details.name}`);\n console.log(` Symbol: ${details.symbol}`);\n console.log(` Decimals: ${details.decimals}`);\n console.log(` Verified: ${details.verified}`);\n console.log(` Trading: ${details.tradingEnabled}`);\n console.log(` Network: ${details.network}`);\n console.log(` Image: ${details.image}`);\n\n // Pre-trading validation\n async function validateBeforeTrade(tokenId: string) {\n const token = await sdk.fetchTokenDetails(tokenId);\n\n if (!token.verified) {\n console.warn(`⚠️ ${token.symbol} is NOT verified`);\n }\n\n if (!token.tradingEnabled) {\n throw new Error(`Trading disabled for ${token.symbol}`);\n }\n\n if (token.network !== 'ethereum') {\n throw new Error(`Wrong network: got ${token.network}`);\n }\n\n return token;\n }\n\n // Batch token comparison\n const tokens = ['GALA|Unit|none|none', 'GUSDC|Unit|none|eth:0x...'];\n const details_list = await Promise.all(\n tokens.map(id => sdk.fetchTokenDetails(id).catch(() => null))\n );\n\n const verified = details_list.filter(t => t?.verified).length;\n console.log(`Verified tokens: ${verified}/${tokens.length}`);\n}\n```\n\n**Response Fields:**\n- `symbol` - Token symbol (e.g., 'GUSDC')\n- `name` - Full token name\n- `decimals` - Decimal places\n- `verified` - Verification status\n- `tradingEnabled` - Trading availability\n- `network` - Network name (e.g., 'ethereum')\n- `contractAddress` - Smart contract address\n- `image` - Token image URL\n- `chainId` - Blockchain chain ID\n\n**Use Cases:**\n- Pre-trading validation and safety checks\n- Display token metadata in UI\n- Verify token authenticity\n- Network compatibility checking\n\n**Token ID Formats:**\n- String: `GUSDC|Unit|none|eth:0x...`\n- Object: `{ collection, category, type, additionalKey }`\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_token_details`\n",
172
- "samplePrompts": [
173
- "How do I get token details and information?",
174
- "Show me how to get token details and information with the SDK",
175
- "Explain the get token details and information workflow",
176
- "What methods do I need for get token details and information?"
177
- ]
178
- },
179
- "token-distribution": {
180
- "key": "token-distribution",
181
- "label": "Token distribution",
182
- "description": "Token distribution operations",
183
- "category": "pools",
184
- "methods": [
185
- "fetchTokenDistribution",
186
- "fetchUserHolderContext"
187
- ],
188
- "mcpTools": [
189
- "gala_launchpad_fetch_token_distribution",
190
- "gala_launchpad_fetch_user_holder_context"
191
- ],
192
- "explanation": "\n## Token Holder Distribution with SDK\n\n**Covers Methods:**\n- `fetchTokenDistribution()`\n- `fetchUserHolderContext()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function analyzeTokenDistribution() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Fetch complete token distribution (all holders, non-paginated)\n const distribution = await sdk.fetchTokenDistribution('anime');\n\n console.log(`Total holders: ${distribution.totalHolders}`);\n console.log(`Total supply: ${distribution.totalSupply}`);\n console.log(`Last updated: ${distribution.lastUpdated.toISOString()}`);\n\n // Analyze top holders\n // Use compareAmounts for precise balance sorting with large numbers\n distribution.holders\n .sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)\n .slice(0, 5)\n .forEach((holder, index) => {\n console.log(`#${index + 1}: ${holder.address}`);\n console.log(` Balance: ${holder.balance}`);\n console.log(` Ownership: ${toBigNumberFixed(holder.percentage, 2)}%`);\n });\n\n // Check concentration risk (e.g., top 5 holders own >80%)\n const top5Ownership = distribution.holders\n .sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)\n .slice(0, 5)\n .reduce((sum, holder) => sum + holder.percentage, 0);\n\n console.log(`Top 5 holders control: ${toBigNumberFixed(top5Ownership, 2)}%`);\n\n // Find specific holder\n const myAddress = sdk.getAddress();\n const myHolding = distribution.holders.find(h => h.address === myAddress);\n\n if (myHolding) {\n console.log(`Your ownership: ${toBigNumberFixed(myHolding.percentage, 4)}%`);\n console.log(`Your balance: ${myHolding.balance}`);\n }\n\n // Calculate concentration metrics\n const giniCoefficient = calculateGini(distribution.holders);\n console.log(`Gini coefficient: ${toBigNumberFixed(giniCoefficient, 4)}`);\n\n // Count whales (holders with >5%)\n const whales = distribution.holders.filter(h => h.percentage > 5);\n console.log(`Whales (>5%): ${whales.length}`);\n}\n\n// Helper: Calculate Gini coefficient for wealth distribution\nfunction calculateGini(holders: Array<{balance: string}>) {\n const balances = holders.map(h => safeParseFloat(h.balance, 0)).sort((a, b) => a - b);\n const n = balances.length;\n const sum = balances.reduce((a, b) => a + b, 0);\n\n let numerator = 0;\n for (let i = 0; i < n; i++) {\n numerator += (2 * (i + 1) - n - 1) * balances[i];\n }\n\n return numerator / (n * sum);\n}\n```\n\n**Key Characteristics:**\n- **Non-Paginated**: Returns ALL token holders in single response (no pagination)\n- **Complete Distribution**: Full holder list with addresses, balances, and ownership percentages\n- **BigNumber Precision**: Uses BigNumber.js for accurate percentage calculations\n- **Total Supply**: Computed from holder balances (sum of all holdings)\n- **Service Account Included**: Vault/service accounts appear in holder list\n\n**Use Cases:**\n- Analyze token concentration risk\n- Identify whale holders\n- Track ownership changes over time\n- Generate holder reports\n- Calculate distribution metrics (Gini coefficient, etc.)\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_token_distribution`\n\n---\n\n## User Holder Context (Single User Lookup)\n\n**Covers Methods:**\n- `fetchUserHolderContext()`\n\nUse this when you need holder info for a **specific user** rather than the full holder list.\nPerfect for user cards in comments/chat.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function getUserCard() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch single user's holder context for a token\n const holderContext = await sdk.fetchUserHolderContext('anime', 'eth|abc123...');\n\n // Response shape:\n // {\n // tokenName: 'anime',\n // userAddress: 'abc123...',\n // quantity: '25000' | null, // null if not a holder\n // percentage: 2.5 | null, // null if not a holder\n // rank: 3 | null, // 1-indexed rank (null if not a holder)\n // holderTier: { tier: 3, tierName: 'Major Holder' } | null,\n // isCreator: false\n // }\n\n if (holderContext.quantity !== null) {\n console.log(`Rank: #${holderContext.rank}`);\n console.log(`Holder Tier: ${holderContext.holderTier?.tierName}`);\n console.log(`Owns: ${holderContext.percentage ? toBigNumberFixed(holderContext.percentage, 4) : 'N/A'}%`);\n } else {\n console.log('User is not a holder of this token');\n }\n\n if (holderContext.isCreator) {\n console.log('This user created the token!');\n }\n}\n```\n\n**Holder Tiers (based on % of max supply):**\n| Tier | Name | Min % |\n|------|------|-------|\n| 5 | Whale | 5% |\n| 4 | Top Holder | 1% |\n| 3 | Major Holder | 0.1% |\n| 2 | Strong Holder | 0.01% |\n| 1 | Holder | 0.001% |\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_user_holder_context`\n",
193
- "samplePrompts": [
194
- "How do I analyze token distribution?",
195
- "Show me how to analyze token distribution with the SDK",
196
- "Explain the analyze token distribution workflow",
197
- "What methods do I need for analyze token distribution?"
198
- ]
199
- },
200
- "token-status": {
201
- "key": "token-status",
202
- "label": "Token status",
203
- "description": "Token status operations",
204
- "category": "utils",
205
- "methods": [
206
- "isTokenGraduated",
207
- "onDexPoolCreation",
208
- "onLaunchpadTokenCreation"
209
- ],
210
- "mcpTools": [
211
- "gala_launchpad_is_token_graduated",
212
- "gala_launchpad_on_dex_pool_creation",
213
- "gala_launchpad_on_launchpad_token_creation"
214
- ],
215
- "explanation": "\n## Token Status and Event Monitoring\n\n**Covers Methods:**\n- `isTokenGraduated()`\n- `onDexPoolCreation()`\n- `onLaunchpadTokenCreation()`\n\nCheck token graduation status and monitor real-time token/pool creation events.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function monitorTokenStatus() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // ============================================================================\n // CHECK GRADUATION STATUS - Determine if token is on DEX or bonding curve\n // ============================================================================\n\n // Check if token has graduated from bonding curve to DEX\n const isGraduated = await sdk.isTokenGraduated('anime');\n\n if (isGraduated) {\n console.log('Token has graduated to DEX - trade via GalaSwap');\n // Use DEX trading methods: executeSwap(), getSwapQuoteExactInput(), etc.\n } else {\n console.log('Token on bonding curve - trade via launchpad');\n // Use bonding curve methods: buy(), sell(), calculateBuyAmount(), etc.\n }\n\n // ============================================================================\n // MONITOR DEX POOL CREATION - Real-time notifications\n // ============================================================================\n\n // Set up listener for new DEX pools\n const cleanupDexPool = sdk.onDexPoolCreation((poolData) => {\n console.log('New DEX pool created!');\n console.log(` Token: ${poolData.tokenName}`);\n console.log(` Token0: ${poolData.token0}`);\n console.log(` Token1: ${poolData.token1}`);\n console.log(` Fee Tier: ${poolData.feeTier}`);\n console.log(` Initial TVL: ${poolData.tvl}`);\n\n // Take action on new pool\n // Example: Automatically provide liquidity or execute arbitrage\n });\n\n // ============================================================================\n // MONITOR TOKEN LAUNCHES - Real-time notifications\n // ============================================================================\n\n // Set up listener for new token launches\n const cleanupTokenCreation = sdk.onLaunchpadTokenCreation((tokenData) => {\n console.log('New token launched!');\n console.log(` Name: ${tokenData.tokenName}`);\n console.log(` Symbol: ${tokenData.tokenSymbol}`);\n console.log(` Creator: ${tokenData.creator}`);\n console.log(` Max Supply: ${tokenData.maxSupply}`);\n console.log(` Base Price: ${tokenData.basePrice}`);\n\n // Take action on new token\n // Example: Automatically buy early or analyze opportunity\n });\n\n // ============================================================================\n // COMPLETE WORKFLOW: Monitoring + Trading\n // ============================================================================\n\n async function autoTrade() {\n // Monitor new tokens\n sdk.onLaunchpadTokenCreation(async (token) => {\n console.log(`New token: ${token.tokenName}`);\n\n // Wait for graduation\n const checkGraduation = setInterval(async () => {\n const graduated = await sdk.isTokenGraduated(token.tokenName);\n\n if (graduated) {\n clearInterval(checkGraduation);\n console.log(`${token.tokenName} graduated! Switching to DEX trading.`);\n\n // Now use DEX methods instead of bonding curve\n const quote = await sdk.getSwapQuoteExactInput('GALA', token.tokenName, '100');\n console.log(`DEX quote: ${quote.estimatedOutput}`);\n }\n }, 60000); // Check every minute\n });\n\n // Monitor new DEX pools\n sdk.onDexPoolCreation(async (pool) => {\n console.log(`New pool: ${pool.tokenName}`);\n\n // Analyze liquidity opportunity\n const poolInfo = await sdk.getSwapPoolInfo(pool.token0, pool.token1);\n console.log(`Pool liquidity: ${poolInfo.liquidity}`);\n });\n }\n\n // Keep process running\n console.log('Monitoring events... Press Ctrl+C to stop');\n await new Promise(() => {}); // Run forever\n\n // Cleanup when done\n cleanupDexPool();\n cleanupTokenCreation();\n}\n```\n\n**Use Cases:**\n- **Arbitrage Bots**: Detect graduation events and switch trading strategies\n- **Early Bird Trading**: Monitor new token launches and trade immediately\n- **Liquidity Provision**: Detect new DEX pools and provide liquidity\n- **Portfolio Automation**: Automatically adjust positions on graduation\n- **Price Discovery**: Track token lifecycle from launch to DEX\n\n**Event Data:**\n- **DEX Pool Creation**: tokenName, token0, token1, feeTier, tvl, timestamp\n- **Token Launch**: tokenName, tokenSymbol, creator, maxSupply, basePrice, timestamp\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_is_token_graduated`\n- `gala_launchpad_on_dex_pool_creation` (WebSocket event)\n- `gala_launchpad_on_launchpad_token_creation` (WebSocket event)\n",
216
- "samplePrompts": [
217
- "How do I check token pool status?",
218
- "Show me how to check token pool status with the SDK",
219
- "Explain the check token pool status workflow",
220
- "What methods do I need for check token pool status?"
221
- ]
222
- },
223
- "multi-wallet": {
224
- "key": "multi-wallet",
225
- "label": "Multi wallet",
226
- "description": "Multi wallet operations",
227
- "category": "utils",
228
- "methods": [],
229
- "mcpTools": [],
230
- "explanation": "\n## Multi-Wallet Support with SDK\n\n**Covers Methods:**\n- `createWallet()` (utility function)\n- `buy()`, `sell()`, `launchToken()` with privateKey override\n\n```typescript\nimport { createLaunchpadSDK, createWallet } from '@gala-chain/launchpad-sdk';\n\nasync function multiWalletExample() {\n // Main SDK with your wallet\n const sdk = createLaunchpadSDK({\n wallet: 'your-main-private-key'\n });\n\n // Create a test wallet\n const testWallet = createWallet();\n console.log('Test wallet:', testWallet.address);\n\n // 1. Fund test wallet from main wallet\n await sdk.transferGala({\n recipientAddress: testWallet.address,\n amount: '1000'\n });\n\n // 2. Have test wallet buy tokens (using privateKey override)\n const buyCalc = await sdk.calculateBuyAmount({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native'\n });\n\n const buyResult = await sdk.buy({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native',\n expectedAmount: buyCalc.amount,\n slippageToleranceFactor: 0.01,\n privateKey: testWallet.privateKey // Override to use test wallet\n });\n\n console.log('Test wallet bought tokens');\n\n // 3. Check balances for both wallets\n const mainBalance = await sdk.fetchGalaBalance(); // Main wallet\n const testBalance = await sdk.fetchGalaBalance(testWallet.address); // Test wallet\n\n console.log(`Main wallet: ${mainBalance.balance} GALA`);\n console.log(`Test wallet: ${testBalance.balance} GALA`);\n}\n```\n\n**Key Points:**\n- All signing operations support `privateKey` parameter\n- Creates temporary SDK instance internally\n- Supports: buy, sell, launchToken, transfers, profile updates\n",
231
- "samplePrompts": [
232
- "How do I work with multiple wallets?",
233
- "Show me how to work with multiple wallets with the SDK",
234
- "Explain the work with multiple wallets workflow",
235
- "What methods do I need for work with multiple wallets?"
236
- ]
237
- },
238
- "transfers": {
239
- "key": "transfers",
240
- "label": "Transfers",
241
- "description": "Transfers operations",
242
- "category": "transfers",
243
- "methods": [
244
- "transferGala",
245
- "transferToken"
246
- ],
247
- "mcpTools": [
248
- "gala_launchpad_transfer_gala",
249
- "gala_launchpad_transfer_token"
250
- ],
251
- "explanation": "\n## Token Transfers with SDK\n\n**Covers Methods:**\n- `transferGala()`\n- `transferToken()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function transferTokens() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Transfer GALA tokens\n const galaTransfer = await sdk.transferGala({\n recipientAddress: '0x1234...', // or 'eth|1234...'\n amount: '100',\n uniqueKey: 'galaconnect-operation-my-transfer-123' // Optional idempotency\n });\n\n console.log('GALA transfer ID:', galaTransfer.transactionId);\n console.log('Status:', galaTransfer.status);\n\n // Transfer launchpad tokens\n const tokenTransfer = await sdk.transferToken({\n to: 'eth|5678...',\n tokenName: 'dragnrkti',\n amount: '1000', // Token amount\n uniqueKey: 'galaconnect-operation-token-456'\n });\n\n console.log('Token transfer ID:', tokenTransfer.transactionId);\n}\n```\n\n**Features:**\n- EIP-712 signatures for security\n- Supports both `0x` and `eth|` address formats\n- Optional idempotency keys prevent duplicates\n- Comprehensive validation\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_transfer_gala`\n- `gala_launchpad_transfer_token`\n",
252
- "samplePrompts": [
253
- "How do I transfer tokens?",
254
- "Show me how to transfer tokens with the SDK",
255
- "Explain the transfer tokens workflow",
256
- "What methods do I need for transfer tokens?"
257
- ]
258
- },
259
- "locks": {
260
- "key": "locks",
261
- "label": "Locks",
262
- "description": "Locks operations",
263
- "category": "locks",
264
- "methods": [
265
- "lockTokens",
266
- "unlockTokens",
267
- "burnTokens",
268
- "fetchLockedBalance"
269
- ],
270
- "mcpTools": [
271
- "gala_launchpad_lock_tokens",
272
- "gala_launchpad_unlock_tokens",
273
- "gala_launchpad_burn_tokens"
274
- ],
275
- "explanation": "\n## Token Locking, Unlocking, and Burning with SDK\n\n**Covers Methods:**\n- `lockTokens()` - Lock one or more token types in a single transaction\n- `unlockTokens()` - Unlock one or more token types in a single transaction\n- `burnTokens()` - Permanently destroy tokens (IRREVERSIBLE)\n- `fetchLockedBalance()` - Query locked token balances with hold details\n\nLock, unlock, and burn tokens on GalaChain for staking, escrow, vesting, or token management.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function tokenLockingAndBurning() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // ============================================================================\n // LOCK TOKENS - Single token (batch API wraps single token)\n // ============================================================================\n\n // Lock 1000 tokens with default options (caller is lock authority)\n const lockResult = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '1000'\n }]\n });\n\n console.log('Lock transaction ID:', lockResult.transactionId);\n console.log('Locked entries:', lockResult.locked);\n\n // ============================================================================\n // LOCK TOKENS - Multiple tokens in one transaction (batch)\n // ============================================================================\n\n // Lock multiple token types atomically\n const batchLock = await sdk.lockTokens({\n tokens: [\n { tokenName: 'anime', amount: '500' },\n { tokenName: 'dragon', amount: '200' },\n { tokenName: 'mystic', amount: '100', lockAuthority: 'eth|0x1234...' }\n ]\n });\n\n console.log('Batch lock completed:', batchLock.locked.length, 'tokens locked');\n\n // ============================================================================\n // LOCK TOKENS - Advanced options\n // ============================================================================\n\n // Lock with custom lock authority (another address can unlock)\n const escrowLock = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '500',\n lockAuthority: 'eth|0x1234...', // Escrow agent address\n name: 'escrow-payment-001', // Identifier for matching during unlock\n expires: Date.now() + 30 * 24 * 60 * 60 * 1000 // Auto-release in 30 days\n }]\n });\n\n console.log('Escrow lock created');\n\n // Lock for time-based vesting\n const vestingLock = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '10000',\n name: 'vesting-q1-2025',\n expires: new Date('2025-04-01').getTime() // Auto-unlock on April 1st\n }]\n });\n\n console.log('Vesting lock created with expiry');\n\n // ============================================================================\n // UNLOCK TOKENS - Release locked tokens\n // ============================================================================\n\n // Unlock tokens (must be called by lock authority)\n const unlockResult = await sdk.unlockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '500'\n }]\n });\n\n console.log('Unlock transaction ID:', unlockResult.transactionId);\n console.log('Unlocked entries:', unlockResult.unlocked);\n\n // Unlock multiple tokens in one transaction\n const batchUnlock = await sdk.unlockTokens({\n tokens: [\n { tokenName: 'anime', amount: '500' },\n { tokenName: 'dragon', amount: '200', name: 'escrow-payment-001' }\n ]\n });\n\n console.log('Batch unlock completed');\n\n // ============================================================================\n // BURN TOKENS - Permanently destroy (IRREVERSIBLE!)\n // ============================================================================\n\n // WARNING: Burn operations are permanent and cannot be undone!\n const burnResult = await sdk.burnTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '100'\n }]\n });\n\n console.log('Burn transaction ID:', burnResult.transactionId);\n console.log('Burned:', burnResult.burned);\n\n // Batch burn multiple token types\n const batchBurn = await sdk.burnTokens({\n tokens: [\n { tokenName: 'anime', amount: '50' },\n { tokenName: 'oldtoken', amount: '1000' } // Clean up deprecated tokens\n ]\n });\n\n console.log('Batch burn completed:', batchBurn.burned.length, 'token types burned');\n\n // ============================================================================\n // QUERY LOCKED TOKENS - Check lock status\n // ============================================================================\n\n const lockedTokens = await sdk.fetchLockedBalance({\n tokenName: 'anime',\n address: sdk.getAddress()\n });\n\n console.log('Locked quantity:', lockedTokens.lockedQuantity);\n console.log('Active holds:', lockedTokens.holds);\n\n // Each hold contains: lockAuthority, expires, name, quantity\n for (const hold of lockedTokens.holds) {\n console.log(` - ${hold.quantity} locked by ${hold.lockAuthority}`);\n if (hold.expires) console.log(` Expires: ${new Date(hold.expires)}`);\n if (hold.name) console.log(` Name: ${hold.name}`);\n }\n\n // ============================================================================\n // STAKING WORKFLOW EXAMPLE\n // ============================================================================\n\n async function stakingWorkflow() {\n // Step 1: Lock tokens for staking period\n const stake = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '5000',\n name: 'staking-period-1',\n expires: Date.now() + 90 * 24 * 60 * 60 * 1000 // 90-day staking period\n }]\n });\n\n console.log('Staked 5000 tokens for 90 days');\n\n // Step 2: After staking period expires, unlock\n const unstake = await sdk.unlockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '5000',\n name: 'staking-period-1'\n }]\n });\n\n console.log('Unstaked tokens after staking period');\n return { stake, unstake };\n }\n\n // ============================================================================\n // ESCROW WORKFLOW EXAMPLE\n // ============================================================================\n\n async function escrowWorkflow(buyerAddress: string, sellerAddress: string) {\n // Step 1: Buyer locks payment in escrow (seller is lock authority)\n const escrow = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '1000',\n lockAuthority: sellerAddress, // Seller can release upon delivery\n name: 'order-12345'\n }]\n });\n\n console.log('Escrow created: seller can release payment upon delivery');\n\n // Step 2: Seller releases escrow after delivery (seller calls unlock)\n // This would be executed by the seller's SDK instance\n // const release = await sellerSdk.unlockTokens({\n // tokens: [{ tokenName: 'anime', amount: '1000', name: 'order-12345' }]\n // });\n\n return escrow;\n }\n}\n```\n\n**Key Features:**\n- **Batch Operations**: Lock/unlock/burn multiple token types in one transaction\n- **Lock Authority**: Specify who can unlock (defaults to caller)\n- **Expiration**: Optional auto-release timestamp for time-based vesting\n- **Named Locks**: Use `name` to identify specific locks for targeted unlocks\n- **EIP-712 Signatures**: Secure blockchain transactions\n- **Error Handling**: `LockError` and `BurnError` classes with specific error types\n\n**Lock Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to lock (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to lock |\n| `lockAuthority` | No | Address that can unlock (defaults to caller) |\n| `expires` | No | Timestamp in ms for auto-unlock |\n| `name` | No | Identifier for matching during unlock |\n\n*Either `tokenName` or `tokenId` required\n\n**Unlock Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to unlock (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to unlock |\n| `name` | No | Lock name to match (if used during lock) |\n\n**Burn Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to burn (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to burn (PERMANENT!) |\n\n**Use Cases:**\n- **Staking**: Lock tokens for rewards/governance\n- **Escrow**: Third-party controlled releases\n- **Vesting**: Time-based token releases\n- **Governance**: Lock tokens for voting power\n- **Token Retirement**: Permanently burn deprecated tokens\n- **Deflationary Mechanics**: Reduce supply via burns\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_lock_tokens` (batch)\n- `gala_launchpad_unlock_tokens` (batch)\n- `gala_launchpad_burn_tokens` (batch)\n- `gala_launchpad_fetch_locked_tokens`\n",
276
- "samplePrompts": [
277
- "How do I lock and unlock tokens?",
278
- "Show me how to lock and unlock tokens with the SDK",
279
- "Explain the lock and unlock tokens workflow",
280
- "What methods do I need for lock and unlock tokens?"
281
- ]
282
- },
283
- "dex-trading": {
284
- "key": "dex-trading",
285
- "label": "Dex trading",
286
- "description": "Dex trading operations",
287
- "category": "dex",
288
- "methods": [
289
- "getSwapQuoteExactInput",
290
- "getSwapQuoteExactOutput",
291
- "executeSwap",
292
- "getSwapUserAssets",
293
- "getAllSwapUserAssets",
294
- "getSwapPoolInfo"
295
- ],
296
- "mcpTools": [
297
- "gala_launchpad_get_swap_quote_exact_input",
298
- "gala_launchpad_get_swap_quote_exact_output",
299
- "gala_launchpad_execute_swap",
300
- "gala_launchpad_get_swap_user_assets",
301
- "gala_launchpad_get_all_swap_user_assets",
302
- "gala_launchpad_get_swap_pool_info"
303
- ],
304
- "explanation": "\n## DEX Trading with SDK - GalaSwap Integration\n\n**Covers Methods:**\n- `getSwapQuoteExactInput()`\n- `getSwapQuoteExactOutput()`\n- `executeSwap()`\n- `getSwapUserAssets()`\n- `getAllSwapUserAssets()`\n- `getSwapPoolInfo()`\n\nTrade graduated tokens on the GalaSwap DEX with real-time WebSocket monitoring:\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function dexTradingExample() {\n // 1. Initialize SDK with wallet\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n env: 'production'\n });\n\n // ============================================================================\n // QUOTES: Get pricing information (read-only operations)\n // ============================================================================\n\n // Quote 1: Exact input (spend known GALA amount)\n const quoteIn = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');\n console.log('Spend 100 GALA → get ~' + quoteIn.estimatedOutput + ' GUSDC');\n console.log('Price impact: ' + quoteIn.priceImpact + '%');\n console.log('Fee tier: ' + quoteIn.feeTier + ' bps');\n\n // Quote 2: Exact output (get known token amount)\n const quoteOut = await sdk.getSwapQuoteExactOutput('GALA', 'GUSDC', '100');\n console.log('Get exactly 100 GUSDC → need ~' + quoteOut.inputAmount + ' GALA');\n\n // ============================================================================\n // EXECUTE: Perform the swap with slippage protection\n // ============================================================================\n\n const result = await sdk.executeSwap(\n 'GALA', // from token\n 'GUSDC', // to token\n '100', // input amount (100 GALA)\n quoteIn.estimatedOutput, // Use quote's output!\n quoteIn.feeTier, // Use quote's fee tier!\n 0.01 // 1% slippage tolerance\n );\n\n console.log('Transaction ID: ' + result.transactionId);\n console.log('Status: ' + result.status);\n console.log('Received: ' + result.outputAmount + ' ' + result.toToken);\n\n // ============================================================================\n // PORTFOLIO: Check balances and assets\n // ============================================================================\n\n const assets = await sdk.getSwapUserAssets(sdk.getEthereumAddress());\n console.log('Assets in wallet:');\n assets.forEach(asset => {\n console.log(' ' + asset.symbol + ': ' + asset.balance);\n });\n\n // ============================================================================\n // PORTFOLIO: Get ALL assets (auto-paginated)\n // ============================================================================\n\n const allAssets = await sdk.getAllSwapUserAssets(sdk.getEthereumAddress());\n console.log('Complete asset portfolio:');\n console.log('Total assets: ' + allAssets.length);\n allAssets.forEach(asset => {\n console.log(' ' + asset.symbol + ': ' + asset.balance);\n });\n\n // ============================================================================\n // POOL INFO: Check liquidity before trading\n // ============================================================================\n\n const pool = await sdk.getSwapPoolInfo('GALA', 'GUSDC');\n console.log('GALA↔GUSDC Pool Info:');\n console.log(' Liquidity: ' + pool.liquidity);\n console.log(' Available fee tiers: ' + pool.feeTiers.join(', ') + ' bps');\n console.log(' 24h swaps: ' + pool.swapCount);\n}\n```\n\n**Key Architecture:**\n- **Unified WebSocket**: Uses LaunchpadSDK's unified WebSocket for transaction monitoring\n- **Environment Alignment**: STAGE/PROD URLs must match between LaunchpadSDK and GSwapService\n- **Token Formats**:\n - **Launchpad bonding curve**: Use `tokenName` (lowercase simple symbols like 'anime', 'dragon')\n - **DEX trading**: Use `tokenId` (pipe-delimited format like 'GALA|Unit|none|none', 'GUSDC|Unit|none|eth:0x...')\n- **Slippage Protection**: Always use quote values for execution\n- **Fee Tiers**: 500 (0.05%), 3000 (0.30%), 10000 (1.00%)\n- **Auto-Pagination**: Use `getAllSwapUserAssets()` for complete portfolio\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_swap_quote_exact_input`\n- `gala_launchpad_get_swap_quote_exact_output`\n- `gala_launchpad_execute_swap`\n- `gala_launchpad_get_swap_user_assets`\n- `gala_launchpad_get_all_swap_user_assets`\n- `gala_launchpad_get_swap_pool_info`\n",
305
- "samplePrompts": [
306
- "How do I trade tokens on GalaSwap?",
307
- "Show me how to trade tokens on GalaSwap with the SDK",
308
- "Explain the trade tokens on GalaSwap workflow",
309
- "What methods do I need for trade tokens on GalaSwap?"
310
- ]
311
- },
312
- "error-handling": {
313
- "key": "error-handling",
314
- "label": "Error handling",
315
- "description": "Error handling operations",
316
- "category": "utils",
317
- "methods": [],
318
- "mcpTools": [],
319
- "explanation": "\n## Error Handling with SDK\n\n**Covers Methods:**\n- Error types from SDK (ValidationError, NetworkError, TransactionError, TokenNotFoundError, etc.)\n\n```typescript\nimport {\n createLaunchpadSDK,\n ValidationError,\n NetworkError,\n TransactionError,\n TokenNotFoundError\n} from '@gala-chain/launchpad-sdk';\n\nasync function errorHandlingExample() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n try {\n // Attempt trade\n const result = await sdk.buy({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native',\n expectedAmount: '5000',\n slippageToleranceFactor: 0.01\n });\n\n console.log('Success:', result.transactionId);\n\n } catch (error) {\n if (error instanceof ValidationError) {\n console.error('Invalid input:', error.message);\n console.error('Field:', error.field);\n console.error('Code:', error.code);\n\n } else if (error instanceof TokenNotFoundError) {\n console.error('Token does not exist:', error.tokenName);\n\n } else if (error instanceof NetworkError) {\n console.error('Network issue:', error.message);\n console.error('Status code:', error.statusCode);\n\n } else if (error instanceof TransactionError) {\n console.error('Transaction failed:', error.message);\n console.error('Transaction ID:', error.transactionId);\n\n } else {\n console.error('Unexpected error:', error);\n }\n }\n}\n```\n\n**Error Types:**\n- `ValidationError` - Invalid input parameters\n- `NetworkError` - HTTP/network failures\n- `TransactionError` - Blockchain transaction failures\n- `TokenNotFoundError` - Token doesn't exist\n- `ConfigurationError` - SDK misconfiguration\n- `WebSocketError` - Real-time connection issues\n",
320
- "samplePrompts": [
321
- "How do I handle SDK errors properly?",
322
- "Show me how to handle SDK errors properly with the SDK",
323
- "Explain the handle SDK errors properly workflow",
324
- "What methods do I need for handle SDK errors properly?"
325
- ]
326
- },
327
- "installation": {
328
- "key": "installation",
329
- "label": "Installation",
330
- "description": "Installation operations",
331
- "category": "utils",
332
- "methods": [],
333
- "mcpTools": [],
334
- "explanation": "\n## Installing and Importing SDK\n\n**Covers Methods:**\n- SDK installation, imports, and configuration\n\n### NPM Installation\n\n```bash\n# Install SDK\nnpm install @gala-chain/launchpad-sdk\n\n# Install peer dependencies\nnpm install ethers@^6.15.0 @gala-chain/api@^2.4.3 @gala-chain/connect@^2.4.3 \\\n socket.io-client@^4.8.1 axios@^1.12.2 bignumber.js@^9.1.2 zod@^3.25.76\n```\n\n### Import Patterns\n\n```typescript\n// Main SDK class\nimport { LaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\n// Helper functions (recommended)\nimport {\n createLaunchpadSDK,\n createTestLaunchpadSDK,\n createWallet,\n validateWalletInput\n} from '@gala-chain/launchpad-sdk';\n\n// Error types\nimport {\n ValidationError,\n NetworkError,\n TransactionError,\n TokenNotFoundError\n} from '@gala-chain/launchpad-sdk';\n\n// Type definitions\nimport type {\n PoolData,\n TradeResult,\n TokenBalanceInfo,\n BuyTokenOptions,\n SellTokenOptions\n} from '@gala-chain/launchpad-sdk';\n```\n\n### Environment Configuration\n\n```typescript\n// Production (default)\nconst sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: {\n baseUrl: 'https://lpad-backend-prod1.defi.gala.com',\n debug: false,\n timeout: 60000\n }\n});\n\n// Development\nconst sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: {\n baseUrl: 'https://lpad-backend-dev1.defi.gala.com',\n debug: true\n }\n});\n```\n",
335
- "samplePrompts": [
336
- "How do I install and configure the SDK?",
337
- "Show me how to install and configure the SDK with the SDK",
338
- "Explain the install and configure the SDK workflow",
339
- "What methods do I need for install and configure the SDK?"
340
- ]
341
- },
342
- "local-calculations": {
343
- "key": "local-calculations",
344
- "label": "Local calculations",
345
- "description": "Local calculations operations",
346
- "category": "trading",
347
- "methods": [
348
- "calculateBuyAmountLocal",
349
- "calculateSellAmountLocal",
350
- "calculateBuyAmountExternal",
351
- "calculateSellAmountExternal",
352
- "calculateInitialBuyAmount"
353
- ],
354
- "mcpTools": [
355
- "gala_launchpad_calculate_buy_amount_local",
356
- "gala_launchpad_calculate_sell_amount_local",
357
- "gala_launchpad_calculate_buy_amount_external",
358
- "gala_launchpad_calculate_sell_amount_external"
359
- ],
360
- "explanation": "\n## Local Bonding Curve Calculations with SDK\n\n**Covers Methods:**\n- `calculateBuyAmountLocal()`\n- `calculateSellAmountLocal()`\n- `calculateBuyAmountExternal()`\n- `calculateSellAmountExternal()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function localCalculationsExample() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // ============================================================================\n // LOCAL CALCULATIONS - Instant quotes without network calls\n // ============================================================================\n\n // 1. Buy calculation (local, instant)\n const localBuy = await sdk.calculateBuyAmountLocal({\n tokenName: 'dragnrkti',\n amount: '100', // Spending 100 GALA\n type: 'native' // 'native' = GALA amount, 'exact' = token amount\n });\n\n console.log('LOCAL Buy Quote (instant):');\n console.log(' Tokens received:', localBuy.amount);\n console.log(' Transaction fee:', localBuy.transactionFee);\n console.log(' RBC Fee:', localBuy.reverseBondingCurveFee); // Always \"0\" for buys\n console.log(' Gas fee:', localBuy.gasFee);\n\n // 2. Sell calculation (local, requires pool details)\n const poolDetails = await sdk.fetchPoolDetails('dragnrkti');\n\n const localSell = await sdk.calculateSellAmountLocal({\n tokenName: 'dragnrkti',\n amount: '1000', // Selling 1000 tokens\n type: 'exact',\n // Required parameters from pool details:\n maxSupply: poolDetails.maxSupply.toString(),\n minFeePortion: poolDetails.reverseBondingCurveMinFeeFactor || 0,\n maxFeePortion: poolDetails.reverseBondingCurveMaxFeeFactor || 0\n });\n\n console.log('LOCAL Sell Quote (instant):');\n console.log(' GALA received:', localSell.amount);\n console.log(' RBC Fee:', localSell.reverseBondingCurveFee);\n console.log(' Transaction fee:', localSell.transactionFee);\n\n // ============================================================================\n // EXTERNAL CALCULATIONS - Real-time network queries (explicit)\n // ============================================================================\n\n // 3. External buy (explicit network call)\n const externalBuy = await sdk.calculateBuyAmountExternal({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native'\n });\n\n console.log('EXTERNAL Buy Quote (network):');\n console.log(' Tokens received:', externalBuy.amount);\n\n // 4. External sell (explicit network call)\n const externalSell = await sdk.calculateSellAmountExternal({\n tokenName: 'dragnrkti',\n amount: '1000',\n type: 'exact'\n });\n\n console.log('EXTERNAL Sell Quote (network):');\n console.log(' GALA received:', externalSell.amount);\n\n // ============================================================================\n // A/B COMPARISON - Verify local accuracy\n // ============================================================================\n\n // Use compareAmounts for precise quote comparison\n const buyComparison = compareAmounts(localBuy.amount, externalBuy.amount);\n const buyDiff = Math.abs(safeParseNumber(localBuy.amount, 0) - safeParseNumber(externalBuy.amount, 0));\n const buyPct = (buyDiff / safeParseNumber(externalBuy.amount, 1)) * 100;\n\n console.log('Local vs External Accuracy:');\n console.log(` Buy difference: ${toBigNumberFixed(buyPct, 4)}% (should be <0.01%)`);\n\n // ============================================================================\n // PERFORMANCE BENEFIT - Local is instant\n // ============================================================================\n\n console.time('Local calculation');\n await sdk.calculateBuyAmountLocal({ tokenName: 'dragnrkti', amount: '100', type: 'native' });\n console.timeEnd('Local calculation'); // ~0ms (instant)\n\n console.time('External calculation');\n await sdk.calculateBuyAmountExternal({ tokenName: 'dragnrkti', amount: '100', type: 'native' });\n console.timeEnd('External calculation'); // ~200-500ms (network roundtrip)\n}\n```\n\n**Benefits of Local Calculations:**\n- ✅ Instant quotes (no network delay)\n- ✅ Offline support (no internet required)\n- ✅ No API rate limits\n- ✅ Perfect accuracy (<0.01% difference)\n- ✅ Reduced server load\n\n**When to Use:**\n- Local: Price discovery, UI updates, offline scenarios\n- External: Production trades (always verify before executing)\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_calculate_buy_amount_local`\n- `gala_launchpad_calculate_buy_amount_external`\n- `gala_launchpad_calculate_sell_amount_local`\n- `gala_launchpad_calculate_sell_amount_external`\n",
361
- "samplePrompts": [
362
- "How do I perform local calculations?",
363
- "Show me how to perform local calculations with the SDK",
364
- "Explain the perform local calculations workflow",
365
- "What methods do I need for perform local calculations?"
366
- ]
367
- },
368
- "price-history": {
369
- "key": "price-history",
370
- "label": "Price history",
371
- "description": "Price history operations",
372
- "category": "pools",
373
- "methods": [
374
- "fetchPriceHistory",
375
- "fetchAllPriceHistory"
376
- ],
377
- "mcpTools": [
378
- "gala_launchpad_fetch_price_history",
379
- "gala_launchpad_fetch_all_price_history"
380
- ],
381
- "explanation": "\n## Historical Price Analysis with SDK\n\n**Covers Methods:**\n- `fetchPriceHistory()`\n- `fetchAllPriceHistory()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function analyzePriceHistory() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Paginated price history\n const history = await sdk.fetchPriceHistory({\n tokenId: 'GUSDC|Unit|none|eth:0x...',\n from: new Date('2025-01-01'),\n to: new Date('2025-01-31'),\n sortOrder: 'DESC',\n page: 1,\n limit: 50\n });\n\n console.log(`Found ${history.snapshots.length} snapshots`);\n console.log(`Total available: ${history.total} (page ${history.page} of ${history.totalPages})`);\n\n // Auto-paginated complete history\n const allHistory = await sdk.fetchAllPriceHistory({\n tokenId: 'GWETH|Unit|none|none',\n from: new Date('2024-01-01'),\n sortOrder: 'ASC'\n });\n\n // Price analysis - Convert strings to numbers for statistical calculations\n // Note: For precise trading amounts, use compareAmounts() from SDK instead\n const prices = allHistory.snapshots.map(s => safeParseNumber(s.price, 0));\n const avg = prices.reduce((a, b) => a + b, 0) / prices.length;\n const variance = prices.reduce((sum, p) => sum + Math.pow(p - avg, 2), 0) / prices.length;\n const volatility = Math.sqrt(variance);\n\n console.log(`Average: $${toBigNumberFixed(avg, 4)}, Volatility: $${toBigNumberFixed(volatility, 4)}`);\n\n // Data export (CSV)\n const csv = ['timestamp,price'].concat(\n allHistory.snapshots.map(s => `${s.timestamp.toISOString()},${s.price}`)\n ).join('\\n');\n\n console.log('CSV export:', csv.split('\\n').slice(0, 3).join('\\n'));\n}\n```\n\n**Key Methods:**\n- `fetchPriceHistory()` - Paginated historical prices (max 50 per page)\n- `fetchAllPriceHistory()` - Auto-paginated complete history (all snapshots)\n\n**Response Fields:**\n- `price` - Token price as decimal string\n- `timestamp` - ISO 8601 timestamp\n- `tokenId` - Token identifier (pipe-delimited)\n\n**Use Cases:**\n- Technical analysis and charting\n- Volatility assessment\n- Price trend identification\n- Data export for analytics\n- Backtesting strategies\n\n**Token ID Formats:**\n- String: `GUSDC|Unit|none|eth:0x...`\n- Object: `{ collection, category, type, additionalKey }`\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_price_history` - Paginated\n- `gala_launchpad_fetch_all_price_history` - Auto-paginated\n",
382
- "samplePrompts": [
383
- "How do I view token price history?",
384
- "Show me how to view token price history with the SDK",
385
- "Explain the view token price history workflow",
386
- "What methods do I need for view token price history?"
387
- ]
388
- },
389
- "spot-prices-smart-routing": {
390
- "key": "spot-prices-smart-routing",
391
- "label": "Spot prices smart routing",
392
- "description": "Spot prices smart routing operations",
393
- "category": "utils",
394
- "methods": [
395
- "fetchTokenPrice",
396
- "getSwapPoolPrice"
397
- ],
398
- "mcpTools": [
399
- "gala_launchpad_get_swap_pool_price"
400
- ],
401
- "explanation": "\n## Smart Spot Price Routing with DEX Fallback\n\n**Covers Methods:**\n- `fetchTokenPrice()` (smart routing)\n- `isTokenGraduated()`\n\nThe SDK intelligently routes pricing requests between DEX and Launchpad backends based on token graduation status - no need to know which backend a token uses!\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function tokenPricing() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // OPTION 1: SMART ROUTING (Recommended) - Automatic backend selection\n // Use tokenId for ANY token (graduated or ungraduated)\n // SDK automatically detects and routes to correct backend\n console.log('=== Smart Routing (Recommended) ===');\n const smartPrice = await sdk.fetchTokenPrice({\n tokenId: 'Token|Unit|ANIME|eth:0x...' // Works for ANY token!\n });\n console.log(`Token price: $${smartPrice}`);\n // ✅ Handles graduated tokens (DEX) automatically\n // ✅ Handles ungraduated tokens (Launchpad) automatically\n // ✅ No need to know token status beforehand\n\n // OPTION 2: EXPLICIT DEX PRICING - Graduated tokens only\n // Use tokenId directly for DEX tokens\n console.log('\\n=== Explicit DEX Pricing ===');\n const dexPrices = await sdk.fetchTokenPrice({\n tokenId: 'GALA|Unit|none|none' // Or other DEX token\n });\n console.log(`DEX Token GALA: $${dexPrices}`);\n\n // OPTION 3: TOKEN NAME PRICING - For launchpad tokens by name\n // Use tokenName for simple lookup of launchpad tokens\n console.log('\\n=== Token Name Pricing ===');\n const launchpadPrice = await sdk.fetchTokenPrice({ tokenName: 'anime' });\n console.log(`Launchpad token anime: $${launchpadPrice.price}`);\n\n // ADVANCED: The smart router handles fallback automatically!\n // No need for manual fallback - fetchTokenPrice with tokenId detects\n // ungraduated tokens and automatically falls back to launchpad pricing\n console.log('\\n=== Automatic Fallback (Built-in) ===');\n const autoPrice = await sdk.fetchTokenPrice({\n tokenId: 'Token|Unit|ANIME|eth:0x...' // Auto-fallback if ungraduated\n });\n console.log(`Auto-routed price: $${autoPrice.price}`);\n\n // USECASE: Price comparison and discovery\n console.log('\\n=== Price Discovery ===');\n async function comparePrices(tokenName: string) {\n const launchpadPrice = await sdk.fetchTokenPrice({ tokenName });\n\n // Check if graduated (on DEX)\n const isGraduated = await sdk.isTokenGraduated(tokenName);\n\n if (isGraduated) {\n const dexPrice = await sdk.fetchTokenPrice({\n tokenId: `Token|Unit|${tokenName.toUpperCase()}|eth:0x...`\n });\n console.log(`Launchpad: $${launchpadPrice.price}, DEX: $${dexPrice.price}`);\n return { launchpadPrice, dexPrice, graduated: true };\n } else {\n console.log(`Launchpad: $${launchpadPrice.price} (not on DEX yet)`);\n return { launchpadPrice, graduated: false };\n }\n }\n\n const priceComparison = await comparePrices('anime');\n}\n```\n\n**Smart Routing Benefits:**\n- ✅ **Seamless Transitions** - Works before and after token graduation\n- ✅ **No Backend Knowledge** - SDK handles routing automatically\n- ✅ **Error Handling** - Automatic fallback if needed\n- ✅ **Single API** - Use same method for all tokens\n\n**When to Use Each Method:**\n\n| Method | Use Case | Token Status |\n|--------|----------|--------------|\n| `fetchTokenPrice({ tokenId })` | Smart routing (recommended) | Any (DEX or Launchpad) |\n| `fetchTokenPrice({ tokenName })` | Token name pricing | Any |\n| `isTokenGraduated(name)` | Check token status | Any |\n\n**Key Differences:**\n\n**Ungraduated Tokens (Launchpad):**\n- Priced on exponential bonding curve\n- Token name parameter works: `fetchTokenPrice({ tokenName: 'anime' })`\n- Price affected by supply/demand\n\n**Graduated Tokens (DEX):**\n- Priced on DEX via order books\n- Token ID format needed: `Token|Unit|SYMBOL|eth:0x...`\n- Market-driven pricing\n\n**Graduation Impact:**\nWhen a token graduates from launchpad to DEX:\n- Bonding curve closes\n- Trading moves to DEX order books\n- Smart routing automatically switches backends\n- Old launchpad queries will fail (use DEX pricing instead)\n\n**Error Handling:**\n```typescript\nasync function safePriceQuery(tokenId: string) {\n try {\n // Always try smart routing first\n return await sdk.fetchTokenPrice({ tokenId });\n } catch (error) {\n if (error.message.includes('not found')) {\n console.log('Token not available on DEX');\n // Could try fallback to launchpad pricing here\n }\n throw error;\n }\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_token_spot_price` - Smart routing\n- `gala_launchpad_fetch_launchpad_token_spot_price` - Launchpad-only\n- `gala_launchpad_is_token_graduated` - Check graduation status\n",
402
- "samplePrompts": [
403
- "How do I get token prices with smart routing?",
404
- "Show me how to get token prices with smart routing with the SDK",
405
- "Explain the get token prices with smart routing workflow",
406
- "What methods do I need for get token prices with smart routing?"
407
- ]
408
- },
409
- "profile-management": {
410
- "key": "profile-management",
411
- "label": "Profile management",
412
- "description": "Profile management operations",
413
- "category": "balance",
414
- "methods": [
415
- "fetchProfile",
416
- "updateProfile",
417
- "uploadProfileImage",
418
- "getManagedTokens"
419
- ],
420
- "mcpTools": [
421
- "gala_launchpad_fetch_profile",
422
- "gala_launchpad_update_profile",
423
- "gala_launchpad_upload_profile_image",
424
- "gala_launchpad_get_managed_tokens"
425
- ],
426
- "explanation": "\n## User Profile Management with SDK\n\n**Covers Methods:**\n- `fetchProfile()`\n- `updateProfile()`\n- `uploadProfileImage()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageUserProfiles() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Fetch current user profile\n const myProfile = await sdk.fetchProfile();\n console.log(`Name: ${myProfile.fullName}`);\n console.log(`Avatar: ${myProfile.profileImage}`);\n\n // Fetch another user's profile\n const other = await sdk.fetchProfile('eth|0x...');\n console.log(`Other user: ${other.fullName}`);\n\n // Update profile\n const updated = await sdk.updateProfile({\n fullName: 'Satoshi Nakamoto',\n profileImage: 'https://example.com/avatar.png',\n address: sdk.getAddress()\n });\n\n console.log(`Updated: ${updated.fullName}`);\n\n // Upload profile image (Node.js only)\n const imgResult = await sdk.uploadProfileImage({\n imagePath: '/path/to/avatar.png'\n });\n\n // Update with uploaded image\n await sdk.updateProfile({\n fullName: 'My Name',\n profileImage: imgResult.imageUrl,\n address: sdk.getAddress()\n });\n\n // Complete workflow: Update profile, then launch token\n async function createTokenWithProfile() {\n const avatar = await sdk.uploadProfileImage({\n imagePath: '/path/to/pic.png'\n });\n\n await sdk.updateProfile({\n fullName: 'Token Creator',\n profileImage: avatar.imageUrl,\n address: sdk.getAddress()\n });\n\n const logo = await sdk.uploadTokenImage({\n tokenName: 'mytoken',\n imagePath: '/path/to/logo.png'\n });\n\n const result = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'Awesome token',\n tokenImage: logo.imageUrl,\n websiteUrl: 'https://mytoken.com'\n });\n\n return result;\n }\n\n // Batch profile fetching\n const addresses = ['eth|0xaddress1', 'eth|0xaddress2'];\n const profiles = await Promise.all(\n addresses.map(addr => sdk.fetchProfile(addr).catch(() => null))\n );\n\n console.log('Profiles:', profiles.filter(p => p).map(p => p.fullName));\n}\n```\n\n**Profile Methods:**\n- `fetchProfile(address?)` - Get user profile\n- `updateProfile(data)` - Update profile info\n- `uploadProfileImage(options)` - Upload avatar (Node.js)\n- `getManagedTokens()` - Get tokens you manage (creator, moderator, manager, technical producer)\n\n**Profile Fields:**\n- `fullName` - Display name (max 100 chars)\n- `profileImage` - Avatar image URL\n- `address` - Wallet address\n- `createdAt` - Creation date\n- `updatedAt` - Update timestamp\n\n**Use Cases:**\n- Display user profiles\n- Allow profile customization\n- Manage profile images\n- Token creator attribution\n- Multi-wallet profiles\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_profile`\n- `gala_launchpad_update_profile`\n- `gala_launchpad_upload_profile_image`\n- `gala_launchpad_get_managed_tokens`\n",
427
- "samplePrompts": [
428
- "How do I manage user profiles?",
429
- "Show me how to manage user profiles with the SDK",
430
- "Explain the manage user profiles workflow",
431
- "What methods do I need for manage user profiles?"
432
- ]
433
- },
434
- "liquidity-positions": {
435
- "key": "liquidity-positions",
436
- "label": "Liquidity positions",
437
- "description": "Liquidity positions operations",
438
- "category": "utils",
439
- "methods": [
440
- "getSwapUserLiquidityPositions",
441
- "getAllSwapUserLiquidityPositions",
442
- "getSwapLiquidityPosition",
443
- "getSwapLiquidityPositionById",
444
- "addSwapLiquidityByPrice",
445
- "addSwapLiquidityByTicks",
446
- "getSwapEstimateRemoveLiquidity",
447
- "removeSwapLiquidity",
448
- "collectSwapPositionFees"
449
- ],
450
- "mcpTools": [],
451
- "explanation": "\n## GSwap Liquidity Position Management\n\n**Covers Methods:**\n- `getSwapUserLiquidityPositions()`\n- `getAllSwapUserLiquidityPositions()`\n- `getSwapLiquidityPosition()`\n- `getSwapLiquidityPositionById()`\n- `addSwapLiquidityByPrice()`\n- `addSwapLiquidityByTicks()`\n- `getSwapEstimateRemoveLiquidity()`\n- `removeSwapLiquidity()`\n- `collectSwapPositionFees()`\n\nProvide liquidity on GalaSwap DEX and earn passive trading fees from swaps.\n\n**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.\n\n**9 Core SDK Methods:**\n\n1. **getSwapUserLiquidityPositions(ownerAddress, limit?, bookmark?)** - View all open positions for wallet\n - Returns: Array of positions with token pairs, amounts, accumulated fees\n\n2. **getSwapLiquidityPositionById(ownerAddress, positionId)** - Get specific position by UUID\n\n3. **getSwapLiquidityPosition(ownerAddress, position)** - Get position by token pair and tick range\n\n4. **addSwapLiquidityByPrice(args)** - Create position using user-friendly price ranges\n - params: token0, token1, fee, minPrice, maxPrice, amount0Desired, amount1Desired\n\n5. **addSwapLiquidityByTicks(args)** - Create position using precise tick boundaries (advanced)\n\n6. **getSwapEstimateRemoveLiquidity(args)** - Preview removal amounts before executing\n - Returns: estimated token amounts and accumulated fees\n\n7. **removeSwapLiquidity(args)** - Close or reduce position with slippage protection\n - Removes liquidity and collects accumulated fees\n\n8. **collectSwapPositionFees(args)** - Harvest accumulated fees without closing position\n - Passive income collection\n\n**Fee Tiers:** 500 bps (0.05%), 3000 bps (0.30%), 10000 bps (1.00%)\n\n**MCP Tools (8 tools):**\n- gala_launchpad_get_user_liquidity_positions\n- gala_launchpad_get_liquidity_position_by_id\n- gala_launchpad_get_liquidity_position\n- gala_launchpad_add_liquidity_by_price\n- gala_launchpad_add_liquidity_by_ticks\n- gala_launchpad_estimate_remove_liquidity\n- gala_launchpad_remove_liquidity\n- gala_launchpad_collect_position_fees\n\n**Slash Commands (4 commands):**\n- /galachain-launchpad:my-positions - View all positions\n- /galachain-launchpad:add-liquidity - Create position\n- /galachain-launchpad:remove-liquidity - Close position\n- /galachain-launchpad:collect-fees - Harvest fees\n\n**Auto-Pagination Method:**\n\nUse `getAllSwapUserLiquidityPositions()` to fetch all positions without manual pagination:\n\n```typescript\n// Fetch ALL positions automatically (handles pagination internally)\nconst allPositions = await sdk.getAllSwapUserLiquidityPositions(ownerAddress);\n\nconsole.log(`Total positions: ${allPositions.length}`);\nallPositions.forEach(position => {\n const fees = position.fees0 + position.fees1; // Total accumulated fees\n console.log(`Position: ${position.token0}-${position.token1}`);\n console.log(`Accumulated fees: ${fees}`);\n});\n```\n\n**Demo Script:** See packages/sdk/examples/demo-liquidity-positions.ts for complete workflows\n",
452
- "samplePrompts": [
453
- "How do I manage liquidity positions?",
454
- "Show me how to manage liquidity positions with the SDK",
455
- "Explain the manage liquidity positions workflow",
456
- "What methods do I need for manage liquidity positions?"
457
- ]
458
- },
459
- "advanced-dex-analysis": {
460
- "key": "advanced-dex-analysis",
461
- "label": "Advanced dex analysis",
462
- "description": "Advanced dex analysis operations",
463
- "category": "dex-pools",
464
- "methods": [
465
- "fetchCompositePoolData",
466
- "calculateDexPoolQuoteExactAmountLocal",
467
- "calculateDexPoolQuoteExactAmountExternal",
468
- "calculateDexPoolQuoteExactAmount"
469
- ],
470
- "mcpTools": [
471
- "gala_launchpad_fetch_composite_pool_data"
472
- ],
473
- "explanation": "\n## Advanced DEX Pool Analysis with SDK\n\n**Covers Methods:**\n- `fetchCompositePoolData()`\n- `calculateDexPoolQuoteExactAmountLocal()`\n- `calculateDexPoolQuoteExactAmountExternal()`\n- `calculateDexPoolQuoteExactAmount()`\n\nThis workflow demonstrates analyzing graduated tokens using composite data and price calculations.\n\n**Use Cases:**\n- Arbitrage opportunity detection\n- Price impact analysis before large trades\n- Comparing bonding curve vs DEX pricing\n- Smart routing for best execution\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function advancedDexAnalysis() {\n const sdk = createLaunchpadSDK({ environment: 'production' });\n\n // Step 1: Get composite pool data (bonding curve + DEX if graduated)\n const composite = await sdk.fetchCompositePoolData('anime');\n\n if (composite.isGraduated) {\n console.log('Token graduated to DEX!');\n console.log('DEX Pool TVL:', composite.dexPool.tvl);\n console.log('DEX 24h Volume:', composite.dexPool.volume1d);\n }\n\n // Step 2: Compare local vs external price calculations\n const localQuote = await sdk.calculateDexPoolQuoteExactAmountLocal(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n const externalQuote = await sdk.calculateDexPoolQuoteExactAmountExternal(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n console.log('Local calculation:', localQuote.outputAmount);\n console.log('External API:', externalQuote.outputAmount);\n console.log('Price difference:',\n Math.abs(safeParseFloat(localQuote.outputAmount, 0) - safeParseFloat(externalQuote.outputAmount, 0))\n );\n\n // Step 3: Use smart routing for best price\n const bestQuote = await sdk.calculateDexPoolQuoteExactAmount(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n console.log('Best route:', bestQuote.route); // 'local' or 'external'\n console.log('Best price:', bestQuote.outputAmount);\n}\n```\n\n**MCP Tools:**\n- `gala_launchpad_fetch_composite_pool_data`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount_local`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount_external`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount`\n",
474
- "samplePrompts": [
475
- "How do I analyze DEX trading data?",
476
- "Show me how to analyze DEX trading data with the SDK",
477
- "Explain the analyze DEX trading data workflow",
478
- "What methods do I need for analyze DEX trading data?"
479
- ]
480
- },
481
- "trading-analytics": {
482
- "key": "trading-analytics",
483
- "label": "Trading analytics",
484
- "description": "Trading analytics operations",
485
- "category": "trading",
486
- "methods": [
487
- "fetchTrades",
488
- "getTrades"
489
- ],
490
- "mcpTools": [
491
- "gala_launchpad_fetch_trades",
492
- "gala_launchpad_get_trades"
493
- ],
494
- "explanation": "\n## Trading History and Analytics\n\n**Covers Methods:**\n- `fetchTrades()` - Legacy trade fetching by token\n- `getV1Trades()` - Flexible trade queries with tokenName/userAddress filters\n\nAnalyze individual trades for technical analysis and bot development.\n\n**Use Cases:**\n- Track recent trading activity\n- Calculate average trade size\n- Identify whale transactions\n- Build trading bots with historical data\n- Query a user's trading history across all tokens\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function tradingAnalytics() {\n const sdk = createLaunchpadSDK({ environment: 'production' });\n\n // Fetch recent trades for a token (legacy method)\n const trades = await sdk.fetchTrades('anime', {\n limit: 100,\n page: 1\n });\n\n console.log(`Analyzing ${trades.total} trades`);\n\n // Calculate analytics\n const totalVolume = trades.trades.reduce((sum, t) => sum + safeParseFloat(t.galaAmount, 0), 0);\n const averageTradeSize = totalVolume / trades.trades.length;\n const whaleTrades = trades.trades.filter(t => safeParseFloat(t.galaAmount, 0) > 1000);\n\n console.log(`Total volume: ${totalVolume} GALA`);\n console.log(`Average trade size: ${averageTradeSize} GALA`);\n console.log(`Whale trades (>1000 GALA): ${whaleTrades.length}`);\n\n // Most recent trades\n trades.trades.slice(0, 10).forEach(trade => {\n console.log(`${trade.type}: ${trade.galaAmount} GALA at ${trade.timestamp}`);\n });\n}\n\n// V1 Trades API - Flexible queries with filters\nasync function queryTradesV1() {\n const sdk = createLaunchpadSDK({ environment: 'production' });\n\n // Query all trades for a specific token\n const { trades, meta } = await sdk.getV1Trades({ tokenName: 'anime' });\n console.log(`Found ${meta.totalItems} trades for anime`);\n\n // Query all trades by a specific user\n const userTrades = await sdk.getV1Trades({\n userAddress: 'eth|1234567890abcdef...'\n });\n console.log(`User has ${userTrades.meta.totalItems} trades across all tokens`);\n\n // Query a user's trades on a specific token with pagination\n const filteredTrades = await sdk.getV1Trades({\n tokenName: 'anime',\n userAddress: 'eth|1234567890abcdef...',\n page: 2,\n limit: 20\n });\n console.log(`Page ${filteredTrades.meta.currentPage} of ${filteredTrades.meta.totalPages}`);\n\n // Analyze trade types\n filteredTrades.trades.forEach(trade => {\n console.log(`${trade.txnType}: ${trade.inputAmount} -> ${trade.outputAmount}`);\n });\n}\n```\n\n**Related Topics:**\n- See `fetch-pools` for volume data analysis\n- See `dex-trading` for executing trades\n\n**MCP Tools:**\n- `gala_launchpad_fetch_trades` - Legacy trade fetching\n- `gala_launchpad_get_v1_trades` - Flexible trade queries with filters\n",
495
- "samplePrompts": [
496
- "How do I analyze trading data?",
497
- "Show me how to analyze trading data with the SDK",
498
- "Explain the analyze trading data workflow",
499
- "What methods do I need for analyze trading data?"
500
- ]
501
- },
502
- "utilities-and-helpers": {
503
- "key": "utilities-and-helpers",
504
- "label": "Utilities and helpers",
505
- "description": "Utilities and helpers operations",
506
- "category": "utils",
507
- "methods": [
508
- "fetchGalaPrice",
509
- "fetchTokenClassesWithSupply",
510
- "calculateInitialBuyAmount",
511
- "getBundlerTransactionResult",
512
- "getSwapPoolPrice",
513
- "fetchSwapPositionDirect",
514
- "getAllSwapUserAssets",
515
- "cleanup",
516
- "clearCache",
517
- "getCacheInfo"
518
- ],
519
- "mcpTools": [
520
- "gala_launchpad_fetch_token_classes_with_supply",
521
- "gala_launchpad_get_bundler_transaction_result",
522
- "gala_launchpad_get_swap_pool_price",
523
- "gala_launchpad_fetch_swap_position_direct",
524
- "gala_launchpad_get_all_swap_user_assets",
525
- "gala_launchpad_cleanup",
526
- "gala_launchpad_clear_cache",
527
- "gala_launchpad_get_cache_info"
528
- ],
529
- "explanation": "\n## Utility Methods and Helpers\n\n**Covers Methods:**\n- `fetchGalaPrice()`\n- `fetchTokenClassesWithSupply()`\n- `calculateInitialBuyAmount()`\n- `getBundlerTransactionResult()`\n- `getSwapPoolPrice()`\n- `fetchSwapPositionDirect()`\n- `getAllSwapUserAssets()`\n- `cleanup()`\n\nEssential helper methods for development, debugging, and special use cases.\n\n### Price & Supply Queries\n\n```typescript\n// Get current GALA price in USD\nconst galaPrice = await sdk.fetchGalaPrice();\nconsole.log(`GALA: $${galaPrice}`);\n\n// Get token supply metrics from GalaChain\nconst supplies = await sdk.fetchTokenClassesWithSupply();\nsupplies.forEach(token => {\n console.log(`${token.tokenClass}: ${token.totalSupply}`);\n});\n```\n\n### Transaction Monitoring\n\n```typescript\n// Check transaction status\nconst status = await sdk.getBundlerTransactionResult('tx-id-123');\nconsole.log('Status:', status.status); // 'pending' | 'success' | 'failed'\n```\n\n### Advanced Swap Queries\n\n```typescript\n// Get pool price without full quote\nconst price = await sdk.getSwapPoolPrice('GALA|Unit|none|none', 'GUSDC|Unit|none|none');\nconsole.log(`Pool price: ${price}`);\n\n// Auto-paginated asset fetch\nconst allAssets = await sdk.getAllSwapUserAssets('eth|0x...', { limit: 100 });\nconsole.log(`Total assets: ${allAssets.length}`);\n\n// Direct position lookup (if you have compound key)\nconst position = await sdk.fetchSwapPositionDirect({\n owner: 'eth|0x...',\n token0: 'GALA|Unit|none|none',\n token1: 'GUSDC|Unit|none|none',\n feeTier: 3000\n});\n```\n\n### Launch Calculations\n\n```typescript\n// Calculate initial buy amount for token launch\nconst buyAmount = await sdk.calculateInitialBuyAmount('100');\nconsole.log(`Initial buy: ${buyAmount} tokens`);\n```\n\n### SDK Cleanup\n\n```typescript\n// Proper cleanup when done (closes connections)\nawait sdk.cleanup();\n```\n\n### Monitor Bundler Transactions\n\n```typescript\n// After a trade, monitor transaction status\nconst tradeResult = await sdk.buy({ tokenName, amount, type: 'native', expectedAmount, slippageToleranceFactor: 0.01 });\n\n// Poll for completion\nconst status = await sdk.getBundlerTransactionResult(tradeResult.transactionId);\nconsole.log('Status:', status.status); // PENDING, PROCESSING, COMPLETED, FAILED\n\n// Wait with polling\nlet attempts = 0;\nwhile (status.status === 'PENDING' || status.status === 'PROCESSING') {\n await new Promise(r => setTimeout(r, 2000));\n const updated = await sdk.getBundlerTransactionResult(tradeResult.transactionId);\n if (updated.status === 'COMPLETED') break;\n if (++attempts > 30) throw new Error('Transaction timeout');\n}\n```\n\n**MCP Tools:**\n- `gala_launchpad_fetch_gala_price`\n- `gala_launchpad_fetch_token_classes_with_supply`\n- `gala_launchpad_calculate_initial_buy_amount`\n- `gala_launchpad_get_bundler_transaction_result`\n- `gala_launchpad_get_swap_pool_price`\n- `gala_launchpad_fetch_swap_position_direct`\n- `gala_launchpad_get_all_swap_user_assets`\n",
530
- "samplePrompts": [
531
- "How do I use SDK utilities and helpers?",
532
- "Show me how to use SDK utilities and helpers with the SDK",
533
- "Explain the use SDK utilities and helpers workflow",
534
- "What methods do I need for use SDK utilities and helpers?"
535
- ]
536
- },
537
- "utilities-system": {
538
- "key": "utilities-system",
539
- "label": "Utilities system",
540
- "description": "Utilities system operations",
541
- "category": "wallet",
542
- "methods": [
543
- "getAddress",
544
- "getConfig",
545
- "getEthereumAddress",
546
- "getUrlByTokenName",
547
- "getVersion",
548
- "getWallet",
549
- "hasWallet",
550
- "setWallet",
551
- "connectWebSocket",
552
- "disconnectWebSocket",
553
- "isWebSocketConnected"
554
- ],
555
- "mcpTools": [
556
- "gala_launchpad_get_address",
557
- "gala_launchpad_get_config",
558
- "gala_launchpad_get_ethereum_address",
559
- "gala_launchpad_get_url_by_token_name",
560
- "gala_launchpad_get_version",
561
- "gala_launchpad_get_wallet",
562
- "gala_launchpad_has_wallet",
563
- "gala_launchpad_set_wallet"
564
- ],
565
- "explanation": "\n## SDK Configuration and Wallet Utilities\n\n**Covers Methods:**\n- `getAddress()`\n- `getConfig()`\n- `getEthereumAddress()`\n- `getUrlByTokenName()`\n- `getVersion()`\n- `getWallet()`\n- `hasWallet()`\n- `setWallet()`\n\nEssential utilities for SDK configuration, wallet management, and system information.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function sdkUtilities() {\n // ============================================================================\n // ADDRESS MANAGEMENT - Get wallet addresses in different formats\n // ============================================================================\n\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get GalaChain address (eth|0x... format)\n const galaAddress = sdk.getAddress();\n console.log(`GalaChain address: ${galaAddress}`); // \"eth|0x1234...\"\n\n // Get Ethereum address (0x... format)\n const ethAddress = sdk.getEthereumAddress();\n console.log(`Ethereum address: ${ethAddress}`); // \"0x1234...\"\n\n // ============================================================================\n // WALLET MANAGEMENT - Check and update wallet\n // ============================================================================\n\n // Check if SDK has wallet configured\n if (sdk.hasWallet()) {\n console.log('Wallet configured - can execute trades');\n\n // Get wallet instance (for advanced use)\n const wallet = sdk.getWallet();\n console.log(`Wallet address: ${wallet.address}`);\n } else {\n console.log('Read-only mode - cannot execute trades');\n }\n\n // Update wallet at runtime\n sdk.setWallet('new-private-key');\n console.log(`New address: ${sdk.getAddress()}`);\n\n // ============================================================================\n // CONFIGURATION ACCESS - Get SDK config\n // ============================================================================\n\n // Get SDK configuration\n const config = sdk.getConfig();\n console.log(`Base URL: ${config.baseUrl}`);\n console.log(`Environment: ${config.env}`);\n console.log(`Debug: ${config.debug}`);\n console.log(`Timeout: ${config.timeout}ms`);\n\n // ============================================================================\n // VERSION INFORMATION - Get SDK version\n // ============================================================================\n\n // Get SDK version\n const version = sdk.getVersion();\n console.log(`SDK Version: ${version}`); // \"4.0.4-beta.0\"\n\n // ============================================================================\n // URL GENERATION - Get frontend URLs for tokens\n // ============================================================================\n\n // Generate frontend URL for token\n const url = sdk.getUrlByTokenName('anime');\n console.log(`Token URL: ${url}`);\n // \"https://launchpad.gala.com/token/anime\" (production)\n // \"https://lpad-dev1.defi.gala.com/token/anime\" (development)\n\n // Complete workflow: Launch token + share URL\n const launchResult = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'My awesome token'\n });\n\n const tokenUrl = sdk.getUrlByTokenName('mytoken');\n console.log(`Share your token: ${tokenUrl}`);\n\n // ============================================================================\n // MULTI-WALLET SCENARIO - Check multiple addresses\n // ============================================================================\n\n async function compareWallets() {\n const wallet1 = createLaunchpadSDK({ wallet: 'private-key-1' });\n const wallet2 = createLaunchpadSDK({ wallet: 'private-key-2' });\n\n console.log(`Wallet 1: ${wallet1.getAddress()}`);\n console.log(`Wallet 2: ${wallet2.getAddress()}`);\n\n // Compare balances\n const balance1 = await wallet1.fetchGalaBalance();\n const balance2 = await wallet2.fetchGalaBalance();\n\n console.log(`Wallet 1 balance: ${balance1.balance}`);\n console.log(`Wallet 2 balance: ${balance2.balance}`);\n }\n\n // ============================================================================\n // READ-ONLY SDK - Public data without wallet\n // ============================================================================\n\n async function readOnlyMode() {\n // Create SDK without wallet (read-only mode)\n const readOnlySdk = createLaunchpadSDK();\n\n console.log(`Has wallet: ${readOnlySdk.hasWallet()}`); // false\n\n // Can fetch public data\n const pools = await readOnlySdk.fetchPools({ type: 'recent', limit: 10 });\n console.log(`Found ${pools.total} pools`);\n\n // Cannot execute trades (will throw error)\n try {\n await readOnlySdk.buy({ tokenName: 'anime', amount: '100', type: 'native' });\n } catch (error) {\n console.error('Cannot trade without wallet');\n }\n }\n\n // ============================================================================\n // ENVIRONMENT SWITCHING - Change environments at runtime\n // ============================================================================\n\n async function switchEnvironments() {\n // Production SDK\n const prodSdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: { env: 'production' }\n });\n\n console.log(`Prod config: ${prodSdk.getConfig().baseUrl}`);\n console.log(`Prod URL: ${prodSdk.getUrlByTokenName('anime')}`);\n\n // Development SDK\n const devSdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: { env: 'development' }\n });\n\n console.log(`Dev config: ${devSdk.getConfig().baseUrl}`);\n console.log(`Dev URL: ${devSdk.getUrlByTokenName('anime')}`);\n }\n}\n```\n\n**Key Methods:**\n\n| Method | Returns | Use Case |\n|--------|---------|----------|\n| `getAddress()` | GalaChain address (eth|0x...) | Trading, transfers, profile |\n| `getEthereumAddress()` | Ethereum address (0x...) | DEX trading, external systems |\n| `getConfig()` | SDK configuration object | Debug, environment info |\n| `getVersion()` | SDK version string | Compatibility checks |\n| `getUrlByTokenName()` | Frontend URL | Share token pages |\n| `getWallet()` | Wallet instance | Advanced wallet operations |\n| `hasWallet()` | Boolean | Check if trades enabled |\n| `setWallet()` | void | Update wallet at runtime |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_address`\n- `gala_launchpad_get_ethereum_address`\n- `gala_launchpad_get_config`\n- `gala_launchpad_get_version`\n- `gala_launchpad_get_url_by_token_name`\n",
566
- "samplePrompts": [
567
- "How do I access system utilities?",
568
- "Show me how to access system utilities with the SDK",
569
- "Explain the access system utilities workflow",
570
- "What methods do I need for access system utilities?"
571
- ]
572
- },
573
- "fetch-all-dex-seasons": {
574
- "key": "fetch-all-dex-seasons",
575
- "label": "Fetch all dex seasons",
576
- "description": "Fetch all dex seasons operations",
577
- "category": "dex-analytics",
578
- "methods": [
579
- "fetchAllDexSeasons"
580
- ],
581
- "mcpTools": [
582
- "gala_launchpad_fetch_all_dex_seasons"
583
- ],
584
- "explanation": "\n## DEX Leaderboard Seasons Management\n\n**Covers Methods:**\n- `fetchAllDexSeasons()`\n- `fetchCurrentDexSeason()`\n\nDiscover and manage DEX leaderboard seasons for competitive trading events.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageDexSeasons() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch all available seasons\n const seasons = await sdk.fetchAllDexSeasons();\n\n // Display season information\n seasons.forEach(season => {\n console.log(`Season: ${season.name} (ID: ${season.id})`);\n console.log(`Duration: ${season.start} to ${season.end}`);\n });\n\n // Get current season\n const activeSeason = await sdk.fetchCurrentDexSeason();\n if (activeSeason) {\n console.log(`Active: ${activeSeason.name}`);\n } else {\n console.log('No active season (between seasons)');\n }\n\n // Verify season is active\n const now = new Date();\n const isActive = activeSeason && now >= activeSeason.start && now <= activeSeason.end;\n console.log(`Season active: ${isActive}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_all_dex_seasons`\n- `gala_launchpad_fetch_current_dex_season`\n",
585
- "samplePrompts": [
586
- "How do I fetch DEX leaderboard seasons?",
587
- "Show me how to fetch DEX leaderboard seasons with the SDK",
588
- "Explain the fetch DEX leaderboard seasons workflow",
589
- "What methods do I need for fetch DEX leaderboard seasons?"
590
- ]
591
- },
592
- "fetch-current-dex-season": {
593
- "key": "fetch-current-dex-season",
594
- "label": "Fetch current dex season",
595
- "description": "Fetch current dex season operations",
596
- "category": "dex-analytics",
597
- "methods": [
598
- "fetchCurrentDexSeason"
599
- ],
600
- "mcpTools": [
601
- "gala_launchpad_fetch_current_dex_season"
602
- ],
603
- "explanation": "\n## Fetch Current DEX Season\n\n**Covers Methods:**\n- `fetchCurrentDexSeason()`\n\nGet the currently active DEX leaderboard season for competitive trading.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function getCurrentSeason() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch the current active season\n const currentSeason = await sdk.fetchCurrentDexSeason();\n\n if (currentSeason) {\n console.log('Current DEX Season:');\n console.log(` Season ID: ${currentSeason.id}`);\n console.log(` Name: ${currentSeason.name}`);\n console.log(` Start: ${currentSeason.start.toISOString()}`);\n console.log(` End: ${currentSeason.end.toISOString()}`);\n\n // Check if season is currently active\n const now = new Date();\n const isActive = now >= currentSeason.start && now <= currentSeason.end;\n\n console.log(` Active: ${isActive}`);\n\n // Calculate time remaining\n const timeRemaining = currentSeason.end.getTime() - now.getTime();\n const daysRemaining = Math.floor(timeRemaining / (1000 * 60 * 60 * 24));\n\n console.log(` Days remaining: ${daysRemaining}`);\n\n // Fetch leaderboard for current season\n const leaderboard = await sdk.fetchDexLeaderboardBySeasonId(currentSeason.id);\n console.log(` Total participants: ${leaderboard.entries.length}`);\n\n // Show top 3 players\n leaderboard.entries.slice(0, 3).forEach((entry, index) => {\n console.log(` #${index + 1}: ${entry.wallet} - ${entry.totalXp} XP`);\n });\n } else {\n console.log('No active season (between seasons)');\n\n // Fetch all seasons to see when next one starts\n const allSeasons = await sdk.fetchAllDexSeasons();\n const futureSeason = allSeasons.find(s => s.start > new Date());\n\n if (futureSeason) {\n console.log(`Next season starts: ${futureSeason.start.toISOString()}`);\n }\n }\n}\n\n// Complete workflow: Check season + participate\nasync function participateInSeason() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const season = await sdk.fetchCurrentDexSeason();\n\n if (season) {\n console.log(`Active season: ${season.name}`);\n\n // Execute trades to earn XP\n const quote = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');\n const swap = await sdk.executeSwap(\n 'GALA',\n 'GUSDC',\n '100',\n quote.estimatedOutput,\n quote.feeTier,\n 0.01\n );\n\n console.log('Trade executed - XP earned!');\n\n // Check updated leaderboard position\n const leaderboard = await sdk.fetchCurrentDexLeaderboard();\n const myPosition = leaderboard?.entries.find(\n e => e.wallet === sdk.getAddress()\n );\n\n if (myPosition) {\n console.log(`Current rank: #${myPosition.rank}`);\n console.log(`Total XP: ${myPosition.totalXp}`);\n }\n } else {\n console.log('No active season - trades won't earn XP');\n }\n}\n```\n\n**Use Cases:**\n- Check if competitive trading is active\n- Display season information in UI\n- Calculate time remaining in season\n- Auto-participate in seasonal trading\n- Track seasonal leaderboard position\n\n**Related Methods:**\n- `fetchAllDexSeasons()` - Get all seasons (past, current, future)\n- `fetchDexLeaderboardBySeasonId()` - Get leaderboard for specific season\n- `fetchCurrentDexLeaderboard()` - Get current season leaderboard (convenience)\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_current_dex_season`\n",
604
- "samplePrompts": [
605
- "How do I get current DEX season info?",
606
- "Show me how to get current DEX season info with the SDK",
607
- "Explain the get current DEX season info workflow",
608
- "What methods do I need for get current DEX season info?"
609
- ]
610
- },
611
- "fetch-dex-leaderboard-by-season-id": {
612
- "key": "fetch-dex-leaderboard-by-season-id",
613
- "label": "Fetch dex leaderboard by season id",
614
- "description": "Fetch dex leaderboard by season id operations",
615
- "category": "dex-analytics",
616
- "methods": [
617
- "fetchDexLeaderboardBySeasonId"
618
- ],
619
- "mcpTools": [
620
- "gala_launchpad_fetch_dex_leaderboard_by_season_id"
621
- ],
622
- "explanation": "\n## DEX Leaderboard Rankings by Season\n\n**Covers Methods:**\n- `fetchDexLeaderboardBySeasonId()`\n- `fetchCurrentDexLeaderboard()`\n\nQuery leaderboard rankings for competitive DEX trading seasons.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function viewLeaderboards() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Option 1: Fetch leaderboard for specific season\n const leaderboard = await sdk.fetchDexLeaderboardBySeasonId(4);\n\n // Display top 10 ranked players\n console.log(`Season ${leaderboard.seasonId} - Top 10 Players:`);\n leaderboard.entries.slice(0, 10).forEach(entry => {\n console.log(` ${entry.rank}. ${entry.wallet}`);\n console.log(` XP: ${entry.totalXp} (Liquidity: ${entry.liquidityXp}, Trading: ${entry.tradingXp})`);\n });\n\n // Analyze mastery titles\n const topPlayer = leaderboard.entries[0];\n topPlayer.masteryTitles.forEach(title => {\n console.log(` 🏆 ${title.name} (Type: ${title.type}, Tier: ${title.order})`);\n });\n\n // Option 2: Get current leaderboard (convenience method)\n const currentBoard = await sdk.fetchCurrentDexLeaderboard();\n\n if (currentBoard) {\n console.log(`Season ${currentBoard.seasonId} is active`);\n console.log(`Total participants: ${currentBoard.entries.length}`);\n\n // Top 3 performers\n const topThree = currentBoard.entries.slice(0, 3);\n topThree.forEach(entry => {\n console.log(` #${entry.rank}: ${entry.totalXp} XP`);\n });\n }\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_dex_leaderboard_by_season_id`\n- `gala_launchpad_fetch_current_dex_leaderboard`\n",
623
- "samplePrompts": [
624
- "How do I view DEX leaderboard rankings?",
625
- "Show me how to view DEX leaderboard rankings with the SDK",
626
- "Explain the view DEX leaderboard rankings workflow",
627
- "What methods do I need for view DEX leaderboard rankings?"
628
- ]
629
- },
630
- "fetch-current-dex-leaderboard": {
631
- "key": "fetch-current-dex-leaderboard",
632
- "label": "Fetch current dex leaderboard",
633
- "description": "Fetch current dex leaderboard operations",
634
- "category": "dex-analytics",
635
- "methods": [
636
- "fetchCurrentDexLeaderboard"
637
- ],
638
- "mcpTools": [
639
- "gala_launchpad_fetch_current_dex_leaderboard"
640
- ],
641
- "explanation": "",
642
- "samplePrompts": [
643
- "How do I view current DEX leaderboard?",
644
- "Show me how to view current DEX leaderboard with the SDK",
645
- "Explain the view current DEX leaderboard workflow",
646
- "What methods do I need for view current DEX leaderboard?"
647
- ]
648
- },
649
- "fetch-dex-aggregated-volume-summary": {
650
- "key": "fetch-dex-aggregated-volume-summary",
651
- "label": "Fetch dex aggregated volume summary",
652
- "description": "Fetch dex aggregated volume summary operations",
653
- "category": "dex-analytics",
654
- "methods": [
655
- "fetchDexAggregatedVolumeSummary"
656
- ],
657
- "mcpTools": [
658
- "gala_launchpad_fetch_dex_aggregated_volume_summary"
659
- ],
660
- "explanation": "\n## DEX Aggregated Volume Summary and Trends\n\n**Covers Methods:**\n- `fetchDexAggregatedVolumeSummary()`\n\nAnalyze DEX trading volume trends across different time periods.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function analyzeVolumeTrends() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get volume summary with trend metrics\n const summary = await sdk.fetchDexAggregatedVolumeSummary();\n\n // Display volumes\n console.log(`1-Day Volume: $${summary.volume1d.toLocaleString()}`);\n console.log(`7-Day Volume: $${summary.volume7d.toLocaleString()}`);\n console.log(`30-Day Volume: $${summary.volume30d.toLocaleString()}`);\n\n // Analyze trends\n const trend1d = summary.volume1dDelta > 0 ? '📈 UP' : '📉 DOWN';\n const trend7d = summary.volume7dDelta > 0 ? '📈 UP' : '📉 DOWN';\n const trend30d = summary.volume30dDelta > 0 ? '📈 UP' : '📉 DOWN';\n\n console.log(`1-Day Trend: ${trend1d} (${toBigNumberFixed(summary.volume1dDelta * 100, 2)}%)`);\n console.log(`7-Day Trend: ${trend7d} (${toBigNumberFixed(summary.volume7dDelta * 100, 2)}%)`);\n console.log(`30-Day Trend: ${trend30d} (${toBigNumberFixed(summary.volume30dDelta * 100, 2)}%)`);\n\n // Growth analysis\n if (summary.volume30dDelta > 0.1) {\n console.log('Strong growth - Platform adoption increasing');\n } else if (summary.volume30dDelta < -0.1) {\n console.log('Declining volume - Platform may be slowing');\n }\n}\n```\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_dex_aggregated_volume_summary`\n",
661
- "samplePrompts": [
662
- "How do I analyze DEX volume metrics?",
663
- "Show me how to analyze DEX volume metrics with the SDK",
664
- "Explain the analyze DEX volume metrics workflow",
665
- "What methods do I need for analyze DEX volume metrics?"
666
- ]
667
- },
668
- "fetch-dex-pools": {
669
- "key": "fetch-dex-pools",
670
- "label": "Fetch dex pools",
671
- "description": "Fetch dex pools operations",
672
- "category": "dex-pools",
673
- "methods": [
674
- "fetchDexPools",
675
- "fetchAllDexPools"
676
- ],
677
- "mcpTools": [
678
- "gala_launchpad_fetch_dex_pools",
679
- "gala_launchpad_fetch_all_dex_pools"
680
- ],
681
- "explanation": "\n## Fetch DEX Pools with Pagination\n\n**Covers Methods:**\n- `fetchDexPools()`\n- `fetchAllDexPools()`\n\nDiscover and query liquidity pools on GalaSwap with advanced filtering and pagination.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function queryDexPools() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Option 1: Fetch pools with pagination\n const pools = await sdk.fetchDexPools({\n search: 'GALA',\n sortBy: 'tvl', // Sort by: tvl, volume30d, volume1d\n limit: 20,\n page: 1\n });\n\n console.log(`Found ${pools.total} pools, page ${pools.page} of ${pools.totalPages}`);\n pools.pools.forEach(pool => {\n console.log(`${pool.tokenName}: TVL ${pool.tvl}, 24h Volume: ${pool.volume1d}`);\n });\n\n // Option 2: Fetch ALL pools automatically (handles pagination)\n const allPools = await sdk.fetchAllDexPools({\n sortBy: 'tvl'\n });\n\n console.log(`Total pools: ${allPools.pools.length}`);\n\n // Analyze pool metrics\n const avgTvl = allPools.pools.reduce((sum, p) => sum + safeParseFloat(p.tvl, 0), 0) / allPools.pools.length;\n console.log(`Average TVL: $${toBigNumberFixed(avgTvl, 2)}`);\n}\n```\n\n**Key Features:**\n- **Sorting**: TVL (total value locked), volume30d (30-day volume), volume1d (24-hour volume)\n- **Pool Metrics**: Token prices, fee tiers, liquidity, 24h/30d volume, APR\n- **Auto-Pagination**: `fetchAllDexPools()` handles pagination automatically\n- **Search**: Filter by token name or pair\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_dex_pools`\n- `gala_launchpad_fetch_all_dex_pools`\n",
682
- "samplePrompts": [
683
- "How do I fetch dex pools?",
684
- "Show me how to fetch dex pools with the SDK",
685
- "Explain the fetch dex pools workflow",
686
- "What methods do I need for fetch dex pools?"
687
- ]
688
- },
689
- "event-subscriptions": {
690
- "key": "event-subscriptions",
691
- "label": "Event subscriptions",
692
- "description": "Event subscriptions operations",
693
- "category": "chat",
694
- "methods": [
695
- "subscribeToStream",
696
- "unsubscribeFromStream",
697
- "onStreamStatusChanged",
698
- "onUserBanned",
699
- "onUserUnbanned",
700
- "onBanEnforcement",
701
- "onContentFlagged",
702
- "onFlagResolved",
703
- "onStreamChatMessage",
704
- "onStreamChatUpdated",
705
- "onStreamChatDeleted",
706
- "onStreamChatPinned",
707
- "onStreamChatUnpinned",
708
- "onChatStatusChanged",
709
- "onViewerCountChanged",
710
- "onRecordingStatusChanged",
711
- "onSimulcastStatusChanged",
712
- "onDownloadReady",
713
- "onUserTyping",
714
- "onStreamReaction",
715
- "onContentReactionAdded",
716
- "onContentReactionRemoved",
717
- "onStreamCountdownUpdated",
718
- "onStreamLanguageUpdated",
719
- "onStreamControlStatusChanged",
720
- "onConnection",
721
- "onAuthenticated",
722
- "onTokenSubscribed",
723
- "onTokenUnsubscribed",
724
- "onRoomSubscribed",
725
- "onRoomLeft",
726
- "onDexPoolCreation",
727
- "onLaunchpadTokenCreation"
728
- ],
729
- "mcpTools": [
730
- "gala_launchpad_subscribe_to_stream",
731
- "gala_launchpad_on_dex_pool_creation",
732
- "gala_launchpad_on_launchpad_token_creation"
733
- ],
734
- "explanation": "\n## Real-Time Event Subscriptions and Monitoring\n\n**Covers Methods:**\n- `subscribeToDexLiquidityAdded()`\n- `subscribeToDexLiquidityChanged()`\n- `subscribeToDexLiquidityRemoved()`\n- `subscribeToDexPoolAdded()`\n- `subscribeToDexSwapExecuted()`\n- `subscribeToTokenCreations()`\n\nSubscribe to real-time WebSocket events for DEX trading, liquidity changes, and token launches.\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function subscribeToEvents() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // ============================================================================\n // LIQUIDITY EVENTS - Monitor position changes\n // ============================================================================\n\n // Subscribe to liquidity additions\n const cleanupAdded = sdk.subscribeToDexLiquidityAdded((event) => {\n console.log('Liquidity added!');\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Amount0: ${event.amount0}`);\n console.log(` Amount1: ${event.amount1}`);\n console.log(` Owner: ${event.owner}`);\n console.log(` Position ID: ${event.positionId}`);\n });\n\n // Subscribe to liquidity changes (compound events)\n const cleanupChanged = sdk.subscribeToDexLiquidityChanged((event) => {\n console.log('Liquidity changed!');\n console.log(` Type: ${event.type}`); // 'added', 'removed', 'modified'\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Delta: ${event.liquidityDelta}`);\n });\n\n // Subscribe to liquidity removals\n const cleanupRemoved = sdk.subscribeToDexLiquidityRemoved((event) => {\n console.log('Liquidity removed!');\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Amount0: ${event.amount0}`);\n console.log(` Amount1: ${event.amount1}`);\n console.log(` Owner: ${event.owner}`);\n console.log(` Fees collected: ${event.fees0}, ${event.fees1}`);\n });\n\n // ============================================================================\n // POOL EVENTS - Monitor new DEX pools\n // ============================================================================\n\n // Subscribe to new DEX pool creation\n const cleanupPool = sdk.subscribeToDexPoolAdded((pool) => {\n console.log('New DEX pool created!');\n console.log(` Token: ${pool.tokenName}`);\n console.log(` Token0: ${pool.token0}`);\n console.log(` Token1: ${pool.token1}`);\n console.log(` Fee Tier: ${pool.feeTier}`);\n console.log(` Initial TVL: ${pool.tvl}`);\n\n // Auto-provide liquidity to new pools\n sdk.addSwapLiquidityByPrice({\n token0: pool.token0,\n token1: pool.token1,\n fee: pool.feeTier,\n minPrice: '0.95',\n maxPrice: '1.05',\n amount0Desired: '1000',\n amount1Desired: '1000'\n }).then(() => console.log('Liquidity provided to new pool'));\n });\n\n // ============================================================================\n // SWAP EVENTS - Monitor all DEX swaps\n // ============================================================================\n\n // Subscribe to DEX swap executions\n const cleanupSwap = sdk.subscribeToDexSwapExecuted((swap) => {\n console.log('DEX swap executed!');\n console.log(` Pair: ${swap.tokenIn} → ${swap.tokenOut}`);\n console.log(` Amount In: ${swap.amountIn}`);\n console.log(` Amount Out: ${swap.amountOut}`);\n console.log(` Trader: ${swap.trader}`);\n console.log(` Fee Tier: ${swap.feeTier}`);\n\n // Track volume and price impact\n const priceImpact = calculatePriceImpact(swap.amountIn, swap.amountOut);\n console.log(` Price impact: ${priceImpact}%`);\n });\n\n // ============================================================================\n // TOKEN CREATION EVENTS - Monitor new token launches\n // ============================================================================\n\n // Subscribe to new token launches\n const cleanupToken = sdk.subscribeToTokenCreations((token) => {\n console.log('New token launched!');\n console.log(` Name: ${token.tokenName}`);\n console.log(` Symbol: ${token.tokenSymbol}`);\n console.log(` Creator: ${token.creator}`);\n console.log(` Max Supply: ${token.maxSupply}`);\n console.log(` Base Price: ${token.basePrice}`);\n\n // Auto-buy new tokens\n sdk.buy({\n tokenName: token.tokenName,\n amount: '100',\n type: 'native',\n slippageToleranceFactor: 0.01\n }).then(() => console.log('Auto-bought new token'));\n });\n\n // ============================================================================\n // ARBITRAGE BOT EXAMPLE - Multi-event monitoring\n // ============================================================================\n\n async function arbitrageBot() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Track all swaps for arbitrage opportunities\n sdk.subscribeToDexSwapExecuted(async (swap) => {\n // Check if price divergence exists\n const poolPrice = await sdk.getSwapPoolPrice(swap.tokenIn, swap.tokenOut);\n const externalPrice = await getExternalPrice(swap.tokenIn, swap.tokenOut);\n\n const divergence = Math.abs(poolPrice - externalPrice) / externalPrice;\n\n if (divergence > 0.01) {\n // 1% arbitrage opportunity\n console.log(`Arbitrage opportunity: ${divergence * 100}%`);\n\n // Execute arbitrage trade\n await sdk.executeSwap(\n swap.tokenOut,\n swap.tokenIn,\n calculateArbitrageAmount(divergence),\n '0', // min output\n 3000, // fee tier\n 0.01 // slippage\n );\n }\n });\n\n // Monitor liquidity additions for new opportunities\n sdk.subscribeToDexLiquidityAdded(async (event) => {\n console.log(`New liquidity in ${event.token0}-${event.token1}`);\n\n // Check if pool has sufficient depth for arbitrage\n const poolInfo = await sdk.getSwapPoolInfo(event.token0, event.token1);\n // Use compareAmounts for precise liquidity threshold comparison\n if (compareAmounts(poolInfo.liquidity, '100000') > 0) {\n console.log('Pool has sufficient liquidity for arbitrage');\n }\n });\n }\n\n // ============================================================================\n // LIQUIDITY PROVIDER BOT - Auto-manage positions\n // ============================================================================\n\n async function liquidityProviderBot() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Auto-add liquidity to new pools\n sdk.subscribeToDexPoolAdded(async (pool) => {\n console.log(`New pool: ${pool.tokenName}`);\n\n // Wait for some initial swaps to establish price\n setTimeout(async () => {\n const poolInfo = await sdk.getSwapPoolInfo(pool.token0, pool.token1);\n\n // Add liquidity if TVL is high enough\n // Use compareAmounts for precise liquidity threshold comparison\n if (compareAmounts(poolInfo.liquidity, '50000') > 0) {\n await sdk.addSwapLiquidityByPrice({\n token0: pool.token0,\n token1: pool.token1,\n fee: pool.feeTier,\n minPrice: '0.9',\n maxPrice: '1.1',\n amount0Desired: '10000',\n amount1Desired: '10000'\n });\n\n console.log('Liquidity added to new pool');\n }\n }, 60000); // Wait 1 minute\n });\n\n // Monitor liquidity removals (potential exit signal)\n sdk.subscribeToDexLiquidityRemoved((event) => {\n console.log(`Large liquidity removal: ${event.amount0}, ${event.amount1}`);\n\n // Check if we should also exit\n if (isLargeRemoval(event)) {\n console.log('Large removal detected - consider exiting position');\n }\n });\n }\n\n // Keep subscriptions running\n console.log('Subscriptions active... Press Ctrl+C to stop');\n await new Promise(() => {}); // Run forever\n\n // Cleanup when done\n cleanupAdded();\n cleanupChanged();\n cleanupRemoved();\n cleanupPool();\n cleanupSwap();\n cleanupToken();\n}\n```\n\n**Event Data Structures:**\n\n**LiquidityAdded:**\n- token0, token1, feeTier\n- amount0, amount1\n- owner, positionId\n- timestamp\n\n**LiquidityRemoved:**\n- token0, token1, feeTier\n- amount0, amount1\n- fees0, fees1\n- owner, positionId\n- timestamp\n\n**DexPoolAdded:**\n- tokenName, token0, token1\n- feeTier, tvl\n- timestamp\n\n**SwapExecuted:**\n- tokenIn, tokenOut\n- amountIn, amountOut\n- trader, feeTier\n- priceImpact\n- timestamp\n\n**TokenCreation:**\n- tokenName, tokenSymbol\n- creator, maxSupply\n- basePrice\n- timestamp\n\n**Use Cases:**\n- **Arbitrage Bots**: Monitor swaps for price divergence\n- **Liquidity Management**: Auto-provide liquidity to new pools\n- **Early Bird Trading**: Buy new tokens immediately after launch\n- **Position Monitoring**: Track liquidity changes in your positions\n- **Market Analysis**: Analyze trading patterns and volumes\n\n### WebSocket Connection Lifecycle\n\n```typescript\n// Handle connection lifecycle events\nawait sdk.connectStreamWebSocket({\n onConnect: () => {\n console.log('WebSocket connected');\n },\n onDisconnect: (reason) => {\n console.log('WebSocket disconnected:', reason);\n // Implement reconnection logic if needed\n },\n onError: (error) => {\n console.error('WebSocket error:', error);\n }\n});\n\n// Check connection state\nif (sdk.isStreamWebSocketConnected()) {\n console.log('Ready to send/receive messages');\n}\n```\n\n### Typing Indicators\n\n```typescript\n// Subscribe to typing indicators in chat\nawait sdk.connectStreamWebSocket({\n onTypingIndicator: (event) => {\n if (event.isTyping) {\n console.log(`${event.userAddress} is typing...`);\n } else {\n console.log(`${event.userAddress} stopped typing`);\n }\n }\n});\n\n// Send typing start indicator\nawait sdk.sendTypingStart({\n tokenName: 'anime'\n});\n\n// Later: Send typing stop indicator\nawait sdk.sendTypingStop({\n tokenName: 'anime'\n});\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_subscribe_to_dex_liquidity_added`\n- `gala_launchpad_subscribe_to_dex_liquidity_changed`\n- `gala_launchpad_subscribe_to_dex_liquidity_removed`\n- `gala_launchpad_subscribe_to_dex_pool_added`\n- `gala_launchpad_subscribe_to_dex_swap_executed`\n- `gala_launchpad_subscribe_to_token_creations`\n",
735
- "samplePrompts": [
736
- "How do I subscribe to real-time events?",
737
- "Show me how to subscribe to real-time events with the SDK",
738
- "Explain the subscribe to real-time events workflow",
739
- "What methods do I need for subscribe to real-time events?"
740
- ]
741
- },
742
- "mcp-to-sdk-mapping": {
743
- "key": "mcp-to-sdk-mapping",
744
- "label": "Mcp to sdk mapping",
745
- "description": "Mcp to sdk mapping operations",
746
- "category": "utils",
747
- "methods": [],
748
- "mcpTools": [],
749
- "explanation": "\n## MCP Tool to SDK Method Mapping Guide\n\n**Covers Concepts:**\n- Understanding MCP tool architecture\n- Mapping between MCP tools and SDK methods\n- When to use MCP vs direct SDK\n\nThis is a conceptual guide showing how MCP (Model Context Protocol) tools map to SDK methods.\n\n### Architecture Overview\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│ MCP Server Layer │\n│ (241 tools - user-friendly wrappers with validation) │\n└─────────────────────────────────────────────────────────────┘\n │\n ▼\n┌─────────────────────────────────────────────────────────────┐\n│ LaunchpadSDK Layer │\n│ (217 methods - low-level programmatic access) │\n└─────────────────────────────────────────────────────────────┘\n │\n ▼\n┌─────────────────────────────────────────────────────────────┐\n│ Gala Launchpad Backend APIs │\n│ (REST endpoints, WebSocket events, GalaChain) │\n└─────────────────────────────────────────────────────────────┘\n```\n\n### MCP vs SDK Decision Matrix\n\n| Scenario | Use MCP | Use SDK |\n|----------|---------|---------|\n| **AI Agent Development** | ✅ Yes | ❌ No |\n| **Claude Desktop Integration** | ✅ Yes | ❌ No |\n| **LLM-Driven Trading Bots** | ✅ Yes | ❌ No |\n| **TypeScript Application** | ❌ No | ✅ Yes |\n| **Node.js Backend Service** | ❌ No | ✅ Yes |\n| **React/Vue Frontend** | ❌ No | ✅ Yes |\n| **Python Application** | ❌ No (SDK only) | ❌ No (not yet) |\n\n### Tool Naming Conventions\n\n**MCP Tool Pattern:** `gala_launchpad_{action}_{resource}`\n**SDK Method Pattern:** `{action}{Resource}`\n\nExamples:\n- MCP: `gala_launchpad_fetch_pools` → SDK: `fetchPools()`\n- MCP: `gala_launchpad_buy_tokens` → SDK: `buy()`\n- MCP: `gala_launchpad_get_swap_quote_exact_input` → SDK: `getSwapQuoteExactInput()`\n\n### Common Mapping Patterns\n\n**1. Direct 1:1 Mapping (Most Common):**\n\n```typescript\n// MCP Tool: gala_launchpad_fetch_pools\n// SDK Method: fetchPools()\n\n// MCP Usage (AI agent)\nconst result = await tools.gala_launchpad_fetch_pools({\n type: 'recent',\n limit: 10\n});\n\n// SDK Usage (TypeScript app)\nconst sdk = createLaunchpadSDK({ wallet: 'private-key' });\nconst result = await sdk.fetchPools({ type: 'recent', limit: 10 });\n```\n\n**2. Composite Tool → Multiple SDK Methods:**\n\n```typescript\n// MCP Tool: gala_launchpad_buy_tokens_with_calculation\n// Calls TWO SDK methods internally:\n\n// 1. Calculate quote\nconst quote = await sdk.calculateBuyAmount({\n tokenName: 'anime',\n amount: '100',\n type: 'native'\n});\n\n// 2. Execute trade\nconst result = await sdk.buy({\n tokenName: 'anime',\n amount: '100',\n type: 'native',\n expectedAmount: quote.amount,\n slippageToleranceFactor: 0.01\n});\n```\n\n**3. SDK Method → No MCP Tool (Advanced Features):**\n\nSome SDK methods don't have MCP equivalents:\n- `setWallet()` - Runtime wallet changes\n- `getConfig()` - SDK configuration access\n- `warmCacheFromPoolData()` - Cache optimization\n\n**4. MCP Tool → No Direct SDK Method (Abstractions):**\n\nSome MCP tools provide abstractions:\n- `gala_launchpad_portfolio` - Aggregates multiple SDK calls\n- `gala_launchpad_analyze_token` - Composite analysis workflow\n\n### Complete Mapping Reference\n\n**Trading (13 MCP tools → 9 SDK methods):**\n\n| MCP Tool | SDK Method |\n|----------|-----------|\n| `gala_launchpad_buy_tokens` | `buy()` |\n| `gala_launchpad_sell_tokens` | `sell()` |\n| `gala_launchpad_calculate_buy_amount` | `calculateBuyAmount()` |\n| `gala_launchpad_calculate_sell_amount` | `calculateSellAmount()` |\n| `gala_launchpad_graduate_token` | `graduateToken()` |\n| `gala_launchpad_calculate_buy_amount_local` | `calculateBuyAmountLocal()` |\n| `gala_launchpad_calculate_sell_amount_local` | `calculateSellAmountLocal()` |\n| `gala_launchpad_calculate_buy_amount_external` | `calculateBuyAmountExternal()` |\n| `gala_launchpad_calculate_sell_amount_external` | `calculateSellAmountExternal()` |\n\n**DEX Trading (6 MCP tools → 6 SDK methods):**\n\n| MCP Tool | SDK Method |\n|----------|-----------|\n| `gala_launchpad_get_swap_quote_exact_input` | `getSwapQuoteExactInput()` |\n| `gala_launchpad_get_swap_quote_exact_output` | `getSwapQuoteExactOutput()` |\n| `gala_launchpad_execute_swap` | `executeSwap()` |\n| `gala_launchpad_get_swap_user_assets` | `getSwapUserAssets()` |\n| `gala_launchpad_get_all_swap_user_assets` | `getAllSwapUserAssets()` |\n| `gala_launchpad_get_swap_pool_info` | `getSwapPoolInfo()` |\n\n**Liquidity Management (8 MCP tools → 9 SDK methods):**\n\n| MCP Tool | SDK Method |\n|----------|-----------|\n| `gala_launchpad_get_user_liquidity_positions` | `getSwapUserLiquidityPositions()` |\n| `gala_launchpad_get_all_user_liquidity_positions` | `getAllSwapUserLiquidityPositions()` |\n| `gala_launchpad_get_liquidity_position_by_id` | `getSwapLiquidityPositionById()` |\n| `gala_launchpad_add_liquidity_by_price` | `addSwapLiquidityByPrice()` |\n| `gala_launchpad_add_liquidity_by_ticks` | `addSwapLiquidityByTicks()` |\n| `gala_launchpad_estimate_remove_liquidity` | `getSwapEstimateRemoveLiquidity()` |\n| `gala_launchpad_remove_liquidity` | `removeSwapLiquidity()` |\n| `gala_launchpad_collect_position_fees` | `collectSwapPositionFees()` |\n\n### When to Use Each\n\n**Use MCP Tools When:**\n- Building AI agents (Claude, GPT, etc.)\n- Need LLM-friendly error messages\n- Want automatic parameter validation\n- Working in Claude Desktop environment\n- Need slash command shortcuts\n\n**Use SDK Directly When:**\n- Building TypeScript/JavaScript applications\n- Need maximum performance\n- Want full TypeScript type safety\n- Building React/Vue components\n- Need fine-grained control\n\n### Migration Example\n\n**From MCP to SDK:**\n\n```typescript\n// AI Agent using MCP\nasync function mcpExample() {\n const result = await tools.gala_launchpad_buy_tokens({\n tokenName: 'anime',\n amount: '100',\n type: 'native',\n slippageToleranceFactor: 0.01\n });\n return result;\n}\n\n// TypeScript App using SDK\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function sdkExample() {\n const sdk = createLaunchpadSDK({ wallet: 'private-key' });\n\n // Step 1: Calculate quote\n const quote = await sdk.calculateBuyAmount({\n tokenName: 'anime',\n amount: '100',\n type: 'native'\n });\n\n // Step 2: Execute trade\n const result = await sdk.buy({\n tokenName: 'anime',\n amount: '100',\n type: 'native',\n expectedAmount: quote.amount,\n slippageToleranceFactor: 0.01\n });\n\n return result;\n}\n```\n\n**Key Differences:**\n1. MCP combines calculation + execution (safer for AI)\n2. SDK exposes individual steps (more control)\n3. MCP validates all inputs via Zod schemas\n4. SDK provides TypeScript type safety\n\n### Resources\n\n- **SDK Documentation**: packages/sdk/README.md\n- **MCP Documentation**: packages/mcp-server/README.md\n- **API Reference**: docs/API-REFERENCE.md\n- **Tool Registry**: packages/mcp-server/src/tools/registry.ts\n",
750
- "samplePrompts": [
751
- "How do I map MCP tools to SDK methods?",
752
- "Show me how to map MCP tools to SDK methods with the SDK",
753
- "Explain the map MCP tools to SDK methods workflow",
754
- "What methods do I need for map MCP tools to SDK methods?"
755
- ]
756
- },
757
- "bridge-operations": {
758
- "key": "bridge-operations",
759
- "label": "Bridge operations",
760
- "description": "Bridge operations operations",
761
- "category": "bridge",
762
- "methods": [
763
- "estimateBridgeFee",
764
- "bridgeOut",
765
- "bridgeIn",
766
- "getBridgeStatus",
767
- "fetchEthereumWalletTokenBalance",
768
- "fetchEthereumWalletNativeBalance",
769
- "fetchEthereumWalletAllBalances",
770
- "fetchSolanaWalletTokenBalance",
771
- "fetchSolanaWalletNativeBalance",
772
- "fetchSolanaWalletAllBalances",
773
- "getSupportedBridgeTokens",
774
- "getEthereumTransactionStatus",
775
- "getSolanaTransactionStatus",
776
- "fetchBridgeableTokensByNetwork",
777
- "fetchAllBridgeableTokensByNetwork",
778
- "fetchAllTokensBridgeableToEthereum",
779
- "fetchAllTokensBridgeableToSolana",
780
- "isTokenBridgeableToNetwork",
781
- "isTokenBridgeableToEthereum",
782
- "isTokenBridgeableToSolana",
783
- "requestSolanaDevnetAirdrop"
784
- ],
785
- "mcpTools": [
786
- "gala_launchpad_estimate_bridge_fee",
787
- "gala_launchpad_bridge_out",
788
- "gala_launchpad_bridge_in",
789
- "gala_launchpad_get_bridge_status",
790
- "gala_launchpad_fetch_ethereum_wallet_token_balance",
791
- "gala_launchpad_fetch_ethereum_wallet_native_balance",
792
- "gala_launchpad_fetch_ethereum_wallet_all_balances",
793
- "gala_launchpad_fetch_solana_wallet_token_balance",
794
- "gala_launchpad_fetch_solana_wallet_native_balance",
795
- "gala_launchpad_fetch_solana_wallet_all_balances",
796
- "gala_launchpad_get_supported_bridge_tokens",
797
- "gala_launchpad_get_ethereum_transaction_status",
798
- "gala_launchpad_get_solana_transaction_status",
799
- "gala_launchpad_fetch_bridgeable_tokens_by_network",
800
- "gala_launchpad_fetch_all_bridgeable_tokens_by_network",
801
- "gala_launchpad_fetch_all_tokens_bridgeable_to_ethereum",
802
- "gala_launchpad_fetch_all_tokens_bridgeable_to_solana",
803
- "gala_launchpad_is_token_bridgeable_to_network",
804
- "gala_launchpad_is_token_bridgeable_to_ethereum",
805
- "gala_launchpad_is_token_bridgeable_to_solana",
806
- "gala_launchpad_request_solana_devnet_airdrop"
807
- ],
808
- "explanation": "\n## Cross-Chain Bridge Operations with SDK\n\n**Covers Methods:**\n- `estimateBridgeFee()`\n- `bridgeOut()`\n- `bridgeIn()`\n- `getBridgeStatus()`\n- `getSupportedBridgeTokens()`\n- `getEthereumTransactionStatus()`\n- `getSolanaTransactionStatus()`\n- `fetchEthereumWalletTokenBalance()` / `fetchSolanaWalletTokenBalance()`\n- `fetchEthereumWalletNativeBalance()` / `fetchSolanaWalletNativeBalance()`\n- `fetchEthereumWalletAllBalances()` / `fetchSolanaWalletAllBalances()`\n- `fetchBridgeableTokensByNetwork()` / `fetchAllBridgeableTokensByNetwork()`\n- `fetchAllTokensBridgeableToEthereum()` / `fetchAllTokensBridgeableToSolana()`\n- `isTokenBridgeableToNetwork()` / `isTokenBridgeableToEthereum()` / `isTokenBridgeableToSolana()`\n- `requestSolanaDevnetAirdrop()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function bridgeOperations() {\n // 1. Create SDK with wallet configuration\n const sdk = createLaunchpadSDK({\n privateKey: '0xabcd...',\n environment: 'production', // or 'staging' for testnet\n });\n\n // 2. Get supported bridge tokens\n const supportedTokens = await sdk.getSupportedBridgeTokens('Ethereum');\n console.log('Bridgeable to Ethereum:', supportedTokens.map(t => t.symbol));\n\n // 3. Check if specific token is bridgeable\n const canBridge = await sdk.isTokenBridgeableToEthereum('GALA');\n console.log('GALA bridgeable to Ethereum:', canBridge.bridgeable);\n\n // 4. Estimate bridge fee (calculated externally by GalaConnect API)\n const fee = await sdk.estimateBridgeFee({\n tokenId: 'GALA|Unit|none|none',\n destinationChain: 'Ethereum',\n amount: '100',\n });\n console.log('Bridge fee:', fee.totalFee, 'GALA');\n\n // 5. Bridge Out: GalaChain → Ethereum\n const bridgeOutTx = await sdk.bridgeOut({\n tokenId: 'GALA|Unit|none|none',\n amount: '100',\n destinationChain: 'Ethereum',\n recipientAddress: '0x5678...',\n });\n console.log('Bridge out TX:', bridgeOutTx.transactionHash);\n\n // 6. Get bridge status\n const status = await sdk.getBridgeStatus(bridgeOutTx.transactionHash);\n console.log('Bridge status:', status.status);\n\n // 7. Get Ethereum transaction status\n const ethTxStatus = await sdk.getEthereumTransactionStatus(bridgeOutTx.transactionHash);\n console.log('ETH TX confirmed:', ethTxStatus.confirmed);\n\n // 8. Query external chain balances\n const ethBalance = await sdk.fetchEthereumWalletNativeBalance();\n const galaEthBalance = await sdk.fetchEthereumWalletTokenBalance('GALA');\n const allEthBalances = await sdk.fetchEthereumWalletAllBalances();\n\n // 9. Discover all bridgeable tokens\n const allBridgeable = await sdk.fetchAllBridgeableTokensByNetwork('ETHEREUM');\n console.log('All tokens bridgeable to Ethereum:', allBridgeable.length);\n}\n```\n\n**Supported Tokens:**\n- **Ethereum:** GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC\n- **Solana:** GALA, GSOL\n\n**Environment Configuration:**\n- `PROD`: Ethereum Mainnet, Solana Mainnet\n- `STAGE`: Ethereum Sepolia, Solana Devnet\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_bridge_estimate_fee`\n- `gala_launchpad_bridge_out`\n- `gala_launchpad_bridge_in`\n- `gala_launchpad_bridge_status`\n- `gala_launchpad_bridge_ethereum_balance`\n- `gala_launchpad_bridge_ethereum_all_balances`\n- `gala_launchpad_bridge_solana_balance`\n- `gala_launchpad_bridge_solana_all_balances`\n",
809
- "samplePrompts": [
810
- "How do I bridge tokens across chains?",
811
- "Show me how to bridge tokens across chains with the SDK",
812
- "Explain the bridge tokens across chains workflow",
813
- "What methods do I need for bridge tokens across chains?"
814
- ]
815
- },
816
- "dex-token-discovery": {
817
- "key": "dex-token-discovery",
818
- "label": "Dex token discovery",
819
- "description": "Dex token discovery operations",
820
- "category": "dex-pools",
821
- "methods": [
822
- "fetchAvailableDexTokens",
823
- "fetchAllAvailableDexTokens"
824
- ],
825
- "mcpTools": [
826
- "gala_launchpad_fetch_available_dex_tokens",
827
- "gala_launchpad_fetch_all_available_dex_tokens"
828
- ],
829
- "explanation": "\n## DEX Token Discovery with SDK\n\n**Covers Methods:**\n- `fetchAvailableDexTokens()`\n- `fetchAllAvailableDexTokens()`\n\nDiscover all tokens available for trading on GalaSwap DEX with rich metadata.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function discoverDexTokens() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Option 1: Paginated token discovery\n const tokens = await sdk.fetchAvailableDexTokens({\n search: 'GALA', // Optional search filter\n page: 1,\n limit: 20\n });\n\n console.log(`Found ${tokens.total} tokens, page ${tokens.page} of ${tokens.totalPages}`);\n tokens.items.forEach(token => {\n console.log(`${token.symbol}: ${token.name} (decimals: ${token.decimals})`);\n });\n\n // Option 2: Fetch ALL tokens (auto-pagination)\n const allTokens = await sdk.fetchAllAvailableDexTokens();\n console.log(`Total DEX tokens: ${allTokens.length}`);\n\n // Option 3: Search for specific tokens\n const searchResults = await sdk.fetchAllAvailableDexTokens({ search: 'USD' });\n console.log('USD-related tokens:', searchResults.map(t => t.symbol));\n}\n```\n\n**Token Metadata Includes:**\n- Symbol and full name\n- Decimal precision\n- Token class key (collection, category, type, additionalKey)\n- Verification status\n- Trading availability\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_available_dex_tokens`\n- `gala_launchpad_fetch_all_available_dex_tokens`\n",
830
- "samplePrompts": [
831
- "How do I discover tokens on DEX?",
832
- "Show me how to discover tokens on DEX with the SDK",
833
- "Explain the discover tokens on DEX workflow",
834
- "What methods do I need for discover tokens on DEX?"
835
- ]
836
- },
837
- "wrap-unwrap-operations": {
838
- "key": "wrap-unwrap-operations",
839
- "label": "Wrap unwrap operations",
840
- "description": "Wrap unwrap operations operations",
841
- "category": "bridge",
842
- "methods": [
843
- "wrapToken",
844
- "unwrapToken",
845
- "estimateWrapFee",
846
- "estimateUnwrapFee",
847
- "getWrapStatus",
848
- "fetchWrappableTokens",
849
- "fetchAllWrappableTokens",
850
- "getWrappableToken",
851
- "getWrapCounterpart",
852
- "isTokenWrappable"
853
- ],
854
- "mcpTools": [
855
- "gala_launchpad_wrap_token",
856
- "gala_launchpad_unwrap_token",
857
- "gala_launchpad_estimate_wrap_fee",
858
- "gala_launchpad_estimate_unwrap_fee",
859
- "gala_launchpad_get_wrap_status",
860
- "gala_launchpad_fetch_wrappable_tokens",
861
- "gala_launchpad_fetch_all_wrappable_tokens",
862
- "gala_launchpad_get_wrappable_token",
863
- "gala_launchpad_get_wrap_counterpart",
864
- "gala_launchpad_is_token_wrappable"
865
- ],
866
- "explanation": "\n# Wrap/Unwrap Operations (Cross-Channel GalaChain Bridge)\n\nThe SDK provides methods for wrapping and unwrapping tokens between GalaChain channels.\nThis is an **internal GalaChain cross-channel bridge**, NOT external bridging to Ethereum/Solana.\n\n**Key Concept:**\n- **Wrap**: Move token from native channel → asset channel (e.g., MUSIC → GMUSIC)\n- **Unwrap**: Move token from asset channel → native channel (e.g., GMUSIC → MUSIC)\n\n## Wrap Token\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function wrapToken() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Wrap MUSIC to GMUSIC (music channel → asset channel)\n const result = await sdk.wrapToken({\n tokenId: 'MUSIC', // or '$MUSIC|Unit|none|none'\n amount: '100',\n recipient: '0x...', // Optional, defaults to sender\n memo: 'Wrapping for DEX trading' // Optional\n });\n\n console.log('Wrap transaction:', result.transactionId);\n}\n```\n\n## Unwrap Token\n\n```typescript\nasync function unwrapToken() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Unwrap GMUSIC back to MUSIC (asset channel → music channel)\n const result = await sdk.unwrapToken({\n tokenId: 'GMUSIC', // or '$GMUSIC|Unit|none|none'\n amount: '50',\n recipient: '0x...', // Optional\n memo: 'Unwrapping after trading' // Optional\n });\n\n console.log('Unwrap transaction:', result.transactionId);\n}\n```\n\n## Fee Estimation\n\n```typescript\nasync function estimateFees() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Estimate wrap fee (uses cross_channel_authorization)\n const wrapFee = await sdk.estimateWrapFee('MUSIC', '100');\n console.log('Wrap fee:', wrapFee);\n\n // Estimate unwrap fee (uses automatic authorization)\n const unwrapFee = await sdk.estimateUnwrapFee('GMUSIC', '100');\n console.log('Unwrap fee:', unwrapFee);\n}\n```\n\n## Transaction Status\n\n```typescript\nasync function checkStatus() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const status = await sdk.getWrapStatus('transaction-id-here');\n console.log('Status:', status.status); // pending, processing, completed, failed\n}\n```\n\n## Wrappable Token Discovery\n\n```typescript\nasync function discoverWrappableTokens() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Paginated fetch\n const tokens = await sdk.fetchWrappableTokens({ limit: 100 });\n\n // Auto-paginated (all tokens)\n const allTokens = await sdk.fetchAllWrappableTokens();\n\n // Get specific wrappable token\n const token = await sdk.getWrappableToken('$MUSIC|Unit|none|none');\n\n // Get wrap counterpart (MUSIC → GMUSIC or vice versa)\n const counterpart = await sdk.getWrapCounterpart('$MUSIC|Unit|none|none');\n\n // Check if token is wrappable\n const isWrappable = await sdk.isTokenWrappable('$MUSIC|Unit|none|none');\n console.log('Is wrappable:', isWrappable.isWrappable);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_wrap_token`\n- `gala_launchpad_unwrap_token`\n- `gala_launchpad_estimate_wrap_fee`\n- `gala_launchpad_estimate_unwrap_fee`\n- `gala_launchpad_get_wrap_status`\n- `gala_launchpad_fetch_wrappable_tokens`\n- `gala_launchpad_fetch_all_wrappable_tokens`\n- `gala_launchpad_get_wrappable_token`\n- `gala_launchpad_get_wrap_counterpart`\n- `gala_launchpad_is_token_wrappable`\n",
867
- "samplePrompts": [
868
- "How do I wrap and unwrap tokens?",
869
- "Show me how to wrap and unwrap tokens with the SDK",
870
- "Explain the wrap and unwrap tokens workflow",
871
- "What methods do I need for wrap and unwrap tokens?"
872
- ]
873
- },
874
- "referral-system": {
875
- "key": "referral-system",
876
- "label": "Referral system",
877
- "description": "Referral system operations",
878
- "category": "referrals",
879
- "methods": [
880
- "fetchReferralUrl",
881
- "fetchReferrals",
882
- "fetchAllReferrals",
883
- "fetchReferralsSummary"
884
- ],
885
- "mcpTools": [
886
- "gala_launchpad_fetch_referral_url",
887
- "gala_launchpad_fetch_referrals",
888
- "gala_launchpad_fetch_all_referrals",
889
- "gala_launchpad_fetch_referrals_summary"
890
- ],
891
- "explanation": "\n# Referral System\n\nThe SDK provides methods for managing referral URLs and tracking referral activity.\n\n## Get Your Referral URL\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function getReferralUrl() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get your unique referral URL\n const result = await sdk.fetchReferralUrl();\n console.log('Share this URL:', result.referralUrl);\n}\n```\n\n## Fetch Referrals (Paginated)\n\n```typescript\nasync function fetchReferrals() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Paginated referral list\n const referrals = await sdk.fetchReferrals({\n address: '0x...', // Optional, defaults to SDK wallet\n page: 1,\n limit: 20\n });\n\n console.log('Total referrals:', referrals.total);\n referrals.items.forEach(ref => {\n console.log(`Referred: ${ref.referredAddress} on ${ref.createdAt}`);\n });\n}\n```\n\n## Fetch All Referrals (Auto-Paginated)\n\n```typescript\nasync function fetchAllReferrals() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get ALL referrals with auto-pagination\n const allReferrals = await sdk.fetchAllReferrals({ address: '0x...' });\n console.log('Total referrals:', allReferrals.length);\n}\n```\n\n## Referral Summary\n\n```typescript\nasync function getReferralSummary() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const summary = await sdk.fetchReferralsSummary({ address: '0x...' });\n console.log('Total referred users:', summary.totalReferrals);\n console.log('Total rewards earned:', summary.totalRewards);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_referral_url`\n- `gala_launchpad_fetch_referrals`\n- `gala_launchpad_fetch_all_referrals`\n- `gala_launchpad_fetch_referrals_summary`\n",
892
- "samplePrompts": [
893
- "How do I manage referral rewards?",
894
- "Show me how to manage referral rewards with the SDK",
895
- "Explain the manage referral rewards workflow",
896
- "What methods do I need for manage referral rewards?"
897
- ]
898
- },
899
- "account-management": {
900
- "key": "account-management",
901
- "label": "Account management",
902
- "description": "Account management operations",
903
- "category": "balance",
904
- "methods": [
905
- "registerAccount"
906
- ],
907
- "mcpTools": [
908
- "gala_launchpad_register_account"
909
- ],
910
- "explanation": "\n# Account Management\n\nThe SDK provides methods for account registration and management.\n\n## Register Account\n\nRegister an account for trading on Gala. This should be called before the first purchase\nto ensure the wallet is ready for trading operations.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function registerAccount() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Register the SDK wallet\n const result = await sdk.registerAccount();\n console.log('Account exists:', result.exists);\n console.log('Wallet alias:', result.walletAlias);\n\n // Register a specific address\n const otherResult = await sdk.registerAccount({\n address: '0x1234...' // Supports eth|, 0x, or client| formats\n });\n console.log('Other account exists:', otherResult.exists);\n}\n```\n\n**Response Structure:**\n```typescript\ninterface RegisterAccountResult {\n exists: boolean; // Whether account is registered\n walletAlias: string; // Normalized wallet alias (client|...)\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_register_account`\n",
911
- "samplePrompts": [
912
- "How do I manage your account?",
913
- "Show me how to manage your account with the SDK",
914
- "Explain the manage your account workflow",
915
- "What methods do I need for manage your account?"
916
- ]
917
- },
918
- "session-auth": {
919
- "key": "session-auth",
920
- "label": "Session auth",
921
- "description": "Session auth operations",
922
- "category": "auth",
923
- "methods": [
924
- "login",
925
- "logout",
926
- "refreshToken",
927
- "getSession",
928
- "isAuthenticated",
929
- "shouldRefreshToken",
930
- "getAccessToken",
931
- "ensureValidToken"
932
- ],
933
- "mcpTools": [
934
- "gala_launchpad_login",
935
- "gala_launchpad_logout",
936
- "gala_launchpad_refresh_token",
937
- "gala_launchpad_get_session",
938
- "gala_launchpad_is_authenticated",
939
- "gala_launchpad_should_refresh_token",
940
- "gala_launchpad_get_access_token",
941
- "gala_launchpad_ensure_valid_token"
942
- ],
943
- "explanation": "\n# Session Authentication (JWT) - SDK v5.1.0+\n\nJWT-based session authentication for protected operations (streaming, chat, profile updates).\n\n## Authentication Flow\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n environment: 'production',\n});\n\n// 1. Login to get JWT token\nconst session = await sdk.login();\nconsole.log('Authenticated:', session.address);\nconsole.log('Token expires in:', session.expiresIn, 'seconds');\n\n// 2. Check authentication status\nif (sdk.isAuthenticated()) {\n console.log('Session is valid');\n}\n\n// 3. Get current session info\nconst info = await sdk.getSession();\nconsole.log('Session issued at:', info.issuedAt);\nconsole.log('Session expires at:', info.expiresAt);\n\n// 4. Access token directly (for custom requests)\nconst token = sdk.getAccessToken();\nconsole.log('JWT token:', token);\n\n// 5. Refresh token before expiry\nif (sdk.shouldRefreshToken()) {\n const refreshed = await sdk.refreshToken();\n console.log('Token refreshed, new expiry:', refreshed.expiresIn);\n}\n\n// 6. Ensure valid token (auto-refreshes if needed)\nconst validToken = await sdk.ensureValidToken();\nconsole.log('Valid token obtained');\n\n// 7. Logout when done\nsdk.logout();\nconsole.log('Logged out');\n```\n\n## Auto-Refresh Behavior\n\nThe SDK automatically refreshes tokens when:\n- Token expires within 5 minutes (default threshold)\n- Making requests to JWT-protected endpoints\n\n```typescript\n// Manual refresh threshold check\nconst shouldRefresh = sdk.shouldRefreshToken(10 * 60 * 1000); // 10 min threshold\n\n// ensureValidToken auto-refreshes if needed\nconst token = await sdk.ensureValidToken(5 * 60 * 1000); // 5 min threshold\n```\n\n## Protected Endpoints\n\nThese operations require JWT authentication (call \\`login()\\` first):\n\n**Streaming:**\n- \\`startStream()\\` - Start live stream\n- \\`resetStreamKey()\\` - Reset RTMP key\n- \\`getRecordingDownload()\\` - Download recordings\n- \\`deleteRecording()\\` - Delete recordings\n- \\`addSimulcastTarget()\\` - Add simulcast\n- \\`removeSimulcastTarget()\\` - Remove simulcast\n\n**Chat:**\n- \\`sendChatMessage()\\` - Send chat messages\n\n**Profile:**\n- \\`updateProfile()\\` - Update user profile\n\n**Uploads:**\n- \\`uploadTokenImage()\\` - Upload token images\n- \\`uploadProfileImage()\\` - Upload profile images\n\n## Error Handling\n\n```typescript\ntry {\n await sdk.login();\n} catch (error) {\n if (error.message.includes('signature')) {\n console.error('Wallet signature failed');\n } else if (error.message.includes('network')) {\n console.error('Network error during login');\n }\n}\n\n// Check auth before protected operations\nif (!sdk.isAuthenticated()) {\n await sdk.login();\n}\n\ntry {\n await sdk.startStream('mytoken');\n} catch (error) {\n if (error.message.includes('JWT') || error.message.includes('token')) {\n // Re-authenticate and retry\n await sdk.login();\n await sdk.startStream('mytoken');\n }\n}\n```\n\n## Session Methods Reference\n\n| Method | Description | Returns |\n|--------|-------------|---------|\n| \\`login()\\` | Authenticate with wallet signature | \\`{ accessToken, expiresIn, address }\\` |\n| \\`logout()\\` | Clear JWT token (client-side) | \\`void\\` |\n| \\`refreshToken()\\` | Get new JWT token | \\`{ accessToken, expiresIn, address }\\` |\n| \\`getSession()\\` | Get session info | \\`{ address, issuedAt, expiresAt }\\` |\n| \\`isAuthenticated()\\` | Check if token exists and valid | \\`boolean\\` |\n| \\`shouldRefreshToken(threshold?)\\` | Check if refresh needed | \\`boolean\\` |\n| \\`getAccessToken()\\` | Get raw JWT token | \\`string | null\\` |\n| \\`ensureValidToken(threshold?)\\` | Auto-refresh if needed | \\`Promise<string>\\` |\n\n## Dev Bypass (STAGE Only)\n\nFor testing in STAGE environment without JWT:\n\n```typescript\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n environment: 'development',\n devBypass: true, // Skip JWT auth in STAGE\n});\n\n// Protected methods work without login() in STAGE\nawait sdk.startStream('testtoken');\n```\n\n**Note:** Dev bypass only works in STAGE/development environments.\n",
944
- "samplePrompts": [
945
- "How do I manage JWT authentication?",
946
- "Show me how to manage JWT authentication with the SDK",
947
- "Explain the manage JWT authentication workflow",
948
- "What methods do I need for manage JWT authentication?"
949
- ]
950
- },
951
- "streaming": {
952
- "key": "streaming",
953
- "label": "Streaming",
954
- "description": "Streaming operations",
955
- "category": "streaming",
956
- "methods": [
957
- "startStream",
958
- "stopStream",
959
- "getStreamInfo",
960
- "disableStream",
961
- "enableStream",
962
- "resetStreamKey",
963
- "getStreamRecordings",
964
- "getRecordingDownload",
965
- "deleteRecording",
966
- "getSimulcastTargets",
967
- "addSimulcastTarget",
968
- "removeSimulcastTarget",
969
- "getGlobalStreamingStatus",
970
- "setGlobalStreamingEnabled",
971
- "getAvailableRoles",
972
- "getStreamRole",
973
- "getTokenAccess"
974
- ],
975
- "mcpTools": [
976
- "gala_launchpad_start_stream",
977
- "gala_launchpad_stop_stream",
978
- "gala_launchpad_get_stream_info",
979
- "gala_launchpad_reset_stream_key",
980
- "gala_launchpad_get_stream_recordings",
981
- "gala_launchpad_get_recording_download",
982
- "gala_launchpad_delete_recording",
983
- "gala_launchpad_get_simulcast_targets",
984
- "gala_launchpad_add_simulcast_target",
985
- "gala_launchpad_remove_simulcast_target",
986
- "gala_launchpad_get_global_streaming_status",
987
- "gala_launchpad_set_global_streaming_enabled",
988
- "gala_launchpad_get_available_roles",
989
- "gala_launchpad_get_stream_role",
990
- "gala_launchpad_get_token_access"
991
- ],
992
- "explanation": "\n# Live Streaming SDK\n\nThe SDK provides comprehensive live streaming management including stream control,\nrecordings management, and simulcast to external platforms.\n\n## Starting a Stream\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageStream() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamWebSocketUrl: 'wss://stream.example.com', // Required for streaming\n streamAdminApiKey: 'your-admin-key', // Optional: for admin operations\n });\n\n // Start a stream for your token\n const stream = await sdk.startStream('mytoken');\n console.log('Stream Key:', stream.streamKey);\n console.log('RTMP URL:', stream.rtmpUrl);\n console.log('Playback URL:', stream.playbackUrl);\n // Use stream.streamKey in OBS or other RTMP software\n\n // Get stream info (public endpoint)\n const info = await sdk.getStreamInfo('mytoken');\n console.log('Status:', info.status); // IDLE, ACTIVE, DISABLED\n console.log('Is Live:', info.isLive);\n console.log('Viewers:', info.viewerCount);\n\n // Stop the stream when done\n await sdk.stopStream('mytoken');\n console.log('Stream stopped');\n\n // Reset stream key if compromised\n const newKey = await sdk.resetStreamKey('mytoken');\n console.log('New Stream Key:', newKey.streamKey);\n}\n```\n\n## Recordings Management\n\n```typescript\nasync function manageRecordings() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // List recordings (paginated)\n const recordings = await sdk.getStreamRecordings({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n });\n console.log('Total recordings:', recordings.total);\n\n for (const rec of recordings.recordings) {\n console.log('Asset ID:', rec.assetId);\n console.log('Duration:', rec.duration, 'seconds');\n console.log('Status:', rec.status); // READY, PROCESSING, ERRORED\n }\n\n // Get download URL for a recording\n const download = await sdk.getRecordingDownload('mytoken', 'asset-123');\n console.log('Download URL:', download.downloadUrl);\n console.log('Expires:', download.expiresAt);\n\n // Delete a recording\n await sdk.deleteRecording('mytoken', 'asset-123');\n}\n```\n\n## Simulcast Management\n\nRebroadcast your stream to external platforms (YouTube, Twitch, Facebook).\n\n```typescript\nasync function manageSimulcast() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get existing simulcast targets\n const targets = await sdk.getSimulcastTargets('mytoken');\n console.log('Max targets:', targets.maxTargets);\n console.log('Current targets:', targets.targets.length);\n\n // Add YouTube simulcast\n const youtube = await sdk.addSimulcastTarget({\n tokenName: 'mytoken',\n platform: 'YOUTUBE',\n rtmpUrl: 'rtmp://a.rtmp.youtube.com/live2',\n streamKey: 'your-youtube-stream-key',\n name: 'My YouTube Channel',\n });\n console.log('Added target:', youtube.target.targetId);\n\n // Add Twitch simulcast\n await sdk.addSimulcastTarget({\n tokenName: 'mytoken',\n platform: 'TWITCH',\n rtmpUrl: 'rtmp://live.twitch.tv/app',\n streamKey: 'live_123456_abcdef',\n name: 'Twitch Stream',\n });\n\n // Remove a simulcast target\n await sdk.removeSimulcastTarget('mytoken', youtube.target.targetId);\n}\n```\n\n## Admin Operations\n\nEnable/disable streaming globally or per-token (requires admin API key).\n\n```typescript\nasync function adminOperations() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamAdminApiKey: 'your-admin-key',\n });\n\n // Disable streaming for a specific token (admin-only)\n await sdk.disableStream('mytoken');\n\n // Re-enable streaming for a token (admin-only)\n await sdk.enableStream('mytoken');\n\n // Get global streaming status\n const globalStatus = await sdk.getGlobalStreamingStatus();\n console.log('Global streaming enabled:', globalStatus.enabled);\n\n // Enable/disable streaming globally (maintenance mode)\n await sdk.setGlobalStreamingEnabled(false); // Disable all streams\n await sdk.setGlobalStreamingEnabled(true); // Re-enable\n}\n```\n\n**Available SDK Methods:**\n| Method | Description | Auth |\n|--------|-------------|------|\n| `startStream(tokenName)` | Start a stream | Wallet |\n| `stopStream(tokenName)` | Stop a stream | Wallet |\n| `getStreamInfo(tokenName)` | Get stream status | Public |\n| `resetStreamKey(tokenName)` | Generate new stream key | Wallet |\n| `disableStream(tokenName)` | Disable token streaming | Admin |\n| `enableStream(tokenName)` | Enable token streaming | Admin |\n| `getStreamRecordings(options)` | List recordings | Public |\n| `getRecordingDownload(tokenName, assetId)` | Get download URL | Wallet |\n| `deleteRecording(tokenName, assetId)` | Delete recording | Wallet |\n| `getSimulcastTargets(tokenName)` | List simulcast targets | Public |\n| `addSimulcastTarget(options)` | Add simulcast target | Wallet |\n| `removeSimulcastTarget(tokenName, targetId)` | Remove target | Wallet |\n| `getGlobalStreamingStatus()` | Get global status | Public |\n| `setGlobalStreamingEnabled(enabled)` | Enable/disable globally | Admin |\n| `getAvailableRoles()` | Get list of available streaming roles | Public |\n| `getStreamRole(options)` | Get user's role for a token | JWT |\n| `getTokenAccess(options)` | Check user's access to a token stream | JWT (optional) |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_start_stream`\n- `gala_launchpad_stop_stream`\n- `gala_launchpad_get_stream_info`\n- `gala_launchpad_reset_stream_key`\n- `gala_launchpad_disable_stream`\n- `gala_launchpad_enable_stream`\n- `gala_launchpad_get_stream_recordings`\n- `gala_launchpad_get_recording_download`\n- `gala_launchpad_delete_recording`\n- `gala_launchpad_get_simulcast_targets`\n- `gala_launchpad_add_simulcast_target`\n- `gala_launchpad_remove_simulcast_target`\n- `gala_launchpad_get_global_streaming_status`\n- `gala_launchpad_set_global_streaming_enabled`\n- `gala_launchpad_get_available_roles`\n- `gala_launchpad_get_stream_role`\n- `gala_launchpad_get_token_access`\n",
993
- "samplePrompts": [
994
- "How do I manage live streams?",
995
- "Show me how to manage live streams with the SDK",
996
- "Explain the manage live streams workflow",
997
- "What methods do I need for manage live streams?"
998
- ]
999
- },
1000
- "stream-chat": {
1001
- "key": "stream-chat",
1002
- "label": "Stream chat",
1003
- "description": "Stream chat operations",
1004
- "category": "chat-messages",
1005
- "methods": [
1006
- "getChatMessages",
1007
- "sendChatMessage",
1008
- "updateChatMessage",
1009
- "deleteChatMessage",
1010
- "getChatStatus",
1011
- "disableChat",
1012
- "enableChat",
1013
- "getGlobalChatStatus",
1014
- "setGlobalChatEnabled",
1015
- "connectStreamWebSocket",
1016
- "authenticateStreamWebSocket",
1017
- "subscribeToStream",
1018
- "unsubscribeFromStream",
1019
- "sendStreamChatViaWebSocket",
1020
- "sendStreamReaction",
1021
- "disconnectStreamWebSocket",
1022
- "isStreamWebSocketConnected",
1023
- "getEngagementStats"
1024
- ],
1025
- "mcpTools": [
1026
- "gala_launchpad_get_chat_messages",
1027
- "gala_launchpad_send_chat_message",
1028
- "gala_launchpad_update_chat_message",
1029
- "gala_launchpad_delete_chat_message",
1030
- "gala_launchpad_get_chat_status",
1031
- "gala_launchpad_get_global_chat_status",
1032
- "gala_launchpad_set_global_chat_enabled",
1033
- "gala_launchpad_subscribe_to_stream",
1034
- "gala_launchpad_send_stream_chat_via_web_socket",
1035
- "gala_launchpad_send_stream_reaction",
1036
- "gala_launchpad_get_engagement_stats"
1037
- ],
1038
- "explanation": "\n# Stream Chat SDK\n\nThe SDK provides chat functionality for live streams, including REST API and\nWebSocket real-time messaging.\n\n## REST API Chat\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function restChat() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get chat messages (public endpoint)\n const messages = await sdk.getChatMessages({\n tokenName: 'mytoken',\n page: 1,\n limit: 50,\n });\n\n for (const msg of messages.messages) {\n console.log(`[${msg.createdAt}] ${msg.user?.fullName}: ${msg.content}`);\n }\n\n // Send a chat message via REST\n const sent = await sdk.sendChatMessage({\n tokenName: 'mytoken',\n content: 'Hello everyone!',\n });\n console.log('Message ID:', sent.message.messageId);\n\n // Delete a chat message (user can delete own, admin can delete any)\n const deleted = await sdk.deleteChatMessage({\n tokenName: 'mytoken',\n messageId: sent.message.messageId,\n });\n console.log('Message deleted:', deleted.deleted);\n\n // Check chat status\n const status = await sdk.getChatStatus('mytoken');\n console.log('Chat enabled:', status.enabled);\n if (!status.enabled) {\n console.log('Reason:', status.reason); // 'global' or 'token'\n }\n}\n```\n\n## WebSocket Real-time Chat\n\nLower latency messaging with real-time updates.\n\n```typescript\nasync function webSocketChat() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamWebSocketUrl: 'wss://stream.example.com',\n });\n\n // Connect with event callbacks\n await sdk.connectStreamWebSocket({\n onConnect: () => console.log('Connected!'),\n onDisconnect: (reason) => console.log('Disconnected:', reason),\n onError: (error) => console.error('Error:', error),\n onChatMessage: (msg) => {\n console.log(`[${msg.tokenName}] ${msg.userAddress}: ${msg.content}`);\n },\n onViewerCount: (data) => {\n console.log(`Viewers on ${data.tokenName}: ${data.count}`);\n },\n onStreamStatus: (status) => {\n console.log(`Stream ${status.tokenName}: ${status.status}`);\n },\n });\n\n // Authenticate (required for sending messages)\n await sdk.authenticateStreamWebSocket();\n\n // Subscribe to a stream's events\n const subscribed = await sdk.subscribeToStream('mytoken');\n console.log('Subscribed, stream status:', subscribed.status);\n\n // Send message via WebSocket (lower latency)\n await sdk.sendStreamChatViaWebSocket('mytoken', 'Hello via WebSocket!');\n\n // Send emoji reaction (ephemeral, not persisted)\n await sdk.sendStreamReaction('mytoken', '🔥', 0);\n\n // Unsubscribe when done\n await sdk.unsubscribeFromStream('mytoken');\n\n // Disconnect\n sdk.disconnectStreamWebSocket();\n}\n```\n\n## Admin Chat Operations\n\n```typescript\nasync function adminChat() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamAdminApiKey: 'your-admin-key',\n });\n\n // Disable chat for a token\n await sdk.disableChat('mytoken');\n\n // Re-enable chat\n await sdk.enableChat('mytoken');\n\n // Get global chat status\n const globalStatus = await sdk.getGlobalChatStatus();\n console.log('Global chat enabled:', globalStatus.enabled);\n\n // Disable/enable chat globally\n await sdk.setGlobalChatEnabled(false); // Disable all chat\n await sdk.setGlobalChatEnabled(true); // Re-enable\n}\n```\n\n**WebSocket Events:**\n| Event | Description | Payload |\n|-------|-------------|---------|\n| `chat_message` | New chat message | `{ tokenName, messageId, content, userAddress, user? }` |\n| `viewer_count` | Viewer count update | `{ tokenName, count }` |\n| `stream_status` | Stream status change | `{ tokenName, status, isLive, playbackId }` |\n| `chat_status` | Chat enabled/disabled | `{ tokenName, enabled }` |\n\n**Available SDK Methods:**\n| Method | Description | Auth |\n|--------|-------------|------|\n| `getChatMessages(options)` | Get chat history | Public |\n| `sendChatMessage(options)` | Send via REST | Wallet |\n| `deleteChatMessage(options)` | Delete message | Wallet/Admin |\n| `getChatStatus(tokenName)` | Check chat status | Public |\n| `disableChat(tokenName)` | Disable token chat | Admin |\n| `enableChat(tokenName)` | Enable token chat | Admin |\n| `getGlobalChatStatus()` | Get global status | Public |\n| `setGlobalChatEnabled(enabled)` | Enable/disable globally | Admin |\n| `connectStreamWebSocket(callbacks)` | Connect WebSocket | None |\n| `authenticateStreamWebSocket()` | Authenticate WS | Wallet |\n| `subscribeToStream(tokenName)` | Subscribe to events | None |\n| `unsubscribeFromStream(tokenName)` | Unsubscribe | None |\n| `sendStreamChatViaWebSocket(tokenName, content)` | Send via WS | Wallet |\n| `sendStreamReaction(tokenName, emoji, streamTime)` | Send emoji reaction | Wallet |\n| `disconnectStreamWebSocket()` | Close connection | None |\n| `getEngagementStats(tokenName)` | Get viewer and chat engagement stats | Public |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_chat_messages`\n- `gala_launchpad_send_chat_message`\n- `gala_launchpad_delete_chat_message`\n- `gala_launchpad_get_chat_status`\n- `gala_launchpad_set_chat_enabled`\n- `gala_launchpad_get_global_chat_status`\n- `gala_launchpad_set_global_chat_enabled`\n- `gala_launchpad_connect_stream_websocket`\n- `gala_launchpad_subscribe_to_stream`\n- `gala_launchpad_send_stream_chat_websocket`\n- `gala_launchpad_send_stream_reaction`\n- `gala_launchpad_get_engagement_stats`\n",
1039
- "samplePrompts": [
1040
- "How do I handle stream chat and messaging?",
1041
- "Show me how to handle stream chat and messaging with the SDK",
1042
- "Explain the handle stream chat and messaging workflow",
1043
- "What methods do I need for handle stream chat and messaging?"
1044
- ]
1045
- },
1046
- "ban-management": {
1047
- "key": "ban-management",
1048
- "label": "Ban management",
1049
- "description": "Ban management operations",
1050
- "category": "ban",
1051
- "methods": [
1052
- "createBan",
1053
- "removeBan",
1054
- "listBans",
1055
- "getBanStatus",
1056
- "getActiveUsers"
1057
- ],
1058
- "mcpTools": [
1059
- "gala_launchpad_create_ban",
1060
- "gala_launchpad_remove_ban",
1061
- "gala_launchpad_list_bans",
1062
- "gala_launchpad_get_ban_status",
1063
- "gala_launchpad_get_active_users"
1064
- ],
1065
- "explanation": "\n# Ban/Moderation Operations - SDK v5.5.0+\n\nUser ban management for stream moderation, including creating bans, removing bans,\nlisting banned users, checking ban status, and viewing active users.\n\n## Creating and Removing Bans\n\n```typescript\nimport { createLaunchpadSDK, BAN_DURATIONS } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key for ban ops\n});\n\n// Create a permanent ban\nconst permanentBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n reason: 'Spamming chat',\n});\nconsole.log('Permanent ban created:', permanentBan.ban.id);\n\n// Create a temporary ban (1 hour)\nconst tempBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0xabcdef1234567890abcdef1234567890abcdef12',\n reason: 'Inappropriate behavior',\n durationSeconds: BAN_DURATIONS.ONE_HOUR, // 3600 seconds\n});\nconsole.log('Temp ban expires:', tempBan.ban.expiresAt);\n\n// Remove a ban (unban user)\nconst unbanned = await sdk.removeBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n});\nconsole.log('User unbanned:', unbanned.removed);\n```\n\n## Duration Presets\n\n```typescript\nimport { BAN_DURATIONS } from '@gala-chain/launchpad-sdk';\n\n// Available presets\nBAN_DURATIONS.ONE_HOUR // 3600 seconds (1 hour)\nBAN_DURATIONS.ONE_DAY // 86400 seconds (24 hours)\nBAN_DURATIONS.ONE_WEEK // 604800 seconds (7 days)\nBAN_DURATIONS.ONE_MONTH // 2592000 seconds (30 days)\n\n// Custom duration (min: 60 sec, max: 31536000 sec / 1 year)\nconst customBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x...',\n durationSeconds: 7200, // 2 hours\n});\n```\n\n## Listing Bans\n\n```typescript\n// List all bans for a token\nconst allBans = await sdk.listBans({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n});\nconsole.log('Total bans:', allBans.meta.total);\n\nfor (const ban of allBans.bans) {\n console.log(`- ${ban.userAddress}: ${ban.reason || 'No reason'}`);\n console.log(` Permanent: ${ban.isPermanent}`);\n console.log(` Expires: ${ban.expiresAt || 'Never'}`);\n}\n\n// Search bans by user\nconst searchResults = await sdk.listBans({\n tokenName: 'mytoken',\n search: '0x1234', // Searches userAddress OR fullName\n});\n\n// Filter by specific field\nconst filteredBans = await sdk.listBans({\n tokenName: 'mytoken',\n userAddress: '0x1234', // Filter by address only\n name: 'John', // Filter by display name only\n});\n```\n\n## Checking Ban Status\n\n```typescript\n// Check if specific user is banned\nconst status = await sdk.getBanStatus({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n});\n\nif (status.banned) {\n console.log('User is banned!');\n console.log('Reason:', status.ban?.reason);\n console.log('Permanent:', status.ban?.isPermanent);\n console.log('Expires:', status.ban?.expiresAt);\n} else {\n console.log('User is not banned');\n}\n```\n\n## Viewing Active Users\n\n```typescript\nimport { ACTIVE_USER_TYPE } from '@gala-chain/launchpad-sdk';\n\n// Get all active viewers\nconst viewers = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n type: ACTIVE_USER_TYPE.VIEWERS, // or 'viewers'\n});\nconsole.log('Active viewers:', viewers.total);\n\n// Get only chat participants\nconst chatters = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n type: ACTIVE_USER_TYPE.CHAT_PARTICIPANTS, // or 'chat_participants'\n});\nconsole.log('Chat participants:', chatters.total);\n\n// Search active users\nconst searchActive = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n search: 'john', // Search by name or address\n});\n\nfor (const user of searchActive.users) {\n console.log(`- ${user.fullName || user.userAddress}`);\n console.log(` In chat: ${user.isChatParticipant}`);\n}\n```\n\n## Authentication\n\nBan operations support two authentication modes:\n\n1. **Admin API Key** (streamAdminApiKey) - Full moderation access\n2. **JWT Auth** (login()) - Token owner moderation only\n\n```typescript\n// Admin mode - can moderate any token\nconst adminSdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,\n});\n\n// Owner mode - can only moderate own tokens\nconst ownerSdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\nawait ownerSdk.login(); // JWT authentication required\n```\n\n## WebSocket Events\n\nBan events are broadcast to affected users via WebSocket:\n\n```typescript\n// Listen for ban events\nsdk.connectStreamWebSocket({\n onUserBanned: (event) => {\n console.log('User banned:', event.userAddress);\n console.log('Reason:', event.reason);\n console.log('Expires:', event.expiresAt);\n },\n onUserUnbanned: (event) => {\n console.log('User unbanned:', event.userAddress);\n },\n onBanEnforcement: (event) => {\n // Received when banned user tries to chat/react\n console.log('Ban enforced for action:', event.action);\n console.log('Reason:', event.reason);\n },\n});\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createBan(options)` | Create a new ban | Admin/Owner |\n| `removeBan(options)` | Remove a ban (unban user) | Admin/Owner |\n| `listBans(options)` | List banned users | Admin/Owner |\n| `getBanStatus(options)` | Check if user is banned | Admin/Owner |\n| `getActiveUsers(options)` | Get active viewers/chatters | Admin/Owner |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_ban`\n- `gala_launchpad_remove_ban`\n- `gala_launchpad_list_bans`\n- `gala_launchpad_get_ban_status`\n- `gala_launchpad_get_active_users`\n",
1066
- "samplePrompts": [
1067
- "How do I manage user bans?",
1068
- "Show me how to manage user bans with the SDK",
1069
- "Explain the manage user bans workflow",
1070
- "What methods do I need for manage user bans?"
1071
- ]
1072
- },
1073
- "api-key-management": {
1074
- "key": "api-key-management",
1075
- "label": "Api key management",
1076
- "description": "Api key management operations",
1077
- "category": "api-keys",
1078
- "methods": [
1079
- "createApiKey",
1080
- "listApiKeys",
1081
- "getApiKey",
1082
- "updateApiKey",
1083
- "revokeApiKey",
1084
- "getApiKeyRoles"
1085
- ],
1086
- "mcpTools": [
1087
- "gala_launchpad_create_api_key",
1088
- "gala_launchpad_list_api_keys",
1089
- "gala_launchpad_get_api_key",
1090
- "gala_launchpad_update_api_key",
1091
- "gala_launchpad_revoke_api_key",
1092
- "gala_launchpad_get_api_key_roles"
1093
- ],
1094
- "explanation": "\n# API Key Management - SDK v5.6.0+\n\nUser-managed API keys with role-based permissions for delegating token management\nauthority to third-party services or automated systems.\n\n**CRITICAL**: Raw API keys are ONLY shown once at creation time. Store them\nsecurely immediately - they cannot be retrieved again.\n\n## Creating API Keys\n\n```typescript\nimport { createLaunchpadSDK, API_KEY_ROLE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\n// MUST authenticate first\nawait sdk.login();\n\n// Create a moderator key for specific tokens\nconst result = await sdk.createApiKey({\n role: API_KEY_ROLE.MODERATOR,\n description: 'Chat moderation bot',\n delegateAllTokens: false,\n tokenNames: ['mytoken', 'othertoken'],\n expiresAt: '2025-12-31T23:59:59Z', // Optional expiration\n});\n\n// CRITICAL: Save this immediately - shown only once!\nconsole.log('Raw Key:', result.rawKey);\n// Format: glp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nconsole.log('Key ID:', result.id);\nconsole.log('Prefix:', result.keyPrefix);\n```\n\n## Role Hierarchy\n\n```typescript\nimport { API_KEY_ROLE, API_KEY_ROLE_HIERARCHY } from '@gala-chain/launchpad-sdk';\n\n// Available roles (hierarchical)\nAPI_KEY_ROLE.MODERATOR // Chat, comments, bans\nAPI_KEY_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start\nAPI_KEY_ROLE.MANAGER // Moderator + Technical Producer + recordings\nAPI_KEY_ROLE.OWNER // Full access (indistinguishable from normal auth)\n\n// Role hierarchy levels\nAPI_KEY_ROLE_HIERARCHY.MODERATOR // 1\nAPI_KEY_ROLE_HIERARCHY.TECHNICAL_PRODUCER // 1\nAPI_KEY_ROLE_HIERARCHY.MANAGER // 2\nAPI_KEY_ROLE_HIERARCHY.OWNER // 3\n\n// Check if role has sufficient permission\nimport { roleHasSufficientPermission } from '@gala-chain/launchpad-sdk';\n\nconst canManage = roleHasSufficientPermission('MANAGER', 'MODERATOR'); // true\nconst canOwn = roleHasSufficientPermission('MODERATOR', 'OWNER'); // false\n```\n\n## Token Delegation\n\n```typescript\n// Delegate all tokens (current and future)\nconst allTokensKey = await sdk.createApiKey({\n role: API_KEY_ROLE.MODERATOR,\n description: 'All tokens moderator',\n delegateAllTokens: true,\n});\n\n// Delegate specific tokens only\nconst specificKey = await sdk.createApiKey({\n role: API_KEY_ROLE.MANAGER,\n description: 'Project manager for specific tokens',\n delegateAllTokens: false,\n tokenNames: ['token1', 'token2', 'token3'], // Case-insensitive\n});\n```\n\n## Listing and Getting API Keys\n\n```typescript\n// List all API keys (paginated)\nconst list = await sdk.listApiKeys({\n page: 1,\n limit: 20,\n});\nconsole.log('Total keys:', list.meta.total);\n\nfor (const key of list.apiKeys) {\n console.log(`- ${key.keyPrefix}: ${key.role}`);\n console.log(` Description: ${key.description || 'None'}`);\n console.log(` Last used: ${key.lastUsedAt || 'Never'}`);\n console.log(` Expires: ${key.expiresAt || 'Never'}`);\n}\n\n// Get single API key by ID\nconst key = await sdk.getApiKey(123);\nconsole.log('Key details:', key);\n```\n\n## Updating API Keys\n\n```typescript\n// Update description\nconst updated = await sdk.updateApiKey(123, {\n description: 'Updated description',\n});\n\n// Upgrade role\nawait sdk.updateApiKey(123, {\n role: API_KEY_ROLE.MANAGER,\n});\n\n// Change token delegation\nawait sdk.updateApiKey(123, {\n delegateAllTokens: true,\n});\n\n// Update specific token access (replaces existing)\nawait sdk.updateApiKey(123, {\n delegateAllTokens: false,\n tokenNames: ['newtoken1', 'newtoken2'],\n});\n\n// Update expiration (null to remove)\nawait sdk.updateApiKey(123, {\n expiresAt: '2026-12-31T23:59:59Z',\n});\n\n// Remove expiration\nawait sdk.updateApiKey(123, {\n expiresAt: null,\n});\n```\n\n## Revoking API Keys\n\n```typescript\n// Revoke (soft delete) an API key\nawait sdk.revokeApiKey(123);\nconsole.log('API key revoked');\n\n// Key is now unusable - attempts to use it will fail with 401\n```\n\n## Getting Available Roles\n\n```typescript\n// Get list of valid roles\nconst roles = sdk.getApiKeyRoles();\nconsole.log('Available roles:', roles);\n// ['MODERATOR', 'TECHNICAL_PRODUCER', 'MANAGER', 'OWNER']\n```\n\n## Validation Helpers\n\n```typescript\nimport {\n isValidApiKeyRole,\n validateCreateApiKeyOptions,\n validateUpdateApiKeyOptions,\n} from '@gala-chain/launchpad-sdk';\n\n// Validate role string\nif (isValidApiKeyRole('MODERATOR')) {\n console.log('Valid role');\n}\n\n// Validate creation options\nconst createErrors = validateCreateApiKeyOptions({\n role: 'MODERATOR',\n description: 'Test key',\n});\nif (createErrors.length > 0) {\n console.error('Validation errors:', createErrors);\n}\n\n// Validate update options\nconst updateErrors = validateUpdateApiKeyOptions({\n role: 'MANAGER',\n expiresAt: '2025-12-31T23:59:59Z',\n});\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createApiKey(options)` | Create new API key | JWT |\n| `listApiKeys(options?)` | List API keys (paginated) | JWT |\n| `getApiKey(id)` | Get API key by ID | JWT |\n| `updateApiKey(id, options)` | Update API key | JWT |\n| `revokeApiKey(id)` | Revoke (soft delete) key | JWT |\n| `getApiKeyRoles()` | Get valid role list | None |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_api_key`\n- `gala_launchpad_list_api_keys`\n- `gala_launchpad_get_api_key`\n- `gala_launchpad_update_api_key`\n- `gala_launchpad_revoke_api_key`\n- `gala_launchpad_get_api_key_roles`\n",
1095
- "samplePrompts": [
1096
- "How do I manage API keys?",
1097
- "Show me how to manage API keys with the SDK",
1098
- "Explain the manage API keys workflow",
1099
- "What methods do I need for manage API keys?"
1100
- ]
1101
- },
1102
- "moderator-invites": {
1103
- "key": "moderator-invites",
1104
- "label": "Moderator invites",
1105
- "description": "Moderator invites operations",
1106
- "category": "moderators",
1107
- "methods": [
1108
- "createModeratorInvite",
1109
- "claimModeratorInvite",
1110
- "getModeratedTokens",
1111
- "listModeratorInvites",
1112
- "revokeModeratorInvite",
1113
- "getModeratorInviteByCode",
1114
- "updateModeratorInviteRole"
1115
- ],
1116
- "mcpTools": [
1117
- "gala_launchpad_create_moderator_invite",
1118
- "gala_launchpad_claim_moderator_invite",
1119
- "gala_launchpad_get_moderated_tokens",
1120
- "gala_launchpad_list_moderator_invites",
1121
- "gala_launchpad_revoke_moderator_invite",
1122
- "gala_launchpad_update_moderator_invite_role"
1123
- ],
1124
- "explanation": "\n# Moderator Invites - SDK v5.7.0+\n\nMagic link-based moderator delegation system. Token owners can create invite\nlinks to grant stream management access to other users without needing their\nwallet address upfront.\n\n## Flow Overview\n\n1. **Owner creates invite** → Gets magic link URL\n2. **Owner shares link** (email, Slack, Discord, etc.)\n3. **Recipient clicks link** → Redirected to claim page\n4. **Recipient logs in** → Claims invite with their wallet\n5. **Recipient gains access** → Token appears in their /studio dashboard\n\n## Creating Moderator Invites\n\n```typescript\nimport { createLaunchpadSDK, MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\n// MUST authenticate first\nawait sdk.login();\n\n// Create an invite for a moderator\nconst result = await sdk.createModeratorInvite({\n tokenName: 'mytoken',\n role: MODERATOR_ROLE.MODERATOR,\n description: 'John - Friday stream moderator',\n expiresAt: '2025-12-31T23:59:59Z', // Optional expiration\n});\n\n// Share this URL with the intended moderator\nconsole.log('Invite URL:', result.invite.inviteUrl);\nconsole.log('Invite Code:', result.invite.inviteCode);\nconsole.log('Status:', result.invite.status); // PENDING\n```\n\n## Moderator Roles\n\n```typescript\nimport { MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';\n\n// Available roles (OWNER not available for invites)\nMODERATOR_ROLE.MODERATOR // Chat, comments, bans\nMODERATOR_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start\nMODERATOR_ROLE.MANAGER // All of the above + recordings + stream settings\n```\n\n## Listing Invites\n\n```typescript\n// List all invites for a token (owner only)\nconst list = await sdk.listModeratorInvites({\n tokenName: 'mytoken',\n status: 'PENDING', // Optional filter: PENDING, CLAIMED, REVOKED, EXPIRED\n page: 1,\n limit: 20,\n});\n\nconsole.log('Total invites:', list.meta.totalItems);\n\nfor (const invite of list.invites) {\n console.log(`- ID ${invite.id}: ${invite.role}`);\n console.log(` Status: ${invite.status}`);\n console.log(` Description: ${invite.description || 'None'}`);\n console.log(` Created: ${invite.createdAt}`);\n console.log(` Expires: ${invite.expiresAt || 'Never'}`);\n}\n```\n\n## Claiming Invites (Recipient Side)\n\n```typescript\n// Extract code from magic link URL\nconst inviteCode = 'abc123...'; // 64-character hex code\n\n// Recipient authenticates and claims\nawait sdk.login();\n\nconst result = await sdk.claimModeratorInvite({\n inviteCode: inviteCode,\n});\n\nconsole.log('Claimed token:', result.token.tokenName);\nconsole.log('Your role:', result.token.role);\nconsole.log('Claimed at:', result.token.claimedAt);\n// Token now appears in /studio dashboard\n```\n\n## Previewing Invites (Public)\n\n```typescript\n// Preview invite details before logging in (public endpoint)\nconst preview = await sdk.getModeratorInviteByCode('abc123...');\n\nconsole.log('Token:', preview.tokenName);\nconsole.log('Symbol:', preview.tokenSymbol);\nconsole.log('Role offered:', preview.role);\nconsole.log('Status:', preview.status);\nconsole.log('Invited by:', preview.invitedBy.fullName);\n```\n\n## Getting Moderated Tokens (Studio Dashboard)\n\n```typescript\n// Get all tokens where you have moderator access\nawait sdk.login();\n\nconst tokens = await sdk.getModeratedTokens({\n page: 1,\n limit: 20,\n});\n\nfor (const token of tokens.tokens) {\n console.log(`- ${token.tokenName} (${token.tokenSymbol})`);\n console.log(` Role: ${token.role}`);\n console.log(` Stream status: ${token.muxStreamStatus}`);\n}\n```\n\n## Revoking Invites\n\n```typescript\n// Revoke by invite ID (owner only)\nawait sdk.revokeModeratorInvite(123);\nconsole.log('Invite revoked');\n\n// If already claimed, moderator loses access immediately\n// If pending, invite can no longer be claimed\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createModeratorInvite(options)` | Create magic link invite | JWT (owner) |\n| `claimModeratorInvite(options)` | Claim invite with code | JWT |\n| `getModeratedTokens(options?)` | Get tokens you moderate | JWT |\n| `listModeratorInvites(options)` | List invites for token | JWT (owner) |\n| `revokeModeratorInvite(id)` | Revoke invite by ID | JWT (owner) |\n| `getModeratorInviteByCode(code)` | Preview invite details | None |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_moderator_invite`\n- `gala_launchpad_claim_moderator_invite`\n- `gala_launchpad_get_moderated_tokens`\n- `gala_launchpad_list_moderator_invites`\n- `gala_launchpad_revoke_moderator_invite`\n- `gala_launchpad_get_moderator_invite`\n",
1125
- "samplePrompts": [
1126
- "How do I manage moderator invites?",
1127
- "Show me how to manage moderator invites with the SDK",
1128
- "Explain the manage moderator invites workflow",
1129
- "What methods do I need for manage moderator invites?"
1130
- ]
1131
- },
1132
- "overseer-invites": {
1133
- "key": "overseer-invites",
1134
- "label": "Overseer invites",
1135
- "description": "Overseer invites operations",
1136
- "category": "overseers",
1137
- "methods": [
1138
- "createOverseerInvite",
1139
- "claimOverseerInvite",
1140
- "listOverseerInvites",
1141
- "getOverseerInviteByCode",
1142
- "revokeOverseerInvite",
1143
- "listOverseers",
1144
- "revokeOverseer",
1145
- "getMyOverseerStatus",
1146
- "getOverseerSummary"
1147
- ],
1148
- "mcpTools": [
1149
- "gala_launchpad_create_overseer_invite",
1150
- "gala_launchpad_claim_overseer_invite",
1151
- "gala_launchpad_list_overseer_invites",
1152
- "gala_launchpad_revoke_overseer_invite",
1153
- "gala_launchpad_list_overseers",
1154
- "gala_launchpad_revoke_overseer",
1155
- "gala_launchpad_get_my_overseer_status",
1156
- "gala_launchpad_get_overseer_summary"
1157
- ],
1158
- "explanation": "\n# Overseer System - SDK v5.9.0+\n\nGlobal platform oversight via magic link invites. Overseers have MANAGER-level\naccess to ALL tokens (current and future), unlike moderators who have token-scoped access.\n\n## Key Differences from Moderators\n\n| Feature | Moderator | Overseer |\n|---------|-----------|----------|\n| Scope | Per-token or blanket (owner's tokens) | ALL tokens on platform |\n| Access Level | MODERATOR, TECHNICAL_PRODUCER, or MANAGER | Always MANAGER |\n| Grant Authority | Token owner | Admin or existing Overseer |\n| Use Case | Stream management delegation | Platform-wide oversight |\n\n## Creating Overseer Invites\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key OR JWT auth\n});\n\n// Option 1: Using Admin API key\nconst result = await sdk.createOverseerInvite({\n description: 'John - Platform Support Team',\n expiresAt: '2025-12-31T23:59:59Z', // Optional\n});\n\n// Option 2: Using JWT (as existing Overseer)\nawait sdk.login();\nconst result = await sdk.createOverseerInvite({\n description: 'Platform team member',\n});\n\nconsole.log('Share this link:', result.invite.inviteUrl);\nconsole.log('Invite Code:', result.invite.inviteCode);\n```\n\n## Claiming Overseer Invites\n\n```typescript\n// Recipient must be authenticated\nawait sdk.login();\n\n// Claim the invite\nconst claimed = await sdk.claimOverseerInvite('abc123...');\nconsole.log('Now an overseer!');\nconsole.log('Status:', claimed.invite.status); // CLAIMED\n\n// Check own status\nconst status = await sdk.getMyOverseerStatus();\nconsole.log('Is Overseer:', status.isOverseer); // true\nconsole.log('Granted at:', status.overseer?.createdAt);\n```\n\n## Listing Overseers and Invites\n\n```typescript\n// List all overseer invites (paginated)\nconst invites = await sdk.listOverseerInvites({\n status: 'PENDING', // PENDING, CLAIMED, REVOKED, EXPIRED\n page: 1,\n limit: 20,\n});\n\nfor (const invite of invites.invites) {\n console.log(`#${invite.id}: ${invite.description || 'No description'}`);\n console.log(` Status: ${invite.status}`);\n console.log(` Created by: ${invite.invitedBy.fullName || invite.invitedBy.address}`);\n}\n\n// List all active overseers\nconst overseers = await sdk.listOverseers({\n status: 'ACTIVE', // ACTIVE or REVOKED\n page: 1,\n limit: 20,\n});\n\nfor (const overseer of overseers.overseers) {\n console.log(`Overseer: ${overseer.userAddress}`);\n console.log(` Since: ${overseer.createdAt}`);\n}\n```\n\n## Public Invite Preview\n\n```typescript\n// Get public info about an invite (no auth required)\nconst preview = await sdk.getOverseerInviteByCode('abc123...');\n\nconsole.log('Status:', preview.status);\nconsole.log('Description:', preview.description);\nconsole.log('Invited by:', preview.invitedBy.fullName);\nconsole.log('Expires:', preview.expiresAt);\n```\n\n## Revoking Access\n\n```typescript\n// Revoke an invite by ID\nawait sdk.revokeOverseerInvite(123);\nconsole.log('Invite revoked');\n\n// Revoke an overseer by wallet address\nawait sdk.revokeOverseer('eth|1234567890abcdef...');\nconsole.log('Overseer access revoked');\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createOverseerInvite(options?)` | Create magic link invite | Admin API key OR JWT (Overseer) |\n| `claimOverseerInvite(code)` | Claim invite with code | JWT |\n| `listOverseerInvites(options?)` | List all overseer invites | Admin API key OR JWT (Overseer) |\n| `getOverseerInviteByCode(code)` | Preview invite details | None (public) |\n| `revokeOverseerInvite(id)` | Revoke invite by ID | Admin API key OR JWT (Overseer) |\n| `listOverseers(options?)` | List all overseers | Admin API key OR JWT (Overseer) |\n| `revokeOverseer(address)` | Revoke overseer by address | Admin API key OR JWT (Overseer) |\n| `getMyOverseerStatus()` | Check own overseer status | JWT |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_overseer_invite`\n- `gala_launchpad_claim_overseer_invite`\n- `gala_launchpad_list_overseer_invites`\n- `gala_launchpad_get_overseer_invite`\n- `gala_launchpad_revoke_overseer_invite`\n- `gala_launchpad_list_overseers`\n- `gala_launchpad_revoke_overseer`\n- `gala_launchpad_get_my_overseer_status`\n- `gala_launchpad_get_overseer_summary`\n",
1159
- "samplePrompts": [
1160
- "How do I manage overseer invites?",
1161
- "Show me how to manage overseer invites with the SDK",
1162
- "Explain the manage overseer invites workflow",
1163
- "What methods do I need for manage overseer invites?"
1164
- ]
1165
- },
1166
- "content-flag-management": {
1167
- "key": "content-flag-management",
1168
- "label": "Content flag management",
1169
- "description": "Content flag management operations",
1170
- "category": "content-flags",
1171
- "methods": [
1172
- "createFlag",
1173
- "listFlags",
1174
- "listGlobalFlags",
1175
- "dismissFlag",
1176
- "actionFlag",
1177
- "getComments",
1178
- "createComment",
1179
- "updateComment",
1180
- "deleteComment"
1181
- ],
1182
- "mcpTools": [
1183
- "gala_launchpad_create_flag",
1184
- "gala_launchpad_list_flags",
1185
- "gala_launchpad_list_global_flags",
1186
- "gala_launchpad_dismiss_flag",
1187
- "gala_launchpad_action_flag",
1188
- "gala_launchpad_get_comments",
1189
- "gala_launchpad_create_comment",
1190
- "gala_launchpad_update_comment",
1191
- "gala_launchpad_delete_comment"
1192
- ],
1193
- "explanation": "\n# Content Flag Management - SDK v5.11.0+\n\nContent moderation via flags and comments. Moderators can flag content for review,\ntake action on flags (delete content, ban users), and manage pool comments.\n\n## Content Types\n\nFlags can be created for:\n- `MESSAGE` - Chat messages\n- `COMMENT` - Pool comments\n- `STREAM` - Live streams (admin only)\n\n## Creating Content Flags\n\n```typescript\nimport { createLaunchpadSDK, CONTENT_TYPE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\nawait sdk.login();\n\n// Flag a chat message\nconst flag = await sdk.createFlag({\n tokenName: 'mytoken',\n contentType: CONTENT_TYPE.MESSAGE,\n contentId: 'msg-123',\n reason: 'Spam/harassment',\n});\n\nconsole.log('Flag ID:', flag.id);\nconsole.log('Status:', flag.status); // PENDING\n```\n\n## Listing Flags\n\n```typescript\n// List all pending flags for a token\nconst flags = await sdk.listFlags({\n tokenName: 'mytoken',\n status: 'PENDING',\n page: 1,\n limit: 20,\n});\n\nfor (const flag of flags.flags) {\n console.log(`Flag #${flag.id}: ${flag.contentType}`);\n console.log(` Reason: ${flag.reason}`);\n console.log(` Reporter: ${flag.reporterAddress}`);\n}\n```\n\n## Taking Action on Flags\n\n```typescript\n// Dismiss a flag (no action taken)\nawait sdk.dismissFlag(flagId);\n\n// Take action - delete content only\nawait sdk.actionFlag(flagId, {\n action: 'DELETE_CONTENT',\n});\n\n// Take action - ban the user\nawait sdk.actionFlag(flagId, {\n action: 'BAN_USER',\n banDuration: 3600, // 1 hour ban\n});\n\n// Take action - delete content AND ban user\nawait sdk.actionFlag(flagId, {\n action: 'DELETE_AND_BAN',\n banDuration: 86400, // 24 hour ban\n});\n```\n\n## Managing Pool Comments with Reactions\n\nComments include a `messageId` for reactions integration and optional `reactions` data.\n\n```typescript\n// Fetch comments for a pool (with reactions data)\nconst comments = await sdk.getComments({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n});\n\nfor (const comment of comments.comments) {\n console.log(`ID: ${comment.id}, MessageId: ${comment.messageId}`);\n console.log(`${comment.userAddress}: ${comment.content}`);\n\n // Check reactions on this comment\n if (comment.reactions) {\n console.log(`Total reactions: ${comment.reactions.totalCount}`);\n for (const reaction of comment.reactions.reactions) {\n console.log(` ${reaction.reactionType}: ${reaction.count} (you reacted: ${reaction.userReacted})`);\n }\n }\n}\n\n// Post a comment (requires JWT auth)\nawait sdk.login();\nconst newComment = await sdk.createComment({\n tokenName: 'mytoken',\n content: 'Great project! Looking forward to the launch.',\n});\nconsole.log('Comment messageId:', newComment.comment.messageId);\n\n// Add a reaction to a comment using its messageId\nawait sdk.addReaction({\n messageId: newComment.comment.messageId,\n reaction: '👍',\n});\n\n// Remove a reaction\nawait sdk.removeReaction({\n messageId: newComment.comment.messageId,\n reaction: '👍',\n});\n\n// Delete a comment (moderator only)\nawait sdk.deleteComment({ commentId: comment.id });\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createFlag(options)` | Flag content for review | JWT |\n| `listFlags(options)` | List flags for a token | API key OR JWT (Moderator) |\n| `dismissFlag(flagId)` | Dismiss flag (no action) | API key OR JWT (Moderator) |\n| `actionFlag(flagId, options)` | Take action on flag | API key OR JWT (Moderator) |\n| `getComments(options)` | Get pool comments with reactions | None (public) |\n| `createComment(options)` | Post a comment, returns messageId | JWT |\n| `deleteComment(options)` | Delete a comment | API key OR JWT (Moderator) |\n| `addReaction(options)` | Add reaction to comment/message | JWT |\n| `removeReaction(options)` | Remove reaction from comment/message | JWT |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_flag`\n- `gala_launchpad_list_flags`\n- `gala_launchpad_dismiss_flag`\n- `gala_launchpad_action_flag`\n- `gala_launchpad_fetch_comments`\n- `gala_launchpad_post_comment`\n- `gala_launchpad_delete_comment`\n- `gala_launchpad_add_reaction`\n- `gala_launchpad_remove_reaction`\n",
1194
- "samplePrompts": [
1195
- "How do I manage content flags?",
1196
- "Show me how to manage content flags with the SDK",
1197
- "Explain the manage content flags workflow",
1198
- "What methods do I need for manage content flags?"
1199
- ]
1200
- },
1201
- "content-reactions": {
1202
- "key": "content-reactions",
1203
- "label": "Content reactions",
1204
- "description": "Content reactions operations",
1205
- "category": "content-reactions",
1206
- "methods": [
1207
- "addContentReaction",
1208
- "removeContentReaction",
1209
- "addReactionToChatMessage",
1210
- "removeReactionFromChatMessage",
1211
- "addReactionToComment",
1212
- "removeReactionFromComment"
1213
- ],
1214
- "mcpTools": [
1215
- "gala_launchpad_add_content_reaction",
1216
- "gala_launchpad_remove_content_reaction",
1217
- "gala_launchpad_add_reaction_to_chat_message",
1218
- "gala_launchpad_remove_reaction_from_chat_message",
1219
- "gala_launchpad_add_reaction_to_comment",
1220
- "gala_launchpad_remove_reaction_from_comment"
1221
- ],
1222
- "explanation": "",
1223
- "samplePrompts": [
1224
- "How do I manage content reactions?",
1225
- "Show me how to manage content reactions with the SDK",
1226
- "Explain the manage content reactions workflow",
1227
- "What methods do I need for manage content reactions?"
1228
- ]
1229
- },
1230
- "trade-history": {
1231
- "key": "trade-history",
1232
- "label": "Trade history",
1233
- "description": "Trade history operations",
1234
- "category": "trades",
1235
- "methods": [
1236
- "getTrades"
1237
- ],
1238
- "mcpTools": [
1239
- "gala_launchpad_get_trades"
1240
- ],
1241
- "explanation": "\n## Trade History\n\nQuery and analyze trading activity for tokens.\n\n### Basic Usage\n\n```typescript\nimport { LaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = new LaunchpadSDK({ environment: 'production' });\n\n// Get recent trades for a token\nconst result = await sdk.getTrades({\n tokenName: 'anime',\n limit: 10,\n page: 1\n});\n\nconsole.log(`Found ${result.trades.length} trades`);\nfor (const trade of result.trades) {\n console.log(`${trade.txnType}: ${trade.inputAmount} → ${trade.outputAmount}`);\n}\n```\n\n### Filter by Trade Type\n\n```typescript\n// Get only buy orders\nconst buyTrades = await sdk.getTrades({\n tokenName: 'anime',\n txnType: 'BUY',\n limit: 50\n});\n\n// Get only sell orders\nconst sellTrades = await sdk.getTrades({\n tokenName: 'anime',\n txnType: 'SELL',\n limit: 50\n});\n```\n\n### Date Range Queries\n\n```typescript\nconst oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);\nconst now = new Date();\n\nconst recentTrades = await sdk.getTrades({\n tokenName: 'anime',\n startDate: oneWeekAgo,\n endDate: now,\n limit: 50\n});\n```\n\n### Filter by User\n\n```typescript\n// Get trades for a specific wallet\nconst userTrades = await sdk.getTrades({\n tokenName: 'anime',\n userAddress: 'eth|0x1234...',\n limit: 20\n});\n```\n\n### Pagination\n\n```typescript\n// Paginate through all trades\nlet page = 1;\nlet hasMore = true;\n\nwhile (hasMore) {\n const result = await sdk.getTrades({ tokenName: 'anime', page, limit: 50 });\n console.log(`Page ${page}: ${result.trades.length} trades`);\n\n hasMore = result.trades.length === 50;\n page++;\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_trades`\n",
1242
- "samplePrompts": [
1243
- "How do I view trading history?",
1244
- "Show me how to view trading history with the SDK",
1245
- "Explain the view trading history workflow",
1246
- "What methods do I need for view trading history?"
1247
- ]
1248
- },
1249
- "token-ban-management": {
1250
- "key": "token-ban-management",
1251
- "label": "Token ban management",
1252
- "description": "Token ban management operations",
1253
- "category": "token-ban",
1254
- "methods": [
1255
- "banToken",
1256
- "unbanToken",
1257
- "listTokenBans",
1258
- "getTokenBan",
1259
- "isTokenBanned"
1260
- ],
1261
- "mcpTools": [
1262
- "gala_launchpad_ban_token",
1263
- "gala_launchpad_unban_token",
1264
- "gala_launchpad_list_token_bans",
1265
- "gala_launchpad_get_token_ban",
1266
- "gala_launchpad_is_token_banned"
1267
- ],
1268
- "explanation": "\n# Token Ban Management - SDK v6.x.0+\n\nPlatform-wide token ban operations for overseers. Banned tokens are hidden from ALL listings\nand have actions (comments, streaming, chat) blocked. This is different from user bans which\nonly affect specific users on specific tokens.\n\n**Access Control:** All methods require either:\n- streamAdminApiKey (server-to-server)\n- JWT with overseer status (authenticated overseer user)\n\n**Effects of Token Bans:**\n- Hidden from ALL pool listings (including creator's profile)\n- Comments blocked on banned tokens\n- Live streaming blocked on banned tokens\n- Chat messages blocked on banned tokens\n- Trading NOT blocked (GalaChain handles trading independently)\n\n## Banning a Token\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\n// Using Admin API key\nconst sdk = createLaunchpadSDK({\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,\n});\n\n// Or using JWT auth (must be an overseer)\nconst sdkWithAuth = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\nawait sdkWithAuth.login({ walletAddress: 'eth|0x...' });\n\n// Ban a token with reason\nconst result = await sdk.banToken({\n tokenName: 'scamtoken',\n reason: 'Fraudulent project - reported by multiple users',\n});\nconsole.log('Token banned:', result.tokenName);\nconsole.log('Ban ID:', result.ban.id);\nconsole.log('Banned by:', result.ban.bannedBy);\n\n// Ban without reason (optional)\nawait sdk.banToken({ tokenName: 'problematictoken' });\n```\n\n## Unbanning a Token\n\n```typescript\n// Remove a token ban\nconst result = await sdk.unbanToken({ tokenName: 'scamtoken' });\nconsole.log('Ban removed:', result.removed); // true\nconsole.log('Token:', result.tokenName);\n\n// Token is now:\n// - Visible in pool listings again\n// - Comments re-enabled\n// - Live streaming re-enabled\n// - Chat re-enabled\n```\n\n## Checking Token Ban Status\n\n```typescript\n// Check if a specific token is banned\nconst status = await sdk.isTokenBanned({ tokenName: 'sometoken' });\n\nif (status.banned) {\n console.log('Token is banned!');\n console.log('Reason:', status.ban?.reason);\n console.log('Banned by:', status.ban?.bannedBy);\n console.log('Banned at:', status.ban?.createdAt);\n} else {\n console.log('Token is not banned');\n}\n\n// getTokenBan is an alias - use whichever is more readable\nconst details = await sdk.getTokenBan({ tokenName: 'sometoken' });\n```\n\n## Listing All Banned Tokens\n\n```typescript\n// Get first page with default limit (20)\nconst page1 = await sdk.listTokenBans({});\nconsole.log('Total banned tokens:', page1.meta.total);\n\nfor (const ban of page1.items) {\n console.log(`- ${ban.tokenName}: ${ban.reason || 'No reason'}`);\n console.log(` Banned by: ${ban.bannedBy}`);\n console.log(` Date: ${ban.createdAt}`);\n}\n\n// Search for specific tokens (partial match, case-insensitive)\nconst searchResults = await sdk.listTokenBans({\n search: 'scam',\n page: 1,\n limit: 10,\n});\n\n// Paginate through all banned tokens\nlet page = 1;\nlet hasMore = true;\nwhile (hasMore) {\n const results = await sdk.listTokenBans({ page, limit: 20 });\n console.log(`Page ${page}: ${results.items.length} bans`);\n for (const ban of results.items) {\n console.log(` - ${ban.tokenName}`);\n }\n hasMore = page < results.meta.totalPages;\n page++;\n}\n```\n\n## Important Notes\n\n1. **Permanent Bans Only**: Token bans do not expire. They remain in effect until\n explicitly removed by an overseer.\n\n2. **Case Normalization**: Token names are automatically normalized to lowercase\n in all requests and responses.\n\n3. **Idempotency**: Banning an already-banned token returns a 409 Conflict error.\n Unbanning a non-banned token returns a 404 Not Found error.\n\n4. **Trading Continues**: Token bans do NOT stop trading on GalaChain. The\n launchpad hides visibility and blocks social features only.\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_ban_token`\n- `gala_launchpad_unban_token`\n- `gala_launchpad_list_token_bans`\n- `gala_launchpad_get_token_ban`\n- `gala_launchpad_is_token_banned`\n",
1269
- "samplePrompts": [
1270
- "How do I manage token bans?",
1271
- "Show me how to manage token bans with the SDK",
1272
- "Explain the manage token bans workflow",
1273
- "What methods do I need for manage token bans?"
1274
- ]
1275
- },
1276
- "nft-collection-management": {
1277
- "key": "nft-collection-management",
1278
- "label": "Nft collection management",
1279
- "description": "Nft collection management operations",
1280
- "category": "nft",
1281
- "methods": [
1282
- "getNftCollectionClaimFee",
1283
- "getNftTokenClassCreateFee",
1284
- "estimateNftMintFee",
1285
- "estimateNftOperationFees",
1286
- "isNftCollectionAvailable",
1287
- "claimNftCollection",
1288
- "fetchNftCollections",
1289
- "createNftTokenClass",
1290
- "fetchNftTokenClasses",
1291
- "mintNft",
1292
- "fetchNftBalances"
1293
- ],
1294
- "mcpTools": [
1295
- "gala_launchpad_get_nft_collection_claim_fee",
1296
- "gala_launchpad_get_nft_token_class_create_fee",
1297
- "gala_launchpad_estimate_nft_mint_fee",
1298
- "gala_launchpad_estimate_nft_operation_fees",
1299
- "gala_launchpad_claim_nft_collection",
1300
- "gala_launchpad_fetch_nft_collections",
1301
- "gala_launchpad_create_nft_token_class",
1302
- "gala_launchpad_fetch_nft_token_classes",
1303
- "gala_launchpad_mint_nft",
1304
- "gala_launchpad_fetch_nft_balances"
1305
- ],
1306
- "explanation": "\n# NFT Collection Management - SDK v5.12.0+\n\nCreate and manage NFT collections, token classes, and mint NFTs on GalaChain.\n\n**Key Concepts:**\n- **Collection**: A named grouping for NFT token classes (claimed for 10,000 GALA)\n- **Token Class**: A specific type/rarity within a collection (created for 1,000 GALA)\n- **NFT Instance**: Individual NFT minted from a token class (dynamic fee based on quantity)\n\n## Check Collection Availability\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({ privateKey: 'your-private-key' });\n\n// Check if a collection name is available\nconst available = await sdk.isNftCollectionAvailable('MyEpicNFTs');\nconsole.log('Collection available:', available);\n\n// Get fee for claiming a collection\nconst claimFee = await sdk.getNftCollectionClaimFee();\nconsole.log('Claim fee:', claimFee); // Usually \"10000\" GALA\n```\n\n## Claim a Collection\n\n```typescript\n// Claim an available collection name\nconst result = await sdk.claimNftCollection({\n collectionName: 'MyEpicNFTs',\n description: 'Epic NFT collection for gaming',\n});\nconsole.log('Collection claimed:', result.collectionName);\nconsole.log('Transaction ID:', result.transactionId);\n\n// Fetch your owned collections\nconst collections = await sdk.fetchNftCollections(walletAddress);\nfor (const collection of collections) {\n console.log(`Collection: ${collection.collectionName}`);\n console.log(` Status: ${collection.status}`);\n}\n```\n\n## Create Token Classes (Rarities)\n\n```typescript\n// Get fee for creating a token class\nconst classCreateFee = await sdk.getNftTokenClassCreateFee();\nconsole.log('Create fee:', classCreateFee); // Usually \"1000\" GALA\n\n// Create a token class (rarity tier)\nconst classResult = await sdk.createNftTokenClass({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n description: 'Ultra-rare legendary wizard NFTs',\n maximumSupply: '100', // Max NFTs of this type\n data: {\n rarity: 'legendary',\n class: 'wizard',\n power: '9000',\n },\n});\nconsole.log('Token class created:', classResult.tokenClassName);\n\n// Fetch token classes for your collection\nconst classes = await sdk.fetchNftTokenClasses({\n collectionName: 'MyEpicNFTs',\n});\nfor (const tokenClass of classes) {\n console.log(`Class: ${tokenClass.tokenClassName}`);\n console.log(` Current Supply: ${tokenClass.currentSupply}/${tokenClass.maxSupply}`);\n}\n```\n\n## Estimate Mint Fees\n\n```typescript\n// Estimate fee for minting multiple NFTs\nconst mintFeeEstimate = await sdk.estimateNftMintFee({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n quantity: 5,\n});\nconsole.log('Estimated mint fee:', mintFeeEstimate); // Dynamic fee in GALA\n\n// Estimate multiple operations at once\nconst bundleFee = await sdk.estimateNftOperationFees({\n operations: [\n { type: 'claim_collection' },\n { type: 'create_token_class', collectionName: 'MyEpicNFTs' },\n { type: 'mint', quantity: 10 },\n ],\n});\nconsole.log('Total bundle fee:', bundleFee.totalFee);\nfor (const op of bundleFee.breakdown) {\n console.log(` ${op.operationType}: ${op.fee}`);\n}\n```\n\n## Mint NFTs\n\n```typescript\n// Mint NFT instances from a token class\nconst mintResult = await sdk.mintNft({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n quantity: 5,\n to: 'eth|0x...', // Recipient wallet\n metadata: {\n attributes: [\n { name: 'level', value: '50' },\n { name: 'element', value: 'fire' },\n ],\n },\n});\nconsole.log('Minted:', mintResult.quantityMinted);\nconsole.log('Transaction ID:', mintResult.transactionId);\n\n// Check NFT balances\nconst balances = await sdk.fetchNftBalances(walletAddress);\nfor (const balance of balances) {\n console.log(`${balance.collectionName}/${balance.tokenClassName}: ${balance.quantity}`);\n}\n\n// Filter by collection\nconst collectionBalances = await sdk.fetchNftBalances(walletAddress, 'MyEpicNFTs');\n```\n\n## Complete Workflow\n\n```typescript\n// 1. Check availability\nconst available = await sdk.isNftCollectionAvailable('MyEpicNFTs');\nif (!available) throw new Error('Collection name taken');\n\n// 2. Claim collection (10,000 GALA)\nconst claimResult = await sdk.claimNftCollection({\n collectionName: 'MyEpicNFTs',\n description: 'My epic NFT collection',\n});\nconsole.log('✓ Collection claimed');\n\n// 3. Create token class (1,000 GALA)\nconst classResult = await sdk.createNftTokenClass({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n description: 'Legendary tier NFTs',\n maximumSupply: '1000',\n});\nconsole.log('✓ Token class created');\n\n// 4. Estimate mint fee\nconst fee = await sdk.estimateNftMintFee({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n quantity: 100,\n});\nconsole.log(`✓ Mint fee: ${fee} GALA`);\n\n// 5. Mint NFTs\nconst mintResult = await sdk.mintNft({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n quantity: 100,\n to: userWallet,\n});\nconsole.log('✓ Minted:', mintResult.quantityMinted);\n\n// 6. Verify ownership\nconst balances = await sdk.fetchNftBalances(userWallet, 'MyEpicNFTs');\nconsole.log('Total NFTs:', balances.reduce((sum, b) => sum + parseInt(b.quantity), 0));\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_nft_collection_claim_fee`\n- `gala_launchpad_get_nft_token_class_create_fee`\n- `gala_launchpad_estimate_nft_mint_fee`\n- `gala_launchpad_estimate_nft_operation_fees`\n- `gala_launchpad_check_nft_collection_available`\n- `gala_launchpad_claim_nft_collection`\n- `gala_launchpad_fetch_nft_collections`\n- `gala_launchpad_create_nft_token_class`\n- `gala_launchpad_fetch_nft_token_classes`\n- `gala_launchpad_mint_nft`\n- `gala_launchpad_fetch_nft_balances`\n",
1307
- "samplePrompts": [
1308
- "How do I nft collection management?",
1309
- "Show me how to nft collection management with the SDK",
1310
- "Explain the nft collection management workflow",
1311
- "What methods do I need for nft collection management?"
1312
- ]
1313
- }
1314
- },
1315
- "categories": {
1316
- "trading": {
1317
- "label": "Trading",
1318
- "topics": [
1319
- "buy-tokens",
1320
- "sell-tokens",
1321
- "pool-graduation",
1322
- "local-calculations",
1323
- "trading-analytics"
1324
- ]
1325
- },
1326
- "pools": {
1327
- "label": "Pools",
1328
- "topics": [
1329
- "fetch-pools",
1330
- "token-details",
1331
- "token-distribution",
1332
- "price-history"
1333
- ]
1334
- },
1335
- "balance": {
1336
- "label": "Balances",
1337
- "topics": [
1338
- "balances",
1339
- "profile-management",
1340
- "account-management"
1341
- ]
1342
- },
1343
- "utils": {
1344
- "label": "Utilities",
1345
- "topics": [
1346
- "token-creation",
1347
- "token-status",
1348
- "multi-wallet",
1349
- "error-handling",
1350
- "installation",
1351
- "spot-prices-smart-routing",
1352
- "liquidity-positions",
1353
- "utilities-and-helpers",
1354
- "mcp-to-sdk-mapping"
1355
- ]
1356
- },
1357
- "transfers": {
1358
- "label": "Transfers",
1359
- "topics": [
1360
- "transfers"
1361
- ]
1362
- },
1363
- "locks": {
1364
- "label": "Locks",
1365
- "topics": [
1366
- "locks"
1367
- ]
1368
- },
1369
- "dex": {
1370
- "label": "DEX Trading",
1371
- "topics": [
1372
- "dex-trading"
1373
- ]
1374
- },
1375
- "dex-pools": {
1376
- "label": "DEX Pools",
1377
- "topics": [
1378
- "advanced-dex-analysis",
1379
- "fetch-dex-pools",
1380
- "dex-token-discovery"
1381
- ]
1382
- },
1383
- "wallet": {
1384
- "label": "Wallet",
1385
- "topics": [
1386
- "utilities-system"
1387
- ]
1388
- },
1389
- "dex-analytics": {
1390
- "label": "DEX Analytics",
1391
- "topics": [
1392
- "fetch-all-dex-seasons",
1393
- "fetch-current-dex-season",
1394
- "fetch-dex-leaderboard-by-season-id",
1395
- "fetch-current-dex-leaderboard",
1396
- "fetch-dex-aggregated-volume-summary"
1397
- ]
1398
- },
1399
- "chat": {
1400
- "label": "Chat",
1401
- "topics": [
1402
- "event-subscriptions"
1403
- ]
1404
- },
1405
- "bridge": {
1406
- "label": "Bridge",
1407
- "topics": [
1408
- "bridge-operations",
1409
- "wrap-unwrap-operations"
1410
- ]
1411
- },
1412
- "referrals": {
1413
- "label": "Referrals",
1414
- "topics": [
1415
- "referral-system"
1416
- ]
1417
- },
1418
- "auth": {
1419
- "label": "Auth",
1420
- "topics": [
1421
- "session-auth"
1422
- ]
1423
- },
1424
- "streaming": {
1425
- "label": "Live Stream",
1426
- "topics": [
1427
- "streaming"
1428
- ]
1429
- },
1430
- "chat-messages": {
1431
- "label": "Chat Messages",
1432
- "topics": [
1433
- "stream-chat"
1434
- ]
1435
- },
1436
- "ban": {
1437
- "label": "Ban Management",
1438
- "topics": [
1439
- "ban-management"
1440
- ]
1441
- },
1442
- "api-keys": {
1443
- "label": "API Keys",
1444
- "topics": [
1445
- "api-key-management"
1446
- ]
1447
- },
1448
- "moderators": {
1449
- "label": "Moderators",
1450
- "topics": [
1451
- "moderator-invites"
1452
- ]
1453
- },
1454
- "overseers": {
1455
- "label": "Overseers",
1456
- "topics": [
1457
- "overseer-invites"
1458
- ]
1459
- },
1460
- "content-flags": {
1461
- "label": "Content Flags",
1462
- "topics": [
1463
- "content-flag-management"
1464
- ]
1465
- },
1466
- "content-reactions": {
1467
- "label": "Reactions",
1468
- "topics": [
1469
- "content-reactions"
1470
- ]
1471
- },
1472
- "trades": {
1473
- "label": "Trade History",
1474
- "topics": [
1475
- "trade-history"
1476
- ]
1477
- },
1478
- "token-ban": {
1479
- "label": "Token Ban",
1480
- "topics": [
1481
- "token-ban-management"
1482
- ]
1483
- },
1484
- "nft": {
1485
- "label": "NFT Collections",
1486
- "topics": [
1487
- "nft-collection-management"
1488
- ]
1489
- }
1490
- },
1491
- "sampleConversations": [
1492
- {
1493
- "id": "buy-tokens-demo",
1494
- "title": "Example: Buy tokens",
1495
- "topic": "buy-tokens",
1496
- "messages": [
1497
- {
1498
- "role": "user",
1499
- "content": "How do I buy tokens?"
1500
- },
1501
- {
1502
- "role": "assistant",
1503
- "content": "\n## Buying Tokens with SDK\n\n**Covers Methods:**\n- `calculateBuyAmount()`\n- `buy()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function buyTokens() {\n // 1. Create SDK instance\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // 2. Calculate expected amounts FIRST (REQUIRED)\n const calculation = await sdk.calculateBuyAmount({\n tokenName: 'dragnrkti',\n amount: '100', // Spending 100 GALA\n type: 'native' // 'native' = GALA amount, 'exact' = token amount\n });\n\n console.log('Expected tokens:', calculation.amount);\n console.log('RBC Fee:', calculation.reverseBondingCurveFee);\n console.log('Transaction fee:', calculation.transactionFee);\n\n // 3. Execute buy with slippage protection\n const result = await sdk.buy({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native',\n expectedAmount: calculation.amount, // REQUIRED: from step 2\n maxAcceptableReverseBondingCurveFee: calculation.reverseBondingCurveFee, // RECOMMENDED\n slippageToleranceFactor: 0.01 // 1% slippage tolerance (REQUIRED)\n });\n\n console.log('Transaction ID:', result.transactionId);\n console.log('GALA spent:', result.inputAmount);\n console.log('Tokens received:', result.outputAmount);\n console.log('Total fees:', result.totalFees);\n}\n```\n\n**MCP Tool Equivalent:** `gala_launchpad_buy_tokens`\n"
1504
- }
1505
- ]
1506
- },
1507
- {
1508
- "id": "fetch-pools-demo",
1509
- "title": "Example: Fetch pools",
1510
- "topic": "fetch-pools",
1511
- "messages": [
1512
- {
1513
- "role": "user",
1514
- "content": "How do I fetch and search token pools?"
1515
- },
1516
- {
1517
- "role": "assistant",
1518
- "content": "\n## Fetching Pool Data with Advanced Methods\n\n**Covers Methods:**\n- `fetchPools()`\n- `fetchAllPools()`\n- `fetchPoolDetails()`\n- `fetchPoolDetailsForCalculation()`\n- `fetchVolumeData()`\n- `fetchTokenPrice()`\n- `fetchTokenDistribution()`\n- `fetchTokenBadges()`\n- `resolveVaultAddress()`\n- `resolveTokenClassKey()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\n// 1. BASIC POOL FETCHING - With Pagination\nasync function basicPoolFetching() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch recent pools with pagination\n const pools = await sdk.fetchPools({\n type: 'recent',\n limit: 10,\n page: 1\n });\n\n console.log(`Found ${pools.total} pools, page ${pools.page} of ${pools.totalPages}`);\n pools.pools.forEach(pool => {\n console.log(`${pool.tokenName}: ${pool.tokenSymbol}`);\n });\n}\n\n// 2. AUTO-PAGINATED FETCHING - Get ALL Pools\nasync function fetchAllPools() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Auto-paginated - returns all pools without manual pagination\n const allPools = await sdk.fetchAllPools({\n type: 'recent'\n });\n\n console.log(`Total pools: ${allPools.pools.length}`);\n}\n\n// 3. POOL DETAILS - Complete information\nasync function getPoolDetails(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const details = await sdk.fetchPoolDetails(tokenName);\n\n console.log('Sale status:', details.saleStatus); // 'Ongoing' or 'Completed'\n console.log('Base price:', details.basePrice);\n console.log('Max supply:', details.maxSupply);\n console.log('Remaining tokens:', details.sellingTokenQuantity);\n}\n\n// 4. POOL DETAILS FOR CALCULATIONS - Optimized for math\nasync function getOptimizedPoolDetails(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Returns only fields needed for bonding curve calculations\n const poolData = await sdk.fetchPoolDetailsForCalculation(tokenName);\n\n console.log('Current supply:', poolData.currentSupply);\n console.log('Remaining tokens:', poolData.remainingTokens);\n console.log('Max supply:', poolData.maxSupply);\n console.log('Reverse bonding curve max fee:', poolData.reverseBondingCurveMaxFeeFactor);\n}\n\n// 5. VOLUME & OHLCV DATA - Historical candlestick data\nasync function getVolumeData(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Different resolutions: '1m', '5m', '15m', '1h', '4h', '1d'\n const volumeData = await sdk.fetchVolumeData({\n tokenName: tokenName,\n from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), // Last 7 days\n to: new Date(),\n resolution: '1h' // 1-hour candlesticks\n });\n\n volumeData.forEach(candle => {\n console.log(`${candle.time}: O:${candle.open} H:${candle.high} L:${candle.low} C:${candle.close} V:${candle.volume}`);\n });\n}\n\n// 6. SPOT PRICES - DEX tokens (GALA, SILK, MUSIC)\nasync function getDexTokenPrices() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch prices for multiple DEX tokens\n const prices = await sdk.fetchTokenPrice(['GALA', 'SILK', 'MUSIC']);\n\n console.log(`GALA: $${prices.GALA}`);\n console.log(`SILK: $${prices.SILK}`);\n console.log(`MUSIC: $${prices.MUSIC}`);\n}\n\n// 7. LAUNCHPAD TOKEN SPOT PRICES (via smart router)\nasync function getLaunchpadTokenPrice(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get USD spot price for a launchpad token (anime, woohoo, etc.)\n const price = await sdk.fetchTokenPrice({ tokenName });\n\n console.log(`${tokenName} price: $${price.price}`);\n}\n\n// 8. RESOLVE UTILITY ADDRESSES\nasync function resolveAddresses(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get GalaChain vault address for token\n const vaultAddress = await sdk.resolveVaultAddress(tokenName);\n console.log(`Vault address: ${vaultAddress}`);\n\n // Get TokenClassKey for token\n const tokenClassKey = await sdk.resolveTokenClassKey(tokenName);\n console.log(`TokenClassKey: ${tokenClassKey}`);\n}\n\n// 9. COMPLETE INVESTMENT ANALYSIS WORKFLOW\nasync function analyzeToken(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get all token data in parallel\n const [details, volumeData, distribution, badges] = await Promise.all([\n sdk.fetchPoolDetails(tokenName),\n sdk.fetchVolumeData({ tokenName, resolution: '1d' }),\n sdk.fetchTokenDistribution(tokenName),\n sdk.fetchTokenBadges(tokenName)\n ]);\n\n // Analyze status\n console.log(`Pool Status: ${details.saleStatus}`);\n console.log(`Supply: ${details.currentSupply} / ${details.maxSupply}`);\n\n // Analyze volume trend\n // Note: For analytics/aggregation, we use safeParseFloat for performance. For trades, use BigNumber via SDK\n const volumes = volumeData.map(v => safeParseFloat(v.volume, 0));\n const avgVolume = volumes.reduce((a, b) => a + b, 0) / volumes.length;\n console.log(`Avg daily volume: $${toBigNumberFixed(avgVolume, 2)}`);\n\n // Analyze distribution\n // Use compareAmounts for precise balance comparisons\n const top5Ownership = distribution.holders\n .sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)\n .slice(0, 5)\n .reduce((sum, h) => sum + h.percentage, 0);\n console.log(`Top 5 holders: ${toBigNumberFixed(top5Ownership, 2)}%`);\n\n // Check badges\n console.log(`Badges: ${badges.join(', ')}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_pools` - Paginated pool list\n- `gala_launchpad_fetch_all_pools` - Auto-paginated all pools\n- `gala_launchpad_fetch_pool_details` - Complete pool information\n- `gala_launchpad_fetch_pool_details_for_calculation` - Optimized for calculations\n- `gala_launchpad_fetch_volume_data` - OHLCV candlestick data\n- `gala_launchpad_fetch_token_spot_price` - DEX token prices (GALA, SILK, MUSIC)\n- `gala_launchpad_fetch_launchpad_token_spot_price` - Launchpad token USD prices\n- `gala_launchpad_fetch_token_distribution` - Token holder analysis\n- `gala_launchpad_fetch_token_badges` - Achievement badges\n- `gala_launchpad_resolve_vault_address` - Get vault address\n- `gala_launchpad_resolve_token_class_key` - Get TokenClassKey\n"
1519
- }
1520
- ]
1521
- },
1522
- {
1523
- "id": "balances-demo",
1524
- "title": "Example: Balances",
1525
- "topic": "balances",
1526
- "messages": [
1527
- {
1528
- "role": "user",
1529
- "content": "How do I check token balances?"
1530
- },
1531
- {
1532
- "role": "assistant",
1533
- "content": "\n## Checking Balances with SDK\n\n**Covers Methods:**\n- `fetchGalaBalance()`\n- `fetchTokenBalance()`\n- `fetchTokensHeld()`\n- `fetchTokensCreated()`\n- `fetchProfile()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function checkBalances() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Check GALA balance\n const galaBalance = await sdk.fetchGalaBalance();\n console.log(`GALA: ${galaBalance.balance}`);\n console.log(`Decimals: ${galaBalance.decimals}`);\n console.log(`Last updated: ${galaBalance.lastUpdated.toISOString()}`);\n\n // Check specific token balance\n const tokenBalance = await sdk.fetchTokenBalance({\n tokenName: 'dragnrkti',\n address: sdk.getAddress()\n });\n\n console.log(`Token: ${tokenBalance.quantity}`);\n console.log(`USD value: $${tokenBalance.holdingPriceUsd}`);\n console.log(`GALA value: ${tokenBalance.holdingPriceGala}`);\n\n // Check all tokens held\n const portfolio = await sdk.fetchTokensHeld({\n address: sdk.getAddress(),\n limit: 20\n });\n\n console.log(`Holding ${portfolio.total} different tokens`);\n portfolio.tokens.forEach(token => {\n console.log(`${token.name}: ${token.quantity}`);\n });\n\n // Check tokens created by this wallet\n const createdTokens = await sdk.fetchTokensCreated({\n address: sdk.getAddress(),\n limit: 10\n });\n\n console.log(`Created ${createdTokens.total} tokens`);\n createdTokens.tokens.forEach(token => {\n console.log(` ${token.symbol}: ${token.name}`);\n });\n\n // Get user profile\n const profile = await sdk.fetchProfile();\n console.log(`Profile: ${profile.fullName}`);\n\n // Check profile of another user\n const otherProfile = await sdk.fetchProfile('eth|0x...');\n console.log(`Other user: ${otherProfile.fullName}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_gala_balance`\n- `gala_launchpad_fetch_token_balance`\n- `gala_launchpad_fetch_tokens_held`\n- `gala_launchpad_fetch_tokens_created`\n- `gala_launchpad_fetch_profile`\n- `gala_launchpad_fetch_available_balance`\n- `gala_launchpad_fetch_locked_tokens`\n\n### Available vs Locked Balance\n\n```typescript\n// Get available balance (excludes locked/escrowed tokens)\nconst available = await sdk.fetchAvailableBalance({\n tokenName: 'anime',\n address: walletAddress\n});\n\n// Get locked tokens with details\nconst locked = await sdk.fetchLockedTokens({\n tokenName: 'anime',\n address: walletAddress\n});\n\nconsole.log('Available:', available.quantity);\nconsole.log('Locked:', locked.lockedQuantity);\n```\n"
1534
- }
1535
- ]
1536
- },
1537
- {
1538
- "id": "token-creation-demo",
1539
- "title": "Example: Token creation",
1540
- "topic": "token-creation",
1541
- "messages": [
1542
- {
1543
- "role": "user",
1544
- "content": "How do I create and launch new tokens?"
1545
- },
1546
- {
1547
- "role": "assistant",
1548
- "content": "\n## Creating Tokens with SDK\n\n**Covers Methods:**\n- `isTokenNameAvailable()`\n- `isTokenSymbolAvailable()`\n- `fetchLaunchTokenFee()`\n- `uploadTokenImage()`\n- `launchToken()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function launchToken() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // 1. Check if name/symbol available\n const nameAvailable = await sdk.isTokenNameAvailable('mytoken');\n const symbolAvailable = await sdk.isTokenSymbolAvailable('MTK');\n\n if (!nameAvailable || !symbolAvailable) {\n throw new Error('Name or symbol already taken');\n }\n\n // 2. Check launch fee\n const launchFee = await sdk.fetchLaunchTokenFee();\n console.log(`Launch fee: ${launchFee} GALA`);\n\n // 3. Upload token image (Node.js only)\n const imageUpload = await sdk.uploadTokenImage({\n tokenName: 'mytoken',\n imagePath: '/path/to/image.png'\n });\n\n // 4. Launch the token\n const result = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'My awesome token',\n tokenImage: imageUpload.imageUrl,\n websiteUrl: 'https://mytoken.com',\n twitterUrl: 'https://twitter.com/mytoken',\n preBuyQuantity: '100' // Optional: pre-buy with GALA\n });\n\n console.log('Token launched!');\n console.log('Transaction ID:', result.transactionId);\n\n // Get frontend URL\n const url = sdk.getUrlByTokenName('mytoken');\n console.log(`View at: ${url}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_check_token_name`\n- `gala_launchpad_check_token_symbol`\n- `gala_launchpad_fetch_launch_token_fee`\n- `gala_launchpad_upload_token_image`\n- `gala_launchpad_launch_token`\n- `gala_launchpad_get_url_by_token_name`\n"
1549
- }
1550
- ]
1551
- },
1552
- {
1553
- "id": "transfers-demo",
1554
- "title": "Example: Transfers",
1555
- "topic": "transfers",
1556
- "messages": [
1557
- {
1558
- "role": "user",
1559
- "content": "How do I transfer tokens?"
1560
- },
1561
- {
1562
- "role": "assistant",
1563
- "content": "\n## Token Transfers with SDK\n\n**Covers Methods:**\n- `transferGala()`\n- `transferToken()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function transferTokens() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Transfer GALA tokens\n const galaTransfer = await sdk.transferGala({\n recipientAddress: '0x1234...', // or 'eth|1234...'\n amount: '100',\n uniqueKey: 'galaconnect-operation-my-transfer-123' // Optional idempotency\n });\n\n console.log('GALA transfer ID:', galaTransfer.transactionId);\n console.log('Status:', galaTransfer.status);\n\n // Transfer launchpad tokens\n const tokenTransfer = await sdk.transferToken({\n to: 'eth|5678...',\n tokenName: 'dragnrkti',\n amount: '1000', // Token amount\n uniqueKey: 'galaconnect-operation-token-456'\n });\n\n console.log('Token transfer ID:', tokenTransfer.transactionId);\n}\n```\n\n**Features:**\n- EIP-712 signatures for security\n- Supports both `0x` and `eth|` address formats\n- Optional idempotency keys prevent duplicates\n- Comprehensive validation\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_transfer_gala`\n- `gala_launchpad_transfer_token`\n"
1564
- }
1565
- ]
1566
- },
1567
- {
1568
- "id": "locks-demo",
1569
- "title": "Example: Locks",
1570
- "topic": "locks",
1571
- "messages": [
1572
- {
1573
- "role": "user",
1574
- "content": "How do I lock and unlock tokens?"
1575
- },
1576
- {
1577
- "role": "assistant",
1578
- "content": "\n## Token Locking, Unlocking, and Burning with SDK\n\n**Covers Methods:**\n- `lockTokens()` - Lock one or more token types in a single transaction\n- `unlockTokens()` - Unlock one or more token types in a single transaction\n- `burnTokens()` - Permanently destroy tokens (IRREVERSIBLE)\n- `fetchLockedBalance()` - Query locked token balances with hold details\n\nLock, unlock, and burn tokens on GalaChain for staking, escrow, vesting, or token management.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function tokenLockingAndBurning() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // ============================================================================\n // LOCK TOKENS - Single token (batch API wraps single token)\n // ============================================================================\n\n // Lock 1000 tokens with default options (caller is lock authority)\n const lockResult = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '1000'\n }]\n });\n\n console.log('Lock transaction ID:', lockResult.transactionId);\n console.log('Locked entries:', lockResult.locked);\n\n // ============================================================================\n // LOCK TOKENS - Multiple tokens in one transaction (batch)\n // ============================================================================\n\n // Lock multiple token types atomically\n const batchLock = await sdk.lockTokens({\n tokens: [\n { tokenName: 'anime', amount: '500' },\n { tokenName: 'dragon', amount: '200' },\n { tokenName: 'mystic', amount: '100', lockAuthority: 'eth|0x1234...' }\n ]\n });\n\n console.log('Batch lock completed:', batchLock.locked.length, 'tokens locked');\n\n // ============================================================================\n // LOCK TOKENS - Advanced options\n // ============================================================================\n\n // Lock with custom lock authority (another address can unlock)\n const escrowLock = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '500',\n lockAuthority: 'eth|0x1234...', // Escrow agent address\n name: 'escrow-payment-001', // Identifier for matching during unlock\n expires: Date.now() + 30 * 24 * 60 * 60 * 1000 // Auto-release in 30 days\n }]\n });\n\n console.log('Escrow lock created');\n\n // Lock for time-based vesting\n const vestingLock = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '10000',\n name: 'vesting-q1-2025',\n expires: new Date('2025-04-01').getTime() // Auto-unlock on April 1st\n }]\n });\n\n console.log('Vesting lock created with expiry');\n\n // ============================================================================\n // UNLOCK TOKENS - Release locked tokens\n // ============================================================================\n\n // Unlock tokens (must be called by lock authority)\n const unlockResult = await sdk.unlockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '500'\n }]\n });\n\n console.log('Unlock transaction ID:', unlockResult.transactionId);\n console.log('Unlocked entries:', unlockResult.unlocked);\n\n // Unlock multiple tokens in one transaction\n const batchUnlock = await sdk.unlockTokens({\n tokens: [\n { tokenName: 'anime', amount: '500' },\n { tokenName: 'dragon', amount: '200', name: 'escrow-payment-001' }\n ]\n });\n\n console.log('Batch unlock completed');\n\n // ============================================================================\n // BURN TOKENS - Permanently destroy (IRREVERSIBLE!)\n // ============================================================================\n\n // WARNING: Burn operations are permanent and cannot be undone!\n const burnResult = await sdk.burnTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '100'\n }]\n });\n\n console.log('Burn transaction ID:', burnResult.transactionId);\n console.log('Burned:', burnResult.burned);\n\n // Batch burn multiple token types\n const batchBurn = await sdk.burnTokens({\n tokens: [\n { tokenName: 'anime', amount: '50' },\n { tokenName: 'oldtoken', amount: '1000' } // Clean up deprecated tokens\n ]\n });\n\n console.log('Batch burn completed:', batchBurn.burned.length, 'token types burned');\n\n // ============================================================================\n // QUERY LOCKED TOKENS - Check lock status\n // ============================================================================\n\n const lockedTokens = await sdk.fetchLockedBalance({\n tokenName: 'anime',\n address: sdk.getAddress()\n });\n\n console.log('Locked quantity:', lockedTokens.lockedQuantity);\n console.log('Active holds:', lockedTokens.holds);\n\n // Each hold contains: lockAuthority, expires, name, quantity\n for (const hold of lockedTokens.holds) {\n console.log(` - ${hold.quantity} locked by ${hold.lockAuthority}`);\n if (hold.expires) console.log(` Expires: ${new Date(hold.expires)}`);\n if (hold.name) console.log(` Name: ${hold.name}`);\n }\n\n // ============================================================================\n // STAKING WORKFLOW EXAMPLE\n // ============================================================================\n\n async function stakingWorkflow() {\n // Step 1: Lock tokens for staking period\n const stake = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '5000',\n name: 'staking-period-1',\n expires: Date.now() + 90 * 24 * 60 * 60 * 1000 // 90-day staking period\n }]\n });\n\n console.log('Staked 5000 tokens for 90 days');\n\n // Step 2: After staking period expires, unlock\n const unstake = await sdk.unlockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '5000',\n name: 'staking-period-1'\n }]\n });\n\n console.log('Unstaked tokens after staking period');\n return { stake, unstake };\n }\n\n // ============================================================================\n // ESCROW WORKFLOW EXAMPLE\n // ============================================================================\n\n async function escrowWorkflow(buyerAddress: string, sellerAddress: string) {\n // Step 1: Buyer locks payment in escrow (seller is lock authority)\n const escrow = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '1000',\n lockAuthority: sellerAddress, // Seller can release upon delivery\n name: 'order-12345'\n }]\n });\n\n console.log('Escrow created: seller can release payment upon delivery');\n\n // Step 2: Seller releases escrow after delivery (seller calls unlock)\n // This would be executed by the seller's SDK instance\n // const release = await sellerSdk.unlockTokens({\n // tokens: [{ tokenName: 'anime', amount: '1000', name: 'order-12345' }]\n // });\n\n return escrow;\n }\n}\n```\n\n**Key Features:**\n- **Batch Operations**: Lock/unlock/burn multiple token types in one transaction\n- **Lock Authority**: Specify who can unlock (defaults to caller)\n- **Expiration**: Optional auto-release timestamp for time-based vesting\n- **Named Locks**: Use `name` to identify specific locks for targeted unlocks\n- **EIP-712 Signatures**: Secure blockchain transactions\n- **Error Handling**: `LockError` and `BurnError` classes with specific error types\n\n**Lock Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to lock (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to lock |\n| `lockAuthority` | No | Address that can unlock (defaults to caller) |\n| `expires` | No | Timestamp in ms for auto-unlock |\n| `name` | No | Identifier for matching during unlock |\n\n*Either `tokenName` or `tokenId` required\n\n**Unlock Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to unlock (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to unlock |\n| `name` | No | Lock name to match (if used during lock) |\n\n**Burn Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to burn (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to burn (PERMANENT!) |\n\n**Use Cases:**\n- **Staking**: Lock tokens for rewards/governance\n- **Escrow**: Third-party controlled releases\n- **Vesting**: Time-based token releases\n- **Governance**: Lock tokens for voting power\n- **Token Retirement**: Permanently burn deprecated tokens\n- **Deflationary Mechanics**: Reduce supply via burns\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_lock_tokens` (batch)\n- `gala_launchpad_unlock_tokens` (batch)\n- `gala_launchpad_burn_tokens` (batch)\n- `gala_launchpad_fetch_locked_tokens`\n"
1579
- }
1580
- ]
1581
- },
1582
- {
1583
- "id": "dex-trading-demo",
1584
- "title": "Example: Dex trading",
1585
- "topic": "dex-trading",
1586
- "messages": [
1587
- {
1588
- "role": "user",
1589
- "content": "How do I trade tokens on GalaSwap?"
1590
- },
1591
- {
1592
- "role": "assistant",
1593
- "content": "\n## DEX Trading with SDK - GalaSwap Integration\n\n**Covers Methods:**\n- `getSwapQuoteExactInput()`\n- `getSwapQuoteExactOutput()`\n- `executeSwap()`\n- `getSwapUserAssets()`\n- `getAllSwapUserAssets()`\n- `getSwapPoolInfo()`\n\nTrade graduated tokens on the GalaSwap DEX with real-time WebSocket monitoring:\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function dexTradingExample() {\n // 1. Initialize SDK with wallet\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n env: 'production'\n });\n\n // ============================================================================\n // QUOTES: Get pricing information (read-only operations)\n // ============================================================================\n\n // Quote 1: Exact input (spend known GALA amount)\n const quoteIn = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');\n console.log('Spend 100 GALA → get ~' + quoteIn.estimatedOutput + ' GUSDC');\n console.log('Price impact: ' + quoteIn.priceImpact + '%');\n console.log('Fee tier: ' + quoteIn.feeTier + ' bps');\n\n // Quote 2: Exact output (get known token amount)\n const quoteOut = await sdk.getSwapQuoteExactOutput('GALA', 'GUSDC', '100');\n console.log('Get exactly 100 GUSDC → need ~' + quoteOut.inputAmount + ' GALA');\n\n // ============================================================================\n // EXECUTE: Perform the swap with slippage protection\n // ============================================================================\n\n const result = await sdk.executeSwap(\n 'GALA', // from token\n 'GUSDC', // to token\n '100', // input amount (100 GALA)\n quoteIn.estimatedOutput, // Use quote's output!\n quoteIn.feeTier, // Use quote's fee tier!\n 0.01 // 1% slippage tolerance\n );\n\n console.log('Transaction ID: ' + result.transactionId);\n console.log('Status: ' + result.status);\n console.log('Received: ' + result.outputAmount + ' ' + result.toToken);\n\n // ============================================================================\n // PORTFOLIO: Check balances and assets\n // ============================================================================\n\n const assets = await sdk.getSwapUserAssets(sdk.getEthereumAddress());\n console.log('Assets in wallet:');\n assets.forEach(asset => {\n console.log(' ' + asset.symbol + ': ' + asset.balance);\n });\n\n // ============================================================================\n // PORTFOLIO: Get ALL assets (auto-paginated)\n // ============================================================================\n\n const allAssets = await sdk.getAllSwapUserAssets(sdk.getEthereumAddress());\n console.log('Complete asset portfolio:');\n console.log('Total assets: ' + allAssets.length);\n allAssets.forEach(asset => {\n console.log(' ' + asset.symbol + ': ' + asset.balance);\n });\n\n // ============================================================================\n // POOL INFO: Check liquidity before trading\n // ============================================================================\n\n const pool = await sdk.getSwapPoolInfo('GALA', 'GUSDC');\n console.log('GALA↔GUSDC Pool Info:');\n console.log(' Liquidity: ' + pool.liquidity);\n console.log(' Available fee tiers: ' + pool.feeTiers.join(', ') + ' bps');\n console.log(' 24h swaps: ' + pool.swapCount);\n}\n```\n\n**Key Architecture:**\n- **Unified WebSocket**: Uses LaunchpadSDK's unified WebSocket for transaction monitoring\n- **Environment Alignment**: STAGE/PROD URLs must match between LaunchpadSDK and GSwapService\n- **Token Formats**:\n - **Launchpad bonding curve**: Use `tokenName` (lowercase simple symbols like 'anime', 'dragon')\n - **DEX trading**: Use `tokenId` (pipe-delimited format like 'GALA|Unit|none|none', 'GUSDC|Unit|none|eth:0x...')\n- **Slippage Protection**: Always use quote values for execution\n- **Fee Tiers**: 500 (0.05%), 3000 (0.30%), 10000 (1.00%)\n- **Auto-Pagination**: Use `getAllSwapUserAssets()` for complete portfolio\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_swap_quote_exact_input`\n- `gala_launchpad_get_swap_quote_exact_output`\n- `gala_launchpad_execute_swap`\n- `gala_launchpad_get_swap_user_assets`\n- `gala_launchpad_get_all_swap_user_assets`\n- `gala_launchpad_get_swap_pool_info`\n"
1594
- }
1595
- ]
1596
- },
1597
- {
1598
- "id": "advanced-dex-analysis-demo",
1599
- "title": "Example: Advanced dex analysis",
1600
- "topic": "advanced-dex-analysis",
1601
- "messages": [
1602
- {
1603
- "role": "user",
1604
- "content": "How do I analyze DEX trading data?"
1605
- },
1606
- {
1607
- "role": "assistant",
1608
- "content": "\n## Advanced DEX Pool Analysis with SDK\n\n**Covers Methods:**\n- `fetchCompositePoolData()`\n- `calculateDexPoolQuoteExactAmountLocal()`\n- `calculateDexPoolQuoteExactAmountExternal()`\n- `calculateDexPoolQuoteExactAmount()`\n\nThis workflow demonstrates analyzing graduated tokens using composite data and price calculations.\n\n**Use Cases:**\n- Arbitrage opportunity detection\n- Price impact analysis before large trades\n- Comparing bonding curve vs DEX pricing\n- Smart routing for best execution\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function advancedDexAnalysis() {\n const sdk = createLaunchpadSDK({ environment: 'production' });\n\n // Step 1: Get composite pool data (bonding curve + DEX if graduated)\n const composite = await sdk.fetchCompositePoolData('anime');\n\n if (composite.isGraduated) {\n console.log('Token graduated to DEX!');\n console.log('DEX Pool TVL:', composite.dexPool.tvl);\n console.log('DEX 24h Volume:', composite.dexPool.volume1d);\n }\n\n // Step 2: Compare local vs external price calculations\n const localQuote = await sdk.calculateDexPoolQuoteExactAmountLocal(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n const externalQuote = await sdk.calculateDexPoolQuoteExactAmountExternal(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n console.log('Local calculation:', localQuote.outputAmount);\n console.log('External API:', externalQuote.outputAmount);\n console.log('Price difference:',\n Math.abs(safeParseFloat(localQuote.outputAmount, 0) - safeParseFloat(externalQuote.outputAmount, 0))\n );\n\n // Step 3: Use smart routing for best price\n const bestQuote = await sdk.calculateDexPoolQuoteExactAmount(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n console.log('Best route:', bestQuote.route); // 'local' or 'external'\n console.log('Best price:', bestQuote.outputAmount);\n}\n```\n\n**MCP Tools:**\n- `gala_launchpad_fetch_composite_pool_data`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount_local`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount_external`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount`\n"
1609
- }
1610
- ]
1611
- },
1612
- {
1613
- "id": "utilities-system-demo",
1614
- "title": "Example: Utilities system",
1615
- "topic": "utilities-system",
1616
- "messages": [
1617
- {
1618
- "role": "user",
1619
- "content": "How do I access system utilities?"
1620
- },
1621
- {
1622
- "role": "assistant",
1623
- "content": "\n## SDK Configuration and Wallet Utilities\n\n**Covers Methods:**\n- `getAddress()`\n- `getConfig()`\n- `getEthereumAddress()`\n- `getUrlByTokenName()`\n- `getVersion()`\n- `getWallet()`\n- `hasWallet()`\n- `setWallet()`\n\nEssential utilities for SDK configuration, wallet management, and system information.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function sdkUtilities() {\n // ============================================================================\n // ADDRESS MANAGEMENT - Get wallet addresses in different formats\n // ============================================================================\n\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get GalaChain address (eth|0x... format)\n const galaAddress = sdk.getAddress();\n console.log(`GalaChain address: ${galaAddress}`); // \"eth|0x1234...\"\n\n // Get Ethereum address (0x... format)\n const ethAddress = sdk.getEthereumAddress();\n console.log(`Ethereum address: ${ethAddress}`); // \"0x1234...\"\n\n // ============================================================================\n // WALLET MANAGEMENT - Check and update wallet\n // ============================================================================\n\n // Check if SDK has wallet configured\n if (sdk.hasWallet()) {\n console.log('Wallet configured - can execute trades');\n\n // Get wallet instance (for advanced use)\n const wallet = sdk.getWallet();\n console.log(`Wallet address: ${wallet.address}`);\n } else {\n console.log('Read-only mode - cannot execute trades');\n }\n\n // Update wallet at runtime\n sdk.setWallet('new-private-key');\n console.log(`New address: ${sdk.getAddress()}`);\n\n // ============================================================================\n // CONFIGURATION ACCESS - Get SDK config\n // ============================================================================\n\n // Get SDK configuration\n const config = sdk.getConfig();\n console.log(`Base URL: ${config.baseUrl}`);\n console.log(`Environment: ${config.env}`);\n console.log(`Debug: ${config.debug}`);\n console.log(`Timeout: ${config.timeout}ms`);\n\n // ============================================================================\n // VERSION INFORMATION - Get SDK version\n // ============================================================================\n\n // Get SDK version\n const version = sdk.getVersion();\n console.log(`SDK Version: ${version}`); // \"4.0.4-beta.0\"\n\n // ============================================================================\n // URL GENERATION - Get frontend URLs for tokens\n // ============================================================================\n\n // Generate frontend URL for token\n const url = sdk.getUrlByTokenName('anime');\n console.log(`Token URL: ${url}`);\n // \"https://launchpad.gala.com/token/anime\" (production)\n // \"https://lpad-dev1.defi.gala.com/token/anime\" (development)\n\n // Complete workflow: Launch token + share URL\n const launchResult = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'My awesome token'\n });\n\n const tokenUrl = sdk.getUrlByTokenName('mytoken');\n console.log(`Share your token: ${tokenUrl}`);\n\n // ============================================================================\n // MULTI-WALLET SCENARIO - Check multiple addresses\n // ============================================================================\n\n async function compareWallets() {\n const wallet1 = createLaunchpadSDK({ wallet: 'private-key-1' });\n const wallet2 = createLaunchpadSDK({ wallet: 'private-key-2' });\n\n console.log(`Wallet 1: ${wallet1.getAddress()}`);\n console.log(`Wallet 2: ${wallet2.getAddress()}`);\n\n // Compare balances\n const balance1 = await wallet1.fetchGalaBalance();\n const balance2 = await wallet2.fetchGalaBalance();\n\n console.log(`Wallet 1 balance: ${balance1.balance}`);\n console.log(`Wallet 2 balance: ${balance2.balance}`);\n }\n\n // ============================================================================\n // READ-ONLY SDK - Public data without wallet\n // ============================================================================\n\n async function readOnlyMode() {\n // Create SDK without wallet (read-only mode)\n const readOnlySdk = createLaunchpadSDK();\n\n console.log(`Has wallet: ${readOnlySdk.hasWallet()}`); // false\n\n // Can fetch public data\n const pools = await readOnlySdk.fetchPools({ type: 'recent', limit: 10 });\n console.log(`Found ${pools.total} pools`);\n\n // Cannot execute trades (will throw error)\n try {\n await readOnlySdk.buy({ tokenName: 'anime', amount: '100', type: 'native' });\n } catch (error) {\n console.error('Cannot trade without wallet');\n }\n }\n\n // ============================================================================\n // ENVIRONMENT SWITCHING - Change environments at runtime\n // ============================================================================\n\n async function switchEnvironments() {\n // Production SDK\n const prodSdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: { env: 'production' }\n });\n\n console.log(`Prod config: ${prodSdk.getConfig().baseUrl}`);\n console.log(`Prod URL: ${prodSdk.getUrlByTokenName('anime')}`);\n\n // Development SDK\n const devSdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: { env: 'development' }\n });\n\n console.log(`Dev config: ${devSdk.getConfig().baseUrl}`);\n console.log(`Dev URL: ${devSdk.getUrlByTokenName('anime')}`);\n }\n}\n```\n\n**Key Methods:**\n\n| Method | Returns | Use Case |\n|--------|---------|----------|\n| `getAddress()` | GalaChain address (eth|0x...) | Trading, transfers, profile |\n| `getEthereumAddress()` | Ethereum address (0x...) | DEX trading, external systems |\n| `getConfig()` | SDK configuration object | Debug, environment info |\n| `getVersion()` | SDK version string | Compatibility checks |\n| `getUrlByTokenName()` | Frontend URL | Share token pages |\n| `getWallet()` | Wallet instance | Advanced wallet operations |\n| `hasWallet()` | Boolean | Check if trades enabled |\n| `setWallet()` | void | Update wallet at runtime |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_address`\n- `gala_launchpad_get_ethereum_address`\n- `gala_launchpad_get_config`\n- `gala_launchpad_get_version`\n- `gala_launchpad_get_url_by_token_name`\n"
1624
- }
1625
- ]
1626
- },
1627
- {
1628
- "id": "fetch-all-dex-seasons-demo",
1629
- "title": "Example: Fetch all dex seasons",
1630
- "topic": "fetch-all-dex-seasons",
1631
- "messages": [
1632
- {
1633
- "role": "user",
1634
- "content": "How do I fetch DEX leaderboard seasons?"
1635
- },
1636
- {
1637
- "role": "assistant",
1638
- "content": "\n## DEX Leaderboard Seasons Management\n\n**Covers Methods:**\n- `fetchAllDexSeasons()`\n- `fetchCurrentDexSeason()`\n\nDiscover and manage DEX leaderboard seasons for competitive trading events.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageDexSeasons() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch all available seasons\n const seasons = await sdk.fetchAllDexSeasons();\n\n // Display season information\n seasons.forEach(season => {\n console.log(`Season: ${season.name} (ID: ${season.id})`);\n console.log(`Duration: ${season.start} to ${season.end}`);\n });\n\n // Get current season\n const activeSeason = await sdk.fetchCurrentDexSeason();\n if (activeSeason) {\n console.log(`Active: ${activeSeason.name}`);\n } else {\n console.log('No active season (between seasons)');\n }\n\n // Verify season is active\n const now = new Date();\n const isActive = activeSeason && now >= activeSeason.start && now <= activeSeason.end;\n console.log(`Season active: ${isActive}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_all_dex_seasons`\n- `gala_launchpad_fetch_current_dex_season`\n"
1639
- }
1640
- ]
1641
- },
1642
- {
1643
- "id": "event-subscriptions-demo",
1644
- "title": "Example: Event subscriptions",
1645
- "topic": "event-subscriptions",
1646
- "messages": [
1647
- {
1648
- "role": "user",
1649
- "content": "How do I subscribe to real-time events?"
1650
- },
1651
- {
1652
- "role": "assistant",
1653
- "content": "\n## Real-Time Event Subscriptions and Monitoring\n\n**Covers Methods:**\n- `subscribeToDexLiquidityAdded()`\n- `subscribeToDexLiquidityChanged()`\n- `subscribeToDexLiquidityRemoved()`\n- `subscribeToDexPoolAdded()`\n- `subscribeToDexSwapExecuted()`\n- `subscribeToTokenCreations()`\n\nSubscribe to real-time WebSocket events for DEX trading, liquidity changes, and token launches.\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function subscribeToEvents() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // ============================================================================\n // LIQUIDITY EVENTS - Monitor position changes\n // ============================================================================\n\n // Subscribe to liquidity additions\n const cleanupAdded = sdk.subscribeToDexLiquidityAdded((event) => {\n console.log('Liquidity added!');\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Amount0: ${event.amount0}`);\n console.log(` Amount1: ${event.amount1}`);\n console.log(` Owner: ${event.owner}`);\n console.log(` Position ID: ${event.positionId}`);\n });\n\n // Subscribe to liquidity changes (compound events)\n const cleanupChanged = sdk.subscribeToDexLiquidityChanged((event) => {\n console.log('Liquidity changed!');\n console.log(` Type: ${event.type}`); // 'added', 'removed', 'modified'\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Delta: ${event.liquidityDelta}`);\n });\n\n // Subscribe to liquidity removals\n const cleanupRemoved = sdk.subscribeToDexLiquidityRemoved((event) => {\n console.log('Liquidity removed!');\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Amount0: ${event.amount0}`);\n console.log(` Amount1: ${event.amount1}`);\n console.log(` Owner: ${event.owner}`);\n console.log(` Fees collected: ${event.fees0}, ${event.fees1}`);\n });\n\n // ============================================================================\n // POOL EVENTS - Monitor new DEX pools\n // ============================================================================\n\n // Subscribe to new DEX pool creation\n const cleanupPool = sdk.subscribeToDexPoolAdded((pool) => {\n console.log('New DEX pool created!');\n console.log(` Token: ${pool.tokenName}`);\n console.log(` Token0: ${pool.token0}`);\n console.log(` Token1: ${pool.token1}`);\n console.log(` Fee Tier: ${pool.feeTier}`);\n console.log(` Initial TVL: ${pool.tvl}`);\n\n // Auto-provide liquidity to new pools\n sdk.addSwapLiquidityByPrice({\n token0: pool.token0,\n token1: pool.token1,\n fee: pool.feeTier,\n minPrice: '0.95',\n maxPrice: '1.05',\n amount0Desired: '1000',\n amount1Desired: '1000'\n }).then(() => console.log('Liquidity provided to new pool'));\n });\n\n // ============================================================================\n // SWAP EVENTS - Monitor all DEX swaps\n // ============================================================================\n\n // Subscribe to DEX swap executions\n const cleanupSwap = sdk.subscribeToDexSwapExecuted((swap) => {\n console.log('DEX swap executed!');\n console.log(` Pair: ${swap.tokenIn} → ${swap.tokenOut}`);\n console.log(` Amount In: ${swap.amountIn}`);\n console.log(` Amount Out: ${swap.amountOut}`);\n console.log(` Trader: ${swap.trader}`);\n console.log(` Fee Tier: ${swap.feeTier}`);\n\n // Track volume and price impact\n const priceImpact = calculatePriceImpact(swap.amountIn, swap.amountOut);\n console.log(` Price impact: ${priceImpact}%`);\n });\n\n // ============================================================================\n // TOKEN CREATION EVENTS - Monitor new token launches\n // ============================================================================\n\n // Subscribe to new token launches\n const cleanupToken = sdk.subscribeToTokenCreations((token) => {\n console.log('New token launched!');\n console.log(` Name: ${token.tokenName}`);\n console.log(` Symbol: ${token.tokenSymbol}`);\n console.log(` Creator: ${token.creator}`);\n console.log(` Max Supply: ${token.maxSupply}`);\n console.log(` Base Price: ${token.basePrice}`);\n\n // Auto-buy new tokens\n sdk.buy({\n tokenName: token.tokenName,\n amount: '100',\n type: 'native',\n slippageToleranceFactor: 0.01\n }).then(() => console.log('Auto-bought new token'));\n });\n\n // ============================================================================\n // ARBITRAGE BOT EXAMPLE - Multi-event monitoring\n // ============================================================================\n\n async function arbitrageBot() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Track all swaps for arbitrage opportunities\n sdk.subscribeToDexSwapExecuted(async (swap) => {\n // Check if price divergence exists\n const poolPrice = await sdk.getSwapPoolPrice(swap.tokenIn, swap.tokenOut);\n const externalPrice = await getExternalPrice(swap.tokenIn, swap.tokenOut);\n\n const divergence = Math.abs(poolPrice - externalPrice) / externalPrice;\n\n if (divergence > 0.01) {\n // 1% arbitrage opportunity\n console.log(`Arbitrage opportunity: ${divergence * 100}%`);\n\n // Execute arbitrage trade\n await sdk.executeSwap(\n swap.tokenOut,\n swap.tokenIn,\n calculateArbitrageAmount(divergence),\n '0', // min output\n 3000, // fee tier\n 0.01 // slippage\n );\n }\n });\n\n // Monitor liquidity additions for new opportunities\n sdk.subscribeToDexLiquidityAdded(async (event) => {\n console.log(`New liquidity in ${event.token0}-${event.token1}`);\n\n // Check if pool has sufficient depth for arbitrage\n const poolInfo = await sdk.getSwapPoolInfo(event.token0, event.token1);\n // Use compareAmounts for precise liquidity threshold comparison\n if (compareAmounts(poolInfo.liquidity, '100000') > 0) {\n console.log('Pool has sufficient liquidity for arbitrage');\n }\n });\n }\n\n // ============================================================================\n // LIQUIDITY PROVIDER BOT - Auto-manage positions\n // ============================================================================\n\n async function liquidityProviderBot() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Auto-add liquidity to new pools\n sdk.subscribeToDexPoolAdded(async (pool) => {\n console.log(`New pool: ${pool.tokenName}`);\n\n // Wait for some initial swaps to establish price\n setTimeout(async () => {\n const poolInfo = await sdk.getSwapPoolInfo(pool.token0, pool.token1);\n\n // Add liquidity if TVL is high enough\n // Use compareAmounts for precise liquidity threshold comparison\n if (compareAmounts(poolInfo.liquidity, '50000') > 0) {\n await sdk.addSwapLiquidityByPrice({\n token0: pool.token0,\n token1: pool.token1,\n fee: pool.feeTier,\n minPrice: '0.9',\n maxPrice: '1.1',\n amount0Desired: '10000',\n amount1Desired: '10000'\n });\n\n console.log('Liquidity added to new pool');\n }\n }, 60000); // Wait 1 minute\n });\n\n // Monitor liquidity removals (potential exit signal)\n sdk.subscribeToDexLiquidityRemoved((event) => {\n console.log(`Large liquidity removal: ${event.amount0}, ${event.amount1}`);\n\n // Check if we should also exit\n if (isLargeRemoval(event)) {\n console.log('Large removal detected - consider exiting position');\n }\n });\n }\n\n // Keep subscriptions running\n console.log('Subscriptions active... Press Ctrl+C to stop');\n await new Promise(() => {}); // Run forever\n\n // Cleanup when done\n cleanupAdded();\n cleanupChanged();\n cleanupRemoved();\n cleanupPool();\n cleanupSwap();\n cleanupToken();\n}\n```\n\n**Event Data Structures:**\n\n**LiquidityAdded:**\n- token0, token1, feeTier\n- amount0, amount1\n- owner, positionId\n- timestamp\n\n**LiquidityRemoved:**\n- token0, token1, feeTier\n- amount0, amount1\n- fees0, fees1\n- owner, positionId\n- timestamp\n\n**DexPoolAdded:**\n- tokenName, token0, token1\n- feeTier, tvl\n- timestamp\n\n**SwapExecuted:**\n- tokenIn, tokenOut\n- amountIn, amountOut\n- trader, feeTier\n- priceImpact\n- timestamp\n\n**TokenCreation:**\n- tokenName, tokenSymbol\n- creator, maxSupply\n- basePrice\n- timestamp\n\n**Use Cases:**\n- **Arbitrage Bots**: Monitor swaps for price divergence\n- **Liquidity Management**: Auto-provide liquidity to new pools\n- **Early Bird Trading**: Buy new tokens immediately after launch\n- **Position Monitoring**: Track liquidity changes in your positions\n- **Market Analysis**: Analyze trading patterns and volumes\n\n### WebSocket Connection Lifecycle\n\n```typescript\n// Handle connection lifecycle events\nawait sdk.connectStreamWebSocket({\n onConnect: () => {\n console.log('WebSocket connected');\n },\n onDisconnect: (reason) => {\n console.log('WebSocket disconnected:', reason);\n // Implement reconnection logic if needed\n },\n onError: (error) => {\n console.error('WebSocket error:', error);\n }\n});\n\n// Check connection state\nif (sdk.isStreamWebSocketConnected()) {\n console.log('Ready to send/receive messages');\n}\n```\n\n### Typing Indicators\n\n```typescript\n// Subscribe to typing indicators in chat\nawait sdk.connectStreamWebSocket({\n onTypingIndicator: (event) => {\n if (event.isTyping) {\n console.log(`${event.userAddress} is typing...`);\n } else {\n console.log(`${event.userAddress} stopped typing`);\n }\n }\n});\n\n// Send typing start indicator\nawait sdk.sendTypingStart({\n tokenName: 'anime'\n});\n\n// Later: Send typing stop indicator\nawait sdk.sendTypingStop({\n tokenName: 'anime'\n});\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_subscribe_to_dex_liquidity_added`\n- `gala_launchpad_subscribe_to_dex_liquidity_changed`\n- `gala_launchpad_subscribe_to_dex_liquidity_removed`\n- `gala_launchpad_subscribe_to_dex_pool_added`\n- `gala_launchpad_subscribe_to_dex_swap_executed`\n- `gala_launchpad_subscribe_to_token_creations`\n"
1654
- }
1655
- ]
1656
- },
1657
- {
1658
- "id": "bridge-operations-demo",
1659
- "title": "Example: Bridge operations",
1660
- "topic": "bridge-operations",
1661
- "messages": [
1662
- {
1663
- "role": "user",
1664
- "content": "How do I bridge tokens across chains?"
1665
- },
1666
- {
1667
- "role": "assistant",
1668
- "content": "\n## Cross-Chain Bridge Operations with SDK\n\n**Covers Methods:**\n- `estimateBridgeFee()`\n- `bridgeOut()`\n- `bridgeIn()`\n- `getBridgeStatus()`\n- `getSupportedBridgeTokens()`\n- `getEthereumTransactionStatus()`\n- `getSolanaTransactionStatus()`\n- `fetchEthereumWalletTokenBalance()` / `fetchSolanaWalletTokenBalance()`\n- `fetchEthereumWalletNativeBalance()` / `fetchSolanaWalletNativeBalance()`\n- `fetchEthereumWalletAllBalances()` / `fetchSolanaWalletAllBalances()`\n- `fetchBridgeableTokensByNetwork()` / `fetchAllBridgeableTokensByNetwork()`\n- `fetchAllTokensBridgeableToEthereum()` / `fetchAllTokensBridgeableToSolana()`\n- `isTokenBridgeableToNetwork()` / `isTokenBridgeableToEthereum()` / `isTokenBridgeableToSolana()`\n- `requestSolanaDevnetAirdrop()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function bridgeOperations() {\n // 1. Create SDK with wallet configuration\n const sdk = createLaunchpadSDK({\n privateKey: '0xabcd...',\n environment: 'production', // or 'staging' for testnet\n });\n\n // 2. Get supported bridge tokens\n const supportedTokens = await sdk.getSupportedBridgeTokens('Ethereum');\n console.log('Bridgeable to Ethereum:', supportedTokens.map(t => t.symbol));\n\n // 3. Check if specific token is bridgeable\n const canBridge = await sdk.isTokenBridgeableToEthereum('GALA');\n console.log('GALA bridgeable to Ethereum:', canBridge.bridgeable);\n\n // 4. Estimate bridge fee (calculated externally by GalaConnect API)\n const fee = await sdk.estimateBridgeFee({\n tokenId: 'GALA|Unit|none|none',\n destinationChain: 'Ethereum',\n amount: '100',\n });\n console.log('Bridge fee:', fee.totalFee, 'GALA');\n\n // 5. Bridge Out: GalaChain → Ethereum\n const bridgeOutTx = await sdk.bridgeOut({\n tokenId: 'GALA|Unit|none|none',\n amount: '100',\n destinationChain: 'Ethereum',\n recipientAddress: '0x5678...',\n });\n console.log('Bridge out TX:', bridgeOutTx.transactionHash);\n\n // 6. Get bridge status\n const status = await sdk.getBridgeStatus(bridgeOutTx.transactionHash);\n console.log('Bridge status:', status.status);\n\n // 7. Get Ethereum transaction status\n const ethTxStatus = await sdk.getEthereumTransactionStatus(bridgeOutTx.transactionHash);\n console.log('ETH TX confirmed:', ethTxStatus.confirmed);\n\n // 8. Query external chain balances\n const ethBalance = await sdk.fetchEthereumWalletNativeBalance();\n const galaEthBalance = await sdk.fetchEthereumWalletTokenBalance('GALA');\n const allEthBalances = await sdk.fetchEthereumWalletAllBalances();\n\n // 9. Discover all bridgeable tokens\n const allBridgeable = await sdk.fetchAllBridgeableTokensByNetwork('ETHEREUM');\n console.log('All tokens bridgeable to Ethereum:', allBridgeable.length);\n}\n```\n\n**Supported Tokens:**\n- **Ethereum:** GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC\n- **Solana:** GALA, GSOL\n\n**Environment Configuration:**\n- `PROD`: Ethereum Mainnet, Solana Mainnet\n- `STAGE`: Ethereum Sepolia, Solana Devnet\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_bridge_estimate_fee`\n- `gala_launchpad_bridge_out`\n- `gala_launchpad_bridge_in`\n- `gala_launchpad_bridge_status`\n- `gala_launchpad_bridge_ethereum_balance`\n- `gala_launchpad_bridge_ethereum_all_balances`\n- `gala_launchpad_bridge_solana_balance`\n- `gala_launchpad_bridge_solana_all_balances`\n"
1669
- }
1670
- ]
1671
- },
1672
- {
1673
- "id": "referral-system-demo",
1674
- "title": "Example: Referral system",
1675
- "topic": "referral-system",
1676
- "messages": [
1677
- {
1678
- "role": "user",
1679
- "content": "How do I manage referral rewards?"
1680
- },
1681
- {
1682
- "role": "assistant",
1683
- "content": "\n# Referral System\n\nThe SDK provides methods for managing referral URLs and tracking referral activity.\n\n## Get Your Referral URL\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function getReferralUrl() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get your unique referral URL\n const result = await sdk.fetchReferralUrl();\n console.log('Share this URL:', result.referralUrl);\n}\n```\n\n## Fetch Referrals (Paginated)\n\n```typescript\nasync function fetchReferrals() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Paginated referral list\n const referrals = await sdk.fetchReferrals({\n address: '0x...', // Optional, defaults to SDK wallet\n page: 1,\n limit: 20\n });\n\n console.log('Total referrals:', referrals.total);\n referrals.items.forEach(ref => {\n console.log(`Referred: ${ref.referredAddress} on ${ref.createdAt}`);\n });\n}\n```\n\n## Fetch All Referrals (Auto-Paginated)\n\n```typescript\nasync function fetchAllReferrals() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get ALL referrals with auto-pagination\n const allReferrals = await sdk.fetchAllReferrals({ address: '0x...' });\n console.log('Total referrals:', allReferrals.length);\n}\n```\n\n## Referral Summary\n\n```typescript\nasync function getReferralSummary() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const summary = await sdk.fetchReferralsSummary({ address: '0x...' });\n console.log('Total referred users:', summary.totalReferrals);\n console.log('Total rewards earned:', summary.totalRewards);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_referral_url`\n- `gala_launchpad_fetch_referrals`\n- `gala_launchpad_fetch_all_referrals`\n- `gala_launchpad_fetch_referrals_summary`\n"
1684
- }
1685
- ]
1686
- },
1687
- {
1688
- "id": "session-auth-demo",
1689
- "title": "Example: Session auth",
1690
- "topic": "session-auth",
1691
- "messages": [
1692
- {
1693
- "role": "user",
1694
- "content": "How do I manage JWT authentication?"
1695
- },
1696
- {
1697
- "role": "assistant",
1698
- "content": "\n# Session Authentication (JWT) - SDK v5.1.0+\n\nJWT-based session authentication for protected operations (streaming, chat, profile updates).\n\n## Authentication Flow\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n environment: 'production',\n});\n\n// 1. Login to get JWT token\nconst session = await sdk.login();\nconsole.log('Authenticated:', session.address);\nconsole.log('Token expires in:', session.expiresIn, 'seconds');\n\n// 2. Check authentication status\nif (sdk.isAuthenticated()) {\n console.log('Session is valid');\n}\n\n// 3. Get current session info\nconst info = await sdk.getSession();\nconsole.log('Session issued at:', info.issuedAt);\nconsole.log('Session expires at:', info.expiresAt);\n\n// 4. Access token directly (for custom requests)\nconst token = sdk.getAccessToken();\nconsole.log('JWT token:', token);\n\n// 5. Refresh token before expiry\nif (sdk.shouldRefreshToken()) {\n const refreshed = await sdk.refreshToken();\n console.log('Token refreshed, new expiry:', refreshed.expiresIn);\n}\n\n// 6. Ensure valid token (auto-refreshes if needed)\nconst validToken = await sdk.ensureValidToken();\nconsole.log('Valid token obtained');\n\n// 7. Logout when done\nsdk.logout();\nconsole.log('Logged out');\n```\n\n## Auto-Refresh Behavior\n\nThe SDK automatically refreshes tokens when:\n- Token expires within 5 minutes (default threshold)\n- Making requests to JWT-protected endpoints\n\n```typescript\n// Manual refresh threshold check\nconst shouldRefresh = sdk.shouldRefreshToken(10 * 60 * 1000); // 10 min threshold\n\n// ensureValidToken auto-refreshes if needed\nconst token = await sdk.ensureValidToken(5 * 60 * 1000); // 5 min threshold\n```\n\n## Protected Endpoints\n\nThese operations require JWT authentication (call \\`login()\\` first):\n\n**Streaming:**\n- \\`startStream()\\` - Start live stream\n- \\`resetStreamKey()\\` - Reset RTMP key\n- \\`getRecordingDownload()\\` - Download recordings\n- \\`deleteRecording()\\` - Delete recordings\n- \\`addSimulcastTarget()\\` - Add simulcast\n- \\`removeSimulcastTarget()\\` - Remove simulcast\n\n**Chat:**\n- \\`sendChatMessage()\\` - Send chat messages\n\n**Profile:**\n- \\`updateProfile()\\` - Update user profile\n\n**Uploads:**\n- \\`uploadTokenImage()\\` - Upload token images\n- \\`uploadProfileImage()\\` - Upload profile images\n\n## Error Handling\n\n```typescript\ntry {\n await sdk.login();\n} catch (error) {\n if (error.message.includes('signature')) {\n console.error('Wallet signature failed');\n } else if (error.message.includes('network')) {\n console.error('Network error during login');\n }\n}\n\n// Check auth before protected operations\nif (!sdk.isAuthenticated()) {\n await sdk.login();\n}\n\ntry {\n await sdk.startStream('mytoken');\n} catch (error) {\n if (error.message.includes('JWT') || error.message.includes('token')) {\n // Re-authenticate and retry\n await sdk.login();\n await sdk.startStream('mytoken');\n }\n}\n```\n\n## Session Methods Reference\n\n| Method | Description | Returns |\n|--------|-------------|---------|\n| \\`login()\\` | Authenticate with wallet signature | \\`{ accessToken, expiresIn, address }\\` |\n| \\`logout()\\` | Clear JWT token (client-side) | \\`void\\` |\n| \\`refreshToken()\\` | Get new JWT token | \\`{ accessToken, expiresIn, address }\\` |\n| \\`getSession()\\` | Get session info | \\`{ address, issuedAt, expiresAt }\\` |\n| \\`isAuthenticated()\\` | Check if token exists and valid | \\`boolean\\` |\n| \\`shouldRefreshToken(threshold?)\\` | Check if refresh needed | \\`boolean\\` |\n| \\`getAccessToken()\\` | Get raw JWT token | \\`string | null\\` |\n| \\`ensureValidToken(threshold?)\\` | Auto-refresh if needed | \\`Promise<string>\\` |\n\n## Dev Bypass (STAGE Only)\n\nFor testing in STAGE environment without JWT:\n\n```typescript\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n environment: 'development',\n devBypass: true, // Skip JWT auth in STAGE\n});\n\n// Protected methods work without login() in STAGE\nawait sdk.startStream('testtoken');\n```\n\n**Note:** Dev bypass only works in STAGE/development environments.\n"
1699
- }
1700
- ]
1701
- },
1702
- {
1703
- "id": "streaming-demo",
1704
- "title": "Example: Streaming",
1705
- "topic": "streaming",
1706
- "messages": [
1707
- {
1708
- "role": "user",
1709
- "content": "How do I manage live streams?"
1710
- },
1711
- {
1712
- "role": "assistant",
1713
- "content": "\n# Live Streaming SDK\n\nThe SDK provides comprehensive live streaming management including stream control,\nrecordings management, and simulcast to external platforms.\n\n## Starting a Stream\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageStream() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamWebSocketUrl: 'wss://stream.example.com', // Required for streaming\n streamAdminApiKey: 'your-admin-key', // Optional: for admin operations\n });\n\n // Start a stream for your token\n const stream = await sdk.startStream('mytoken');\n console.log('Stream Key:', stream.streamKey);\n console.log('RTMP URL:', stream.rtmpUrl);\n console.log('Playback URL:', stream.playbackUrl);\n // Use stream.streamKey in OBS or other RTMP software\n\n // Get stream info (public endpoint)\n const info = await sdk.getStreamInfo('mytoken');\n console.log('Status:', info.status); // IDLE, ACTIVE, DISABLED\n console.log('Is Live:', info.isLive);\n console.log('Viewers:', info.viewerCount);\n\n // Stop the stream when done\n await sdk.stopStream('mytoken');\n console.log('Stream stopped');\n\n // Reset stream key if compromised\n const newKey = await sdk.resetStreamKey('mytoken');\n console.log('New Stream Key:', newKey.streamKey);\n}\n```\n\n## Recordings Management\n\n```typescript\nasync function manageRecordings() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // List recordings (paginated)\n const recordings = await sdk.getStreamRecordings({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n });\n console.log('Total recordings:', recordings.total);\n\n for (const rec of recordings.recordings) {\n console.log('Asset ID:', rec.assetId);\n console.log('Duration:', rec.duration, 'seconds');\n console.log('Status:', rec.status); // READY, PROCESSING, ERRORED\n }\n\n // Get download URL for a recording\n const download = await sdk.getRecordingDownload('mytoken', 'asset-123');\n console.log('Download URL:', download.downloadUrl);\n console.log('Expires:', download.expiresAt);\n\n // Delete a recording\n await sdk.deleteRecording('mytoken', 'asset-123');\n}\n```\n\n## Simulcast Management\n\nRebroadcast your stream to external platforms (YouTube, Twitch, Facebook).\n\n```typescript\nasync function manageSimulcast() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get existing simulcast targets\n const targets = await sdk.getSimulcastTargets('mytoken');\n console.log('Max targets:', targets.maxTargets);\n console.log('Current targets:', targets.targets.length);\n\n // Add YouTube simulcast\n const youtube = await sdk.addSimulcastTarget({\n tokenName: 'mytoken',\n platform: 'YOUTUBE',\n rtmpUrl: 'rtmp://a.rtmp.youtube.com/live2',\n streamKey: 'your-youtube-stream-key',\n name: 'My YouTube Channel',\n });\n console.log('Added target:', youtube.target.targetId);\n\n // Add Twitch simulcast\n await sdk.addSimulcastTarget({\n tokenName: 'mytoken',\n platform: 'TWITCH',\n rtmpUrl: 'rtmp://live.twitch.tv/app',\n streamKey: 'live_123456_abcdef',\n name: 'Twitch Stream',\n });\n\n // Remove a simulcast target\n await sdk.removeSimulcastTarget('mytoken', youtube.target.targetId);\n}\n```\n\n## Admin Operations\n\nEnable/disable streaming globally or per-token (requires admin API key).\n\n```typescript\nasync function adminOperations() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamAdminApiKey: 'your-admin-key',\n });\n\n // Disable streaming for a specific token (admin-only)\n await sdk.disableStream('mytoken');\n\n // Re-enable streaming for a token (admin-only)\n await sdk.enableStream('mytoken');\n\n // Get global streaming status\n const globalStatus = await sdk.getGlobalStreamingStatus();\n console.log('Global streaming enabled:', globalStatus.enabled);\n\n // Enable/disable streaming globally (maintenance mode)\n await sdk.setGlobalStreamingEnabled(false); // Disable all streams\n await sdk.setGlobalStreamingEnabled(true); // Re-enable\n}\n```\n\n**Available SDK Methods:**\n| Method | Description | Auth |\n|--------|-------------|------|\n| `startStream(tokenName)` | Start a stream | Wallet |\n| `stopStream(tokenName)` | Stop a stream | Wallet |\n| `getStreamInfo(tokenName)` | Get stream status | Public |\n| `resetStreamKey(tokenName)` | Generate new stream key | Wallet |\n| `disableStream(tokenName)` | Disable token streaming | Admin |\n| `enableStream(tokenName)` | Enable token streaming | Admin |\n| `getStreamRecordings(options)` | List recordings | Public |\n| `getRecordingDownload(tokenName, assetId)` | Get download URL | Wallet |\n| `deleteRecording(tokenName, assetId)` | Delete recording | Wallet |\n| `getSimulcastTargets(tokenName)` | List simulcast targets | Public |\n| `addSimulcastTarget(options)` | Add simulcast target | Wallet |\n| `removeSimulcastTarget(tokenName, targetId)` | Remove target | Wallet |\n| `getGlobalStreamingStatus()` | Get global status | Public |\n| `setGlobalStreamingEnabled(enabled)` | Enable/disable globally | Admin |\n| `getAvailableRoles()` | Get list of available streaming roles | Public |\n| `getStreamRole(options)` | Get user's role for a token | JWT |\n| `getTokenAccess(options)` | Check user's access to a token stream | JWT (optional) |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_start_stream`\n- `gala_launchpad_stop_stream`\n- `gala_launchpad_get_stream_info`\n- `gala_launchpad_reset_stream_key`\n- `gala_launchpad_disable_stream`\n- `gala_launchpad_enable_stream`\n- `gala_launchpad_get_stream_recordings`\n- `gala_launchpad_get_recording_download`\n- `gala_launchpad_delete_recording`\n- `gala_launchpad_get_simulcast_targets`\n- `gala_launchpad_add_simulcast_target`\n- `gala_launchpad_remove_simulcast_target`\n- `gala_launchpad_get_global_streaming_status`\n- `gala_launchpad_set_global_streaming_enabled`\n- `gala_launchpad_get_available_roles`\n- `gala_launchpad_get_stream_role`\n- `gala_launchpad_get_token_access`\n"
1714
- }
1715
- ]
1716
- },
1717
- {
1718
- "id": "stream-chat-demo",
1719
- "title": "Example: Stream chat",
1720
- "topic": "stream-chat",
1721
- "messages": [
1722
- {
1723
- "role": "user",
1724
- "content": "How do I handle stream chat and messaging?"
1725
- },
1726
- {
1727
- "role": "assistant",
1728
- "content": "\n# Stream Chat SDK\n\nThe SDK provides chat functionality for live streams, including REST API and\nWebSocket real-time messaging.\n\n## REST API Chat\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function restChat() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get chat messages (public endpoint)\n const messages = await sdk.getChatMessages({\n tokenName: 'mytoken',\n page: 1,\n limit: 50,\n });\n\n for (const msg of messages.messages) {\n console.log(`[${msg.createdAt}] ${msg.user?.fullName}: ${msg.content}`);\n }\n\n // Send a chat message via REST\n const sent = await sdk.sendChatMessage({\n tokenName: 'mytoken',\n content: 'Hello everyone!',\n });\n console.log('Message ID:', sent.message.messageId);\n\n // Delete a chat message (user can delete own, admin can delete any)\n const deleted = await sdk.deleteChatMessage({\n tokenName: 'mytoken',\n messageId: sent.message.messageId,\n });\n console.log('Message deleted:', deleted.deleted);\n\n // Check chat status\n const status = await sdk.getChatStatus('mytoken');\n console.log('Chat enabled:', status.enabled);\n if (!status.enabled) {\n console.log('Reason:', status.reason); // 'global' or 'token'\n }\n}\n```\n\n## WebSocket Real-time Chat\n\nLower latency messaging with real-time updates.\n\n```typescript\nasync function webSocketChat() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamWebSocketUrl: 'wss://stream.example.com',\n });\n\n // Connect with event callbacks\n await sdk.connectStreamWebSocket({\n onConnect: () => console.log('Connected!'),\n onDisconnect: (reason) => console.log('Disconnected:', reason),\n onError: (error) => console.error('Error:', error),\n onChatMessage: (msg) => {\n console.log(`[${msg.tokenName}] ${msg.userAddress}: ${msg.content}`);\n },\n onViewerCount: (data) => {\n console.log(`Viewers on ${data.tokenName}: ${data.count}`);\n },\n onStreamStatus: (status) => {\n console.log(`Stream ${status.tokenName}: ${status.status}`);\n },\n });\n\n // Authenticate (required for sending messages)\n await sdk.authenticateStreamWebSocket();\n\n // Subscribe to a stream's events\n const subscribed = await sdk.subscribeToStream('mytoken');\n console.log('Subscribed, stream status:', subscribed.status);\n\n // Send message via WebSocket (lower latency)\n await sdk.sendStreamChatViaWebSocket('mytoken', 'Hello via WebSocket!');\n\n // Send emoji reaction (ephemeral, not persisted)\n await sdk.sendStreamReaction('mytoken', '🔥', 0);\n\n // Unsubscribe when done\n await sdk.unsubscribeFromStream('mytoken');\n\n // Disconnect\n sdk.disconnectStreamWebSocket();\n}\n```\n\n## Admin Chat Operations\n\n```typescript\nasync function adminChat() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamAdminApiKey: 'your-admin-key',\n });\n\n // Disable chat for a token\n await sdk.disableChat('mytoken');\n\n // Re-enable chat\n await sdk.enableChat('mytoken');\n\n // Get global chat status\n const globalStatus = await sdk.getGlobalChatStatus();\n console.log('Global chat enabled:', globalStatus.enabled);\n\n // Disable/enable chat globally\n await sdk.setGlobalChatEnabled(false); // Disable all chat\n await sdk.setGlobalChatEnabled(true); // Re-enable\n}\n```\n\n**WebSocket Events:**\n| Event | Description | Payload |\n|-------|-------------|---------|\n| `chat_message` | New chat message | `{ tokenName, messageId, content, userAddress, user? }` |\n| `viewer_count` | Viewer count update | `{ tokenName, count }` |\n| `stream_status` | Stream status change | `{ tokenName, status, isLive, playbackId }` |\n| `chat_status` | Chat enabled/disabled | `{ tokenName, enabled }` |\n\n**Available SDK Methods:**\n| Method | Description | Auth |\n|--------|-------------|------|\n| `getChatMessages(options)` | Get chat history | Public |\n| `sendChatMessage(options)` | Send via REST | Wallet |\n| `deleteChatMessage(options)` | Delete message | Wallet/Admin |\n| `getChatStatus(tokenName)` | Check chat status | Public |\n| `disableChat(tokenName)` | Disable token chat | Admin |\n| `enableChat(tokenName)` | Enable token chat | Admin |\n| `getGlobalChatStatus()` | Get global status | Public |\n| `setGlobalChatEnabled(enabled)` | Enable/disable globally | Admin |\n| `connectStreamWebSocket(callbacks)` | Connect WebSocket | None |\n| `authenticateStreamWebSocket()` | Authenticate WS | Wallet |\n| `subscribeToStream(tokenName)` | Subscribe to events | None |\n| `unsubscribeFromStream(tokenName)` | Unsubscribe | None |\n| `sendStreamChatViaWebSocket(tokenName, content)` | Send via WS | Wallet |\n| `sendStreamReaction(tokenName, emoji, streamTime)` | Send emoji reaction | Wallet |\n| `disconnectStreamWebSocket()` | Close connection | None |\n| `getEngagementStats(tokenName)` | Get viewer and chat engagement stats | Public |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_chat_messages`\n- `gala_launchpad_send_chat_message`\n- `gala_launchpad_delete_chat_message`\n- `gala_launchpad_get_chat_status`\n- `gala_launchpad_set_chat_enabled`\n- `gala_launchpad_get_global_chat_status`\n- `gala_launchpad_set_global_chat_enabled`\n- `gala_launchpad_connect_stream_websocket`\n- `gala_launchpad_subscribe_to_stream`\n- `gala_launchpad_send_stream_chat_websocket`\n- `gala_launchpad_send_stream_reaction`\n- `gala_launchpad_get_engagement_stats`\n"
1729
- }
1730
- ]
1731
- },
1732
- {
1733
- "id": "ban-management-demo",
1734
- "title": "Example: Ban management",
1735
- "topic": "ban-management",
1736
- "messages": [
1737
- {
1738
- "role": "user",
1739
- "content": "How do I manage user bans?"
1740
- },
1741
- {
1742
- "role": "assistant",
1743
- "content": "\n# Ban/Moderation Operations - SDK v5.5.0+\n\nUser ban management for stream moderation, including creating bans, removing bans,\nlisting banned users, checking ban status, and viewing active users.\n\n## Creating and Removing Bans\n\n```typescript\nimport { createLaunchpadSDK, BAN_DURATIONS } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key for ban ops\n});\n\n// Create a permanent ban\nconst permanentBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n reason: 'Spamming chat',\n});\nconsole.log('Permanent ban created:', permanentBan.ban.id);\n\n// Create a temporary ban (1 hour)\nconst tempBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0xabcdef1234567890abcdef1234567890abcdef12',\n reason: 'Inappropriate behavior',\n durationSeconds: BAN_DURATIONS.ONE_HOUR, // 3600 seconds\n});\nconsole.log('Temp ban expires:', tempBan.ban.expiresAt);\n\n// Remove a ban (unban user)\nconst unbanned = await sdk.removeBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n});\nconsole.log('User unbanned:', unbanned.removed);\n```\n\n## Duration Presets\n\n```typescript\nimport { BAN_DURATIONS } from '@gala-chain/launchpad-sdk';\n\n// Available presets\nBAN_DURATIONS.ONE_HOUR // 3600 seconds (1 hour)\nBAN_DURATIONS.ONE_DAY // 86400 seconds (24 hours)\nBAN_DURATIONS.ONE_WEEK // 604800 seconds (7 days)\nBAN_DURATIONS.ONE_MONTH // 2592000 seconds (30 days)\n\n// Custom duration (min: 60 sec, max: 31536000 sec / 1 year)\nconst customBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x...',\n durationSeconds: 7200, // 2 hours\n});\n```\n\n## Listing Bans\n\n```typescript\n// List all bans for a token\nconst allBans = await sdk.listBans({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n});\nconsole.log('Total bans:', allBans.meta.total);\n\nfor (const ban of allBans.bans) {\n console.log(`- ${ban.userAddress}: ${ban.reason || 'No reason'}`);\n console.log(` Permanent: ${ban.isPermanent}`);\n console.log(` Expires: ${ban.expiresAt || 'Never'}`);\n}\n\n// Search bans by user\nconst searchResults = await sdk.listBans({\n tokenName: 'mytoken',\n search: '0x1234', // Searches userAddress OR fullName\n});\n\n// Filter by specific field\nconst filteredBans = await sdk.listBans({\n tokenName: 'mytoken',\n userAddress: '0x1234', // Filter by address only\n name: 'John', // Filter by display name only\n});\n```\n\n## Checking Ban Status\n\n```typescript\n// Check if specific user is banned\nconst status = await sdk.getBanStatus({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n});\n\nif (status.banned) {\n console.log('User is banned!');\n console.log('Reason:', status.ban?.reason);\n console.log('Permanent:', status.ban?.isPermanent);\n console.log('Expires:', status.ban?.expiresAt);\n} else {\n console.log('User is not banned');\n}\n```\n\n## Viewing Active Users\n\n```typescript\nimport { ACTIVE_USER_TYPE } from '@gala-chain/launchpad-sdk';\n\n// Get all active viewers\nconst viewers = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n type: ACTIVE_USER_TYPE.VIEWERS, // or 'viewers'\n});\nconsole.log('Active viewers:', viewers.total);\n\n// Get only chat participants\nconst chatters = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n type: ACTIVE_USER_TYPE.CHAT_PARTICIPANTS, // or 'chat_participants'\n});\nconsole.log('Chat participants:', chatters.total);\n\n// Search active users\nconst searchActive = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n search: 'john', // Search by name or address\n});\n\nfor (const user of searchActive.users) {\n console.log(`- ${user.fullName || user.userAddress}`);\n console.log(` In chat: ${user.isChatParticipant}`);\n}\n```\n\n## Authentication\n\nBan operations support two authentication modes:\n\n1. **Admin API Key** (streamAdminApiKey) - Full moderation access\n2. **JWT Auth** (login()) - Token owner moderation only\n\n```typescript\n// Admin mode - can moderate any token\nconst adminSdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,\n});\n\n// Owner mode - can only moderate own tokens\nconst ownerSdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\nawait ownerSdk.login(); // JWT authentication required\n```\n\n## WebSocket Events\n\nBan events are broadcast to affected users via WebSocket:\n\n```typescript\n// Listen for ban events\nsdk.connectStreamWebSocket({\n onUserBanned: (event) => {\n console.log('User banned:', event.userAddress);\n console.log('Reason:', event.reason);\n console.log('Expires:', event.expiresAt);\n },\n onUserUnbanned: (event) => {\n console.log('User unbanned:', event.userAddress);\n },\n onBanEnforcement: (event) => {\n // Received when banned user tries to chat/react\n console.log('Ban enforced for action:', event.action);\n console.log('Reason:', event.reason);\n },\n});\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createBan(options)` | Create a new ban | Admin/Owner |\n| `removeBan(options)` | Remove a ban (unban user) | Admin/Owner |\n| `listBans(options)` | List banned users | Admin/Owner |\n| `getBanStatus(options)` | Check if user is banned | Admin/Owner |\n| `getActiveUsers(options)` | Get active viewers/chatters | Admin/Owner |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_ban`\n- `gala_launchpad_remove_ban`\n- `gala_launchpad_list_bans`\n- `gala_launchpad_get_ban_status`\n- `gala_launchpad_get_active_users`\n"
1744
- }
1745
- ]
1746
- },
1747
- {
1748
- "id": "api-key-management-demo",
1749
- "title": "Example: Api key management",
1750
- "topic": "api-key-management",
1751
- "messages": [
1752
- {
1753
- "role": "user",
1754
- "content": "How do I manage API keys?"
1755
- },
1756
- {
1757
- "role": "assistant",
1758
- "content": "\n# API Key Management - SDK v5.6.0+\n\nUser-managed API keys with role-based permissions for delegating token management\nauthority to third-party services or automated systems.\n\n**CRITICAL**: Raw API keys are ONLY shown once at creation time. Store them\nsecurely immediately - they cannot be retrieved again.\n\n## Creating API Keys\n\n```typescript\nimport { createLaunchpadSDK, API_KEY_ROLE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\n// MUST authenticate first\nawait sdk.login();\n\n// Create a moderator key for specific tokens\nconst result = await sdk.createApiKey({\n role: API_KEY_ROLE.MODERATOR,\n description: 'Chat moderation bot',\n delegateAllTokens: false,\n tokenNames: ['mytoken', 'othertoken'],\n expiresAt: '2025-12-31T23:59:59Z', // Optional expiration\n});\n\n// CRITICAL: Save this immediately - shown only once!\nconsole.log('Raw Key:', result.rawKey);\n// Format: glp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nconsole.log('Key ID:', result.id);\nconsole.log('Prefix:', result.keyPrefix);\n```\n\n## Role Hierarchy\n\n```typescript\nimport { API_KEY_ROLE, API_KEY_ROLE_HIERARCHY } from '@gala-chain/launchpad-sdk';\n\n// Available roles (hierarchical)\nAPI_KEY_ROLE.MODERATOR // Chat, comments, bans\nAPI_KEY_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start\nAPI_KEY_ROLE.MANAGER // Moderator + Technical Producer + recordings\nAPI_KEY_ROLE.OWNER // Full access (indistinguishable from normal auth)\n\n// Role hierarchy levels\nAPI_KEY_ROLE_HIERARCHY.MODERATOR // 1\nAPI_KEY_ROLE_HIERARCHY.TECHNICAL_PRODUCER // 1\nAPI_KEY_ROLE_HIERARCHY.MANAGER // 2\nAPI_KEY_ROLE_HIERARCHY.OWNER // 3\n\n// Check if role has sufficient permission\nimport { roleHasSufficientPermission } from '@gala-chain/launchpad-sdk';\n\nconst canManage = roleHasSufficientPermission('MANAGER', 'MODERATOR'); // true\nconst canOwn = roleHasSufficientPermission('MODERATOR', 'OWNER'); // false\n```\n\n## Token Delegation\n\n```typescript\n// Delegate all tokens (current and future)\nconst allTokensKey = await sdk.createApiKey({\n role: API_KEY_ROLE.MODERATOR,\n description: 'All tokens moderator',\n delegateAllTokens: true,\n});\n\n// Delegate specific tokens only\nconst specificKey = await sdk.createApiKey({\n role: API_KEY_ROLE.MANAGER,\n description: 'Project manager for specific tokens',\n delegateAllTokens: false,\n tokenNames: ['token1', 'token2', 'token3'], // Case-insensitive\n});\n```\n\n## Listing and Getting API Keys\n\n```typescript\n// List all API keys (paginated)\nconst list = await sdk.listApiKeys({\n page: 1,\n limit: 20,\n});\nconsole.log('Total keys:', list.meta.total);\n\nfor (const key of list.apiKeys) {\n console.log(`- ${key.keyPrefix}: ${key.role}`);\n console.log(` Description: ${key.description || 'None'}`);\n console.log(` Last used: ${key.lastUsedAt || 'Never'}`);\n console.log(` Expires: ${key.expiresAt || 'Never'}`);\n}\n\n// Get single API key by ID\nconst key = await sdk.getApiKey(123);\nconsole.log('Key details:', key);\n```\n\n## Updating API Keys\n\n```typescript\n// Update description\nconst updated = await sdk.updateApiKey(123, {\n description: 'Updated description',\n});\n\n// Upgrade role\nawait sdk.updateApiKey(123, {\n role: API_KEY_ROLE.MANAGER,\n});\n\n// Change token delegation\nawait sdk.updateApiKey(123, {\n delegateAllTokens: true,\n});\n\n// Update specific token access (replaces existing)\nawait sdk.updateApiKey(123, {\n delegateAllTokens: false,\n tokenNames: ['newtoken1', 'newtoken2'],\n});\n\n// Update expiration (null to remove)\nawait sdk.updateApiKey(123, {\n expiresAt: '2026-12-31T23:59:59Z',\n});\n\n// Remove expiration\nawait sdk.updateApiKey(123, {\n expiresAt: null,\n});\n```\n\n## Revoking API Keys\n\n```typescript\n// Revoke (soft delete) an API key\nawait sdk.revokeApiKey(123);\nconsole.log('API key revoked');\n\n// Key is now unusable - attempts to use it will fail with 401\n```\n\n## Getting Available Roles\n\n```typescript\n// Get list of valid roles\nconst roles = sdk.getApiKeyRoles();\nconsole.log('Available roles:', roles);\n// ['MODERATOR', 'TECHNICAL_PRODUCER', 'MANAGER', 'OWNER']\n```\n\n## Validation Helpers\n\n```typescript\nimport {\n isValidApiKeyRole,\n validateCreateApiKeyOptions,\n validateUpdateApiKeyOptions,\n} from '@gala-chain/launchpad-sdk';\n\n// Validate role string\nif (isValidApiKeyRole('MODERATOR')) {\n console.log('Valid role');\n}\n\n// Validate creation options\nconst createErrors = validateCreateApiKeyOptions({\n role: 'MODERATOR',\n description: 'Test key',\n});\nif (createErrors.length > 0) {\n console.error('Validation errors:', createErrors);\n}\n\n// Validate update options\nconst updateErrors = validateUpdateApiKeyOptions({\n role: 'MANAGER',\n expiresAt: '2025-12-31T23:59:59Z',\n});\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createApiKey(options)` | Create new API key | JWT |\n| `listApiKeys(options?)` | List API keys (paginated) | JWT |\n| `getApiKey(id)` | Get API key by ID | JWT |\n| `updateApiKey(id, options)` | Update API key | JWT |\n| `revokeApiKey(id)` | Revoke (soft delete) key | JWT |\n| `getApiKeyRoles()` | Get valid role list | None |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_api_key`\n- `gala_launchpad_list_api_keys`\n- `gala_launchpad_get_api_key`\n- `gala_launchpad_update_api_key`\n- `gala_launchpad_revoke_api_key`\n- `gala_launchpad_get_api_key_roles`\n"
1759
- }
1760
- ]
1761
- },
1762
- {
1763
- "id": "moderator-invites-demo",
1764
- "title": "Example: Moderator invites",
1765
- "topic": "moderator-invites",
1766
- "messages": [
1767
- {
1768
- "role": "user",
1769
- "content": "How do I manage moderator invites?"
1770
- },
1771
- {
1772
- "role": "assistant",
1773
- "content": "\n# Moderator Invites - SDK v5.7.0+\n\nMagic link-based moderator delegation system. Token owners can create invite\nlinks to grant stream management access to other users without needing their\nwallet address upfront.\n\n## Flow Overview\n\n1. **Owner creates invite** → Gets magic link URL\n2. **Owner shares link** (email, Slack, Discord, etc.)\n3. **Recipient clicks link** → Redirected to claim page\n4. **Recipient logs in** → Claims invite with their wallet\n5. **Recipient gains access** → Token appears in their /studio dashboard\n\n## Creating Moderator Invites\n\n```typescript\nimport { createLaunchpadSDK, MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\n// MUST authenticate first\nawait sdk.login();\n\n// Create an invite for a moderator\nconst result = await sdk.createModeratorInvite({\n tokenName: 'mytoken',\n role: MODERATOR_ROLE.MODERATOR,\n description: 'John - Friday stream moderator',\n expiresAt: '2025-12-31T23:59:59Z', // Optional expiration\n});\n\n// Share this URL with the intended moderator\nconsole.log('Invite URL:', result.invite.inviteUrl);\nconsole.log('Invite Code:', result.invite.inviteCode);\nconsole.log('Status:', result.invite.status); // PENDING\n```\n\n## Moderator Roles\n\n```typescript\nimport { MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';\n\n// Available roles (OWNER not available for invites)\nMODERATOR_ROLE.MODERATOR // Chat, comments, bans\nMODERATOR_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start\nMODERATOR_ROLE.MANAGER // All of the above + recordings + stream settings\n```\n\n## Listing Invites\n\n```typescript\n// List all invites for a token (owner only)\nconst list = await sdk.listModeratorInvites({\n tokenName: 'mytoken',\n status: 'PENDING', // Optional filter: PENDING, CLAIMED, REVOKED, EXPIRED\n page: 1,\n limit: 20,\n});\n\nconsole.log('Total invites:', list.meta.totalItems);\n\nfor (const invite of list.invites) {\n console.log(`- ID ${invite.id}: ${invite.role}`);\n console.log(` Status: ${invite.status}`);\n console.log(` Description: ${invite.description || 'None'}`);\n console.log(` Created: ${invite.createdAt}`);\n console.log(` Expires: ${invite.expiresAt || 'Never'}`);\n}\n```\n\n## Claiming Invites (Recipient Side)\n\n```typescript\n// Extract code from magic link URL\nconst inviteCode = 'abc123...'; // 64-character hex code\n\n// Recipient authenticates and claims\nawait sdk.login();\n\nconst result = await sdk.claimModeratorInvite({\n inviteCode: inviteCode,\n});\n\nconsole.log('Claimed token:', result.token.tokenName);\nconsole.log('Your role:', result.token.role);\nconsole.log('Claimed at:', result.token.claimedAt);\n// Token now appears in /studio dashboard\n```\n\n## Previewing Invites (Public)\n\n```typescript\n// Preview invite details before logging in (public endpoint)\nconst preview = await sdk.getModeratorInviteByCode('abc123...');\n\nconsole.log('Token:', preview.tokenName);\nconsole.log('Symbol:', preview.tokenSymbol);\nconsole.log('Role offered:', preview.role);\nconsole.log('Status:', preview.status);\nconsole.log('Invited by:', preview.invitedBy.fullName);\n```\n\n## Getting Moderated Tokens (Studio Dashboard)\n\n```typescript\n// Get all tokens where you have moderator access\nawait sdk.login();\n\nconst tokens = await sdk.getModeratedTokens({\n page: 1,\n limit: 20,\n});\n\nfor (const token of tokens.tokens) {\n console.log(`- ${token.tokenName} (${token.tokenSymbol})`);\n console.log(` Role: ${token.role}`);\n console.log(` Stream status: ${token.muxStreamStatus}`);\n}\n```\n\n## Revoking Invites\n\n```typescript\n// Revoke by invite ID (owner only)\nawait sdk.revokeModeratorInvite(123);\nconsole.log('Invite revoked');\n\n// If already claimed, moderator loses access immediately\n// If pending, invite can no longer be claimed\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createModeratorInvite(options)` | Create magic link invite | JWT (owner) |\n| `claimModeratorInvite(options)` | Claim invite with code | JWT |\n| `getModeratedTokens(options?)` | Get tokens you moderate | JWT |\n| `listModeratorInvites(options)` | List invites for token | JWT (owner) |\n| `revokeModeratorInvite(id)` | Revoke invite by ID | JWT (owner) |\n| `getModeratorInviteByCode(code)` | Preview invite details | None |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_moderator_invite`\n- `gala_launchpad_claim_moderator_invite`\n- `gala_launchpad_get_moderated_tokens`\n- `gala_launchpad_list_moderator_invites`\n- `gala_launchpad_revoke_moderator_invite`\n- `gala_launchpad_get_moderator_invite`\n"
1774
- }
1775
- ]
1776
- },
1777
- {
1778
- "id": "overseer-invites-demo",
1779
- "title": "Example: Overseer invites",
1780
- "topic": "overseer-invites",
1781
- "messages": [
1782
- {
1783
- "role": "user",
1784
- "content": "How do I manage overseer invites?"
1785
- },
1786
- {
1787
- "role": "assistant",
1788
- "content": "\n# Overseer System - SDK v5.9.0+\n\nGlobal platform oversight via magic link invites. Overseers have MANAGER-level\naccess to ALL tokens (current and future), unlike moderators who have token-scoped access.\n\n## Key Differences from Moderators\n\n| Feature | Moderator | Overseer |\n|---------|-----------|----------|\n| Scope | Per-token or blanket (owner's tokens) | ALL tokens on platform |\n| Access Level | MODERATOR, TECHNICAL_PRODUCER, or MANAGER | Always MANAGER |\n| Grant Authority | Token owner | Admin or existing Overseer |\n| Use Case | Stream management delegation | Platform-wide oversight |\n\n## Creating Overseer Invites\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key OR JWT auth\n});\n\n// Option 1: Using Admin API key\nconst result = await sdk.createOverseerInvite({\n description: 'John - Platform Support Team',\n expiresAt: '2025-12-31T23:59:59Z', // Optional\n});\n\n// Option 2: Using JWT (as existing Overseer)\nawait sdk.login();\nconst result = await sdk.createOverseerInvite({\n description: 'Platform team member',\n});\n\nconsole.log('Share this link:', result.invite.inviteUrl);\nconsole.log('Invite Code:', result.invite.inviteCode);\n```\n\n## Claiming Overseer Invites\n\n```typescript\n// Recipient must be authenticated\nawait sdk.login();\n\n// Claim the invite\nconst claimed = await sdk.claimOverseerInvite('abc123...');\nconsole.log('Now an overseer!');\nconsole.log('Status:', claimed.invite.status); // CLAIMED\n\n// Check own status\nconst status = await sdk.getMyOverseerStatus();\nconsole.log('Is Overseer:', status.isOverseer); // true\nconsole.log('Granted at:', status.overseer?.createdAt);\n```\n\n## Listing Overseers and Invites\n\n```typescript\n// List all overseer invites (paginated)\nconst invites = await sdk.listOverseerInvites({\n status: 'PENDING', // PENDING, CLAIMED, REVOKED, EXPIRED\n page: 1,\n limit: 20,\n});\n\nfor (const invite of invites.invites) {\n console.log(`#${invite.id}: ${invite.description || 'No description'}`);\n console.log(` Status: ${invite.status}`);\n console.log(` Created by: ${invite.invitedBy.fullName || invite.invitedBy.address}`);\n}\n\n// List all active overseers\nconst overseers = await sdk.listOverseers({\n status: 'ACTIVE', // ACTIVE or REVOKED\n page: 1,\n limit: 20,\n});\n\nfor (const overseer of overseers.overseers) {\n console.log(`Overseer: ${overseer.userAddress}`);\n console.log(` Since: ${overseer.createdAt}`);\n}\n```\n\n## Public Invite Preview\n\n```typescript\n// Get public info about an invite (no auth required)\nconst preview = await sdk.getOverseerInviteByCode('abc123...');\n\nconsole.log('Status:', preview.status);\nconsole.log('Description:', preview.description);\nconsole.log('Invited by:', preview.invitedBy.fullName);\nconsole.log('Expires:', preview.expiresAt);\n```\n\n## Revoking Access\n\n```typescript\n// Revoke an invite by ID\nawait sdk.revokeOverseerInvite(123);\nconsole.log('Invite revoked');\n\n// Revoke an overseer by wallet address\nawait sdk.revokeOverseer('eth|1234567890abcdef...');\nconsole.log('Overseer access revoked');\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createOverseerInvite(options?)` | Create magic link invite | Admin API key OR JWT (Overseer) |\n| `claimOverseerInvite(code)` | Claim invite with code | JWT |\n| `listOverseerInvites(options?)` | List all overseer invites | Admin API key OR JWT (Overseer) |\n| `getOverseerInviteByCode(code)` | Preview invite details | None (public) |\n| `revokeOverseerInvite(id)` | Revoke invite by ID | Admin API key OR JWT (Overseer) |\n| `listOverseers(options?)` | List all overseers | Admin API key OR JWT (Overseer) |\n| `revokeOverseer(address)` | Revoke overseer by address | Admin API key OR JWT (Overseer) |\n| `getMyOverseerStatus()` | Check own overseer status | JWT |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_overseer_invite`\n- `gala_launchpad_claim_overseer_invite`\n- `gala_launchpad_list_overseer_invites`\n- `gala_launchpad_get_overseer_invite`\n- `gala_launchpad_revoke_overseer_invite`\n- `gala_launchpad_list_overseers`\n- `gala_launchpad_revoke_overseer`\n- `gala_launchpad_get_my_overseer_status`\n- `gala_launchpad_get_overseer_summary`\n"
1789
- }
1790
- ]
1791
- },
1792
- {
1793
- "id": "content-flag-management-demo",
1794
- "title": "Example: Content flag management",
1795
- "topic": "content-flag-management",
1796
- "messages": [
1797
- {
1798
- "role": "user",
1799
- "content": "How do I manage content flags?"
1800
- },
1801
- {
1802
- "role": "assistant",
1803
- "content": "\n# Content Flag Management - SDK v5.11.0+\n\nContent moderation via flags and comments. Moderators can flag content for review,\ntake action on flags (delete content, ban users), and manage pool comments.\n\n## Content Types\n\nFlags can be created for:\n- `MESSAGE` - Chat messages\n- `COMMENT` - Pool comments\n- `STREAM` - Live streams (admin only)\n\n## Creating Content Flags\n\n```typescript\nimport { createLaunchpadSDK, CONTENT_TYPE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\nawait sdk.login();\n\n// Flag a chat message\nconst flag = await sdk.createFlag({\n tokenName: 'mytoken',\n contentType: CONTENT_TYPE.MESSAGE,\n contentId: 'msg-123',\n reason: 'Spam/harassment',\n});\n\nconsole.log('Flag ID:', flag.id);\nconsole.log('Status:', flag.status); // PENDING\n```\n\n## Listing Flags\n\n```typescript\n// List all pending flags for a token\nconst flags = await sdk.listFlags({\n tokenName: 'mytoken',\n status: 'PENDING',\n page: 1,\n limit: 20,\n});\n\nfor (const flag of flags.flags) {\n console.log(`Flag #${flag.id}: ${flag.contentType}`);\n console.log(` Reason: ${flag.reason}`);\n console.log(` Reporter: ${flag.reporterAddress}`);\n}\n```\n\n## Taking Action on Flags\n\n```typescript\n// Dismiss a flag (no action taken)\nawait sdk.dismissFlag(flagId);\n\n// Take action - delete content only\nawait sdk.actionFlag(flagId, {\n action: 'DELETE_CONTENT',\n});\n\n// Take action - ban the user\nawait sdk.actionFlag(flagId, {\n action: 'BAN_USER',\n banDuration: 3600, // 1 hour ban\n});\n\n// Take action - delete content AND ban user\nawait sdk.actionFlag(flagId, {\n action: 'DELETE_AND_BAN',\n banDuration: 86400, // 24 hour ban\n});\n```\n\n## Managing Pool Comments with Reactions\n\nComments include a `messageId` for reactions integration and optional `reactions` data.\n\n```typescript\n// Fetch comments for a pool (with reactions data)\nconst comments = await sdk.getComments({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n});\n\nfor (const comment of comments.comments) {\n console.log(`ID: ${comment.id}, MessageId: ${comment.messageId}`);\n console.log(`${comment.userAddress}: ${comment.content}`);\n\n // Check reactions on this comment\n if (comment.reactions) {\n console.log(`Total reactions: ${comment.reactions.totalCount}`);\n for (const reaction of comment.reactions.reactions) {\n console.log(` ${reaction.reactionType}: ${reaction.count} (you reacted: ${reaction.userReacted})`);\n }\n }\n}\n\n// Post a comment (requires JWT auth)\nawait sdk.login();\nconst newComment = await sdk.createComment({\n tokenName: 'mytoken',\n content: 'Great project! Looking forward to the launch.',\n});\nconsole.log('Comment messageId:', newComment.comment.messageId);\n\n// Add a reaction to a comment using its messageId\nawait sdk.addReaction({\n messageId: newComment.comment.messageId,\n reaction: '👍',\n});\n\n// Remove a reaction\nawait sdk.removeReaction({\n messageId: newComment.comment.messageId,\n reaction: '👍',\n});\n\n// Delete a comment (moderator only)\nawait sdk.deleteComment({ commentId: comment.id });\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createFlag(options)` | Flag content for review | JWT |\n| `listFlags(options)` | List flags for a token | API key OR JWT (Moderator) |\n| `dismissFlag(flagId)` | Dismiss flag (no action) | API key OR JWT (Moderator) |\n| `actionFlag(flagId, options)` | Take action on flag | API key OR JWT (Moderator) |\n| `getComments(options)` | Get pool comments with reactions | None (public) |\n| `createComment(options)` | Post a comment, returns messageId | JWT |\n| `deleteComment(options)` | Delete a comment | API key OR JWT (Moderator) |\n| `addReaction(options)` | Add reaction to comment/message | JWT |\n| `removeReaction(options)` | Remove reaction from comment/message | JWT |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_flag`\n- `gala_launchpad_list_flags`\n- `gala_launchpad_dismiss_flag`\n- `gala_launchpad_action_flag`\n- `gala_launchpad_fetch_comments`\n- `gala_launchpad_post_comment`\n- `gala_launchpad_delete_comment`\n- `gala_launchpad_add_reaction`\n- `gala_launchpad_remove_reaction`\n"
1804
- }
1805
- ]
1806
- },
1807
- {
1808
- "id": "content-reactions-demo",
1809
- "title": "Example: Content reactions",
1810
- "topic": "content-reactions",
1811
- "messages": [
1812
- {
1813
- "role": "user",
1814
- "content": "How do I manage content reactions?"
1815
- },
1816
- {
1817
- "role": "assistant",
1818
- "content": "Learn about Content reactions"
1819
- }
1820
- ]
1821
- },
1822
- {
1823
- "id": "trade-history-demo",
1824
- "title": "Example: Trade history",
1825
- "topic": "trade-history",
1826
- "messages": [
1827
- {
1828
- "role": "user",
1829
- "content": "How do I view trading history?"
1830
- },
1831
- {
1832
- "role": "assistant",
1833
- "content": "\n## Trade History\n\nQuery and analyze trading activity for tokens.\n\n### Basic Usage\n\n```typescript\nimport { LaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = new LaunchpadSDK({ environment: 'production' });\n\n// Get recent trades for a token\nconst result = await sdk.getTrades({\n tokenName: 'anime',\n limit: 10,\n page: 1\n});\n\nconsole.log(`Found ${result.trades.length} trades`);\nfor (const trade of result.trades) {\n console.log(`${trade.txnType}: ${trade.inputAmount} → ${trade.outputAmount}`);\n}\n```\n\n### Filter by Trade Type\n\n```typescript\n// Get only buy orders\nconst buyTrades = await sdk.getTrades({\n tokenName: 'anime',\n txnType: 'BUY',\n limit: 50\n});\n\n// Get only sell orders\nconst sellTrades = await sdk.getTrades({\n tokenName: 'anime',\n txnType: 'SELL',\n limit: 50\n});\n```\n\n### Date Range Queries\n\n```typescript\nconst oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);\nconst now = new Date();\n\nconst recentTrades = await sdk.getTrades({\n tokenName: 'anime',\n startDate: oneWeekAgo,\n endDate: now,\n limit: 50\n});\n```\n\n### Filter by User\n\n```typescript\n// Get trades for a specific wallet\nconst userTrades = await sdk.getTrades({\n tokenName: 'anime',\n userAddress: 'eth|0x1234...',\n limit: 20\n});\n```\n\n### Pagination\n\n```typescript\n// Paginate through all trades\nlet page = 1;\nlet hasMore = true;\n\nwhile (hasMore) {\n const result = await sdk.getTrades({ tokenName: 'anime', page, limit: 50 });\n console.log(`Page ${page}: ${result.trades.length} trades`);\n\n hasMore = result.trades.length === 50;\n page++;\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_trades`\n"
1834
- }
1835
- ]
1836
- },
1837
- {
1838
- "id": "token-ban-management-demo",
1839
- "title": "Example: Token ban management",
1840
- "topic": "token-ban-management",
1841
- "messages": [
1842
- {
1843
- "role": "user",
1844
- "content": "How do I manage token bans?"
1845
- },
1846
- {
1847
- "role": "assistant",
1848
- "content": "\n# Token Ban Management - SDK v6.x.0+\n\nPlatform-wide token ban operations for overseers. Banned tokens are hidden from ALL listings\nand have actions (comments, streaming, chat) blocked. This is different from user bans which\nonly affect specific users on specific tokens.\n\n**Access Control:** All methods require either:\n- streamAdminApiKey (server-to-server)\n- JWT with overseer status (authenticated overseer user)\n\n**Effects of Token Bans:**\n- Hidden from ALL pool listings (including creator's profile)\n- Comments blocked on banned tokens\n- Live streaming blocked on banned tokens\n- Chat messages blocked on banned tokens\n- Trading NOT blocked (GalaChain handles trading independently)\n\n## Banning a Token\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\n// Using Admin API key\nconst sdk = createLaunchpadSDK({\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,\n});\n\n// Or using JWT auth (must be an overseer)\nconst sdkWithAuth = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\nawait sdkWithAuth.login({ walletAddress: 'eth|0x...' });\n\n// Ban a token with reason\nconst result = await sdk.banToken({\n tokenName: 'scamtoken',\n reason: 'Fraudulent project - reported by multiple users',\n});\nconsole.log('Token banned:', result.tokenName);\nconsole.log('Ban ID:', result.ban.id);\nconsole.log('Banned by:', result.ban.bannedBy);\n\n// Ban without reason (optional)\nawait sdk.banToken({ tokenName: 'problematictoken' });\n```\n\n## Unbanning a Token\n\n```typescript\n// Remove a token ban\nconst result = await sdk.unbanToken({ tokenName: 'scamtoken' });\nconsole.log('Ban removed:', result.removed); // true\nconsole.log('Token:', result.tokenName);\n\n// Token is now:\n// - Visible in pool listings again\n// - Comments re-enabled\n// - Live streaming re-enabled\n// - Chat re-enabled\n```\n\n## Checking Token Ban Status\n\n```typescript\n// Check if a specific token is banned\nconst status = await sdk.isTokenBanned({ tokenName: 'sometoken' });\n\nif (status.banned) {\n console.log('Token is banned!');\n console.log('Reason:', status.ban?.reason);\n console.log('Banned by:', status.ban?.bannedBy);\n console.log('Banned at:', status.ban?.createdAt);\n} else {\n console.log('Token is not banned');\n}\n\n// getTokenBan is an alias - use whichever is more readable\nconst details = await sdk.getTokenBan({ tokenName: 'sometoken' });\n```\n\n## Listing All Banned Tokens\n\n```typescript\n// Get first page with default limit (20)\nconst page1 = await sdk.listTokenBans({});\nconsole.log('Total banned tokens:', page1.meta.total);\n\nfor (const ban of page1.items) {\n console.log(`- ${ban.tokenName}: ${ban.reason || 'No reason'}`);\n console.log(` Banned by: ${ban.bannedBy}`);\n console.log(` Date: ${ban.createdAt}`);\n}\n\n// Search for specific tokens (partial match, case-insensitive)\nconst searchResults = await sdk.listTokenBans({\n search: 'scam',\n page: 1,\n limit: 10,\n});\n\n// Paginate through all banned tokens\nlet page = 1;\nlet hasMore = true;\nwhile (hasMore) {\n const results = await sdk.listTokenBans({ page, limit: 20 });\n console.log(`Page ${page}: ${results.items.length} bans`);\n for (const ban of results.items) {\n console.log(` - ${ban.tokenName}`);\n }\n hasMore = page < results.meta.totalPages;\n page++;\n}\n```\n\n## Important Notes\n\n1. **Permanent Bans Only**: Token bans do not expire. They remain in effect until\n explicitly removed by an overseer.\n\n2. **Case Normalization**: Token names are automatically normalized to lowercase\n in all requests and responses.\n\n3. **Idempotency**: Banning an already-banned token returns a 409 Conflict error.\n Unbanning a non-banned token returns a 404 Not Found error.\n\n4. **Trading Continues**: Token bans do NOT stop trading on GalaChain. The\n launchpad hides visibility and blocks social features only.\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_ban_token`\n- `gala_launchpad_unban_token`\n- `gala_launchpad_list_token_bans`\n- `gala_launchpad_get_token_ban`\n- `gala_launchpad_is_token_banned`\n"
1849
- }
1850
- ]
1851
- },
1852
- {
1853
- "id": "nft-collection-management-demo",
1854
- "title": "Example: Nft collection management",
1855
- "topic": "nft-collection-management",
1856
- "messages": [
1857
- {
1858
- "role": "user",
1859
- "content": "How do I nft collection management?"
1860
- },
1861
- {
1862
- "role": "assistant",
1863
- "content": "\n# NFT Collection Management - SDK v5.12.0+\n\nCreate and manage NFT collections, token classes, and mint NFTs on GalaChain.\n\n**Key Concepts:**\n- **Collection**: A named grouping for NFT token classes (claimed for 10,000 GALA)\n- **Token Class**: A specific type/rarity within a collection (created for 1,000 GALA)\n- **NFT Instance**: Individual NFT minted from a token class (dynamic fee based on quantity)\n\n## Check Collection Availability\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({ privateKey: 'your-private-key' });\n\n// Check if a collection name is available\nconst available = await sdk.isNftCollectionAvailable('MyEpicNFTs');\nconsole.log('Collection available:', available);\n\n// Get fee for claiming a collection\nconst claimFee = await sdk.getNftCollectionClaimFee();\nconsole.log('Claim fee:', claimFee); // Usually \"10000\" GALA\n```\n\n## Claim a Collection\n\n```typescript\n// Claim an available collection name\nconst result = await sdk.claimNftCollection({\n collectionName: 'MyEpicNFTs',\n description: 'Epic NFT collection for gaming',\n});\nconsole.log('Collection claimed:', result.collectionName);\nconsole.log('Transaction ID:', result.transactionId);\n\n// Fetch your owned collections\nconst collections = await sdk.fetchNftCollections(walletAddress);\nfor (const collection of collections) {\n console.log(`Collection: ${collection.collectionName}`);\n console.log(` Status: ${collection.status}`);\n}\n```\n\n## Create Token Classes (Rarities)\n\n```typescript\n// Get fee for creating a token class\nconst classCreateFee = await sdk.getNftTokenClassCreateFee();\nconsole.log('Create fee:', classCreateFee); // Usually \"1000\" GALA\n\n// Create a token class (rarity tier)\nconst classResult = await sdk.createNftTokenClass({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n description: 'Ultra-rare legendary wizard NFTs',\n maximumSupply: '100', // Max NFTs of this type\n data: {\n rarity: 'legendary',\n class: 'wizard',\n power: '9000',\n },\n});\nconsole.log('Token class created:', classResult.tokenClassName);\n\n// Fetch token classes for your collection\nconst classes = await sdk.fetchNftTokenClasses({\n collectionName: 'MyEpicNFTs',\n});\nfor (const tokenClass of classes) {\n console.log(`Class: ${tokenClass.tokenClassName}`);\n console.log(` Current Supply: ${tokenClass.currentSupply}/${tokenClass.maxSupply}`);\n}\n```\n\n## Estimate Mint Fees\n\n```typescript\n// Estimate fee for minting multiple NFTs\nconst mintFeeEstimate = await sdk.estimateNftMintFee({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n quantity: 5,\n});\nconsole.log('Estimated mint fee:', mintFeeEstimate); // Dynamic fee in GALA\n\n// Estimate multiple operations at once\nconst bundleFee = await sdk.estimateNftOperationFees({\n operations: [\n { type: 'claim_collection' },\n { type: 'create_token_class', collectionName: 'MyEpicNFTs' },\n { type: 'mint', quantity: 10 },\n ],\n});\nconsole.log('Total bundle fee:', bundleFee.totalFee);\nfor (const op of bundleFee.breakdown) {\n console.log(` ${op.operationType}: ${op.fee}`);\n}\n```\n\n## Mint NFTs\n\n```typescript\n// Mint NFT instances from a token class\nconst mintResult = await sdk.mintNft({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n quantity: 5,\n to: 'eth|0x...', // Recipient wallet\n metadata: {\n attributes: [\n { name: 'level', value: '50' },\n { name: 'element', value: 'fire' },\n ],\n },\n});\nconsole.log('Minted:', mintResult.quantityMinted);\nconsole.log('Transaction ID:', mintResult.transactionId);\n\n// Check NFT balances\nconst balances = await sdk.fetchNftBalances(walletAddress);\nfor (const balance of balances) {\n console.log(`${balance.collectionName}/${balance.tokenClassName}: ${balance.quantity}`);\n}\n\n// Filter by collection\nconst collectionBalances = await sdk.fetchNftBalances(walletAddress, 'MyEpicNFTs');\n```\n\n## Complete Workflow\n\n```typescript\n// 1. Check availability\nconst available = await sdk.isNftCollectionAvailable('MyEpicNFTs');\nif (!available) throw new Error('Collection name taken');\n\n// 2. Claim collection (10,000 GALA)\nconst claimResult = await sdk.claimNftCollection({\n collectionName: 'MyEpicNFTs',\n description: 'My epic NFT collection',\n});\nconsole.log('✓ Collection claimed');\n\n// 3. Create token class (1,000 GALA)\nconst classResult = await sdk.createNftTokenClass({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n description: 'Legendary tier NFTs',\n maximumSupply: '1000',\n});\nconsole.log('✓ Token class created');\n\n// 4. Estimate mint fee\nconst fee = await sdk.estimateNftMintFee({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n quantity: 100,\n});\nconsole.log(`✓ Mint fee: ${fee} GALA`);\n\n// 5. Mint NFTs\nconst mintResult = await sdk.mintNft({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n quantity: 100,\n to: userWallet,\n});\nconsole.log('✓ Minted:', mintResult.quantityMinted);\n\n// 6. Verify ownership\nconst balances = await sdk.fetchNftBalances(userWallet, 'MyEpicNFTs');\nconsole.log('Total NFTs:', balances.reduce((sum, b) => sum + parseInt(b.quantity), 0));\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_nft_collection_claim_fee`\n- `gala_launchpad_get_nft_token_class_create_fee`\n- `gala_launchpad_estimate_nft_mint_fee`\n- `gala_launchpad_estimate_nft_operation_fees`\n- `gala_launchpad_check_nft_collection_available`\n- `gala_launchpad_claim_nft_collection`\n- `gala_launchpad_fetch_nft_collections`\n- `gala_launchpad_create_nft_token_class`\n- `gala_launchpad_fetch_nft_token_classes`\n- `gala_launchpad_mint_nft`\n- `gala_launchpad_fetch_nft_balances`\n"
1864
- }
1865
- ]
1866
- }
1867
- ],
1868
- "demoConversations": [
1869
- {
1870
- "topicKey": "api-key-management",
1871
- "label": "Api key management",
1872
- "category": "api-keys",
1873
- "description": "API key management",
1874
- "methodCount": 6,
1875
- "exchanges": [
1876
- {
1877
- "userQuestion": "How do I manage API keys?",
1878
- "assistantResponse": "\n# API Key Management - SDK v5.6.0+\n\nUser-managed API keys with role-based permissions for delegating token management\nauthority to third-party services or automated systems.\n\n**CRITICAL**: Raw API keys are ONLY shown once at creation time. Store them\nsecurely immediately - they cannot be retrieved again.\n\n## Creating API Keys\n\n```typescript\nimport { createLaunchpadSDK, API_KEY_ROLE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\n// MUST authenticate first\nawait sdk.login();\n\n// Create a moderator key for specific tokens\nconst result = await sdk.createApiKey({\n role: API_KEY_ROLE.MODERATOR,\n description: 'Chat moderation bot',\n delegateAllTokens: false,\n tokenNames: ['mytoken', 'othertoken'],\n expiresAt: '2025-12-31T23:59:59Z', // Optional expiration\n});\n\n// CRITICAL: Save this immediately - shown only once!\nconsole.log('Raw Key:', result.rawKey);\n// Format: glp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nconsole.log('Key ID:', result.id);\nconsole.log('Prefix:', result.keyPrefix);\n```\n\n## Role Hierarchy\n\n```typescript\nimport { API_KEY_ROLE, API_KEY_ROLE_HIERARCHY } from '@gala-chain/launchpad-sdk';\n\n// Available roles (hierarchical)\nAPI_KEY_ROLE.MODERATOR // Chat, comments, bans\nAPI_KEY_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start\nAPI_KEY_ROLE.MANAGER // Moderator + Technical Producer + recordings\nAPI_KEY_ROLE.OWNER // Full access (indistinguishable from normal auth)\n\n// Role hierarchy levels\nAPI_KEY_ROLE_HIERARCHY.MODERATOR // 1\nAPI_KEY_ROLE_HIERARCHY.TECHNICAL_PRODUCER // 1\nAPI_KEY_ROLE_HIERARCHY.MANAGER // 2\nAPI_KEY_ROLE_HIERARCHY.OWNER // 3\n\n// Check if role has sufficient permission\nimport { roleHasSufficientPermission } from '@gala-chain/launchpad-sdk';\n\nconst canManage = roleHasSufficientPermission('MANAGER', 'MODERATOR'); // true\nconst canOwn = roleHasSufficientPermission('MODERATOR', 'OWNER'); // false\n```\n\n## Token Delegation\n\n```typescript\n// Delegate all tokens (current and future)\nconst allTokensKey = await sdk.createApiKey({\n role: API_KEY_ROLE.MODERATOR,\n description: 'All tokens moderator',\n delegateAllTokens: true,\n});\n\n// Delegate specific tokens only\nconst specificKey = await sdk.createApiKey({\n role: API_KEY_ROLE.MANAGER,\n description: 'Project manager for specific tokens',\n delegateAllTokens: false,\n tokenNames: ['token1', 'token2', 'token3'], // Case-insensitive\n});\n```\n\n## Listing and Getting API Keys\n\n```typescript\n// List all API keys (paginated)\nconst list = await sdk.listApiKeys({\n page: 1,\n limit: 20,\n});\nconsole.log('Total keys:', list.meta.total);\n\nfor (const key of list.apiKeys) {\n console.log(`- ${key.keyPrefix}: ${key.role}`);\n console.log(` Description: ${key.description || 'None'}`);\n console.log(` Last used: ${key.lastUsedAt || 'Never'}`);\n console.log(` Expires: ${key.expiresAt || 'Never'}`);\n}\n\n// Get single API key by ID\nconst key = await sdk.getApiKey(123);\nconsole.log('Key details:', key);\n```\n\n## Updating API Keys\n\n```typescript\n// Update description\nconst updated = await sdk.updateApiKey(123, {\n description: 'Updated description',\n});\n\n// Upgrade role\nawait sdk.updateApiKey(123, {\n role: API_KEY_ROLE.MANAGER,\n});\n\n// Change token delegation\nawait sdk.updateApiKey(123, {\n delegateAllTokens: true,\n});\n\n// Update specific token access (replaces existing)\nawait sdk.updateApiKey(123, {\n delegateAllTokens: false,\n tokenNames: ['newtoken1', 'newtoken2'],\n});\n\n// Update expiration (null to remove)\nawait sdk.updateApiKey(123, {\n expiresAt: '2026-12-31T23:59:59Z',\n});\n\n// Remove expiration\nawait sdk.updateApiKey(123, {\n expiresAt: null,\n});\n```\n\n## Revoking API Keys\n\n```typescript\n// Revoke (soft delete) an API key\nawait sdk.revokeApiKey(123);\nconsole.log('API key revoked');\n\n// Key is now unusable - attempts to use it will fail with 401\n```\n\n## Getting Available Roles\n\n```typescript\n// Get list of valid roles\nconst roles = sdk.getApiKeyRoles();\nconsole.log('Available roles:', roles);\n// ['MODERATOR', 'TECHNICAL_PRODUCER', 'MANAGER', 'OWNER']\n```\n\n## Validation Helpers\n\n```typescript\nimport {\n isValidApiKeyRole,\n validateCreateApiKeyOptions,\n validateUpdateApiKeyOptions,\n} from '@gala-chain/launchpad-sdk';\n\n// Validate role string\nif (isValidApiKeyRole('MODERATOR')) {\n console.log('Valid role');\n}\n\n// Validate creation options\nconst createErrors = validateCreateApiKeyOptions({\n role: 'MODERATOR',\n description: 'Test key',\n});\nif (createErrors.length > 0) {\n console.error('Validation errors:', createErrors);\n}\n\n// Validate update options\nconst updateErrors = validateUpdateApiKeyOptions({\n role: 'MANAGER',\n expiresAt: '2025-12-31T23:59:59Z',\n});\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createApiKey(options)` | Create new API key | JWT |\n| `listApiKeys(options?)` | List API keys (paginated) | JWT |\n| `getApiKey(id)` | Get API key by ID | JWT |\n| `updateApiKey(id, options)` | Update API key | JWT |\n| `revokeApiKey(id)` | Revoke (soft delete) key | JWT |\n| `getApiKeyRoles()` | Get valid role list | None |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_api_key`\n- `gala_launchpad_list_api_keys`\n- `gala_launchpad_get_api_key`\n- `gala_launchpad_update_api_key`\n- `gala_launchpad_revoke_api_key`\n- `gala_launchpad_get_api_key_roles`\n"
1879
- },
1880
- {
1881
- "userQuestion": "What parameters does createApiKey() accept?",
1882
- "assistantResponse": "The primary methods for Api key management are `createApiKey()`, `listApiKeys()`, `getApiKey()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
1883
- },
1884
- {
1885
- "userQuestion": "What are best practices for manage API keys?",
1886
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
1887
- },
1888
- {
1889
- "userQuestion": "What errors should I handle when manage API keys?",
1890
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.apikeymanagement(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
1891
- },
1892
- {
1893
- "userQuestion": "Can you walk me through a complete manage API keys example?",
1894
- "assistantResponse": "**Complete Workflow: Api key management**\n\nHere's the typical flow: `createApiKey()` → `listApiKeys()` → `getApiKey()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
1895
- },
1896
- {
1897
- "userQuestion": "What other methods are available for Api key management?",
1898
- "assistantResponse": "**Additional Methods:**\n\n- `updateApiKey()`\n- `revokeApiKey()`\n- `getApiKeyRoles()`\n\n**Total methods in this topic:** 6\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
1899
- },
1900
- {
1901
- "userQuestion": "When would I actually use manage API keys in a real application?",
1902
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Backend Services**: Server-to-server authentication\n2. **Rate Limiting**: Separate keys for different services\n3. **Access Control**: Role-based permissions per key\n4. **Key Rotation**: Regular security key updates"
1903
- },
1904
- {
1905
- "userQuestion": "What should I learn next after manage API keys?",
1906
- "assistantResponse": "**Related Topics:**\n\n- **Session auth**: `explainSdkUsage({ topic: 'session-auth' })`\n- **Profile management**: `explainSdkUsage({ topic: 'profile-management' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
1907
- }
1908
- ]
1909
- },
1910
- {
1911
- "topicKey": "session-auth",
1912
- "label": "Session auth",
1913
- "category": "auth",
1914
- "description": "JWT session authentication",
1915
- "methodCount": 8,
1916
- "exchanges": [
1917
- {
1918
- "userQuestion": "How do I manage JWT authentication?",
1919
- "assistantResponse": "\n# Session Authentication (JWT) - SDK v5.1.0+\n\nJWT-based session authentication for protected operations (streaming, chat, profile updates).\n\n## Authentication Flow\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n environment: 'production',\n});\n\n// 1. Login to get JWT token\nconst session = await sdk.login();\nconsole.log('Authenticated:', session.address);\nconsole.log('Token expires in:', session.expiresIn, 'seconds');\n\n// 2. Check authentication status\nif (sdk.isAuthenticated()) {\n console.log('Session is valid');\n}\n\n// 3. Get current session info\nconst info = await sdk.getSession();\nconsole.log('Session issued at:', info.issuedAt);\nconsole.log('Session expires at:', info.expiresAt);\n\n// 4. Access token directly (for custom requests)\nconst token = sdk.getAccessToken();\nconsole.log('JWT token:', token);\n\n// 5. Refresh token before expiry\nif (sdk.shouldRefreshToken()) {\n const refreshed = await sdk.refreshToken();\n console.log('Token refreshed, new expiry:', refreshed.expiresIn);\n}\n\n// 6. Ensure valid token (auto-refreshes if needed)\nconst validToken = await sdk.ensureValidToken();\nconsole.log('Valid token obtained');\n\n// 7. Logout when done\nsdk.logout();\nconsole.log('Logged out');\n```\n\n## Auto-Refresh Behavior\n\nThe SDK automatically refreshes tokens when:\n- Token expires within 5 minutes (default threshold)\n- Making requests to JWT-protected endpoints\n\n```typescript\n// Manual refresh threshold check\nconst shouldRefresh = sdk.shouldRefreshToken(10 * 60 * 1000); // 10 min threshold\n\n// ensureValidToken auto-refreshes if needed\nconst token = await sdk.ensureValidToken(5 * 60 * 1000); // 5 min threshold\n```\n\n## Protected Endpoints\n\nThese operations require JWT authentication (call \\`login()\\` first):\n\n**Streaming:**\n- \\`startStream()\\` - Start live stream\n- \\`resetStreamKey()\\` - Reset RTMP key\n- \\`getRecordingDownload()\\` - Download recordings\n- \\`deleteRecording()\\` - Delete recordings\n- \\`addSimulcastTarget()\\` - Add simulcast\n- \\`removeSimulcastTarget()\\` - Remove simulcast\n\n**Chat:**\n- \\`sendChatMessage()\\` - Send chat messages\n\n**Profile:**\n- \\`updateProfile()\\` - Update user profile\n\n**Uploads:**\n- \\`uploadTokenImage()\\` - Upload token images\n- \\`uploadProfileImage()\\` - Upload profile images\n\n## Error Handling\n\n```typescript\ntry {\n await sdk.login();\n} catch (error) {\n if (error.message.includes('signature')) {\n console.error('Wallet signature failed');\n } else if (error.message.includes('network')) {\n console.error('Network error during login');\n }\n}\n\n// Check auth before protected operations\nif (!sdk.isAuthenticated()) {\n await sdk.login();\n}\n\ntry {\n await sdk.startStream('mytoken');\n} catch (error) {\n if (error.message.includes('JWT') || error.message.includes('token')) {\n // Re-authenticate and retry\n await sdk.login();\n await sdk.startStream('mytoken');\n }\n}\n```\n\n## Session Methods Reference\n\n| Method | Description | Returns |\n|--------|-------------|---------|\n| \\`login()\\` | Authenticate with wallet signature | \\`{ accessToken, expiresIn, address }\\` |\n| \\`logout()\\` | Clear JWT token (client-side) | \\`void\\` |\n| \\`refreshToken()\\` | Get new JWT token | \\`{ accessToken, expiresIn, address }\\` |\n| \\`getSession()\\` | Get session info | \\`{ address, issuedAt, expiresAt }\\` |\n| \\`isAuthenticated()\\` | Check if token exists and valid | \\`boolean\\` |\n| \\`shouldRefreshToken(threshold?)\\` | Check if refresh needed | \\`boolean\\` |\n| \\`getAccessToken()\\` | Get raw JWT token | \\`string | null\\` |\n| \\`ensureValidToken(threshold?)\\` | Auto-refresh if needed | \\`Promise<string>\\` |\n\n## Dev Bypass (STAGE Only)\n\nFor testing in STAGE environment without JWT:\n\n```typescript\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n environment: 'development',\n devBypass: true, // Skip JWT auth in STAGE\n});\n\n// Protected methods work without login() in STAGE\nawait sdk.startStream('testtoken');\n```\n\n**Note:** Dev bypass only works in STAGE/development environments.\n"
1920
- },
1921
- {
1922
- "userQuestion": "What parameters does login() accept?",
1923
- "assistantResponse": "The primary methods for Session auth are `login()`, `logout()`, `refreshToken()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
1924
- },
1925
- {
1926
- "userQuestion": "What are best practices for manage JWT authentication?",
1927
- "assistantResponse": "1. **Refresh tokens proactively**: Use `shouldRefreshToken()` to check before expiration.\n2. **Handle logout gracefully**: Clear local state when session ends.\n3. **Secure token storage**: Never expose tokens in client-side code."
1928
- },
1929
- {
1930
- "userQuestion": "What errors should I handle when manage JWT authentication?",
1931
- "assistantResponse": "**Common Errors:**\n- `TokenExpired`: JWT expired - call `refreshToken()`\n- `InvalidSignature`: Wallet signature failed\n- `SessionNotFound`: Not logged in - call `login()` first\n\n**Pattern:** Use `ensureValidToken()` before authenticated calls."
1932
- },
1933
- {
1934
- "userQuestion": "Can you walk me through a complete manage JWT authentication example?",
1935
- "assistantResponse": "**Complete Workflow: Session auth**\n\nHere's the typical flow: `login()` → `logout()` → `refreshToken()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
1936
- },
1937
- {
1938
- "userQuestion": "What edge cases should I know about for manage JWT authentication?",
1939
- "assistantResponse": "**Edge Cases:**\n1. **Token refresh race**: Multiple tabs can cause refresh conflicts\n2. **Wallet switching**: Changing wallets requires new login\n3. **Session persistence**: Tokens stored in memory by default\n\n**Gotcha:** `shouldRefreshToken()` checks remaining time - refresh before expiration!"
1940
- },
1941
- {
1942
- "userQuestion": "What other methods are available for Session auth?",
1943
- "assistantResponse": "**Additional Methods:**\n\n- `getSession()`\n- `isAuthenticated()`\n- `shouldRefreshToken()`\n- `getAccessToken()`\n\n**Total methods in this topic:** 8\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
1944
- },
1945
- {
1946
- "userQuestion": "When would I actually use manage JWT authentication in a real application?",
1947
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Web Apps**: Authenticate users for full SDK access\n2. **Bot Authentication**: Automated services needing auth\n3. **Multi-Tenant Apps**: Per-user session management\n4. **Mobile Apps**: Persistent authenticated sessions"
1948
- },
1949
- {
1950
- "userQuestion": "What should I learn next after manage JWT authentication?",
1951
- "assistantResponse": "**Related Topics:**\n\n- **Api key management**: `explainSdkUsage({ topic: 'api-key-management' })`\n- **Profile management**: `explainSdkUsage({ topic: 'profile-management' })`\n- **Streaming**: `explainSdkUsage({ topic: 'streaming' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
1952
- }
1953
- ]
1954
- },
1955
- {
1956
- "topicKey": "account-management",
1957
- "label": "Account management",
1958
- "category": "balance",
1959
- "description": "Balance queries and portfolio management",
1960
- "methodCount": 1,
1961
- "exchanges": [
1962
- {
1963
- "userQuestion": "How do I manage your account?",
1964
- "assistantResponse": "\n# Account Management\n\nThe SDK provides methods for account registration and management.\n\n## Register Account\n\nRegister an account for trading on Gala. This should be called before the first purchase\nto ensure the wallet is ready for trading operations.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function registerAccount() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Register the SDK wallet\n const result = await sdk.registerAccount();\n console.log('Account exists:', result.exists);\n console.log('Wallet alias:', result.walletAlias);\n\n // Register a specific address\n const otherResult = await sdk.registerAccount({\n address: '0x1234...' // Supports eth|, 0x, or client| formats\n });\n console.log('Other account exists:', otherResult.exists);\n}\n```\n\n**Response Structure:**\n```typescript\ninterface RegisterAccountResult {\n exists: boolean; // Whether account is registered\n walletAlias: string; // Normalized wallet alias (client|...)\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_register_account`\n"
1965
- },
1966
- {
1967
- "userQuestion": "What parameters does registerAccount() accept?",
1968
- "assistantResponse": "The primary methods for Account management are `registerAccount()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
1969
- },
1970
- {
1971
- "userQuestion": "What are best practices for manage your account?",
1972
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
1973
- },
1974
- {
1975
- "userQuestion": "What should I learn next after manage your account?",
1976
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
1977
- },
1978
- {
1979
- "userQuestion": "Any final tips for manage your account?",
1980
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
1981
- }
1982
- ]
1983
- },
1984
- {
1985
- "topicKey": "balances",
1986
- "label": "Balances",
1987
- "category": "balance",
1988
- "description": "Balance queries and portfolio management",
1989
- "methodCount": 5,
1990
- "exchanges": [
1991
- {
1992
- "userQuestion": "How do I check token balances?",
1993
- "assistantResponse": "\n## Checking Balances with SDK\n\n**Covers Methods:**\n- `fetchGalaBalance()`\n- `fetchTokenBalance()`\n- `fetchTokensHeld()`\n- `fetchTokensCreated()`\n- `fetchProfile()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function checkBalances() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Check GALA balance\n const galaBalance = await sdk.fetchGalaBalance();\n console.log(`GALA: ${galaBalance.balance}`);\n console.log(`Decimals: ${galaBalance.decimals}`);\n console.log(`Last updated: ${galaBalance.lastUpdated.toISOString()}`);\n\n // Check specific token balance\n const tokenBalance = await sdk.fetchTokenBalance({\n tokenName: 'dragnrkti',\n address: sdk.getAddress()\n });\n\n console.log(`Token: ${tokenBalance.quantity}`);\n console.log(`USD value: $${tokenBalance.holdingPriceUsd}`);\n console.log(`GALA value: ${tokenBalance.holdingPriceGala}`);\n\n // Check all tokens held\n const portfolio = await sdk.fetchTokensHeld({\n address: sdk.getAddress(),\n limit: 20\n });\n\n console.log(`Holding ${portfolio.total} different tokens`);\n portfolio.tokens.forEach(token => {\n console.log(`${token.name}: ${token.quantity}`);\n });\n\n // Check tokens created by this wallet\n const createdTokens = await sdk.fetchTokensCreated({\n address: sdk.getAddress(),\n limit: 10\n });\n\n console.log(`Created ${createdTokens.total} tokens`);\n createdTokens.tokens.forEach(token => {\n console.log(` ${token.symbol}: ${token.name}`);\n });\n\n // Get user profile\n const profile = await sdk.fetchProfile();\n console.log(`Profile: ${profile.fullName}`);\n\n // Check profile of another user\n const otherProfile = await sdk.fetchProfile('eth|0x...');\n console.log(`Other user: ${otherProfile.fullName}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_gala_balance`\n- `gala_launchpad_fetch_token_balance`\n- `gala_launchpad_fetch_tokens_held`\n- `gala_launchpad_fetch_tokens_created`\n- `gala_launchpad_fetch_profile`\n- `gala_launchpad_fetch_available_balance`\n- `gala_launchpad_fetch_locked_tokens`\n\n### Available vs Locked Balance\n\n```typescript\n// Get available balance (excludes locked/escrowed tokens)\nconst available = await sdk.fetchAvailableBalance({\n tokenName: 'anime',\n address: walletAddress\n});\n\n// Get locked tokens with details\nconst locked = await sdk.fetchLockedTokens({\n tokenName: 'anime',\n address: walletAddress\n});\n\nconsole.log('Available:', available.quantity);\nconsole.log('Locked:', locked.lockedQuantity);\n```\n"
1994
- },
1995
- {
1996
- "userQuestion": "What parameters does fetchGalaBalance() accept?",
1997
- "assistantResponse": "The primary methods for Balances are `fetchGalaBalance()`, `fetchTokenBalance()`, `fetchTokensHeld()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
1998
- },
1999
- {
2000
- "userQuestion": "What are best practices for check token balances?",
2001
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2002
- },
2003
- {
2004
- "userQuestion": "Can you walk me through a complete check token balances example?",
2005
- "assistantResponse": "**Complete Workflow: Balances**\n\nHere's the typical flow: `fetchGalaBalance()` → `fetchTokenBalance()` → `fetchTokensHeld()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2006
- },
2007
- {
2008
- "userQuestion": "What other methods are available for Balances?",
2009
- "assistantResponse": "**Additional Methods:**\n\n- `fetchTokensCreated()`\n- `fetchAvailableBalance()`\n\n**Total methods in this topic:** 5\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2010
- },
2011
- {
2012
- "userQuestion": "What should I learn next after check token balances?",
2013
- "assistantResponse": "**Related Topics:**\n\n- **Transfers**: `explainSdkUsage({ topic: 'transfers' })`\n- **Locks**: `explainSdkUsage({ topic: 'locks' })`\n- **Fetch pools**: `explainSdkUsage({ topic: 'fetch-pools' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2014
- }
2015
- ]
2016
- },
2017
- {
2018
- "topicKey": "profile-management",
2019
- "label": "Profile management",
2020
- "category": "balance",
2021
- "description": "Balance queries and portfolio management",
2022
- "methodCount": 4,
2023
- "exchanges": [
2024
- {
2025
- "userQuestion": "How do I manage user profiles?",
2026
- "assistantResponse": "\n## User Profile Management with SDK\n\n**Covers Methods:**\n- `fetchProfile()`\n- `updateProfile()`\n- `uploadProfileImage()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageUserProfiles() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Fetch current user profile\n const myProfile = await sdk.fetchProfile();\n console.log(`Name: ${myProfile.fullName}`);\n console.log(`Avatar: ${myProfile.profileImage}`);\n\n // Fetch another user's profile\n const other = await sdk.fetchProfile('eth|0x...');\n console.log(`Other user: ${other.fullName}`);\n\n // Update profile\n const updated = await sdk.updateProfile({\n fullName: 'Satoshi Nakamoto',\n profileImage: 'https://example.com/avatar.png',\n address: sdk.getAddress()\n });\n\n console.log(`Updated: ${updated.fullName}`);\n\n // Upload profile image (Node.js only)\n const imgResult = await sdk.uploadProfileImage({\n imagePath: '/path/to/avatar.png'\n });\n\n // Update with uploaded image\n await sdk.updateProfile({\n fullName: 'My Name',\n profileImage: imgResult.imageUrl,\n address: sdk.getAddress()\n });\n\n // Complete workflow: Update profile, then launch token\n async function createTokenWithProfile() {\n const avatar = await sdk.uploadProfileImage({\n imagePath: '/path/to/pic.png'\n });\n\n await sdk.updateProfile({\n fullName: 'Token Creator',\n profileImage: avatar.imageUrl,\n address: sdk.getAddress()\n });\n\n const logo = await sdk.uploadTokenImage({\n tokenName: 'mytoken',\n imagePath: '/path/to/logo.png'\n });\n\n const result = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'Awesome token',\n tokenImage: logo.imageUrl,\n websiteUrl: 'https://mytoken.com'\n });\n\n return result;\n }\n\n // Batch profile fetching\n const addresses = ['eth|0xaddress1', 'eth|0xaddress2'];\n const profiles = await Promise.all(\n addresses.map(addr => sdk.fetchProfile(addr).catch(() => null))\n );\n\n console.log('Profiles:', profiles.filter(p => p).map(p => p.fullName));\n}\n```\n\n**Profile Methods:**\n- `fetchProfile(address?)` - Get user profile\n- `updateProfile(data)` - Update profile info\n- `uploadProfileImage(options)` - Upload avatar (Node.js)\n- `getManagedTokens()` - Get tokens you manage (creator, moderator, manager, technical producer)\n\n**Profile Fields:**\n- `fullName` - Display name (max 100 chars)\n- `profileImage` - Avatar image URL\n- `address` - Wallet address\n- `createdAt` - Creation date\n- `updatedAt` - Update timestamp\n\n**Use Cases:**\n- Display user profiles\n- Allow profile customization\n- Manage profile images\n- Token creator attribution\n- Multi-wallet profiles\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_profile`\n- `gala_launchpad_update_profile`\n- `gala_launchpad_upload_profile_image`\n- `gala_launchpad_get_managed_tokens`\n"
2027
- },
2028
- {
2029
- "userQuestion": "What parameters does fetchProfile() accept?",
2030
- "assistantResponse": "The primary methods for Profile management are `fetchProfile()`, `updateProfile()`, `uploadProfileImage()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2031
- },
2032
- {
2033
- "userQuestion": "What are best practices for manage user profiles?",
2034
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2035
- },
2036
- {
2037
- "userQuestion": "Can you walk me through a complete manage user profiles example?",
2038
- "assistantResponse": "**Complete Workflow: Profile management**\n\nHere's the typical flow: `fetchProfile()` → `updateProfile()` → `uploadProfileImage()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2039
- },
2040
- {
2041
- "userQuestion": "What should I learn next after manage user profiles?",
2042
- "assistantResponse": "**Related Topics:**\n\n- **Session auth**: `explainSdkUsage({ topic: 'session-auth' })`\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n- **Referral system**: `explainSdkUsage({ topic: 'referral-system' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2043
- }
2044
- ]
2045
- },
2046
- {
2047
- "topicKey": "ban-management",
2048
- "label": "Ban management",
2049
- "category": "ban",
2050
- "description": "User bans and moderation",
2051
- "methodCount": 5,
2052
- "exchanges": [
2053
- {
2054
- "userQuestion": "How do I manage user bans?",
2055
- "assistantResponse": "\n# Ban/Moderation Operations - SDK v5.5.0+\n\nUser ban management for stream moderation, including creating bans, removing bans,\nlisting banned users, checking ban status, and viewing active users.\n\n## Creating and Removing Bans\n\n```typescript\nimport { createLaunchpadSDK, BAN_DURATIONS } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key for ban ops\n});\n\n// Create a permanent ban\nconst permanentBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n reason: 'Spamming chat',\n});\nconsole.log('Permanent ban created:', permanentBan.ban.id);\n\n// Create a temporary ban (1 hour)\nconst tempBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0xabcdef1234567890abcdef1234567890abcdef12',\n reason: 'Inappropriate behavior',\n durationSeconds: BAN_DURATIONS.ONE_HOUR, // 3600 seconds\n});\nconsole.log('Temp ban expires:', tempBan.ban.expiresAt);\n\n// Remove a ban (unban user)\nconst unbanned = await sdk.removeBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n});\nconsole.log('User unbanned:', unbanned.removed);\n```\n\n## Duration Presets\n\n```typescript\nimport { BAN_DURATIONS } from '@gala-chain/launchpad-sdk';\n\n// Available presets\nBAN_DURATIONS.ONE_HOUR // 3600 seconds (1 hour)\nBAN_DURATIONS.ONE_DAY // 86400 seconds (24 hours)\nBAN_DURATIONS.ONE_WEEK // 604800 seconds (7 days)\nBAN_DURATIONS.ONE_MONTH // 2592000 seconds (30 days)\n\n// Custom duration (min: 60 sec, max: 31536000 sec / 1 year)\nconst customBan = await sdk.createBan({\n tokenName: 'mytoken',\n userAddress: 'eth|0x...',\n durationSeconds: 7200, // 2 hours\n});\n```\n\n## Listing Bans\n\n```typescript\n// List all bans for a token\nconst allBans = await sdk.listBans({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n});\nconsole.log('Total bans:', allBans.meta.total);\n\nfor (const ban of allBans.bans) {\n console.log(`- ${ban.userAddress}: ${ban.reason || 'No reason'}`);\n console.log(` Permanent: ${ban.isPermanent}`);\n console.log(` Expires: ${ban.expiresAt || 'Never'}`);\n}\n\n// Search bans by user\nconst searchResults = await sdk.listBans({\n tokenName: 'mytoken',\n search: '0x1234', // Searches userAddress OR fullName\n});\n\n// Filter by specific field\nconst filteredBans = await sdk.listBans({\n tokenName: 'mytoken',\n userAddress: '0x1234', // Filter by address only\n name: 'John', // Filter by display name only\n});\n```\n\n## Checking Ban Status\n\n```typescript\n// Check if specific user is banned\nconst status = await sdk.getBanStatus({\n tokenName: 'mytoken',\n userAddress: 'eth|0x1234567890abcdef1234567890abcdef12345678',\n});\n\nif (status.banned) {\n console.log('User is banned!');\n console.log('Reason:', status.ban?.reason);\n console.log('Permanent:', status.ban?.isPermanent);\n console.log('Expires:', status.ban?.expiresAt);\n} else {\n console.log('User is not banned');\n}\n```\n\n## Viewing Active Users\n\n```typescript\nimport { ACTIVE_USER_TYPE } from '@gala-chain/launchpad-sdk';\n\n// Get all active viewers\nconst viewers = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n type: ACTIVE_USER_TYPE.VIEWERS, // or 'viewers'\n});\nconsole.log('Active viewers:', viewers.total);\n\n// Get only chat participants\nconst chatters = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n type: ACTIVE_USER_TYPE.CHAT_PARTICIPANTS, // or 'chat_participants'\n});\nconsole.log('Chat participants:', chatters.total);\n\n// Search active users\nconst searchActive = await sdk.getActiveUsers({\n tokenName: 'mytoken',\n search: 'john', // Search by name or address\n});\n\nfor (const user of searchActive.users) {\n console.log(`- ${user.fullName || user.userAddress}`);\n console.log(` In chat: ${user.isChatParticipant}`);\n}\n```\n\n## Authentication\n\nBan operations support two authentication modes:\n\n1. **Admin API Key** (streamAdminApiKey) - Full moderation access\n2. **JWT Auth** (login()) - Token owner moderation only\n\n```typescript\n// Admin mode - can moderate any token\nconst adminSdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,\n});\n\n// Owner mode - can only moderate own tokens\nconst ownerSdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\nawait ownerSdk.login(); // JWT authentication required\n```\n\n## WebSocket Events\n\nBan events are broadcast to affected users via WebSocket:\n\n```typescript\n// Listen for ban events\nsdk.connectStreamWebSocket({\n onUserBanned: (event) => {\n console.log('User banned:', event.userAddress);\n console.log('Reason:', event.reason);\n console.log('Expires:', event.expiresAt);\n },\n onUserUnbanned: (event) => {\n console.log('User unbanned:', event.userAddress);\n },\n onBanEnforcement: (event) => {\n // Received when banned user tries to chat/react\n console.log('Ban enforced for action:', event.action);\n console.log('Reason:', event.reason);\n },\n});\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createBan(options)` | Create a new ban | Admin/Owner |\n| `removeBan(options)` | Remove a ban (unban user) | Admin/Owner |\n| `listBans(options)` | List banned users | Admin/Owner |\n| `getBanStatus(options)` | Check if user is banned | Admin/Owner |\n| `getActiveUsers(options)` | Get active viewers/chatters | Admin/Owner |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_ban`\n- `gala_launchpad_remove_ban`\n- `gala_launchpad_list_bans`\n- `gala_launchpad_get_ban_status`\n- `gala_launchpad_get_active_users`\n"
2056
- },
2057
- {
2058
- "userQuestion": "What parameters does createBan() accept?",
2059
- "assistantResponse": "The primary methods for Ban management are `createBan()`, `removeBan()`, `listBans()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2060
- },
2061
- {
2062
- "userQuestion": "What are best practices for manage user bans?",
2063
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2064
- },
2065
- {
2066
- "userQuestion": "What errors should I handle when manage user bans?",
2067
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.banmanagement(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
2068
- },
2069
- {
2070
- "userQuestion": "Can you walk me through a complete manage user bans example?",
2071
- "assistantResponse": "**Complete Workflow: Ban management**\n\nHere's the typical flow: `createBan()` → `removeBan()` → `listBans()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2072
- },
2073
- {
2074
- "userQuestion": "What other methods are available for Ban management?",
2075
- "assistantResponse": "**Additional Methods:**\n\n- `getBanStatus()`\n- `getActiveUsers()`\n\n**Total methods in this topic:** 5\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2076
- },
2077
- {
2078
- "userQuestion": "What should I learn next after manage user bans?",
2079
- "assistantResponse": "**Related Topics:**\n\n- **Moderator invites**: `explainSdkUsage({ topic: 'moderator-invites' })`\n- **Stream chat**: `explainSdkUsage({ topic: 'stream-chat' })`\n- **Content flag management**: `explainSdkUsage({ topic: 'content-flag-management' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2080
- }
2081
- ]
2082
- },
2083
- {
2084
- "topicKey": "bridge-operations",
2085
- "label": "Bridge operations",
2086
- "category": "bridge",
2087
- "description": "Cross-chain bridging operations",
2088
- "methodCount": 21,
2089
- "exchanges": [
2090
- {
2091
- "userQuestion": "How do I bridge tokens across chains?",
2092
- "assistantResponse": "\n## Cross-Chain Bridge Operations with SDK\n\n**Covers Methods:**\n- `estimateBridgeFee()`\n- `bridgeOut()`\n- `bridgeIn()`\n- `getBridgeStatus()`\n- `getSupportedBridgeTokens()`\n- `getEthereumTransactionStatus()`\n- `getSolanaTransactionStatus()`\n- `fetchEthereumWalletTokenBalance()` / `fetchSolanaWalletTokenBalance()`\n- `fetchEthereumWalletNativeBalance()` / `fetchSolanaWalletNativeBalance()`\n- `fetchEthereumWalletAllBalances()` / `fetchSolanaWalletAllBalances()`\n- `fetchBridgeableTokensByNetwork()` / `fetchAllBridgeableTokensByNetwork()`\n- `fetchAllTokensBridgeableToEthereum()` / `fetchAllTokensBridgeableToSolana()`\n- `isTokenBridgeableToNetwork()` / `isTokenBridgeableToEthereum()` / `isTokenBridgeableToSolana()`\n- `requestSolanaDevnetAirdrop()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function bridgeOperations() {\n // 1. Create SDK with wallet configuration\n const sdk = createLaunchpadSDK({\n privateKey: '0xabcd...',\n environment: 'production', // or 'staging' for testnet\n });\n\n // 2. Get supported bridge tokens\n const supportedTokens = await sdk.getSupportedBridgeTokens('Ethereum');\n console.log('Bridgeable to Ethereum:', supportedTokens.map(t => t.symbol));\n\n // 3. Check if specific token is bridgeable\n const canBridge = await sdk.isTokenBridgeableToEthereum('GALA');\n console.log('GALA bridgeable to Ethereum:', canBridge.bridgeable);\n\n // 4. Estimate bridge fee (calculated externally by GalaConnect API)\n const fee = await sdk.estimateBridgeFee({\n tokenId: 'GALA|Unit|none|none',\n destinationChain: 'Ethereum',\n amount: '100',\n });\n console.log('Bridge fee:', fee.totalFee, 'GALA');\n\n // 5. Bridge Out: GalaChain → Ethereum\n const bridgeOutTx = await sdk.bridgeOut({\n tokenId: 'GALA|Unit|none|none',\n amount: '100',\n destinationChain: 'Ethereum',\n recipientAddress: '0x5678...',\n });\n console.log('Bridge out TX:', bridgeOutTx.transactionHash);\n\n // 6. Get bridge status\n const status = await sdk.getBridgeStatus(bridgeOutTx.transactionHash);\n console.log('Bridge status:', status.status);\n\n // 7. Get Ethereum transaction status\n const ethTxStatus = await sdk.getEthereumTransactionStatus(bridgeOutTx.transactionHash);\n console.log('ETH TX confirmed:', ethTxStatus.confirmed);\n\n // 8. Query external chain balances\n const ethBalance = await sdk.fetchEthereumWalletNativeBalance();\n const galaEthBalance = await sdk.fetchEthereumWalletTokenBalance('GALA');\n const allEthBalances = await sdk.fetchEthereumWalletAllBalances();\n\n // 9. Discover all bridgeable tokens\n const allBridgeable = await sdk.fetchAllBridgeableTokensByNetwork('ETHEREUM');\n console.log('All tokens bridgeable to Ethereum:', allBridgeable.length);\n}\n```\n\n**Supported Tokens:**\n- **Ethereum:** GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC\n- **Solana:** GALA, GSOL\n\n**Environment Configuration:**\n- `PROD`: Ethereum Mainnet, Solana Mainnet\n- `STAGE`: Ethereum Sepolia, Solana Devnet\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_bridge_estimate_fee`\n- `gala_launchpad_bridge_out`\n- `gala_launchpad_bridge_in`\n- `gala_launchpad_bridge_status`\n- `gala_launchpad_bridge_ethereum_balance`\n- `gala_launchpad_bridge_ethereum_all_balances`\n- `gala_launchpad_bridge_solana_balance`\n- `gala_launchpad_bridge_solana_all_balances`\n"
2093
- },
2094
- {
2095
- "userQuestion": "What parameters does estimateBridgeFee() accept?",
2096
- "assistantResponse": "The primary methods for Bridge operations are `estimateBridgeFee()`, `bridgeOut()`, `bridgeIn()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2097
- },
2098
- {
2099
- "userQuestion": "What are best practices for bridge tokens across chains?",
2100
- "assistantResponse": "1. **Estimate fees first**: Always call `estimateBridgeFee()` before bridging.\n2. **Track status**: Use `getBridgeStatus()` to monitor cross-chain transfers.\n3. **Verify network**: Ensure you're bridging to the correct destination network."
2101
- },
2102
- {
2103
- "userQuestion": "What errors should I handle when bridge tokens across chains?",
2104
- "assistantResponse": "**Common Errors:**\n- `InsufficientFee`: Bridge fee not covered - estimate first\n- `InvalidDestinationAddress`: Wrong format for target chain\n- `NetworkTimeout`: Cross-chain operations can take time\n\n**Tip:** Always poll `getBridgeStatus()` until completion."
2105
- },
2106
- {
2107
- "userQuestion": "Can you walk me through a complete bridge tokens across chains example?",
2108
- "assistantResponse": "**Complete Workflow: Bridge operations**\n\nHere's the typical flow: `estimateBridgeFee()` → `bridgeOut()` → `bridgeIn()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2109
- },
2110
- {
2111
- "userQuestion": "What edge cases should I know about for bridge tokens across chains?",
2112
- "assistantResponse": "**Edge Cases:**\n1. **Network delays**: Solana is faster than Ethereum bridging\n2. **Token decimals**: Different chains may have different decimal precision\n3. **Gas spikes**: Ethereum fees can vary significantly\n\n**Gotcha:** Bridge transactions can take 10-30+ minutes depending on network congestion."
2113
- },
2114
- {
2115
- "userQuestion": "What other methods are available for Bridge operations?",
2116
- "assistantResponse": "**Additional Methods:**\n\n- `getBridgeStatus()`\n- `fetchEthereumWalletTokenBalance()`\n- `fetchEthereumWalletNativeBalance()`\n- `fetchEthereumWalletAllBalances()`\n\n**Total methods in this topic:** 21\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2117
- },
2118
- {
2119
- "userQuestion": "When would I actually use bridge tokens across chains in a real application?",
2120
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Cross-Chain Arbitrage**: Move tokens to chains with better prices\n2. **DeFi Access**: Bridge to Ethereum for wider DeFi ecosystem\n3. **Gas Optimization**: Bridge to chains with lower fees\n4. **Liquidity Aggregation**: Consolidate holdings from multiple chains"
2121
- },
2122
- {
2123
- "userQuestion": "What should I learn next after bridge tokens across chains?",
2124
- "assistantResponse": "**Related Topics:**\n\n- **Wrap unwrap operations**: `explainSdkUsage({ topic: 'wrap-unwrap-operations' })`\n- **Transfers**: `explainSdkUsage({ topic: 'transfers' })`\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2125
- },
2126
- {
2127
- "userQuestion": "Are there any advanced patterns for this topic?",
2128
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
2129
- }
2130
- ]
2131
- },
2132
- {
2133
- "topicKey": "wrap-unwrap-operations",
2134
- "label": "Wrap unwrap operations",
2135
- "category": "bridge",
2136
- "description": "Cross-chain bridging operations",
2137
- "methodCount": 10,
2138
- "exchanges": [
2139
- {
2140
- "userQuestion": "How do I wrap and unwrap tokens?",
2141
- "assistantResponse": "\n# Wrap/Unwrap Operations (Cross-Channel GalaChain Bridge)\n\nThe SDK provides methods for wrapping and unwrapping tokens between GalaChain channels.\nThis is an **internal GalaChain cross-channel bridge**, NOT external bridging to Ethereum/Solana.\n\n**Key Concept:**\n- **Wrap**: Move token from native channel → asset channel (e.g., MUSIC → GMUSIC)\n- **Unwrap**: Move token from asset channel → native channel (e.g., GMUSIC → MUSIC)\n\n## Wrap Token\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function wrapToken() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Wrap MUSIC to GMUSIC (music channel → asset channel)\n const result = await sdk.wrapToken({\n tokenId: 'MUSIC', // or '$MUSIC|Unit|none|none'\n amount: '100',\n recipient: '0x...', // Optional, defaults to sender\n memo: 'Wrapping for DEX trading' // Optional\n });\n\n console.log('Wrap transaction:', result.transactionId);\n}\n```\n\n## Unwrap Token\n\n```typescript\nasync function unwrapToken() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Unwrap GMUSIC back to MUSIC (asset channel → music channel)\n const result = await sdk.unwrapToken({\n tokenId: 'GMUSIC', // or '$GMUSIC|Unit|none|none'\n amount: '50',\n recipient: '0x...', // Optional\n memo: 'Unwrapping after trading' // Optional\n });\n\n console.log('Unwrap transaction:', result.transactionId);\n}\n```\n\n## Fee Estimation\n\n```typescript\nasync function estimateFees() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Estimate wrap fee (uses cross_channel_authorization)\n const wrapFee = await sdk.estimateWrapFee('MUSIC', '100');\n console.log('Wrap fee:', wrapFee);\n\n // Estimate unwrap fee (uses automatic authorization)\n const unwrapFee = await sdk.estimateUnwrapFee('GMUSIC', '100');\n console.log('Unwrap fee:', unwrapFee);\n}\n```\n\n## Transaction Status\n\n```typescript\nasync function checkStatus() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const status = await sdk.getWrapStatus('transaction-id-here');\n console.log('Status:', status.status); // pending, processing, completed, failed\n}\n```\n\n## Wrappable Token Discovery\n\n```typescript\nasync function discoverWrappableTokens() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Paginated fetch\n const tokens = await sdk.fetchWrappableTokens({ limit: 100 });\n\n // Auto-paginated (all tokens)\n const allTokens = await sdk.fetchAllWrappableTokens();\n\n // Get specific wrappable token\n const token = await sdk.getWrappableToken('$MUSIC|Unit|none|none');\n\n // Get wrap counterpart (MUSIC → GMUSIC or vice versa)\n const counterpart = await sdk.getWrapCounterpart('$MUSIC|Unit|none|none');\n\n // Check if token is wrappable\n const isWrappable = await sdk.isTokenWrappable('$MUSIC|Unit|none|none');\n console.log('Is wrappable:', isWrappable.isWrappable);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_wrap_token`\n- `gala_launchpad_unwrap_token`\n- `gala_launchpad_estimate_wrap_fee`\n- `gala_launchpad_estimate_unwrap_fee`\n- `gala_launchpad_get_wrap_status`\n- `gala_launchpad_fetch_wrappable_tokens`\n- `gala_launchpad_fetch_all_wrappable_tokens`\n- `gala_launchpad_get_wrappable_token`\n- `gala_launchpad_get_wrap_counterpart`\n- `gala_launchpad_is_token_wrappable`\n"
2142
- },
2143
- {
2144
- "userQuestion": "What parameters does wrapToken() accept?",
2145
- "assistantResponse": "The primary methods for Wrap unwrap operations are `wrapToken()`, `unwrapToken()`, `estimateWrapFee()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2146
- },
2147
- {
2148
- "userQuestion": "What are best practices for wrap and unwrap tokens?",
2149
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2150
- },
2151
- {
2152
- "userQuestion": "What errors should I handle when wrap and unwrap tokens?",
2153
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.wrapunwrapoperations(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
2154
- },
2155
- {
2156
- "userQuestion": "Can you walk me through a complete wrap and unwrap tokens example?",
2157
- "assistantResponse": "**Complete Workflow: Wrap unwrap operations**\n\nHere's the typical flow: `wrapToken()` → `unwrapToken()` → `estimateWrapFee()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2158
- },
2159
- {
2160
- "userQuestion": "What other methods are available for Wrap unwrap operations?",
2161
- "assistantResponse": "**Additional Methods:**\n\n- `estimateUnwrapFee()`\n- `getWrapStatus()`\n- `fetchWrappableTokens()`\n- `fetchAllWrappableTokens()`\n\n**Total methods in this topic:** 10\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2162
- },
2163
- {
2164
- "userQuestion": "What should I learn next after wrap and unwrap tokens?",
2165
- "assistantResponse": "**Related Topics:**\n\n- **Bridge operations**: `explainSdkUsage({ topic: 'bridge-operations' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Transfers**: `explainSdkUsage({ topic: 'transfers' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2166
- },
2167
- {
2168
- "userQuestion": "Are there any advanced patterns for this topic?",
2169
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
2170
- }
2171
- ]
2172
- },
2173
- {
2174
- "topicKey": "event-subscriptions",
2175
- "label": "Event subscriptions",
2176
- "category": "chat",
2177
- "description": "Stream chat and messaging",
2178
- "methodCount": 33,
2179
- "exchanges": [
2180
- {
2181
- "userQuestion": "How do I subscribe to real-time events?",
2182
- "assistantResponse": "\n## Real-Time Event Subscriptions and Monitoring\n\n**Covers Methods:**\n- `subscribeToDexLiquidityAdded()`\n- `subscribeToDexLiquidityChanged()`\n- `subscribeToDexLiquidityRemoved()`\n- `subscribeToDexPoolAdded()`\n- `subscribeToDexSwapExecuted()`\n- `subscribeToTokenCreations()`\n\nSubscribe to real-time WebSocket events for DEX trading, liquidity changes, and token launches.\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function subscribeToEvents() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // ============================================================================\n // LIQUIDITY EVENTS - Monitor position changes\n // ============================================================================\n\n // Subscribe to liquidity additions\n const cleanupAdded = sdk.subscribeToDexLiquidityAdded((event) => {\n console.log('Liquidity added!');\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Amount0: ${event.amount0}`);\n console.log(` Amount1: ${event.amount1}`);\n console.log(` Owner: ${event.owner}`);\n console.log(` Position ID: ${event.positionId}`);\n });\n\n // Subscribe to liquidity changes (compound events)\n const cleanupChanged = sdk.subscribeToDexLiquidityChanged((event) => {\n console.log('Liquidity changed!');\n console.log(` Type: ${event.type}`); // 'added', 'removed', 'modified'\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Delta: ${event.liquidityDelta}`);\n });\n\n // Subscribe to liquidity removals\n const cleanupRemoved = sdk.subscribeToDexLiquidityRemoved((event) => {\n console.log('Liquidity removed!');\n console.log(` Pool: ${event.token0}-${event.token1}`);\n console.log(` Amount0: ${event.amount0}`);\n console.log(` Amount1: ${event.amount1}`);\n console.log(` Owner: ${event.owner}`);\n console.log(` Fees collected: ${event.fees0}, ${event.fees1}`);\n });\n\n // ============================================================================\n // POOL EVENTS - Monitor new DEX pools\n // ============================================================================\n\n // Subscribe to new DEX pool creation\n const cleanupPool = sdk.subscribeToDexPoolAdded((pool) => {\n console.log('New DEX pool created!');\n console.log(` Token: ${pool.tokenName}`);\n console.log(` Token0: ${pool.token0}`);\n console.log(` Token1: ${pool.token1}`);\n console.log(` Fee Tier: ${pool.feeTier}`);\n console.log(` Initial TVL: ${pool.tvl}`);\n\n // Auto-provide liquidity to new pools\n sdk.addSwapLiquidityByPrice({\n token0: pool.token0,\n token1: pool.token1,\n fee: pool.feeTier,\n minPrice: '0.95',\n maxPrice: '1.05',\n amount0Desired: '1000',\n amount1Desired: '1000'\n }).then(() => console.log('Liquidity provided to new pool'));\n });\n\n // ============================================================================\n // SWAP EVENTS - Monitor all DEX swaps\n // ============================================================================\n\n // Subscribe to DEX swap executions\n const cleanupSwap = sdk.subscribeToDexSwapExecuted((swap) => {\n console.log('DEX swap executed!');\n console.log(` Pair: ${swap.tokenIn} → ${swap.tokenOut}`);\n console.log(` Amount In: ${swap.amountIn}`);\n console.log(` Amount Out: ${swap.amountOut}`);\n console.log(` Trader: ${swap.trader}`);\n console.log(` Fee Tier: ${swap.feeTier}`);\n\n // Track volume and price impact\n const priceImpact = calculatePriceImpact(swap.amountIn, swap.amountOut);\n console.log(` Price impact: ${priceImpact}%`);\n });\n\n // ============================================================================\n // TOKEN CREATION EVENTS - Monitor new token launches\n // ============================================================================\n\n // Subscribe to new token launches\n const cleanupToken = sdk.subscribeToTokenCreations((token) => {\n console.log('New token launched!');\n console.log(` Name: ${token.tokenName}`);\n console.log(` Symbol: ${token.tokenSymbol}`);\n console.log(` Creator: ${token.creator}`);\n console.log(` Max Supply: ${token.maxSupply}`);\n console.log(` Base Price: ${token.basePrice}`);\n\n // Auto-buy new tokens\n sdk.buy({\n tokenName: token.tokenName,\n amount: '100',\n type: 'native',\n slippageToleranceFactor: 0.01\n }).then(() => console.log('Auto-bought new token'));\n });\n\n // ============================================================================\n // ARBITRAGE BOT EXAMPLE - Multi-event monitoring\n // ============================================================================\n\n async function arbitrageBot() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Track all swaps for arbitrage opportunities\n sdk.subscribeToDexSwapExecuted(async (swap) => {\n // Check if price divergence exists\n const poolPrice = await sdk.getSwapPoolPrice(swap.tokenIn, swap.tokenOut);\n const externalPrice = await getExternalPrice(swap.tokenIn, swap.tokenOut);\n\n const divergence = Math.abs(poolPrice - externalPrice) / externalPrice;\n\n if (divergence > 0.01) {\n // 1% arbitrage opportunity\n console.log(`Arbitrage opportunity: ${divergence * 100}%`);\n\n // Execute arbitrage trade\n await sdk.executeSwap(\n swap.tokenOut,\n swap.tokenIn,\n calculateArbitrageAmount(divergence),\n '0', // min output\n 3000, // fee tier\n 0.01 // slippage\n );\n }\n });\n\n // Monitor liquidity additions for new opportunities\n sdk.subscribeToDexLiquidityAdded(async (event) => {\n console.log(`New liquidity in ${event.token0}-${event.token1}`);\n\n // Check if pool has sufficient depth for arbitrage\n const poolInfo = await sdk.getSwapPoolInfo(event.token0, event.token1);\n // Use compareAmounts for precise liquidity threshold comparison\n if (compareAmounts(poolInfo.liquidity, '100000') > 0) {\n console.log('Pool has sufficient liquidity for arbitrage');\n }\n });\n }\n\n // ============================================================================\n // LIQUIDITY PROVIDER BOT - Auto-manage positions\n // ============================================================================\n\n async function liquidityProviderBot() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Auto-add liquidity to new pools\n sdk.subscribeToDexPoolAdded(async (pool) => {\n console.log(`New pool: ${pool.tokenName}`);\n\n // Wait for some initial swaps to establish price\n setTimeout(async () => {\n const poolInfo = await sdk.getSwapPoolInfo(pool.token0, pool.token1);\n\n // Add liquidity if TVL is high enough\n // Use compareAmounts for precise liquidity threshold comparison\n if (compareAmounts(poolInfo.liquidity, '50000') > 0) {\n await sdk.addSwapLiquidityByPrice({\n token0: pool.token0,\n token1: pool.token1,\n fee: pool.feeTier,\n minPrice: '0.9',\n maxPrice: '1.1',\n amount0Desired: '10000',\n amount1Desired: '10000'\n });\n\n console.log('Liquidity added to new pool');\n }\n }, 60000); // Wait 1 minute\n });\n\n // Monitor liquidity removals (potential exit signal)\n sdk.subscribeToDexLiquidityRemoved((event) => {\n console.log(`Large liquidity removal: ${event.amount0}, ${event.amount1}`);\n\n // Check if we should also exit\n if (isLargeRemoval(event)) {\n console.log('Large removal detected - consider exiting position');\n }\n });\n }\n\n // Keep subscriptions running\n console.log('Subscriptions active... Press Ctrl+C to stop');\n await new Promise(() => {}); // Run forever\n\n // Cleanup when done\n cleanupAdded();\n cleanupChanged();\n cleanupRemoved();\n cleanupPool();\n cleanupSwap();\n cleanupToken();\n}\n```\n\n**Event Data Structures:**\n\n**LiquidityAdded:**\n- token0, token1, feeTier\n- amount0, amount1\n- owner, positionId\n- timestamp\n\n**LiquidityRemoved:**\n- token0, token1, feeTier\n- amount0, amount1\n- fees0, fees1\n- owner, positionId\n- timestamp\n\n**DexPoolAdded:**\n- tokenName, token0, token1\n- feeTier, tvl\n- timestamp\n\n**SwapExecuted:**\n- tokenIn, tokenOut\n- amountIn, amountOut\n- trader, feeTier\n- priceImpact\n- timestamp\n\n**TokenCreation:**\n- tokenName, tokenSymbol\n- creator, maxSupply\n- basePrice\n- timestamp\n\n**Use Cases:**\n- **Arbitrage Bots**: Monitor swaps for price divergence\n- **Liquidity Management**: Auto-provide liquidity to new pools\n- **Early Bird Trading**: Buy new tokens immediately after launch\n- **Position Monitoring**: Track liquidity changes in your positions\n- **Market Analysis**: Analyze trading patterns and volumes\n\n### WebSocket Connection Lifecycle\n\n```typescript\n// Handle connection lifecycle events\nawait sdk.connectStreamWebSocket({\n onConnect: () => {\n console.log('WebSocket connected');\n },\n onDisconnect: (reason) => {\n console.log('WebSocket disconnected:', reason);\n // Implement reconnection logic if needed\n },\n onError: (error) => {\n console.error('WebSocket error:', error);\n }\n});\n\n// Check connection state\nif (sdk.isStreamWebSocketConnected()) {\n console.log('Ready to send/receive messages');\n}\n```\n\n### Typing Indicators\n\n```typescript\n// Subscribe to typing indicators in chat\nawait sdk.connectStreamWebSocket({\n onTypingIndicator: (event) => {\n if (event.isTyping) {\n console.log(`${event.userAddress} is typing...`);\n } else {\n console.log(`${event.userAddress} stopped typing`);\n }\n }\n});\n\n// Send typing start indicator\nawait sdk.sendTypingStart({\n tokenName: 'anime'\n});\n\n// Later: Send typing stop indicator\nawait sdk.sendTypingStop({\n tokenName: 'anime'\n});\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_subscribe_to_dex_liquidity_added`\n- `gala_launchpad_subscribe_to_dex_liquidity_changed`\n- `gala_launchpad_subscribe_to_dex_liquidity_removed`\n- `gala_launchpad_subscribe_to_dex_pool_added`\n- `gala_launchpad_subscribe_to_dex_swap_executed`\n- `gala_launchpad_subscribe_to_token_creations`\n"
2183
- },
2184
- {
2185
- "userQuestion": "What parameters does subscribeToStream() accept?",
2186
- "assistantResponse": "The primary methods for Event subscriptions are `subscribeToStream()`, `unsubscribeFromStream()`, `onStreamStatusChanged()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2187
- },
2188
- {
2189
- "userQuestion": "What are best practices for subscribe to real-time events?",
2190
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2191
- },
2192
- {
2193
- "userQuestion": "Can you walk me through a complete subscribe to real-time events example?",
2194
- "assistantResponse": "**Complete Workflow: Event subscriptions**\n\nHere's the typical flow: `subscribeToStream()` → `unsubscribeFromStream()` → `onStreamStatusChanged()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2195
- },
2196
- {
2197
- "userQuestion": "What other methods are available for Event subscriptions?",
2198
- "assistantResponse": "**Additional Methods:**\n\n- `onUserBanned()`\n- `onUserUnbanned()`\n- `onBanEnforcement()`\n- `onContentFlagged()`\n\n**Total methods in this topic:** 33\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2199
- },
2200
- {
2201
- "userQuestion": "What should I learn next after subscribe to real-time events?",
2202
- "assistantResponse": "**Related Topics:**\n\n- **Streaming**: `explainSdkUsage({ topic: 'streaming' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Token status**: `explainSdkUsage({ topic: 'token-status' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2203
- },
2204
- {
2205
- "userQuestion": "Are there any advanced patterns for this topic?",
2206
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
2207
- }
2208
- ]
2209
- },
2210
- {
2211
- "topicKey": "stream-chat",
2212
- "label": "Stream chat",
2213
- "category": "chat-messages",
2214
- "description": "Stream chat message operations",
2215
- "methodCount": 18,
2216
- "exchanges": [
2217
- {
2218
- "userQuestion": "How do I handle stream chat and messaging?",
2219
- "assistantResponse": "\n# Stream Chat SDK\n\nThe SDK provides chat functionality for live streams, including REST API and\nWebSocket real-time messaging.\n\n## REST API Chat\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function restChat() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get chat messages (public endpoint)\n const messages = await sdk.getChatMessages({\n tokenName: 'mytoken',\n page: 1,\n limit: 50,\n });\n\n for (const msg of messages.messages) {\n console.log(`[${msg.createdAt}] ${msg.user?.fullName}: ${msg.content}`);\n }\n\n // Send a chat message via REST\n const sent = await sdk.sendChatMessage({\n tokenName: 'mytoken',\n content: 'Hello everyone!',\n });\n console.log('Message ID:', sent.message.messageId);\n\n // Delete a chat message (user can delete own, admin can delete any)\n const deleted = await sdk.deleteChatMessage({\n tokenName: 'mytoken',\n messageId: sent.message.messageId,\n });\n console.log('Message deleted:', deleted.deleted);\n\n // Check chat status\n const status = await sdk.getChatStatus('mytoken');\n console.log('Chat enabled:', status.enabled);\n if (!status.enabled) {\n console.log('Reason:', status.reason); // 'global' or 'token'\n }\n}\n```\n\n## WebSocket Real-time Chat\n\nLower latency messaging with real-time updates.\n\n```typescript\nasync function webSocketChat() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamWebSocketUrl: 'wss://stream.example.com',\n });\n\n // Connect with event callbacks\n await sdk.connectStreamWebSocket({\n onConnect: () => console.log('Connected!'),\n onDisconnect: (reason) => console.log('Disconnected:', reason),\n onError: (error) => console.error('Error:', error),\n onChatMessage: (msg) => {\n console.log(`[${msg.tokenName}] ${msg.userAddress}: ${msg.content}`);\n },\n onViewerCount: (data) => {\n console.log(`Viewers on ${data.tokenName}: ${data.count}`);\n },\n onStreamStatus: (status) => {\n console.log(`Stream ${status.tokenName}: ${status.status}`);\n },\n });\n\n // Authenticate (required for sending messages)\n await sdk.authenticateStreamWebSocket();\n\n // Subscribe to a stream's events\n const subscribed = await sdk.subscribeToStream('mytoken');\n console.log('Subscribed, stream status:', subscribed.status);\n\n // Send message via WebSocket (lower latency)\n await sdk.sendStreamChatViaWebSocket('mytoken', 'Hello via WebSocket!');\n\n // Send emoji reaction (ephemeral, not persisted)\n await sdk.sendStreamReaction('mytoken', '🔥', 0);\n\n // Unsubscribe when done\n await sdk.unsubscribeFromStream('mytoken');\n\n // Disconnect\n sdk.disconnectStreamWebSocket();\n}\n```\n\n## Admin Chat Operations\n\n```typescript\nasync function adminChat() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamAdminApiKey: 'your-admin-key',\n });\n\n // Disable chat for a token\n await sdk.disableChat('mytoken');\n\n // Re-enable chat\n await sdk.enableChat('mytoken');\n\n // Get global chat status\n const globalStatus = await sdk.getGlobalChatStatus();\n console.log('Global chat enabled:', globalStatus.enabled);\n\n // Disable/enable chat globally\n await sdk.setGlobalChatEnabled(false); // Disable all chat\n await sdk.setGlobalChatEnabled(true); // Re-enable\n}\n```\n\n**WebSocket Events:**\n| Event | Description | Payload |\n|-------|-------------|---------|\n| `chat_message` | New chat message | `{ tokenName, messageId, content, userAddress, user? }` |\n| `viewer_count` | Viewer count update | `{ tokenName, count }` |\n| `stream_status` | Stream status change | `{ tokenName, status, isLive, playbackId }` |\n| `chat_status` | Chat enabled/disabled | `{ tokenName, enabled }` |\n\n**Available SDK Methods:**\n| Method | Description | Auth |\n|--------|-------------|------|\n| `getChatMessages(options)` | Get chat history | Public |\n| `sendChatMessage(options)` | Send via REST | Wallet |\n| `deleteChatMessage(options)` | Delete message | Wallet/Admin |\n| `getChatStatus(tokenName)` | Check chat status | Public |\n| `disableChat(tokenName)` | Disable token chat | Admin |\n| `enableChat(tokenName)` | Enable token chat | Admin |\n| `getGlobalChatStatus()` | Get global status | Public |\n| `setGlobalChatEnabled(enabled)` | Enable/disable globally | Admin |\n| `connectStreamWebSocket(callbacks)` | Connect WebSocket | None |\n| `authenticateStreamWebSocket()` | Authenticate WS | Wallet |\n| `subscribeToStream(tokenName)` | Subscribe to events | None |\n| `unsubscribeFromStream(tokenName)` | Unsubscribe | None |\n| `sendStreamChatViaWebSocket(tokenName, content)` | Send via WS | Wallet |\n| `sendStreamReaction(tokenName, emoji, streamTime)` | Send emoji reaction | Wallet |\n| `disconnectStreamWebSocket()` | Close connection | None |\n| `getEngagementStats(tokenName)` | Get viewer and chat engagement stats | Public |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_chat_messages`\n- `gala_launchpad_send_chat_message`\n- `gala_launchpad_delete_chat_message`\n- `gala_launchpad_get_chat_status`\n- `gala_launchpad_set_chat_enabled`\n- `gala_launchpad_get_global_chat_status`\n- `gala_launchpad_set_global_chat_enabled`\n- `gala_launchpad_connect_stream_websocket`\n- `gala_launchpad_subscribe_to_stream`\n- `gala_launchpad_send_stream_chat_websocket`\n- `gala_launchpad_send_stream_reaction`\n- `gala_launchpad_get_engagement_stats`\n"
2220
- },
2221
- {
2222
- "userQuestion": "What parameters does getChatMessages() accept?",
2223
- "assistantResponse": "The primary methods for Stream chat are `getChatMessages()`, `sendChatMessage()`, `updateChatMessage()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2224
- },
2225
- {
2226
- "userQuestion": "What are best practices for handle stream chat and messaging?",
2227
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2228
- },
2229
- {
2230
- "userQuestion": "What errors should I handle when handle stream chat and messaging?",
2231
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.streamchat(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
2232
- },
2233
- {
2234
- "userQuestion": "Can you walk me through a complete handle stream chat and messaging example?",
2235
- "assistantResponse": "**Complete Workflow: Stream chat**\n\nHere's the typical flow: `getChatMessages()` → `sendChatMessage()` → `updateChatMessage()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2236
- },
2237
- {
2238
- "userQuestion": "What other methods are available for Stream chat?",
2239
- "assistantResponse": "**Additional Methods:**\n\n- `deleteChatMessage()`\n- `getChatStatus()`\n- `disableChat()`\n- `enableChat()`\n\n**Total methods in this topic:** 18\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2240
- },
2241
- {
2242
- "userQuestion": "What should I learn next after handle stream chat and messaging?",
2243
- "assistantResponse": "**Related Topics:**\n\n- **Streaming**: `explainSdkUsage({ topic: 'streaming' })`\n- **Content reactions**: `explainSdkUsage({ topic: 'content-reactions' })`\n- **Ban management**: `explainSdkUsage({ topic: 'ban-management' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2244
- },
2245
- {
2246
- "userQuestion": "Are there any advanced patterns for this topic?",
2247
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
2248
- }
2249
- ]
2250
- },
2251
- {
2252
- "topicKey": "content-flag-management",
2253
- "label": "Content flag management",
2254
- "category": "content-flags",
2255
- "description": "Report and moderate content",
2256
- "methodCount": 9,
2257
- "exchanges": [
2258
- {
2259
- "userQuestion": "How do I manage content flags?",
2260
- "assistantResponse": "\n# Content Flag Management - SDK v5.11.0+\n\nContent moderation via flags and comments. Moderators can flag content for review,\ntake action on flags (delete content, ban users), and manage pool comments.\n\n## Content Types\n\nFlags can be created for:\n- `MESSAGE` - Chat messages\n- `COMMENT` - Pool comments\n- `STREAM` - Live streams (admin only)\n\n## Creating Content Flags\n\n```typescript\nimport { createLaunchpadSDK, CONTENT_TYPE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\nawait sdk.login();\n\n// Flag a chat message\nconst flag = await sdk.createFlag({\n tokenName: 'mytoken',\n contentType: CONTENT_TYPE.MESSAGE,\n contentId: 'msg-123',\n reason: 'Spam/harassment',\n});\n\nconsole.log('Flag ID:', flag.id);\nconsole.log('Status:', flag.status); // PENDING\n```\n\n## Listing Flags\n\n```typescript\n// List all pending flags for a token\nconst flags = await sdk.listFlags({\n tokenName: 'mytoken',\n status: 'PENDING',\n page: 1,\n limit: 20,\n});\n\nfor (const flag of flags.flags) {\n console.log(`Flag #${flag.id}: ${flag.contentType}`);\n console.log(` Reason: ${flag.reason}`);\n console.log(` Reporter: ${flag.reporterAddress}`);\n}\n```\n\n## Taking Action on Flags\n\n```typescript\n// Dismiss a flag (no action taken)\nawait sdk.dismissFlag(flagId);\n\n// Take action - delete content only\nawait sdk.actionFlag(flagId, {\n action: 'DELETE_CONTENT',\n});\n\n// Take action - ban the user\nawait sdk.actionFlag(flagId, {\n action: 'BAN_USER',\n banDuration: 3600, // 1 hour ban\n});\n\n// Take action - delete content AND ban user\nawait sdk.actionFlag(flagId, {\n action: 'DELETE_AND_BAN',\n banDuration: 86400, // 24 hour ban\n});\n```\n\n## Managing Pool Comments with Reactions\n\nComments include a `messageId` for reactions integration and optional `reactions` data.\n\n```typescript\n// Fetch comments for a pool (with reactions data)\nconst comments = await sdk.getComments({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n});\n\nfor (const comment of comments.comments) {\n console.log(`ID: ${comment.id}, MessageId: ${comment.messageId}`);\n console.log(`${comment.userAddress}: ${comment.content}`);\n\n // Check reactions on this comment\n if (comment.reactions) {\n console.log(`Total reactions: ${comment.reactions.totalCount}`);\n for (const reaction of comment.reactions.reactions) {\n console.log(` ${reaction.reactionType}: ${reaction.count} (you reacted: ${reaction.userReacted})`);\n }\n }\n}\n\n// Post a comment (requires JWT auth)\nawait sdk.login();\nconst newComment = await sdk.createComment({\n tokenName: 'mytoken',\n content: 'Great project! Looking forward to the launch.',\n});\nconsole.log('Comment messageId:', newComment.comment.messageId);\n\n// Add a reaction to a comment using its messageId\nawait sdk.addReaction({\n messageId: newComment.comment.messageId,\n reaction: '👍',\n});\n\n// Remove a reaction\nawait sdk.removeReaction({\n messageId: newComment.comment.messageId,\n reaction: '👍',\n});\n\n// Delete a comment (moderator only)\nawait sdk.deleteComment({ commentId: comment.id });\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createFlag(options)` | Flag content for review | JWT |\n| `listFlags(options)` | List flags for a token | API key OR JWT (Moderator) |\n| `dismissFlag(flagId)` | Dismiss flag (no action) | API key OR JWT (Moderator) |\n| `actionFlag(flagId, options)` | Take action on flag | API key OR JWT (Moderator) |\n| `getComments(options)` | Get pool comments with reactions | None (public) |\n| `createComment(options)` | Post a comment, returns messageId | JWT |\n| `deleteComment(options)` | Delete a comment | API key OR JWT (Moderator) |\n| `addReaction(options)` | Add reaction to comment/message | JWT |\n| `removeReaction(options)` | Remove reaction from comment/message | JWT |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_flag`\n- `gala_launchpad_list_flags`\n- `gala_launchpad_dismiss_flag`\n- `gala_launchpad_action_flag`\n- `gala_launchpad_fetch_comments`\n- `gala_launchpad_post_comment`\n- `gala_launchpad_delete_comment`\n- `gala_launchpad_add_reaction`\n- `gala_launchpad_remove_reaction`\n"
2261
- },
2262
- {
2263
- "userQuestion": "What parameters does createFlag() accept?",
2264
- "assistantResponse": "The primary methods for Content flag management are `createFlag()`, `listFlags()`, `listGlobalFlags()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2265
- },
2266
- {
2267
- "userQuestion": "What are best practices for manage content flags?",
2268
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2269
- },
2270
- {
2271
- "userQuestion": "What errors should I handle when manage content flags?",
2272
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.contentflagmanagement(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
2273
- },
2274
- {
2275
- "userQuestion": "Can you walk me through a complete manage content flags example?",
2276
- "assistantResponse": "**Complete Workflow: Content flag management**\n\nHere's the typical flow: `createFlag()` → `listFlags()` → `listGlobalFlags()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2277
- },
2278
- {
2279
- "userQuestion": "What other methods are available for Content flag management?",
2280
- "assistantResponse": "**Additional Methods:**\n\n- `dismissFlag()`\n- `actionFlag()`\n- `getComments()`\n- `createComment()`\n\n**Total methods in this topic:** 9\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2281
- },
2282
- {
2283
- "userQuestion": "What should I learn next after manage content flags?",
2284
- "assistantResponse": "**Related Topics:**\n\n- **Ban management**: `explainSdkUsage({ topic: 'ban-management' })`\n- **Moderator invites**: `explainSdkUsage({ topic: 'moderator-invites' })`\n- **Overseer invites**: `explainSdkUsage({ topic: 'overseer-invites' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2285
- }
2286
- ]
2287
- },
2288
- {
2289
- "topicKey": "content-reactions",
2290
- "label": "Content reactions",
2291
- "category": "content-reactions",
2292
- "description": "Content reactions on messages and comments",
2293
- "methodCount": 6,
2294
- "exchanges": [
2295
- {
2296
- "userQuestion": "How do I manage content reactions?",
2297
- "assistantResponse": "Learn about Content reactions with the SDK. This topic covers various methods for manage content reactions."
2298
- },
2299
- {
2300
- "userQuestion": "What parameters does addContentReaction() accept?",
2301
- "assistantResponse": "The primary methods for Content reactions are `addContentReaction()`, `removeContentReaction()`, `addReactionToChatMessage()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2302
- },
2303
- {
2304
- "userQuestion": "What are best practices for manage content reactions?",
2305
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2306
- },
2307
- {
2308
- "userQuestion": "Can you walk me through a complete manage content reactions example?",
2309
- "assistantResponse": "**Complete Workflow: Content reactions**\n\nHere's the typical flow: `addContentReaction()` → `removeContentReaction()` → `addReactionToChatMessage()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2310
- },
2311
- {
2312
- "userQuestion": "What other methods are available for Content reactions?",
2313
- "assistantResponse": "**Additional Methods:**\n\n- `removeReactionFromChatMessage()`\n- `addReactionToComment()`\n- `removeReactionFromComment()`\n\n**Total methods in this topic:** 6\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2314
- },
2315
- {
2316
- "userQuestion": "What should I learn next after manage content reactions?",
2317
- "assistantResponse": "**Related Topics:**\n\n- **Stream chat**: `explainSdkUsage({ topic: 'stream-chat' })`\n- **Content flag management**: `explainSdkUsage({ topic: 'content-flag-management' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2318
- }
2319
- ]
2320
- },
2321
- {
2322
- "topicKey": "dex-trading",
2323
- "label": "Dex trading",
2324
- "category": "dex",
2325
- "description": "GalaSwap quotes, swaps, and user assets",
2326
- "methodCount": 6,
2327
- "exchanges": [
2328
- {
2329
- "userQuestion": "How do I trade tokens on GalaSwap?",
2330
- "assistantResponse": "\n## DEX Trading with SDK - GalaSwap Integration\n\n**Covers Methods:**\n- `getSwapQuoteExactInput()`\n- `getSwapQuoteExactOutput()`\n- `executeSwap()`\n- `getSwapUserAssets()`\n- `getAllSwapUserAssets()`\n- `getSwapPoolInfo()`\n\nTrade graduated tokens on the GalaSwap DEX with real-time WebSocket monitoring:\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function dexTradingExample() {\n // 1. Initialize SDK with wallet\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n env: 'production'\n });\n\n // ============================================================================\n // QUOTES: Get pricing information (read-only operations)\n // ============================================================================\n\n // Quote 1: Exact input (spend known GALA amount)\n const quoteIn = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');\n console.log('Spend 100 GALA → get ~' + quoteIn.estimatedOutput + ' GUSDC');\n console.log('Price impact: ' + quoteIn.priceImpact + '%');\n console.log('Fee tier: ' + quoteIn.feeTier + ' bps');\n\n // Quote 2: Exact output (get known token amount)\n const quoteOut = await sdk.getSwapQuoteExactOutput('GALA', 'GUSDC', '100');\n console.log('Get exactly 100 GUSDC → need ~' + quoteOut.inputAmount + ' GALA');\n\n // ============================================================================\n // EXECUTE: Perform the swap with slippage protection\n // ============================================================================\n\n const result = await sdk.executeSwap(\n 'GALA', // from token\n 'GUSDC', // to token\n '100', // input amount (100 GALA)\n quoteIn.estimatedOutput, // Use quote's output!\n quoteIn.feeTier, // Use quote's fee tier!\n 0.01 // 1% slippage tolerance\n );\n\n console.log('Transaction ID: ' + result.transactionId);\n console.log('Status: ' + result.status);\n console.log('Received: ' + result.outputAmount + ' ' + result.toToken);\n\n // ============================================================================\n // PORTFOLIO: Check balances and assets\n // ============================================================================\n\n const assets = await sdk.getSwapUserAssets(sdk.getEthereumAddress());\n console.log('Assets in wallet:');\n assets.forEach(asset => {\n console.log(' ' + asset.symbol + ': ' + asset.balance);\n });\n\n // ============================================================================\n // PORTFOLIO: Get ALL assets (auto-paginated)\n // ============================================================================\n\n const allAssets = await sdk.getAllSwapUserAssets(sdk.getEthereumAddress());\n console.log('Complete asset portfolio:');\n console.log('Total assets: ' + allAssets.length);\n allAssets.forEach(asset => {\n console.log(' ' + asset.symbol + ': ' + asset.balance);\n });\n\n // ============================================================================\n // POOL INFO: Check liquidity before trading\n // ============================================================================\n\n const pool = await sdk.getSwapPoolInfo('GALA', 'GUSDC');\n console.log('GALA↔GUSDC Pool Info:');\n console.log(' Liquidity: ' + pool.liquidity);\n console.log(' Available fee tiers: ' + pool.feeTiers.join(', ') + ' bps');\n console.log(' 24h swaps: ' + pool.swapCount);\n}\n```\n\n**Key Architecture:**\n- **Unified WebSocket**: Uses LaunchpadSDK's unified WebSocket for transaction monitoring\n- **Environment Alignment**: STAGE/PROD URLs must match between LaunchpadSDK and GSwapService\n- **Token Formats**:\n - **Launchpad bonding curve**: Use `tokenName` (lowercase simple symbols like 'anime', 'dragon')\n - **DEX trading**: Use `tokenId` (pipe-delimited format like 'GALA|Unit|none|none', 'GUSDC|Unit|none|eth:0x...')\n- **Slippage Protection**: Always use quote values for execution\n- **Fee Tiers**: 500 (0.05%), 3000 (0.30%), 10000 (1.00%)\n- **Auto-Pagination**: Use `getAllSwapUserAssets()` for complete portfolio\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_swap_quote_exact_input`\n- `gala_launchpad_get_swap_quote_exact_output`\n- `gala_launchpad_execute_swap`\n- `gala_launchpad_get_swap_user_assets`\n- `gala_launchpad_get_all_swap_user_assets`\n- `gala_launchpad_get_swap_pool_info`\n"
2331
- },
2332
- {
2333
- "userQuestion": "What parameters does getSwapQuoteExactInput() accept?",
2334
- "assistantResponse": "The primary methods for Dex trading are `getSwapQuoteExactInput()`, `getSwapQuoteExactOutput()`, `executeSwap()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2335
- },
2336
- {
2337
- "userQuestion": "What are best practices for trade tokens on GalaSwap?",
2338
- "assistantResponse": "1. **Get quotes first**: Always call `getSwapQuoteExactInput()` or `getSwapQuoteExactOutput()` before executing.\n2. **Check slippage**: DEX trades can have significant slippage on large orders.\n3. **Monitor gas**: DEX operations may require more gas for complex routes."
2339
- },
2340
- {
2341
- "userQuestion": "What errors should I handle when trade tokens on GalaSwap?",
2342
- "assistantResponse": "**Common Errors:**\n- `InsufficientLiquidity`: Not enough liquidity in pool for your trade size\n- `PriceImpactTooHigh`: Large orders cause significant slippage\n- `InvalidFeeTier`: Use 500, 3000, or 10000 for fee tier\n\n**Best Practice:** Start with smaller amounts and check price impact."
2343
- },
2344
- {
2345
- "userQuestion": "Can you walk me through a complete trade tokens on GalaSwap example?",
2346
- "assistantResponse": "**Complete Workflow: Dex trading**\n\nHere's the typical flow: `getSwapQuoteExactInput()` → `getSwapQuoteExactOutput()` → `executeSwap()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2347
- },
2348
- {
2349
- "userQuestion": "What edge cases should I know about for trade tokens on GalaSwap?",
2350
- "assistantResponse": "**Edge Cases:**\n1. **Multi-hop routes**: Some token pairs require routing through GALA\n2. **Fee tiers**: Different pools may have different fees (500, 3000, 10000 bps)\n3. **Minimum output**: Set reasonable minimums to avoid dust trades\n\n**Gotcha:** Price quotes are valid for a limited time - execute promptly!"
2351
- },
2352
- {
2353
- "userQuestion": "What other methods are available for Dex trading?",
2354
- "assistantResponse": "**Additional Methods:**\n\n- `getSwapUserAssets()`\n- `getAllSwapUserAssets()`\n- `getSwapPoolInfo()`\n\n**Total methods in this topic:** 6\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2355
- },
2356
- {
2357
- "userQuestion": "When would I actually use trade tokens on GalaSwap in a real application?",
2358
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Token Swaps**: Exchange between any supported tokens\n2. **Graduated Token Trading**: Trade tokens after bonding curve completion\n3. **Stablecoin Conversion**: Swap volatile tokens for GUSDC\n4. **Portfolio Diversification**: Spread holdings across multiple assets"
2359
- },
2360
- {
2361
- "userQuestion": "What should I learn next after trade tokens on GalaSwap?",
2362
- "assistantResponse": "**Related Topics:**\n\n- **Liquidity positions**: `explainSdkUsage({ topic: 'liquidity-positions' })`\n- **Fetch dex pools**: `explainSdkUsage({ topic: 'fetch-dex-pools' })`\n- **Advanced dex analysis**: `explainSdkUsage({ topic: 'advanced-dex-analysis' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2363
- }
2364
- ]
2365
- },
2366
- {
2367
- "topicKey": "fetch-all-dex-seasons",
2368
- "label": "Fetch all dex seasons",
2369
- "category": "dex-analytics",
2370
- "description": "Leaderboards and volume metrics",
2371
- "methodCount": 1,
2372
- "exchanges": [
2373
- {
2374
- "userQuestion": "How do I fetch DEX leaderboard seasons?",
2375
- "assistantResponse": "\n## DEX Leaderboard Seasons Management\n\n**Covers Methods:**\n- `fetchAllDexSeasons()`\n- `fetchCurrentDexSeason()`\n\nDiscover and manage DEX leaderboard seasons for competitive trading events.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageDexSeasons() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch all available seasons\n const seasons = await sdk.fetchAllDexSeasons();\n\n // Display season information\n seasons.forEach(season => {\n console.log(`Season: ${season.name} (ID: ${season.id})`);\n console.log(`Duration: ${season.start} to ${season.end}`);\n });\n\n // Get current season\n const activeSeason = await sdk.fetchCurrentDexSeason();\n if (activeSeason) {\n console.log(`Active: ${activeSeason.name}`);\n } else {\n console.log('No active season (between seasons)');\n }\n\n // Verify season is active\n const now = new Date();\n const isActive = activeSeason && now >= activeSeason.start && now <= activeSeason.end;\n console.log(`Season active: ${isActive}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_all_dex_seasons`\n- `gala_launchpad_fetch_current_dex_season`\n"
2376
- },
2377
- {
2378
- "userQuestion": "What parameters does fetchAllDexSeasons() accept?",
2379
- "assistantResponse": "The primary methods for Fetch all dex seasons are `fetchAllDexSeasons()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2380
- },
2381
- {
2382
- "userQuestion": "What are best practices for fetch DEX leaderboard seasons?",
2383
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2384
- },
2385
- {
2386
- "userQuestion": "What should I learn next after fetch DEX leaderboard seasons?",
2387
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2388
- },
2389
- {
2390
- "userQuestion": "Any final tips for fetch DEX leaderboard seasons?",
2391
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2392
- }
2393
- ]
2394
- },
2395
- {
2396
- "topicKey": "fetch-current-dex-leaderboard",
2397
- "label": "Fetch current dex leaderboard",
2398
- "category": "dex-analytics",
2399
- "description": "Leaderboards and volume metrics",
2400
- "methodCount": 1,
2401
- "exchanges": [
2402
- {
2403
- "userQuestion": "How do I view current DEX leaderboard?",
2404
- "assistantResponse": "Learn about Fetch current dex leaderboard with the SDK. This topic covers various methods for view current DEX leaderboard."
2405
- },
2406
- {
2407
- "userQuestion": "What parameters does fetchCurrentDexLeaderboard() accept?",
2408
- "assistantResponse": "The primary methods for Fetch current dex leaderboard are `fetchCurrentDexLeaderboard()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2409
- },
2410
- {
2411
- "userQuestion": "What are best practices for view current DEX leaderboard?",
2412
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2413
- },
2414
- {
2415
- "userQuestion": "What should I learn next after view current DEX leaderboard?",
2416
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2417
- },
2418
- {
2419
- "userQuestion": "Any final tips for view current DEX leaderboard?",
2420
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2421
- }
2422
- ]
2423
- },
2424
- {
2425
- "topicKey": "fetch-current-dex-season",
2426
- "label": "Fetch current dex season",
2427
- "category": "dex-analytics",
2428
- "description": "Leaderboards and volume metrics",
2429
- "methodCount": 1,
2430
- "exchanges": [
2431
- {
2432
- "userQuestion": "How do I get current DEX season info?",
2433
- "assistantResponse": "\n## Fetch Current DEX Season\n\n**Covers Methods:**\n- `fetchCurrentDexSeason()`\n\nGet the currently active DEX leaderboard season for competitive trading.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function getCurrentSeason() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch the current active season\n const currentSeason = await sdk.fetchCurrentDexSeason();\n\n if (currentSeason) {\n console.log('Current DEX Season:');\n console.log(` Season ID: ${currentSeason.id}`);\n console.log(` Name: ${currentSeason.name}`);\n console.log(` Start: ${currentSeason.start.toISOString()}`);\n console.log(` End: ${currentSeason.end.toISOString()}`);\n\n // Check if season is currently active\n const now = new Date();\n const isActive = now >= currentSeason.start && now <= currentSeason.end;\n\n console.log(` Active: ${isActive}`);\n\n // Calculate time remaining\n const timeRemaining = currentSeason.end.getTime() - now.getTime();\n const daysRemaining = Math.floor(timeRemaining / (1000 * 60 * 60 * 24));\n\n console.log(` Days remaining: ${daysRemaining}`);\n\n // Fetch leaderboard for current season\n const leaderboard = await sdk.fetchDexLeaderboardBySeasonId(currentSeason.id);\n console.log(` Total participants: ${leaderboard.entries.length}`);\n\n // Show top 3 players\n leaderboard.entries.slice(0, 3).forEach((entry, index) => {\n console.log(` #${index + 1}: ${entry.wallet} - ${entry.totalXp} XP`);\n });\n } else {\n console.log('No active season (between seasons)');\n\n // Fetch all seasons to see when next one starts\n const allSeasons = await sdk.fetchAllDexSeasons();\n const futureSeason = allSeasons.find(s => s.start > new Date());\n\n if (futureSeason) {\n console.log(`Next season starts: ${futureSeason.start.toISOString()}`);\n }\n }\n}\n\n// Complete workflow: Check season + participate\nasync function participateInSeason() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const season = await sdk.fetchCurrentDexSeason();\n\n if (season) {\n console.log(`Active season: ${season.name}`);\n\n // Execute trades to earn XP\n const quote = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');\n const swap = await sdk.executeSwap(\n 'GALA',\n 'GUSDC',\n '100',\n quote.estimatedOutput,\n quote.feeTier,\n 0.01\n );\n\n console.log('Trade executed - XP earned!');\n\n // Check updated leaderboard position\n const leaderboard = await sdk.fetchCurrentDexLeaderboard();\n const myPosition = leaderboard?.entries.find(\n e => e.wallet === sdk.getAddress()\n );\n\n if (myPosition) {\n console.log(`Current rank: #${myPosition.rank}`);\n console.log(`Total XP: ${myPosition.totalXp}`);\n }\n } else {\n console.log('No active season - trades won't earn XP');\n }\n}\n```\n\n**Use Cases:**\n- Check if competitive trading is active\n- Display season information in UI\n- Calculate time remaining in season\n- Auto-participate in seasonal trading\n- Track seasonal leaderboard position\n\n**Related Methods:**\n- `fetchAllDexSeasons()` - Get all seasons (past, current, future)\n- `fetchDexLeaderboardBySeasonId()` - Get leaderboard for specific season\n- `fetchCurrentDexLeaderboard()` - Get current season leaderboard (convenience)\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_current_dex_season`\n"
2434
- },
2435
- {
2436
- "userQuestion": "What parameters does fetchCurrentDexSeason() accept?",
2437
- "assistantResponse": "The primary methods for Fetch current dex season are `fetchCurrentDexSeason()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2438
- },
2439
- {
2440
- "userQuestion": "What are best practices for get current DEX season info?",
2441
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2442
- },
2443
- {
2444
- "userQuestion": "What should I learn next after get current DEX season info?",
2445
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2446
- },
2447
- {
2448
- "userQuestion": "Any final tips for get current DEX season info?",
2449
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2450
- }
2451
- ]
2452
- },
2453
- {
2454
- "topicKey": "fetch-dex-aggregated-volume-summary",
2455
- "label": "Fetch dex aggregated volume summary",
2456
- "category": "dex-analytics",
2457
- "description": "Leaderboards and volume metrics",
2458
- "methodCount": 1,
2459
- "exchanges": [
2460
- {
2461
- "userQuestion": "How do I analyze DEX volume metrics?",
2462
- "assistantResponse": "\n## DEX Aggregated Volume Summary and Trends\n\n**Covers Methods:**\n- `fetchDexAggregatedVolumeSummary()`\n\nAnalyze DEX trading volume trends across different time periods.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function analyzeVolumeTrends() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get volume summary with trend metrics\n const summary = await sdk.fetchDexAggregatedVolumeSummary();\n\n // Display volumes\n console.log(`1-Day Volume: $${summary.volume1d.toLocaleString()}`);\n console.log(`7-Day Volume: $${summary.volume7d.toLocaleString()}`);\n console.log(`30-Day Volume: $${summary.volume30d.toLocaleString()}`);\n\n // Analyze trends\n const trend1d = summary.volume1dDelta > 0 ? '📈 UP' : '📉 DOWN';\n const trend7d = summary.volume7dDelta > 0 ? '📈 UP' : '📉 DOWN';\n const trend30d = summary.volume30dDelta > 0 ? '📈 UP' : '📉 DOWN';\n\n console.log(`1-Day Trend: ${trend1d} (${toBigNumberFixed(summary.volume1dDelta * 100, 2)}%)`);\n console.log(`7-Day Trend: ${trend7d} (${toBigNumberFixed(summary.volume7dDelta * 100, 2)}%)`);\n console.log(`30-Day Trend: ${trend30d} (${toBigNumberFixed(summary.volume30dDelta * 100, 2)}%)`);\n\n // Growth analysis\n if (summary.volume30dDelta > 0.1) {\n console.log('Strong growth - Platform adoption increasing');\n } else if (summary.volume30dDelta < -0.1) {\n console.log('Declining volume - Platform may be slowing');\n }\n}\n```\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_dex_aggregated_volume_summary`\n"
2463
- },
2464
- {
2465
- "userQuestion": "What parameters does fetchDexAggregatedVolumeSummary() accept?",
2466
- "assistantResponse": "The primary methods for Fetch dex aggregated volume summary are `fetchDexAggregatedVolumeSummary()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2467
- },
2468
- {
2469
- "userQuestion": "What are best practices for analyze DEX volume metrics?",
2470
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2471
- },
2472
- {
2473
- "userQuestion": "What should I learn next after analyze DEX volume metrics?",
2474
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2475
- },
2476
- {
2477
- "userQuestion": "Any final tips for analyze DEX volume metrics?",
2478
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2479
- }
2480
- ]
2481
- },
2482
- {
2483
- "topicKey": "fetch-dex-leaderboard-by-season-id",
2484
- "label": "Fetch dex leaderboard by season id",
2485
- "category": "dex-analytics",
2486
- "description": "Leaderboards and volume metrics",
2487
- "methodCount": 1,
2488
- "exchanges": [
2489
- {
2490
- "userQuestion": "How do I view DEX leaderboard rankings?",
2491
- "assistantResponse": "\n## DEX Leaderboard Rankings by Season\n\n**Covers Methods:**\n- `fetchDexLeaderboardBySeasonId()`\n- `fetchCurrentDexLeaderboard()`\n\nQuery leaderboard rankings for competitive DEX trading seasons.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function viewLeaderboards() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Option 1: Fetch leaderboard for specific season\n const leaderboard = await sdk.fetchDexLeaderboardBySeasonId(4);\n\n // Display top 10 ranked players\n console.log(`Season ${leaderboard.seasonId} - Top 10 Players:`);\n leaderboard.entries.slice(0, 10).forEach(entry => {\n console.log(` ${entry.rank}. ${entry.wallet}`);\n console.log(` XP: ${entry.totalXp} (Liquidity: ${entry.liquidityXp}, Trading: ${entry.tradingXp})`);\n });\n\n // Analyze mastery titles\n const topPlayer = leaderboard.entries[0];\n topPlayer.masteryTitles.forEach(title => {\n console.log(` 🏆 ${title.name} (Type: ${title.type}, Tier: ${title.order})`);\n });\n\n // Option 2: Get current leaderboard (convenience method)\n const currentBoard = await sdk.fetchCurrentDexLeaderboard();\n\n if (currentBoard) {\n console.log(`Season ${currentBoard.seasonId} is active`);\n console.log(`Total participants: ${currentBoard.entries.length}`);\n\n // Top 3 performers\n const topThree = currentBoard.entries.slice(0, 3);\n topThree.forEach(entry => {\n console.log(` #${entry.rank}: ${entry.totalXp} XP`);\n });\n }\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_dex_leaderboard_by_season_id`\n- `gala_launchpad_fetch_current_dex_leaderboard`\n"
2492
- },
2493
- {
2494
- "userQuestion": "What parameters does fetchDexLeaderboardBySeasonId() accept?",
2495
- "assistantResponse": "The primary methods for Fetch dex leaderboard by season id are `fetchDexLeaderboardBySeasonId()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2496
- },
2497
- {
2498
- "userQuestion": "What are best practices for view DEX leaderboard rankings?",
2499
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2500
- },
2501
- {
2502
- "userQuestion": "What should I learn next after view DEX leaderboard rankings?",
2503
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2504
- },
2505
- {
2506
- "userQuestion": "Any final tips for view DEX leaderboard rankings?",
2507
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2508
- }
2509
- ]
2510
- },
2511
- {
2512
- "topicKey": "advanced-dex-analysis",
2513
- "label": "Advanced dex analysis",
2514
- "category": "dex-pools",
2515
- "description": "DEX pool discovery and information",
2516
- "methodCount": 4,
2517
- "exchanges": [
2518
- {
2519
- "userQuestion": "How do I analyze DEX trading data?",
2520
- "assistantResponse": "\n## Advanced DEX Pool Analysis with SDK\n\n**Covers Methods:**\n- `fetchCompositePoolData()`\n- `calculateDexPoolQuoteExactAmountLocal()`\n- `calculateDexPoolQuoteExactAmountExternal()`\n- `calculateDexPoolQuoteExactAmount()`\n\nThis workflow demonstrates analyzing graduated tokens using composite data and price calculations.\n\n**Use Cases:**\n- Arbitrage opportunity detection\n- Price impact analysis before large trades\n- Comparing bonding curve vs DEX pricing\n- Smart routing for best execution\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function advancedDexAnalysis() {\n const sdk = createLaunchpadSDK({ environment: 'production' });\n\n // Step 1: Get composite pool data (bonding curve + DEX if graduated)\n const composite = await sdk.fetchCompositePoolData('anime');\n\n if (composite.isGraduated) {\n console.log('Token graduated to DEX!');\n console.log('DEX Pool TVL:', composite.dexPool.tvl);\n console.log('DEX 24h Volume:', composite.dexPool.volume1d);\n }\n\n // Step 2: Compare local vs external price calculations\n const localQuote = await sdk.calculateDexPoolQuoteExactAmountLocal(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n const externalQuote = await sdk.calculateDexPoolQuoteExactAmountExternal(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n console.log('Local calculation:', localQuote.outputAmount);\n console.log('External API:', externalQuote.outputAmount);\n console.log('Price difference:',\n Math.abs(safeParseFloat(localQuote.outputAmount, 0) - safeParseFloat(externalQuote.outputAmount, 0))\n );\n\n // Step 3: Use smart routing for best price\n const bestQuote = await sdk.calculateDexPoolQuoteExactAmount(\n 'GALA|Unit|none|none',\n 'anime|Unit|none|eth:0x...',\n '100'\n );\n\n console.log('Best route:', bestQuote.route); // 'local' or 'external'\n console.log('Best price:', bestQuote.outputAmount);\n}\n```\n\n**MCP Tools:**\n- `gala_launchpad_fetch_composite_pool_data`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount_local`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount_external`\n- `gala_launchpad_calculate_dex_pool_quote_exact_amount`\n"
2521
- },
2522
- {
2523
- "userQuestion": "What parameters does fetchCompositePoolData() accept?",
2524
- "assistantResponse": "The primary methods for Advanced dex analysis are `fetchCompositePoolData()`, `calculateDexPoolQuoteExactAmountLocal()`, `calculateDexPoolQuoteExactAmountExternal()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2525
- },
2526
- {
2527
- "userQuestion": "What are best practices for analyze DEX trading data?",
2528
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2529
- },
2530
- {
2531
- "userQuestion": "Can you walk me through a complete analyze DEX trading data example?",
2532
- "assistantResponse": "**Complete Workflow: Advanced dex analysis**\n\nHere's the typical flow: `fetchCompositePoolData()` → `calculateDexPoolQuoteExactAmountLocal()` → `calculateDexPoolQuoteExactAmountExternal()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2533
- },
2534
- {
2535
- "userQuestion": "What should I learn next after analyze DEX trading data?",
2536
- "assistantResponse": "**Related Topics:**\n\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Liquidity positions**: `explainSdkUsage({ topic: 'liquidity-positions' })`\n- **Fetch dex pools**: `explainSdkUsage({ topic: 'fetch-dex-pools' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2537
- }
2538
- ]
2539
- },
2540
- {
2541
- "topicKey": "dex-token-discovery",
2542
- "label": "Dex token discovery",
2543
- "category": "dex-pools",
2544
- "description": "DEX pool discovery and information",
2545
- "methodCount": 2,
2546
- "exchanges": [
2547
- {
2548
- "userQuestion": "How do I discover tokens on DEX?",
2549
- "assistantResponse": "\n## DEX Token Discovery with SDK\n\n**Covers Methods:**\n- `fetchAvailableDexTokens()`\n- `fetchAllAvailableDexTokens()`\n\nDiscover all tokens available for trading on GalaSwap DEX with rich metadata.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function discoverDexTokens() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Option 1: Paginated token discovery\n const tokens = await sdk.fetchAvailableDexTokens({\n search: 'GALA', // Optional search filter\n page: 1,\n limit: 20\n });\n\n console.log(`Found ${tokens.total} tokens, page ${tokens.page} of ${tokens.totalPages}`);\n tokens.items.forEach(token => {\n console.log(`${token.symbol}: ${token.name} (decimals: ${token.decimals})`);\n });\n\n // Option 2: Fetch ALL tokens (auto-pagination)\n const allTokens = await sdk.fetchAllAvailableDexTokens();\n console.log(`Total DEX tokens: ${allTokens.length}`);\n\n // Option 3: Search for specific tokens\n const searchResults = await sdk.fetchAllAvailableDexTokens({ search: 'USD' });\n console.log('USD-related tokens:', searchResults.map(t => t.symbol));\n}\n```\n\n**Token Metadata Includes:**\n- Symbol and full name\n- Decimal precision\n- Token class key (collection, category, type, additionalKey)\n- Verification status\n- Trading availability\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_available_dex_tokens`\n- `gala_launchpad_fetch_all_available_dex_tokens`\n"
2550
- },
2551
- {
2552
- "userQuestion": "What parameters does fetchAvailableDexTokens() accept?",
2553
- "assistantResponse": "The primary methods for Dex token discovery are `fetchAvailableDexTokens()`, `fetchAllAvailableDexTokens()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2554
- },
2555
- {
2556
- "userQuestion": "What are best practices for discover tokens on DEX?",
2557
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2558
- },
2559
- {
2560
- "userQuestion": "What should I learn next after discover tokens on DEX?",
2561
- "assistantResponse": "**Related Topics:**\n\n- **Fetch dex pools**: `explainSdkUsage({ topic: 'fetch-dex-pools' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Token details**: `explainSdkUsage({ topic: 'token-details' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2562
- },
2563
- {
2564
- "userQuestion": "Any final tips for discover tokens on DEX?",
2565
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2566
- }
2567
- ]
2568
- },
2569
- {
2570
- "topicKey": "fetch-dex-pools",
2571
- "label": "Fetch dex pools",
2572
- "category": "dex-pools",
2573
- "description": "DEX pool discovery and information",
2574
- "methodCount": 2,
2575
- "exchanges": [
2576
- {
2577
- "userQuestion": "How do I fetch dex pools?",
2578
- "assistantResponse": "\n## Fetch DEX Pools with Pagination\n\n**Covers Methods:**\n- `fetchDexPools()`\n- `fetchAllDexPools()`\n\nDiscover and query liquidity pools on GalaSwap with advanced filtering and pagination.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function queryDexPools() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Option 1: Fetch pools with pagination\n const pools = await sdk.fetchDexPools({\n search: 'GALA',\n sortBy: 'tvl', // Sort by: tvl, volume30d, volume1d\n limit: 20,\n page: 1\n });\n\n console.log(`Found ${pools.total} pools, page ${pools.page} of ${pools.totalPages}`);\n pools.pools.forEach(pool => {\n console.log(`${pool.tokenName}: TVL ${pool.tvl}, 24h Volume: ${pool.volume1d}`);\n });\n\n // Option 2: Fetch ALL pools automatically (handles pagination)\n const allPools = await sdk.fetchAllDexPools({\n sortBy: 'tvl'\n });\n\n console.log(`Total pools: ${allPools.pools.length}`);\n\n // Analyze pool metrics\n const avgTvl = allPools.pools.reduce((sum, p) => sum + safeParseFloat(p.tvl, 0), 0) / allPools.pools.length;\n console.log(`Average TVL: $${toBigNumberFixed(avgTvl, 2)}`);\n}\n```\n\n**Key Features:**\n- **Sorting**: TVL (total value locked), volume30d (30-day volume), volume1d (24-hour volume)\n- **Pool Metrics**: Token prices, fee tiers, liquidity, 24h/30d volume, APR\n- **Auto-Pagination**: `fetchAllDexPools()` handles pagination automatically\n- **Search**: Filter by token name or pair\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_dex_pools`\n- `gala_launchpad_fetch_all_dex_pools`\n"
2579
- },
2580
- {
2581
- "userQuestion": "What parameters does fetchDexPools() accept?",
2582
- "assistantResponse": "The primary methods for Fetch dex pools are `fetchDexPools()`, `fetchAllDexPools()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2583
- },
2584
- {
2585
- "userQuestion": "What are best practices for fetch dex pools?",
2586
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2587
- },
2588
- {
2589
- "userQuestion": "What should I learn next after fetch dex pools?",
2590
- "assistantResponse": "**Related Topics:**\n\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Liquidity positions**: `explainSdkUsage({ topic: 'liquidity-positions' })`\n- **Dex token discovery**: `explainSdkUsage({ topic: 'dex-token-discovery' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2591
- },
2592
- {
2593
- "userQuestion": "Any final tips for fetch dex pools?",
2594
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2595
- }
2596
- ]
2597
- },
2598
- {
2599
- "topicKey": "locks",
2600
- "label": "Locks",
2601
- "category": "locks",
2602
- "description": "Token lock and unlock operations",
2603
- "methodCount": 4,
2604
- "exchanges": [
2605
- {
2606
- "userQuestion": "How do I lock and unlock tokens?",
2607
- "assistantResponse": "\n## Token Locking, Unlocking, and Burning with SDK\n\n**Covers Methods:**\n- `lockTokens()` - Lock one or more token types in a single transaction\n- `unlockTokens()` - Unlock one or more token types in a single transaction\n- `burnTokens()` - Permanently destroy tokens (IRREVERSIBLE)\n- `fetchLockedBalance()` - Query locked token balances with hold details\n\nLock, unlock, and burn tokens on GalaChain for staking, escrow, vesting, or token management.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function tokenLockingAndBurning() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // ============================================================================\n // LOCK TOKENS - Single token (batch API wraps single token)\n // ============================================================================\n\n // Lock 1000 tokens with default options (caller is lock authority)\n const lockResult = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '1000'\n }]\n });\n\n console.log('Lock transaction ID:', lockResult.transactionId);\n console.log('Locked entries:', lockResult.locked);\n\n // ============================================================================\n // LOCK TOKENS - Multiple tokens in one transaction (batch)\n // ============================================================================\n\n // Lock multiple token types atomically\n const batchLock = await sdk.lockTokens({\n tokens: [\n { tokenName: 'anime', amount: '500' },\n { tokenName: 'dragon', amount: '200' },\n { tokenName: 'mystic', amount: '100', lockAuthority: 'eth|0x1234...' }\n ]\n });\n\n console.log('Batch lock completed:', batchLock.locked.length, 'tokens locked');\n\n // ============================================================================\n // LOCK TOKENS - Advanced options\n // ============================================================================\n\n // Lock with custom lock authority (another address can unlock)\n const escrowLock = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '500',\n lockAuthority: 'eth|0x1234...', // Escrow agent address\n name: 'escrow-payment-001', // Identifier for matching during unlock\n expires: Date.now() + 30 * 24 * 60 * 60 * 1000 // Auto-release in 30 days\n }]\n });\n\n console.log('Escrow lock created');\n\n // Lock for time-based vesting\n const vestingLock = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '10000',\n name: 'vesting-q1-2025',\n expires: new Date('2025-04-01').getTime() // Auto-unlock on April 1st\n }]\n });\n\n console.log('Vesting lock created with expiry');\n\n // ============================================================================\n // UNLOCK TOKENS - Release locked tokens\n // ============================================================================\n\n // Unlock tokens (must be called by lock authority)\n const unlockResult = await sdk.unlockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '500'\n }]\n });\n\n console.log('Unlock transaction ID:', unlockResult.transactionId);\n console.log('Unlocked entries:', unlockResult.unlocked);\n\n // Unlock multiple tokens in one transaction\n const batchUnlock = await sdk.unlockTokens({\n tokens: [\n { tokenName: 'anime', amount: '500' },\n { tokenName: 'dragon', amount: '200', name: 'escrow-payment-001' }\n ]\n });\n\n console.log('Batch unlock completed');\n\n // ============================================================================\n // BURN TOKENS - Permanently destroy (IRREVERSIBLE!)\n // ============================================================================\n\n // WARNING: Burn operations are permanent and cannot be undone!\n const burnResult = await sdk.burnTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '100'\n }]\n });\n\n console.log('Burn transaction ID:', burnResult.transactionId);\n console.log('Burned:', burnResult.burned);\n\n // Batch burn multiple token types\n const batchBurn = await sdk.burnTokens({\n tokens: [\n { tokenName: 'anime', amount: '50' },\n { tokenName: 'oldtoken', amount: '1000' } // Clean up deprecated tokens\n ]\n });\n\n console.log('Batch burn completed:', batchBurn.burned.length, 'token types burned');\n\n // ============================================================================\n // QUERY LOCKED TOKENS - Check lock status\n // ============================================================================\n\n const lockedTokens = await sdk.fetchLockedBalance({\n tokenName: 'anime',\n address: sdk.getAddress()\n });\n\n console.log('Locked quantity:', lockedTokens.lockedQuantity);\n console.log('Active holds:', lockedTokens.holds);\n\n // Each hold contains: lockAuthority, expires, name, quantity\n for (const hold of lockedTokens.holds) {\n console.log(` - ${hold.quantity} locked by ${hold.lockAuthority}`);\n if (hold.expires) console.log(` Expires: ${new Date(hold.expires)}`);\n if (hold.name) console.log(` Name: ${hold.name}`);\n }\n\n // ============================================================================\n // STAKING WORKFLOW EXAMPLE\n // ============================================================================\n\n async function stakingWorkflow() {\n // Step 1: Lock tokens for staking period\n const stake = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '5000',\n name: 'staking-period-1',\n expires: Date.now() + 90 * 24 * 60 * 60 * 1000 // 90-day staking period\n }]\n });\n\n console.log('Staked 5000 tokens for 90 days');\n\n // Step 2: After staking period expires, unlock\n const unstake = await sdk.unlockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '5000',\n name: 'staking-period-1'\n }]\n });\n\n console.log('Unstaked tokens after staking period');\n return { stake, unstake };\n }\n\n // ============================================================================\n // ESCROW WORKFLOW EXAMPLE\n // ============================================================================\n\n async function escrowWorkflow(buyerAddress: string, sellerAddress: string) {\n // Step 1: Buyer locks payment in escrow (seller is lock authority)\n const escrow = await sdk.lockTokens({\n tokens: [{\n tokenName: 'anime',\n amount: '1000',\n lockAuthority: sellerAddress, // Seller can release upon delivery\n name: 'order-12345'\n }]\n });\n\n console.log('Escrow created: seller can release payment upon delivery');\n\n // Step 2: Seller releases escrow after delivery (seller calls unlock)\n // This would be executed by the seller's SDK instance\n // const release = await sellerSdk.unlockTokens({\n // tokens: [{ tokenName: 'anime', amount: '1000', name: 'order-12345' }]\n // });\n\n return escrow;\n }\n}\n```\n\n**Key Features:**\n- **Batch Operations**: Lock/unlock/burn multiple token types in one transaction\n- **Lock Authority**: Specify who can unlock (defaults to caller)\n- **Expiration**: Optional auto-release timestamp for time-based vesting\n- **Named Locks**: Use `name` to identify specific locks for targeted unlocks\n- **EIP-712 Signatures**: Secure blockchain transactions\n- **Error Handling**: `LockError` and `BurnError` classes with specific error types\n\n**Lock Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to lock (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to lock |\n| `lockAuthority` | No | Address that can unlock (defaults to caller) |\n| `expires` | No | Timestamp in ms for auto-unlock |\n| `name` | No | Identifier for matching during unlock |\n\n*Either `tokenName` or `tokenId` required\n\n**Unlock Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to unlock (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to unlock |\n| `name` | No | Lock name to match (if used during lock) |\n\n**Burn Parameters (per token in array):**\n| Parameter | Required | Description |\n|-----------|----------|-------------|\n| `tokenName` | Yes* | Token to burn (e.g., 'anime') |\n| `tokenId` | Yes* | Alternative: TokenClassKey or pipe-delimited string |\n| `amount` | Yes | Amount of tokens to burn (PERMANENT!) |\n\n**Use Cases:**\n- **Staking**: Lock tokens for rewards/governance\n- **Escrow**: Third-party controlled releases\n- **Vesting**: Time-based token releases\n- **Governance**: Lock tokens for voting power\n- **Token Retirement**: Permanently burn deprecated tokens\n- **Deflationary Mechanics**: Reduce supply via burns\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_lock_tokens` (batch)\n- `gala_launchpad_unlock_tokens` (batch)\n- `gala_launchpad_burn_tokens` (batch)\n- `gala_launchpad_fetch_locked_tokens`\n"
2608
- },
2609
- {
2610
- "userQuestion": "What parameters does lockTokens() accept?",
2611
- "assistantResponse": "The primary methods for Locks are `lockTokens()`, `unlockTokens()`, `burnTokens()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2612
- },
2613
- {
2614
- "userQuestion": "What are best practices for lock and unlock tokens?",
2615
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2616
- },
2617
- {
2618
- "userQuestion": "What errors should I handle when lock and unlock tokens?",
2619
- "assistantResponse": "**Common Errors:**\n- `InsufficientUnlockedBalance`: Can't lock more than available\n- `LockNotFound`: No lock exists to unlock\n- `UnauthorizedUnlock`: Only lock authority can unlock\n\n**Remember:** Burns are irreversible!"
2620
- },
2621
- {
2622
- "userQuestion": "Can you walk me through a complete lock and unlock tokens example?",
2623
- "assistantResponse": "**Complete Workflow: Locks**\n\nHere's the typical flow: `lockTokens()` → `unlockTokens()` → `burnTokens()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2624
- },
2625
- {
2626
- "userQuestion": "What should I learn next after lock and unlock tokens?",
2627
- "assistantResponse": "**Related Topics:**\n\n- **Transfers**: `explainSdkUsage({ topic: 'transfers' })`\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n- **Burns**: `explainSdkUsage({ topic: 'burns' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2628
- }
2629
- ]
2630
- },
2631
- {
2632
- "topicKey": "moderator-invites",
2633
- "label": "Moderator invites",
2634
- "category": "moderators",
2635
- "description": "Moderator invites and access",
2636
- "methodCount": 7,
2637
- "exchanges": [
2638
- {
2639
- "userQuestion": "How do I manage moderator invites?",
2640
- "assistantResponse": "\n# Moderator Invites - SDK v5.7.0+\n\nMagic link-based moderator delegation system. Token owners can create invite\nlinks to grant stream management access to other users without needing their\nwallet address upfront.\n\n## Flow Overview\n\n1. **Owner creates invite** → Gets magic link URL\n2. **Owner shares link** (email, Slack, Discord, etc.)\n3. **Recipient clicks link** → Redirected to claim page\n4. **Recipient logs in** → Claims invite with their wallet\n5. **Recipient gains access** → Token appears in their /studio dashboard\n\n## Creating Moderator Invites\n\n```typescript\nimport { createLaunchpadSDK, MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\n\n// MUST authenticate first\nawait sdk.login();\n\n// Create an invite for a moderator\nconst result = await sdk.createModeratorInvite({\n tokenName: 'mytoken',\n role: MODERATOR_ROLE.MODERATOR,\n description: 'John - Friday stream moderator',\n expiresAt: '2025-12-31T23:59:59Z', // Optional expiration\n});\n\n// Share this URL with the intended moderator\nconsole.log('Invite URL:', result.invite.inviteUrl);\nconsole.log('Invite Code:', result.invite.inviteCode);\nconsole.log('Status:', result.invite.status); // PENDING\n```\n\n## Moderator Roles\n\n```typescript\nimport { MODERATOR_ROLE } from '@gala-chain/launchpad-sdk';\n\n// Available roles (OWNER not available for invites)\nMODERATOR_ROLE.MODERATOR // Chat, comments, bans\nMODERATOR_ROLE.TECHNICAL_PRODUCER // Simulcast, stream key, stop/start\nMODERATOR_ROLE.MANAGER // All of the above + recordings + stream settings\n```\n\n## Listing Invites\n\n```typescript\n// List all invites for a token (owner only)\nconst list = await sdk.listModeratorInvites({\n tokenName: 'mytoken',\n status: 'PENDING', // Optional filter: PENDING, CLAIMED, REVOKED, EXPIRED\n page: 1,\n limit: 20,\n});\n\nconsole.log('Total invites:', list.meta.totalItems);\n\nfor (const invite of list.invites) {\n console.log(`- ID ${invite.id}: ${invite.role}`);\n console.log(` Status: ${invite.status}`);\n console.log(` Description: ${invite.description || 'None'}`);\n console.log(` Created: ${invite.createdAt}`);\n console.log(` Expires: ${invite.expiresAt || 'Never'}`);\n}\n```\n\n## Claiming Invites (Recipient Side)\n\n```typescript\n// Extract code from magic link URL\nconst inviteCode = 'abc123...'; // 64-character hex code\n\n// Recipient authenticates and claims\nawait sdk.login();\n\nconst result = await sdk.claimModeratorInvite({\n inviteCode: inviteCode,\n});\n\nconsole.log('Claimed token:', result.token.tokenName);\nconsole.log('Your role:', result.token.role);\nconsole.log('Claimed at:', result.token.claimedAt);\n// Token now appears in /studio dashboard\n```\n\n## Previewing Invites (Public)\n\n```typescript\n// Preview invite details before logging in (public endpoint)\nconst preview = await sdk.getModeratorInviteByCode('abc123...');\n\nconsole.log('Token:', preview.tokenName);\nconsole.log('Symbol:', preview.tokenSymbol);\nconsole.log('Role offered:', preview.role);\nconsole.log('Status:', preview.status);\nconsole.log('Invited by:', preview.invitedBy.fullName);\n```\n\n## Getting Moderated Tokens (Studio Dashboard)\n\n```typescript\n// Get all tokens where you have moderator access\nawait sdk.login();\n\nconst tokens = await sdk.getModeratedTokens({\n page: 1,\n limit: 20,\n});\n\nfor (const token of tokens.tokens) {\n console.log(`- ${token.tokenName} (${token.tokenSymbol})`);\n console.log(` Role: ${token.role}`);\n console.log(` Stream status: ${token.muxStreamStatus}`);\n}\n```\n\n## Revoking Invites\n\n```typescript\n// Revoke by invite ID (owner only)\nawait sdk.revokeModeratorInvite(123);\nconsole.log('Invite revoked');\n\n// If already claimed, moderator loses access immediately\n// If pending, invite can no longer be claimed\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createModeratorInvite(options)` | Create magic link invite | JWT (owner) |\n| `claimModeratorInvite(options)` | Claim invite with code | JWT |\n| `getModeratedTokens(options?)` | Get tokens you moderate | JWT |\n| `listModeratorInvites(options)` | List invites for token | JWT (owner) |\n| `revokeModeratorInvite(id)` | Revoke invite by ID | JWT (owner) |\n| `getModeratorInviteByCode(code)` | Preview invite details | None |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_moderator_invite`\n- `gala_launchpad_claim_moderator_invite`\n- `gala_launchpad_get_moderated_tokens`\n- `gala_launchpad_list_moderator_invites`\n- `gala_launchpad_revoke_moderator_invite`\n- `gala_launchpad_get_moderator_invite`\n"
2641
- },
2642
- {
2643
- "userQuestion": "What parameters does createModeratorInvite() accept?",
2644
- "assistantResponse": "The primary methods for Moderator invites are `createModeratorInvite()`, `claimModeratorInvite()`, `getModeratedTokens()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2645
- },
2646
- {
2647
- "userQuestion": "What are best practices for manage moderator invites?",
2648
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2649
- },
2650
- {
2651
- "userQuestion": "What errors should I handle when manage moderator invites?",
2652
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.moderatorinvites(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
2653
- },
2654
- {
2655
- "userQuestion": "Can you walk me through a complete manage moderator invites example?",
2656
- "assistantResponse": "**Complete Workflow: Moderator invites**\n\nHere's the typical flow: `createModeratorInvite()` → `claimModeratorInvite()` → `getModeratedTokens()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2657
- },
2658
- {
2659
- "userQuestion": "What other methods are available for Moderator invites?",
2660
- "assistantResponse": "**Additional Methods:**\n\n- `listModeratorInvites()`\n- `revokeModeratorInvite()`\n- `getModeratorInviteByCode()`\n- `updateModeratorInviteRole()`\n\n**Total methods in this topic:** 7\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2661
- },
2662
- {
2663
- "userQuestion": "When would I actually use manage moderator invites in a real application?",
2664
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Community Moderation**: Delegate chat moderation to trusted members\n2. **Technical Teams**: Give stream control to production staff\n3. **Multi-Admin Setup**: Multiple managers for large communities\n4. **Temporary Access**: Time-limited invites for events"
2665
- },
2666
- {
2667
- "userQuestion": "What should I learn next after manage moderator invites?",
2668
- "assistantResponse": "**Related Topics:**\n\n- **Overseer invites**: `explainSdkUsage({ topic: 'overseer-invites' })`\n- **Ban management**: `explainSdkUsage({ topic: 'ban-management' })`\n- **Streaming**: `explainSdkUsage({ topic: 'streaming' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2669
- }
2670
- ]
2671
- },
2672
- {
2673
- "topicKey": "nft-collection-management",
2674
- "label": "Nft collection management",
2675
- "category": "nft",
2676
- "description": "NFT collection management and operations",
2677
- "methodCount": 11,
2678
- "exchanges": [
2679
- {
2680
- "userQuestion": "How do I nft collection management?",
2681
- "assistantResponse": "\n# NFT Collection Management - SDK v5.12.0+\n\nCreate and manage NFT collections, token classes, and mint NFTs on GalaChain.\n\n**Key Concepts:**\n- **Collection**: A named grouping for NFT token classes (claimed for 10,000 GALA)\n- **Token Class**: A specific type/rarity within a collection (created for 1,000 GALA)\n- **NFT Instance**: Individual NFT minted from a token class (dynamic fee based on quantity)\n\n## Check Collection Availability\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({ privateKey: 'your-private-key' });\n\n// Check if a collection name is available\nconst available = await sdk.isNftCollectionAvailable('MyEpicNFTs');\nconsole.log('Collection available:', available);\n\n// Get fee for claiming a collection\nconst claimFee = await sdk.getNftCollectionClaimFee();\nconsole.log('Claim fee:', claimFee); // Usually \"10000\" GALA\n```\n\n## Claim a Collection\n\n```typescript\n// Claim an available collection name\nconst result = await sdk.claimNftCollection({\n collectionName: 'MyEpicNFTs',\n description: 'Epic NFT collection for gaming',\n});\nconsole.log('Collection claimed:', result.collectionName);\nconsole.log('Transaction ID:', result.transactionId);\n\n// Fetch your owned collections\nconst collections = await sdk.fetchNftCollections(walletAddress);\nfor (const collection of collections) {\n console.log(`Collection: ${collection.collectionName}`);\n console.log(` Status: ${collection.status}`);\n}\n```\n\n## Create Token Classes (Rarities)\n\n```typescript\n// Get fee for creating a token class\nconst classCreateFee = await sdk.getNftTokenClassCreateFee();\nconsole.log('Create fee:', classCreateFee); // Usually \"1000\" GALA\n\n// Create a token class (rarity tier)\nconst classResult = await sdk.createNftTokenClass({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n description: 'Ultra-rare legendary wizard NFTs',\n maximumSupply: '100', // Max NFTs of this type\n data: {\n rarity: 'legendary',\n class: 'wizard',\n power: '9000',\n },\n});\nconsole.log('Token class created:', classResult.tokenClassName);\n\n// Fetch token classes for your collection\nconst classes = await sdk.fetchNftTokenClasses({\n collectionName: 'MyEpicNFTs',\n});\nfor (const tokenClass of classes) {\n console.log(`Class: ${tokenClass.tokenClassName}`);\n console.log(` Current Supply: ${tokenClass.currentSupply}/${tokenClass.maxSupply}`);\n}\n```\n\n## Estimate Mint Fees\n\n```typescript\n// Estimate fee for minting multiple NFTs\nconst mintFeeEstimate = await sdk.estimateNftMintFee({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n quantity: 5,\n});\nconsole.log('Estimated mint fee:', mintFeeEstimate); // Dynamic fee in GALA\n\n// Estimate multiple operations at once\nconst bundleFee = await sdk.estimateNftOperationFees({\n operations: [\n { type: 'claim_collection' },\n { type: 'create_token_class', collectionName: 'MyEpicNFTs' },\n { type: 'mint', quantity: 10 },\n ],\n});\nconsole.log('Total bundle fee:', bundleFee.totalFee);\nfor (const op of bundleFee.breakdown) {\n console.log(` ${op.operationType}: ${op.fee}`);\n}\n```\n\n## Mint NFTs\n\n```typescript\n// Mint NFT instances from a token class\nconst mintResult = await sdk.mintNft({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'LegendaryWizard',\n quantity: 5,\n to: 'eth|0x...', // Recipient wallet\n metadata: {\n attributes: [\n { name: 'level', value: '50' },\n { name: 'element', value: 'fire' },\n ],\n },\n});\nconsole.log('Minted:', mintResult.quantityMinted);\nconsole.log('Transaction ID:', mintResult.transactionId);\n\n// Check NFT balances\nconst balances = await sdk.fetchNftBalances(walletAddress);\nfor (const balance of balances) {\n console.log(`${balance.collectionName}/${balance.tokenClassName}: ${balance.quantity}`);\n}\n\n// Filter by collection\nconst collectionBalances = await sdk.fetchNftBalances(walletAddress, 'MyEpicNFTs');\n```\n\n## Complete Workflow\n\n```typescript\n// 1. Check availability\nconst available = await sdk.isNftCollectionAvailable('MyEpicNFTs');\nif (!available) throw new Error('Collection name taken');\n\n// 2. Claim collection (10,000 GALA)\nconst claimResult = await sdk.claimNftCollection({\n collectionName: 'MyEpicNFTs',\n description: 'My epic NFT collection',\n});\nconsole.log('✓ Collection claimed');\n\n// 3. Create token class (1,000 GALA)\nconst classResult = await sdk.createNftTokenClass({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n description: 'Legendary tier NFTs',\n maximumSupply: '1000',\n});\nconsole.log('✓ Token class created');\n\n// 4. Estimate mint fee\nconst fee = await sdk.estimateNftMintFee({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n quantity: 100,\n});\nconsole.log(`✓ Mint fee: ${fee} GALA`);\n\n// 5. Mint NFTs\nconst mintResult = await sdk.mintNft({\n collectionName: 'MyEpicNFTs',\n tokenClassName: 'Legendary',\n quantity: 100,\n to: userWallet,\n});\nconsole.log('✓ Minted:', mintResult.quantityMinted);\n\n// 6. Verify ownership\nconst balances = await sdk.fetchNftBalances(userWallet, 'MyEpicNFTs');\nconsole.log('Total NFTs:', balances.reduce((sum, b) => sum + parseInt(b.quantity), 0));\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_nft_collection_claim_fee`\n- `gala_launchpad_get_nft_token_class_create_fee`\n- `gala_launchpad_estimate_nft_mint_fee`\n- `gala_launchpad_estimate_nft_operation_fees`\n- `gala_launchpad_check_nft_collection_available`\n- `gala_launchpad_claim_nft_collection`\n- `gala_launchpad_fetch_nft_collections`\n- `gala_launchpad_create_nft_token_class`\n- `gala_launchpad_fetch_nft_token_classes`\n- `gala_launchpad_mint_nft`\n- `gala_launchpad_fetch_nft_balances`\n"
2682
- },
2683
- {
2684
- "userQuestion": "What parameters does getNftCollectionClaimFee() accept?",
2685
- "assistantResponse": "The primary methods for Nft collection management are `getNftCollectionClaimFee()`, `getNftTokenClassCreateFee()`, `estimateNftMintFee()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2686
- },
2687
- {
2688
- "userQuestion": "What are best practices for nft collection management?",
2689
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2690
- },
2691
- {
2692
- "userQuestion": "Can you walk me through a complete nft collection management example?",
2693
- "assistantResponse": "**Complete Workflow: Nft collection management**\n\nHere's the typical flow: `getNftCollectionClaimFee()` → `getNftTokenClassCreateFee()` → `estimateNftMintFee()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2694
- },
2695
- {
2696
- "userQuestion": "What other methods are available for Nft collection management?",
2697
- "assistantResponse": "**Additional Methods:**\n\n- `estimateNftOperationFees()`\n- `isNftCollectionAvailable()`\n- `claimNftCollection()`\n- `fetchNftCollections()`\n\n**Total methods in this topic:** 11\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2698
- },
2699
- {
2700
- "userQuestion": "What should I learn next after nft collection management?",
2701
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2702
- },
2703
- {
2704
- "userQuestion": "Are there any advanced patterns for this topic?",
2705
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
2706
- }
2707
- ]
2708
- },
2709
- {
2710
- "topicKey": "overseer-invites",
2711
- "label": "Overseer invites",
2712
- "category": "overseers",
2713
- "description": "Global platform oversight",
2714
- "methodCount": 9,
2715
- "exchanges": [
2716
- {
2717
- "userQuestion": "How do I manage overseer invites?",
2718
- "assistantResponse": "\n# Overseer System - SDK v5.9.0+\n\nGlobal platform oversight via magic link invites. Overseers have MANAGER-level\naccess to ALL tokens (current and future), unlike moderators who have token-scoped access.\n\n## Key Differences from Moderators\n\n| Feature | Moderator | Overseer |\n|---------|-----------|----------|\n| Scope | Per-token or blanket (owner's tokens) | ALL tokens on platform |\n| Access Level | MODERATOR, TECHNICAL_PRODUCER, or MANAGER | Always MANAGER |\n| Grant Authority | Token owner | Admin or existing Overseer |\n| Use Case | Stream management delegation | Platform-wide oversight |\n\n## Creating Overseer Invites\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY, // Admin key OR JWT auth\n});\n\n// Option 1: Using Admin API key\nconst result = await sdk.createOverseerInvite({\n description: 'John - Platform Support Team',\n expiresAt: '2025-12-31T23:59:59Z', // Optional\n});\n\n// Option 2: Using JWT (as existing Overseer)\nawait sdk.login();\nconst result = await sdk.createOverseerInvite({\n description: 'Platform team member',\n});\n\nconsole.log('Share this link:', result.invite.inviteUrl);\nconsole.log('Invite Code:', result.invite.inviteCode);\n```\n\n## Claiming Overseer Invites\n\n```typescript\n// Recipient must be authenticated\nawait sdk.login();\n\n// Claim the invite\nconst claimed = await sdk.claimOverseerInvite('abc123...');\nconsole.log('Now an overseer!');\nconsole.log('Status:', claimed.invite.status); // CLAIMED\n\n// Check own status\nconst status = await sdk.getMyOverseerStatus();\nconsole.log('Is Overseer:', status.isOverseer); // true\nconsole.log('Granted at:', status.overseer?.createdAt);\n```\n\n## Listing Overseers and Invites\n\n```typescript\n// List all overseer invites (paginated)\nconst invites = await sdk.listOverseerInvites({\n status: 'PENDING', // PENDING, CLAIMED, REVOKED, EXPIRED\n page: 1,\n limit: 20,\n});\n\nfor (const invite of invites.invites) {\n console.log(`#${invite.id}: ${invite.description || 'No description'}`);\n console.log(` Status: ${invite.status}`);\n console.log(` Created by: ${invite.invitedBy.fullName || invite.invitedBy.address}`);\n}\n\n// List all active overseers\nconst overseers = await sdk.listOverseers({\n status: 'ACTIVE', // ACTIVE or REVOKED\n page: 1,\n limit: 20,\n});\n\nfor (const overseer of overseers.overseers) {\n console.log(`Overseer: ${overseer.userAddress}`);\n console.log(` Since: ${overseer.createdAt}`);\n}\n```\n\n## Public Invite Preview\n\n```typescript\n// Get public info about an invite (no auth required)\nconst preview = await sdk.getOverseerInviteByCode('abc123...');\n\nconsole.log('Status:', preview.status);\nconsole.log('Description:', preview.description);\nconsole.log('Invited by:', preview.invitedBy.fullName);\nconsole.log('Expires:', preview.expiresAt);\n```\n\n## Revoking Access\n\n```typescript\n// Revoke an invite by ID\nawait sdk.revokeOverseerInvite(123);\nconsole.log('Invite revoked');\n\n// Revoke an overseer by wallet address\nawait sdk.revokeOverseer('eth|1234567890abcdef...');\nconsole.log('Overseer access revoked');\n```\n\n## SDK Methods Reference\n\n| Method | Description | Auth |\n|--------|-------------|------|\n| `createOverseerInvite(options?)` | Create magic link invite | Admin API key OR JWT (Overseer) |\n| `claimOverseerInvite(code)` | Claim invite with code | JWT |\n| `listOverseerInvites(options?)` | List all overseer invites | Admin API key OR JWT (Overseer) |\n| `getOverseerInviteByCode(code)` | Preview invite details | None (public) |\n| `revokeOverseerInvite(id)` | Revoke invite by ID | Admin API key OR JWT (Overseer) |\n| `listOverseers(options?)` | List all overseers | Admin API key OR JWT (Overseer) |\n| `revokeOverseer(address)` | Revoke overseer by address | Admin API key OR JWT (Overseer) |\n| `getMyOverseerStatus()` | Check own overseer status | JWT |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_create_overseer_invite`\n- `gala_launchpad_claim_overseer_invite`\n- `gala_launchpad_list_overseer_invites`\n- `gala_launchpad_get_overseer_invite`\n- `gala_launchpad_revoke_overseer_invite`\n- `gala_launchpad_list_overseers`\n- `gala_launchpad_revoke_overseer`\n- `gala_launchpad_get_my_overseer_status`\n- `gala_launchpad_get_overseer_summary`\n"
2719
- },
2720
- {
2721
- "userQuestion": "What parameters does createOverseerInvite() accept?",
2722
- "assistantResponse": "The primary methods for Overseer invites are `createOverseerInvite()`, `claimOverseerInvite()`, `listOverseerInvites()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2723
- },
2724
- {
2725
- "userQuestion": "What are best practices for manage overseer invites?",
2726
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2727
- },
2728
- {
2729
- "userQuestion": "What errors should I handle when manage overseer invites?",
2730
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.overseerinvites(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
2731
- },
2732
- {
2733
- "userQuestion": "Can you walk me through a complete manage overseer invites example?",
2734
- "assistantResponse": "**Complete Workflow: Overseer invites**\n\nHere's the typical flow: `createOverseerInvite()` → `claimOverseerInvite()` → `listOverseerInvites()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2735
- },
2736
- {
2737
- "userQuestion": "What other methods are available for Overseer invites?",
2738
- "assistantResponse": "**Additional Methods:**\n\n- `getOverseerInviteByCode()`\n- `revokeOverseerInvite()`\n- `listOverseers()`\n- `revokeOverseer()`\n\n**Total methods in this topic:** 9\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2739
- },
2740
- {
2741
- "userQuestion": "What should I learn next after manage overseer invites?",
2742
- "assistantResponse": "**Related Topics:**\n\n- **Moderator invites**: `explainSdkUsage({ topic: 'moderator-invites' })`\n- **Token ban management**: `explainSdkUsage({ topic: 'token-ban-management' })`\n- **Content flag management**: `explainSdkUsage({ topic: 'content-flag-management' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2743
- }
2744
- ]
2745
- },
2746
- {
2747
- "topicKey": "fetch-pools",
2748
- "label": "Fetch pools",
2749
- "category": "pools",
2750
- "description": "Pool management, pricing, and token availability",
2751
- "methodCount": 10,
2752
- "exchanges": [
2753
- {
2754
- "userQuestion": "How do I fetch and search token pools?",
2755
- "assistantResponse": "\n## Fetching Pool Data with Advanced Methods\n\n**Covers Methods:**\n- `fetchPools()`\n- `fetchAllPools()`\n- `fetchPoolDetails()`\n- `fetchPoolDetailsForCalculation()`\n- `fetchVolumeData()`\n- `fetchTokenPrice()`\n- `fetchTokenDistribution()`\n- `fetchTokenBadges()`\n- `resolveVaultAddress()`\n- `resolveTokenClassKey()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\n// 1. BASIC POOL FETCHING - With Pagination\nasync function basicPoolFetching() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch recent pools with pagination\n const pools = await sdk.fetchPools({\n type: 'recent',\n limit: 10,\n page: 1\n });\n\n console.log(`Found ${pools.total} pools, page ${pools.page} of ${pools.totalPages}`);\n pools.pools.forEach(pool => {\n console.log(`${pool.tokenName}: ${pool.tokenSymbol}`);\n });\n}\n\n// 2. AUTO-PAGINATED FETCHING - Get ALL Pools\nasync function fetchAllPools() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Auto-paginated - returns all pools without manual pagination\n const allPools = await sdk.fetchAllPools({\n type: 'recent'\n });\n\n console.log(`Total pools: ${allPools.pools.length}`);\n}\n\n// 3. POOL DETAILS - Complete information\nasync function getPoolDetails(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const details = await sdk.fetchPoolDetails(tokenName);\n\n console.log('Sale status:', details.saleStatus); // 'Ongoing' or 'Completed'\n console.log('Base price:', details.basePrice);\n console.log('Max supply:', details.maxSupply);\n console.log('Remaining tokens:', details.sellingTokenQuantity);\n}\n\n// 4. POOL DETAILS FOR CALCULATIONS - Optimized for math\nasync function getOptimizedPoolDetails(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Returns only fields needed for bonding curve calculations\n const poolData = await sdk.fetchPoolDetailsForCalculation(tokenName);\n\n console.log('Current supply:', poolData.currentSupply);\n console.log('Remaining tokens:', poolData.remainingTokens);\n console.log('Max supply:', poolData.maxSupply);\n console.log('Reverse bonding curve max fee:', poolData.reverseBondingCurveMaxFeeFactor);\n}\n\n// 5. VOLUME & OHLCV DATA - Historical candlestick data\nasync function getVolumeData(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Different resolutions: '1m', '5m', '15m', '1h', '4h', '1d'\n const volumeData = await sdk.fetchVolumeData({\n tokenName: tokenName,\n from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), // Last 7 days\n to: new Date(),\n resolution: '1h' // 1-hour candlesticks\n });\n\n volumeData.forEach(candle => {\n console.log(`${candle.time}: O:${candle.open} H:${candle.high} L:${candle.low} C:${candle.close} V:${candle.volume}`);\n });\n}\n\n// 6. SPOT PRICES - DEX tokens (GALA, SILK, MUSIC)\nasync function getDexTokenPrices() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch prices for multiple DEX tokens\n const prices = await sdk.fetchTokenPrice(['GALA', 'SILK', 'MUSIC']);\n\n console.log(`GALA: $${prices.GALA}`);\n console.log(`SILK: $${prices.SILK}`);\n console.log(`MUSIC: $${prices.MUSIC}`);\n}\n\n// 7. LAUNCHPAD TOKEN SPOT PRICES (via smart router)\nasync function getLaunchpadTokenPrice(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get USD spot price for a launchpad token (anime, woohoo, etc.)\n const price = await sdk.fetchTokenPrice({ tokenName });\n\n console.log(`${tokenName} price: $${price.price}`);\n}\n\n// 8. RESOLVE UTILITY ADDRESSES\nasync function resolveAddresses(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get GalaChain vault address for token\n const vaultAddress = await sdk.resolveVaultAddress(tokenName);\n console.log(`Vault address: ${vaultAddress}`);\n\n // Get TokenClassKey for token\n const tokenClassKey = await sdk.resolveTokenClassKey(tokenName);\n console.log(`TokenClassKey: ${tokenClassKey}`);\n}\n\n// 9. COMPLETE INVESTMENT ANALYSIS WORKFLOW\nasync function analyzeToken(tokenName) {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get all token data in parallel\n const [details, volumeData, distribution, badges] = await Promise.all([\n sdk.fetchPoolDetails(tokenName),\n sdk.fetchVolumeData({ tokenName, resolution: '1d' }),\n sdk.fetchTokenDistribution(tokenName),\n sdk.fetchTokenBadges(tokenName)\n ]);\n\n // Analyze status\n console.log(`Pool Status: ${details.saleStatus}`);\n console.log(`Supply: ${details.currentSupply} / ${details.maxSupply}`);\n\n // Analyze volume trend\n // Note: For analytics/aggregation, we use safeParseFloat for performance. For trades, use BigNumber via SDK\n const volumes = volumeData.map(v => safeParseFloat(v.volume, 0));\n const avgVolume = volumes.reduce((a, b) => a + b, 0) / volumes.length;\n console.log(`Avg daily volume: $${toBigNumberFixed(avgVolume, 2)}`);\n\n // Analyze distribution\n // Use compareAmounts for precise balance comparisons\n const top5Ownership = distribution.holders\n .sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)\n .slice(0, 5)\n .reduce((sum, h) => sum + h.percentage, 0);\n console.log(`Top 5 holders: ${toBigNumberFixed(top5Ownership, 2)}%`);\n\n // Check badges\n console.log(`Badges: ${badges.join(', ')}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_pools` - Paginated pool list\n- `gala_launchpad_fetch_all_pools` - Auto-paginated all pools\n- `gala_launchpad_fetch_pool_details` - Complete pool information\n- `gala_launchpad_fetch_pool_details_for_calculation` - Optimized for calculations\n- `gala_launchpad_fetch_volume_data` - OHLCV candlestick data\n- `gala_launchpad_fetch_token_spot_price` - DEX token prices (GALA, SILK, MUSIC)\n- `gala_launchpad_fetch_launchpad_token_spot_price` - Launchpad token USD prices\n- `gala_launchpad_fetch_token_distribution` - Token holder analysis\n- `gala_launchpad_fetch_token_badges` - Achievement badges\n- `gala_launchpad_resolve_vault_address` - Get vault address\n- `gala_launchpad_resolve_token_class_key` - Get TokenClassKey\n"
2756
- },
2757
- {
2758
- "userQuestion": "What parameters does fetchPools() accept?",
2759
- "assistantResponse": "The primary methods for Fetch pools are `fetchPools()`, `fetchAllPools()`, `fetchPoolDetails()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2760
- },
2761
- {
2762
- "userQuestion": "What are best practices for fetch and search token pools?",
2763
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2764
- },
2765
- {
2766
- "userQuestion": "Can you walk me through a complete fetch and search token pools example?",
2767
- "assistantResponse": "**Complete Workflow: Fetch pools**\n\nHere's the typical flow: `fetchPools()` → `fetchAllPools()` → `fetchPoolDetails()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2768
- },
2769
- {
2770
- "userQuestion": "What other methods are available for Fetch pools?",
2771
- "assistantResponse": "**Additional Methods:**\n\n- `fetchPoolDetailsForCalculation()`\n- `fetchVolumeData()`\n- `fetchTokenPrice()`\n- `fetchTokenDistribution()`\n\n**Total methods in this topic:** 10\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2772
- },
2773
- {
2774
- "userQuestion": "What should I learn next after fetch and search token pools?",
2775
- "assistantResponse": "**Related Topics:**\n\n- **Token details**: `explainSdkUsage({ topic: 'token-details' })`\n- **Token distribution**: `explainSdkUsage({ topic: 'token-distribution' })`\n- **Price history**: `explainSdkUsage({ topic: 'price-history' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2776
- },
2777
- {
2778
- "userQuestion": "Are there any advanced patterns for this topic?",
2779
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
2780
- }
2781
- ]
2782
- },
2783
- {
2784
- "topicKey": "price-history",
2785
- "label": "Price history",
2786
- "category": "pools",
2787
- "description": "Pool management, pricing, and token availability",
2788
- "methodCount": 2,
2789
- "exchanges": [
2790
- {
2791
- "userQuestion": "How do I view token price history?",
2792
- "assistantResponse": "\n## Historical Price Analysis with SDK\n\n**Covers Methods:**\n- `fetchPriceHistory()`\n- `fetchAllPriceHistory()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function analyzePriceHistory() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Paginated price history\n const history = await sdk.fetchPriceHistory({\n tokenId: 'GUSDC|Unit|none|eth:0x...',\n from: new Date('2025-01-01'),\n to: new Date('2025-01-31'),\n sortOrder: 'DESC',\n page: 1,\n limit: 50\n });\n\n console.log(`Found ${history.snapshots.length} snapshots`);\n console.log(`Total available: ${history.total} (page ${history.page} of ${history.totalPages})`);\n\n // Auto-paginated complete history\n const allHistory = await sdk.fetchAllPriceHistory({\n tokenId: 'GWETH|Unit|none|none',\n from: new Date('2024-01-01'),\n sortOrder: 'ASC'\n });\n\n // Price analysis - Convert strings to numbers for statistical calculations\n // Note: For precise trading amounts, use compareAmounts() from SDK instead\n const prices = allHistory.snapshots.map(s => safeParseNumber(s.price, 0));\n const avg = prices.reduce((a, b) => a + b, 0) / prices.length;\n const variance = prices.reduce((sum, p) => sum + Math.pow(p - avg, 2), 0) / prices.length;\n const volatility = Math.sqrt(variance);\n\n console.log(`Average: $${toBigNumberFixed(avg, 4)}, Volatility: $${toBigNumberFixed(volatility, 4)}`);\n\n // Data export (CSV)\n const csv = ['timestamp,price'].concat(\n allHistory.snapshots.map(s => `${s.timestamp.toISOString()},${s.price}`)\n ).join('\\n');\n\n console.log('CSV export:', csv.split('\\n').slice(0, 3).join('\\n'));\n}\n```\n\n**Key Methods:**\n- `fetchPriceHistory()` - Paginated historical prices (max 50 per page)\n- `fetchAllPriceHistory()` - Auto-paginated complete history (all snapshots)\n\n**Response Fields:**\n- `price` - Token price as decimal string\n- `timestamp` - ISO 8601 timestamp\n- `tokenId` - Token identifier (pipe-delimited)\n\n**Use Cases:**\n- Technical analysis and charting\n- Volatility assessment\n- Price trend identification\n- Data export for analytics\n- Backtesting strategies\n\n**Token ID Formats:**\n- String: `GUSDC|Unit|none|eth:0x...`\n- Object: `{ collection, category, type, additionalKey }`\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_price_history` - Paginated\n- `gala_launchpad_fetch_all_price_history` - Auto-paginated\n"
2793
- },
2794
- {
2795
- "userQuestion": "What parameters does fetchPriceHistory() accept?",
2796
- "assistantResponse": "The primary methods for Price history are `fetchPriceHistory()`, `fetchAllPriceHistory()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2797
- },
2798
- {
2799
- "userQuestion": "What are best practices for view token price history?",
2800
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2801
- },
2802
- {
2803
- "userQuestion": "What should I learn next after view token price history?",
2804
- "assistantResponse": "**Related Topics:**\n\n- **Fetch pools**: `explainSdkUsage({ topic: 'fetch-pools' })`\n- **Token details**: `explainSdkUsage({ topic: 'token-details' })`\n- **Trading analytics**: `explainSdkUsage({ topic: 'trading-analytics' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2805
- },
2806
- {
2807
- "userQuestion": "Any final tips for view token price history?",
2808
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2809
- }
2810
- ]
2811
- },
2812
- {
2813
- "topicKey": "token-details",
2814
- "label": "Token details",
2815
- "category": "pools",
2816
- "description": "Pool management, pricing, and token availability",
2817
- "methodCount": 1,
2818
- "exchanges": [
2819
- {
2820
- "userQuestion": "How do I get token details and information?",
2821
- "assistantResponse": "\n## Token Details and Metadata with SDK\n\n**Covers Methods:**\n- `fetchTokenDetails()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function analyzeTokenDetails() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Fetch token metadata\n const details = await sdk.fetchTokenDetails('GUSDC|Unit|none|eth:0x...');\n\n console.log('Token Information:');\n console.log(` Name: ${details.name}`);\n console.log(` Symbol: ${details.symbol}`);\n console.log(` Decimals: ${details.decimals}`);\n console.log(` Verified: ${details.verified}`);\n console.log(` Trading: ${details.tradingEnabled}`);\n console.log(` Network: ${details.network}`);\n console.log(` Image: ${details.image}`);\n\n // Pre-trading validation\n async function validateBeforeTrade(tokenId: string) {\n const token = await sdk.fetchTokenDetails(tokenId);\n\n if (!token.verified) {\n console.warn(`⚠️ ${token.symbol} is NOT verified`);\n }\n\n if (!token.tradingEnabled) {\n throw new Error(`Trading disabled for ${token.symbol}`);\n }\n\n if (token.network !== 'ethereum') {\n throw new Error(`Wrong network: got ${token.network}`);\n }\n\n return token;\n }\n\n // Batch token comparison\n const tokens = ['GALA|Unit|none|none', 'GUSDC|Unit|none|eth:0x...'];\n const details_list = await Promise.all(\n tokens.map(id => sdk.fetchTokenDetails(id).catch(() => null))\n );\n\n const verified = details_list.filter(t => t?.verified).length;\n console.log(`Verified tokens: ${verified}/${tokens.length}`);\n}\n```\n\n**Response Fields:**\n- `symbol` - Token symbol (e.g., 'GUSDC')\n- `name` - Full token name\n- `decimals` - Decimal places\n- `verified` - Verification status\n- `tradingEnabled` - Trading availability\n- `network` - Network name (e.g., 'ethereum')\n- `contractAddress` - Smart contract address\n- `image` - Token image URL\n- `chainId` - Blockchain chain ID\n\n**Use Cases:**\n- Pre-trading validation and safety checks\n- Display token metadata in UI\n- Verify token authenticity\n- Network compatibility checking\n\n**Token ID Formats:**\n- String: `GUSDC|Unit|none|eth:0x...`\n- Object: `{ collection, category, type, additionalKey }`\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_token_details`\n"
2822
- },
2823
- {
2824
- "userQuestion": "What parameters does fetchTokenDetails() accept?",
2825
- "assistantResponse": "The primary methods for Token details are `fetchTokenDetails()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2826
- },
2827
- {
2828
- "userQuestion": "What are best practices for get token details and information?",
2829
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2830
- },
2831
- {
2832
- "userQuestion": "What should I learn next after get token details and information?",
2833
- "assistantResponse": "**Related Topics:**\n\n- **Fetch pools**: `explainSdkUsage({ topic: 'fetch-pools' })`\n- **Token distribution**: `explainSdkUsage({ topic: 'token-distribution' })`\n- **Price history**: `explainSdkUsage({ topic: 'price-history' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2834
- },
2835
- {
2836
- "userQuestion": "Any final tips for get token details and information?",
2837
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2838
- }
2839
- ]
2840
- },
2841
- {
2842
- "topicKey": "token-distribution",
2843
- "label": "Token distribution",
2844
- "category": "pools",
2845
- "description": "Pool management, pricing, and token availability",
2846
- "methodCount": 2,
2847
- "exchanges": [
2848
- {
2849
- "userQuestion": "How do I analyze token distribution?",
2850
- "assistantResponse": "\n## Token Holder Distribution with SDK\n\n**Covers Methods:**\n- `fetchTokenDistribution()`\n- `fetchUserHolderContext()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function analyzeTokenDistribution() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // Fetch complete token distribution (all holders, non-paginated)\n const distribution = await sdk.fetchTokenDistribution('anime');\n\n console.log(`Total holders: ${distribution.totalHolders}`);\n console.log(`Total supply: ${distribution.totalSupply}`);\n console.log(`Last updated: ${distribution.lastUpdated.toISOString()}`);\n\n // Analyze top holders\n // Use compareAmounts for precise balance sorting with large numbers\n distribution.holders\n .sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)\n .slice(0, 5)\n .forEach((holder, index) => {\n console.log(`#${index + 1}: ${holder.address}`);\n console.log(` Balance: ${holder.balance}`);\n console.log(` Ownership: ${toBigNumberFixed(holder.percentage, 2)}%`);\n });\n\n // Check concentration risk (e.g., top 5 holders own >80%)\n const top5Ownership = distribution.holders\n .sort((a, b) => compareAmounts(b.balance, a.balance) > 0 ? 1 : -1)\n .slice(0, 5)\n .reduce((sum, holder) => sum + holder.percentage, 0);\n\n console.log(`Top 5 holders control: ${toBigNumberFixed(top5Ownership, 2)}%`);\n\n // Find specific holder\n const myAddress = sdk.getAddress();\n const myHolding = distribution.holders.find(h => h.address === myAddress);\n\n if (myHolding) {\n console.log(`Your ownership: ${toBigNumberFixed(myHolding.percentage, 4)}%`);\n console.log(`Your balance: ${myHolding.balance}`);\n }\n\n // Calculate concentration metrics\n const giniCoefficient = calculateGini(distribution.holders);\n console.log(`Gini coefficient: ${toBigNumberFixed(giniCoefficient, 4)}`);\n\n // Count whales (holders with >5%)\n const whales = distribution.holders.filter(h => h.percentage > 5);\n console.log(`Whales (>5%): ${whales.length}`);\n}\n\n// Helper: Calculate Gini coefficient for wealth distribution\nfunction calculateGini(holders: Array<{balance: string}>) {\n const balances = holders.map(h => safeParseFloat(h.balance, 0)).sort((a, b) => a - b);\n const n = balances.length;\n const sum = balances.reduce((a, b) => a + b, 0);\n\n let numerator = 0;\n for (let i = 0; i < n; i++) {\n numerator += (2 * (i + 1) - n - 1) * balances[i];\n }\n\n return numerator / (n * sum);\n}\n```\n\n**Key Characteristics:**\n- **Non-Paginated**: Returns ALL token holders in single response (no pagination)\n- **Complete Distribution**: Full holder list with addresses, balances, and ownership percentages\n- **BigNumber Precision**: Uses BigNumber.js for accurate percentage calculations\n- **Total Supply**: Computed from holder balances (sum of all holdings)\n- **Service Account Included**: Vault/service accounts appear in holder list\n\n**Use Cases:**\n- Analyze token concentration risk\n- Identify whale holders\n- Track ownership changes over time\n- Generate holder reports\n- Calculate distribution metrics (Gini coefficient, etc.)\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_token_distribution`\n\n---\n\n## User Holder Context (Single User Lookup)\n\n**Covers Methods:**\n- `fetchUserHolderContext()`\n\nUse this when you need holder info for a **specific user** rather than the full holder list.\nPerfect for user cards in comments/chat.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function getUserCard() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Fetch single user's holder context for a token\n const holderContext = await sdk.fetchUserHolderContext('anime', 'eth|abc123...');\n\n // Response shape:\n // {\n // tokenName: 'anime',\n // userAddress: 'abc123...',\n // quantity: '25000' | null, // null if not a holder\n // percentage: 2.5 | null, // null if not a holder\n // rank: 3 | null, // 1-indexed rank (null if not a holder)\n // holderTier: { tier: 3, tierName: 'Major Holder' } | null,\n // isCreator: false\n // }\n\n if (holderContext.quantity !== null) {\n console.log(`Rank: #${holderContext.rank}`);\n console.log(`Holder Tier: ${holderContext.holderTier?.tierName}`);\n console.log(`Owns: ${holderContext.percentage ? toBigNumberFixed(holderContext.percentage, 4) : 'N/A'}%`);\n } else {\n console.log('User is not a holder of this token');\n }\n\n if (holderContext.isCreator) {\n console.log('This user created the token!');\n }\n}\n```\n\n**Holder Tiers (based on % of max supply):**\n| Tier | Name | Min % |\n|------|------|-------|\n| 5 | Whale | 5% |\n| 4 | Top Holder | 1% |\n| 3 | Major Holder | 0.1% |\n| 2 | Strong Holder | 0.01% |\n| 1 | Holder | 0.001% |\n\n**MCP Tool Equivalent:** `gala_launchpad_fetch_user_holder_context`\n"
2851
- },
2852
- {
2853
- "userQuestion": "What parameters does fetchTokenDistribution() accept?",
2854
- "assistantResponse": "The primary methods for Token distribution are `fetchTokenDistribution()`, `fetchUserHolderContext()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2855
- },
2856
- {
2857
- "userQuestion": "What are best practices for analyze token distribution?",
2858
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2859
- },
2860
- {
2861
- "userQuestion": "What should I learn next after analyze token distribution?",
2862
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2863
- },
2864
- {
2865
- "userQuestion": "Any final tips for analyze token distribution?",
2866
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
2867
- }
2868
- ]
2869
- },
2870
- {
2871
- "topicKey": "referral-system",
2872
- "label": "Referral system",
2873
- "category": "referrals",
2874
- "description": "Referral program and rewards tracking",
2875
- "methodCount": 4,
2876
- "exchanges": [
2877
- {
2878
- "userQuestion": "How do I manage referral rewards?",
2879
- "assistantResponse": "\n# Referral System\n\nThe SDK provides methods for managing referral URLs and tracking referral activity.\n\n## Get Your Referral URL\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function getReferralUrl() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get your unique referral URL\n const result = await sdk.fetchReferralUrl();\n console.log('Share this URL:', result.referralUrl);\n}\n```\n\n## Fetch Referrals (Paginated)\n\n```typescript\nasync function fetchReferrals() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Paginated referral list\n const referrals = await sdk.fetchReferrals({\n address: '0x...', // Optional, defaults to SDK wallet\n page: 1,\n limit: 20\n });\n\n console.log('Total referrals:', referrals.total);\n referrals.items.forEach(ref => {\n console.log(`Referred: ${ref.referredAddress} on ${ref.createdAt}`);\n });\n}\n```\n\n## Fetch All Referrals (Auto-Paginated)\n\n```typescript\nasync function fetchAllReferrals() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get ALL referrals with auto-pagination\n const allReferrals = await sdk.fetchAllReferrals({ address: '0x...' });\n console.log('Total referrals:', allReferrals.length);\n}\n```\n\n## Referral Summary\n\n```typescript\nasync function getReferralSummary() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n const summary = await sdk.fetchReferralsSummary({ address: '0x...' });\n console.log('Total referred users:', summary.totalReferrals);\n console.log('Total rewards earned:', summary.totalRewards);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_referral_url`\n- `gala_launchpad_fetch_referrals`\n- `gala_launchpad_fetch_all_referrals`\n- `gala_launchpad_fetch_referrals_summary`\n"
2880
- },
2881
- {
2882
- "userQuestion": "What parameters does fetchReferralUrl() accept?",
2883
- "assistantResponse": "The primary methods for Referral system are `fetchReferralUrl()`, `fetchReferrals()`, `fetchAllReferrals()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2884
- },
2885
- {
2886
- "userQuestion": "What are best practices for manage referral rewards?",
2887
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2888
- },
2889
- {
2890
- "userQuestion": "Can you walk me through a complete manage referral rewards example?",
2891
- "assistantResponse": "**Complete Workflow: Referral system**\n\nHere's the typical flow: `fetchReferralUrl()` → `fetchReferrals()` → `fetchAllReferrals()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2892
- },
2893
- {
2894
- "userQuestion": "What should I learn next after manage referral rewards?",
2895
- "assistantResponse": "**Related Topics:**\n\n- **Profile management**: `explainSdkUsage({ topic: 'profile-management' })`\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2896
- }
2897
- ]
2898
- },
2899
- {
2900
- "topicKey": "streaming",
2901
- "label": "Streaming",
2902
- "category": "streaming",
2903
- "description": "Live streaming management",
2904
- "methodCount": 17,
2905
- "exchanges": [
2906
- {
2907
- "userQuestion": "How do I manage live streams?",
2908
- "assistantResponse": "\n# Live Streaming SDK\n\nThe SDK provides comprehensive live streaming management including stream control,\nrecordings management, and simulcast to external platforms.\n\n## Starting a Stream\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function manageStream() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamWebSocketUrl: 'wss://stream.example.com', // Required for streaming\n streamAdminApiKey: 'your-admin-key', // Optional: for admin operations\n });\n\n // Start a stream for your token\n const stream = await sdk.startStream('mytoken');\n console.log('Stream Key:', stream.streamKey);\n console.log('RTMP URL:', stream.rtmpUrl);\n console.log('Playback URL:', stream.playbackUrl);\n // Use stream.streamKey in OBS or other RTMP software\n\n // Get stream info (public endpoint)\n const info = await sdk.getStreamInfo('mytoken');\n console.log('Status:', info.status); // IDLE, ACTIVE, DISABLED\n console.log('Is Live:', info.isLive);\n console.log('Viewers:', info.viewerCount);\n\n // Stop the stream when done\n await sdk.stopStream('mytoken');\n console.log('Stream stopped');\n\n // Reset stream key if compromised\n const newKey = await sdk.resetStreamKey('mytoken');\n console.log('New Stream Key:', newKey.streamKey);\n}\n```\n\n## Recordings Management\n\n```typescript\nasync function manageRecordings() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // List recordings (paginated)\n const recordings = await sdk.getStreamRecordings({\n tokenName: 'mytoken',\n page: 1,\n limit: 20,\n });\n console.log('Total recordings:', recordings.total);\n\n for (const rec of recordings.recordings) {\n console.log('Asset ID:', rec.assetId);\n console.log('Duration:', rec.duration, 'seconds');\n console.log('Status:', rec.status); // READY, PROCESSING, ERRORED\n }\n\n // Get download URL for a recording\n const download = await sdk.getRecordingDownload('mytoken', 'asset-123');\n console.log('Download URL:', download.downloadUrl);\n console.log('Expires:', download.expiresAt);\n\n // Delete a recording\n await sdk.deleteRecording('mytoken', 'asset-123');\n}\n```\n\n## Simulcast Management\n\nRebroadcast your stream to external platforms (YouTube, Twitch, Facebook).\n\n```typescript\nasync function manageSimulcast() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get existing simulcast targets\n const targets = await sdk.getSimulcastTargets('mytoken');\n console.log('Max targets:', targets.maxTargets);\n console.log('Current targets:', targets.targets.length);\n\n // Add YouTube simulcast\n const youtube = await sdk.addSimulcastTarget({\n tokenName: 'mytoken',\n platform: 'YOUTUBE',\n rtmpUrl: 'rtmp://a.rtmp.youtube.com/live2',\n streamKey: 'your-youtube-stream-key',\n name: 'My YouTube Channel',\n });\n console.log('Added target:', youtube.target.targetId);\n\n // Add Twitch simulcast\n await sdk.addSimulcastTarget({\n tokenName: 'mytoken',\n platform: 'TWITCH',\n rtmpUrl: 'rtmp://live.twitch.tv/app',\n streamKey: 'live_123456_abcdef',\n name: 'Twitch Stream',\n });\n\n // Remove a simulcast target\n await sdk.removeSimulcastTarget('mytoken', youtube.target.targetId);\n}\n```\n\n## Admin Operations\n\nEnable/disable streaming globally or per-token (requires admin API key).\n\n```typescript\nasync function adminOperations() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n streamAdminApiKey: 'your-admin-key',\n });\n\n // Disable streaming for a specific token (admin-only)\n await sdk.disableStream('mytoken');\n\n // Re-enable streaming for a token (admin-only)\n await sdk.enableStream('mytoken');\n\n // Get global streaming status\n const globalStatus = await sdk.getGlobalStreamingStatus();\n console.log('Global streaming enabled:', globalStatus.enabled);\n\n // Enable/disable streaming globally (maintenance mode)\n await sdk.setGlobalStreamingEnabled(false); // Disable all streams\n await sdk.setGlobalStreamingEnabled(true); // Re-enable\n}\n```\n\n**Available SDK Methods:**\n| Method | Description | Auth |\n|--------|-------------|------|\n| `startStream(tokenName)` | Start a stream | Wallet |\n| `stopStream(tokenName)` | Stop a stream | Wallet |\n| `getStreamInfo(tokenName)` | Get stream status | Public |\n| `resetStreamKey(tokenName)` | Generate new stream key | Wallet |\n| `disableStream(tokenName)` | Disable token streaming | Admin |\n| `enableStream(tokenName)` | Enable token streaming | Admin |\n| `getStreamRecordings(options)` | List recordings | Public |\n| `getRecordingDownload(tokenName, assetId)` | Get download URL | Wallet |\n| `deleteRecording(tokenName, assetId)` | Delete recording | Wallet |\n| `getSimulcastTargets(tokenName)` | List simulcast targets | Public |\n| `addSimulcastTarget(options)` | Add simulcast target | Wallet |\n| `removeSimulcastTarget(tokenName, targetId)` | Remove target | Wallet |\n| `getGlobalStreamingStatus()` | Get global status | Public |\n| `setGlobalStreamingEnabled(enabled)` | Enable/disable globally | Admin |\n| `getAvailableRoles()` | Get list of available streaming roles | Public |\n| `getStreamRole(options)` | Get user's role for a token | JWT |\n| `getTokenAccess(options)` | Check user's access to a token stream | JWT (optional) |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_start_stream`\n- `gala_launchpad_stop_stream`\n- `gala_launchpad_get_stream_info`\n- `gala_launchpad_reset_stream_key`\n- `gala_launchpad_disable_stream`\n- `gala_launchpad_enable_stream`\n- `gala_launchpad_get_stream_recordings`\n- `gala_launchpad_get_recording_download`\n- `gala_launchpad_delete_recording`\n- `gala_launchpad_get_simulcast_targets`\n- `gala_launchpad_add_simulcast_target`\n- `gala_launchpad_remove_simulcast_target`\n- `gala_launchpad_get_global_streaming_status`\n- `gala_launchpad_set_global_streaming_enabled`\n- `gala_launchpad_get_available_roles`\n- `gala_launchpad_get_stream_role`\n- `gala_launchpad_get_token_access`\n"
2909
- },
2910
- {
2911
- "userQuestion": "What parameters does startStream() accept?",
2912
- "assistantResponse": "The primary methods for Streaming are `startStream()`, `stopStream()`, `getStreamInfo()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2913
- },
2914
- {
2915
- "userQuestion": "What are best practices for manage live streams?",
2916
- "assistantResponse": "1. **Check stream status first**: Use `getStreamInfo()` before starting.\n2. **Handle WebSocket reconnection**: Implement reconnection logic for dropped connections.\n3. **Moderate in real-time**: Use chat moderation tools to maintain community standards."
2917
- },
2918
- {
2919
- "userQuestion": "What errors should I handle when manage live streams?",
2920
- "assistantResponse": "**Common Errors:**\n- `StreamAlreadyActive`: Stream already running\n- `UnauthorizedAccess`: Need proper role permissions\n- `WebSocketDisconnected`: Handle reconnection gracefully\n\n**Tip:** Check stream status before starting operations."
2921
- },
2922
- {
2923
- "userQuestion": "Can you walk me through a complete manage live streams example?",
2924
- "assistantResponse": "**Complete Workflow: Streaming**\n\nHere's the typical flow: `startStream()` → `stopStream()` → `getStreamInfo()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2925
- },
2926
- {
2927
- "userQuestion": "What edge cases should I know about for manage live streams?",
2928
- "assistantResponse": "**Edge Cases:**\n1. **Concurrent streams**: Only one active stream per token\n2. **Recording availability**: Recordings take time to process\n3. **Simulcast limits**: Check target platform requirements\n\n**Gotcha:** Stream key changes invalidate existing OBS/streaming software configs."
2929
- },
2930
- {
2931
- "userQuestion": "What other methods are available for Streaming?",
2932
- "assistantResponse": "**Additional Methods:**\n\n- `disableStream()`\n- `enableStream()`\n- `resetStreamKey()`\n- `getStreamRecordings()`\n\n**Total methods in this topic:** 17\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2933
- },
2934
- {
2935
- "userQuestion": "When would I actually use manage live streams in a real application?",
2936
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Token Launches**: Live-stream new token announcements\n2. **AMAs**: Host ask-me-anything sessions with community\n3. **Trading Commentary**: Stream market analysis and trades\n4. **Educational Content**: Teach about your project/token"
2937
- },
2938
- {
2939
- "userQuestion": "What should I learn next after manage live streams?",
2940
- "assistantResponse": "**Related Topics:**\n\n- **Stream chat**: `explainSdkUsage({ topic: 'stream-chat' })`\n- **Ban management**: `explainSdkUsage({ topic: 'ban-management' })`\n- **Moderator invites**: `explainSdkUsage({ topic: 'moderator-invites' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2941
- },
2942
- {
2943
- "userQuestion": "Are there any advanced patterns for this topic?",
2944
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
2945
- }
2946
- ]
2947
- },
2948
- {
2949
- "topicKey": "token-ban-management",
2950
- "label": "Token ban management",
2951
- "category": "token-ban",
2952
- "description": "Platform-wide token bans",
2953
- "methodCount": 5,
2954
- "exchanges": [
2955
- {
2956
- "userQuestion": "How do I manage token bans?",
2957
- "assistantResponse": "\n# Token Ban Management - SDK v6.x.0+\n\nPlatform-wide token ban operations for overseers. Banned tokens are hidden from ALL listings\nand have actions (comments, streaming, chat) blocked. This is different from user bans which\nonly affect specific users on specific tokens.\n\n**Access Control:** All methods require either:\n- streamAdminApiKey (server-to-server)\n- JWT with overseer status (authenticated overseer user)\n\n**Effects of Token Bans:**\n- Hidden from ALL pool listings (including creator's profile)\n- Comments blocked on banned tokens\n- Live streaming blocked on banned tokens\n- Chat messages blocked on banned tokens\n- Trading NOT blocked (GalaChain handles trading independently)\n\n## Banning a Token\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\n// Using Admin API key\nconst sdk = createLaunchpadSDK({\n streamAdminApiKey: process.env.STREAM_ADMIN_API_KEY,\n});\n\n// Or using JWT auth (must be an overseer)\nconst sdkWithAuth = createLaunchpadSDK({\n privateKey: process.env.PRIVATE_KEY,\n});\nawait sdkWithAuth.login({ walletAddress: 'eth|0x...' });\n\n// Ban a token with reason\nconst result = await sdk.banToken({\n tokenName: 'scamtoken',\n reason: 'Fraudulent project - reported by multiple users',\n});\nconsole.log('Token banned:', result.tokenName);\nconsole.log('Ban ID:', result.ban.id);\nconsole.log('Banned by:', result.ban.bannedBy);\n\n// Ban without reason (optional)\nawait sdk.banToken({ tokenName: 'problematictoken' });\n```\n\n## Unbanning a Token\n\n```typescript\n// Remove a token ban\nconst result = await sdk.unbanToken({ tokenName: 'scamtoken' });\nconsole.log('Ban removed:', result.removed); // true\nconsole.log('Token:', result.tokenName);\n\n// Token is now:\n// - Visible in pool listings again\n// - Comments re-enabled\n// - Live streaming re-enabled\n// - Chat re-enabled\n```\n\n## Checking Token Ban Status\n\n```typescript\n// Check if a specific token is banned\nconst status = await sdk.isTokenBanned({ tokenName: 'sometoken' });\n\nif (status.banned) {\n console.log('Token is banned!');\n console.log('Reason:', status.ban?.reason);\n console.log('Banned by:', status.ban?.bannedBy);\n console.log('Banned at:', status.ban?.createdAt);\n} else {\n console.log('Token is not banned');\n}\n\n// getTokenBan is an alias - use whichever is more readable\nconst details = await sdk.getTokenBan({ tokenName: 'sometoken' });\n```\n\n## Listing All Banned Tokens\n\n```typescript\n// Get first page with default limit (20)\nconst page1 = await sdk.listTokenBans({});\nconsole.log('Total banned tokens:', page1.meta.total);\n\nfor (const ban of page1.items) {\n console.log(`- ${ban.tokenName}: ${ban.reason || 'No reason'}`);\n console.log(` Banned by: ${ban.bannedBy}`);\n console.log(` Date: ${ban.createdAt}`);\n}\n\n// Search for specific tokens (partial match, case-insensitive)\nconst searchResults = await sdk.listTokenBans({\n search: 'scam',\n page: 1,\n limit: 10,\n});\n\n// Paginate through all banned tokens\nlet page = 1;\nlet hasMore = true;\nwhile (hasMore) {\n const results = await sdk.listTokenBans({ page, limit: 20 });\n console.log(`Page ${page}: ${results.items.length} bans`);\n for (const ban of results.items) {\n console.log(` - ${ban.tokenName}`);\n }\n hasMore = page < results.meta.totalPages;\n page++;\n}\n```\n\n## Important Notes\n\n1. **Permanent Bans Only**: Token bans do not expire. They remain in effect until\n explicitly removed by an overseer.\n\n2. **Case Normalization**: Token names are automatically normalized to lowercase\n in all requests and responses.\n\n3. **Idempotency**: Banning an already-banned token returns a 409 Conflict error.\n Unbanning a non-banned token returns a 404 Not Found error.\n\n4. **Trading Continues**: Token bans do NOT stop trading on GalaChain. The\n launchpad hides visibility and blocks social features only.\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_ban_token`\n- `gala_launchpad_unban_token`\n- `gala_launchpad_list_token_bans`\n- `gala_launchpad_get_token_ban`\n- `gala_launchpad_is_token_banned`\n"
2958
- },
2959
- {
2960
- "userQuestion": "What parameters does banToken() accept?",
2961
- "assistantResponse": "The primary methods for Token ban management are `banToken()`, `unbanToken()`, `listTokenBans()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2962
- },
2963
- {
2964
- "userQuestion": "What are best practices for manage token bans?",
2965
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2966
- },
2967
- {
2968
- "userQuestion": "Can you walk me through a complete manage token bans example?",
2969
- "assistantResponse": "**Complete Workflow: Token ban management**\n\nHere's the typical flow: `banToken()` → `unbanToken()` → `listTokenBans()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
2970
- },
2971
- {
2972
- "userQuestion": "What other methods are available for Token ban management?",
2973
- "assistantResponse": "**Additional Methods:**\n\n- `getTokenBan()`\n- `isTokenBanned()`\n\n**Total methods in this topic:** 5\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
2974
- },
2975
- {
2976
- "userQuestion": "What should I learn next after manage token bans?",
2977
- "assistantResponse": "**Related Topics:**\n\n- **Overseer invites**: `explainSdkUsage({ topic: 'overseer-invites' })`\n- **Content flag management**: `explainSdkUsage({ topic: 'content-flag-management' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
2978
- }
2979
- ]
2980
- },
2981
- {
2982
- "topicKey": "trade-history",
2983
- "label": "Trade history",
2984
- "category": "trades",
2985
- "description": "View and analyze trading history",
2986
- "methodCount": 1,
2987
- "exchanges": [
2988
- {
2989
- "userQuestion": "How do I view trading history?",
2990
- "assistantResponse": "\n## Trade History\n\nQuery and analyze trading activity for tokens.\n\n### Basic Usage\n\n```typescript\nimport { LaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nconst sdk = new LaunchpadSDK({ environment: 'production' });\n\n// Get recent trades for a token\nconst result = await sdk.getTrades({\n tokenName: 'anime',\n limit: 10,\n page: 1\n});\n\nconsole.log(`Found ${result.trades.length} trades`);\nfor (const trade of result.trades) {\n console.log(`${trade.txnType}: ${trade.inputAmount} → ${trade.outputAmount}`);\n}\n```\n\n### Filter by Trade Type\n\n```typescript\n// Get only buy orders\nconst buyTrades = await sdk.getTrades({\n tokenName: 'anime',\n txnType: 'BUY',\n limit: 50\n});\n\n// Get only sell orders\nconst sellTrades = await sdk.getTrades({\n tokenName: 'anime',\n txnType: 'SELL',\n limit: 50\n});\n```\n\n### Date Range Queries\n\n```typescript\nconst oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);\nconst now = new Date();\n\nconst recentTrades = await sdk.getTrades({\n tokenName: 'anime',\n startDate: oneWeekAgo,\n endDate: now,\n limit: 50\n});\n```\n\n### Filter by User\n\n```typescript\n// Get trades for a specific wallet\nconst userTrades = await sdk.getTrades({\n tokenName: 'anime',\n userAddress: 'eth|0x1234...',\n limit: 20\n});\n```\n\n### Pagination\n\n```typescript\n// Paginate through all trades\nlet page = 1;\nlet hasMore = true;\n\nwhile (hasMore) {\n const result = await sdk.getTrades({ tokenName: 'anime', page, limit: 50 });\n console.log(`Page ${page}: ${result.trades.length} trades`);\n\n hasMore = result.trades.length === 50;\n page++;\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_trades`\n"
2991
- },
2992
- {
2993
- "userQuestion": "What parameters does getTrades() accept?",
2994
- "assistantResponse": "The primary methods for Trade history are `getTrades()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
2995
- },
2996
- {
2997
- "userQuestion": "What are best practices for view trading history?",
2998
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
2999
- },
3000
- {
3001
- "userQuestion": "What should I learn next after view trading history?",
3002
- "assistantResponse": "**Related Topics:**\n\n- **Trading analytics**: `explainSdkUsage({ topic: 'trading-analytics' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Buy tokens**: `explainSdkUsage({ topic: 'buy-tokens' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3003
- },
3004
- {
3005
- "userQuestion": "Any final tips for view trading history?",
3006
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
3007
- }
3008
- ]
3009
- },
3010
- {
3011
- "topicKey": "buy-tokens",
3012
- "label": "Buy tokens",
3013
- "category": "trading",
3014
- "description": "Buy, sell, and calculate token amounts",
3015
- "methodCount": 2,
3016
- "exchanges": [
3017
- {
3018
- "userQuestion": "How do I buy tokens?",
3019
- "assistantResponse": "\n## Buying Tokens with SDK\n\n**Covers Methods:**\n- `calculateBuyAmount()`\n- `buy()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function buyTokens() {\n // 1. Create SDK instance\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key-or-mnemonic'\n });\n\n // 2. Calculate expected amounts FIRST (REQUIRED)\n const calculation = await sdk.calculateBuyAmount({\n tokenName: 'dragnrkti',\n amount: '100', // Spending 100 GALA\n type: 'native' // 'native' = GALA amount, 'exact' = token amount\n });\n\n console.log('Expected tokens:', calculation.amount);\n console.log('RBC Fee:', calculation.reverseBondingCurveFee);\n console.log('Transaction fee:', calculation.transactionFee);\n\n // 3. Execute buy with slippage protection\n const result = await sdk.buy({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native',\n expectedAmount: calculation.amount, // REQUIRED: from step 2\n maxAcceptableReverseBondingCurveFee: calculation.reverseBondingCurveFee, // RECOMMENDED\n slippageToleranceFactor: 0.01 // 1% slippage tolerance (REQUIRED)\n });\n\n console.log('Transaction ID:', result.transactionId);\n console.log('GALA spent:', result.inputAmount);\n console.log('Tokens received:', result.outputAmount);\n console.log('Total fees:', result.totalFees);\n}\n```\n\n**MCP Tool Equivalent:** `gala_launchpad_buy_tokens`\n"
3020
- },
3021
- {
3022
- "userQuestion": "What parameters does calculateBuyAmount() accept?",
3023
- "assistantResponse": "The primary methods for Buy tokens are `calculateBuyAmount()`, `buy()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3024
- },
3025
- {
3026
- "userQuestion": "What are best practices for buy tokens?",
3027
- "assistantResponse": "1. **Always calculate first**: Call `calculateBuyAmount()` before `buy()` to get expected amounts and fees.\n2. **Set slippage tolerance**: Use `slippageToleranceFactor` (e.g., 0.01 for 1%) to protect against price movements.\n3. **Handle errors gracefully**: Wrap in try-catch and provide user-friendly error messages."
3028
- },
3029
- {
3030
- "userQuestion": "What errors should I handle when buy tokens?",
3031
- "assistantResponse": "**Common Errors:**\n- `InsufficientBalance`: Not enough GALA - check balance first with `fetchGalaBalance()`\n- `SlippageExceeded`: Price moved - increase slippage tolerance or retry\n- `PoolNotFound`: Token not on bonding curve - check with `fetchPoolDetails()`\n\n**Error Handling Pattern:**\n```typescript\ntry {\n const result = await sdk.buy({ tokenName, amount, type: 'native', ... });\n} catch (error) {\n if (error.message.includes('insufficient')) {\n // Handle balance issue\n } else if (error.message.includes('slippage')) {\n // Retry with higher tolerance\n }\n}\n```"
3032
- },
3033
- {
3034
- "userQuestion": "What edge cases should I know about for buy tokens?",
3035
- "assistantResponse": "**Edge Cases to Watch:**\n1. **Graduated tokens**: Bonding curve methods don't work for graduated tokens - use DEX trading instead\n2. **Minimum amounts**: Very small purchases may fail due to fee minimums\n3. **RBC fees**: Reverse bonding curve fees vary based on pool state\n\n**Gotcha:** `calculateBuyAmount` returns the fee breakdown - always pass `reverseBondingCurveFee` to the `buy()` call!"
3036
- },
3037
- {
3038
- "userQuestion": "When would I actually use buy tokens in a real application?",
3039
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Trading Bot**: Automate token purchases based on price signals\n2. **DCA Strategy**: Schedule regular purchases at intervals\n3. **Portfolio Rebalancing**: Buy tokens to maintain target allocations\n4. **Arbitrage**: Buy when price is favorable vs other markets"
3040
- },
3041
- {
3042
- "userQuestion": "What should I learn next after buy tokens?",
3043
- "assistantResponse": "**Related Topics:**\n\n- **Sell tokens**: `explainSdkUsage({ topic: 'sell-tokens' })`\n- **Pool graduation**: `explainSdkUsage({ topic: 'pool-graduation' })`\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3044
- }
3045
- ]
3046
- },
3047
- {
3048
- "topicKey": "local-calculations",
3049
- "label": "Local calculations",
3050
- "category": "trading",
3051
- "description": "Buy, sell, and calculate token amounts",
3052
- "methodCount": 5,
3053
- "exchanges": [
3054
- {
3055
- "userQuestion": "How do I perform local calculations?",
3056
- "assistantResponse": "\n## Local Bonding Curve Calculations with SDK\n\n**Covers Methods:**\n- `calculateBuyAmountLocal()`\n- `calculateSellAmountLocal()`\n- `calculateBuyAmountExternal()`\n- `calculateSellAmountExternal()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function localCalculationsExample() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // ============================================================================\n // LOCAL CALCULATIONS - Instant quotes without network calls\n // ============================================================================\n\n // 1. Buy calculation (local, instant)\n const localBuy = await sdk.calculateBuyAmountLocal({\n tokenName: 'dragnrkti',\n amount: '100', // Spending 100 GALA\n type: 'native' // 'native' = GALA amount, 'exact' = token amount\n });\n\n console.log('LOCAL Buy Quote (instant):');\n console.log(' Tokens received:', localBuy.amount);\n console.log(' Transaction fee:', localBuy.transactionFee);\n console.log(' RBC Fee:', localBuy.reverseBondingCurveFee); // Always \"0\" for buys\n console.log(' Gas fee:', localBuy.gasFee);\n\n // 2. Sell calculation (local, requires pool details)\n const poolDetails = await sdk.fetchPoolDetails('dragnrkti');\n\n const localSell = await sdk.calculateSellAmountLocal({\n tokenName: 'dragnrkti',\n amount: '1000', // Selling 1000 tokens\n type: 'exact',\n // Required parameters from pool details:\n maxSupply: poolDetails.maxSupply.toString(),\n minFeePortion: poolDetails.reverseBondingCurveMinFeeFactor || 0,\n maxFeePortion: poolDetails.reverseBondingCurveMaxFeeFactor || 0\n });\n\n console.log('LOCAL Sell Quote (instant):');\n console.log(' GALA received:', localSell.amount);\n console.log(' RBC Fee:', localSell.reverseBondingCurveFee);\n console.log(' Transaction fee:', localSell.transactionFee);\n\n // ============================================================================\n // EXTERNAL CALCULATIONS - Real-time network queries (explicit)\n // ============================================================================\n\n // 3. External buy (explicit network call)\n const externalBuy = await sdk.calculateBuyAmountExternal({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native'\n });\n\n console.log('EXTERNAL Buy Quote (network):');\n console.log(' Tokens received:', externalBuy.amount);\n\n // 4. External sell (explicit network call)\n const externalSell = await sdk.calculateSellAmountExternal({\n tokenName: 'dragnrkti',\n amount: '1000',\n type: 'exact'\n });\n\n console.log('EXTERNAL Sell Quote (network):');\n console.log(' GALA received:', externalSell.amount);\n\n // ============================================================================\n // A/B COMPARISON - Verify local accuracy\n // ============================================================================\n\n // Use compareAmounts for precise quote comparison\n const buyComparison = compareAmounts(localBuy.amount, externalBuy.amount);\n const buyDiff = Math.abs(safeParseNumber(localBuy.amount, 0) - safeParseNumber(externalBuy.amount, 0));\n const buyPct = (buyDiff / safeParseNumber(externalBuy.amount, 1)) * 100;\n\n console.log('Local vs External Accuracy:');\n console.log(` Buy difference: ${toBigNumberFixed(buyPct, 4)}% (should be <0.01%)`);\n\n // ============================================================================\n // PERFORMANCE BENEFIT - Local is instant\n // ============================================================================\n\n console.time('Local calculation');\n await sdk.calculateBuyAmountLocal({ tokenName: 'dragnrkti', amount: '100', type: 'native' });\n console.timeEnd('Local calculation'); // ~0ms (instant)\n\n console.time('External calculation');\n await sdk.calculateBuyAmountExternal({ tokenName: 'dragnrkti', amount: '100', type: 'native' });\n console.timeEnd('External calculation'); // ~200-500ms (network roundtrip)\n}\n```\n\n**Benefits of Local Calculations:**\n- ✅ Instant quotes (no network delay)\n- ✅ Offline support (no internet required)\n- ✅ No API rate limits\n- ✅ Perfect accuracy (<0.01% difference)\n- ✅ Reduced server load\n\n**When to Use:**\n- Local: Price discovery, UI updates, offline scenarios\n- External: Production trades (always verify before executing)\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_calculate_buy_amount_local`\n- `gala_launchpad_calculate_buy_amount_external`\n- `gala_launchpad_calculate_sell_amount_local`\n- `gala_launchpad_calculate_sell_amount_external`\n"
3057
- },
3058
- {
3059
- "userQuestion": "What parameters does calculateBuyAmountLocal() accept?",
3060
- "assistantResponse": "The primary methods for Local calculations are `calculateBuyAmountLocal()`, `calculateSellAmountLocal()`, `calculateBuyAmountExternal()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3061
- },
3062
- {
3063
- "userQuestion": "What are best practices for perform local calculations?",
3064
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3065
- },
3066
- {
3067
- "userQuestion": "Can you walk me through a complete perform local calculations example?",
3068
- "assistantResponse": "**Complete Workflow: Local calculations**\n\nHere's the typical flow: `calculateBuyAmountLocal()` → `calculateSellAmountLocal()` → `calculateBuyAmountExternal()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
3069
- },
3070
- {
3071
- "userQuestion": "What other methods are available for Local calculations?",
3072
- "assistantResponse": "**Additional Methods:**\n\n- `calculateSellAmountExternal()`\n- `calculateInitialBuyAmount()`\n\n**Total methods in this topic:** 5\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
3073
- },
3074
- {
3075
- "userQuestion": "What should I learn next after perform local calculations?",
3076
- "assistantResponse": "**Related Topics:**\n\n- **Buy tokens**: `explainSdkUsage({ topic: 'buy-tokens' })`\n- **Sell tokens**: `explainSdkUsage({ topic: 'sell-tokens' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3077
- }
3078
- ]
3079
- },
3080
- {
3081
- "topicKey": "pool-graduation",
3082
- "label": "Pool graduation",
3083
- "category": "trading",
3084
- "description": "Buy, sell, and calculate token amounts",
3085
- "methodCount": 2,
3086
- "exchanges": [
3087
- {
3088
- "userQuestion": "How do I graduate token pools?",
3089
- "assistantResponse": "\n## Pool Graduation with SDK\n\n**Covers Methods:**\n- `calculateBuyAmountForGraduation()`\n- `graduateToken()`\n\n```typescript\nimport { createLaunchpadSDK, compareAmounts } from '@gala-chain/launchpad-sdk';\n\nasync function graduatePool() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Option 1: Calculate graduation cost first (recommended)\n const calculation = await sdk.calculateBuyAmountForGraduation('dragnrkti');\n\n console.log('GALA cost to graduate:', calculation.amount);\n console.log('RBC Fee:', calculation.reverseBondingCurveFee);\n console.log('Transaction fee:', calculation.transactionFee);\n\n // Check if you have enough balance\n const balance = await sdk.fetchGalaBalance();\n // Use compareAmounts() instead of parseFloat for precision with currency amounts\n if (compareAmounts(balance.balance, calculation.amount) < 0) {\n throw new Error('Insufficient GALA balance');\n }\n\n // Option 2: One-step graduation (convenience method)\n const result = await sdk.graduateToken({\n tokenName: 'dragnrkti',\n slippageToleranceFactor: 0.01 // Optional: defaults to SDK config\n });\n\n console.log('Pool graduated!');\n console.log('Transaction ID:', result.transactionId);\n console.log('Total GALA spent:', result.inputAmount);\n console.log('Tokens received:', result.outputAmount);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_calculate_buy_amount_for_graduation`\n- `gala_launchpad_graduate_token`\n"
3090
- },
3091
- {
3092
- "userQuestion": "What parameters does calculateBuyAmountForGraduation() accept?",
3093
- "assistantResponse": "The primary methods for Pool graduation are `calculateBuyAmountForGraduation()`, `graduateToken()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3094
- },
3095
- {
3096
- "userQuestion": "What are best practices for graduate token pools?",
3097
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3098
- },
3099
- {
3100
- "userQuestion": "What errors should I handle when graduate token pools?",
3101
- "assistantResponse": "**General Error Handling:**\n\n```typescript\ntry {\n const result = await sdk.poolgraduation(...);\n} catch (error) {\n if (error instanceof Error) {\n console.error('Operation failed:', error.message);\n // Handle specific error types\n }\n}\n```\n\n**Common Issues:**\n- Network timeouts - implement retry logic\n- Invalid parameters - validate before calling\n- Authentication errors - ensure valid session"
3102
- },
3103
- {
3104
- "userQuestion": "What should I learn next after graduate token pools?",
3105
- "assistantResponse": "**Related Topics:**\n\n- **Buy tokens**: `explainSdkUsage({ topic: 'buy-tokens' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Token status**: `explainSdkUsage({ topic: 'token-status' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3106
- }
3107
- ]
3108
- },
3109
- {
3110
- "topicKey": "sell-tokens",
3111
- "label": "Sell tokens",
3112
- "category": "trading",
3113
- "description": "Buy, sell, and calculate token amounts",
3114
- "methodCount": 2,
3115
- "exchanges": [
3116
- {
3117
- "userQuestion": "How do I sell tokens?",
3118
- "assistantResponse": "\n## Selling Tokens with SDK\n\n**Covers Methods:**\n- `calculateSellAmount()`\n- `sell()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function sellTokens() {\n // 1. Create SDK instance\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // 2. Calculate expected GALA FIRST (REQUIRED)\n const calculation = await sdk.calculateSellAmount({\n tokenName: 'dragnrkti',\n amount: '1000', // Selling 1000 tokens\n type: 'exact' // 'exact' = exact tokens, 'native' = target GALA amount\n });\n\n console.log('Expected GALA:', calculation.amount);\n console.log('RBC Fee:', calculation.reverseBondingCurveFee);\n\n // 3. Execute sell with slippage protection\n const result = await sdk.sell({\n tokenName: 'dragnrkti',\n amount: '1000',\n type: 'exact',\n expectedAmount: calculation.amount, // REQUIRED: from step 2\n maxAcceptableReverseBondingCurveFee: calculation.reverseBondingCurveFee, // RECOMMENDED\n slippageToleranceFactor: 0.01 // 1% slippage\n });\n\n console.log('Tokens sold:', result.inputAmount);\n console.log('GALA received:', result.outputAmount);\n}\n```\n\n**MCP Tool Equivalent:** `gala_launchpad_sell_tokens`\n"
3119
- },
3120
- {
3121
- "userQuestion": "What parameters does calculateSellAmount() accept?",
3122
- "assistantResponse": "The primary methods for Sell tokens are `calculateSellAmount()`, `sell()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3123
- },
3124
- {
3125
- "userQuestion": "What are best practices for sell tokens?",
3126
- "assistantResponse": "1. **Calculate before selling**: Use `calculateSellAmount()` to preview the GALA you'll receive.\n2. **Consider fees**: RBC fees affect your final amount.\n3. **Verify token balance**: Check you have enough tokens before attempting to sell."
3127
- },
3128
- {
3129
- "userQuestion": "What errors should I handle when sell tokens?",
3130
- "assistantResponse": "**Common Errors:**\n- `InsufficientTokenBalance`: Not enough tokens to sell\n- `SlippageExceeded`: Price moved during transaction\n- `TokenLocked`: Some tokens may be locked - check with `fetchLockedBalance()`\n\n**Tip:** Always verify your available (unlocked) balance before selling."
3131
- },
3132
- {
3133
- "userQuestion": "What edge cases should I know about for sell tokens?",
3134
- "assistantResponse": "**Edge Cases:**\n1. **Partial sells**: You can sell any amount up to your balance\n2. **Graduated tokens**: Use DEX trading, not bonding curve\n3. **Fee calculation**: RBC fee percentage changes based on supply\n\n**Gotcha:** Selling large amounts can have significant price impact on smaller pools."
3135
- },
3136
- {
3137
- "userQuestion": "When would I actually use sell tokens in a real application?",
3138
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Profit Taking**: Sell portion of holdings at target prices\n2. **Stop Loss**: Automated selling when price drops below threshold\n3. **Portfolio Rebalancing**: Sell to maintain allocation percentages\n4. **Liquidity Provision**: Sell to provide capital for other investments"
3139
- },
3140
- {
3141
- "userQuestion": "What should I learn next after sell tokens?",
3142
- "assistantResponse": "**Related Topics:**\n\n- **Buy tokens**: `explainSdkUsage({ topic: 'buy-tokens' })`\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n- **Transfers**: `explainSdkUsage({ topic: 'transfers' })`\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3143
- }
3144
- ]
3145
- },
3146
- {
3147
- "topicKey": "trading-analytics",
3148
- "label": "Trading analytics",
3149
- "category": "trading",
3150
- "description": "Buy, sell, and calculate token amounts",
3151
- "methodCount": 2,
3152
- "exchanges": [
3153
- {
3154
- "userQuestion": "How do I analyze trading data?",
3155
- "assistantResponse": "\n## Trading History and Analytics\n\n**Covers Methods:**\n- `fetchTrades()` - Legacy trade fetching by token\n- `getV1Trades()` - Flexible trade queries with tokenName/userAddress filters\n\nAnalyze individual trades for technical analysis and bot development.\n\n**Use Cases:**\n- Track recent trading activity\n- Calculate average trade size\n- Identify whale transactions\n- Build trading bots with historical data\n- Query a user's trading history across all tokens\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function tradingAnalytics() {\n const sdk = createLaunchpadSDK({ environment: 'production' });\n\n // Fetch recent trades for a token (legacy method)\n const trades = await sdk.fetchTrades('anime', {\n limit: 100,\n page: 1\n });\n\n console.log(`Analyzing ${trades.total} trades`);\n\n // Calculate analytics\n const totalVolume = trades.trades.reduce((sum, t) => sum + safeParseFloat(t.galaAmount, 0), 0);\n const averageTradeSize = totalVolume / trades.trades.length;\n const whaleTrades = trades.trades.filter(t => safeParseFloat(t.galaAmount, 0) > 1000);\n\n console.log(`Total volume: ${totalVolume} GALA`);\n console.log(`Average trade size: ${averageTradeSize} GALA`);\n console.log(`Whale trades (>1000 GALA): ${whaleTrades.length}`);\n\n // Most recent trades\n trades.trades.slice(0, 10).forEach(trade => {\n console.log(`${trade.type}: ${trade.galaAmount} GALA at ${trade.timestamp}`);\n });\n}\n\n// V1 Trades API - Flexible queries with filters\nasync function queryTradesV1() {\n const sdk = createLaunchpadSDK({ environment: 'production' });\n\n // Query all trades for a specific token\n const { trades, meta } = await sdk.getV1Trades({ tokenName: 'anime' });\n console.log(`Found ${meta.totalItems} trades for anime`);\n\n // Query all trades by a specific user\n const userTrades = await sdk.getV1Trades({\n userAddress: 'eth|1234567890abcdef...'\n });\n console.log(`User has ${userTrades.meta.totalItems} trades across all tokens`);\n\n // Query a user's trades on a specific token with pagination\n const filteredTrades = await sdk.getV1Trades({\n tokenName: 'anime',\n userAddress: 'eth|1234567890abcdef...',\n page: 2,\n limit: 20\n });\n console.log(`Page ${filteredTrades.meta.currentPage} of ${filteredTrades.meta.totalPages}`);\n\n // Analyze trade types\n filteredTrades.trades.forEach(trade => {\n console.log(`${trade.txnType}: ${trade.inputAmount} -> ${trade.outputAmount}`);\n });\n}\n```\n\n**Related Topics:**\n- See `fetch-pools` for volume data analysis\n- See `dex-trading` for executing trades\n\n**MCP Tools:**\n- `gala_launchpad_fetch_trades` - Legacy trade fetching\n- `gala_launchpad_get_v1_trades` - Flexible trade queries with filters\n"
3156
- },
3157
- {
3158
- "userQuestion": "What parameters does fetchTrades() accept?",
3159
- "assistantResponse": "The primary methods for Trading analytics are `fetchTrades()`, `getTrades()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3160
- },
3161
- {
3162
- "userQuestion": "What are best practices for analyze trading data?",
3163
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3164
- },
3165
- {
3166
- "userQuestion": "What should I learn next after analyze trading data?",
3167
- "assistantResponse": "**Related Topics:**\n\n- **Trade history**: `explainSdkUsage({ topic: 'trade-history' })`\n- **Price history**: `explainSdkUsage({ topic: 'price-history' })`\n- **Fetch pools**: `explainSdkUsage({ topic: 'fetch-pools' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3168
- },
3169
- {
3170
- "userQuestion": "Any final tips for analyze trading data?",
3171
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
3172
- }
3173
- ]
3174
- },
3175
- {
3176
- "topicKey": "transfers",
3177
- "label": "Transfers",
3178
- "category": "transfers",
3179
- "description": "GALA and token transfers",
3180
- "methodCount": 2,
3181
- "exchanges": [
3182
- {
3183
- "userQuestion": "How do I transfer tokens?",
3184
- "assistantResponse": "\n## Token Transfers with SDK\n\n**Covers Methods:**\n- `transferGala()`\n- `transferToken()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function transferTokens() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // Transfer GALA tokens\n const galaTransfer = await sdk.transferGala({\n recipientAddress: '0x1234...', // or 'eth|1234...'\n amount: '100',\n uniqueKey: 'galaconnect-operation-my-transfer-123' // Optional idempotency\n });\n\n console.log('GALA transfer ID:', galaTransfer.transactionId);\n console.log('Status:', galaTransfer.status);\n\n // Transfer launchpad tokens\n const tokenTransfer = await sdk.transferToken({\n to: 'eth|5678...',\n tokenName: 'dragnrkti',\n amount: '1000', // Token amount\n uniqueKey: 'galaconnect-operation-token-456'\n });\n\n console.log('Token transfer ID:', tokenTransfer.transactionId);\n}\n```\n\n**Features:**\n- EIP-712 signatures for security\n- Supports both `0x` and `eth|` address formats\n- Optional idempotency keys prevent duplicates\n- Comprehensive validation\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_transfer_gala`\n- `gala_launchpad_transfer_token`\n"
3185
- },
3186
- {
3187
- "userQuestion": "What parameters does transferGala() accept?",
3188
- "assistantResponse": "The primary methods for Transfers are `transferGala()`, `transferToken()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3189
- },
3190
- {
3191
- "userQuestion": "What are best practices for transfer tokens?",
3192
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3193
- },
3194
- {
3195
- "userQuestion": "What errors should I handle when transfer tokens?",
3196
- "assistantResponse": "**Common Errors:**\n- `InsufficientBalance`: Not enough tokens/GALA\n- `InvalidRecipientAddress`: Check address format\n- `TokenLocked`: Some balance may be locked\n\n**Tip:** Verify available balance before transfer."
3197
- },
3198
- {
3199
- "userQuestion": "What should I learn next after transfer tokens?",
3200
- "assistantResponse": "**Related Topics:**\n\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n- **Locks**: `explainSdkUsage({ topic: 'locks' })`\n- **Bridge operations**: `explainSdkUsage({ topic: 'bridge-operations' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3201
- }
3202
- ]
3203
- },
3204
- {
3205
- "topicKey": "error-handling",
3206
- "label": "Error handling",
3207
- "category": "utils",
3208
- "description": "SDK configuration and helpers",
3209
- "methodCount": 0,
3210
- "exchanges": [
3211
- {
3212
- "userQuestion": "How do I handle SDK errors properly?",
3213
- "assistantResponse": "\n## Error Handling with SDK\n\n**Covers Methods:**\n- Error types from SDK (ValidationError, NetworkError, TransactionError, TokenNotFoundError, etc.)\n\n```typescript\nimport {\n createLaunchpadSDK,\n ValidationError,\n NetworkError,\n TransactionError,\n TokenNotFoundError\n} from '@gala-chain/launchpad-sdk';\n\nasync function errorHandlingExample() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n try {\n // Attempt trade\n const result = await sdk.buy({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native',\n expectedAmount: '5000',\n slippageToleranceFactor: 0.01\n });\n\n console.log('Success:', result.transactionId);\n\n } catch (error) {\n if (error instanceof ValidationError) {\n console.error('Invalid input:', error.message);\n console.error('Field:', error.field);\n console.error('Code:', error.code);\n\n } else if (error instanceof TokenNotFoundError) {\n console.error('Token does not exist:', error.tokenName);\n\n } else if (error instanceof NetworkError) {\n console.error('Network issue:', error.message);\n console.error('Status code:', error.statusCode);\n\n } else if (error instanceof TransactionError) {\n console.error('Transaction failed:', error.message);\n console.error('Transaction ID:', error.transactionId);\n\n } else {\n console.error('Unexpected error:', error);\n }\n }\n}\n```\n\n**Error Types:**\n- `ValidationError` - Invalid input parameters\n- `NetworkError` - HTTP/network failures\n- `TransactionError` - Blockchain transaction failures\n- `TokenNotFoundError` - Token doesn't exist\n- `ConfigurationError` - SDK misconfiguration\n- `WebSocketError` - Real-time connection issues\n"
3214
- },
3215
- {
3216
- "userQuestion": "Where can I find more details about handle SDK errors properly?",
3217
- "assistantResponse": "This topic covers conceptual material and best practices. For reference documentation, check the full SDK API docs or use TypeScript intellisense in your editor for complete method signatures and parameter types."
3218
- },
3219
- {
3220
- "userQuestion": "What are best practices for handle SDK errors properly?",
3221
- "assistantResponse": "1. **Wrap all SDK calls in try-catch**: Handle errors gracefully.\n2. **Check for specific error types**: Different errors require different handling.\n3. **Log errors for debugging**: Include context like token name and amounts."
3222
- },
3223
- {
3224
- "userQuestion": "What should I learn next after handle SDK errors properly?",
3225
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3226
- },
3227
- {
3228
- "userQuestion": "Any final tips for handle SDK errors properly?",
3229
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
3230
- }
3231
- ]
3232
- },
3233
- {
3234
- "topicKey": "installation",
3235
- "label": "Installation",
3236
- "category": "utils",
3237
- "description": "SDK configuration and helpers",
3238
- "methodCount": 0,
3239
- "exchanges": [
3240
- {
3241
- "userQuestion": "How do I install and configure the SDK?",
3242
- "assistantResponse": "\n## Installing and Importing SDK\n\n**Covers Methods:**\n- SDK installation, imports, and configuration\n\n### NPM Installation\n\n```bash\n# Install SDK\nnpm install @gala-chain/launchpad-sdk\n\n# Install peer dependencies\nnpm install ethers@^6.15.0 @gala-chain/api@^2.4.3 @gala-chain/connect@^2.4.3 \\\n socket.io-client@^4.8.1 axios@^1.12.2 bignumber.js@^9.1.2 zod@^3.25.76\n```\n\n### Import Patterns\n\n```typescript\n// Main SDK class\nimport { LaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\n// Helper functions (recommended)\nimport {\n createLaunchpadSDK,\n createTestLaunchpadSDK,\n createWallet,\n validateWalletInput\n} from '@gala-chain/launchpad-sdk';\n\n// Error types\nimport {\n ValidationError,\n NetworkError,\n TransactionError,\n TokenNotFoundError\n} from '@gala-chain/launchpad-sdk';\n\n// Type definitions\nimport type {\n PoolData,\n TradeResult,\n TokenBalanceInfo,\n BuyTokenOptions,\n SellTokenOptions\n} from '@gala-chain/launchpad-sdk';\n```\n\n### Environment Configuration\n\n```typescript\n// Production (default)\nconst sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: {\n baseUrl: 'https://lpad-backend-prod1.defi.gala.com',\n debug: false,\n timeout: 60000\n }\n});\n\n// Development\nconst sdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: {\n baseUrl: 'https://lpad-backend-dev1.defi.gala.com',\n debug: true\n }\n});\n```\n"
3243
- },
3244
- {
3245
- "userQuestion": "Where can I find more details about install and configure the SDK?",
3246
- "assistantResponse": "This topic covers conceptual material and best practices. For reference documentation, check the full SDK API docs or use TypeScript intellisense in your editor for complete method signatures and parameter types."
3247
- },
3248
- {
3249
- "userQuestion": "What are best practices for install and configure the SDK?",
3250
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3251
- },
3252
- {
3253
- "userQuestion": "What should I learn next after install and configure the SDK?",
3254
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3255
- },
3256
- {
3257
- "userQuestion": "Any final tips for install and configure the SDK?",
3258
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
3259
- }
3260
- ]
3261
- },
3262
- {
3263
- "topicKey": "liquidity-positions",
3264
- "label": "Liquidity positions",
3265
- "category": "utils",
3266
- "description": "SDK configuration and helpers",
3267
- "methodCount": 9,
3268
- "exchanges": [
3269
- {
3270
- "userQuestion": "How do I manage liquidity positions?",
3271
- "assistantResponse": "\n## GSwap Liquidity Position Management\n\n**Covers Methods:**\n- `getSwapUserLiquidityPositions()`\n- `getAllSwapUserLiquidityPositions()`\n- `getSwapLiquidityPosition()`\n- `getSwapLiquidityPositionById()`\n- `addSwapLiquidityByPrice()`\n- `addSwapLiquidityByTicks()`\n- `getSwapEstimateRemoveLiquidity()`\n- `removeSwapLiquidity()`\n- `collectSwapPositionFees()`\n\nProvide liquidity on GalaSwap DEX and earn passive trading fees from swaps.\n\n**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.\n\n**9 Core SDK Methods:**\n\n1. **getSwapUserLiquidityPositions(ownerAddress, limit?, bookmark?)** - View all open positions for wallet\n - Returns: Array of positions with token pairs, amounts, accumulated fees\n\n2. **getSwapLiquidityPositionById(ownerAddress, positionId)** - Get specific position by UUID\n\n3. **getSwapLiquidityPosition(ownerAddress, position)** - Get position by token pair and tick range\n\n4. **addSwapLiquidityByPrice(args)** - Create position using user-friendly price ranges\n - params: token0, token1, fee, minPrice, maxPrice, amount0Desired, amount1Desired\n\n5. **addSwapLiquidityByTicks(args)** - Create position using precise tick boundaries (advanced)\n\n6. **getSwapEstimateRemoveLiquidity(args)** - Preview removal amounts before executing\n - Returns: estimated token amounts and accumulated fees\n\n7. **removeSwapLiquidity(args)** - Close or reduce position with slippage protection\n - Removes liquidity and collects accumulated fees\n\n8. **collectSwapPositionFees(args)** - Harvest accumulated fees without closing position\n - Passive income collection\n\n**Fee Tiers:** 500 bps (0.05%), 3000 bps (0.30%), 10000 bps (1.00%)\n\n**MCP Tools (8 tools):**\n- gala_launchpad_get_user_liquidity_positions\n- gala_launchpad_get_liquidity_position_by_id\n- gala_launchpad_get_liquidity_position\n- gala_launchpad_add_liquidity_by_price\n- gala_launchpad_add_liquidity_by_ticks\n- gala_launchpad_estimate_remove_liquidity\n- gala_launchpad_remove_liquidity\n- gala_launchpad_collect_position_fees\n\n**Slash Commands (4 commands):**\n- /galachain-launchpad:my-positions - View all positions\n- /galachain-launchpad:add-liquidity - Create position\n- /galachain-launchpad:remove-liquidity - Close position\n- /galachain-launchpad:collect-fees - Harvest fees\n\n**Auto-Pagination Method:**\n\nUse `getAllSwapUserLiquidityPositions()` to fetch all positions without manual pagination:\n\n```typescript\n// Fetch ALL positions automatically (handles pagination internally)\nconst allPositions = await sdk.getAllSwapUserLiquidityPositions(ownerAddress);\n\nconsole.log(`Total positions: ${allPositions.length}`);\nallPositions.forEach(position => {\n const fees = position.fees0 + position.fees1; // Total accumulated fees\n console.log(`Position: ${position.token0}-${position.token1}`);\n console.log(`Accumulated fees: ${fees}`);\n});\n```\n\n**Demo Script:** See packages/sdk/examples/demo-liquidity-positions.ts for complete workflows\n"
3272
- },
3273
- {
3274
- "userQuestion": "What parameters does getSwapUserLiquidityPositions() accept?",
3275
- "assistantResponse": "The primary methods for Liquidity positions are `getSwapUserLiquidityPositions()`, `getAllSwapUserLiquidityPositions()`, `getSwapLiquidityPosition()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3276
- },
3277
- {
3278
- "userQuestion": "What are best practices for manage liquidity positions?",
3279
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3280
- },
3281
- {
3282
- "userQuestion": "What errors should I handle when manage liquidity positions?",
3283
- "assistantResponse": "**Common Errors:**\n- `TickOutOfRange`: Invalid tick boundaries for fee tier\n- `InsufficientAmount`: Not enough tokens for position\n- `PositionNotFound`: Position ID doesn't exist\n\n**Tip:** Use `addSwapLiquidityByPrice()` for easier price-based ranges."
3284
- },
3285
- {
3286
- "userQuestion": "Can you walk me through a complete manage liquidity positions example?",
3287
- "assistantResponse": "**Complete Workflow: Liquidity positions**\n\nHere's the typical flow: `getSwapUserLiquidityPositions()` → `getAllSwapUserLiquidityPositions()` → `getSwapLiquidityPosition()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
3288
- },
3289
- {
3290
- "userQuestion": "What other methods are available for Liquidity positions?",
3291
- "assistantResponse": "**Additional Methods:**\n\n- `getSwapLiquidityPositionById()`\n- `addSwapLiquidityByPrice()`\n- `addSwapLiquidityByTicks()`\n- `getSwapEstimateRemoveLiquidity()`\n\n**Total methods in this topic:** 9\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
3292
- },
3293
- {
3294
- "userQuestion": "When would I actually use manage liquidity positions in a real application?",
3295
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Fee Earning**: Provide liquidity to earn trading fees\n2. **Market Making**: Set tight ranges for active trading pairs\n3. **Range Orders**: Use LP positions as limit orders\n4. **Yield Strategies**: Combine with other DeFi protocols"
3296
- },
3297
- {
3298
- "userQuestion": "What should I learn next after manage liquidity positions?",
3299
- "assistantResponse": "**Related Topics:**\n\n- **Dex trading**: `explainSdkUsage({ topic: 'dex-trading' })`\n- **Fetch dex pools**: `explainSdkUsage({ topic: 'fetch-dex-pools' })`\n- **Advanced dex analysis**: `explainSdkUsage({ topic: 'advanced-dex-analysis' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3300
- }
3301
- ]
3302
- },
3303
- {
3304
- "topicKey": "mcp-to-sdk-mapping",
3305
- "label": "Mcp to sdk mapping",
3306
- "category": "utils",
3307
- "description": "SDK configuration and helpers",
3308
- "methodCount": 0,
3309
- "exchanges": [
3310
- {
3311
- "userQuestion": "How do I map MCP tools to SDK methods?",
3312
- "assistantResponse": "\n## MCP Tool to SDK Method Mapping Guide\n\n**Covers Concepts:**\n- Understanding MCP tool architecture\n- Mapping between MCP tools and SDK methods\n- When to use MCP vs direct SDK\n\nThis is a conceptual guide showing how MCP (Model Context Protocol) tools map to SDK methods.\n\n### Architecture Overview\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│ MCP Server Layer │\n│ (241 tools - user-friendly wrappers with validation) │\n└─────────────────────────────────────────────────────────────┘\n │\n ▼\n┌─────────────────────────────────────────────────────────────┐\n│ LaunchpadSDK Layer │\n│ (217 methods - low-level programmatic access) │\n└─────────────────────────────────────────────────────────────┘\n │\n ▼\n┌─────────────────────────────────────────────────────────────┐\n│ Gala Launchpad Backend APIs │\n│ (REST endpoints, WebSocket events, GalaChain) │\n└─────────────────────────────────────────────────────────────┘\n```\n\n### MCP vs SDK Decision Matrix\n\n| Scenario | Use MCP | Use SDK |\n|----------|---------|---------|\n| **AI Agent Development** | ✅ Yes | ❌ No |\n| **Claude Desktop Integration** | ✅ Yes | ❌ No |\n| **LLM-Driven Trading Bots** | ✅ Yes | ❌ No |\n| **TypeScript Application** | ❌ No | ✅ Yes |\n| **Node.js Backend Service** | ❌ No | ✅ Yes |\n| **React/Vue Frontend** | ❌ No | ✅ Yes |\n| **Python Application** | ❌ No (SDK only) | ❌ No (not yet) |\n\n### Tool Naming Conventions\n\n**MCP Tool Pattern:** `gala_launchpad_{action}_{resource}`\n**SDK Method Pattern:** `{action}{Resource}`\n\nExamples:\n- MCP: `gala_launchpad_fetch_pools` → SDK: `fetchPools()`\n- MCP: `gala_launchpad_buy_tokens` → SDK: `buy()`\n- MCP: `gala_launchpad_get_swap_quote_exact_input` → SDK: `getSwapQuoteExactInput()`\n\n### Common Mapping Patterns\n\n**1. Direct 1:1 Mapping (Most Common):**\n\n```typescript\n// MCP Tool: gala_launchpad_fetch_pools\n// SDK Method: fetchPools()\n\n// MCP Usage (AI agent)\nconst result = await tools.gala_launchpad_fetch_pools({\n type: 'recent',\n limit: 10\n});\n\n// SDK Usage (TypeScript app)\nconst sdk = createLaunchpadSDK({ wallet: 'private-key' });\nconst result = await sdk.fetchPools({ type: 'recent', limit: 10 });\n```\n\n**2. Composite Tool → Multiple SDK Methods:**\n\n```typescript\n// MCP Tool: gala_launchpad_buy_tokens_with_calculation\n// Calls TWO SDK methods internally:\n\n// 1. Calculate quote\nconst quote = await sdk.calculateBuyAmount({\n tokenName: 'anime',\n amount: '100',\n type: 'native'\n});\n\n// 2. Execute trade\nconst result = await sdk.buy({\n tokenName: 'anime',\n amount: '100',\n type: 'native',\n expectedAmount: quote.amount,\n slippageToleranceFactor: 0.01\n});\n```\n\n**3. SDK Method → No MCP Tool (Advanced Features):**\n\nSome SDK methods don't have MCP equivalents:\n- `setWallet()` - Runtime wallet changes\n- `getConfig()` - SDK configuration access\n- `warmCacheFromPoolData()` - Cache optimization\n\n**4. MCP Tool → No Direct SDK Method (Abstractions):**\n\nSome MCP tools provide abstractions:\n- `gala_launchpad_portfolio` - Aggregates multiple SDK calls\n- `gala_launchpad_analyze_token` - Composite analysis workflow\n\n### Complete Mapping Reference\n\n**Trading (13 MCP tools → 9 SDK methods):**\n\n| MCP Tool | SDK Method |\n|----------|-----------|\n| `gala_launchpad_buy_tokens` | `buy()` |\n| `gala_launchpad_sell_tokens` | `sell()` |\n| `gala_launchpad_calculate_buy_amount` | `calculateBuyAmount()` |\n| `gala_launchpad_calculate_sell_amount` | `calculateSellAmount()` |\n| `gala_launchpad_graduate_token` | `graduateToken()` |\n| `gala_launchpad_calculate_buy_amount_local` | `calculateBuyAmountLocal()` |\n| `gala_launchpad_calculate_sell_amount_local` | `calculateSellAmountLocal()` |\n| `gala_launchpad_calculate_buy_amount_external` | `calculateBuyAmountExternal()` |\n| `gala_launchpad_calculate_sell_amount_external` | `calculateSellAmountExternal()` |\n\n**DEX Trading (6 MCP tools → 6 SDK methods):**\n\n| MCP Tool | SDK Method |\n|----------|-----------|\n| `gala_launchpad_get_swap_quote_exact_input` | `getSwapQuoteExactInput()` |\n| `gala_launchpad_get_swap_quote_exact_output` | `getSwapQuoteExactOutput()` |\n| `gala_launchpad_execute_swap` | `executeSwap()` |\n| `gala_launchpad_get_swap_user_assets` | `getSwapUserAssets()` |\n| `gala_launchpad_get_all_swap_user_assets` | `getAllSwapUserAssets()` |\n| `gala_launchpad_get_swap_pool_info` | `getSwapPoolInfo()` |\n\n**Liquidity Management (8 MCP tools → 9 SDK methods):**\n\n| MCP Tool | SDK Method |\n|----------|-----------|\n| `gala_launchpad_get_user_liquidity_positions` | `getSwapUserLiquidityPositions()` |\n| `gala_launchpad_get_all_user_liquidity_positions` | `getAllSwapUserLiquidityPositions()` |\n| `gala_launchpad_get_liquidity_position_by_id` | `getSwapLiquidityPositionById()` |\n| `gala_launchpad_add_liquidity_by_price` | `addSwapLiquidityByPrice()` |\n| `gala_launchpad_add_liquidity_by_ticks` | `addSwapLiquidityByTicks()` |\n| `gala_launchpad_estimate_remove_liquidity` | `getSwapEstimateRemoveLiquidity()` |\n| `gala_launchpad_remove_liquidity` | `removeSwapLiquidity()` |\n| `gala_launchpad_collect_position_fees` | `collectSwapPositionFees()` |\n\n### When to Use Each\n\n**Use MCP Tools When:**\n- Building AI agents (Claude, GPT, etc.)\n- Need LLM-friendly error messages\n- Want automatic parameter validation\n- Working in Claude Desktop environment\n- Need slash command shortcuts\n\n**Use SDK Directly When:**\n- Building TypeScript/JavaScript applications\n- Need maximum performance\n- Want full TypeScript type safety\n- Building React/Vue components\n- Need fine-grained control\n\n### Migration Example\n\n**From MCP to SDK:**\n\n```typescript\n// AI Agent using MCP\nasync function mcpExample() {\n const result = await tools.gala_launchpad_buy_tokens({\n tokenName: 'anime',\n amount: '100',\n type: 'native',\n slippageToleranceFactor: 0.01\n });\n return result;\n}\n\n// TypeScript App using SDK\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function sdkExample() {\n const sdk = createLaunchpadSDK({ wallet: 'private-key' });\n\n // Step 1: Calculate quote\n const quote = await sdk.calculateBuyAmount({\n tokenName: 'anime',\n amount: '100',\n type: 'native'\n });\n\n // Step 2: Execute trade\n const result = await sdk.buy({\n tokenName: 'anime',\n amount: '100',\n type: 'native',\n expectedAmount: quote.amount,\n slippageToleranceFactor: 0.01\n });\n\n return result;\n}\n```\n\n**Key Differences:**\n1. MCP combines calculation + execution (safer for AI)\n2. SDK exposes individual steps (more control)\n3. MCP validates all inputs via Zod schemas\n4. SDK provides TypeScript type safety\n\n### Resources\n\n- **SDK Documentation**: packages/sdk/README.md\n- **MCP Documentation**: packages/mcp-server/README.md\n- **API Reference**: docs/API-REFERENCE.md\n- **Tool Registry**: packages/mcp-server/src/tools/registry.ts\n"
3313
- },
3314
- {
3315
- "userQuestion": "Where can I find more details about map MCP tools to SDK methods?",
3316
- "assistantResponse": "This topic covers conceptual material and best practices. For reference documentation, check the full SDK API docs or use TypeScript intellisense in your editor for complete method signatures and parameter types."
3317
- },
3318
- {
3319
- "userQuestion": "What are best practices for map MCP tools to SDK methods?",
3320
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3321
- },
3322
- {
3323
- "userQuestion": "What should I learn next after map MCP tools to SDK methods?",
3324
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3325
- },
3326
- {
3327
- "userQuestion": "Any final tips for map MCP tools to SDK methods?",
3328
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
3329
- }
3330
- ]
3331
- },
3332
- {
3333
- "topicKey": "multi-wallet",
3334
- "label": "Multi wallet",
3335
- "category": "utils",
3336
- "description": "SDK configuration and helpers",
3337
- "methodCount": 0,
3338
- "exchanges": [
3339
- {
3340
- "userQuestion": "How do I work with multiple wallets?",
3341
- "assistantResponse": "\n## Multi-Wallet Support with SDK\n\n**Covers Methods:**\n- `createWallet()` (utility function)\n- `buy()`, `sell()`, `launchToken()` with privateKey override\n\n```typescript\nimport { createLaunchpadSDK, createWallet } from '@gala-chain/launchpad-sdk';\n\nasync function multiWalletExample() {\n // Main SDK with your wallet\n const sdk = createLaunchpadSDK({\n wallet: 'your-main-private-key'\n });\n\n // Create a test wallet\n const testWallet = createWallet();\n console.log('Test wallet:', testWallet.address);\n\n // 1. Fund test wallet from main wallet\n await sdk.transferGala({\n recipientAddress: testWallet.address,\n amount: '1000'\n });\n\n // 2. Have test wallet buy tokens (using privateKey override)\n const buyCalc = await sdk.calculateBuyAmount({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native'\n });\n\n const buyResult = await sdk.buy({\n tokenName: 'dragnrkti',\n amount: '100',\n type: 'native',\n expectedAmount: buyCalc.amount,\n slippageToleranceFactor: 0.01,\n privateKey: testWallet.privateKey // Override to use test wallet\n });\n\n console.log('Test wallet bought tokens');\n\n // 3. Check balances for both wallets\n const mainBalance = await sdk.fetchGalaBalance(); // Main wallet\n const testBalance = await sdk.fetchGalaBalance(testWallet.address); // Test wallet\n\n console.log(`Main wallet: ${mainBalance.balance} GALA`);\n console.log(`Test wallet: ${testBalance.balance} GALA`);\n}\n```\n\n**Key Points:**\n- All signing operations support `privateKey` parameter\n- Creates temporary SDK instance internally\n- Supports: buy, sell, launchToken, transfers, profile updates\n"
3342
- },
3343
- {
3344
- "userQuestion": "Where can I find more details about work with multiple wallets?",
3345
- "assistantResponse": "This topic covers conceptual material and best practices. For reference documentation, check the full SDK API docs or use TypeScript intellisense in your editor for complete method signatures and parameter types."
3346
- },
3347
- {
3348
- "userQuestion": "What are best practices for work with multiple wallets?",
3349
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3350
- },
3351
- {
3352
- "userQuestion": "What should I learn next after work with multiple wallets?",
3353
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3354
- },
3355
- {
3356
- "userQuestion": "Any final tips for work with multiple wallets?",
3357
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
3358
- }
3359
- ]
3360
- },
3361
- {
3362
- "topicKey": "spot-prices-smart-routing",
3363
- "label": "Spot prices smart routing",
3364
- "category": "utils",
3365
- "description": "SDK configuration and helpers",
3366
- "methodCount": 2,
3367
- "exchanges": [
3368
- {
3369
- "userQuestion": "How do I get token prices with smart routing?",
3370
- "assistantResponse": "\n## Smart Spot Price Routing with DEX Fallback\n\n**Covers Methods:**\n- `fetchTokenPrice()` (smart routing)\n- `isTokenGraduated()`\n\nThe SDK intelligently routes pricing requests between DEX and Launchpad backends based on token graduation status - no need to know which backend a token uses!\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function tokenPricing() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // OPTION 1: SMART ROUTING (Recommended) - Automatic backend selection\n // Use tokenId for ANY token (graduated or ungraduated)\n // SDK automatically detects and routes to correct backend\n console.log('=== Smart Routing (Recommended) ===');\n const smartPrice = await sdk.fetchTokenPrice({\n tokenId: 'Token|Unit|ANIME|eth:0x...' // Works for ANY token!\n });\n console.log(`Token price: $${smartPrice}`);\n // ✅ Handles graduated tokens (DEX) automatically\n // ✅ Handles ungraduated tokens (Launchpad) automatically\n // ✅ No need to know token status beforehand\n\n // OPTION 2: EXPLICIT DEX PRICING - Graduated tokens only\n // Use tokenId directly for DEX tokens\n console.log('\\n=== Explicit DEX Pricing ===');\n const dexPrices = await sdk.fetchTokenPrice({\n tokenId: 'GALA|Unit|none|none' // Or other DEX token\n });\n console.log(`DEX Token GALA: $${dexPrices}`);\n\n // OPTION 3: TOKEN NAME PRICING - For launchpad tokens by name\n // Use tokenName for simple lookup of launchpad tokens\n console.log('\\n=== Token Name Pricing ===');\n const launchpadPrice = await sdk.fetchTokenPrice({ tokenName: 'anime' });\n console.log(`Launchpad token anime: $${launchpadPrice.price}`);\n\n // ADVANCED: The smart router handles fallback automatically!\n // No need for manual fallback - fetchTokenPrice with tokenId detects\n // ungraduated tokens and automatically falls back to launchpad pricing\n console.log('\\n=== Automatic Fallback (Built-in) ===');\n const autoPrice = await sdk.fetchTokenPrice({\n tokenId: 'Token|Unit|ANIME|eth:0x...' // Auto-fallback if ungraduated\n });\n console.log(`Auto-routed price: $${autoPrice.price}`);\n\n // USECASE: Price comparison and discovery\n console.log('\\n=== Price Discovery ===');\n async function comparePrices(tokenName: string) {\n const launchpadPrice = await sdk.fetchTokenPrice({ tokenName });\n\n // Check if graduated (on DEX)\n const isGraduated = await sdk.isTokenGraduated(tokenName);\n\n if (isGraduated) {\n const dexPrice = await sdk.fetchTokenPrice({\n tokenId: `Token|Unit|${tokenName.toUpperCase()}|eth:0x...`\n });\n console.log(`Launchpad: $${launchpadPrice.price}, DEX: $${dexPrice.price}`);\n return { launchpadPrice, dexPrice, graduated: true };\n } else {\n console.log(`Launchpad: $${launchpadPrice.price} (not on DEX yet)`);\n return { launchpadPrice, graduated: false };\n }\n }\n\n const priceComparison = await comparePrices('anime');\n}\n```\n\n**Smart Routing Benefits:**\n- ✅ **Seamless Transitions** - Works before and after token graduation\n- ✅ **No Backend Knowledge** - SDK handles routing automatically\n- ✅ **Error Handling** - Automatic fallback if needed\n- ✅ **Single API** - Use same method for all tokens\n\n**When to Use Each Method:**\n\n| Method | Use Case | Token Status |\n|--------|----------|--------------|\n| `fetchTokenPrice({ tokenId })` | Smart routing (recommended) | Any (DEX or Launchpad) |\n| `fetchTokenPrice({ tokenName })` | Token name pricing | Any |\n| `isTokenGraduated(name)` | Check token status | Any |\n\n**Key Differences:**\n\n**Ungraduated Tokens (Launchpad):**\n- Priced on exponential bonding curve\n- Token name parameter works: `fetchTokenPrice({ tokenName: 'anime' })`\n- Price affected by supply/demand\n\n**Graduated Tokens (DEX):**\n- Priced on DEX via order books\n- Token ID format needed: `Token|Unit|SYMBOL|eth:0x...`\n- Market-driven pricing\n\n**Graduation Impact:**\nWhen a token graduates from launchpad to DEX:\n- Bonding curve closes\n- Trading moves to DEX order books\n- Smart routing automatically switches backends\n- Old launchpad queries will fail (use DEX pricing instead)\n\n**Error Handling:**\n```typescript\nasync function safePriceQuery(tokenId: string) {\n try {\n // Always try smart routing first\n return await sdk.fetchTokenPrice({ tokenId });\n } catch (error) {\n if (error.message.includes('not found')) {\n console.log('Token not available on DEX');\n // Could try fallback to launchpad pricing here\n }\n throw error;\n }\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_fetch_token_spot_price` - Smart routing\n- `gala_launchpad_fetch_launchpad_token_spot_price` - Launchpad-only\n- `gala_launchpad_is_token_graduated` - Check graduation status\n"
3371
- },
3372
- {
3373
- "userQuestion": "What parameters does fetchTokenPrice() accept?",
3374
- "assistantResponse": "The primary methods for Spot prices smart routing are `fetchTokenPrice()`, `getSwapPoolPrice()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3375
- },
3376
- {
3377
- "userQuestion": "What are best practices for get token prices with smart routing?",
3378
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3379
- },
3380
- {
3381
- "userQuestion": "What should I learn next after get token prices with smart routing?",
3382
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3383
- },
3384
- {
3385
- "userQuestion": "Any final tips for get token prices with smart routing?",
3386
- "assistantResponse": "**Quick Tips:**\n\n1. **Start Simple**: Begin with the basic use case before exploring advanced features\n2. **Use TypeScript**: The SDK has full TypeScript support for better autocomplete and type safety\n3. **Check the Demos**: The examples/ directory has working demos for most SDK features\n4. **Read Error Messages**: SDK errors include helpful context for troubleshooting\n\nYou're ready to start building with this feature!"
3387
- }
3388
- ]
3389
- },
3390
- {
3391
- "topicKey": "token-creation",
3392
- "label": "Token creation",
3393
- "category": "utils",
3394
- "description": "SDK configuration and helpers",
3395
- "methodCount": 5,
3396
- "exchanges": [
3397
- {
3398
- "userQuestion": "How do I create and launch new tokens?",
3399
- "assistantResponse": "\n## Creating Tokens with SDK\n\n**Covers Methods:**\n- `isTokenNameAvailable()`\n- `isTokenSymbolAvailable()`\n- `fetchLaunchTokenFee()`\n- `uploadTokenImage()`\n- `launchToken()`\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function launchToken() {\n const sdk = createLaunchpadSDK({\n wallet: 'your-private-key'\n });\n\n // 1. Check if name/symbol available\n const nameAvailable = await sdk.isTokenNameAvailable('mytoken');\n const symbolAvailable = await sdk.isTokenSymbolAvailable('MTK');\n\n if (!nameAvailable || !symbolAvailable) {\n throw new Error('Name or symbol already taken');\n }\n\n // 2. Check launch fee\n const launchFee = await sdk.fetchLaunchTokenFee();\n console.log(`Launch fee: ${launchFee} GALA`);\n\n // 3. Upload token image (Node.js only)\n const imageUpload = await sdk.uploadTokenImage({\n tokenName: 'mytoken',\n imagePath: '/path/to/image.png'\n });\n\n // 4. Launch the token\n const result = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'My awesome token',\n tokenImage: imageUpload.imageUrl,\n websiteUrl: 'https://mytoken.com',\n twitterUrl: 'https://twitter.com/mytoken',\n preBuyQuantity: '100' // Optional: pre-buy with GALA\n });\n\n console.log('Token launched!');\n console.log('Transaction ID:', result.transactionId);\n\n // Get frontend URL\n const url = sdk.getUrlByTokenName('mytoken');\n console.log(`View at: ${url}`);\n}\n```\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_check_token_name`\n- `gala_launchpad_check_token_symbol`\n- `gala_launchpad_fetch_launch_token_fee`\n- `gala_launchpad_upload_token_image`\n- `gala_launchpad_launch_token`\n- `gala_launchpad_get_url_by_token_name`\n"
3400
- },
3401
- {
3402
- "userQuestion": "What parameters does isTokenNameAvailable() accept?",
3403
- "assistantResponse": "The primary methods for Token creation are `isTokenNameAvailable()`, `isTokenSymbolAvailable()`, `fetchLaunchTokenFee()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3404
- },
3405
- {
3406
- "userQuestion": "What are best practices for create and launch new tokens?",
3407
- "assistantResponse": "1. **Check availability**: Verify token name and symbol are available first.\n2. **Upload image first**: Use `uploadTokenImage()` before `launchToken()`.\n3. **Review fees**: Check launch fees with `fetchLaunchTokenFee()`."
3408
- },
3409
- {
3410
- "userQuestion": "What errors should I handle when create and launch new tokens?",
3411
- "assistantResponse": "**Common Errors:**\n- `TokenNameTaken`: Name already exists - check availability first\n- `SymbolTaken`: Symbol in use - verify with `isTokenSymbolAvailable()`\n- `InsufficientLaunchFee`: Check fee with `fetchLaunchTokenFee()`\n\n**Important:** Token creation is irreversible!"
3412
- },
3413
- {
3414
- "userQuestion": "Can you walk me through a complete create and launch new tokens example?",
3415
- "assistantResponse": "**Complete Workflow: Token creation**\n\nHere's the typical flow: `isTokenNameAvailable()` → `isTokenSymbolAvailable()` → `fetchLaunchTokenFee()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
3416
- },
3417
- {
3418
- "userQuestion": "What edge cases should I know about for create and launch new tokens?",
3419
- "assistantResponse": "**Edge Cases:**\n1. **Image requirements**: JPEG/PNG, reasonable size\n2. **Name restrictions**: Alphanumeric only, 3-20 chars\n3. **Symbol format**: Uppercase, 1-8 chars\n\n**Gotcha:** Once created, tokens cannot be renamed or have their symbol changed!"
3420
- },
3421
- {
3422
- "userQuestion": "What other methods are available for Token creation?",
3423
- "assistantResponse": "**Additional Methods:**\n\n- `uploadTokenImage()`\n- `launchToken()`\n\n**Total methods in this topic:** 5\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
3424
- },
3425
- {
3426
- "userQuestion": "When would I actually use create and launch new tokens in a real application?",
3427
- "assistantResponse": "**Real-World Use Cases:**\n\n1. **Community Tokens**: Launch tokens for DAOs or communities\n2. **Gaming Tokens**: Create in-game currencies or assets\n3. **Creator Coins**: Personal tokens for content creators\n4. **Project Tokens**: Utility tokens for new projects"
3428
- },
3429
- {
3430
- "userQuestion": "What should I learn next after create and launch new tokens?",
3431
- "assistantResponse": "**Related Topics:**\n\n- **Token details**: `explainSdkUsage({ topic: 'token-details' })`\n- **Fetch pools**: `explainSdkUsage({ topic: 'fetch-pools' })`\n- **Streaming**: `explainSdkUsage({ topic: 'streaming' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3432
- }
3433
- ]
3434
- },
3435
- {
3436
- "topicKey": "token-status",
3437
- "label": "Token status",
3438
- "category": "utils",
3439
- "description": "SDK configuration and helpers",
3440
- "methodCount": 3,
3441
- "exchanges": [
3442
- {
3443
- "userQuestion": "How do I check token pool status?",
3444
- "assistantResponse": "\n## Token Status and Event Monitoring\n\n**Covers Methods:**\n- `isTokenGraduated()`\n- `onDexPoolCreation()`\n- `onLaunchpadTokenCreation()`\n\nCheck token graduation status and monitor real-time token/pool creation events.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function monitorTokenStatus() {\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // ============================================================================\n // CHECK GRADUATION STATUS - Determine if token is on DEX or bonding curve\n // ============================================================================\n\n // Check if token has graduated from bonding curve to DEX\n const isGraduated = await sdk.isTokenGraduated('anime');\n\n if (isGraduated) {\n console.log('Token has graduated to DEX - trade via GalaSwap');\n // Use DEX trading methods: executeSwap(), getSwapQuoteExactInput(), etc.\n } else {\n console.log('Token on bonding curve - trade via launchpad');\n // Use bonding curve methods: buy(), sell(), calculateBuyAmount(), etc.\n }\n\n // ============================================================================\n // MONITOR DEX POOL CREATION - Real-time notifications\n // ============================================================================\n\n // Set up listener for new DEX pools\n const cleanupDexPool = sdk.onDexPoolCreation((poolData) => {\n console.log('New DEX pool created!');\n console.log(` Token: ${poolData.tokenName}`);\n console.log(` Token0: ${poolData.token0}`);\n console.log(` Token1: ${poolData.token1}`);\n console.log(` Fee Tier: ${poolData.feeTier}`);\n console.log(` Initial TVL: ${poolData.tvl}`);\n\n // Take action on new pool\n // Example: Automatically provide liquidity or execute arbitrage\n });\n\n // ============================================================================\n // MONITOR TOKEN LAUNCHES - Real-time notifications\n // ============================================================================\n\n // Set up listener for new token launches\n const cleanupTokenCreation = sdk.onLaunchpadTokenCreation((tokenData) => {\n console.log('New token launched!');\n console.log(` Name: ${tokenData.tokenName}`);\n console.log(` Symbol: ${tokenData.tokenSymbol}`);\n console.log(` Creator: ${tokenData.creator}`);\n console.log(` Max Supply: ${tokenData.maxSupply}`);\n console.log(` Base Price: ${tokenData.basePrice}`);\n\n // Take action on new token\n // Example: Automatically buy early or analyze opportunity\n });\n\n // ============================================================================\n // COMPLETE WORKFLOW: Monitoring + Trading\n // ============================================================================\n\n async function autoTrade() {\n // Monitor new tokens\n sdk.onLaunchpadTokenCreation(async (token) => {\n console.log(`New token: ${token.tokenName}`);\n\n // Wait for graduation\n const checkGraduation = setInterval(async () => {\n const graduated = await sdk.isTokenGraduated(token.tokenName);\n\n if (graduated) {\n clearInterval(checkGraduation);\n console.log(`${token.tokenName} graduated! Switching to DEX trading.`);\n\n // Now use DEX methods instead of bonding curve\n const quote = await sdk.getSwapQuoteExactInput('GALA', token.tokenName, '100');\n console.log(`DEX quote: ${quote.estimatedOutput}`);\n }\n }, 60000); // Check every minute\n });\n\n // Monitor new DEX pools\n sdk.onDexPoolCreation(async (pool) => {\n console.log(`New pool: ${pool.tokenName}`);\n\n // Analyze liquidity opportunity\n const poolInfo = await sdk.getSwapPoolInfo(pool.token0, pool.token1);\n console.log(`Pool liquidity: ${poolInfo.liquidity}`);\n });\n }\n\n // Keep process running\n console.log('Monitoring events... Press Ctrl+C to stop');\n await new Promise(() => {}); // Run forever\n\n // Cleanup when done\n cleanupDexPool();\n cleanupTokenCreation();\n}\n```\n\n**Use Cases:**\n- **Arbitrage Bots**: Detect graduation events and switch trading strategies\n- **Early Bird Trading**: Monitor new token launches and trade immediately\n- **Liquidity Provision**: Detect new DEX pools and provide liquidity\n- **Portfolio Automation**: Automatically adjust positions on graduation\n- **Price Discovery**: Track token lifecycle from launch to DEX\n\n**Event Data:**\n- **DEX Pool Creation**: tokenName, token0, token1, feeTier, tvl, timestamp\n- **Token Launch**: tokenName, tokenSymbol, creator, maxSupply, basePrice, timestamp\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_is_token_graduated`\n- `gala_launchpad_on_dex_pool_creation` (WebSocket event)\n- `gala_launchpad_on_launchpad_token_creation` (WebSocket event)\n"
3445
- },
3446
- {
3447
- "userQuestion": "What parameters does isTokenGraduated() accept?",
3448
- "assistantResponse": "The primary methods for Token status are `isTokenGraduated()`, `onDexPoolCreation()`, `onLaunchpadTokenCreation()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3449
- },
3450
- {
3451
- "userQuestion": "What are best practices for check token pool status?",
3452
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3453
- },
3454
- {
3455
- "userQuestion": "Can you walk me through a complete check token pool status example?",
3456
- "assistantResponse": "**Complete Workflow: Token status**\n\nHere's the typical flow: `isTokenGraduated()` → `onDexPoolCreation()` → `onLaunchpadTokenCreation()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
3457
- },
3458
- {
3459
- "userQuestion": "What should I learn next after check token pool status?",
3460
- "assistantResponse": "**Related Topics:**\n\n- Check the SDK documentation for related functionality\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3461
- }
3462
- ]
3463
- },
3464
- {
3465
- "topicKey": "utilities-and-helpers",
3466
- "label": "Utilities and helpers",
3467
- "category": "utils",
3468
- "description": "SDK configuration and helpers",
3469
- "methodCount": 10,
3470
- "exchanges": [
3471
- {
3472
- "userQuestion": "How do I use SDK utilities and helpers?",
3473
- "assistantResponse": "\n## Utility Methods and Helpers\n\n**Covers Methods:**\n- `fetchGalaPrice()`\n- `fetchTokenClassesWithSupply()`\n- `calculateInitialBuyAmount()`\n- `getBundlerTransactionResult()`\n- `getSwapPoolPrice()`\n- `fetchSwapPositionDirect()`\n- `getAllSwapUserAssets()`\n- `cleanup()`\n\nEssential helper methods for development, debugging, and special use cases.\n\n### Price & Supply Queries\n\n```typescript\n// Get current GALA price in USD\nconst galaPrice = await sdk.fetchGalaPrice();\nconsole.log(`GALA: $${galaPrice}`);\n\n// Get token supply metrics from GalaChain\nconst supplies = await sdk.fetchTokenClassesWithSupply();\nsupplies.forEach(token => {\n console.log(`${token.tokenClass}: ${token.totalSupply}`);\n});\n```\n\n### Transaction Monitoring\n\n```typescript\n// Check transaction status\nconst status = await sdk.getBundlerTransactionResult('tx-id-123');\nconsole.log('Status:', status.status); // 'pending' | 'success' | 'failed'\n```\n\n### Advanced Swap Queries\n\n```typescript\n// Get pool price without full quote\nconst price = await sdk.getSwapPoolPrice('GALA|Unit|none|none', 'GUSDC|Unit|none|none');\nconsole.log(`Pool price: ${price}`);\n\n// Auto-paginated asset fetch\nconst allAssets = await sdk.getAllSwapUserAssets('eth|0x...', { limit: 100 });\nconsole.log(`Total assets: ${allAssets.length}`);\n\n// Direct position lookup (if you have compound key)\nconst position = await sdk.fetchSwapPositionDirect({\n owner: 'eth|0x...',\n token0: 'GALA|Unit|none|none',\n token1: 'GUSDC|Unit|none|none',\n feeTier: 3000\n});\n```\n\n### Launch Calculations\n\n```typescript\n// Calculate initial buy amount for token launch\nconst buyAmount = await sdk.calculateInitialBuyAmount('100');\nconsole.log(`Initial buy: ${buyAmount} tokens`);\n```\n\n### SDK Cleanup\n\n```typescript\n// Proper cleanup when done (closes connections)\nawait sdk.cleanup();\n```\n\n### Monitor Bundler Transactions\n\n```typescript\n// After a trade, monitor transaction status\nconst tradeResult = await sdk.buy({ tokenName, amount, type: 'native', expectedAmount, slippageToleranceFactor: 0.01 });\n\n// Poll for completion\nconst status = await sdk.getBundlerTransactionResult(tradeResult.transactionId);\nconsole.log('Status:', status.status); // PENDING, PROCESSING, COMPLETED, FAILED\n\n// Wait with polling\nlet attempts = 0;\nwhile (status.status === 'PENDING' || status.status === 'PROCESSING') {\n await new Promise(r => setTimeout(r, 2000));\n const updated = await sdk.getBundlerTransactionResult(tradeResult.transactionId);\n if (updated.status === 'COMPLETED') break;\n if (++attempts > 30) throw new Error('Transaction timeout');\n}\n```\n\n**MCP Tools:**\n- `gala_launchpad_fetch_gala_price`\n- `gala_launchpad_fetch_token_classes_with_supply`\n- `gala_launchpad_calculate_initial_buy_amount`\n- `gala_launchpad_get_bundler_transaction_result`\n- `gala_launchpad_get_swap_pool_price`\n- `gala_launchpad_fetch_swap_position_direct`\n- `gala_launchpad_get_all_swap_user_assets`\n"
3474
- },
3475
- {
3476
- "userQuestion": "What parameters does fetchGalaPrice() accept?",
3477
- "assistantResponse": "The primary methods for Utilities and helpers are `fetchGalaPrice()`, `fetchTokenClassesWithSupply()`, `calculateInitialBuyAmount()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3478
- },
3479
- {
3480
- "userQuestion": "What are best practices for use SDK utilities and helpers?",
3481
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3482
- },
3483
- {
3484
- "userQuestion": "Can you walk me through a complete use SDK utilities and helpers example?",
3485
- "assistantResponse": "**Complete Workflow: Utilities and helpers**\n\nHere's the typical flow: `fetchGalaPrice()` → `fetchTokenClassesWithSupply()` → `calculateInitialBuyAmount()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
3486
- },
3487
- {
3488
- "userQuestion": "What other methods are available for Utilities and helpers?",
3489
- "assistantResponse": "**Additional Methods:**\n\n- `getBundlerTransactionResult()`\n- `getSwapPoolPrice()`\n- `fetchSwapPositionDirect()`\n- `getAllSwapUserAssets()`\n\n**Total methods in this topic:** 10\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
3490
- },
3491
- {
3492
- "userQuestion": "What should I learn next after use SDK utilities and helpers?",
3493
- "assistantResponse": "**Related Topics:**\n\n- **Utilities system**: `explainSdkUsage({ topic: 'utilities-system' })`\n- **Balances**: `explainSdkUsage({ topic: 'balances' })`\n- **Fetch pools**: `explainSdkUsage({ topic: 'fetch-pools' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3494
- },
3495
- {
3496
- "userQuestion": "Are there any advanced patterns for this topic?",
3497
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
3498
- }
3499
- ]
3500
- },
3501
- {
3502
- "topicKey": "utilities-system",
3503
- "label": "Utilities system",
3504
- "category": "wallet",
3505
- "description": "Wallet creation and key derivation",
3506
- "methodCount": 11,
3507
- "exchanges": [
3508
- {
3509
- "userQuestion": "How do I access system utilities?",
3510
- "assistantResponse": "\n## SDK Configuration and Wallet Utilities\n\n**Covers Methods:**\n- `getAddress()`\n- `getConfig()`\n- `getEthereumAddress()`\n- `getUrlByTokenName()`\n- `getVersion()`\n- `getWallet()`\n- `hasWallet()`\n- `setWallet()`\n\nEssential utilities for SDK configuration, wallet management, and system information.\n\n```typescript\nimport { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';\n\nasync function sdkUtilities() {\n // ============================================================================\n // ADDRESS MANAGEMENT - Get wallet addresses in different formats\n // ============================================================================\n\n const sdk = createLaunchpadSDK({ wallet: 'your-private-key' });\n\n // Get GalaChain address (eth|0x... format)\n const galaAddress = sdk.getAddress();\n console.log(`GalaChain address: ${galaAddress}`); // \"eth|0x1234...\"\n\n // Get Ethereum address (0x... format)\n const ethAddress = sdk.getEthereumAddress();\n console.log(`Ethereum address: ${ethAddress}`); // \"0x1234...\"\n\n // ============================================================================\n // WALLET MANAGEMENT - Check and update wallet\n // ============================================================================\n\n // Check if SDK has wallet configured\n if (sdk.hasWallet()) {\n console.log('Wallet configured - can execute trades');\n\n // Get wallet instance (for advanced use)\n const wallet = sdk.getWallet();\n console.log(`Wallet address: ${wallet.address}`);\n } else {\n console.log('Read-only mode - cannot execute trades');\n }\n\n // Update wallet at runtime\n sdk.setWallet('new-private-key');\n console.log(`New address: ${sdk.getAddress()}`);\n\n // ============================================================================\n // CONFIGURATION ACCESS - Get SDK config\n // ============================================================================\n\n // Get SDK configuration\n const config = sdk.getConfig();\n console.log(`Base URL: ${config.baseUrl}`);\n console.log(`Environment: ${config.env}`);\n console.log(`Debug: ${config.debug}`);\n console.log(`Timeout: ${config.timeout}ms`);\n\n // ============================================================================\n // VERSION INFORMATION - Get SDK version\n // ============================================================================\n\n // Get SDK version\n const version = sdk.getVersion();\n console.log(`SDK Version: ${version}`); // \"4.0.4-beta.0\"\n\n // ============================================================================\n // URL GENERATION - Get frontend URLs for tokens\n // ============================================================================\n\n // Generate frontend URL for token\n const url = sdk.getUrlByTokenName('anime');\n console.log(`Token URL: ${url}`);\n // \"https://launchpad.gala.com/token/anime\" (production)\n // \"https://lpad-dev1.defi.gala.com/token/anime\" (development)\n\n // Complete workflow: Launch token + share URL\n const launchResult = await sdk.launchToken({\n tokenName: 'mytoken',\n tokenSymbol: 'MTK',\n tokenDescription: 'My awesome token'\n });\n\n const tokenUrl = sdk.getUrlByTokenName('mytoken');\n console.log(`Share your token: ${tokenUrl}`);\n\n // ============================================================================\n // MULTI-WALLET SCENARIO - Check multiple addresses\n // ============================================================================\n\n async function compareWallets() {\n const wallet1 = createLaunchpadSDK({ wallet: 'private-key-1' });\n const wallet2 = createLaunchpadSDK({ wallet: 'private-key-2' });\n\n console.log(`Wallet 1: ${wallet1.getAddress()}`);\n console.log(`Wallet 2: ${wallet2.getAddress()}`);\n\n // Compare balances\n const balance1 = await wallet1.fetchGalaBalance();\n const balance2 = await wallet2.fetchGalaBalance();\n\n console.log(`Wallet 1 balance: ${balance1.balance}`);\n console.log(`Wallet 2 balance: ${balance2.balance}`);\n }\n\n // ============================================================================\n // READ-ONLY SDK - Public data without wallet\n // ============================================================================\n\n async function readOnlyMode() {\n // Create SDK without wallet (read-only mode)\n const readOnlySdk = createLaunchpadSDK();\n\n console.log(`Has wallet: ${readOnlySdk.hasWallet()}`); // false\n\n // Can fetch public data\n const pools = await readOnlySdk.fetchPools({ type: 'recent', limit: 10 });\n console.log(`Found ${pools.total} pools`);\n\n // Cannot execute trades (will throw error)\n try {\n await readOnlySdk.buy({ tokenName: 'anime', amount: '100', type: 'native' });\n } catch (error) {\n console.error('Cannot trade without wallet');\n }\n }\n\n // ============================================================================\n // ENVIRONMENT SWITCHING - Change environments at runtime\n // ============================================================================\n\n async function switchEnvironments() {\n // Production SDK\n const prodSdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: { env: 'production' }\n });\n\n console.log(`Prod config: ${prodSdk.getConfig().baseUrl}`);\n console.log(`Prod URL: ${prodSdk.getUrlByTokenName('anime')}`);\n\n // Development SDK\n const devSdk = createLaunchpadSDK({\n wallet: 'your-private-key',\n config: { env: 'development' }\n });\n\n console.log(`Dev config: ${devSdk.getConfig().baseUrl}`);\n console.log(`Dev URL: ${devSdk.getUrlByTokenName('anime')}`);\n }\n}\n```\n\n**Key Methods:**\n\n| Method | Returns | Use Case |\n|--------|---------|----------|\n| `getAddress()` | GalaChain address (eth|0x...) | Trading, transfers, profile |\n| `getEthereumAddress()` | Ethereum address (0x...) | DEX trading, external systems |\n| `getConfig()` | SDK configuration object | Debug, environment info |\n| `getVersion()` | SDK version string | Compatibility checks |\n| `getUrlByTokenName()` | Frontend URL | Share token pages |\n| `getWallet()` | Wallet instance | Advanced wallet operations |\n| `hasWallet()` | Boolean | Check if trades enabled |\n| `setWallet()` | void | Update wallet at runtime |\n\n**MCP Tool Equivalents:**\n- `gala_launchpad_get_address`\n- `gala_launchpad_get_ethereum_address`\n- `gala_launchpad_get_config`\n- `gala_launchpad_get_version`\n- `gala_launchpad_get_url_by_token_name`\n"
3511
- },
3512
- {
3513
- "userQuestion": "What parameters does getAddress() accept?",
3514
- "assistantResponse": "The primary methods for Utilities system are `getAddress()`, `getConfig()`, `getEthereumAddress()`. Each method accepts configuration options as a single object parameter.\n\n**Common Parameters:**\n- `tokenName`: The token identifier (e.g., 'dragnrkti')\n- `amount`: Quantity as a string (for precision)\n- Wallet/auth options when transactions are involved\n\nCheck the SDK documentation or use TypeScript intellisense for the complete parameter interface."
3515
- },
3516
- {
3517
- "userQuestion": "What are best practices for access system utilities?",
3518
- "assistantResponse": "1. **Use TypeScript**: Get full type safety and intellisense.\n2. **Handle errors**: Always wrap SDK calls in try-catch blocks.\n3. **Validate inputs**: Check parameters before making API calls.\n4. **Cache when appropriate**: Reduce API calls for static data."
3519
- },
3520
- {
3521
- "userQuestion": "Can you walk me through a complete access system utilities example?",
3522
- "assistantResponse": "**Complete Workflow: Utilities system**\n\nHere's the typical flow: `getAddress()` → `getConfig()` → `getEthereumAddress()`\n\n**Step-by-Step:**\n1. **Setup**: Initialize SDK with your configuration\n2. **Validate**: Check prerequisites (balances, permissions)\n3. **Calculate**: Use calculation methods to preview results\n4. **Execute**: Perform the main operation\n5. **Verify**: Confirm the operation succeeded\n\n**Pro Tip:** The SDK methods are designed to be called in sequence. Each step provides data needed for the next."
3523
- },
3524
- {
3525
- "userQuestion": "What other methods are available for Utilities system?",
3526
- "assistantResponse": "**Additional Methods:**\n\n- `getUrlByTokenName()`\n- `getVersion()`\n- `getWallet()`\n- `hasWallet()`\n\n**Total methods in this topic:** 11\n\nEach method serves a specific purpose in the workflow. Use TypeScript intellisense or the SDK documentation to explore parameter options for each method."
3527
- },
3528
- {
3529
- "userQuestion": "What should I learn next after access system utilities?",
3530
- "assistantResponse": "**Related Topics:**\n\n- **Utilities and helpers**: `explainSdkUsage({ topic: 'utilities-and-helpers' })`\n- **Session auth**: `explainSdkUsage({ topic: 'session-auth' })`\n- **Profile management**: `explainSdkUsage({ topic: 'profile-management' })`\n\n**Learning Path:** Start with the basics, then explore related topics to build a complete understanding of the SDK capabilities."
3531
- },
3532
- {
3533
- "userQuestion": "Are there any advanced patterns for this topic?",
3534
- "assistantResponse": "**Advanced Patterns:**\n\n1. **Batching**: Combine multiple operations for efficiency\n2. **Caching**: Cache frequently-accessed data locally\n3. **Event-Driven**: Use subscriptions for real-time updates\n4. **Error Recovery**: Implement retry logic with exponential backoff\n5. **Monitoring**: Track operation success rates and latencies\n\n**Performance Tip:** For high-volume operations, consider using the local calculation methods where available to reduce network calls."
3535
- }
3536
- ]
3537
- }
3538
- ]
3539
- }