@gala-chain/launchpad-sdk 0.4.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +358 -75
- 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 +101 -63
- 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 -12
- 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,479 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launchpad Service
|
|
3
|
+
*
|
|
4
|
+
* This service consolidates all launchpad-backend operations from multiple API classes.
|
|
5
|
+
* It provides a unified interface for:
|
|
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
|
|
15
|
+
*
|
|
16
|
+
* All methods use the launchpad-backend HTTP client exclusively.
|
|
17
|
+
*/
|
|
18
|
+
import { HttpClient } from '../utils/http';
|
|
19
|
+
import { PoolsResult, CheckPoolOptions, GraphDataResult, TokenDistributionResult, TokenBadgesResult } from '../types/launchpad.dto';
|
|
20
|
+
import { UploadImageByTokenNameOptions, FetchVolumeDataOptions, HasTokenBadgeOptions } from '../types/options.dto';
|
|
21
|
+
import { CommentsResult } from '../types/comment.dto';
|
|
22
|
+
import { FetchCommentsOptions, PostCommentOptions } from '../types/options.dto';
|
|
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
|
|
38
|
+
*
|
|
39
|
+
* @category Services
|
|
40
|
+
* @since 2.0.0
|
|
41
|
+
*
|
|
42
|
+
* @example Basic usage
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const service = new LaunchpadService(httpClient);
|
|
45
|
+
*
|
|
46
|
+
* // Upload token image
|
|
47
|
+
* const imageUrl = await service.uploadImageByTokenName({
|
|
48
|
+
* tokenName: 'mytoken',
|
|
49
|
+
* options: { file: imageFile, tokenName: 'mytoken' }
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // Fetch pools
|
|
53
|
+
* const pools = await service.fetchPools({ type: 'recent', page: 1, limit: 10 });
|
|
54
|
+
*
|
|
55
|
+
* // Get comments
|
|
56
|
+
* const comments = await service.fetchComments({ tokenName: 'mytoken' });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare class LaunchpadService {
|
|
60
|
+
private readonly http;
|
|
61
|
+
constructor(http: HttpClient);
|
|
62
|
+
/**
|
|
63
|
+
* Uploads an image for a token pool
|
|
64
|
+
*
|
|
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
|
+
* @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
|
+
* @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
|
+
* @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
|
+
*/
|
|
111
|
+
uploadImageByTokenName(options: UploadImageByTokenNameOptions): Promise<string>;
|
|
112
|
+
/**
|
|
113
|
+
* Fetches pools with filtering and pagination
|
|
114
|
+
*
|
|
115
|
+
* ✅ VERIFIED: Real API payload confirmed - endpoint /launchpad/fetch-pool
|
|
116
|
+
*
|
|
117
|
+
* @param options Fetch options including type, search, and pagination
|
|
118
|
+
* @returns Promise<PoolsResult> Clean pool data with full pagination
|
|
119
|
+
*/
|
|
120
|
+
fetchPools(options?: {
|
|
121
|
+
search?: string;
|
|
122
|
+
tokenName?: string;
|
|
123
|
+
type?: 'recent' | 'popular';
|
|
124
|
+
page?: number;
|
|
125
|
+
limit?: number;
|
|
126
|
+
}): Promise<PoolsResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Checks if a pool exists for given token name or symbol
|
|
129
|
+
*
|
|
130
|
+
* @param options Check options with token name and/or symbol
|
|
131
|
+
* @returns Promise<boolean> True if pool exists, false otherwise
|
|
132
|
+
*/
|
|
133
|
+
checkPool(options: CheckPoolOptions): Promise<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Checks if a token name is available (convenience method)
|
|
136
|
+
*
|
|
137
|
+
* @param tokenName Token name to check
|
|
138
|
+
* @returns Promise<boolean> True if available (pool doesn't exist)
|
|
139
|
+
*/
|
|
140
|
+
isTokenNameAvailable(tokenName: string): Promise<boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* Checks if a token symbol is available (convenience method)
|
|
143
|
+
*
|
|
144
|
+
* @param symbol Token symbol to check
|
|
145
|
+
* @returns Promise<boolean> True if available (pool doesn't exist)
|
|
146
|
+
*/
|
|
147
|
+
isTokenSymbolAvailable(symbol: string): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Fetches volume data for a token
|
|
150
|
+
*
|
|
151
|
+
* ✅ VERIFIED: Real API payload confirmed - endpoint /launchpad/get-graph-data
|
|
152
|
+
*
|
|
153
|
+
* @param options Volume data options
|
|
154
|
+
* @returns Promise<GraphDataResult> Clean volume and price data points
|
|
155
|
+
*/
|
|
156
|
+
fetchVolumeData(options: FetchVolumeDataOptions): Promise<GraphDataResult>;
|
|
157
|
+
/**
|
|
158
|
+
* Get token distribution showing top holders
|
|
159
|
+
*
|
|
160
|
+
* Retrieves the list of top token holders for a specific token,
|
|
161
|
+
* along with their balances and percentage of total supply.
|
|
162
|
+
*
|
|
163
|
+
* @param tokenName Token name to fetch distribution for
|
|
164
|
+
* @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
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
fetchTokenDistribution(tokenName: string): Promise<TokenDistributionResult>;
|
|
173
|
+
/**
|
|
174
|
+
* Gets badge achievements for a token
|
|
175
|
+
*
|
|
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
|
+
* @param tokenName The name of the token to get badges for
|
|
182
|
+
* @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
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
fetchTokenBadges(tokenName: string): Promise<TokenBadgesResult>;
|
|
192
|
+
/**
|
|
193
|
+
* Convenience method to check if a token has achieved a specific badge
|
|
194
|
+
*
|
|
195
|
+
* @param tokenName The token name to check
|
|
196
|
+
* @param badgeType Type of badge to check ('volume' or 'engagement')
|
|
197
|
+
* @param badgeName Specific badge name to check for
|
|
198
|
+
* @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
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
hasTokenBadge(options: HasTokenBadgeOptions): Promise<boolean>;
|
|
207
|
+
/**
|
|
208
|
+
* Gets trades for a token by its tokenName with pagination
|
|
209
|
+
*
|
|
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
|
+
* @param options Trade fetching options
|
|
214
|
+
* @returns Promise<TradesResult> Clean trades with full pagination
|
|
215
|
+
* @throws ValidationError if token name is invalid or not found
|
|
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
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
fetchTrades(options: FetchTradesOptions): Promise<TradesResult>;
|
|
231
|
+
/**
|
|
232
|
+
* Fetches comments for a token by its tokenName
|
|
233
|
+
*
|
|
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
|
+
* @param options Options for fetching comments
|
|
239
|
+
* @returns Promise<CommentsResult> Comments with pagination info
|
|
240
|
+
* @throws ValidationError if token name is invalid or not found
|
|
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
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
fetchComments(options: FetchCommentsOptions): Promise<CommentsResult>;
|
|
256
|
+
/**
|
|
257
|
+
* Posts a comment on a token by its tokenName
|
|
258
|
+
*
|
|
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
|
+
* @param options Options for posting a comment
|
|
264
|
+
* @returns Promise<void> No return data
|
|
265
|
+
* @throws ValidationError if token name is invalid, not found, or content is invalid
|
|
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
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
postComment(options: PostCommentOptions): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Fetches user profile information
|
|
279
|
+
*
|
|
280
|
+
* ✅ VERIFIED: Real API payload confirmed - endpoint /user/profile (GET)
|
|
281
|
+
*
|
|
282
|
+
* @param walletAddress Optional wallet address (defaults to SDK wallet address)
|
|
283
|
+
* @returns Promise<any> User profile information
|
|
284
|
+
* @throws ValidationError if input validation fails
|
|
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
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
fetchProfile(walletAddress?: string): Promise<any>;
|
|
296
|
+
/**
|
|
297
|
+
* Updates user profile information
|
|
298
|
+
*
|
|
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
|
+
* @param data Profile update data
|
|
306
|
+
* @returns Promise<void> No return data - throws on failure
|
|
307
|
+
* @throws ValidationError if input validation fails
|
|
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
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
updateProfile(data: UpdateProfileData): Promise<void>;
|
|
328
|
+
/**
|
|
329
|
+
* Uploads a profile image and returns the image URL
|
|
330
|
+
*
|
|
331
|
+
* ✅ VERIFIED: Real API payload confirmed - endpoint /launchpad/upload-image (for profile)
|
|
332
|
+
*
|
|
333
|
+
* @param options Profile image upload options
|
|
334
|
+
* @returns Promise<string> Clean image URL
|
|
335
|
+
* @throws ValidationError if input validation fails
|
|
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
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
uploadProfileImage(options: UploadProfileImageOptions): Promise<string>;
|
|
350
|
+
/**
|
|
351
|
+
* Fetches user token list with optional filtering and pagination
|
|
352
|
+
*
|
|
353
|
+
* ✅ VERIFIED: Real API payload confirmed - endpoint /user/token-list
|
|
354
|
+
*
|
|
355
|
+
* @param options Filtering and pagination options
|
|
356
|
+
* @returns Promise<UserTokenListResult> Clean token list with proper types
|
|
357
|
+
* @throws Error if request fails
|
|
358
|
+
*/
|
|
359
|
+
fetchTokenList(options: GetTokenListOptions): Promise<UserTokenListResult>;
|
|
360
|
+
/**
|
|
361
|
+
* Fetches tokens held by user (balances)
|
|
362
|
+
*
|
|
363
|
+
* ✅ VERIFIED: Real API payload confirmed - endpoint /user/token-hold
|
|
364
|
+
*
|
|
365
|
+
* @param options Token held filtering options (address is optional)
|
|
366
|
+
* @returns Promise<UserTokenListResult> Clean tokens held with full pagination
|
|
367
|
+
* @throws ValidationError if input validation fails
|
|
368
|
+
*/
|
|
369
|
+
fetchTokensHeld(options: GetTokenListOptions): Promise<UserTokenListResult>;
|
|
370
|
+
/**
|
|
371
|
+
* Fetches tokens created by user
|
|
372
|
+
*
|
|
373
|
+
* @param options Options including pagination
|
|
374
|
+
* @returns Promise<UserTokenListResult> Tokens created by the user
|
|
375
|
+
*/
|
|
376
|
+
fetchTokensCreated(options?: {
|
|
377
|
+
page?: number;
|
|
378
|
+
limit?: number;
|
|
379
|
+
}): Promise<UserTokenListResult>;
|
|
380
|
+
/**
|
|
381
|
+
* Transfers faucets to a user address
|
|
382
|
+
*
|
|
383
|
+
* @param data Transfer faucets data
|
|
384
|
+
* @returns Promise<void> No return data - throws on failure
|
|
385
|
+
* @throws ValidationError if input validation fails
|
|
386
|
+
* @throws Error if transfer fails
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* await service.transferFaucets({
|
|
391
|
+
* walletAddress: "eth|1234567890abcdef1234567890abcdef12345678",
|
|
392
|
+
* amount: "1000000000000000000" // 1 token with 18 decimals
|
|
393
|
+
* });
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
transferFaucets(data: TransferFaucetsData): Promise<void>;
|
|
397
|
+
/**
|
|
398
|
+
* Gets the authenticated user's address in backend format
|
|
399
|
+
*
|
|
400
|
+
* @returns Address in eth|{40-hex-chars} format
|
|
401
|
+
*/
|
|
402
|
+
getAddress(): string;
|
|
403
|
+
/**
|
|
404
|
+
* Validates a token name (exposed for external validation)
|
|
405
|
+
*
|
|
406
|
+
* @param tokenName Token name to validate
|
|
407
|
+
* @throws ValidationError if validation fails
|
|
408
|
+
*/
|
|
409
|
+
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
|
+
}
|
|
479
|
+
//# sourceMappingURL=LaunchpadService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LaunchpadService.d.ts","sourceRoot":"","sources":["../../../src/services/LaunchpadService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAY3C,OAAO,EAIL,WAAW,EACX,gBAAgB,EAIhB,eAAe,EAEf,uBAAuB,EAEvB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,cAAc,EAOf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,YAAY,EAGb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAwB,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EAEnB,mBAAmB,EAEnB,iBAAiB,EAEjB,yBAAyB,EAQ1B,MAAM,mBAAmB,CAAC;AAO3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAM7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACG,sBAAsB,CAC1B,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,MAAM,CAAC;IAiElB;;;;;;;OAOG;IACG,UAAU,CACd,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;Q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|
1
|
+
{"version":3,"file":"SignatureService.d.ts","sourceRoot":"","sources":["../../../src/services/SignatureService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAwBH;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,QAAQ,IAAI;IACZ,YAAY,IAAI;IAChB,WAAW,IAAI;CAChB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,KAAK;gBADL,cAAc,EAAE,GAAG,EACnB,KAAK,GAAE,OAAe;IAGhC;;;;;;;;OAQG;IACG,OAAO,CACX,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,gBAAgB,GAAE,gBAA4C,GAC7D,OAAO,CAAC,GAAG,CAAC;IAuEf;;OAEG;YACW,gBAAgB;IA0C9B;;OAEG;YACW,mBAAmB;IAoBjC;;;OAGG;YACW,kBAAkB;IAgDhC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAgF3B;;OAEG;IACH,sBAAsB,IAAI,gBAAgB;CAmB3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenClassKeyService.d.ts","sourceRoot":"","sources":["../../../src/services/TokenClassKeyService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,KAAK;gBAAL,KAAK,GAAE,OAAe;IAE1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE;IA2C3D;;;;;;;OAOG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa;IAkBvD;;;;OAIG;IACH,kBAAkB,IAAI,aAAa;IAgBnC;;;;;;;;;;;;;OAaG;IACH,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IA4BzD;;;;;OAKG;IACH,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAoCnD;;;;;;;;OAQG;IACH,2BAA2B,CACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GACpB,MAAM;IAIT;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG;QAC3C,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;KACvB;CAaF"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Resolver Service
|
|
3
|
+
*
|
|
4
|
+
* Centralized service for resolving token names to vault addresses and
|
|
5
|
+
* GalaChain token identifiers.
|
|
6
|
+
*
|
|
7
|
+
* Key Features:
|
|
8
|
+
* - Token name → vault address resolution
|
|
9
|
+
* - Token name → TokenClassKey resolution
|
|
10
|
+
* - Intelligent in-memory caching (vault addresses are immutable)
|
|
11
|
+
* - Service-to-service dependency (depends on LaunchpadService)
|
|
12
|
+
* - Single responsibility: all token resolution logic in one place
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import { LaunchpadService } from './LaunchpadService';
|
|
17
|
+
import type { TokenClassKey } from '../types/common';
|
|
18
|
+
/**
|
|
19
|
+
* Service for resolving token names to vault addresses and GalaChain identifiers
|
|
20
|
+
*
|
|
21
|
+
* This service encapsulates all token resolution logic and provides
|
|
22
|
+
* intelligent caching to minimize API calls. Since vault addresses are
|
|
23
|
+
* immutable after token creation, they can be safely cached indefinitely.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const launchpadService = new LaunchpadService(httpClient);
|
|
28
|
+
* const tokenResolver = new TokenResolverService(launchpadService);
|
|
29
|
+
*
|
|
30
|
+
* // Resolve token name to vault address
|
|
31
|
+
* const vaultAddress = await tokenResolver.resolveTokenToVault('dragnrkti');
|
|
32
|
+
* console.log('Vault:', vaultAddress);
|
|
33
|
+
*
|
|
34
|
+
* // Resolve token name to GalaChain TokenClassKey
|
|
35
|
+
* const tokenClassKey = await tokenResolver.resolveTokenClassKey('dragnrkti');
|
|
36
|
+
* console.log('Token:', tokenClassKey);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class TokenResolverService {
|
|
40
|
+
private readonly launchpadService;
|
|
41
|
+
/**
|
|
42
|
+
* In-memory cache for tokenName → vaultAddress mappings
|
|
43
|
+
* Key: lowercase token name
|
|
44
|
+
* Value: vault address string
|
|
45
|
+
*/
|
|
46
|
+
private cache;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new TokenResolverService instance
|
|
49
|
+
*
|
|
50
|
+
* @param launchpadService LaunchpadService instance for fetching token data
|
|
51
|
+
*/
|
|
52
|
+
constructor(launchpadService: LaunchpadService);
|
|
53
|
+
/**
|
|
54
|
+
* Resolves a token name to its vault address
|
|
55
|
+
*
|
|
56
|
+
* This method checks the cache first, and only makes an API call if needed.
|
|
57
|
+
* Since vault addresses never change after token creation, successful
|
|
58
|
+
* resolutions are cached indefinitely.
|
|
59
|
+
*
|
|
60
|
+
* @param tokenName Token name to resolve (case-insensitive)
|
|
61
|
+
* @returns Promise<string | null> Vault address if found, null if token doesn't exist
|
|
62
|
+
* @throws {ValidationError} If tokenName is invalid
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const vaultAddress = await tokenResolver.resolveTokenToVault('dragnrkti');
|
|
67
|
+
* if (vaultAddress) {
|
|
68
|
+
* console.log('Vault address:', vaultAddress);
|
|
69
|
+
* } else {
|
|
70
|
+
* console.log('Token not found');
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
resolveTokenToVault(tokenName: string): Promise<string | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Resolves a token name to GalaChain TokenClassKey format
|
|
77
|
+
*
|
|
78
|
+
* This method first resolves the token name to a vault address,
|
|
79
|
+
* then parses the vault address to extract TokenClassKey components.
|
|
80
|
+
*
|
|
81
|
+
* @param tokenName Token name to resolve
|
|
82
|
+
* @returns Promise<TokenClassKey> GalaChain token identifier
|
|
83
|
+
* @throws {Error} If token cannot be resolved or vault address is invalid
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const tokenClassKey = await tokenResolver.resolveTokenClassKey('dragnrkti');
|
|
88
|
+
* console.log('Collection:', tokenClassKey.collection);
|
|
89
|
+
* console.log('Category:', tokenClassKey.category);
|
|
90
|
+
* console.log('Type:', tokenClassKey.type);
|
|
91
|
+
* console.log('Additional Key:', tokenClassKey.additionalKey);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
resolveTokenClassKey(tokenName: string): Promise<TokenClassKey>;
|
|
95
|
+
/**
|
|
96
|
+
* Gets cached vault address for a token name
|
|
97
|
+
*
|
|
98
|
+
* @param tokenName Token name to lookup (case-insensitive)
|
|
99
|
+
* @returns Cached vault address or null if not in cache
|
|
100
|
+
*/
|
|
101
|
+
get(tokenName: string): string | null;
|
|
102
|
+
/**
|
|
103
|
+
* Caches a vault address for a token name
|
|
104
|
+
*
|
|
105
|
+
* @param tokenName Token name to cache (will be normalized to lowercase)
|
|
106
|
+
* @param vaultAddress Vault address to cache
|
|
107
|
+
*/
|
|
108
|
+
set(tokenName: string, vaultAddress: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Clears the entire cache
|
|
111
|
+
*
|
|
112
|
+
* Useful for testing or when you need to force fresh token resolution.
|
|
113
|
+
*/
|
|
114
|
+
clear(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Gets cache statistics
|
|
117
|
+
*
|
|
118
|
+
* @returns Object with cache size and all cached token names
|
|
119
|
+
*/
|
|
120
|
+
getStats(): {
|
|
121
|
+
size: number;
|
|
122
|
+
keys: string[];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Pre-warms the cache with known tokenName → vaultAddress mappings
|
|
126
|
+
*
|
|
127
|
+
* Useful for batch operations or initialization when you already
|
|
128
|
+
* know vault addresses for certain tokens.
|
|
129
|
+
*
|
|
130
|
+
* @param mappings Array of {tokenName, vaultAddress} objects
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* tokenResolver.preWarm([
|
|
135
|
+
* { tokenName: 'dragnrkti', vaultAddress: 'service|Token$Unit$...' },
|
|
136
|
+
* { tokenName: 'rocketri', vaultAddress: 'service|Token$Unit$...' }
|
|
137
|
+
* ]);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
preWarm(mappings: Array<{
|
|
141
|
+
tokenName: string;
|
|
142
|
+
vaultAddress: string;
|
|
143
|
+
}>): void;
|
|
144
|
+
/**
|
|
145
|
+
* Parses a vault address string to extract TokenClassKey components
|
|
146
|
+
*
|
|
147
|
+
* @private
|
|
148
|
+
* @param vaultAddress Vault address in format "service|Token$Unit$SYMBOL$eth:address$launchpad"
|
|
149
|
+
* @returns TokenClassKey object
|
|
150
|
+
* @throws {Error} If vault address format is invalid
|
|
151
|
+
*/
|
|
152
|
+
private parseVaultAddressToTokenClassKey;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=TokenResolverService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenResolverService.d.ts","sourceRoot":"","sources":["../../../src/services/TokenResolverService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;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,CAAC,WAAW,CAChB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,eAAe,EACvB,KAAK,GAAE,OAAe,GACrB,gBAAgB;IAiCnB;;;;;;;;OAQG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;IAgClE;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;IAc5D;;;;;;;OAOG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,GAAE,OAAe,GAAG,IAAI;IAiBlD;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,IAAI,KAAK,CAAC;QAChC,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;IAQF;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI1C;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAK7C;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;CAGzB"}
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* @category Services
|
|
8
8
|
* @since 2.0.0
|
|
9
9
|
*/
|
|
10
|
+
import { SDKTransactionStatus } from '../types/websocket.types';
|
|
10
11
|
export interface TransactionStatus {
|
|
11
12
|
transactionId: string;
|
|
12
|
-
status:
|
|
13
|
+
status: SDKTransactionStatus;
|
|
13
14
|
message?: string;
|
|
14
15
|
timestamp: number;
|
|
15
16
|
blockHash?: string;
|
|
@@ -25,9 +26,11 @@ export declare class WebSocketService {
|
|
|
25
26
|
private socket;
|
|
26
27
|
private config;
|
|
27
28
|
private listeners;
|
|
29
|
+
private timeouts;
|
|
28
30
|
private reconnectCount;
|
|
29
31
|
private debug;
|
|
30
32
|
private isSocketIOAvailable;
|
|
33
|
+
private readonly logger;
|
|
31
34
|
constructor(config: WebSocketConfig, debug?: boolean);
|
|
32
35
|
/**
|
|
33
36
|
* Check if Socket.IO is available in the current environment
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebSocketService.d.ts","sourceRoot":"","sources":["../../../src/services/WebSocketService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAEL,oBAAoB,EAErB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,SAAS,CACL;IACZ,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,mBAAmB,CAAU;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,EAAE,eAAe,EAAE,KAAK,GAAE,OAAe;IAc3D;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAiBjC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAwD9B;;OAEG;IACG,kBAAkB,CACtB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,CAAC,MAAM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