@gala-chain/launchpad-sdk 3.5.2 → 3.6.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/CHANGELOG.md +70 -0
- package/README.md +23 -1
- package/dist/constants/endpoints.d.ts +38 -0
- package/dist/constants/endpoints.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas/files.d.ts +63 -0
- package/dist/schemas/files.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +82 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/launchpad.d.ts +188 -0
- package/dist/schemas/launchpad.d.ts.map +1 -0
- package/dist/schemas/pagination.d.ts +208 -0
- package/dist/schemas/pagination.d.ts.map +1 -0
- package/dist/schemas/primitives.d.ts +144 -0
- package/dist/schemas/primitives.d.ts.map +1 -0
- package/dist/schemas/trade.d.ts +192 -0
- package/dist/schemas/trade.d.ts.map +1 -0
- package/dist/schemas/user.d.ts +251 -0
- package/dist/schemas/user.d.ts.map +1 -0
- package/dist/schemas/validators.d.ts +243 -0
- package/dist/schemas/validators.d.ts.map +1 -0
- package/dist/services/CommentService.d.ts +71 -0
- package/dist/services/CommentService.d.ts.map +1 -0
- package/dist/services/FaucetService.d.ts +55 -0
- package/dist/services/FaucetService.d.ts.map +1 -0
- package/dist/services/ImageService.d.ts +81 -0
- package/dist/services/ImageService.d.ts.map +1 -0
- package/dist/services/LaunchpadService.d.ts +57 -298
- package/dist/services/LaunchpadService.d.ts.map +1 -1
- package/dist/services/PoolService.d.ts +114 -0
- package/dist/services/PoolService.d.ts.map +1 -0
- package/dist/services/TradeService.d.ts +55 -0
- package/dist/services/TradeService.d.ts.map +1 -0
- package/dist/services/UserService.d.ts +121 -0
- package/dist/services/UserService.d.ts.map +1 -0
- package/dist/types/launchpad.validation.d.ts +9 -6
- package/dist/types/launchpad.validation.d.ts.map +1 -1
- package/dist/utils/multipart.d.ts +4 -1
- package/dist/utils/multipart.d.ts.map +1 -1
- package/dist/utils/query-params.d.ts +98 -0
- package/dist/utils/query-params.d.ts.map +1 -0
- package/dist/utils/response-normalizers.d.ts +133 -0
- package/dist/utils/response-normalizers.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +13 -10
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -1,121 +1,75 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Launchpad Service
|
|
2
|
+
* Launchpad Service (Facade)
|
|
3
3
|
*
|
|
4
|
-
* This service
|
|
5
|
-
* It
|
|
6
|
-
* - Image upload operations
|
|
7
|
-
* - Token launch/creation
|
|
8
|
-
* - Pool queries and data fetching
|
|
9
|
-
* - Calculation methods
|
|
10
|
-
* - Trade history
|
|
11
|
-
* - Comment operations
|
|
12
|
-
* - User profile management
|
|
13
|
-
* - User token list operations
|
|
14
|
-
* - Faucet transfers
|
|
4
|
+
* This service provides a unified interface for all launchpad-backend operations.
|
|
5
|
+
* It delegates to specialized service classes while maintaining backward compatibility.
|
|
15
6
|
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import { TradesResult } from '../types/trade.dto';
|
|
24
|
-
import { FetchTradesOptions } from '../types/options.dto';
|
|
25
|
-
import { GetTokenListOptions, UserTokenListResult, TransferFaucetsData, UpdateProfileData, UploadProfileImageOptions } from '../types/user.dto';
|
|
26
|
-
/**
|
|
27
|
-
* Launchpad Service
|
|
28
|
-
*
|
|
29
|
-
* Consolidated service for all launchpad-backend operations including:
|
|
30
|
-
* - Image uploads for token branding
|
|
31
|
-
* - Pool queries and data fetching
|
|
32
|
-
* - Token distribution and badge retrieval
|
|
33
|
-
* - Comment operations
|
|
34
|
-
* - Trade history
|
|
35
|
-
* - User profile management
|
|
36
|
-
* - User token lists
|
|
37
|
-
* - Faucet transfers
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - PoolService: Pool queries, distribution, badges, volume data
|
|
9
|
+
* - TradeService: Trade history and queries
|
|
10
|
+
* - CommentService: Comments with vault resolution
|
|
11
|
+
* - UserService: Profile management and token lists
|
|
12
|
+
* - ImageService: Image uploads for tokens
|
|
13
|
+
* - FaucetService: Faucet transfers
|
|
38
14
|
*
|
|
39
15
|
* @category Services
|
|
40
16
|
* @since 2.0.0
|
|
17
|
+
* @refactored 3.6.0 - Decomposed into specialized services
|
|
41
18
|
*
|
|
42
19
|
* @example Basic usage
|
|
43
20
|
* ```typescript
|
|
44
21
|
* const service = new LaunchpadService(httpClient);
|
|
45
22
|
*
|
|
46
|
-
* // Upload token image
|
|
23
|
+
* // Upload token image (delegates to ImageService)
|
|
47
24
|
* const imageUrl = await service.uploadImageByTokenName({
|
|
48
25
|
* tokenName: 'mytoken',
|
|
49
26
|
* options: { file: imageFile, tokenName: 'mytoken' }
|
|
50
27
|
* });
|
|
51
28
|
*
|
|
52
|
-
* // Fetch pools
|
|
29
|
+
* // Fetch pools (delegates to PoolService)
|
|
53
30
|
* const pools = await service.fetchPools({ type: 'recent', page: 1, limit: 10 });
|
|
54
31
|
*
|
|
55
|
-
* // Get comments
|
|
32
|
+
* // Get comments (delegates to CommentService)
|
|
56
33
|
* const comments = await service.fetchComments({ tokenName: 'mytoken' });
|
|
57
34
|
* ```
|
|
58
35
|
*/
|
|
36
|
+
import { HttpClient } from '../utils/http';
|
|
37
|
+
import { CheckPoolOptions, PoolsResult, GraphDataResult, TokenDistributionResult, TokenBadgesResult } from '../types/launchpad.dto';
|
|
38
|
+
import { UploadImageByTokenNameOptions, FetchVolumeDataOptions, HasTokenBadgeOptions, FetchCommentsOptions, PostCommentOptions, FetchTradesOptions } from '../types/options.dto';
|
|
39
|
+
import { CommentsResult } from '../types/comment.dto';
|
|
40
|
+
import { TradesResult } from '../types/trade.dto';
|
|
41
|
+
import { GetTokenListOptions, UserTokenListResult, TransferFaucetsData, UpdateProfileData, UploadProfileImageOptions } from '../types/user.dto';
|
|
42
|
+
/**
|
|
43
|
+
* Launchpad Service (Facade Pattern)
|
|
44
|
+
*
|
|
45
|
+
* Consolidated facade for all launchpad-backend operations.
|
|
46
|
+
* Delegates to specialized services while maintaining backward compatibility.
|
|
47
|
+
*
|
|
48
|
+
* All public methods from v2.x remain unchanged for backward compatibility.
|
|
49
|
+
*/
|
|
59
50
|
export declare class LaunchpadService {
|
|
60
51
|
private readonly http;
|
|
52
|
+
private readonly poolService;
|
|
53
|
+
private readonly tradeService;
|
|
54
|
+
private readonly commentService;
|
|
55
|
+
private readonly userService;
|
|
56
|
+
private readonly imageService;
|
|
57
|
+
private readonly faucetService;
|
|
61
58
|
constructor(http: HttpClient);
|
|
62
59
|
/**
|
|
63
60
|
* Uploads an image for a token pool
|
|
64
61
|
*
|
|
65
|
-
* Uploads a token image that will be used for branding and display purposes.
|
|
66
|
-
* Supports both browser File objects and Node.js Buffer objects for maximum
|
|
67
|
-
* compatibility across environments.
|
|
68
|
-
*
|
|
69
|
-
* File Requirements:
|
|
70
|
-
* - Format: PNG, JPG, JPEG, WebP
|
|
71
|
-
* - Size: Maximum 5MB
|
|
72
|
-
* - Dimensions: Recommended 512x512px or higher
|
|
73
|
-
* - Aspect ratio: Square (1:1) recommended
|
|
74
|
-
*
|
|
75
|
-
* @category File Operations
|
|
76
62
|
* @param options Upload configuration object
|
|
77
|
-
* @param options.file Image file as File object (browser) or Buffer (Node.js)
|
|
78
|
-
* @param options.tokenName Token name for the image (must be valid token name format)
|
|
79
63
|
* @returns Promise that resolves to image URL string
|
|
80
|
-
* @throws {ValidationError} If token name format is invalid
|
|
81
|
-
* @throws {FileValidationError} If file doesn't meet requirements
|
|
82
|
-
* @throws {Error} If upload fails due to network or server issues
|
|
83
64
|
* @since 2.0.0
|
|
84
|
-
*
|
|
85
|
-
* @example Browser file upload
|
|
86
|
-
* ```typescript
|
|
87
|
-
* const fileInput = document.querySelector('#image-upload') as HTMLInputElement;
|
|
88
|
-
* const file = fileInput.files?.[0];
|
|
89
|
-
*
|
|
90
|
-
* if (file) {
|
|
91
|
-
* const imageUrl = await service.uploadImageByTokenName({
|
|
92
|
-
* file,
|
|
93
|
-
* tokenName: 'mytoken'
|
|
94
|
-
* });
|
|
95
|
-
* console.log('Image uploaded:', imageUrl);
|
|
96
|
-
* }
|
|
97
|
-
* ```
|
|
98
|
-
*
|
|
99
|
-
* @example Node.js buffer upload
|
|
100
|
-
* ```typescript
|
|
101
|
-
* import * as fs from 'fs';
|
|
102
|
-
*
|
|
103
|
-
* const imageBuffer = fs.readFileSync('./token-image.png');
|
|
104
|
-
* const imageUrl = await service.uploadImageByTokenName({
|
|
105
|
-
* file: imageBuffer,
|
|
106
|
-
* tokenName: 'mytoken'
|
|
107
|
-
* });
|
|
108
|
-
* console.log('Image URL:', imageUrl);
|
|
109
|
-
* ```
|
|
110
65
|
*/
|
|
111
66
|
uploadImageByTokenName(options: UploadImageByTokenNameOptions): Promise<string>;
|
|
112
67
|
/**
|
|
113
68
|
* Fetches pools with filtering and pagination
|
|
114
69
|
*
|
|
115
|
-
* ✅ VERIFIED: Real API payload confirmed - endpoint /launchpad/fetch-pool
|
|
116
|
-
*
|
|
117
70
|
* @param options Fetch options including type, search, and pagination
|
|
118
71
|
* @returns Promise<PoolsResult> Clean pool data with full pagination
|
|
72
|
+
* @since 2.0.0
|
|
119
73
|
*/
|
|
120
74
|
fetchPools(options?: {
|
|
121
75
|
search?: string;
|
|
@@ -129,6 +83,7 @@ export declare class LaunchpadService {
|
|
|
129
83
|
*
|
|
130
84
|
* @param options Check options with token name and/or symbol
|
|
131
85
|
* @returns Promise<boolean> True if pool exists, false otherwise
|
|
86
|
+
* @since 2.0.0
|
|
132
87
|
*/
|
|
133
88
|
checkPool(options: CheckPoolOptions): Promise<boolean>;
|
|
134
89
|
/**
|
|
@@ -136,6 +91,7 @@ export declare class LaunchpadService {
|
|
|
136
91
|
*
|
|
137
92
|
* @param tokenName Token name to check
|
|
138
93
|
* @returns Promise<boolean> True if available (pool doesn't exist)
|
|
94
|
+
* @since 2.0.0
|
|
139
95
|
*/
|
|
140
96
|
isTokenNameAvailable(tokenName: string): Promise<boolean>;
|
|
141
97
|
/**
|
|
@@ -143,228 +99,103 @@ export declare class LaunchpadService {
|
|
|
143
99
|
*
|
|
144
100
|
* @param symbol Token symbol to check
|
|
145
101
|
* @returns Promise<boolean> True if available (pool doesn't exist)
|
|
102
|
+
* @since 2.0.0
|
|
146
103
|
*/
|
|
147
104
|
isTokenSymbolAvailable(symbol: string): Promise<boolean>;
|
|
148
105
|
/**
|
|
149
106
|
* Fetches volume data for a token
|
|
150
107
|
*
|
|
151
|
-
* ✅ VERIFIED: Real API payload confirmed - endpoint /launchpad/get-graph-data
|
|
152
|
-
*
|
|
153
108
|
* @param options Volume data options
|
|
154
109
|
* @returns Promise<GraphDataResult> Clean volume and price data points
|
|
110
|
+
* @since 2.0.0
|
|
155
111
|
*/
|
|
156
112
|
fetchVolumeData(options: FetchVolumeDataOptions): Promise<GraphDataResult>;
|
|
157
113
|
/**
|
|
158
114
|
* Get token distribution showing top holders
|
|
159
115
|
*
|
|
160
|
-
* Retrieves the list of top token holders for a specific token,
|
|
161
|
-
* along with their balances and percentage of total supply.
|
|
162
|
-
*
|
|
163
116
|
* @param tokenName Token name to fetch distribution for
|
|
164
117
|
* @returns Promise resolving to token distribution data
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* ```typescript
|
|
168
|
-
* const distribution = await service.fetchTokenDistribution('mytoken');
|
|
169
|
-
* console.log('Top holders:', distribution.holders);
|
|
170
|
-
* ```
|
|
118
|
+
* @since 2.0.0
|
|
171
119
|
*/
|
|
172
120
|
fetchTokenDistribution(tokenName: string): Promise<TokenDistributionResult>;
|
|
173
121
|
/**
|
|
174
122
|
* Gets badge achievements for a token
|
|
175
123
|
*
|
|
176
|
-
* This endpoint retrieves volume and engagement badges for a specific token.
|
|
177
|
-
* Badges indicate milestones in trading volume and community engagement.
|
|
178
|
-
*
|
|
179
|
-
* **Note**: This endpoint does not require authentication.
|
|
180
|
-
*
|
|
181
124
|
* @param tokenName The name of the token to get badges for
|
|
182
125
|
* @returns Promise<TokenBadgesResult> Badge information
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```typescript
|
|
186
|
-
* const badges = await service.fetchTokenBadges('mytoken');
|
|
187
|
-
* console.log('Volume badges:', badges.volumeBadges);
|
|
188
|
-
* console.log('Engagement badges:', badges.engagementBadges);
|
|
189
|
-
* ```
|
|
126
|
+
* @since 2.0.0
|
|
190
127
|
*/
|
|
191
128
|
fetchTokenBadges(tokenName: string): Promise<TokenBadgesResult>;
|
|
192
129
|
/**
|
|
193
130
|
* Convenience method to check if a token has achieved a specific badge
|
|
194
131
|
*
|
|
195
|
-
* @param
|
|
196
|
-
* @param badgeType Type of badge to check ('volume' or 'engagement')
|
|
197
|
-
* @param badgeName Specific badge name to check for
|
|
132
|
+
* @param options Badge check options
|
|
198
133
|
* @returns Promise<boolean> Whether the token has achieved this badge
|
|
199
|
-
*
|
|
200
|
-
* @example
|
|
201
|
-
* ```typescript
|
|
202
|
-
* const has10kVolume = await service.hasTokenBadge('mytoken', 'volume', '10k');
|
|
203
|
-
* const hasCrowdEngagement = await service.hasTokenBadge('mytoken', 'engagement', 'CROWD');
|
|
204
|
-
* ```
|
|
134
|
+
* @since 2.0.0
|
|
205
135
|
*/
|
|
206
136
|
hasTokenBadge(options: HasTokenBadgeOptions): Promise<boolean>;
|
|
207
137
|
/**
|
|
208
138
|
* Gets trades for a token by its tokenName with pagination
|
|
209
139
|
*
|
|
210
|
-
* This method provides a clean, intuitive API for fetching token trades
|
|
211
|
-
* using the token name. Follows the same pattern as CommentAPI.
|
|
212
|
-
*
|
|
213
140
|
* @param options Trade fetching options
|
|
214
141
|
* @returns Promise<TradesResult> Clean trades with full pagination
|
|
215
|
-
* @
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
* ```typescript
|
|
219
|
-
* // Get first page of trades for dragnrkti token
|
|
220
|
-
* const trades = await service.fetchTrades({ tokenName: "dragnrkti" });
|
|
221
|
-
*
|
|
222
|
-
* // Get specific page with custom limit
|
|
223
|
-
* const moreTrades = await service.fetchTrades({
|
|
224
|
-
* tokenName: "dragnrkti",
|
|
225
|
-
* page: 2,
|
|
226
|
-
* limit: 20
|
|
227
|
-
* });
|
|
228
|
-
* ```
|
|
142
|
+
* @since 2.0.0
|
|
229
143
|
*/
|
|
230
144
|
fetchTrades(options: FetchTradesOptions): Promise<TradesResult>;
|
|
231
145
|
/**
|
|
232
146
|
* Fetches comments for a token by its tokenName
|
|
233
147
|
*
|
|
234
|
-
* This method provides a clean, intuitive API for fetching token comments
|
|
235
|
-
* using the token name. It automatically resolves the tokenName
|
|
236
|
-
* to the correct vault address internally.
|
|
237
|
-
*
|
|
238
148
|
* @param options Options for fetching comments
|
|
239
149
|
* @returns Promise<CommentsResult> Comments with pagination info
|
|
240
|
-
* @
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* ```typescript
|
|
244
|
-
* // Fetch first page of comments for dragnrkti token
|
|
245
|
-
* const comments = await service.fetchComments({ tokenName: "dragnrkti" });
|
|
246
|
-
*
|
|
247
|
-
* // Fetch specific page with more items
|
|
248
|
-
* const moreComments = await service.fetchComments({
|
|
249
|
-
* tokenName: "dragnrkti",
|
|
250
|
-
* page: 2,
|
|
251
|
-
* limit: 20
|
|
252
|
-
* });
|
|
253
|
-
* ```
|
|
150
|
+
* @since 2.0.0
|
|
254
151
|
*/
|
|
255
152
|
fetchComments(options: FetchCommentsOptions): Promise<CommentsResult>;
|
|
256
153
|
/**
|
|
257
154
|
* Posts a comment on a token by its tokenName
|
|
258
155
|
*
|
|
259
|
-
* This method provides a clean, intuitive API for posting comments on tokens
|
|
260
|
-
* using the token name. It automatically resolves the tokenName
|
|
261
|
-
* to the correct vault address and uses the authenticated user's wallet address.
|
|
262
|
-
*
|
|
263
156
|
* @param options Options for posting a comment
|
|
264
157
|
* @returns Promise<void> No return data
|
|
265
|
-
* @
|
|
266
|
-
*
|
|
267
|
-
* @example
|
|
268
|
-
* ```typescript
|
|
269
|
-
* // Post comment on dragnrkti token
|
|
270
|
-
* await service.postComment({
|
|
271
|
-
* tokenName: "dragnrkti",
|
|
272
|
-
* content: "Great project with solid fundamentals!"
|
|
273
|
-
* });
|
|
274
|
-
* ```
|
|
158
|
+
* @since 2.0.0
|
|
275
159
|
*/
|
|
276
160
|
postComment(options: PostCommentOptions): Promise<void>;
|
|
277
161
|
/**
|
|
278
162
|
* Fetches user profile information
|
|
279
163
|
*
|
|
280
|
-
* ✅ VERIFIED: Real API payload confirmed - endpoint /user/profile (GET)
|
|
281
|
-
*
|
|
282
164
|
* @param address Optional wallet address (defaults to SDK wallet address)
|
|
283
165
|
* @returns Promise<any> User profile information
|
|
284
|
-
* @
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```typescript
|
|
288
|
-
* // Get current user's profile
|
|
289
|
-
* const profile = await service.fetchProfile();
|
|
290
|
-
*
|
|
291
|
-
* // Get specific user's profile
|
|
292
|
-
* const otherProfile = await service.fetchProfile("eth|1234567890abcdef1234567890abcdef12345678");
|
|
293
|
-
* ```
|
|
166
|
+
* @since 2.0.0
|
|
294
167
|
*/
|
|
295
168
|
fetchProfile(address?: string): Promise<any>;
|
|
296
169
|
/**
|
|
297
170
|
* Updates user profile information
|
|
298
171
|
*
|
|
299
|
-
* ✅ VERIFIED: Real API payload confirmed - endpoint /user/profile (PUT)
|
|
300
|
-
*
|
|
301
|
-
* **Smart Image Preservation**: If profileImage is empty or not provided,
|
|
302
|
-
* the method automatically fetches and preserves the existing profile image
|
|
303
|
-
* to prevent accidental image loss.
|
|
304
|
-
*
|
|
305
172
|
* @param data Profile update data
|
|
306
173
|
* @returns Promise<void> No return data - throws on failure
|
|
307
|
-
* @
|
|
308
|
-
* @throws Error if profile update fails
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* ```typescript
|
|
312
|
-
* // Update with new image
|
|
313
|
-
* await service.updateProfile({
|
|
314
|
-
* profileImage: "https://example.com/avatar.jpg",
|
|
315
|
-
* fullName: "John Doe",
|
|
316
|
-
* walletAddress: "eth|1234567890abcdef1234567890abcdef12345678"
|
|
317
|
-
* });
|
|
318
|
-
*
|
|
319
|
-
* // Update name only - existing image will be preserved automatically
|
|
320
|
-
* await service.updateProfile({
|
|
321
|
-
* profileImage: "",
|
|
322
|
-
* fullName: "Jane Doe",
|
|
323
|
-
* walletAddress: "eth|1234567890abcdef1234567890abcdef12345678"
|
|
324
|
-
* });
|
|
325
|
-
* ```
|
|
174
|
+
* @since 2.0.0
|
|
326
175
|
*/
|
|
327
176
|
updateProfile(data: UpdateProfileData): Promise<void>;
|
|
328
177
|
/**
|
|
329
178
|
* Uploads a profile image and returns the image URL
|
|
330
179
|
*
|
|
331
|
-
* ✅ VERIFIED: Real API payload confirmed - endpoint /launchpad/upload-image (for profile)
|
|
332
|
-
*
|
|
333
180
|
* @param options Profile image upload options
|
|
334
181
|
* @returns Promise<string> Clean image URL
|
|
335
|
-
* @
|
|
336
|
-
* @throws Error if upload fails
|
|
337
|
-
*
|
|
338
|
-
* @example
|
|
339
|
-
* ```typescript
|
|
340
|
-
* // Upload profile image file
|
|
341
|
-
* const fileInput = document.getElementById('avatar') as HTMLInputElement;
|
|
342
|
-
* const file = fileInput.files[0];
|
|
343
|
-
* const imageUrl = await service.uploadProfileImage({
|
|
344
|
-
* file: file,
|
|
345
|
-
* walletAddress: "eth|1234567890abcdef1234567890abcdef12345678"
|
|
346
|
-
* });
|
|
347
|
-
* ```
|
|
182
|
+
* @since 2.0.0
|
|
348
183
|
*/
|
|
349
184
|
uploadProfileImage(options: UploadProfileImageOptions): Promise<string>;
|
|
350
185
|
/**
|
|
351
186
|
* Fetches user token list with optional filtering and pagination
|
|
352
187
|
*
|
|
353
|
-
* ✅ VERIFIED: Real API payload confirmed - endpoint /user/token-list
|
|
354
|
-
*
|
|
355
188
|
* @param options Filtering and pagination options
|
|
356
189
|
* @returns Promise<UserTokenListResult> Clean token list with proper types
|
|
357
|
-
* @
|
|
190
|
+
* @since 2.0.0
|
|
358
191
|
*/
|
|
359
192
|
fetchTokenList(options: GetTokenListOptions): Promise<UserTokenListResult>;
|
|
360
193
|
/**
|
|
361
194
|
* Fetches tokens held by user (balances)
|
|
362
195
|
*
|
|
363
|
-
* ✅ VERIFIED: Real API payload confirmed - endpoint /user/token-hold
|
|
364
|
-
*
|
|
365
196
|
* @param options Token held filtering options (address is optional)
|
|
366
197
|
* @returns Promise<UserTokenListResult> Clean tokens held with full pagination
|
|
367
|
-
* @
|
|
198
|
+
* @since 2.0.0
|
|
368
199
|
*/
|
|
369
200
|
fetchTokensHeld(options: GetTokenListOptions): Promise<UserTokenListResult>;
|
|
370
201
|
/**
|
|
@@ -372,32 +203,27 @@ export declare class LaunchpadService {
|
|
|
372
203
|
*
|
|
373
204
|
* @param options Options including pagination
|
|
374
205
|
* @returns Promise<UserTokenListResult> Tokens created by the user
|
|
206
|
+
* @since 2.0.0
|
|
375
207
|
*/
|
|
376
208
|
fetchTokensCreated(options?: {
|
|
377
209
|
page?: number;
|
|
378
210
|
limit?: number;
|
|
211
|
+
search?: string;
|
|
212
|
+
tokenName?: string;
|
|
379
213
|
}): Promise<UserTokenListResult>;
|
|
380
214
|
/**
|
|
381
215
|
* Transfers faucets to a user address
|
|
382
216
|
*
|
|
383
217
|
* @param data Transfer faucets data
|
|
384
218
|
* @returns Promise<void> No return data - throws on failure
|
|
385
|
-
* @
|
|
386
|
-
* @throws Error if transfer fails
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
* ```typescript
|
|
390
|
-
* await service.transferFaucets({
|
|
391
|
-
* walletAddress: "eth|1234567890abcdef1234567890abcdef12345678",
|
|
392
|
-
* amount: "1" // 1 token
|
|
393
|
-
* });
|
|
394
|
-
* ```
|
|
219
|
+
* @since 2.0.0
|
|
395
220
|
*/
|
|
396
221
|
transferFaucets(data: TransferFaucetsData): Promise<void>;
|
|
397
222
|
/**
|
|
398
223
|
* Gets the authenticated user's address in backend format
|
|
399
224
|
*
|
|
400
225
|
* @returns Address in eth|{40-hex-chars} format
|
|
226
|
+
* @since 2.0.0
|
|
401
227
|
*/
|
|
402
228
|
getAddress(): string;
|
|
403
229
|
/**
|
|
@@ -405,75 +231,8 @@ export declare class LaunchpadService {
|
|
|
405
231
|
*
|
|
406
232
|
* @param tokenName Token name to validate
|
|
407
233
|
* @throws ValidationError if validation fails
|
|
234
|
+
* @since 2.0.0
|
|
408
235
|
*/
|
|
409
236
|
validateTokenName(tokenName: string): void;
|
|
410
|
-
/**
|
|
411
|
-
* Resolves a token name to its vault address by fetching pool data
|
|
412
|
-
*
|
|
413
|
-
* @private
|
|
414
|
-
* @param tokenName Token name to resolve
|
|
415
|
-
* @returns Promise<string | null> Vault address if found, null otherwise
|
|
416
|
-
*/
|
|
417
|
-
private resolveTokenNameToVault;
|
|
418
|
-
/**
|
|
419
|
-
* Builds query parameters for comment fetching
|
|
420
|
-
*
|
|
421
|
-
* @private
|
|
422
|
-
*/
|
|
423
|
-
private buildGetCommentsQueryParams;
|
|
424
|
-
/**
|
|
425
|
-
* Builds query parameters for trade listing
|
|
426
|
-
*
|
|
427
|
-
* @private
|
|
428
|
-
*/
|
|
429
|
-
private buildTradeQueryParams;
|
|
430
|
-
/**
|
|
431
|
-
* Builds query parameters for token list fetching
|
|
432
|
-
*
|
|
433
|
-
* @private
|
|
434
|
-
*/
|
|
435
|
-
private buildTokenListQueryParams;
|
|
436
|
-
/**
|
|
437
|
-
* Builds query parameters for token hold endpoint
|
|
438
|
-
*
|
|
439
|
-
* @private
|
|
440
|
-
*/
|
|
441
|
-
private buildTokenHoldQueryParams;
|
|
442
|
-
/**
|
|
443
|
-
* Validates pagination parameters
|
|
444
|
-
*
|
|
445
|
-
* @private
|
|
446
|
-
*/
|
|
447
|
-
private validateTradePagination;
|
|
448
|
-
/**
|
|
449
|
-
* Validates get token list options
|
|
450
|
-
*
|
|
451
|
-
* @private
|
|
452
|
-
*/
|
|
453
|
-
private validateGetTokenListOptions;
|
|
454
|
-
/**
|
|
455
|
-
* Validates user pagination parameters
|
|
456
|
-
*
|
|
457
|
-
* @private
|
|
458
|
-
*/
|
|
459
|
-
private validateUserPagination;
|
|
460
|
-
/**
|
|
461
|
-
* Validates transfer faucets data
|
|
462
|
-
*
|
|
463
|
-
* @private
|
|
464
|
-
*/
|
|
465
|
-
private validateTransferFaucetsData;
|
|
466
|
-
/**
|
|
467
|
-
* Validates update profile data
|
|
468
|
-
*
|
|
469
|
-
* @private
|
|
470
|
-
*/
|
|
471
|
-
private validateUpdateProfileData;
|
|
472
|
-
/**
|
|
473
|
-
* Validates upload profile image options
|
|
474
|
-
*
|
|
475
|
-
* @private
|
|
476
|
-
*/
|
|
477
|
-
private validateUploadProfileImageOptions;
|
|
478
237
|
}
|
|
479
238
|
//# sourceMappingURL=LaunchpadService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LaunchpadService.d.ts","sourceRoot":"","sources":["../../src/services/LaunchpadService.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"LaunchpadService.d.ts","sourceRoot":"","sources":["../../src/services/LaunchpadService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAY3C,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,O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ACG,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/D;;;;;OAKG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;OAMG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAG3C"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pool Service
|
|
3
|
+
*
|
|
4
|
+
* Handles all pool-related operations including pool queries,
|
|
5
|
+
* token distribution, badges, and volume data.
|
|
6
|
+
*
|
|
7
|
+
* @category Services
|
|
8
|
+
* @since 3.6.0
|
|
9
|
+
*/
|
|
10
|
+
import { HttpClient } from '../utils/http';
|
|
11
|
+
import { PoolsResult, CheckPoolOptions, GraphDataResult, TokenDistributionResult, TokenBadgesResult } from '../types/launchpad.dto';
|
|
12
|
+
import { FetchVolumeDataOptions, HasTokenBadgeOptions } from '../types/options.dto';
|
|
13
|
+
/**
|
|
14
|
+
* Pool Service Class
|
|
15
|
+
*
|
|
16
|
+
* Provides methods for:
|
|
17
|
+
* - Fetching and querying pools
|
|
18
|
+
* - Checking pool existence
|
|
19
|
+
* - Retrieving volume/graph data
|
|
20
|
+
* - Getting token distribution
|
|
21
|
+
* - Managing token badges
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const poolService = new PoolService(httpClient);
|
|
26
|
+
*
|
|
27
|
+
* // Fetch recent pools
|
|
28
|
+
* const pools = await poolService.fetchPools({ type: 'recent', page: 1, limit: 10 });
|
|
29
|
+
*
|
|
30
|
+
* // Check if pool exists
|
|
31
|
+
* const exists = await poolService.checkPool({ tokenName: 'mytoken' });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class PoolService {
|
|
35
|
+
private readonly http;
|
|
36
|
+
constructor(http: HttpClient);
|
|
37
|
+
/**
|
|
38
|
+
* Fetches pools with filtering and pagination
|
|
39
|
+
*
|
|
40
|
+
* @param options Fetch options including type, search, and pagination
|
|
41
|
+
* @returns Promise<PoolsResult> Clean pool data with full pagination
|
|
42
|
+
*/
|
|
43
|
+
fetchPools(options?: {
|
|
44
|
+
search?: string;
|
|
45
|
+
tokenName?: string;
|
|
46
|
+
type?: 'recent' | 'popular';
|
|
47
|
+
page?: number;
|
|
48
|
+
limit?: number;
|
|
49
|
+
}): Promise<PoolsResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if a pool exists for given token name or symbol
|
|
52
|
+
*
|
|
53
|
+
* @param options Check options with token name and/or symbol
|
|
54
|
+
* @returns Promise<boolean> True if pool exists, false otherwise
|
|
55
|
+
*/
|
|
56
|
+
checkPool(options: CheckPoolOptions): Promise<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a token name is available (convenience method)
|
|
59
|
+
*
|
|
60
|
+
* @param tokenName Token name to check
|
|
61
|
+
* @returns Promise<boolean> True if available (pool doesn't exist)
|
|
62
|
+
*/
|
|
63
|
+
isTokenNameAvailable(tokenName: string): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if a token symbol is available (convenience method)
|
|
66
|
+
*
|
|
67
|
+
* @param symbol Token symbol to check
|
|
68
|
+
* @returns Promise<boolean> True if available (pool doesn't exist)
|
|
69
|
+
*/
|
|
70
|
+
isTokenSymbolAvailable(symbol: string): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Fetches volume data for a token
|
|
73
|
+
*
|
|
74
|
+
* @param options Volume data options
|
|
75
|
+
* @returns Promise<GraphDataResult> Clean volume and price data points
|
|
76
|
+
*/
|
|
77
|
+
fetchVolumeData(options: FetchVolumeDataOptions): Promise<GraphDataResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Get token distribution showing top holders
|
|
80
|
+
*
|
|
81
|
+
* Retrieves the list of top token holders for a specific token,
|
|
82
|
+
* along with their balances and percentage of total supply.
|
|
83
|
+
*
|
|
84
|
+
* @param tokenName Token name to fetch distribution for
|
|
85
|
+
* @returns Promise resolving to token distribution data
|
|
86
|
+
*/
|
|
87
|
+
fetchTokenDistribution(tokenName: string): Promise<TokenDistributionResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Gets badge achievements for a token
|
|
90
|
+
*
|
|
91
|
+
* This endpoint retrieves volume and engagement badges for a specific token.
|
|
92
|
+
* Badges indicate milestones in trading volume and community engagement.
|
|
93
|
+
*
|
|
94
|
+
* @param tokenName The name of the token to get badges for
|
|
95
|
+
* @returns Promise<TokenBadgesResult> Badge information
|
|
96
|
+
*/
|
|
97
|
+
fetchTokenBadges(tokenName: string): Promise<TokenBadgesResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Convenience method to check if a token has achieved a specific badge
|
|
100
|
+
*
|
|
101
|
+
* @param options Badge check options
|
|
102
|
+
* @returns Promise<boolean> Whether the token has achieved this badge
|
|
103
|
+
*/
|
|
104
|
+
hasTokenBadge(options: HasTokenBadgeOptions): Promise<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Resolves a token name to its vault address by fetching pool data
|
|
107
|
+
*
|
|
108
|
+
* @private
|
|
109
|
+
* @param tokenName Token name to resolve
|
|
110
|
+
* @returns Promise<string | null> Vault address if found, null otherwise
|
|
111
|
+
*/
|
|
112
|
+
private resolveTokenNameToVault;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=PoolService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PoolService.d.ts","sourceRoot":"","sources":["../../src/services/PoolService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,OAAO,EAGL,WAAW,EACX,gBAAgB,EAIhB,eAAe,EAEf,uBAAuB,EAEvB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WA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