@gala-chain/launchpad-sdk 3.31.2 → 4.0.0
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/API.md +524 -4
- package/CHANGELOG.md +92 -0
- package/EXAMPLES.md +845 -0
- package/README.md +421 -14
- package/dist/LaunchpadSDK.d.ts +435 -18
- package/dist/LaunchpadSDK.d.ts.map +1 -1
- package/dist/api/LaunchpadAPI.d.ts.map +1 -1
- package/dist/constants/version.generated.d.ts +1 -1
- package/dist/constants/version.generated.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/services/CommentService.d.ts.map +1 -1
- package/dist/services/DexBackendClient.d.ts +46 -0
- package/dist/services/DexBackendClient.d.ts.map +1 -0
- package/dist/services/DexPoolService.d.ts +54 -12
- package/dist/services/DexPoolService.d.ts.map +1 -1
- package/dist/services/DexQuoteService.d.ts +288 -0
- package/dist/services/DexQuoteService.d.ts.map +1 -0
- package/dist/services/GSwapService.d.ts +468 -38
- package/dist/services/GSwapService.d.ts.map +1 -1
- package/dist/services/GalaChainGatewayClient.d.ts +89 -0
- package/dist/services/GalaChainGatewayClient.d.ts.map +1 -0
- package/dist/services/GalaChainService.d.ts +26 -0
- package/dist/services/GalaChainService.d.ts.map +1 -1
- package/dist/services/PoolStateManager.d.ts +176 -0
- package/dist/services/PoolStateManager.d.ts.map +1 -0
- package/dist/services/SignatureService.d.ts +13 -35
- package/dist/services/SignatureService.d.ts.map +1 -1
- package/dist/services/WebSocketService.d.ts +98 -0
- package/dist/services/WebSocketService.d.ts.map +1 -1
- package/dist/services/__mocks__/logger.mock.d.ts +17 -0
- package/dist/services/__mocks__/logger.mock.d.ts.map +1 -0
- package/dist/types/common.d.ts +2 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/composite-pool.dto.d.ts +103 -0
- package/dist/types/composite-pool.dto.d.ts.map +1 -0
- package/dist/types/dex-pool.dto.d.ts +56 -5
- package/dist/types/dex-pool.dto.d.ts.map +1 -1
- package/dist/types/dto.d.ts +6 -6
- package/dist/types/dto.d.ts.map +1 -1
- package/dist/types/eip712-types.d.ts +140 -0
- package/dist/types/eip712-types.d.ts.map +1 -0
- package/dist/types/galachain-api.types.d.ts +206 -0
- package/dist/types/galachain-api.types.d.ts.map +1 -0
- package/dist/types/gswap-responses.types.d.ts +366 -0
- package/dist/types/gswap-responses.types.d.ts.map +1 -0
- package/dist/types/gswap.dto.d.ts +58 -3
- package/dist/types/gswap.dto.d.ts.map +1 -1
- package/dist/types/launchpad.dto.d.ts +57 -0
- package/dist/types/launchpad.dto.d.ts.map +1 -1
- package/dist/types/pool-state-delta.dto.d.ts +246 -0
- package/dist/types/pool-state-delta.dto.d.ts.map +1 -0
- package/dist/types/pool-state-manager-config.dto.d.ts +103 -0
- package/dist/types/pool-state-manager-config.dto.d.ts.map +1 -0
- package/dist/utils/auto-pagination.d.ts +74 -0
- package/dist/utils/auto-pagination.d.ts.map +1 -1
- package/dist/utils/bignumber-helpers.d.ts +75 -3
- package/dist/utils/bignumber-helpers.d.ts.map +1 -1
- package/dist/utils/bignumber-pool-cache.d.ts +169 -0
- package/dist/utils/bignumber-pool-cache.d.ts.map +1 -0
- package/dist/utils/composite-pool-converter.d.ts +121 -0
- package/dist/utils/composite-pool-converter.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +86 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/load-env.d.ts +31 -0
- package/dist/utils/load-env.d.ts.map +1 -0
- package/dist/utils/pool-pair-parser.d.ts +55 -0
- package/dist/utils/pool-pair-parser.d.ts.map +1 -0
- package/dist/utils/pool-state-validator.d.ts +207 -0
- package/dist/utils/pool-state-validator.d.ts.map +1 -0
- package/dist/utils/position-filters.d.ts +253 -0
- package/dist/utils/position-filters.d.ts.map +1 -0
- package/dist/utils/swap-delta-calculator.d.ts +231 -0
- package/dist/utils/swap-delta-calculator.d.ts.map +1 -0
- package/dist/utils/tick-crossing-handler.d.ts +250 -0
- package/dist/utils/tick-crossing-handler.d.ts.map +1 -0
- package/dist/utils/token-format-converter.d.ts +10 -3
- package/dist/utils/token-format-converter.d.ts.map +1 -1
- package/dist/utils/token-parser.d.ts +235 -0
- package/dist/utils/token-parser.d.ts.map +1 -0
- package/dist/utils/transfer-validation.d.ts.map +1 -1
- package/package.json +36 -15
package/EXAMPLES.md
ADDED
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
# Gala Launchpad SDK - Usage Examples
|
|
2
|
+
|
|
3
|
+
Practical code examples for common SDK operations organized by category. For complete API documentation, see [API Reference](./docs/API-REFERENCE.md).
|
|
4
|
+
|
|
5
|
+
> **⚠️ BREAKING CHANGE (v3.33.0+)**: All DEX trading examples now require delimited token formats (`'GALA|Unit|none|none'` instead of `'GALA'`). See [README.md migration guide](./README.md#token-format-migration-v330) for details.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Quick Start](#quick-start)
|
|
10
|
+
- [Recommended Learning Path](#recommended-learning-path)
|
|
11
|
+
- [Core Operations](#core-operations)
|
|
12
|
+
- [Liquidity Position Management](#liquidity-position-management)
|
|
13
|
+
- [Bonding Curve Trading](#bonding-curve-trading)
|
|
14
|
+
- [DEX Trading](#dex-trading)
|
|
15
|
+
- [Fee Generation & Collection](#fee-generation--collection)
|
|
16
|
+
- [Real-Time Monitoring](#real-time-monitoring)
|
|
17
|
+
- [Utilities](#utilities)
|
|
18
|
+
- [Error Handling](#error-handling)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @gala-chain/launchpad-sdk
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Basic Setup
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
34
|
+
|
|
35
|
+
// Read-only mode (no wallet required)
|
|
36
|
+
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
37
|
+
|
|
38
|
+
// Full-access mode (with wallet for trading)
|
|
39
|
+
const sdkWithWallet = createLaunchpadSDK({
|
|
40
|
+
environment: 'production',
|
|
41
|
+
privateKey: process.env.WALLET_PRIVATE_KEY
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Run Your First Demo
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Complete SDK feature demonstration
|
|
49
|
+
npm run demo
|
|
50
|
+
|
|
51
|
+
# Interactive liquidity position manager
|
|
52
|
+
npm run demo:liquidity
|
|
53
|
+
|
|
54
|
+
# DEX swap workflow
|
|
55
|
+
npm run demo:dex
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Recommended Learning Path
|
|
61
|
+
|
|
62
|
+
Follow this progression to master the SDK:
|
|
63
|
+
|
|
64
|
+
### 1. Start with Core Operations
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Complete SDK overview (10 minutes)
|
|
68
|
+
npm run demo
|
|
69
|
+
|
|
70
|
+
# Read-only operations (no wallet needed)
|
|
71
|
+
npm run demo:read-only
|
|
72
|
+
|
|
73
|
+
# Authenticated operations (wallet required)
|
|
74
|
+
npm run demo:authenticated
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Learn:** SDK initialization, configuration, read-only vs full-access modes
|
|
78
|
+
|
|
79
|
+
### 2. Explore Liquidity Management
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Interactive CLI for liquidity positions
|
|
83
|
+
npm run demo:liquidity
|
|
84
|
+
|
|
85
|
+
# Run all 9 liquidity demos sequentially
|
|
86
|
+
npm run demo:liquidity:all
|
|
87
|
+
|
|
88
|
+
# Detailed position lifecycle
|
|
89
|
+
npm run demo:liquidity:detailed
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Learn:** Add liquidity, collect fees, remove positions, APR calculations
|
|
93
|
+
|
|
94
|
+
### 3. Master DEX Trading
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# DEX swap workflow (quote → execute → confirm)
|
|
98
|
+
npm run demo:dex
|
|
99
|
+
|
|
100
|
+
# Pool discovery and metrics
|
|
101
|
+
npm run demo:dex:pools
|
|
102
|
+
|
|
103
|
+
# Quote comparison (exact input vs exact output)
|
|
104
|
+
npm run demo:dex:quotes
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Learn:** Token swaps, quote generation, slippage protection, pool discovery
|
|
108
|
+
|
|
109
|
+
### 4. Understand Fee Management
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Basic fee generation and collection
|
|
113
|
+
npm run demo:fees
|
|
114
|
+
|
|
115
|
+
# High-volume trading fee accumulation
|
|
116
|
+
npm run demo:fees:high-volume
|
|
117
|
+
|
|
118
|
+
# Complete fee lifecycle test
|
|
119
|
+
npm run demo:fees:test
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Learn:** LP fee generation, collection strategies, multi-wallet workflows
|
|
123
|
+
|
|
124
|
+
### 5. Try Real-Time Features
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Watch for new DEX pool creation
|
|
128
|
+
npm run demo:watch
|
|
129
|
+
|
|
130
|
+
# Watch for new launchpad token launches
|
|
131
|
+
npm run demo:watch:tokens
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Learn:** WebSocket event monitoring, pool/token discovery
|
|
135
|
+
|
|
136
|
+
### 6. Explore Advanced Topics
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Metadata cache performance
|
|
140
|
+
npm run demo:cache
|
|
141
|
+
|
|
142
|
+
# Token supply metrics from GalaChain
|
|
143
|
+
npm run demo:token-supply
|
|
144
|
+
|
|
145
|
+
# Advanced tick-based positions
|
|
146
|
+
npm run demo:liquidity:ticks
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Learn:** Performance optimization, token supply queries, advanced LP strategies
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Core Operations
|
|
154
|
+
|
|
155
|
+
### Initialize SDK
|
|
156
|
+
|
|
157
|
+
**Read-Only Mode** (no wallet required):
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
161
|
+
|
|
162
|
+
const sdk = createLaunchpadSDK({
|
|
163
|
+
environment: 'production'
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Query operations work without wallet
|
|
167
|
+
const pools = await sdk.fetchDexPools({ search: 'GALA' });
|
|
168
|
+
const prices = await sdk.fetchTokenSpotPrice('GALA');
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Full-Access Mode** (with wallet for trading):
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const sdk = createLaunchpadSDK({
|
|
175
|
+
environment: 'production',
|
|
176
|
+
privateKey: process.env.WALLET_PRIVATE_KEY
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Now you can execute trades
|
|
180
|
+
const result = await sdk.executeSwap('GALA|Unit|none|none', 'GUSDC|Unit|none|none', '100', ...);
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Dynamic Wallet Configuration:**
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// Start in read-only mode
|
|
187
|
+
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
188
|
+
|
|
189
|
+
// Later, upgrade to full-access
|
|
190
|
+
sdk.setWallet('your-private-key');
|
|
191
|
+
|
|
192
|
+
// Now signing operations work
|
|
193
|
+
const result = await sdk.buy({ tokenName: 'anime', amount: '100', ... });
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Demos:**
|
|
197
|
+
- `npm run demo` - Complete SDK showcase
|
|
198
|
+
- `npm run demo:read-only` - Wallet-free operations
|
|
199
|
+
- `npm run demo:authenticated` - Wallet-required operations
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Liquidity Position Management
|
|
204
|
+
|
|
205
|
+
Provide liquidity to GalaSwap DEX pools and earn trading fees.
|
|
206
|
+
|
|
207
|
+
### View All Liquidity Positions
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
211
|
+
|
|
212
|
+
const sdk = createLaunchpadSDK({
|
|
213
|
+
environment: 'production',
|
|
214
|
+
privateKey: process.env.WALLET_PRIVATE_KEY
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// Get all positions with automatic pagination (recommended)
|
|
218
|
+
const positions = await sdk.getAllSwapUserLiquidityPositions('eth|0x...');
|
|
219
|
+
|
|
220
|
+
console.log(`Total positions: ${positions.length}`);
|
|
221
|
+
|
|
222
|
+
// Analyze position performance
|
|
223
|
+
let totalLiquidity = 0;
|
|
224
|
+
let totalFees = 0;
|
|
225
|
+
|
|
226
|
+
positions.forEach(pos => {
|
|
227
|
+
totalLiquidity += parseFloat(pos.liquidity || '0');
|
|
228
|
+
|
|
229
|
+
const fee0 = parseFloat(pos.feeAmount0 || '0');
|
|
230
|
+
const fee1 = parseFloat(pos.feeAmount1 || '0');
|
|
231
|
+
totalFees += fee0 + fee1;
|
|
232
|
+
|
|
233
|
+
console.log(`
|
|
234
|
+
Pool: ${pos.token0}/${pos.token1}
|
|
235
|
+
Liquidity: ${pos.liquidity}
|
|
236
|
+
Fees: ${pos.feeAmount0} ${pos.token0} + ${pos.feeAmount1} ${pos.token1}
|
|
237
|
+
`);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
console.log(`\nTotal Liquidity: ${totalLiquidity}`);
|
|
241
|
+
console.log(`Total Fees Earned: ${totalFees}`);
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Create Liquidity Position (Price Range)
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
// Create position with user-friendly price range (v3.33.0+ requires delimited token format)
|
|
248
|
+
const result = await sdk.addSwapLiquidityByPrice({
|
|
249
|
+
token0: 'GALA|Unit|none|none',
|
|
250
|
+
token1: 'GUSDC|Unit|none|none',
|
|
251
|
+
fee: 3000, // 0.30% fee tier
|
|
252
|
+
minPrice: '0.95', // Active range: 0.95 - 1.05
|
|
253
|
+
maxPrice: '1.05',
|
|
254
|
+
amount0Desired: '1000', // Provide 1000 GALA
|
|
255
|
+
amount1Desired: '1000', // Provide 1000 GUSDC
|
|
256
|
+
amount0Min: '900', // Slippage protection (optional)
|
|
257
|
+
amount1Min: '900'
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
console.log(`Position created: ${result.positionId}`);
|
|
261
|
+
console.log(`Liquidity provided: ${result.liquidity}`);
|
|
262
|
+
console.log(`Amount0 used: ${result.amount0Used} GALA`);
|
|
263
|
+
console.log(`Amount1 used: ${result.amount1Used} GUSDC`);
|
|
264
|
+
|
|
265
|
+
// Wait for confirmation
|
|
266
|
+
await result.wait();
|
|
267
|
+
console.log('✓ Position confirmed on blockchain');
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Collect Fees Periodically
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
// Harvest accumulated fees without closing position
|
|
274
|
+
const result = await sdk.collectSwapPositionFees({
|
|
275
|
+
ownerAddress: 'eth|0x...',
|
|
276
|
+
positionId: 'position-id-uuid'
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
console.log(`Collected fees:`);
|
|
280
|
+
console.log(` ${result.amount0Collected} GALA`);
|
|
281
|
+
console.log(` ${result.amount1Collected} GUSDC`);
|
|
282
|
+
|
|
283
|
+
// Position remains active and continues earning fees
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Remove Liquidity & Close Position
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
// Step 1: Preview what you'll receive
|
|
290
|
+
const estimate = await sdk.getSwapEstimateRemoveLiquidity(
|
|
291
|
+
'GALA',
|
|
292
|
+
'GUSDC',
|
|
293
|
+
3000,
|
|
294
|
+
position.liquidity,
|
|
295
|
+
position.tickLower,
|
|
296
|
+
position.tickUpper
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
console.log(`Will receive:`);
|
|
300
|
+
console.log(` ${estimate.amount0} ${estimate.token0Symbol}`);
|
|
301
|
+
console.log(` ${estimate.amount1} ${estimate.token1Symbol}`);
|
|
302
|
+
|
|
303
|
+
// Step 2: Remove full liquidity
|
|
304
|
+
const result = await sdk.removeSwapLiquidity({
|
|
305
|
+
ownerAddress: 'eth|0x...',
|
|
306
|
+
positionId: position.positionId,
|
|
307
|
+
liquidity: position.liquidity, // Full amount to close
|
|
308
|
+
amount0Min: estimate.amount0, // Use estimated amounts
|
|
309
|
+
amount1Min: estimate.amount1,
|
|
310
|
+
deadline: Math.floor(Date.now() / 1000) + 3600 // 1 hour deadline
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
console.log(`Position closed!`);
|
|
314
|
+
console.log(`Withdrawn: ${result.amount0Withdrawn} GALA + ${result.amount1Withdrawn} GUSDC`);
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Liquidity Demos (9 total):**
|
|
318
|
+
- `npm run demo:liquidity` - Interactive CLI
|
|
319
|
+
- `npm run demo:liquidity:all` - Run all 9 demos (orchestrator)
|
|
320
|
+
- `npm run demo:liquidity:detailed` - Complete lifecycle
|
|
321
|
+
- `npm run demo:liquidity:ticks` - Advanced tick positions
|
|
322
|
+
- `npm run demo:liquidity:portfolio` - Multi-position management
|
|
323
|
+
- `npm run demo:liquidity:apr` - APR calculations
|
|
324
|
+
- `npm run demo:liquidity:errors` - Error handling
|
|
325
|
+
- `npm run demo:liquidity:fetch-all` - Pagination example
|
|
326
|
+
- `npm run demo:liquidity:positions-with-prices` - Price enrichment
|
|
327
|
+
|
|
328
|
+
**Orchestrator Usage:**
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Run all liquidity demos
|
|
332
|
+
npm run demo:liquidity:all
|
|
333
|
+
|
|
334
|
+
# Skip specific demos
|
|
335
|
+
npm run demo:liquidity:all -- --skip=detailed,ticks
|
|
336
|
+
|
|
337
|
+
# Run only specific demos
|
|
338
|
+
npm run demo:liquidity:all -- --only=portfolio,apr
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Bonding Curve Trading
|
|
344
|
+
|
|
345
|
+
Trade tokens that are still in bonding curve pools (pre-graduation).
|
|
346
|
+
|
|
347
|
+
### Buy Tokens on Bonding Curve
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
const sdk = createLaunchpadSDK({
|
|
351
|
+
environment: 'production',
|
|
352
|
+
privateKey: process.env.WALLET_PRIVATE_KEY
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// Calculate purchase amounts
|
|
356
|
+
const quote = await sdk.calculateBuyAmount({
|
|
357
|
+
tokenName: 'anime',
|
|
358
|
+
amount: '100',
|
|
359
|
+
type: 'native'
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
console.log(`For 100 GALA:`);
|
|
363
|
+
console.log(` Receive: ${quote.amount} tokens`);
|
|
364
|
+
console.log(` Fee: ${quote.reverseBondingCurveFee} GALA`);
|
|
365
|
+
console.log(` Total cost: ${quote.totalCost} GALA`);
|
|
366
|
+
|
|
367
|
+
// Execute purchase
|
|
368
|
+
const result = await sdk.buy({
|
|
369
|
+
tokenName: 'anime',
|
|
370
|
+
amount: '100',
|
|
371
|
+
type: 'native',
|
|
372
|
+
expectedAmount: quote.amount,
|
|
373
|
+
slippageToleranceFactor: 0.01
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
console.log(`✓ Purchase completed: ${result.transactionId}`);
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Sell Tokens on Bonding Curve
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
// Calculate sale amounts
|
|
383
|
+
const quote = await sdk.calculateSellAmount({
|
|
384
|
+
tokenName: 'anime',
|
|
385
|
+
amount: '10000',
|
|
386
|
+
type: 'exact'
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
console.log(`Selling 10,000 tokens:`);
|
|
390
|
+
console.log(` Receive: ${quote.amount} GALA`);
|
|
391
|
+
console.log(` Fee: ${quote.reverseBondingCurveFee} GALA`);
|
|
392
|
+
|
|
393
|
+
// Execute sale
|
|
394
|
+
const result = await sdk.sell({
|
|
395
|
+
tokenName: 'anime',
|
|
396
|
+
amount: '10000',
|
|
397
|
+
type: 'exact',
|
|
398
|
+
expectedAmount: quote.amount,
|
|
399
|
+
slippageToleranceFactor: 0.01
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
console.log(`✓ Sale completed: ${result.transactionId}`);
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**Bonding Curve Demos:**
|
|
406
|
+
- `npm run demo:trades` - Basic buy/sell operations
|
|
407
|
+
|
|
408
|
+
**Coming Soon (Bonding Curve Orchestrator):**
|
|
409
|
+
8 additional bonding curve demos planned:
|
|
410
|
+
- Pool discovery and filtering
|
|
411
|
+
- Price calculation methods
|
|
412
|
+
- Graduation simulation
|
|
413
|
+
- Multi-token analysis
|
|
414
|
+
- Fee structure exploration
|
|
415
|
+
- Slippage testing scenarios
|
|
416
|
+
- Liquidity depth analysis
|
|
417
|
+
- Graduation timing optimization
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## DEX Trading
|
|
422
|
+
|
|
423
|
+
Trade graduated tokens on the GalaSwap DEX.
|
|
424
|
+
|
|
425
|
+
### Get Swap Quote
|
|
426
|
+
|
|
427
|
+
```typescript
|
|
428
|
+
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
429
|
+
|
|
430
|
+
// Quote for exact input (how many GUSDC for 100 GALA?)
|
|
431
|
+
// v3.33.0+ requires delimited token format
|
|
432
|
+
const quoteInput = await sdk.getSwapQuoteExactInput('GALA|Unit|none|none', 'GUSDC|Unit|none|none', '100');
|
|
433
|
+
|
|
434
|
+
console.log(`Spend 100 GALA → Receive ~${quoteInput.estimatedOutput} GUSDC`);
|
|
435
|
+
console.log(`Price impact: ${(quoteInput.priceImpact * 100).toFixed(2)}%`);
|
|
436
|
+
console.log(`Suggested fee tier: ${quoteInput.feeTier} bps`);
|
|
437
|
+
|
|
438
|
+
// Quote for exact output (how much GALA to get 100 GUSDC?)
|
|
439
|
+
const quoteOutput = await sdk.getSwapQuoteExactOutput('GALA|Unit|none|none', 'GUSDC|Unit|none|none', '100');
|
|
440
|
+
|
|
441
|
+
console.log(`Need ${quoteOutput.inputAmount} GALA → Get 100 GUSDC`);
|
|
442
|
+
console.log(`Price impact: ${(quoteOutput.priceImpact * 100).toFixed(2)}%`);
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Execute Swap
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
const sdk = createLaunchpadSDK({
|
|
449
|
+
environment: 'production',
|
|
450
|
+
privateKey: process.env.WALLET_PRIVATE_KEY
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
// Step 1: Get quote (v3.33.0+ requires delimited token format)
|
|
454
|
+
const quote = await sdk.getSwapQuoteExactInput('GALA|Unit|none|none', 'GUSDC|Unit|none|none', '100');
|
|
455
|
+
|
|
456
|
+
// Step 2: Execute swap with 1% slippage protection
|
|
457
|
+
const result = await sdk.executeSwap(
|
|
458
|
+
'GALA|Unit|none|none',
|
|
459
|
+
'GUSDC|Unit|none|none',
|
|
460
|
+
'100',
|
|
461
|
+
quote.estimatedOutput,
|
|
462
|
+
quote.feeTier,
|
|
463
|
+
0.01 // 1% slippage
|
|
464
|
+
);
|
|
465
|
+
|
|
466
|
+
console.log(`Swap initiated: ${result.transactionId}`);
|
|
467
|
+
console.log(`Expected output: ~${quote.estimatedOutput} GUSDC`);
|
|
468
|
+
|
|
469
|
+
// Step 3: Wait for confirmation
|
|
470
|
+
await result.wait();
|
|
471
|
+
|
|
472
|
+
console.log(`✓ Swap completed!`);
|
|
473
|
+
console.log(`Received: ${result.outputAmount} GUSDC`);
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Discover DEX Pools
|
|
477
|
+
|
|
478
|
+
```typescript
|
|
479
|
+
// Find high-TVL pools
|
|
480
|
+
const pools = await sdk.fetchDexPools({
|
|
481
|
+
search: 'GALA',
|
|
482
|
+
sortBy: 'tvl',
|
|
483
|
+
sortOrder: 'desc',
|
|
484
|
+
limit: 10
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
pools.pools.forEach(pool => {
|
|
488
|
+
console.log(`${pool.poolPair}: $${pool.tvl.toLocaleString()} TVL`);
|
|
489
|
+
console.log(` 24h Volume: $${pool.volume1d.toLocaleString()}`);
|
|
490
|
+
console.log(` APR: ${pool.apr1d.toFixed(2)}%`);
|
|
491
|
+
});
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
**DEX Demos (6 total):**
|
|
495
|
+
- `npm run demo:dex` - Swap workflow (quote → execute → confirm)
|
|
496
|
+
- `npm run demo:dex:pools` - Pool discovery and metrics
|
|
497
|
+
- `npm run demo:dex:pricing` - Pool pricing and TVL analysis
|
|
498
|
+
- `npm run demo:dex:quotes` - Quote comparison
|
|
499
|
+
- `npm run demo:dex:roundtrip` - Complete liquidity workflow
|
|
500
|
+
- `npm run demo:roundtrip:swap` - Buy → Sell → Verify
|
|
501
|
+
|
|
502
|
+
**Symmetry Note:** Both `bonding-curve/` and `dex/` categories have pool discovery demos for consistent learning patterns.
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## Fee Generation & Collection
|
|
507
|
+
|
|
508
|
+
Liquidity provider fee workflows with multi-wallet testing.
|
|
509
|
+
|
|
510
|
+
### Basic Fee Generation
|
|
511
|
+
|
|
512
|
+
```typescript
|
|
513
|
+
const sdk = createLaunchpadSDK({
|
|
514
|
+
environment: 'production',
|
|
515
|
+
privateKey: process.env.WALLET_PRIVATE_KEY
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
// Step 1: Create liquidity position (v3.33.0+ requires delimited token format)
|
|
519
|
+
const position = await sdk.addSwapLiquidityByPrice({
|
|
520
|
+
token0: 'GALA|Unit|none|none',
|
|
521
|
+
token1: 'GUSDC|Unit|none|none',
|
|
522
|
+
fee: 3000,
|
|
523
|
+
minPrice: '0.95',
|
|
524
|
+
maxPrice: '1.05',
|
|
525
|
+
amount0Desired: '1000',
|
|
526
|
+
amount1Desired: '1000'
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
await position.wait();
|
|
530
|
+
console.log(`Position created: ${position.positionId}`);
|
|
531
|
+
|
|
532
|
+
// Step 2: Execute swaps to generate fees
|
|
533
|
+
for (let i = 0; i < 10; i++) {
|
|
534
|
+
const swap = await sdk.executeSwap('GALA|Unit|none|none', 'GUSDC|Unit|none|none', '10', ...);
|
|
535
|
+
await swap.wait();
|
|
536
|
+
console.log(`Swap ${i + 1} completed`);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Step 3: Check accumulated fees
|
|
540
|
+
const positionData = await sdk.getSwapLiquidityPositionById(
|
|
541
|
+
'eth|0x...',
|
|
542
|
+
position.positionId
|
|
543
|
+
);
|
|
544
|
+
|
|
545
|
+
console.log(`Fees accumulated:`);
|
|
546
|
+
console.log(` ${positionData.feeAmount0} GALA`);
|
|
547
|
+
console.log(` ${positionData.feeAmount1} GUSDC`);
|
|
548
|
+
|
|
549
|
+
// Step 4: Collect fees
|
|
550
|
+
const collected = await sdk.collectSwapPositionFees({
|
|
551
|
+
ownerAddress: 'eth|0x...',
|
|
552
|
+
positionId: position.positionId
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
console.log(`✓ Collected: ${collected.amount0Collected} + ${collected.amount1Collected}`);
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### High-Volume Fee Testing
|
|
559
|
+
|
|
560
|
+
```typescript
|
|
561
|
+
// Simulate high trading volume to test fee accumulation
|
|
562
|
+
const highVolumeSwaps = 100;
|
|
563
|
+
const swapAmount = '50'; // 50 GALA per swap
|
|
564
|
+
|
|
565
|
+
console.log(`Generating ${highVolumeSwaps} swaps...`);
|
|
566
|
+
|
|
567
|
+
for (let i = 0; i < highVolumeSwaps; i++) {
|
|
568
|
+
const quote = await sdk.getSwapQuoteExactInput('GALA|Unit|none|none', 'GUSDC|Unit|none|none', swapAmount);
|
|
569
|
+
const swap = await sdk.executeSwap('GALA|Unit|none|none', 'GUSDC|Unit|none|none', swapAmount, quote.estimatedOutput, quote.feeTier, 0.01);
|
|
570
|
+
await swap.wait();
|
|
571
|
+
|
|
572
|
+
if ((i + 1) % 10 === 0) {
|
|
573
|
+
console.log(`${i + 1}/${highVolumeSwaps} swaps completed`);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
console.log(`✓ High-volume testing complete`);
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
**Fee Demos (5 total):**
|
|
581
|
+
- `npm run demo:fees` - Basic fee generation and collection
|
|
582
|
+
- `npm run demo:fees:high-volume` - High-volume trading simulation
|
|
583
|
+
- `npm run demo:fees:test` - Complete fee lifecycle test suite
|
|
584
|
+
- `npm run demo:fees:trade-collect` - Single workflow (trade + collect)
|
|
585
|
+
|
|
586
|
+
**Advanced (not exposed as npm script):**
|
|
587
|
+
- `tsx examples/fees/demo-multi-wallet-fee-generation.ts` - Multi-wallet fee workflows
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## Real-Time Monitoring
|
|
592
|
+
|
|
593
|
+
Monitor pool and token creation events using WebSocket event watchers.
|
|
594
|
+
|
|
595
|
+
### Watch for DEX Pool Creation
|
|
596
|
+
|
|
597
|
+
```typescript
|
|
598
|
+
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
599
|
+
|
|
600
|
+
// Monitor for 60 seconds
|
|
601
|
+
const unsubscribe = sdk.onDexPoolCreation(
|
|
602
|
+
(pool) => {
|
|
603
|
+
console.log(`🆕 New pool: ${pool.poolPair}`);
|
|
604
|
+
console.log(` TVL: $${pool.tvl.toFixed(2)}`);
|
|
605
|
+
console.log(` 24h Volume: $${pool.volume1d.toFixed(2)}`);
|
|
606
|
+
console.log(` Fee tier: ${pool.fee}%`);
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
minTVL: 1000, // Only pools with $1k+ TVL
|
|
610
|
+
tokens: ['GALA', 'GUSDC'], // Only these token pairs
|
|
611
|
+
intervalMs: 30000 // Poll every 30 seconds
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
// Stop watching after 60 seconds
|
|
616
|
+
setTimeout(() => {
|
|
617
|
+
unsubscribe();
|
|
618
|
+
console.log('Stopped watching for new pools');
|
|
619
|
+
}, 60000);
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### Watch for Launchpad Token Creation
|
|
623
|
+
|
|
624
|
+
```typescript
|
|
625
|
+
// Monitor for new token launches
|
|
626
|
+
const unsubscribe = sdk.onLaunchpadTokenCreation(
|
|
627
|
+
(token) => {
|
|
628
|
+
console.log(`🚀 New token: ${token.tokenName}`);
|
|
629
|
+
console.log(` Symbol: ${token.symbol}`);
|
|
630
|
+
console.log(` Creator: ${token.creatorAddress}`);
|
|
631
|
+
console.log(` Created: ${new Date(token.createdAt).toISOString()}`);
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
creatorAddress: 'eth|0x...', // Optional: watch specific creator
|
|
635
|
+
intervalMs: 30000 // Poll every 30 seconds
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
|
|
639
|
+
// Stop watching after 2 minutes
|
|
640
|
+
setTimeout(() => {
|
|
641
|
+
unsubscribe();
|
|
642
|
+
console.log('Stopped watching for new tokens');
|
|
643
|
+
}, 120000);
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**Monitoring Demos (2 total):**
|
|
647
|
+
- `npm run demo:watch` - Watch for new DEX pool creation
|
|
648
|
+
- `npm run demo:watch:tokens` - Watch for new launchpad token launches
|
|
649
|
+
|
|
650
|
+
---
|
|
651
|
+
|
|
652
|
+
## Utilities
|
|
653
|
+
|
|
654
|
+
### Portfolio & Balances
|
|
655
|
+
|
|
656
|
+
```typescript
|
|
657
|
+
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
658
|
+
|
|
659
|
+
// GALA balance
|
|
660
|
+
const galaBalance = await sdk.fetchGalaBalance('eth|0x...');
|
|
661
|
+
console.log(`GALA: ${galaBalance.balance}`);
|
|
662
|
+
|
|
663
|
+
// Token balance on DEX
|
|
664
|
+
const assets = await sdk.getSwapUserAssets('eth|0x...');
|
|
665
|
+
|
|
666
|
+
console.log('DEX Assets:');
|
|
667
|
+
assets.forEach(asset => {
|
|
668
|
+
console.log(` ${asset.symbol}: ${asset.balance}`);
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
// Tokens you hold
|
|
672
|
+
const held = await sdk.fetchTokensHeld({
|
|
673
|
+
address: 'eth|0x...',
|
|
674
|
+
search: 'dragon' // Optional: filter by search
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
console.log('Tokens held:');
|
|
678
|
+
held.forEach(token => {
|
|
679
|
+
console.log(` ${token.symbol}: ${token.balance}`);
|
|
680
|
+
});
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
### Token Supply Metrics
|
|
684
|
+
|
|
685
|
+
```typescript
|
|
686
|
+
// Query GALA supply information
|
|
687
|
+
const supplies = await sdk.fetchTokenClassesWithSupply([
|
|
688
|
+
{
|
|
689
|
+
collection: 'Token',
|
|
690
|
+
category: 'Unit',
|
|
691
|
+
type: 'GALA',
|
|
692
|
+
additionalKey: 'none'
|
|
693
|
+
}
|
|
694
|
+
]);
|
|
695
|
+
|
|
696
|
+
const gala = supplies[0];
|
|
697
|
+
console.log(`Token: ${gala.symbol} (${gala.name})`);
|
|
698
|
+
console.log(`Total Supply: ${gala.totalSupply}`);
|
|
699
|
+
console.log(`Max Supply: ${gala.maxSupply}`);
|
|
700
|
+
console.log(`Total Burned: ${gala.totalBurned}`);
|
|
701
|
+
console.log(`Decimals: ${gala.decimals}`);
|
|
702
|
+
|
|
703
|
+
// Calculate health metrics
|
|
704
|
+
const totalSupply = parseFloat(gala.totalSupply);
|
|
705
|
+
const maxSupply = parseFloat(gala.maxSupply);
|
|
706
|
+
const burned = parseFloat(gala.totalBurned);
|
|
707
|
+
|
|
708
|
+
const circulationPercent = (totalSupply / maxSupply) * 100;
|
|
709
|
+
const burnPercent = (burned / totalSupply) * 100;
|
|
710
|
+
|
|
711
|
+
console.log(`\nCirculation: ${circulationPercent.toFixed(2)}% of max supply`);
|
|
712
|
+
console.log(`Burned: ${burnPercent.toFixed(2)}% of total supply`);
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
### Metadata Cache Performance
|
|
716
|
+
|
|
717
|
+
```typescript
|
|
718
|
+
// Warm cache by fetching pools
|
|
719
|
+
console.log('Warming cache...');
|
|
720
|
+
await sdk.fetchPools({ type: 'popular', limit: 50 });
|
|
721
|
+
|
|
722
|
+
// Check cache statistics
|
|
723
|
+
const stats = sdk.getCacheInfo();
|
|
724
|
+
console.log(`Cache warmed with ${stats.totalTokens} tokens`);
|
|
725
|
+
console.log(`Memory: ${(stats.cacheSize / 1024).toFixed(2)} KB`);
|
|
726
|
+
|
|
727
|
+
// Perform instant calculations using cached metadata
|
|
728
|
+
const tokens = ['anime', 'dragnrkti', 'rocketri'];
|
|
729
|
+
|
|
730
|
+
console.log('\nCalculating spot prices (instant, no network calls):');
|
|
731
|
+
console.time('Batch Calculations');
|
|
732
|
+
|
|
733
|
+
for (const token of tokens) {
|
|
734
|
+
const poolDetails = await sdk.fetchPoolDetailsForCalculation(token);
|
|
735
|
+
|
|
736
|
+
const buy100 = await sdk.calculateBuyAmountLocal({
|
|
737
|
+
tokenName: token,
|
|
738
|
+
amount: '100',
|
|
739
|
+
type: 'native',
|
|
740
|
+
currentSupply: poolDetails.currentSupply
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
console.log(`${token}: 100 GALA → ${buy100.amount} tokens`);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
console.timeEnd('Batch Calculations');
|
|
747
|
+
// Output: Batch Calculations: ~50ms (vs ~2000ms without cache)
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
**Utility Demos (5 total):**
|
|
751
|
+
- `npm run demo:cache` - Metadata cache warming and performance
|
|
752
|
+
- `npm run demo:token-supply` - Token supply metrics from GalaChain
|
|
753
|
+
|
|
754
|
+
**Additional (not exposed as npm scripts):**
|
|
755
|
+
- `tsx examples/utilities/balances.ts` - Multi-token balance queries
|
|
756
|
+
- `tsx examples/utilities/balance.ts` - Single token balance check
|
|
757
|
+
- `tsx examples/utilities/price-history.ts` - Historical price data (Node.js only)
|
|
758
|
+
|
|
759
|
+
---
|
|
760
|
+
|
|
761
|
+
## Error Handling
|
|
762
|
+
|
|
763
|
+
Common error patterns and solutions.
|
|
764
|
+
|
|
765
|
+
### Network Errors
|
|
766
|
+
|
|
767
|
+
```typescript
|
|
768
|
+
try {
|
|
769
|
+
const quote = await sdk.getSwapQuoteExactInput('GALA', 'INVALID', '100');
|
|
770
|
+
} catch (error) {
|
|
771
|
+
if (error.message.includes('Pool not found')) {
|
|
772
|
+
console.log('Token pair not available on DEX');
|
|
773
|
+
} else if (error.message.includes('Invalid token')) {
|
|
774
|
+
console.log('Check token symbol format');
|
|
775
|
+
} else if (error.message.includes('timeout')) {
|
|
776
|
+
console.log('Network request timeout - try again');
|
|
777
|
+
} else {
|
|
778
|
+
console.log(`Error: ${error.message}`);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
### Wallet Requirements
|
|
784
|
+
|
|
785
|
+
```typescript
|
|
786
|
+
import { ValidationError } from '@gala-chain/launchpad-sdk';
|
|
787
|
+
|
|
788
|
+
const sdk = createLaunchpadSDK({ environment: 'production' });
|
|
789
|
+
// No wallet configured
|
|
790
|
+
|
|
791
|
+
try {
|
|
792
|
+
await sdk.buy({ tokenName: 'anime', amount: '100', ... });
|
|
793
|
+
} catch (error) {
|
|
794
|
+
if (error instanceof ValidationError && error.code === 'WALLET_REQUIRED') {
|
|
795
|
+
console.log('This operation requires a wallet');
|
|
796
|
+
console.log('Configure wallet: sdk.setWallet(privateKey)');
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
### Slippage Protection
|
|
802
|
+
|
|
803
|
+
```typescript
|
|
804
|
+
try {
|
|
805
|
+
const quote = await sdk.getSwapQuoteExactInput('GALA|Unit|none|none', 'GUSDC|Unit|none|none', '10000');
|
|
806
|
+
const result = await sdk.executeSwap(
|
|
807
|
+
'GALA',
|
|
808
|
+
'GUSDC',
|
|
809
|
+
'10000',
|
|
810
|
+
quote.estimatedOutput,
|
|
811
|
+
quote.feeTier,
|
|
812
|
+
0.01 // 1% slippage tolerance
|
|
813
|
+
);
|
|
814
|
+
} catch (error) {
|
|
815
|
+
if (error.message.includes('slippage')) {
|
|
816
|
+
console.log('Price moved beyond slippage tolerance');
|
|
817
|
+
console.log('Increase slippage or retry with fresh quote');
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
**Error Handling Demo:**
|
|
823
|
+
- `npm run demo:liquidity:errors` - Comprehensive error scenarios
|
|
824
|
+
|
|
825
|
+
---
|
|
826
|
+
|
|
827
|
+
## More Examples
|
|
828
|
+
|
|
829
|
+
See the `examples/` directory for complete working demos organized by category:
|
|
830
|
+
|
|
831
|
+
```
|
|
832
|
+
examples/
|
|
833
|
+
├── core/ # 4 demos - SDK fundamentals
|
|
834
|
+
├── liquidity/ # 9 demos - LP position management
|
|
835
|
+
├── bonding-curve/ # 1 demo + 8 planned - Pre-graduation trading
|
|
836
|
+
├── dex/ # 6 demos - DEX trading
|
|
837
|
+
├── fees/ # 5 demos - Fee workflows
|
|
838
|
+
├── monitoring/ # 2 demos - Real-time events
|
|
839
|
+
├── utilities/ # 5 demos - Helper operations
|
|
840
|
+
└── debug/ # 3 tools - Development utilities
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
**Total:** 36 demos covering all major SDK features
|
|
844
|
+
|
|
845
|
+
For migration from old demo structure, see [docs/DEMO_MIGRATION_GUIDE.md](./docs/DEMO_MIGRATION_GUIDE.md).
|