@gala-chain/launchpad-sdk 3.23.0 → 3.24.2
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 +955 -0
- package/CHANGELOG.md +120 -0
- package/README.md +154 -0
- package/dist/LaunchpadSDK.d.ts +121 -0
- package/dist/LaunchpadSDK.d.ts.map +1 -1
- package/dist/constants/version.generated.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/services/GSwapService.d.ts +59 -0
- package/dist/services/GSwapService.d.ts.map +1 -0
- package/dist/services/TokenMetadataService.d.ts +113 -0
- package/dist/services/TokenMetadataService.d.ts.map +1 -0
- package/dist/setup.d.ts +8 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/types/gswap.dto.d.ts +139 -0
- package/dist/types/gswap.dto.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +177 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/token-format-converter.d.ts +58 -0
- package/dist/utils/token-format-converter.d.ts.map +1 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,125 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 683396d: # v3.23.0: GalaSwap DEX Integration & Documentation
|
|
8
|
+
|
|
9
|
+
**🚀 Major Feature Release: Complete GalaSwap DEX Integration**
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### GalaSwap DEX Trading Integration (v3.23.0+)
|
|
14
|
+
|
|
15
|
+
**5 New High-Level SDK Methods for DEX Trading:**
|
|
16
|
+
- `getSwapQuoteExactInput(fromToken, toToken, amount)` - Get quote for known spending
|
|
17
|
+
- `getSwapQuoteExactOutput(fromToken, toToken, amount)` - Get quote for known output
|
|
18
|
+
- `executeSwap(fromToken, toToken, inputAmount, estimatedOutput, feeTier, slippageTolerance)` -
|
|
19
|
+
Execute swaps with slippage protection
|
|
20
|
+
- `getSwapUserAssets(walletAddress)` - Query user token balances
|
|
21
|
+
- `getSwapPoolInfo(tokenA, tokenB)` - Get pool liquidity and fee information
|
|
22
|
+
|
|
23
|
+
**Architecture:**
|
|
24
|
+
- Three-layer design: LaunchpadSDK → GSwapService (wrapper) → @gala-chain/gswap-sdk (core)
|
|
25
|
+
- Automatic token format conversion (simple: "GALA" ↔ full: "GALA|Unit|none|none")
|
|
26
|
+
- Real-time WebSocket event monitoring for transaction confirmation
|
|
27
|
+
- Comprehensive slippage protection (configurable tolerance: 0.0001 to 1.0)
|
|
28
|
+
- Support for three fee tiers per pool: 500 (0.05%), 3000 (0.30%), 10000 (1.00%)
|
|
29
|
+
|
|
30
|
+
### 5 New MCP Tools
|
|
31
|
+
- `gala_launchpad_get_swap_quote_exact_input` - Get swap quote with known input
|
|
32
|
+
- `gala_launchpad_get_swap_quote_exact_output` - Get swap quote with known output
|
|
33
|
+
- `gala_launchpad_execute_swap` - Execute DEX swap with slippage protection
|
|
34
|
+
- `gala_launchpad_get_swap_user_assets` - Query wallet token balances
|
|
35
|
+
- `gala_launchpad_get_swap_pool_info` - Get DEX pool information
|
|
36
|
+
|
|
37
|
+
### 1 New MCP Slash Command
|
|
38
|
+
- `/galachain-launchpad:dex-swap tokenName=GALA toToken=GUSDC amount=100 slippage=1` - Guided DEX
|
|
39
|
+
swap workflow
|
|
40
|
+
|
|
41
|
+
### Comprehensive Test Coverage
|
|
42
|
+
- **gswap-service.test.ts** (45+ test cases) - Full GSwapService integration tests with mocked
|
|
43
|
+
GSwap SDK
|
|
44
|
+
- **token-format-converter.test.ts** (67+ test cases) - Bidirectional token format conversion
|
|
45
|
+
tests
|
|
46
|
+
- **dex-tools.test.ts** (40+ test cases per tool) - MCP tool configuration and schema validation
|
|
47
|
+
- **200+ total test cases** covering edge cases, error handling, and real-world scenarios
|
|
48
|
+
|
|
49
|
+
### Complete Documentation
|
|
50
|
+
|
|
51
|
+
**API.md (450+ lines):**
|
|
52
|
+
- Comprehensive API reference for all SDK methods
|
|
53
|
+
- DEX trading methods with examples
|
|
54
|
+
- Type definitions and error handling patterns
|
|
55
|
+
- Complete installation and usage guide
|
|
56
|
+
|
|
57
|
+
**CLAUDE.md Updates (250+ lines):**
|
|
58
|
+
- GalaSwap DEX Trading Methods section with architecture diagram
|
|
59
|
+
- Complete trading workflow examples
|
|
60
|
+
- Real-time monitoring via WebSocket
|
|
61
|
+
- Error handling patterns
|
|
62
|
+
- Performance characteristics
|
|
63
|
+
|
|
64
|
+
**gswap-integration.md (400+ lines):**
|
|
65
|
+
- Complete DEX integration guide
|
|
66
|
+
- Architecture overview with three-layer design
|
|
67
|
+
- 4 usage patterns: simple swap, pool info, portfolio tracking, real-time monitoring
|
|
68
|
+
- Token format handling and conversion
|
|
69
|
+
- Slippage protection strategies
|
|
70
|
+
- Fee tier analysis and optimization
|
|
71
|
+
- Troubleshooting and advanced topics
|
|
72
|
+
|
|
73
|
+
## Technical Improvements
|
|
74
|
+
|
|
75
|
+
### Token Format Converter Enhancement
|
|
76
|
+
|
|
77
|
+
Fixed edge cases revealed by comprehensive tests:
|
|
78
|
+
- Proper handling of already-formatted tokens (no double-processing)
|
|
79
|
+
- Object input support with TokenClassKey parsing
|
|
80
|
+
- Graceful null/undefined input handling
|
|
81
|
+
- Backward compatibility with old/new token formats
|
|
82
|
+
|
|
83
|
+
### Bundle Size Optimization
|
|
84
|
+
|
|
85
|
+
All formats remain well under 50 kB limit:
|
|
86
|
+
- ESM: 38.79 kB gzipped
|
|
87
|
+
- CommonJS: 38.89 kB gzipped
|
|
88
|
+
- UMD: 39.01 kB gzipped
|
|
89
|
+
|
|
90
|
+
GSwap SDK marked as external dependency (<1 KB bundle impact)
|
|
91
|
+
|
|
92
|
+
## Breaking Changes
|
|
93
|
+
|
|
94
|
+
None - fully backward compatible with v3.22.x
|
|
95
|
+
|
|
96
|
+
## Migration Guide
|
|
97
|
+
|
|
98
|
+
No migration needed. New methods are additive:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
102
|
+
|
|
103
|
+
const sdk = createLaunchpadSDK({ privateKey: process.env.PRIVATE_KEY });
|
|
104
|
+
|
|
105
|
+
// New DEX trading methods available
|
|
106
|
+
const quote = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');
|
|
107
|
+
const result = await sdk.executeSwap(...);
|
|
108
|
+
|
|
109
|
+
// All existing bonding curve methods still work
|
|
110
|
+
await sdk.buyTokens('anime', '100', ...);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Dependencies
|
|
114
|
+
- Added: @gala-chain/gswap-sdk@0.0.7 (marked as external)
|
|
115
|
+
- No breaking dependency changes
|
|
116
|
+
|
|
117
|
+
## Next Steps
|
|
118
|
+
- Try the new `/galachain-launchpad:dex-swap` slash command in Claude Desktop
|
|
119
|
+
- Explore 5 new DEX trading tools in MCP server
|
|
120
|
+
- Reference API.md for complete method signatures
|
|
121
|
+
- See gswap-integration.md for integration patterns
|
|
122
|
+
|
|
3
123
|
## 3.23.0
|
|
4
124
|
|
|
5
125
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1564,6 +1564,160 @@ graduateToken(options): Promise<TransactionResult>
|
|
|
1564
1564
|
// One-step pool graduation: calculates cost and buys all remaining tokens
|
|
1565
1565
|
```
|
|
1566
1566
|
|
|
1567
|
+
### **GSwap DEX Trading Methods**
|
|
1568
|
+
|
|
1569
|
+
```typescript
|
|
1570
|
+
// GSwap Quote Operations (read-only, fast)
|
|
1571
|
+
getSwapQuoteExactInput(fromToken, toToken, amount): Promise<SwapQuoteResult>
|
|
1572
|
+
// Returns: { fromToken, toToken, inputAmount, estimatedOutput, feeTier, priceImpact, executionPrice }
|
|
1573
|
+
// Get quote for known input amount (spend known GALA, get estimated token output)
|
|
1574
|
+
|
|
1575
|
+
getSwapQuoteExactOutput(fromToken, toToken, amount): Promise<SwapQuoteResult>
|
|
1576
|
+
// Returns: { fromToken, toToken, inputAmount, estimatedOutput, feeTier, priceImpact, executionPrice }
|
|
1577
|
+
// Get quote for known output amount (get known token output, estimate GALA cost)
|
|
1578
|
+
|
|
1579
|
+
// GSwap Swap Execution (requires wallet signer)
|
|
1580
|
+
executeSwap(fromToken, toToken, amount, estimatedOutput, feeTier, slippageTolerance): Promise<ExecuteSwapResult>
|
|
1581
|
+
// Options: { fromToken, toToken, inputAmount, estimatedOutput, feeTier, slippageTolerance }
|
|
1582
|
+
// Returns: { transactionId, status, fromToken, toToken, inputAmount, outputAmount, timestamp }
|
|
1583
|
+
// Execute token swap with automatic slippage protection and unified WebSocket monitoring
|
|
1584
|
+
|
|
1585
|
+
// GSwap User Operations
|
|
1586
|
+
getSwapUserAssets(walletAddress): Promise<UserAsset[]>
|
|
1587
|
+
// Returns: [{ tokenId, symbol, balance, decimals }, ...]
|
|
1588
|
+
// Get user token balances across all DEX pools
|
|
1589
|
+
|
|
1590
|
+
getSwapPoolInfo(tokenA, tokenB): Promise<PoolInfo>
|
|
1591
|
+
// Returns: { tokenA, tokenB, liquidity, feeTiers, swapCount }
|
|
1592
|
+
// Get liquidity and fee tier information for token pair
|
|
1593
|
+
```
|
|
1594
|
+
|
|
1595
|
+
**Key Features:**
|
|
1596
|
+
- ✅ **Multi-format token support**: Use simple symbols ('GALA', 'GUSDC') or structured format ('GALA|Unit|none|none')
|
|
1597
|
+
- ✅ **Quote pattern**: Always get quote before executing swap for accurate slippage calculations
|
|
1598
|
+
- ✅ **Unified WebSocket**: Real-time transaction monitoring via shared LaunchpadSDK WebSocket connection
|
|
1599
|
+
- ✅ **Environment alignment**: Automatic STAGE/PROD configuration matching
|
|
1600
|
+
- ✅ **Fee tiers**: Standard DEX fees (500 bps = 0.05%, 3000 bps = 0.30%, 10000 bps = 1.00%)
|
|
1601
|
+
- ✅ **Error handling**: Dedicated error types (GSwapQuoteError, GSwapSwapError, GSwapAssetError, GSwapPoolError)
|
|
1602
|
+
|
|
1603
|
+
### **GSwap DEX Trading** (Graduated Tokens)
|
|
1604
|
+
|
|
1605
|
+
For tokens that have graduated from the bonding curve phase, use GSwap SDK integration for full DEX trading:
|
|
1606
|
+
|
|
1607
|
+
```typescript
|
|
1608
|
+
// Access GSwap trading functionality
|
|
1609
|
+
const gswapService = sdk.gswap;
|
|
1610
|
+
|
|
1611
|
+
// Get swap quotes for graduated tokens
|
|
1612
|
+
const quoteParams = {
|
|
1613
|
+
fromToken: 'GALA',
|
|
1614
|
+
toToken: 'GUSDC',
|
|
1615
|
+
amount: '100'
|
|
1616
|
+
};
|
|
1617
|
+
|
|
1618
|
+
// Quote for exact input (spend known amount)
|
|
1619
|
+
const quoteExactInput = await gswapService.getSwapQuoteExactInput(quoteParams);
|
|
1620
|
+
console.log(`Spend 100 GALA, get ~${quoteExactInput.estimatedOutput} GUSDC`);
|
|
1621
|
+
console.log(`Price impact: ${quoteExactInput.priceImpact}%`);
|
|
1622
|
+
console.log(`Execution price: ${quoteExactInput.executionPrice}`);
|
|
1623
|
+
|
|
1624
|
+
// Quote for exact output (receive known amount)
|
|
1625
|
+
const quoteExactOutput = await gswapService.getSwapQuoteExactOutput({
|
|
1626
|
+
fromToken: 'GALA',
|
|
1627
|
+
toToken: 'GUSDC',
|
|
1628
|
+
amount: '100' // Desired output amount
|
|
1629
|
+
});
|
|
1630
|
+
console.log(`To get 100 GUSDC, spend ~${quoteExactOutput.inputAmount} GALA`);
|
|
1631
|
+
|
|
1632
|
+
// Execute swap with slippage protection
|
|
1633
|
+
const swapResult = await gswapService.executeSwap({
|
|
1634
|
+
fromToken: 'GALA',
|
|
1635
|
+
toToken: 'GUSDC',
|
|
1636
|
+
inputAmount: '100',
|
|
1637
|
+
estimatedOutput: quoteExactInput.estimatedOutput,
|
|
1638
|
+
feeTier: quoteExactInput.feeTier,
|
|
1639
|
+
slippageTolerance: 0.01 // 1% slippage tolerance
|
|
1640
|
+
});
|
|
1641
|
+
|
|
1642
|
+
console.log(`Swap completed! TX: ${swapResult.transactionId}`);
|
|
1643
|
+
console.log(`Received: ${swapResult.outputAmount} GUSDC`);
|
|
1644
|
+
|
|
1645
|
+
// Query user assets on DEX
|
|
1646
|
+
const assets = await gswapService.getUserAssets('eth|0x...');
|
|
1647
|
+
assets.forEach(asset => {
|
|
1648
|
+
console.log(`${asset.symbol}: ${asset.balance}`);
|
|
1649
|
+
});
|
|
1650
|
+
|
|
1651
|
+
// Get pool information for token pair
|
|
1652
|
+
const poolInfo = await gswapService.getPoolInfo('GALA', 'GUSDC');
|
|
1653
|
+
console.log(`Liquidity: ${poolInfo.liquidity}`);
|
|
1654
|
+
console.log(`Available fee tiers: ${poolInfo.feeTiers}`);
|
|
1655
|
+
```
|
|
1656
|
+
|
|
1657
|
+
**GSwap Error Handling:**
|
|
1658
|
+
|
|
1659
|
+
The GSwap service provides specific error types for different failure scenarios:
|
|
1660
|
+
|
|
1661
|
+
```typescript
|
|
1662
|
+
import {
|
|
1663
|
+
GSwapQuoteError,
|
|
1664
|
+
GSwapSwapError,
|
|
1665
|
+
GSwapPoolError,
|
|
1666
|
+
GSwapAssetError
|
|
1667
|
+
} from '@gala-chain/launchpad-sdk';
|
|
1668
|
+
|
|
1669
|
+
try {
|
|
1670
|
+
const quote = await gswapService.getSwapQuoteExactInput({
|
|
1671
|
+
fromToken: 'INVALID',
|
|
1672
|
+
toToken: 'GUSDC',
|
|
1673
|
+
amount: '100'
|
|
1674
|
+
});
|
|
1675
|
+
} catch (error) {
|
|
1676
|
+
if (error instanceof GSwapQuoteError) {
|
|
1677
|
+
console.error(`Quote failed: ${error.message}`);
|
|
1678
|
+
console.error(`Error code: ${error.code}`);
|
|
1679
|
+
console.error(`Original error:`, error.originalError);
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
try {
|
|
1684
|
+
await gswapService.executeSwap({...});
|
|
1685
|
+
} catch (error) {
|
|
1686
|
+
if (error instanceof GSwapSwapError) {
|
|
1687
|
+
console.error(`Swap failed: ${error.message}`);
|
|
1688
|
+
console.error(`Transaction hash: ${error.transactionHash}`);
|
|
1689
|
+
console.error(`Error code: ${error.code}`);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
try {
|
|
1694
|
+
await gswapService.getUserAssets(walletAddress);
|
|
1695
|
+
} catch (error) {
|
|
1696
|
+
if (error instanceof GSwapAssetError) {
|
|
1697
|
+
console.error(`Asset query failed for ${error.walletAddress}: ${error.message}`);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
```
|
|
1701
|
+
|
|
1702
|
+
**GSwap vs Bonding Curve Trading:**
|
|
1703
|
+
|
|
1704
|
+
| Feature | Bonding Curve (buy/sell) | GSwap DEX (swaps) |
|
|
1705
|
+
|---------|-------------------------|-------------------|
|
|
1706
|
+
| **Token Status** | Pre-graduation | Post-graduation |
|
|
1707
|
+
| **Liquidity** | Algorithmic curve | Concentrated liquidity pools |
|
|
1708
|
+
| **Fee Tiers** | Single: reverseBondingCurveFee | Multiple: 500 (0.05%), 3000 (0.30%), 10000 (1.00%) |
|
|
1709
|
+
| **Price Impact** | Linear/exponential | Depends on pool depth |
|
|
1710
|
+
| **Method** | Direct buy/sell | Quote + execute pattern |
|
|
1711
|
+
| **Quote Types** | Exact input/output | Exact input/output |
|
|
1712
|
+
|
|
1713
|
+
**Performance Considerations:**
|
|
1714
|
+
|
|
1715
|
+
- Quotes are fast (typically <100ms)
|
|
1716
|
+
- Socket connection is auto-established on first swap
|
|
1717
|
+
- Socket failures don't block swaps (graceful degradation)
|
|
1718
|
+
- Use BigNumber for precision in calculations
|
|
1719
|
+
- Slippage tolerance typically 0.5% - 2%
|
|
1720
|
+
|
|
1567
1721
|
### **Content Operations**
|
|
1568
1722
|
|
|
1569
1723
|
```typescript
|
package/dist/LaunchpadSDK.d.ts
CHANGED
|
@@ -161,6 +161,7 @@ export declare class LaunchpadSDK {
|
|
|
161
161
|
private readonly bundleService;
|
|
162
162
|
private readonly websocketService;
|
|
163
163
|
private readonly priceHistoryService;
|
|
164
|
+
private readonly gswapService;
|
|
164
165
|
private readonly cache;
|
|
165
166
|
private readonly launchpadAPI;
|
|
166
167
|
constructor(config: LaunchpadSDKConfig);
|
|
@@ -1626,6 +1627,126 @@ export declare class LaunchpadSDK {
|
|
|
1626
1627
|
* @private
|
|
1627
1628
|
*/
|
|
1628
1629
|
private warmCacheFromPools;
|
|
1630
|
+
/**
|
|
1631
|
+
* Get a swap quote for exact input amount
|
|
1632
|
+
*
|
|
1633
|
+
* Queries GalaSwap DEX for a quote when swapping from one token to another,
|
|
1634
|
+
* specifying the exact amount you want to spend.
|
|
1635
|
+
*
|
|
1636
|
+
* @category DEX Trading
|
|
1637
|
+
* @param fromToken Source token symbol (e.g., "GALA", "GUSDC")
|
|
1638
|
+
* @param toToken Destination token symbol (e.g., "GALA", "GUSDC")
|
|
1639
|
+
* @param amount Amount of source token to spend
|
|
1640
|
+
* @returns Promise<SwapQuoteResult> Quote with estimated output and fees
|
|
1641
|
+
* @since 3.23.0
|
|
1642
|
+
*
|
|
1643
|
+
* @example Get swap quote
|
|
1644
|
+
* ```typescript
|
|
1645
|
+
* const quote = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');
|
|
1646
|
+
* console.log(`Spend: 100 GALA`);
|
|
1647
|
+
* console.log(`Receive: ~${quote.estimatedOutput} GUSDC`);
|
|
1648
|
+
* console.log(`Price impact: ${quote.priceImpact}%`);
|
|
1649
|
+
* ```
|
|
1650
|
+
*/
|
|
1651
|
+
getSwapQuoteExactInput(fromToken: string, toToken: string, amount: string): Promise<import(".").SwapQuoteResult>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Get a swap quote for exact output amount
|
|
1654
|
+
*
|
|
1655
|
+
* Queries GalaSwap DEX for a quote when swapping from one token to another,
|
|
1656
|
+
* specifying the exact amount you want to receive.
|
|
1657
|
+
*
|
|
1658
|
+
* @category DEX Trading
|
|
1659
|
+
* @param fromToken Source token symbol (e.g., "GALA", "GUSDC")
|
|
1660
|
+
* @param toToken Destination token symbol (e.g., "GALA", "GUSDC")
|
|
1661
|
+
* @param amount Desired amount of destination token to receive
|
|
1662
|
+
* @returns Promise<SwapQuoteResult> Quote with required input and fees
|
|
1663
|
+
* @since 3.23.0
|
|
1664
|
+
*
|
|
1665
|
+
* @example Get swap quote for exact output
|
|
1666
|
+
* ```typescript
|
|
1667
|
+
* const quote = await sdk.getSwapQuoteExactOutput('GALA', 'GUSDC', '50');
|
|
1668
|
+
* console.log(`To receive: 50 GUSDC`);
|
|
1669
|
+
* console.log(`Need to spend: ~${quote.inputAmount} GALA`);
|
|
1670
|
+
* console.log(`Price impact: ${quote.priceImpact}%`);
|
|
1671
|
+
* ```
|
|
1672
|
+
*/
|
|
1673
|
+
getSwapQuoteExactOutput(fromToken: string, toToken: string, amount: string): Promise<import(".").SwapQuoteResult>;
|
|
1674
|
+
/**
|
|
1675
|
+
* Execute a token swap on GalaSwap DEX
|
|
1676
|
+
*
|
|
1677
|
+
* Executes a swap transaction with slippage protection. Requires a signer wallet.
|
|
1678
|
+
* Use quote methods first to get expected output amounts.
|
|
1679
|
+
*
|
|
1680
|
+
* @category DEX Trading
|
|
1681
|
+
* @param fromToken Source token symbol
|
|
1682
|
+
* @param toToken Destination token symbol
|
|
1683
|
+
* @param inputAmount Amount of source token to spend
|
|
1684
|
+
* @param estimatedOutput Expected output amount from quote
|
|
1685
|
+
* @param feeTier Fee tier for the swap (500, 3000, or 10000 basis points)
|
|
1686
|
+
* @param slippageTolerance Maximum acceptable slippage (default: 0.01 = 1%)
|
|
1687
|
+
* @returns Promise<ExecuteSwapResult> Swap result with transaction details
|
|
1688
|
+
* @since 3.23.0
|
|
1689
|
+
* @throws ValidationError if wallet is not configured
|
|
1690
|
+
*
|
|
1691
|
+
* @example Execute swap
|
|
1692
|
+
* ```typescript
|
|
1693
|
+
* // 1. Get quote first
|
|
1694
|
+
* const quote = await sdk.getSwapQuoteExactInput('GALA', 'GUSDC', '100');
|
|
1695
|
+
*
|
|
1696
|
+
* // 2. Execute swap with quoted amounts
|
|
1697
|
+
* const result = await sdk.executeSwap(
|
|
1698
|
+
* 'GALA',
|
|
1699
|
+
* 'GUSDC',
|
|
1700
|
+
* '100',
|
|
1701
|
+
* quote.estimatedOutput,
|
|
1702
|
+
* quote.feeTier,
|
|
1703
|
+
* 0.01 // 1% slippage tolerance
|
|
1704
|
+
* );
|
|
1705
|
+
*
|
|
1706
|
+
* console.log(`Swapped successfully!`);
|
|
1707
|
+
* console.log(`Transaction: ${result.transactionId}`);
|
|
1708
|
+
* ```
|
|
1709
|
+
*/
|
|
1710
|
+
executeSwap(fromToken: string, toToken: string, inputAmount: string, estimatedOutput: string, feeTier: number, slippageTolerance?: number): Promise<import(".").ExecuteSwapResult>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Get user's token assets/balances from GalaSwap
|
|
1713
|
+
*
|
|
1714
|
+
* Retrieves all token balances for a wallet address.
|
|
1715
|
+
*
|
|
1716
|
+
* @category DEX Trading
|
|
1717
|
+
* @param walletAddress User's wallet address
|
|
1718
|
+
* @returns Promise<UserAsset[]> Array of user assets with balances
|
|
1719
|
+
* @since 3.23.0
|
|
1720
|
+
*
|
|
1721
|
+
* @example Get user assets
|
|
1722
|
+
* ```typescript
|
|
1723
|
+
* const assets = await sdk.getSwapUserAssets(sdk.getEthereumAddress());
|
|
1724
|
+
* assets.forEach(asset => {
|
|
1725
|
+
* console.log(`${asset.symbol}: ${asset.balance}`);
|
|
1726
|
+
* });
|
|
1727
|
+
* ```
|
|
1728
|
+
*/
|
|
1729
|
+
getSwapUserAssets(walletAddress: string): Promise<import(".").UserAsset[]>;
|
|
1730
|
+
/**
|
|
1731
|
+
* Get pool information for a token pair
|
|
1732
|
+
*
|
|
1733
|
+
* Retrieves liquidity and fee tier information for a trading pair.
|
|
1734
|
+
*
|
|
1735
|
+
* @category DEX Trading
|
|
1736
|
+
* @param tokenA First token symbol
|
|
1737
|
+
* @param tokenB Second token symbol
|
|
1738
|
+
* @returns Promise<PoolInfo> Pool information with liquidity and available fee tiers
|
|
1739
|
+
* @since 3.23.0
|
|
1740
|
+
*
|
|
1741
|
+
* @example Get pool info
|
|
1742
|
+
* ```typescript
|
|
1743
|
+
* const poolInfo = await sdk.getSwapPoolInfo('GALA', 'GUSDC');
|
|
1744
|
+
* console.log(`Liquidity: ${poolInfo.liquidity}`);
|
|
1745
|
+
* console.log(`Available fees: ${poolInfo.feeTiers.join(', ')} bps`);
|
|
1746
|
+
* console.log(`Active swaps: ${poolInfo.swapCount}`);
|
|
1747
|
+
* ```
|
|
1748
|
+
*/
|
|
1749
|
+
getSwapPoolInfo(tokenA: string, tokenB: string): Promise<import(".").PoolInfo>;
|
|
1629
1750
|
/**
|
|
1630
1751
|
* Cleanup SDK resources and connections
|
|
1631
1752
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LaunchpadSDK.d.ts","sourceRoot":"","sources":["../src/LaunchpadSDK.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"LaunchpadSDK.d.ts","sourceRoot":"","sources":["../src/LaunchpadSDK.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAelF,OAAO,EAAwB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uB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