@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
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod-Powered Validation Utilities
|
|
3
|
+
*
|
|
4
|
+
* Type-safe validation functions that replace manual type guards.
|
|
5
|
+
* These provide clean, backward-compatible wrappers around Zod schemas.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { launchTokenDataSchema, tokenUrlsSchema, imageUploadOptionsSchema, checkPoolOptionsSchema } from './launchpad.js';
|
|
9
|
+
import { tokenListOptionsSchema, transferFaucetsDataSchema, fetchGalaBalanceOptionsSchema, updateProfileDataSchema, uploadProfileImageOptionsSchema, fetchTokenBalanceOptionsSchema } from './user.js';
|
|
10
|
+
import { createTradeDataSchema, buyTokensDataSchema, sellTokensDataSchema, getTradeOptionsSchema, tradeListParamsSchema, getAmountOptionsSchema, calculatePreMintDataSchema, fetchPoolDetailsDataSchema } from './trade.js';
|
|
11
|
+
/**
|
|
12
|
+
* Standard validation result
|
|
13
|
+
*
|
|
14
|
+
* Provides consistent interface for all validators with proper TypeScript
|
|
15
|
+
* strict mode compatibility.
|
|
16
|
+
*
|
|
17
|
+
* ## Design Rationale
|
|
18
|
+
*
|
|
19
|
+
* This interface uses explicit `T | undefined` instead of optional properties
|
|
20
|
+
* to ensure compatibility with TypeScript's `exactOptionalPropertyTypes` setting.
|
|
21
|
+
*
|
|
22
|
+
* ### TypeScript Configuration Context
|
|
23
|
+
*
|
|
24
|
+
* ```json
|
|
25
|
+
* // tsconfig.json
|
|
26
|
+
* {
|
|
27
|
+
* "compilerOptions": {
|
|
28
|
+
* "exactOptionalPropertyTypes": true
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* With `exactOptionalPropertyTypes: true`, TypeScript strictly enforces that
|
|
34
|
+
* optional properties (`property?: Type`) cannot be assigned `undefined` values.
|
|
35
|
+
* Only missing properties are allowed.
|
|
36
|
+
*
|
|
37
|
+
* ### Interface Design Choice
|
|
38
|
+
*
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // ❌ INCORRECT - Breaks with exactOptionalPropertyTypes
|
|
41
|
+
* interface ValidationResult<T> {
|
|
42
|
+
* success: boolean;
|
|
43
|
+
* data?: T; // Optional property
|
|
44
|
+
* errors?: string[]; // Optional property
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* // ✅ CORRECT - Compatible with exactOptionalPropertyTypes
|
|
48
|
+
* interface ValidationResult<T> {
|
|
49
|
+
* success: boolean;
|
|
50
|
+
* data: T | undefined; // Explicit undefined
|
|
51
|
+
* errors: string[] | undefined; // Explicit undefined
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* ### Usage Patterns
|
|
56
|
+
*
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Success case
|
|
59
|
+
* const successResult: ValidationResult<string> = {
|
|
60
|
+
* success: true,
|
|
61
|
+
* data: 'validated-value',
|
|
62
|
+
* errors: undefined
|
|
63
|
+
* };
|
|
64
|
+
*
|
|
65
|
+
* // Failure case
|
|
66
|
+
* const failureResult: ValidationResult<string> = {
|
|
67
|
+
* success: false,
|
|
68
|
+
* data: undefined,
|
|
69
|
+
* errors: ['Validation error message']
|
|
70
|
+
* };
|
|
71
|
+
*
|
|
72
|
+
* // Type-safe consumption
|
|
73
|
+
* function handleResult(result: ValidationResult<string>) {
|
|
74
|
+
* if (result.success) {
|
|
75
|
+
* // TypeScript knows result.data is string | undefined
|
|
76
|
+
* console.log(result.data);
|
|
77
|
+
* } else {
|
|
78
|
+
* // TypeScript knows result.errors is string[] | undefined
|
|
79
|
+
* console.error(result.errors);
|
|
80
|
+
* }
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* ### Benefits
|
|
85
|
+
*
|
|
86
|
+
* 1. **Type Safety**: Explicit undefined makes intent clear
|
|
87
|
+
* 2. **Strict Mode**: Compatible with `exactOptionalPropertyTypes`
|
|
88
|
+
* 3. **Consistency**: All validators return same shape
|
|
89
|
+
* 4. **Backward Compatibility**: Maintains existing API surface
|
|
90
|
+
*
|
|
91
|
+
* @template T The type of the validated data
|
|
92
|
+
*/
|
|
93
|
+
export interface ValidationResult<T> {
|
|
94
|
+
/** Whether validation passed */
|
|
95
|
+
success: boolean;
|
|
96
|
+
/** Validated and transformed data (if successful) */
|
|
97
|
+
data: T | undefined;
|
|
98
|
+
/** Validation error messages (if failed) */
|
|
99
|
+
errors: string[] | undefined;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Validates token name format
|
|
103
|
+
* Replaces: isValidTokenName()
|
|
104
|
+
*/
|
|
105
|
+
export declare function validateTokenName(value: unknown): ValidationResult<string>;
|
|
106
|
+
/**
|
|
107
|
+
* Validates token symbol format
|
|
108
|
+
* Replaces: isValidTokenSymbol()
|
|
109
|
+
*/
|
|
110
|
+
export declare function validateTokenSymbol(value: unknown): ValidationResult<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Validates token description
|
|
113
|
+
* Replaces: isValidTokenDescription()
|
|
114
|
+
*/
|
|
115
|
+
export declare function validateTokenDescription(value: unknown): ValidationResult<string>;
|
|
116
|
+
/**
|
|
117
|
+
* Validates and normalizes address format
|
|
118
|
+
* Accepts both 0x... and eth|... formats, outputs eth|... format
|
|
119
|
+
* Replaces: isValidUserAddress(), normalizeAddressInput()
|
|
120
|
+
*/
|
|
121
|
+
export declare function validateAddress(value: unknown): ValidationResult<string>;
|
|
122
|
+
/**
|
|
123
|
+
* Validates vault address format
|
|
124
|
+
* Supports both eth| and service| formats
|
|
125
|
+
* Replaces: isValidVaultAddress()
|
|
126
|
+
*/
|
|
127
|
+
export declare function validateVaultAddress(value: unknown): ValidationResult<string>;
|
|
128
|
+
/**
|
|
129
|
+
* Validates positive decimal string
|
|
130
|
+
* Replaces: isValidAmountString()
|
|
131
|
+
*/
|
|
132
|
+
export declare function validateAmountString(value: unknown): ValidationResult<string>;
|
|
133
|
+
/**
|
|
134
|
+
* Validates faucet amount (positive, non-zero)
|
|
135
|
+
* Replaces: isValidFaucetAmount()
|
|
136
|
+
*/
|
|
137
|
+
export declare function validateFaucetAmount(value: unknown): ValidationResult<string>;
|
|
138
|
+
/**
|
|
139
|
+
* Validates full name format
|
|
140
|
+
* Replaces: isValidFullName()
|
|
141
|
+
*/
|
|
142
|
+
export declare function validateFullName(value: unknown): ValidationResult<string>;
|
|
143
|
+
/**
|
|
144
|
+
* Validates search query
|
|
145
|
+
* Replaces: isValidSearchQuery()
|
|
146
|
+
*/
|
|
147
|
+
export declare function validateSearchQuery(value: unknown): ValidationResult<string>;
|
|
148
|
+
/**
|
|
149
|
+
* Validates user token name (more permissive than creation token name)
|
|
150
|
+
* Replaces: isValidUserTokenName()
|
|
151
|
+
*/
|
|
152
|
+
export declare function validateUserTokenName(value: unknown): ValidationResult<string>;
|
|
153
|
+
/**
|
|
154
|
+
* Validates launch token data
|
|
155
|
+
* Replaces: isLaunchTokenData()
|
|
156
|
+
*/
|
|
157
|
+
export declare function validateLaunchTokenData(value: unknown): ValidationResult<z.infer<typeof launchTokenDataSchema>>;
|
|
158
|
+
/**
|
|
159
|
+
* Validates token social URLs
|
|
160
|
+
* Replaces manual URL validation
|
|
161
|
+
*/
|
|
162
|
+
export declare function validateTokenUrls(value: unknown): ValidationResult<z.infer<typeof tokenUrlsSchema>>;
|
|
163
|
+
/**
|
|
164
|
+
* Validates image upload options
|
|
165
|
+
* Replaces: isImageUploadOptions()
|
|
166
|
+
*/
|
|
167
|
+
export declare function validateImageUploadOptions(value: unknown): ValidationResult<z.infer<typeof imageUploadOptionsSchema>>;
|
|
168
|
+
/**
|
|
169
|
+
* Validates check pool options
|
|
170
|
+
* Replaces: isCheckPoolOptions()
|
|
171
|
+
*/
|
|
172
|
+
export declare function validateCheckPoolOptions(value: unknown): ValidationResult<z.infer<typeof checkPoolOptionsSchema>>;
|
|
173
|
+
/**
|
|
174
|
+
* Validates token list options
|
|
175
|
+
* Replaces: isGetTokenListOptions()
|
|
176
|
+
*/
|
|
177
|
+
export declare function validateTokenListOptions(value: unknown): ValidationResult<z.infer<typeof tokenListOptionsSchema>>;
|
|
178
|
+
/**
|
|
179
|
+
* Validates transfer faucets data
|
|
180
|
+
* Replaces: isTransferFaucetsData()
|
|
181
|
+
*/
|
|
182
|
+
export declare function validateTransferFaucetsData(value: unknown): ValidationResult<z.infer<typeof transferFaucetsDataSchema>>;
|
|
183
|
+
/**
|
|
184
|
+
* Validates fetch GALA balance options
|
|
185
|
+
* Replaces: isFetchGalaBalanceOptions()
|
|
186
|
+
*/
|
|
187
|
+
export declare function validateFetchGalaBalanceOptions(value: unknown): ValidationResult<z.infer<typeof fetchGalaBalanceOptionsSchema>>;
|
|
188
|
+
/**
|
|
189
|
+
* Validates update profile data
|
|
190
|
+
* Replaces: isUpdateProfileData()
|
|
191
|
+
*/
|
|
192
|
+
export declare function validateUpdateProfileData(value: unknown): ValidationResult<z.infer<typeof updateProfileDataSchema>>;
|
|
193
|
+
/**
|
|
194
|
+
* Validates upload profile image options
|
|
195
|
+
* Replaces: isUploadProfileImageOptions()
|
|
196
|
+
*/
|
|
197
|
+
export declare function validateUploadProfileImageOptions(value: unknown): ValidationResult<z.infer<typeof uploadProfileImageOptionsSchema>>;
|
|
198
|
+
/**
|
|
199
|
+
* Validates fetch token balance options
|
|
200
|
+
* Replaces: isFetchTokenBalanceOptions()
|
|
201
|
+
*/
|
|
202
|
+
export declare function validateFetchTokenBalanceOptions(value: unknown): ValidationResult<z.infer<typeof fetchTokenBalanceOptionsSchema>>;
|
|
203
|
+
/**
|
|
204
|
+
* Validates create trade data
|
|
205
|
+
* Replaces: isCreateTradeData()
|
|
206
|
+
*/
|
|
207
|
+
export declare function validateCreateTradeData(value: unknown): ValidationResult<z.infer<typeof createTradeDataSchema>>;
|
|
208
|
+
/**
|
|
209
|
+
* Validates buy tokens data
|
|
210
|
+
* Replaces: isBuyTokensData()
|
|
211
|
+
*/
|
|
212
|
+
export declare function validateBuyTokensData(value: unknown): ValidationResult<z.infer<typeof buyTokensDataSchema>>;
|
|
213
|
+
/**
|
|
214
|
+
* Validates sell tokens data
|
|
215
|
+
* Replaces: isSellTokensData()
|
|
216
|
+
*/
|
|
217
|
+
export declare function validateSellTokensData(value: unknown): ValidationResult<z.infer<typeof sellTokensDataSchema>>;
|
|
218
|
+
/**
|
|
219
|
+
* Validates get trade options
|
|
220
|
+
* Replaces: isGetTradeOptions()
|
|
221
|
+
*/
|
|
222
|
+
export declare function validateGetTradeOptions(value: unknown): ValidationResult<z.infer<typeof getTradeOptionsSchema>>;
|
|
223
|
+
/**
|
|
224
|
+
* Validates trade list params
|
|
225
|
+
* Replaces: isTradeListParams()
|
|
226
|
+
*/
|
|
227
|
+
export declare function validateTradeListParams(value: unknown): ValidationResult<z.infer<typeof tradeListParamsSchema>>;
|
|
228
|
+
/**
|
|
229
|
+
* Validates get amount options
|
|
230
|
+
* Replaces: isGetAmountOptions()
|
|
231
|
+
*/
|
|
232
|
+
export declare function validateGetAmountOptions(value: unknown): ValidationResult<z.infer<typeof getAmountOptionsSchema>>;
|
|
233
|
+
/**
|
|
234
|
+
* Validates calculate pre-mint data
|
|
235
|
+
* Replaces: isCalculatePreMintData()
|
|
236
|
+
*/
|
|
237
|
+
export declare function validateCalculatePreMintData(value: unknown): ValidationResult<z.infer<typeof calculatePreMintDataSchema>>;
|
|
238
|
+
/**
|
|
239
|
+
* Validates fetch pool details data
|
|
240
|
+
* Replaces: isFetchPoolDetailsData()
|
|
241
|
+
*/
|
|
242
|
+
export declare function validateFetchPoolDetailsData(value: unknown): ValidationResult<z.infer<typeof fetchPoolDetailsDataSchema>>;
|
|
243
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/schemas/validators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,EACvB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAMpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,gCAAgC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,qDAAqD;IACrD,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC9B;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAO1E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAO5E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAA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,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAO7G;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAO/G;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAO/G;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAOjH;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAOzH;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAOzH"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment Service
|
|
3
|
+
*
|
|
4
|
+
* Handles all comment-related operations including fetching and posting comments.
|
|
5
|
+
*
|
|
6
|
+
* @category Services
|
|
7
|
+
* @since 3.6.0
|
|
8
|
+
*/
|
|
9
|
+
import { HttpClient } from '../utils/http';
|
|
10
|
+
import { CommentsResult } from '../types/comment.dto';
|
|
11
|
+
import { FetchCommentsOptions, PostCommentOptions } from '../types/options.dto';
|
|
12
|
+
import { PoolService } from './PoolService';
|
|
13
|
+
/**
|
|
14
|
+
* Comment Service Class
|
|
15
|
+
*
|
|
16
|
+
* Provides methods for:
|
|
17
|
+
* - Fetching comments for tokens
|
|
18
|
+
* - Posting comments on tokens
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const commentService = new CommentService(httpClient, poolService);
|
|
23
|
+
*
|
|
24
|
+
* // Fetch first page of comments for a token
|
|
25
|
+
* const comments = await commentService.fetchComments({ tokenName: "dragnrkti" });
|
|
26
|
+
*
|
|
27
|
+
* // Post a comment
|
|
28
|
+
* await commentService.postComment({
|
|
29
|
+
* tokenName: "dragnrkti",
|
|
30
|
+
* content: "Great project!"
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class CommentService {
|
|
35
|
+
private readonly http;
|
|
36
|
+
private readonly poolService;
|
|
37
|
+
constructor(http: HttpClient, poolService: PoolService);
|
|
38
|
+
/**
|
|
39
|
+
* Fetches comments for a token by its tokenName
|
|
40
|
+
*
|
|
41
|
+
* This method provides a clean, intuitive API for fetching token comments
|
|
42
|
+
* using the token name. It automatically resolves the tokenName
|
|
43
|
+
* to the correct vault address internally.
|
|
44
|
+
*
|
|
45
|
+
* @param options Options for fetching comments
|
|
46
|
+
* @returns Promise<CommentsResult> Comments with pagination info
|
|
47
|
+
* @throws ValidationError if token name is invalid or not found
|
|
48
|
+
*/
|
|
49
|
+
fetchComments(options: FetchCommentsOptions): Promise<CommentsResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Posts a comment on a token by its tokenName
|
|
52
|
+
*
|
|
53
|
+
* This method provides a clean, intuitive API for posting comments on tokens
|
|
54
|
+
* using the token name. It automatically resolves the tokenName
|
|
55
|
+
* to the correct vault address and uses the authenticated user's wallet address.
|
|
56
|
+
*
|
|
57
|
+
* @param options Options for posting a comment
|
|
58
|
+
* @returns Promise<void> No return data
|
|
59
|
+
* @throws ValidationError if token name is invalid, not found, or content is invalid
|
|
60
|
+
*/
|
|
61
|
+
postComment(options: PostCommentOptions): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves a token name to its vault address by querying PoolService
|
|
64
|
+
*
|
|
65
|
+
* @private
|
|
66
|
+
* @param tokenName Token name to resolve
|
|
67
|
+
* @returns Promise<string | null> Vault address if found, null otherwise
|
|
68
|
+
*/
|
|
69
|
+
private resolveTokenNameToVault;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=CommentService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentService.d.ts","sourceRoot":"","sources":["../../src/services/CommentService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAEL,cAAc,EAMf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,WAAW;IAG3C;;;;;;;;;;OAUG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IA2E3E;;;;;;;;;;OAUG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmE7D;;;;;;OAMG;YACW,uBAAuB;CAsBtC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Faucet Service
|
|
3
|
+
*
|
|
4
|
+
* Handles faucet-related operations for transferring test tokens.
|
|
5
|
+
*
|
|
6
|
+
* @category Services
|
|
7
|
+
* @since 3.6.0
|
|
8
|
+
*/
|
|
9
|
+
import { HttpClient } from '../utils/http';
|
|
10
|
+
import { TransferFaucetsData } from '../types/user.dto';
|
|
11
|
+
/**
|
|
12
|
+
* Faucet Service Class
|
|
13
|
+
*
|
|
14
|
+
* Provides methods for:
|
|
15
|
+
* - Transferring faucet tokens to users
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const faucetService = new FaucetService(httpClient);
|
|
20
|
+
*
|
|
21
|
+
* // Transfer 1 token from faucet
|
|
22
|
+
* await faucetService.transferFaucets({
|
|
23
|
+
* walletAddress: "eth|1234567890abcdef1234567890abcdef12345678",
|
|
24
|
+
* amount: "1"
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class FaucetService {
|
|
29
|
+
private readonly http;
|
|
30
|
+
constructor(http: HttpClient);
|
|
31
|
+
/**
|
|
32
|
+
* Transfers faucets to a user address
|
|
33
|
+
*
|
|
34
|
+
* @param data Transfer faucets data
|
|
35
|
+
* @returns Promise<void> No return data - throws on failure
|
|
36
|
+
* @throws ValidationError if input validation fails
|
|
37
|
+
* @throws Error if transfer fails
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* await service.transferFaucets({
|
|
42
|
+
* walletAddress: "eth|1234567890abcdef1234567890abcdef12345678",
|
|
43
|
+
* amount: "1" // 1 token
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
transferFaucets(data: TransferFaucetsData): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Validates transfer faucets data
|
|
50
|
+
*
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private validateTransferFaucetsData;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=FaucetService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FaucetService.d.ts","sourceRoot":"","sources":["../../src/services/FaucetService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EACL,mBAAmB,EAIpB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB/D;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;CAiBpC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Service
|
|
3
|
+
*
|
|
4
|
+
* Handles all image upload operations for tokens and profiles.
|
|
5
|
+
*
|
|
6
|
+
* @category Services
|
|
7
|
+
* @since 3.6.0
|
|
8
|
+
*/
|
|
9
|
+
import { HttpClient } from '../utils/http';
|
|
10
|
+
import { UploadImageByTokenNameOptions } from '../types/options.dto';
|
|
11
|
+
/**
|
|
12
|
+
* Image Service Class
|
|
13
|
+
*
|
|
14
|
+
* Provides methods for:
|
|
15
|
+
* - Uploading token images
|
|
16
|
+
* - Image validation and processing
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const imageService = new ImageService(httpClient);
|
|
21
|
+
*
|
|
22
|
+
* // Upload token image
|
|
23
|
+
* const imageUrl = await imageService.uploadImageByTokenName({
|
|
24
|
+
* tokenName: 'mytoken',
|
|
25
|
+
* options: { file: imageFile, tokenName: 'mytoken' }
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class ImageService {
|
|
30
|
+
private readonly http;
|
|
31
|
+
constructor(http: HttpClient);
|
|
32
|
+
/**
|
|
33
|
+
* Uploads an image for a token pool
|
|
34
|
+
*
|
|
35
|
+
* Uploads a token image that will be used for branding and display purposes.
|
|
36
|
+
* Supports both browser File objects and Node.js Buffer objects for maximum
|
|
37
|
+
* compatibility across environments.
|
|
38
|
+
*
|
|
39
|
+
* File Requirements:
|
|
40
|
+
* - Format: PNG, JPG, JPEG, WebP
|
|
41
|
+
* - Size: Maximum 5MB
|
|
42
|
+
* - Dimensions: Recommended 512x512px or higher
|
|
43
|
+
* - Aspect ratio: Square (1:1) recommended
|
|
44
|
+
*
|
|
45
|
+
* @param options Upload configuration object
|
|
46
|
+
* @param options.file Image file as File object (browser) or Buffer (Node.js)
|
|
47
|
+
* @param options.tokenName Token name for the image (must be valid token name format)
|
|
48
|
+
* @returns Promise that resolves to image URL string
|
|
49
|
+
* @throws {ValidationError} If token name format is invalid
|
|
50
|
+
* @throws {FileValidationError} If file doesn't meet requirements
|
|
51
|
+
* @throws {Error} If upload fails due to network or server issues
|
|
52
|
+
*
|
|
53
|
+
* @example Browser file upload
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const fileInput = document.querySelector('#image-upload') as HTMLInputElement;
|
|
56
|
+
* const file = fileInput.files?.[0];
|
|
57
|
+
*
|
|
58
|
+
* if (file) {
|
|
59
|
+
* const imageUrl = await service.uploadImageByTokenName({
|
|
60
|
+
* file,
|
|
61
|
+
* tokenName: 'mytoken'
|
|
62
|
+
* });
|
|
63
|
+
* console.log('Image uploaded:', imageUrl);
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example Node.js buffer upload
|
|
68
|
+
* ```typescript
|
|
69
|
+
* import * as fs from 'fs';
|
|
70
|
+
*
|
|
71
|
+
* const imageBuffer = fs.readFileSync('./token-image.png');
|
|
72
|
+
* const imageUrl = await service.uploadImageByTokenName({
|
|
73
|
+
* file: imageBuffer,
|
|
74
|
+
* tokenName: 'mytoken'
|
|
75
|
+
* });
|
|
76
|
+
* console.log('Image URL:', imageUrl);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
uploadImageByTokenName(options: UploadImageByTokenNameOptions): Promise<string>;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=ImageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageService.d.ts","sourceRoot":"","sources":["../../src/services/ImageService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAErE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,sBAAsB,CAC1B,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,MAAM,CAAC;CA6DnB"}
|