@gala-chain/launchpad-sdk 0.4.3 → 3.0.1
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/README.md +351 -77
- package/dist/examples/complete-sdk-demo.d.ts +22 -0
- package/dist/examples/complete-sdk-demo.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/src/LaunchpadSDK.d.ts +755 -0
- package/dist/src/LaunchpadSDK.d.ts.map +1 -0
- package/dist/{api → src/api}/LaunchpadAPI.d.ts +105 -67
- package/dist/src/api/LaunchpadAPI.d.ts.map +1 -0
- package/dist/{api → src/api}/dto/BondingCurveDTOs.d.ts +8 -5
- package/dist/src/api/dto/BondingCurveDTOs.d.ts.map +1 -0
- package/dist/src/api/dto/TransferTokenDto.d.ts +76 -0
- package/dist/src/api/dto/TransferTokenDto.d.ts.map +1 -0
- package/dist/src/auth/SignatureAuth.d.ts.map +1 -0
- package/dist/src/auth/types.d.ts.map +1 -0
- package/dist/src/config/environments.d.ts +45 -0
- package/dist/src/config/environments.d.ts.map +1 -0
- package/dist/{helpers → src/helpers}/sdk.d.ts +23 -13
- package/dist/src/helpers/sdk.d.ts.map +1 -0
- package/dist/src/helpers/wallet.d.ts.map +1 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/services/BundleService.d.ts +197 -0
- package/dist/src/services/BundleService.d.ts.map +1 -0
- package/dist/src/services/DexService.d.ts +84 -0
- package/dist/src/services/DexService.d.ts.map +1 -0
- package/dist/src/services/GalaChainService.d.ts +254 -0
- package/dist/src/services/GalaChainService.d.ts.map +1 -0
- package/dist/src/services/LaunchpadService.d.ts +479 -0
- package/dist/src/services/LaunchpadService.d.ts.map +1 -0
- package/dist/src/services/SignatureService.d.ts.map +1 -0
- package/dist/src/services/TokenClassKeyService.d.ts.map +1 -0
- package/dist/src/services/TokenResolverService.d.ts +154 -0
- package/dist/src/services/TokenResolverService.d.ts.map +1 -0
- package/dist/src/services/WebSocketManager.d.ts.map +1 -0
- package/dist/{api → src}/services/WebSocketService.d.ts +4 -1
- package/dist/src/services/WebSocketService.d.ts.map +1 -0
- package/dist/{types → src/types}/comment.dto.d.ts +14 -5
- package/dist/src/types/comment.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/common.d.ts +36 -1
- package/dist/src/types/common.d.ts.map +1 -0
- package/dist/{types → src/types}/dto.d.ts +19 -0
- package/dist/src/types/dto.d.ts.map +1 -0
- package/dist/{types → src/types}/launchpad.dto.d.ts +216 -30
- package/dist/src/types/launchpad.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/launchpad.validation.d.ts +8 -8
- package/dist/src/types/launchpad.validation.d.ts.map +1 -0
- package/dist/src/types/options.dto.d.ts +281 -0
- package/dist/src/types/options.dto.d.ts.map +1 -0
- package/dist/src/types/result.types.d.ts +120 -0
- package/dist/src/types/result.types.d.ts.map +1 -0
- package/dist/{types → src/types}/trade.dto.d.ts +46 -19
- package/dist/src/types/trade.dto.d.ts.map +1 -0
- package/dist/src/types/transfer.dto.d.ts +161 -0
- package/dist/src/types/transfer.dto.d.ts.map +1 -0
- package/dist/{types → src/types}/user.dto.d.ts +98 -38
- package/dist/src/types/user.dto.d.ts.map +1 -0
- package/dist/src/types/websocket.types.d.ts +82 -0
- package/dist/src/types/websocket.types.d.ts.map +1 -0
- package/dist/src/utils/Logger.d.ts +136 -0
- package/dist/src/utils/Logger.d.ts.map +1 -0
- package/dist/src/utils/SignatureHelper.d.ts +77 -0
- package/dist/src/utils/SignatureHelper.d.ts.map +1 -0
- package/dist/src/utils/adapters.d.ts.map +1 -0
- package/dist/src/utils/agent-config.d.ts.map +1 -0
- package/dist/src/utils/date-utils.d.ts +39 -0
- package/dist/src/utils/date-utils.d.ts.map +1 -0
- package/dist/src/utils/http.d.ts.map +1 -0
- package/dist/src/utils/multipart.d.ts.map +1 -0
- package/dist/src/utils/number-utils.d.ts +57 -0
- package/dist/src/utils/number-utils.d.ts.map +1 -0
- package/dist/src/utils/precision-math.d.ts.map +1 -0
- package/dist/src/utils/slippage-utils.d.ts +70 -0
- package/dist/src/utils/slippage-utils.d.ts.map +1 -0
- package/dist/src/utils/tokenNormalizer.d.ts +111 -0
- package/dist/src/utils/tokenNormalizer.d.ts.map +1 -0
- package/dist/{utils → src/utils}/validation.d.ts +4 -4
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/{utils → src/utils}/wallet.d.ts +2 -2
- package/dist/src/utils/wallet.d.ts.map +1 -0
- package/package.json +10 -13
- package/dist/LaunchpadSDK.d.ts +0 -573
- package/dist/LaunchpadSDK.d.ts.map +0 -1
- package/dist/api/CommentAPI.d.ts +0 -119
- package/dist/api/CommentAPI.d.ts.map +0 -1
- package/dist/api/LaunchpadAPI.d.ts.map +0 -1
- package/dist/api/TradeAPI.d.ts +0 -164
- package/dist/api/TradeAPI.d.ts.map +0 -1
- package/dist/api/Trading.d.ts +0 -176
- package/dist/api/Trading.d.ts.map +0 -1
- package/dist/api/UserAPI.d.ts +0 -426
- package/dist/api/UserAPI.d.ts.map +0 -1
- package/dist/api/WebSocketAPI.d.ts +0 -156
- package/dist/api/WebSocketAPI.d.ts.map +0 -1
- package/dist/api/dto/BondingCurveDTOs.d.ts.map +0 -1
- package/dist/api/services/BundleService.d.ts +0 -105
- package/dist/api/services/BundleService.d.ts.map +0 -1
- package/dist/api/services/SignatureService.d.ts.map +0 -1
- package/dist/api/services/TokenClassKeyService.d.ts.map +0 -1
- package/dist/api/services/WebSocketManager.d.ts.map +0 -1
- package/dist/api/services/WebSocketService.d.ts.map +0 -1
- package/dist/auth/SignatureAuth.d.ts.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/helpers/sdk.d.ts.map +0 -1
- package/dist/helpers/wallet.d.ts.map +0 -1
- package/dist/index.d.ts +0 -49
- package/dist/index.d.ts.map +0 -1
- package/dist/types/comment.dto.d.ts.map +0 -1
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/dto.d.ts.map +0 -1
- package/dist/types/launchpad.dto.d.ts.map +0 -1
- package/dist/types/launchpad.validation.d.ts.map +0 -1
- package/dist/types/trade.dto.d.ts.map +0 -1
- package/dist/types/user.dto.d.ts.map +0 -1
- package/dist/utils/VaultCache.d.ts +0 -73
- package/dist/utils/VaultCache.d.ts.map +0 -1
- package/dist/utils/adapters.d.ts.map +0 -1
- package/dist/utils/agent-config.d.ts.map +0 -1
- package/dist/utils/http.d.ts.map +0 -1
- package/dist/utils/multipart.d.ts.map +0 -1
- package/dist/utils/precision-math.d.ts.map +0 -1
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/wallet.d.ts.map +0 -1
- /package/dist/{auth → src/auth}/SignatureAuth.d.ts +0 -0
- /package/dist/{auth → src/auth}/types.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/wallet.d.ts +0 -0
- /package/dist/{api → src}/services/SignatureService.d.ts +0 -0
- /package/dist/{api → src}/services/TokenClassKeyService.d.ts +0 -0
- /package/dist/{api → src}/services/WebSocketManager.d.ts +0 -0
- /package/dist/{utils → src/utils}/adapters.d.ts +0 -0
- /package/dist/{utils → src/utils}/agent-config.d.ts +0 -0
- /package/dist/{utils → src/utils}/http.d.ts +0 -0
- /package/dist/{utils → src/utils}/multipart.d.ts +0 -0
- /package/dist/{utils → src/utils}/precision-math.d.ts +0 -0
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
import { Wallet } from 'ethers';
|
|
2
|
+
import { SDKConfig, AddressFormat, TokenClassKey } from './types/common';
|
|
3
|
+
import { LaunchTokenData, TokenSpotPrice, FetchPoolsOptions } from './types/launchpad.dto';
|
|
4
|
+
import { UpdateProfileData, UploadProfileImageOptions, FetchTokenBalanceOptions } from './types/user.dto';
|
|
5
|
+
import { TransferGalaData, TransferTokenData } from './types/transfer.dto';
|
|
6
|
+
import { TokenLaunchResult, TradeResult } from './types/result.types';
|
|
7
|
+
/**
|
|
8
|
+
* Error thrown when WebSocket connection or confirmation fails
|
|
9
|
+
*/
|
|
10
|
+
export declare class WebSocketError extends Error {
|
|
11
|
+
readonly cause?: Error | undefined;
|
|
12
|
+
constructor(message: string, cause?: Error | undefined);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Error thrown when WebSocket confirmation times out
|
|
16
|
+
*/
|
|
17
|
+
export declare class WebSocketTimeoutError extends WebSocketError {
|
|
18
|
+
constructor(transactionId: string, timeoutMs: number);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown when a transaction fails on-chain
|
|
22
|
+
*/
|
|
23
|
+
export declare class TransactionFailedError extends Error {
|
|
24
|
+
readonly transactionId: string;
|
|
25
|
+
readonly status: string;
|
|
26
|
+
constructor(transactionId: string, status: string, message?: string);
|
|
27
|
+
}
|
|
28
|
+
import { FetchCommentsOptions, PostCommentOptions, FetchVolumeDataOptions, FetchTradesOptions, CalculateBuyAmountOptions, CalculateSellAmountOptions, BuyTokenOptions, SellTokenOptions, UploadImageByTokenNameOptions, FetchTokensHeldOptions, FetchTokensCreatedOptions } from './types/options.dto';
|
|
29
|
+
/**
|
|
30
|
+
* Configuration for initializing the Launchpad SDK
|
|
31
|
+
*
|
|
32
|
+
* @category Configuration
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
* @agent-capability Enables SDK initialization with wallet authentication
|
|
35
|
+
* @agent-prerequisites Valid ethers.js Wallet instance with private key
|
|
36
|
+
* @agent-example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { Wallet } from 'ethers';
|
|
39
|
+
* import { LaunchpadSDK } from '@gala-chain/launchpad-sdk';
|
|
40
|
+
*
|
|
41
|
+
* const wallet = new Wallet(process.env.PRIVATE_KEY);
|
|
42
|
+
*
|
|
43
|
+
* // Environment-based configuration (recommended)
|
|
44
|
+
* const config: LaunchpadSDKConfig = {
|
|
45
|
+
* wallet,
|
|
46
|
+
* env: 'STAGE', // or 'PROD'
|
|
47
|
+
* timeout: 30000,
|
|
48
|
+
* debug: false
|
|
49
|
+
* };
|
|
50
|
+
*
|
|
51
|
+
* // With URL overrides
|
|
52
|
+
* const configWithOverrides: LaunchpadSDKConfig = {
|
|
53
|
+
* wallet,
|
|
54
|
+
* env: 'PROD',
|
|
55
|
+
* galaChainBaseUrl: 'https://custom-gateway.example.com'
|
|
56
|
+
* };
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export interface LaunchpadSDKConfig extends SDKConfig {
|
|
60
|
+
/** The ethers wallet for authentication - must be a valid ethers.js Wallet instance */
|
|
61
|
+
wallet: Wallet;
|
|
62
|
+
/** Optional GalaChain gateway URL override - defaults based on main API environment */
|
|
63
|
+
galaChainBaseUrl?: string;
|
|
64
|
+
/** Optional Bundle service URL override - defaults based on main API environment */
|
|
65
|
+
bundleBaseUrl?: string;
|
|
66
|
+
/** Optional WebSocket URL override for transaction monitoring - defaults based on main API environment */
|
|
67
|
+
webSocketUrl?: string;
|
|
68
|
+
/** Optional DEX API URL override for launchpad token balances - defaults based on main API environment */
|
|
69
|
+
dexApiBaseUrl?: string;
|
|
70
|
+
/** Optional global slippage tolerance factor (e.g., 0.05 = 5% slippage tolerance) - defaults to 0.05 */
|
|
71
|
+
slippageToleranceFactor?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Main Launchpad SDK class providing access to all Gala Launchpad functionality
|
|
75
|
+
*
|
|
76
|
+
* This is the primary entry point for interacting with the Gala Launchpad backend.
|
|
77
|
+
* It provides a clean, type-safe interface for all API operations including pool creation,
|
|
78
|
+
* token trading, and user management.
|
|
79
|
+
*
|
|
80
|
+
* Features:
|
|
81
|
+
* - Automatic signature-based authentication
|
|
82
|
+
* - Type-safe API interfaces
|
|
83
|
+
* - Built-in error handling and retry logic
|
|
84
|
+
* - Address format conversion (eth|xxx ↔ 0xxxx)
|
|
85
|
+
* - Bonding curve trading for launchpad tokens
|
|
86
|
+
* - EIP-712 signature generation for all wallet types
|
|
87
|
+
* - Bundle transaction processing
|
|
88
|
+
* - Real-time transaction monitoring via WebSocket
|
|
89
|
+
* - Comprehensive validation
|
|
90
|
+
*
|
|
91
|
+
* @category Main SDK
|
|
92
|
+
* @since 1.0.0
|
|
93
|
+
* @agent-capability Primary interface for all Gala Launchpad operations including token creation, trading, and user management
|
|
94
|
+
* @agent-prerequisites Initialized with valid LaunchpadSDKConfig containing wallet
|
|
95
|
+
* @agent-errors
|
|
96
|
+
* - WALLET_001: Invalid wallet configuration - Reinitialize with valid ethers.js Wallet
|
|
97
|
+
* - NETWORK_001: Connection timeout - Check network and retry with higher timeout
|
|
98
|
+
* - AUTH_001: Authentication failed - Verify wallet has valid private key
|
|
99
|
+
* @agent-example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* import { Wallet } from 'ethers';
|
|
102
|
+
* import { LaunchpadSDK, createWallet } from '@gala-chain/launchpad-sdk';
|
|
103
|
+
*
|
|
104
|
+
* // Generate or import wallet
|
|
105
|
+
* const wallet = createWallet(process.env.PRIVATE_KEY).wallet;
|
|
106
|
+
*
|
|
107
|
+
* // Initialize SDK
|
|
108
|
+
* const sdk = new LaunchpadSDK({
|
|
109
|
+
* wallet,
|
|
110
|
+
* debug: true
|
|
111
|
+
* });
|
|
112
|
+
*
|
|
113
|
+
* // Verify setup
|
|
114
|
+
* console.log('SDK Address:', sdk.getAddress()); // eth|{address}
|
|
115
|
+
* console.log('Ethereum Address:', sdk.getEthereumAddress()); // 0x{address}
|
|
116
|
+
*
|
|
117
|
+
* // SDK is ready for operations
|
|
118
|
+
* const balance = await sdk.user.getGalaBalance({ walletAddress: sdk.getAddress() });
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* @example Error handling pattern
|
|
122
|
+
* ```typescript
|
|
123
|
+
* try {
|
|
124
|
+
* const transactionId = await sdk.launchToken(tokenData);
|
|
125
|
+
* console.log('Token launched successfully:', transactionId);
|
|
126
|
+
* return transactionId;
|
|
127
|
+
* } catch (error) {
|
|
128
|
+
* console.error('Operation failed:', error.message);
|
|
129
|
+
* // Implement retry logic or alternative action
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export declare class LaunchpadSDK {
|
|
134
|
+
/** Default slippage tolerance factor (15%) - Higher for volatile bonding curve tokens */
|
|
135
|
+
static readonly DEFAULT_SLIPPAGE_TOLERANCE_FACTOR = 0.15;
|
|
136
|
+
private readonly auth;
|
|
137
|
+
private readonly http;
|
|
138
|
+
private readonly galaChainHttp;
|
|
139
|
+
private readonly bundleHttp;
|
|
140
|
+
private readonly dexApiHttp;
|
|
141
|
+
private readonly config;
|
|
142
|
+
private readonly slippageToleranceFactor;
|
|
143
|
+
private readonly tokenResolverService;
|
|
144
|
+
private readonly launchpadService;
|
|
145
|
+
private readonly galaChainService;
|
|
146
|
+
private readonly dexService;
|
|
147
|
+
private readonly bundleService;
|
|
148
|
+
private readonly websocketService;
|
|
149
|
+
private readonly launchpadAPI;
|
|
150
|
+
constructor(config: LaunchpadSDKConfig);
|
|
151
|
+
/**
|
|
152
|
+
* Gets the authenticated user's address in backend format
|
|
153
|
+
*
|
|
154
|
+
* Returns the wallet address formatted for backend API calls.
|
|
155
|
+
* The backend expects addresses in the format "eth|{40-hex-chars}"
|
|
156
|
+
* without the standard "0x" prefix.
|
|
157
|
+
*
|
|
158
|
+
* @category Address Management
|
|
159
|
+
* @returns The address in eth|{40-hex-chars} format required by the backend
|
|
160
|
+
* @since 1.0.0
|
|
161
|
+
*
|
|
162
|
+
* @example Get backend address format
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const sdk = new LaunchpadSDK({ wallet });
|
|
165
|
+
* const backendAddress = sdk.getAddress();
|
|
166
|
+
* console.log(backendAddress); // "eth|742d35Cc6634C0532925a3b8D0Ea2c76f94C31C0"
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @example Use in API calls
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const address = sdk.getAddress();
|
|
172
|
+
* const pools = await sdk.launchpad.fetchPools({
|
|
173
|
+
* creatorAddress: address,
|
|
174
|
+
* page: 1,
|
|
175
|
+
* limit: 10
|
|
176
|
+
* });
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @see {@link getEthereumAddress} - Get standard Ethereum address format
|
|
180
|
+
*/
|
|
181
|
+
getAddress(): AddressFormat;
|
|
182
|
+
/**
|
|
183
|
+
* Gets the authenticated user's Ethereum address in standard format
|
|
184
|
+
*
|
|
185
|
+
* Returns the wallet address in standard Ethereum format with "0x" prefix.
|
|
186
|
+
* This is the format typically used in frontend displays and external tools.
|
|
187
|
+
*
|
|
188
|
+
* @category Address Management
|
|
189
|
+
* @returns Standard Ethereum address with 0x prefix
|
|
190
|
+
* @since 1.0.0
|
|
191
|
+
*
|
|
192
|
+
* @example Display user address
|
|
193
|
+
* ```typescript
|
|
194
|
+
* const sdk = new LaunchpadSDK({ wallet });
|
|
195
|
+
* const ethAddress = sdk.getEthereumAddress();
|
|
196
|
+
* console.log(`User: ${ethAddress}`); // "User: 0x742d35Cc6634C0532925a3b8D0Ea2c76f94C31C0"
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* @example Address consistency check
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const ethAddr = sdk.getEthereumAddress();
|
|
202
|
+
* const backendAddr = sdk.getAddress();
|
|
203
|
+
*
|
|
204
|
+
* // Verify they represent the same address
|
|
205
|
+
* const ethHex = ethAddr.replace('0x', '');
|
|
206
|
+
* const backendHex = backendAddr.replace('eth|', '');
|
|
207
|
+
* console.log('Same address:', ethHex.toLowerCase() === backendHex.toLowerCase());
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* @see {@link getAddress} - Get backend-compatible address format
|
|
211
|
+
*/
|
|
212
|
+
getEthereumAddress(): string;
|
|
213
|
+
/**
|
|
214
|
+
* Gets the current SDK configuration
|
|
215
|
+
*
|
|
216
|
+
* Returns a copy of the SDK configuration with sensitive data removed.
|
|
217
|
+
* The wallet instance is excluded for security reasons.
|
|
218
|
+
*
|
|
219
|
+
* @category Configuration
|
|
220
|
+
* @returns SDK configuration object without the wallet property
|
|
221
|
+
* @since 1.0.0
|
|
222
|
+
*
|
|
223
|
+
* @example Inspect SDK configuration
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const sdk = new LaunchpadSDK({
|
|
226
|
+
* wallet,
|
|
227
|
+
* baseUrl: 'https://api.example.com',
|
|
228
|
+
* timeout: 45000,
|
|
229
|
+
* debug: true
|
|
230
|
+
* });
|
|
231
|
+
*
|
|
232
|
+
* const config = sdk.getConfig();
|
|
233
|
+
* console.log('Base URL:', config.baseUrl);
|
|
234
|
+
* console.log('Timeout:', config.timeout);
|
|
235
|
+
* console.log('Debug mode:', config.debug);
|
|
236
|
+
* // wallet property is not included for security
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* @example Configuration validation
|
|
240
|
+
* ```typescript
|
|
241
|
+
* const config = sdk.getConfig();
|
|
242
|
+
* if (config.debug) {
|
|
243
|
+
* console.log('Debug mode is enabled - detailed logging active');
|
|
244
|
+
* }
|
|
245
|
+
* if (config.timeout < 30000) {
|
|
246
|
+
* console.warn('Timeout is quite low, consider increasing for stability');
|
|
247
|
+
* }
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
getConfig(): Omit<LaunchpadSDKConfig, 'wallet'>;
|
|
251
|
+
/**
|
|
252
|
+
* Fetch pools with optional filters
|
|
253
|
+
*
|
|
254
|
+
* @param options Optional filters for pool fetching
|
|
255
|
+
* @returns Promise<PoolsResult>
|
|
256
|
+
*/
|
|
257
|
+
fetchPools(options?: FetchPoolsOptions): Promise<import("./types/launchpad.dto").PoolsResult>;
|
|
258
|
+
/**
|
|
259
|
+
* Fetch token distribution information
|
|
260
|
+
*
|
|
261
|
+
* @param tokenName Token name to fetch distribution for
|
|
262
|
+
* @returns Promise<TokenDistributionResult>
|
|
263
|
+
*/
|
|
264
|
+
fetchTokenDistribution(tokenName: string): Promise<import("./types/launchpad.dto").TokenDistributionResult>;
|
|
265
|
+
/**
|
|
266
|
+
* Fetch token badges
|
|
267
|
+
*
|
|
268
|
+
* @param tokenName Token name to fetch badges for
|
|
269
|
+
* @returns Promise<TokenBadgesResult>
|
|
270
|
+
*/
|
|
271
|
+
fetchTokenBadges(tokenName: string): Promise<import("./types/launchpad.dto").TokenBadgesResult>;
|
|
272
|
+
/**
|
|
273
|
+
* Fetch current USD spot prices for one or more DEX token symbols
|
|
274
|
+
*
|
|
275
|
+
* Uses the DEX API to retrieve current pricing information for tokens.
|
|
276
|
+
* Returns simplified spot price format with symbol and price only.
|
|
277
|
+
*
|
|
278
|
+
* @param symbols Single symbol string or array of symbols (e.g., 'GALA', ['GALA', 'SILK'])
|
|
279
|
+
* @returns Promise<TokenSpotPrice[]> Array of simplified token spot prices
|
|
280
|
+
*
|
|
281
|
+
* @example Single token price
|
|
282
|
+
* ```typescript
|
|
283
|
+
* const prices = await sdk.fetchTokenSpotPrice('GALA');
|
|
284
|
+
* console.log(`${prices[0].symbol}: $${prices[0].price}`); // GALA: $0.01463269
|
|
285
|
+
* ```
|
|
286
|
+
*
|
|
287
|
+
* @example Multiple token prices
|
|
288
|
+
* ```typescript
|
|
289
|
+
* const prices = await sdk.fetchTokenSpotPrice(['GALA', 'SILK', 'MUSIC']);
|
|
290
|
+
* prices.forEach(price => {
|
|
291
|
+
* console.log(`${price.symbol}: $${price.price.toFixed(6)}`);
|
|
292
|
+
* });
|
|
293
|
+
* ```
|
|
294
|
+
*
|
|
295
|
+
* @throws Error if DEX API client not configured
|
|
296
|
+
* @throws Error if no valid symbols provided
|
|
297
|
+
* @throws Error if API request fails
|
|
298
|
+
*/
|
|
299
|
+
fetchTokenSpotPrice(symbols: string | string[]): Promise<TokenSpotPrice[]>;
|
|
300
|
+
/**
|
|
301
|
+
* Fetch current GALA token USD spot price
|
|
302
|
+
*
|
|
303
|
+
* Convenience method for fetching GALA price specifically.
|
|
304
|
+
* Returns the TokenSpotPrice object directly, not wrapped in an array.
|
|
305
|
+
*
|
|
306
|
+
* @returns Promise<TokenSpotPrice> GALA spot price data
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```typescript
|
|
310
|
+
* const galaPrice = await sdk.fetchGalaSpotPrice();
|
|
311
|
+
* console.log(`GALA: $${galaPrice.price.toFixed(6)}`);
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* @throws Error if GALA price not available
|
|
315
|
+
* @throws Error if DEX API client not configured
|
|
316
|
+
*/
|
|
317
|
+
fetchGalaSpotPrice(): Promise<TokenSpotPrice>;
|
|
318
|
+
/**
|
|
319
|
+
* Calculate spot price for a launchpad token in USD
|
|
320
|
+
*
|
|
321
|
+
* Calculates the USD price of a launchpad token by determining how many tokens
|
|
322
|
+
* you get for 1 GALA and converting based on current GALA USD price.
|
|
323
|
+
*
|
|
324
|
+
* @param tokenName Token name (e.g., 'dragnrkti', 'rocketri', 'unicornri')
|
|
325
|
+
* @returns Promise<TokenSpotPrice> Spot price with symbol and USD price
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```typescript
|
|
329
|
+
* const price = await sdk.fetchLaunchpadTokenSpotPrice('dragnrkti');
|
|
330
|
+
* console.log(`${price.symbol}: $${price.price.toFixed(6)}`);
|
|
331
|
+
* // Output: DRAGNRKTI: $0.000123
|
|
332
|
+
* ```
|
|
333
|
+
*
|
|
334
|
+
* @throws Error if token not found
|
|
335
|
+
* @throws Error if price calculation fails
|
|
336
|
+
* @throws Error if GALA price unavailable
|
|
337
|
+
*/
|
|
338
|
+
fetchLaunchpadTokenSpotPrice(tokenName: string): Promise<TokenSpotPrice>;
|
|
339
|
+
/**
|
|
340
|
+
* Fetch pool details for a token - returns complete bonding curve pool state
|
|
341
|
+
*
|
|
342
|
+
* @param tokenName Token name to fetch pool details for
|
|
343
|
+
* @returns Promise<PoolDetailsData>
|
|
344
|
+
*/
|
|
345
|
+
fetchPoolDetails(tokenName: string): Promise<import("./types/trade.dto").InternalFetchPoolDetailsResponse>;
|
|
346
|
+
/**
|
|
347
|
+
* Fetch volume data for a token
|
|
348
|
+
*
|
|
349
|
+
* @param options Volume data options with required tokenName
|
|
350
|
+
* @returns Promise<GraphDataResult>
|
|
351
|
+
*/
|
|
352
|
+
fetchVolumeData(options: FetchVolumeDataOptions): Promise<import("./types/launchpad.dto").GraphDataResult>;
|
|
353
|
+
/**
|
|
354
|
+
* Fetch trade history with filters
|
|
355
|
+
*
|
|
356
|
+
* @param options Trade fetching options with required tokenName
|
|
357
|
+
* @returns Promise<TradesResult>
|
|
358
|
+
*/
|
|
359
|
+
fetchTrades(options: FetchTradesOptions): Promise<import("./types/trade.dto").TradesResult>;
|
|
360
|
+
/**
|
|
361
|
+
* Fetch GALA balance for a user
|
|
362
|
+
*
|
|
363
|
+
* @param walletAddress Optional wallet address, defaults to current user
|
|
364
|
+
* @returns Promise<GalaBalanceResult>
|
|
365
|
+
*/
|
|
366
|
+
fetchGalaBalance(walletAddress?: string): Promise<import("./types/user.dto").TokenBalanceResult | null>;
|
|
367
|
+
/**
|
|
368
|
+
* Fetch token balance from GalaChain (published tokens) or DEX API (launchpad tokens)
|
|
369
|
+
*
|
|
370
|
+
* This method queries either the GalaChain gateway directly for published tokens
|
|
371
|
+
* or the DEX API for launchpad tokens, providing reliable results.
|
|
372
|
+
*
|
|
373
|
+
* @param options Token balance options with flexible token identification
|
|
374
|
+
* @returns Promise<TokenBalanceResult | null>
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* // Using string format
|
|
379
|
+
* const galaBalance = await sdk.fetchTokenBalance({
|
|
380
|
+
* address: sdk.getAddress(),
|
|
381
|
+
* tokenId: "GALA|Unit|none|none"
|
|
382
|
+
* });
|
|
383
|
+
*
|
|
384
|
+
* // Using TokenClassKey object
|
|
385
|
+
* const tokenClass = await sdk.resolveTokenClassKey('unicorn');
|
|
386
|
+
* const unicornBalance = await sdk.fetchTokenBalance({
|
|
387
|
+
* address: sdk.getAddress(),
|
|
388
|
+
* tokenClassKey: tokenClass
|
|
389
|
+
* });
|
|
390
|
+
*
|
|
391
|
+
* // Using TokenInstanceKey object
|
|
392
|
+
* const unicornBalance2 = await sdk.fetchTokenBalance({
|
|
393
|
+
* address: sdk.getAddress(),
|
|
394
|
+
* tokenId: {
|
|
395
|
+
* collection: "Token",
|
|
396
|
+
* category: "Unit",
|
|
397
|
+
* type: "UNI",
|
|
398
|
+
* additionalKey: "eth:9401b171307bE656f00F9e18DF756643FD3a91dE",
|
|
399
|
+
* instance: "0"
|
|
400
|
+
* }
|
|
401
|
+
* });
|
|
402
|
+
*
|
|
403
|
+
* // Using token name for convenience
|
|
404
|
+
* const unicornBalance3 = await sdk.fetchTokenBalance({
|
|
405
|
+
* address: sdk.getAddress(),
|
|
406
|
+
* tokenName: "unicorn"
|
|
407
|
+
* });
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
fetchTokenBalance(options: FetchTokenBalanceOptions): Promise<import("./types/user.dto").TokenBalanceResult | null>;
|
|
411
|
+
/**
|
|
412
|
+
* Fetch comments for a token
|
|
413
|
+
*
|
|
414
|
+
* @param options Comment fetching options with required tokenName
|
|
415
|
+
* @returns Promise<CommentsResult>
|
|
416
|
+
*/
|
|
417
|
+
fetchComments(options: FetchCommentsOptions): Promise<import(".").CommentsResult>;
|
|
418
|
+
/**
|
|
419
|
+
* Calculate buy amount for a token purchase
|
|
420
|
+
*
|
|
421
|
+
* @param options Calculation options with required tokenName
|
|
422
|
+
* @returns Promise<AmountCalculationResult>
|
|
423
|
+
*/
|
|
424
|
+
calculateBuyAmount(options: CalculateBuyAmountOptions): Promise<import("./types/launchpad.dto").AmountCalculationResult>;
|
|
425
|
+
/**
|
|
426
|
+
* Calculate sell amount for a token sale
|
|
427
|
+
*
|
|
428
|
+
* @param options Calculation options with required tokenName
|
|
429
|
+
* @returns Promise<AmountCalculationResult>
|
|
430
|
+
*/
|
|
431
|
+
calculateSellAmount(options: CalculateSellAmountOptions): Promise<import("./types/launchpad.dto").AmountCalculationResult>;
|
|
432
|
+
/**
|
|
433
|
+
* Calculate initial buy amount (pre-mint phase)
|
|
434
|
+
*
|
|
435
|
+
* @param nativeTokenQuantity Amount of native token (GALA) to spend
|
|
436
|
+
* @returns Promise<PreMintCalculationResult>
|
|
437
|
+
*/
|
|
438
|
+
calculateInitialBuyAmount(nativeTokenQuantity: string): Promise<import("./types/launchpad.dto").AmountCalculationResult>;
|
|
439
|
+
/**
|
|
440
|
+
* Buy tokens with confirmation
|
|
441
|
+
*
|
|
442
|
+
* Executes a buy order and waits for blockchain confirmation, returning
|
|
443
|
+
* complete trade details including actual amounts traded and fees paid.
|
|
444
|
+
*
|
|
445
|
+
* @param options Buy options with required tokenName and expectedAmount
|
|
446
|
+
* @returns Promise<TradeResult> Complete trade result with amounts and fees
|
|
447
|
+
* @since 3.0.0 - Now returns TradeResult instead of basic response
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```typescript
|
|
451
|
+
* const result = await sdk.buy({
|
|
452
|
+
* tokenName: 'mytoken',
|
|
453
|
+
* amount: '100',
|
|
454
|
+
* type: 'native',
|
|
455
|
+
* expectedAmount: '1000',
|
|
456
|
+
* slippageToleranceFactor: 0.05
|
|
457
|
+
* });
|
|
458
|
+
*
|
|
459
|
+
* console.log('Bought tokens:', result.outputAmount);
|
|
460
|
+
* console.log('Spent GALA:', result.inputAmount);
|
|
461
|
+
* console.log('Fees paid:', result.totalFees);
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
buy(options: BuyTokenOptions): Promise<TradeResult>;
|
|
465
|
+
/**
|
|
466
|
+
* Sell tokens with confirmation
|
|
467
|
+
*
|
|
468
|
+
* Executes a sell order and waits for blockchain confirmation, returning
|
|
469
|
+
* complete trade details including actual amounts traded and fees paid.
|
|
470
|
+
*
|
|
471
|
+
* @param options Sell options with required tokenName and expectedAmount
|
|
472
|
+
* @returns Promise<TradeResult> Complete trade result with amounts and fees
|
|
473
|
+
* @since 3.0.0 - Now returns TradeResult instead of basic response
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* const result = await sdk.sell({
|
|
478
|
+
* tokenName: 'mytoken',
|
|
479
|
+
* amount: '500',
|
|
480
|
+
* type: 'exact',
|
|
481
|
+
* expectedAmount: '50',
|
|
482
|
+
* slippageToleranceFactor: 0.05
|
|
483
|
+
* });
|
|
484
|
+
*
|
|
485
|
+
* console.log('Sold tokens:', result.inputAmount);
|
|
486
|
+
* console.log('Received GALA:', result.outputAmount);
|
|
487
|
+
* console.log('Fees paid:', result.totalFees);
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
sell(options: SellTokenOptions): Promise<TradeResult>;
|
|
491
|
+
/**
|
|
492
|
+
* Post a comment on a token
|
|
493
|
+
*
|
|
494
|
+
* @param options Comment options with required tokenName and content
|
|
495
|
+
* @returns Promise<void>
|
|
496
|
+
*/
|
|
497
|
+
postComment(options: PostCommentOptions): Promise<void>;
|
|
498
|
+
/**
|
|
499
|
+
* Launch a new token
|
|
500
|
+
*
|
|
501
|
+
* Creates a new token with bonding curve and returns complete launch details
|
|
502
|
+
* after blockchain confirmation. This method now blocks until the transaction
|
|
503
|
+
* is confirmed, providing rich data about the created token.
|
|
504
|
+
*
|
|
505
|
+
* @param data Token launch data
|
|
506
|
+
* @returns Promise<TokenLaunchResult> Complete token launch result with vault address and metadata
|
|
507
|
+
* @since 3.0.0 - Now returns TokenLaunchResult instead of transaction ID
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* ```typescript
|
|
511
|
+
* const result = await sdk.launchToken({
|
|
512
|
+
* tokenName: 'mytoken',
|
|
513
|
+
* tokenSymbol: 'MTK',
|
|
514
|
+
* tokenDescription: 'My amazing token',
|
|
515
|
+
* tokenImage: 'https://example.com/image.png',
|
|
516
|
+
* preBuyQuantity: '100'
|
|
517
|
+
* });
|
|
518
|
+
*
|
|
519
|
+
* console.log('Token created:', result.tokenName);
|
|
520
|
+
* console.log('Vault address:', result.vaultAddress);
|
|
521
|
+
* console.log('Creator:', result.creatorAddress);
|
|
522
|
+
* console.log('Transaction:', result.transactionId);
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
launchToken(data: LaunchTokenData): Promise<TokenLaunchResult>;
|
|
526
|
+
/**
|
|
527
|
+
* Upload an image for a token
|
|
528
|
+
*
|
|
529
|
+
* @param options Upload options with required tokenName
|
|
530
|
+
* @returns Promise<string>
|
|
531
|
+
*/
|
|
532
|
+
uploadTokenImage(options: UploadImageByTokenNameOptions): Promise<string>;
|
|
533
|
+
/**
|
|
534
|
+
* Check if token name is available
|
|
535
|
+
*
|
|
536
|
+
* @param tokenName Token name to check
|
|
537
|
+
* @returns Promise<boolean>
|
|
538
|
+
*/
|
|
539
|
+
isTokenNameAvailable(tokenName: string): Promise<boolean>;
|
|
540
|
+
/**
|
|
541
|
+
* Check if token symbol is available
|
|
542
|
+
*
|
|
543
|
+
* @param symbol Token symbol to check
|
|
544
|
+
* @returns Promise<boolean>
|
|
545
|
+
*/
|
|
546
|
+
isTokenSymbolAvailable(symbol: string): Promise<boolean>;
|
|
547
|
+
/**
|
|
548
|
+
* Get user profile information
|
|
549
|
+
*
|
|
550
|
+
* @param walletAddress Optional wallet address (defaults to SDK wallet address)
|
|
551
|
+
* @returns Promise<any> User profile information
|
|
552
|
+
*/
|
|
553
|
+
fetchProfile(walletAddress?: string): Promise<any>;
|
|
554
|
+
/**
|
|
555
|
+
* Update user profile information
|
|
556
|
+
*
|
|
557
|
+
* @param data Profile update data
|
|
558
|
+
* @returns Promise<UserProfile> Update result
|
|
559
|
+
*/
|
|
560
|
+
updateProfile(data: UpdateProfileData): Promise<void>;
|
|
561
|
+
/**
|
|
562
|
+
* Upload a profile image
|
|
563
|
+
*
|
|
564
|
+
* @param options Profile image upload options
|
|
565
|
+
* @returns Promise<string> Upload result with image URL
|
|
566
|
+
*/
|
|
567
|
+
uploadProfileImage(options: UploadProfileImageOptions): Promise<string>;
|
|
568
|
+
/**
|
|
569
|
+
* Retrieve GALA from faucet to user wallet
|
|
570
|
+
* Backend provides a fixed amount (5 GALA) - amount parameter is not used
|
|
571
|
+
*
|
|
572
|
+
* @param walletAddress Optional wallet address override (defaults to SDK's authenticated wallet)
|
|
573
|
+
* @returns Promise<void> Faucet retrieval result
|
|
574
|
+
*/
|
|
575
|
+
retrieveGalaFromFaucet(walletAddress?: string): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* Fetch tokens held by user
|
|
578
|
+
*
|
|
579
|
+
* @param options Token list options
|
|
580
|
+
* @returns Promise<UserTokenListResult> User's token holdings
|
|
581
|
+
*/
|
|
582
|
+
fetchTokensHeld(options?: FetchTokensHeldOptions): Promise<import("./types/user.dto").UserTokenListResult>;
|
|
583
|
+
/**
|
|
584
|
+
* Fetch tokens created by the current user
|
|
585
|
+
*
|
|
586
|
+
* @param options Token list options
|
|
587
|
+
* @returns Promise<UserTokenListResult> User's created tokens
|
|
588
|
+
*/
|
|
589
|
+
fetchTokensCreated(options?: FetchTokensCreatedOptions): Promise<import("./types/user.dto").UserTokenListResult>;
|
|
590
|
+
/**
|
|
591
|
+
* Transfer GALA tokens between wallets
|
|
592
|
+
*
|
|
593
|
+
* Transfers GALA tokens from the authenticated wallet to another wallet
|
|
594
|
+
* using GalaChain with EIP-712 signature authentication.
|
|
595
|
+
*
|
|
596
|
+
* @param data Transfer data including recipient address and amount
|
|
597
|
+
* @returns Promise<string> Transaction ID from successful transfer
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* ```typescript
|
|
601
|
+
* // Transfer 1 GALA to another wallet
|
|
602
|
+
* const transactionId = await sdk.transferGala({
|
|
603
|
+
* recipientAddress: 'eth|1234567890abcdef1234567890abcdef12345678',
|
|
604
|
+
* amount: '1' // 1 GALA in decimal format
|
|
605
|
+
* });
|
|
606
|
+
*
|
|
607
|
+
* console.log('GALA transfer successful!');
|
|
608
|
+
* console.log('Transaction ID:', transactionId);
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
transferGala(data: TransferGalaData): Promise<string>;
|
|
612
|
+
/**
|
|
613
|
+
* Transfer launchpad tokens between wallets
|
|
614
|
+
*
|
|
615
|
+
* Transfers launchpad tokens from the authenticated wallet to another wallet
|
|
616
|
+
* using GalaChain with EIP-712 signature authentication.
|
|
617
|
+
*
|
|
618
|
+
* @param data Transfer data including recipient address, token name, and amount
|
|
619
|
+
* @returns Promise<string> Transaction ID from successful transfer
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```typescript
|
|
623
|
+
* // Transfer 100 TINYEVIL tokens to another wallet
|
|
624
|
+
* const transactionId = await sdk.transferToken({
|
|
625
|
+
* to: 'eth|9876543210fedcba9876543210fedcba98765432',
|
|
626
|
+
* tokenName: 'tinyevil',
|
|
627
|
+
* amount: '100' // Amount in decimal format
|
|
628
|
+
* });
|
|
629
|
+
*
|
|
630
|
+
* console.log('Token transfer successful!');
|
|
631
|
+
* console.log('Transaction ID:', transactionId);
|
|
632
|
+
* ```
|
|
633
|
+
*/
|
|
634
|
+
transferToken(data: TransferTokenData): Promise<string>;
|
|
635
|
+
/**
|
|
636
|
+
* Resolve token class key from token name
|
|
637
|
+
*
|
|
638
|
+
* Public method to resolve a token name to its TokenClassKey object for caching or optimization patterns.
|
|
639
|
+
* Uses the same resolution logic as transferToken internally.
|
|
640
|
+
*
|
|
641
|
+
* @param tokenName Token name to resolve (e.g., 'unicorn', 'tinyevil')
|
|
642
|
+
* @returns Promise<TokenClassKey> The resolved token class key object
|
|
643
|
+
*
|
|
644
|
+
* @example
|
|
645
|
+
* ```typescript
|
|
646
|
+
* const tokenClassKey = await sdk.resolveTokenClassKey('unicorn');
|
|
647
|
+
* // Returns: {
|
|
648
|
+
* // collection: "Token",
|
|
649
|
+
* // category: "Unit",
|
|
650
|
+
* // type: "UNI",
|
|
651
|
+
* // additionalKey: "eth:9401b171307bE656f00F9e18DF756643FD3a91dE"
|
|
652
|
+
* // }
|
|
653
|
+
*
|
|
654
|
+
* // Can be cached and used later for direct operations
|
|
655
|
+
* await sdk.transferToken({
|
|
656
|
+
* to: 'eth|...',
|
|
657
|
+
* tokenId: tokenClassKey, // Direct, no lookup
|
|
658
|
+
* amount: '1'
|
|
659
|
+
* });
|
|
660
|
+
*
|
|
661
|
+
* await sdk.fetchTokenBalance({
|
|
662
|
+
* address: sdk.getAddress(),
|
|
663
|
+
* tokenClassKey: tokenClassKey // Same object format
|
|
664
|
+
* });
|
|
665
|
+
* ```
|
|
666
|
+
*
|
|
667
|
+
* @throws {TransferError} When token name cannot be resolved
|
|
668
|
+
*/
|
|
669
|
+
resolveTokenClassKey(tokenName: string): Promise<TokenClassKey>;
|
|
670
|
+
/**
|
|
671
|
+
* Resolve vault address for a token name
|
|
672
|
+
*
|
|
673
|
+
* @param tokenName Token name to resolve
|
|
674
|
+
* @returns Promise<string | null> Vault address or null if not found
|
|
675
|
+
*/
|
|
676
|
+
resolveVaultAddress(tokenName: string): Promise<string | null>;
|
|
677
|
+
/**
|
|
678
|
+
* Validates configuration parameters for safety and correctness
|
|
679
|
+
* @private
|
|
680
|
+
*/
|
|
681
|
+
private validateConfiguration;
|
|
682
|
+
/**
|
|
683
|
+
* Safely parses slippage tolerance factor with validation
|
|
684
|
+
* @private
|
|
685
|
+
*/
|
|
686
|
+
private parseSlippageToleranceFactor;
|
|
687
|
+
/**
|
|
688
|
+
* Ensures WebSocket connection is established
|
|
689
|
+
* @private
|
|
690
|
+
*/
|
|
691
|
+
private ensureWebSocketConnection;
|
|
692
|
+
/**
|
|
693
|
+
* Internal helper to wait for WebSocket confirmation and transform the result
|
|
694
|
+
* @private
|
|
695
|
+
*/
|
|
696
|
+
private waitForConfirmation;
|
|
697
|
+
/**
|
|
698
|
+
* Cleanup SDK resources and connections
|
|
699
|
+
*
|
|
700
|
+
* Releases WebSocket references and performs cleanup of SDK resources.
|
|
701
|
+
* Should be called when the SDK instance is no longer needed to prevent
|
|
702
|
+
* memory leaks and ensure proper resource management.
|
|
703
|
+
*
|
|
704
|
+
* @category Resource Management
|
|
705
|
+
* @since 2.1.0
|
|
706
|
+
*
|
|
707
|
+
* @example Basic cleanup
|
|
708
|
+
* ```typescript
|
|
709
|
+
* const sdk = new LaunchpadSDK({ wallet });
|
|
710
|
+
*
|
|
711
|
+
* // Use SDK for operations...
|
|
712
|
+
* await sdk.launchToken({...});
|
|
713
|
+
*
|
|
714
|
+
* // Cleanup when done
|
|
715
|
+
* await sdk.cleanup();
|
|
716
|
+
* ```
|
|
717
|
+
*
|
|
718
|
+
* @example Cleanup in application shutdown
|
|
719
|
+
* ```typescript
|
|
720
|
+
* process.on('SIGINT', async () => {
|
|
721
|
+
* console.log('Shutting down...');
|
|
722
|
+
* await sdk.cleanup();
|
|
723
|
+
* process.exit(0);
|
|
724
|
+
* });
|
|
725
|
+
* ```
|
|
726
|
+
*/
|
|
727
|
+
cleanup(): Promise<void>;
|
|
728
|
+
/**
|
|
729
|
+
* Cleanup all SDK instances and shared resources
|
|
730
|
+
*
|
|
731
|
+
* Forces cleanup of all shared WebSocket connections and resources
|
|
732
|
+
* across all SDK instances. Use this for application-wide cleanup
|
|
733
|
+
* or testing teardown.
|
|
734
|
+
*
|
|
735
|
+
* @category Resource Management
|
|
736
|
+
* @param debug Enable debug logging
|
|
737
|
+
* @since 2.1.0
|
|
738
|
+
*
|
|
739
|
+
* @example Application shutdown
|
|
740
|
+
* ```typescript
|
|
741
|
+
* // Cleanup all SDK instances and shared resources
|
|
742
|
+
* LaunchpadSDK.cleanupAll(true);
|
|
743
|
+
* ```
|
|
744
|
+
*
|
|
745
|
+
* @example Test cleanup
|
|
746
|
+
* ```typescript
|
|
747
|
+
* afterEach(() => {
|
|
748
|
+
* // Ensure clean state between tests
|
|
749
|
+
* LaunchpadSDK.cleanupAll();
|
|
750
|
+
* });
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
static cleanupAll(debug?: boolean): void;
|
|
754
|
+
}
|
|
755
|
+
//# sourceMappingURL=LaunchpadSDK.d.ts.map
|