@gala-chain/launchpad-mcp-server 1.7.8 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -1
- package/README.md +10 -0
- package/docs/AI-AGENT-PATTERNS.md +555 -0
- package/docs/CONSTRAINTS-REFERENCE.md +454 -0
- package/docs/PROMPT-TOOL-MAPPING.md +352 -0
- package/docs/examples/default-values-pattern.md +240 -0
- package/docs/examples/tool-factory-pattern.md +217 -0
- package/jest.config.js +94 -0
- package/package.json +2 -2
- package/src/__tests__/integration/poolTools.integration.test.ts +185 -0
- package/src/constants/mcpToolNames.ts +141 -0
- package/src/index.ts +19 -0
- package/src/prompts/__tests__/promptStructure.test.ts +114 -0
- package/src/prompts/__tests__/registry.test.ts +143 -0
- package/src/prompts/analysis.ts +429 -0
- package/src/prompts/index.ts +123 -0
- package/src/prompts/portfolio.ts +242 -0
- package/src/prompts/trading.ts +191 -0
- package/src/prompts/utils/workflowTemplates.ts +344 -0
- package/src/schemas/common-schemas.ts +392 -0
- package/src/scripts/test-all-prompts.ts +184 -0
- package/src/server.ts +241 -0
- package/src/tools/balance/index.ts +174 -0
- package/src/tools/creation/index.ts +182 -0
- package/src/tools/index.ts +80 -0
- package/src/tools/pools/fetchAllPools.ts +47 -0
- package/src/tools/pools/fetchPoolDetails.ts +27 -0
- package/src/tools/pools/fetchPoolDetailsForCalculation.ts +22 -0
- package/src/tools/pools/fetchPools.ts +47 -0
- package/src/tools/pools/index.ts +240 -0
- package/src/tools/social/index.ts +64 -0
- package/src/tools/trading/index.ts +605 -0
- package/src/tools/transfers/index.ts +75 -0
- package/src/tools/utils/clearCache.ts +36 -0
- package/src/tools/utils/createWallet.ts +19 -0
- package/src/tools/utils/explainSdkUsage.ts +853 -0
- package/src/tools/utils/getAddress.ts +12 -0
- package/src/tools/utils/getCacheInfo.ts +14 -0
- package/src/tools/utils/getConfig.ts +11 -0
- package/src/tools/utils/getEthereumAddress.ts +12 -0
- package/src/tools/utils/getUrlByTokenName.ts +12 -0
- package/src/tools/utils/index.ts +25 -0
- package/src/tools/utils/isTokenGraduated.ts +16 -0
- package/src/types/mcp.ts +72 -0
- package/src/utils/__tests__/validation.test.ts +147 -0
- package/src/utils/constraints.ts +146 -0
- package/src/utils/default-values.ts +208 -0
- package/src/utils/error-handler.ts +69 -0
- package/src/utils/error-templates.ts +273 -0
- package/src/utils/response-formatter.ts +51 -0
- package/src/utils/tool-factory.ts +257 -0
- package/src/utils/tool-registry.ts +296 -0
- package/src/utils/validation.ts +336 -0
- package/tsconfig.json +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.7.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Comprehensive documentation for CommonJS support and module formats
|
|
8
|
+
|
|
9
|
+
**SDK Updates:**
|
|
10
|
+
- Document all three module formats (ESM, CommonJS, UMD)
|
|
11
|
+
- Add module resolution table showing automatic format selection
|
|
12
|
+
- Clarify when to use each format with concrete examples
|
|
13
|
+
- Explain package.json exports configuration
|
|
14
|
+
|
|
15
|
+
**MCP Server Updates:**
|
|
16
|
+
- Document CommonJS module format
|
|
17
|
+
- Explain integration with SDK's multi-format support
|
|
18
|
+
- Clarify automatic format selection by Node.js
|
|
19
|
+
|
|
20
|
+
**Project Configuration (CLAUDE.md):**
|
|
21
|
+
- Enhanced Build System section with detailed format breakdown
|
|
22
|
+
- Added comprehensive "Launchpad SDK Module Formats (v3.12.0+)" section
|
|
23
|
+
- Include size monitoring metrics for all three bundles
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @gala-chain/launchpad-sdk@3.12.1
|
|
27
|
+
|
|
28
|
+
## 1.7.9
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Fix: Update STAGE environment launchpadFrontendUrl from lpad-frontend-dev1 to lpad-frontend-test1
|
|
33
|
+
to correct MCP tool URL generation for token frontend links
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
- @gala-chain/launchpad-sdk@3.11.8
|
|
36
|
+
|
|
3
37
|
## 1.7.8
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -25,7 +59,8 @@
|
|
|
25
59
|
### Patch Changes
|
|
26
60
|
|
|
27
61
|
- Update SDK dependency to v3.11.6 with TypeScript declaration file fixes
|
|
28
|
-
- Fixed TypeScript declaration file output structure by restoring correct tsconfig.json
|
|
62
|
+
- Fixed TypeScript declaration file output structure by restoring correct tsconfig.json
|
|
63
|
+
configuration
|
|
29
64
|
|
|
30
65
|
## 1.7.5
|
|
31
66
|
|
package/README.md
CHANGED
|
@@ -18,6 +18,16 @@ MCP (Model Context Protocol) server for Gala Launchpad SDK - Enables AI agents t
|
|
|
18
18
|
npm install -g @gala-chain/launchpad-mcp-server
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
### Module Format
|
|
22
|
+
|
|
23
|
+
The MCP server is built with **CommonJS** (`dist/index.js`) and works seamlessly with the SDK's dual-format support:
|
|
24
|
+
|
|
25
|
+
- **MCP Server**: CommonJS (Node.js native)
|
|
26
|
+
- **Underlying SDK**: Supports ESM, CommonJS, and UMD
|
|
27
|
+
- **Compatibility**: Full support for both modern and legacy environments
|
|
28
|
+
|
|
29
|
+
The MCP server automatically uses the correct SDK format for your Node.js version - no configuration needed!
|
|
30
|
+
|
|
21
31
|
## 🏁 Quick Start
|
|
22
32
|
|
|
23
33
|
### Claude Desktop Configuration
|
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
# AI Agent Patterns for Gala Launchpad MCP Server
|
|
2
|
+
|
|
3
|
+
This guide provides AI agents with common workflows, gotchas, and best practices when using the `galachain-launchpad` MCP server.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Common Workflows](#common-workflows)
|
|
8
|
+
- [Critical Gotchas](#critical-gotchas)
|
|
9
|
+
- [Constraint Reference](#constraint-reference)
|
|
10
|
+
- [Error Troubleshooting](#error-troubleshooting)
|
|
11
|
+
- [Best Practices](#best-practices)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Common Workflows
|
|
16
|
+
|
|
17
|
+
### 1. Token Launch Workflow
|
|
18
|
+
|
|
19
|
+
**Complete token creation from scratch:**
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// Step 1: Verify token name is available
|
|
23
|
+
gala_launchpad_check_token_name({
|
|
24
|
+
tokenName: 'mytoken'
|
|
25
|
+
})
|
|
26
|
+
// Response: { available: true, message: "Token name is available" }
|
|
27
|
+
|
|
28
|
+
// Step 2: Verify token symbol is available
|
|
29
|
+
gala_launchpad_check_token_symbol({
|
|
30
|
+
symbol: 'MTK'
|
|
31
|
+
})
|
|
32
|
+
// Response: { available: true, message: "Token symbol is available" }
|
|
33
|
+
|
|
34
|
+
// Step 3: Upload token image (optional, can use URL instead)
|
|
35
|
+
gala_launchpad_upload_token_image({
|
|
36
|
+
tokenName: 'mytoken',
|
|
37
|
+
imagePath: '/absolute/path/to/image.png'
|
|
38
|
+
})
|
|
39
|
+
// Response: { url: 'https://launchpad.galachain.com/uploads/mytoken.png' }
|
|
40
|
+
|
|
41
|
+
// Step 4: Launch the token
|
|
42
|
+
gala_launchpad_launch_token({
|
|
43
|
+
tokenName: 'mytoken',
|
|
44
|
+
tokenSymbol: 'MTK',
|
|
45
|
+
tokenDescription: 'My awesome token for the community',
|
|
46
|
+
tokenImage: 'https://launchpad.galachain.com/uploads/mytoken.png',
|
|
47
|
+
preBuyQuantity: '100', // Optional initial buy
|
|
48
|
+
websiteUrl: 'https://mytoken.com',
|
|
49
|
+
twitterUrl: 'https://twitter.com/mytoken'
|
|
50
|
+
})
|
|
51
|
+
// Response: { tokenName: 'mytoken', transactionId: '...' }
|
|
52
|
+
|
|
53
|
+
// Step 5: Get the frontend URL
|
|
54
|
+
gala_launchpad_get_url_by_token_name({
|
|
55
|
+
tokenName: 'mytoken'
|
|
56
|
+
})
|
|
57
|
+
// Response: { url: 'https://launchpad.galachain.com/token/mytoken' }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 2. Trading Workflow (Buy Tokens)
|
|
61
|
+
|
|
62
|
+
**Two-step process: Calculate → Execute**
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// Step 1: Calculate buy amount (REQUIRED FIRST STEP)
|
|
66
|
+
const calcResult = gala_launchpad_calculate_buy_amount({
|
|
67
|
+
tokenName: 'woohoo',
|
|
68
|
+
amount: '10', // Spending 10 GALA
|
|
69
|
+
type: 'native' // 'native' = GALA amount
|
|
70
|
+
})
|
|
71
|
+
// Response: {
|
|
72
|
+
// amount: '16843.7579794843252', // <- THIS is expectedAmount for buy()
|
|
73
|
+
// reverseBondingCurveFee: '0.059280156', // <- THIS is maxAcceptableReverseBondingCurveFee
|
|
74
|
+
// transactionFee: '0.00141090',
|
|
75
|
+
// gasFee: '1'
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
// Step 2: Execute buy with calculated expectedAmount AND reverseBondingCurveFee
|
|
79
|
+
gala_launchpad_buy_tokens({
|
|
80
|
+
tokenName: 'woohoo',
|
|
81
|
+
amount: '10', // Same as Step 1
|
|
82
|
+
type: 'native', // Same as Step 1
|
|
83
|
+
expectedAmount: '16843.7579794843252', // <- Use result.amount from Step 1
|
|
84
|
+
maxAcceptableReverseBondingCurveFee: '0.059280156', // <- Use result.reverseBondingCurveFee from Step 1
|
|
85
|
+
slippageToleranceFactor: 0.05 // 5% slippage protection
|
|
86
|
+
})
|
|
87
|
+
// Response: { transactionId: '...', status: 'completed' }
|
|
88
|
+
|
|
89
|
+
// Step 3: Verify trade completed
|
|
90
|
+
gala_launchpad_fetch_trades({
|
|
91
|
+
tokenName: 'woohoo',
|
|
92
|
+
userAddress: 'eth|your-address',
|
|
93
|
+
limit: 1
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**⚠️ CRITICAL:**
|
|
98
|
+
- `expectedAmount` must be `result.amount` from calculate function, NOT your input amount!
|
|
99
|
+
- `maxAcceptableReverseBondingCurveFee` must be `result.reverseBondingCurveFee` from calculate function!
|
|
100
|
+
|
|
101
|
+
### 3. Trading Workflow (Sell Tokens)
|
|
102
|
+
|
|
103
|
+
**Same two-step pattern:**
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// Step 1: Calculate sell amount
|
|
107
|
+
const calcResult = gala_launchpad_calculate_sell_amount({
|
|
108
|
+
tokenName: 'woohoo',
|
|
109
|
+
amount: '1000', // Selling 1000 tokens
|
|
110
|
+
type: 'exact' // 'exact' = exact token amount
|
|
111
|
+
})
|
|
112
|
+
// Response: {
|
|
113
|
+
// amount: '5.234567', // <- THIS is expectedAmount for sell()
|
|
114
|
+
// reverseBondingCurveFee: '2.617284', // <- THIS is maxAcceptableReverseBondingCurveFee
|
|
115
|
+
// transactionFee: '0.00523457',
|
|
116
|
+
// gasFee: '1'
|
|
117
|
+
// }
|
|
118
|
+
|
|
119
|
+
// Step 2: Execute sell with calculated expectedAmount AND reverseBondingCurveFee
|
|
120
|
+
gala_launchpad_sell_tokens({
|
|
121
|
+
tokenName: 'woohoo',
|
|
122
|
+
amount: '1000',
|
|
123
|
+
type: 'exact',
|
|
124
|
+
expectedAmount: '5.234567', // <- Use result.amount from Step 1
|
|
125
|
+
maxAcceptableReverseBondingCurveFee: '2.617284', // <- Use result.reverseBondingCurveFee from Step 1
|
|
126
|
+
slippageToleranceFactor: 0.05
|
|
127
|
+
})
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 4. Portfolio Management Workflow
|
|
131
|
+
|
|
132
|
+
**Check balances and trading activity:**
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// Get GALA balance
|
|
136
|
+
gala_launchpad_fetch_gala_balance({
|
|
137
|
+
address: 'eth|your-address' // Optional, defaults to authenticated wallet
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// Get specific token balance (optimized single-token lookup)
|
|
141
|
+
gala_launchpad_fetch_token_balance({
|
|
142
|
+
tokenName: 'woohoo',
|
|
143
|
+
address: 'eth|your-address'
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
// Get all tokens held (with filtering)
|
|
147
|
+
gala_launchpad_fetch_tokens_held({
|
|
148
|
+
address: 'eth|your-address',
|
|
149
|
+
tokenName: 'woohoo', // Optional exact match filter
|
|
150
|
+
limit: 20 // Max 20 for user operations
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
// Get all tokens created by user
|
|
154
|
+
gala_launchpad_fetch_tokens_created({
|
|
155
|
+
address: 'eth|your-address',
|
|
156
|
+
search: 'test', // Optional fuzzy search filter
|
|
157
|
+
limit: 20
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
// Get trade history
|
|
161
|
+
gala_launchpad_fetch_trades({
|
|
162
|
+
tokenName: 'woohoo',
|
|
163
|
+
userAddress: 'eth|your-address',
|
|
164
|
+
tradeType: 'BUY', // Optional: 'BUY' or 'SELL'
|
|
165
|
+
limit: 20, // Max 20 for trade operations
|
|
166
|
+
sortOrder: 'DESC'
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 5. Pool Analysis Workflow
|
|
171
|
+
|
|
172
|
+
**Discover and analyze token pools:**
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// Fetch recent/trending pools
|
|
176
|
+
gala_launchpad_fetch_pools({
|
|
177
|
+
type: 'trending', // 'recent', 'trending', or 'user'
|
|
178
|
+
limit: 100 // Max 100 for pool operations
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
// Get detailed pool state
|
|
182
|
+
gala_launchpad_fetch_pool_details({
|
|
183
|
+
tokenName: 'woohoo'
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
// Get holder distribution
|
|
187
|
+
gala_launchpad_fetch_token_distribution({
|
|
188
|
+
tokenName: 'woohoo'
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
// Get volume data for charting
|
|
192
|
+
gala_launchpad_fetch_volume_data({
|
|
193
|
+
tokenName: 'woohoo',
|
|
194
|
+
resolution: '1h', // '1m', '5m', '15m', '1h', '4h', '1d'
|
|
195
|
+
from: '2024-01-01T00:00:00Z',
|
|
196
|
+
to: '2024-01-31T23:59:59Z'
|
|
197
|
+
})
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Critical Gotchas
|
|
203
|
+
|
|
204
|
+
### Gotcha #1: Missing reverseBondingCurveFee Parameter ⚠️🔥
|
|
205
|
+
|
|
206
|
+
**Problem:** AI agents forget to pass `maxAcceptableReverseBondingCurveFee`, causing transaction failures.
|
|
207
|
+
|
|
208
|
+
**Wrong:**
|
|
209
|
+
```typescript
|
|
210
|
+
// Step 1: Calculate
|
|
211
|
+
const calc = gala_launchpad_calculate_sell_amount({ tokenName: 'anime', amount: '500', type: 'exact' })
|
|
212
|
+
// calc = { amount: '0.7056532', reverseBondingCurveFee: '0.3528266', ... }
|
|
213
|
+
|
|
214
|
+
// Step 2: Execute - MISSING reverseBondingCurveFee!
|
|
215
|
+
gala_launchpad_sell_tokens({
|
|
216
|
+
tokenName: 'anime',
|
|
217
|
+
amount: '500',
|
|
218
|
+
type: 'exact',
|
|
219
|
+
expectedAmount: '0.7056532', // ✅ Got this right
|
|
220
|
+
// ❌ MISSING: maxAcceptableReverseBondingCurveFee
|
|
221
|
+
slippageToleranceFactor: 0.05
|
|
222
|
+
})
|
|
223
|
+
// Result: Transaction fails with "FAILED" status
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Correct:**
|
|
227
|
+
```typescript
|
|
228
|
+
// Step 1: Calculate
|
|
229
|
+
const calc = gala_launchpad_calculate_sell_amount({ tokenName: 'anime', amount: '500', type: 'exact' })
|
|
230
|
+
// calc = { amount: '0.7056532', reverseBondingCurveFee: '0.3528266', ... }
|
|
231
|
+
|
|
232
|
+
// Step 2: Execute - Include BOTH parameters from calculation
|
|
233
|
+
gala_launchpad_sell_tokens({
|
|
234
|
+
tokenName: 'anime',
|
|
235
|
+
amount: '500',
|
|
236
|
+
type: 'exact',
|
|
237
|
+
expectedAmount: '0.7056532', // ✅ From result.amount
|
|
238
|
+
maxAcceptableReverseBondingCurveFee: '0.3528266', // ✅ From result.reverseBondingCurveFee
|
|
239
|
+
slippageToleranceFactor: 0.05
|
|
240
|
+
})
|
|
241
|
+
// Result: Transaction succeeds!
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Fix:** Always extract BOTH `result.amount` AND `result.reverseBondingCurveFee` from calculate functions, then pass BOTH to buy/sell.
|
|
245
|
+
|
|
246
|
+
**This applies to both buy AND sell operations!**
|
|
247
|
+
|
|
248
|
+
### Gotcha #2: expectedAmount Parameter Confusion ⚠️
|
|
249
|
+
|
|
250
|
+
**Problem:** AI agents use the input `amount` as `expectedAmount`, causing WebSocket timeouts.
|
|
251
|
+
|
|
252
|
+
**Wrong:**
|
|
253
|
+
```typescript
|
|
254
|
+
gala_launchpad_buy_tokens({
|
|
255
|
+
amount: '10',
|
|
256
|
+
expectedAmount: '10' // ❌ WRONG - This is your input, not the expected output!
|
|
257
|
+
})
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Correct:**
|
|
261
|
+
```typescript
|
|
262
|
+
// Step 1: Calculate first
|
|
263
|
+
const calc = gala_launchpad_calculate_buy_amount({ amount: '10', ... })
|
|
264
|
+
// calc.amount = '16843.7579794843252'
|
|
265
|
+
|
|
266
|
+
// Step 2: Use calc.amount as expectedAmount
|
|
267
|
+
gala_launchpad_buy_tokens({
|
|
268
|
+
amount: '10',
|
|
269
|
+
expectedAmount: '16843.7579794843252' // ✅ CORRECT - Use result.amount
|
|
270
|
+
})
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Fix:** Always call `calculate*Amount()` first, then use `result.amount` as `expectedAmount`.
|
|
274
|
+
|
|
275
|
+
### Gotcha #3: Limit Validation Errors
|
|
276
|
+
|
|
277
|
+
**Problem:** AI agents hit "Limit must be between 1 and 20" errors when using `limit: 100`.
|
|
278
|
+
|
|
279
|
+
**Root Cause:** Different operations have different maximum limits:
|
|
280
|
+
- Trade operations: Max 20
|
|
281
|
+
- User operations (tokens held/created): Max 20
|
|
282
|
+
- Pool operations: Max 100
|
|
283
|
+
- Comment operations: Max 50
|
|
284
|
+
|
|
285
|
+
**Wrong:**
|
|
286
|
+
```typescript
|
|
287
|
+
gala_launchpad_fetch_trades({
|
|
288
|
+
limit: 100 // ❌ WRONG - Trades max is 20!
|
|
289
|
+
})
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Correct:**
|
|
293
|
+
```typescript
|
|
294
|
+
gala_launchpad_fetch_trades({
|
|
295
|
+
limit: 20 // ✅ CORRECT - Respects constraint
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
gala_launchpad_fetch_pools({
|
|
299
|
+
limit: 100 // ✅ CORRECT - Pools allow 100
|
|
300
|
+
})
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Fix:** Use the constraint reference table below for correct limits.
|
|
304
|
+
|
|
305
|
+
### Gotcha #4: Type Parameter Ambiguity
|
|
306
|
+
|
|
307
|
+
**Problem:** Confusion between `type: 'native'` and `type: 'exact'`.
|
|
308
|
+
|
|
309
|
+
**When to use 'native' (GALA amount):**
|
|
310
|
+
- "I want to spend 10 GALA" → `{ amount: '10', type: 'native' }`
|
|
311
|
+
- "I want to receive 5 GALA" → `{ amount: '5', type: 'native' }`
|
|
312
|
+
|
|
313
|
+
**When to use 'exact' (exact token amount):**
|
|
314
|
+
- "I want to buy exactly 1000 tokens" → `{ amount: '1000', type: 'exact' }`
|
|
315
|
+
- "I want to sell exactly 500 tokens" → `{ amount: '500', type: 'exact' }`
|
|
316
|
+
|
|
317
|
+
**Most Common:** Use `'native'` when you know the GALA amount.
|
|
318
|
+
|
|
319
|
+
### Gotcha #5: Token Filtering Confusion
|
|
320
|
+
|
|
321
|
+
**Problem:** Not using the right filter for the task.
|
|
322
|
+
|
|
323
|
+
**Use `tokenName` for exact lookups:**
|
|
324
|
+
```typescript
|
|
325
|
+
gala_launchpad_fetch_tokens_held({
|
|
326
|
+
tokenName: 'anime', // Exact match
|
|
327
|
+
limit: 1 // Only need 1 result
|
|
328
|
+
})
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**Use `search` for discovery:**
|
|
332
|
+
```typescript
|
|
333
|
+
gala_launchpad_fetch_tokens_held({
|
|
334
|
+
search: 'dragon', // Fuzzy search
|
|
335
|
+
limit: 10 // Get multiple matches
|
|
336
|
+
})
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Don't mix both:** If you provide both, `tokenName` takes precedence.
|
|
340
|
+
|
|
341
|
+
### Gotcha #6: Wallet Address Format
|
|
342
|
+
|
|
343
|
+
**Problem:** Wrong wallet address format causes validation errors.
|
|
344
|
+
|
|
345
|
+
**Backend Format (for API):**
|
|
346
|
+
- ✅ `'eth|abc123...'` - Prefixed format
|
|
347
|
+
- ❌ `'0xabc123...'` - Standard Ethereum format
|
|
348
|
+
|
|
349
|
+
**Conversion Pattern:**
|
|
350
|
+
```typescript
|
|
351
|
+
// From standard to backend format
|
|
352
|
+
const backendAddress = address.startsWith('0x')
|
|
353
|
+
? `eth|${address.slice(2)}`
|
|
354
|
+
: address
|
|
355
|
+
|
|
356
|
+
// From backend to standard format
|
|
357
|
+
const standardAddress = address.startsWith('eth|')
|
|
358
|
+
? `0x${address.slice(4)}`
|
|
359
|
+
: address
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Constraint Reference
|
|
365
|
+
|
|
366
|
+
### Pagination Limits by Operation Type
|
|
367
|
+
|
|
368
|
+
| Operation Type | Max Limit | SDK Source |
|
|
369
|
+
|---------------|-----------|------------|
|
|
370
|
+
| **Trade Operations** | 20 | `TRADE_CONSTRAINTS.PAGINATION.MAX_LIMIT` |
|
|
371
|
+
| `fetchTrades` | 20 | packages/sdk/src/types/trade.dto.ts:331 |
|
|
372
|
+
| **User Operations** | 20 | `USER_CONSTRAINTS.PAGINATION.MAX_LIMIT` |
|
|
373
|
+
| `fetchTokensHeld` | 20 | packages/sdk/src/types/user.dto.ts:297 |
|
|
374
|
+
| `fetchTokensCreated` | 20 | packages/sdk/src/types/user.dto.ts:297 |
|
|
375
|
+
| **Pool Operations** | 100 | `PAGINATION_CONSTRAINTS.MAX_LIMIT` |
|
|
376
|
+
| `fetchPools` | 100 | packages/sdk/src/types/launchpad.dto.ts:587 |
|
|
377
|
+
| **Comment Operations** | 50 | `COMMENT_CONSTRAINTS.PAGINATION.MAX_LIMIT` |
|
|
378
|
+
| `fetchComments` | 50 | packages/sdk/src/types/comment.dto.ts:149 |
|
|
379
|
+
|
|
380
|
+
### Common Validation Rules
|
|
381
|
+
|
|
382
|
+
| Parameter | Pattern | Example |
|
|
383
|
+
|-----------|---------|---------|
|
|
384
|
+
| `tokenName` | `^[a-z0-9_-]{2,20}$` | `'mytoken'`, `'test_token'` |
|
|
385
|
+
| `tokenSymbol` | `^[A-Z0-9]{2,10}$` | `'MTK'`, `'TEST123'` |
|
|
386
|
+
| `address` | `^(0x[a-fA-F0-9]{40}\|eth\\|[a-fA-F0-9]{40})$` | `'eth\|abc123...'`, `'0xabc123...'` (auto-normalized) |
|
|
387
|
+
| `amount` | `^[0-9.]+$` | `'10'`, `'100.5'` |
|
|
388
|
+
| `slippageTolerance` | `0-1` (decimal) | `0.05` (5%), `0.01` (1%) |
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Error Troubleshooting
|
|
393
|
+
|
|
394
|
+
### "Limit must be a number between 1 and 20"
|
|
395
|
+
|
|
396
|
+
**Cause:** Using `limit: 100` on trade or user operations.
|
|
397
|
+
|
|
398
|
+
**Solution:**
|
|
399
|
+
```typescript
|
|
400
|
+
// Wrong
|
|
401
|
+
gala_launchpad_fetch_trades({ limit: 100 })
|
|
402
|
+
|
|
403
|
+
// Correct
|
|
404
|
+
gala_launchpad_fetch_trades({ limit: 20 })
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### "WebSocket timeout on trade execution"
|
|
408
|
+
|
|
409
|
+
**Cause:** Using wrong `expectedAmount` (likely using input amount instead of calculated result).
|
|
410
|
+
|
|
411
|
+
**Solution:**
|
|
412
|
+
```typescript
|
|
413
|
+
// Wrong
|
|
414
|
+
const calc = gala_launchpad_calculate_buy_amount({ amount: '10', ... })
|
|
415
|
+
gala_launchpad_buy_tokens({ amount: '10', expectedAmount: '10' })
|
|
416
|
+
|
|
417
|
+
// Correct
|
|
418
|
+
const calc = gala_launchpad_calculate_buy_amount({ amount: '10', ... })
|
|
419
|
+
gala_launchpad_buy_tokens({ amount: '10', expectedAmount: calc.amount })
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### "Token name validation failed"
|
|
423
|
+
|
|
424
|
+
**Cause:** Token name doesn't match pattern `^[a-z0-9_-]{2,20}$`.
|
|
425
|
+
|
|
426
|
+
**Valid:** `'mytoken'`, `'test-token'`, `'token_123'`
|
|
427
|
+
**Invalid:** `'MyToken'` (uppercase), `'a'` (too short), `'my token'` (space)
|
|
428
|
+
|
|
429
|
+
**Solution:** Use lowercase alphanumeric with dashes/underscores, 2-20 characters.
|
|
430
|
+
|
|
431
|
+
### "Token symbol validation failed"
|
|
432
|
+
|
|
433
|
+
**Cause:** Token symbol doesn't match pattern `^[A-Z0-9]{2,10}$`.
|
|
434
|
+
|
|
435
|
+
**Valid:** `'MTK'`, `'TEST123'`, `'ABC'`
|
|
436
|
+
**Invalid:** `'mtk'` (lowercase), `'A'` (too short), `'MY-TOKEN'` (dash)
|
|
437
|
+
|
|
438
|
+
**Solution:** Use uppercase alphanumeric only, 2-10 characters.
|
|
439
|
+
|
|
440
|
+
### "At least one social URL required"
|
|
441
|
+
|
|
442
|
+
**Cause:** Launching token without `websiteUrl`, `twitterUrl`, or `telegramUrl`.
|
|
443
|
+
|
|
444
|
+
**Solution:** Provide at least one social link:
|
|
445
|
+
```typescript
|
|
446
|
+
gala_launchpad_launch_token({
|
|
447
|
+
// ... other params
|
|
448
|
+
websiteUrl: 'https://mytoken.com' // At least one required
|
|
449
|
+
})
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Best Practices
|
|
455
|
+
|
|
456
|
+
### 1. Always Calculate Before Trading
|
|
457
|
+
|
|
458
|
+
Never skip the calculate step - it provides:
|
|
459
|
+
- Accurate `expectedAmount` for slippage protection
|
|
460
|
+
- Fee breakdown for transparency
|
|
461
|
+
- Price impact analysis for informed decisions
|
|
462
|
+
|
|
463
|
+
### 2. Use Appropriate Limits
|
|
464
|
+
|
|
465
|
+
Match your `limit` to the operation type:
|
|
466
|
+
- Trades/User operations: Use 20 or less
|
|
467
|
+
- Pools: Can use up to 100
|
|
468
|
+
- Comments: Can use up to 50
|
|
469
|
+
|
|
470
|
+
### 3. Handle Slippage Appropriately
|
|
471
|
+
|
|
472
|
+
Common slippage tolerance factors:
|
|
473
|
+
- `0.01` (1%) - Low volatility, stable pools
|
|
474
|
+
- `0.05` (5%) - Standard for most trades
|
|
475
|
+
- `0.10` (10%) - High volatility, new tokens
|
|
476
|
+
|
|
477
|
+
### 4. Use Token Filtering Efficiently
|
|
478
|
+
|
|
479
|
+
**For single token lookups:**
|
|
480
|
+
```typescript
|
|
481
|
+
gala_launchpad_fetch_token_balance({
|
|
482
|
+
tokenName: 'anime',
|
|
483
|
+
address: 'eth|...'
|
|
484
|
+
})
|
|
485
|
+
// 99% payload reduction vs fetching all tokens
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**For discovery:**
|
|
489
|
+
```typescript
|
|
490
|
+
gala_launchpad_fetch_tokens_held({
|
|
491
|
+
search: 'dragon',
|
|
492
|
+
limit: 10
|
|
493
|
+
})
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### 5. Verify Trades Complete
|
|
497
|
+
|
|
498
|
+
After executing trades, always verify:
|
|
499
|
+
```typescript
|
|
500
|
+
gala_launchpad_fetch_trades({
|
|
501
|
+
tokenName: 'woohoo',
|
|
502
|
+
userAddress: 'eth|...',
|
|
503
|
+
limit: 1,
|
|
504
|
+
sortOrder: 'DESC'
|
|
505
|
+
})
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### 6. Check Availability Before Launch
|
|
509
|
+
|
|
510
|
+
Always verify token name and symbol availability before launching:
|
|
511
|
+
```typescript
|
|
512
|
+
// Step 1: Check name
|
|
513
|
+
gala_launchpad_check_token_name({ tokenName: 'mytoken' })
|
|
514
|
+
|
|
515
|
+
// Step 2: Check symbol
|
|
516
|
+
gala_launchpad_check_token_symbol({ symbol: 'MTK' })
|
|
517
|
+
|
|
518
|
+
// Step 3: Launch if both available
|
|
519
|
+
gala_launchpad_launch_token({ ... })
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## Quick Reference Card
|
|
525
|
+
|
|
526
|
+
### Trading Flow
|
|
527
|
+
1. `calculate_buy_amount()` or `calculate_sell_amount()`
|
|
528
|
+
2. Extract `result.amount` from response
|
|
529
|
+
3. Use `result.amount` as `expectedAmount` in buy/sell
|
|
530
|
+
4. Verify with `fetch_trades()`
|
|
531
|
+
|
|
532
|
+
### Limit Values
|
|
533
|
+
- Trades: 20 max
|
|
534
|
+
- User ops: 20 max
|
|
535
|
+
- Pools: 100 max
|
|
536
|
+
- Comments: 50 max
|
|
537
|
+
|
|
538
|
+
### Type Parameter
|
|
539
|
+
- `'native'` = GALA amount (most common)
|
|
540
|
+
- `'token'` = Exact token amount
|
|
541
|
+
|
|
542
|
+
### Token Filtering
|
|
543
|
+
- `tokenName` = Exact match (faster)
|
|
544
|
+
- `search` = Fuzzy match (discovery)
|
|
545
|
+
|
|
546
|
+
### Address Format
|
|
547
|
+
- API expects: `'eth|abc123...'`
|
|
548
|
+
- Convert from: `'0xabc123...'`
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
**For more details, see:**
|
|
553
|
+
- [MCP Server README](../README.md)
|
|
554
|
+
- [SDK Documentation](../../sdk/README.md)
|
|
555
|
+
- [Constraints Reference](./CONSTRAINTS-REFERENCE.md)
|