@gala-chain/launchpad-sdk 0.4.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +628 -0
  3. package/dist/LaunchpadSDK.d.ts +573 -0
  4. package/dist/LaunchpadSDK.d.ts.map +1 -0
  5. package/dist/api/CommentAPI.d.ts +119 -0
  6. package/dist/api/CommentAPI.d.ts.map +1 -0
  7. package/dist/api/LaunchpadAPI.d.ts +440 -0
  8. package/dist/api/LaunchpadAPI.d.ts.map +1 -0
  9. package/dist/api/TradeAPI.d.ts +164 -0
  10. package/dist/api/TradeAPI.d.ts.map +1 -0
  11. package/dist/api/Trading.d.ts +176 -0
  12. package/dist/api/Trading.d.ts.map +1 -0
  13. package/dist/api/UserAPI.d.ts +426 -0
  14. package/dist/api/UserAPI.d.ts.map +1 -0
  15. package/dist/api/WebSocketAPI.d.ts +156 -0
  16. package/dist/api/WebSocketAPI.d.ts.map +1 -0
  17. package/dist/api/dto/BondingCurveDTOs.d.ts +142 -0
  18. package/dist/api/dto/BondingCurveDTOs.d.ts.map +1 -0
  19. package/dist/api/services/BundleService.d.ts +105 -0
  20. package/dist/api/services/BundleService.d.ts.map +1 -0
  21. package/dist/api/services/SignatureService.d.ts +71 -0
  22. package/dist/api/services/SignatureService.d.ts.map +1 -0
  23. package/dist/api/services/TokenClassKeyService.d.ts +116 -0
  24. package/dist/api/services/TokenClassKeyService.d.ts.map +1 -0
  25. package/dist/api/services/WebSocketManager.d.ts +99 -0
  26. package/dist/api/services/WebSocketManager.d.ts.map +1 -0
  27. package/dist/api/services/WebSocketService.d.ts +66 -0
  28. package/dist/api/services/WebSocketService.d.ts.map +1 -0
  29. package/dist/auth/SignatureAuth.d.ts +92 -0
  30. package/dist/auth/SignatureAuth.d.ts.map +1 -0
  31. package/dist/auth/types.d.ts +41 -0
  32. package/dist/auth/types.d.ts.map +1 -0
  33. package/dist/helpers/sdk.d.ts +75 -0
  34. package/dist/helpers/sdk.d.ts.map +1 -0
  35. package/dist/helpers/wallet.d.ts +60 -0
  36. package/dist/helpers/wallet.d.ts.map +1 -0
  37. package/dist/index.cjs.js +1 -0
  38. package/dist/index.d.ts +49 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.esm.js +1 -0
  41. package/dist/index.js +1 -0
  42. package/dist/types/comment.dto.d.ts +160 -0
  43. package/dist/types/comment.dto.d.ts.map +1 -0
  44. package/dist/types/common.d.ts +108 -0
  45. package/dist/types/common.d.ts.map +1 -0
  46. package/dist/types/dto.d.ts +145 -0
  47. package/dist/types/dto.d.ts.map +1 -0
  48. package/dist/types/launchpad.dto.d.ts +517 -0
  49. package/dist/types/launchpad.dto.d.ts.map +1 -0
  50. package/dist/types/launchpad.validation.d.ts +40 -0
  51. package/dist/types/launchpad.validation.d.ts.map +1 -0
  52. package/dist/types/trade.dto.d.ts +446 -0
  53. package/dist/types/trade.dto.d.ts.map +1 -0
  54. package/dist/types/user.dto.d.ts +330 -0
  55. package/dist/types/user.dto.d.ts.map +1 -0
  56. package/dist/utils/VaultCache.d.ts +73 -0
  57. package/dist/utils/VaultCache.d.ts.map +1 -0
  58. package/dist/utils/adapters.d.ts +111 -0
  59. package/dist/utils/adapters.d.ts.map +1 -0
  60. package/dist/utils/agent-config.d.ts +206 -0
  61. package/dist/utils/agent-config.d.ts.map +1 -0
  62. package/dist/utils/http.d.ts +85 -0
  63. package/dist/utils/http.d.ts.map +1 -0
  64. package/dist/utils/multipart.d.ts +60 -0
  65. package/dist/utils/multipart.d.ts.map +1 -0
  66. package/dist/utils/precision-math.d.ts +37 -0
  67. package/dist/utils/precision-math.d.ts.map +1 -0
  68. package/dist/utils/validation.d.ts +131 -0
  69. package/dist/utils/validation.d.ts.map +1 -0
  70. package/dist/utils/wallet.d.ts +174 -0
  71. package/dist/utils/wallet.d.ts.map +1 -0
  72. package/package.json +151 -0
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Trading API Controller - Bonding Curve Implementation
3
+ *
4
+ * This controller provides token trading operations using bonding curves for launchpad tokens.
5
+ * It uses the @gala-chain/connect ChainCallDTO system for proper EIP-712 signature generation
6
+ * and bundle transaction handling.
7
+ *
8
+ * ## Prerequisites:
9
+ * - Launchpad backend with bonding curve support
10
+ * - Bundle backend for transaction processing
11
+ * - WebSocket endpoint for transaction monitoring
12
+ *
13
+ * ## Four Trading Methods - Complete Coverage
14
+ *
15
+ * ### 1. buyNative() - Spend exact GALA amount
16
+ * - **Input**: Amount of GALA you want to spend
17
+ * - **Output**: Tokens you'll receive (calculated by bonding curve)
18
+ * - **Use case**: "I want to spend exactly 100 GALA to buy tokens"
19
+ * - **Method**: BuyWithNative
20
+ *
21
+ * ### 2. buyExact() - Buy exact token amount
22
+ * - **Input**: Exact amount of tokens you want to buy
23
+ * - **Output**: GALA cost (calculated by bonding curve)
24
+ * - **Use case**: "I want exactly 10 tokens, show me the GALA cost"
25
+ * - **Method**: BuyExactToken
26
+ *
27
+ * ### 3. sellExact() - Sell exact token amount
28
+ * - **Input**: Exact amount of tokens you want to sell
29
+ * - **Output**: GALA you'll receive (calculated by bonding curve)
30
+ * - **Use case**: "I want to sell exactly 100 tokens for GALA"
31
+ * - **Method**: SellExactToken
32
+ *
33
+ * ### 4. sellNative() - Receive exact GALA amount
34
+ * - **Input**: Amount of GALA you want to receive
35
+ * - **Output**: Tokens you need to sell (calculated by bonding curve)
36
+ * - **Use case**: "I want to get exactly 10 GALA, how many tokens do I sell?"
37
+ * - **Method**: SellWithNative
38
+ *
39
+ * ## Key Features:
40
+ * - EIP-712 signature generation for all wallet types
41
+ * - Bundle transaction processing with stringsInstructions
42
+ * - Slippage protection for all operations
43
+ * - WebSocket monitoring for transaction completion
44
+ * - Full compatibility with frontend implementation
45
+ *
46
+ * @category Trading
47
+ * @since 2.0.0
48
+ */
49
+ import { HttpClient } from '../utils/http';
50
+ import type { ApiResponse } from '../types/common';
51
+ import type { LaunchpadAPI } from './LaunchpadAPI';
52
+ export declare class Trading {
53
+ private walletProvider;
54
+ private userAddress;
55
+ private httpClient;
56
+ private debug;
57
+ private launchpadAPI?;
58
+ private signatureService;
59
+ private bundleService;
60
+ private tokenKeyService;
61
+ constructor(walletProvider: any, userAddress: string, httpClient: HttpClient, debug?: boolean, launchpadAPI?: LaunchpadAPI | undefined);
62
+ /**
63
+ * Buy tokens with unified, simplified API (replaces buyNativeByTokenName/buyExactByTokenName)
64
+ *
65
+ * @param tokenName Token name (e.g., "dragnrkti", "rocketri", "unicornri")
66
+ * @param options Trading options
67
+ * @param options.amount Amount to trade (GALA for 'native', tokens for 'exact')
68
+ * @param options.type Trading type: 'native' = spend GALA, 'exact' = buy exact tokens
69
+ * @param options.slippage Optional slippage percentage (default: 5%)
70
+ * @param options.buyerAddress Optional buyer address (defaults to authenticated user)
71
+ * @returns Promise<ApiResponse> Transaction result
72
+ * @throws ValidationError if parameters are invalid or token not found
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * // Buy tokens by spending exactly 100 GALA
77
+ * const result = await sdk.trading.buyToken("dragnrkti", {
78
+ * amount: "100",
79
+ * type: "native",
80
+ * slippage: 5
81
+ * });
82
+ *
83
+ * // Buy exactly 50 tokens
84
+ * const result = await sdk.trading.buyToken("dragnrkti", {
85
+ * amount: "50",
86
+ * type: "exact",
87
+ * slippage: 3
88
+ * });
89
+ * ```
90
+ */
91
+ buyToken(tokenName: string, options: {
92
+ amount: string;
93
+ type: 'native' | 'exact';
94
+ slippage?: number;
95
+ buyerAddress?: string;
96
+ }): Promise<ApiResponse>;
97
+ /**
98
+ * Sell tokens with unified, simplified API (replaces sellExactByTokenName/sellNativeByTokenName)
99
+ *
100
+ * @param tokenName Token name (e.g., "dragnrkti", "rocketri", "unicornri")
101
+ * @param options Trading options
102
+ * @param options.amount Amount to trade (tokens for 'exact', GALA for 'native')
103
+ * @param options.type Trading type: 'exact' = sell exact tokens, 'native' = receive exact GALA
104
+ * @param options.slippage Optional slippage percentage (default: 5%)
105
+ * @param options.sellerAddress Optional seller address (defaults to authenticated user)
106
+ * @returns Promise<ApiResponse> Transaction result
107
+ * @throws ValidationError if parameters are invalid or token not found
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * // Sell exactly 50 tokens
112
+ * const result = await sdk.trading.sellToken("dragnrkti", {
113
+ * amount: "50",
114
+ * type: "exact",
115
+ * slippage: 5
116
+ * });
117
+ *
118
+ * // Sell tokens to receive exactly 25 GALA
119
+ * const result = await sdk.trading.sellToken("dragnrkti", {
120
+ * amount: "25",
121
+ * type: "native",
122
+ * slippage: 3
123
+ * });
124
+ * ```
125
+ */
126
+ sellToken(tokenName: string, options: {
127
+ amount: string;
128
+ type: 'exact' | 'native';
129
+ slippage?: number;
130
+ sellerAddress?: string;
131
+ }): Promise<ApiResponse>;
132
+ /**
133
+ * Execute bundle transaction with signature generation
134
+ */
135
+ private executeBundleTransaction;
136
+ /**
137
+ * Get the authenticated user's address
138
+ */
139
+ getAddress(): string;
140
+ /**
141
+ * Extract token symbol from vault address
142
+ * Format: service|Token$Unit$SYMBOL$eth:address$launchpad
143
+ */
144
+ private extractTokenSymbolFromVault;
145
+ /**
146
+ * Validate token symbol format
147
+ */
148
+ private validateTokenSymbol;
149
+ /**
150
+ * Validate amount format
151
+ */
152
+ private validateAmount;
153
+ /**
154
+ * Validate vault address format
155
+ */
156
+ private validateVaultAddress;
157
+ /**
158
+ * Fetch real vault address for a token from the launchpad API
159
+ *
160
+ * @param tokenSymbol Token symbol to search for (e.g., 'ANIME')
161
+ * @returns Real vault address from the API or null if not found
162
+ */
163
+ fetchRealVaultAddress(tokenSymbol: string): Promise<string | null>;
164
+ /**
165
+ * Resolves a token name to its vault address using cached resolution
166
+ *
167
+ * Uses the shared VaultCache for intelligent caching to eliminate
168
+ * redundant API calls for the same tokenName.
169
+ *
170
+ * @private
171
+ * @param tokenName Token name to resolve (e.g., 'dragnrkti', 'rocketri')
172
+ * @returns Promise<string | null> Vault address if found, null otherwise
173
+ */
174
+ private resolveTokenNameToVault;
175
+ }
176
+ //# sourceMappingURL=Trading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Trading.d.ts","sourceRoot":"","sources":["../../src/api/Trading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,qBAAa,OAAO;IAMhB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,YAAY,CAAC;IATvB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,eAAe,CAAuB;gBAGpC,cAAc,EAAE,GAAG,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,UAAU,EACtB,KAAK,GAAE,OAAe,EACtB,YAAY,CAAC,EAAE,YAAY,YAAA;IAWrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE;QACzC,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,WAAW,CAAC;IAgExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE;QAC1C,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;QACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,WAAW,CAAC;IAyExB;;OAEG;YACW,wBAAwB;IA6DtC;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IAQnC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;OAKG;IACG,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAsGxE;;;;;;;;;OASG;YACW,uBAAuB;CAGtC"}
@@ -0,0 +1,426 @@
1
+ /**
2
+ * User API Controller
3
+ *
4
+ * This controller provides access to user-related operations including:
5
+ * - Token list retrieval with filtering
6
+ * - Faucet transfers
7
+ * - GALA balance fetching
8
+ *
9
+ * All methods include input validation and handle backend type inconsistencies.
10
+ */
11
+ import { HttpClient } from '../utils/http';
12
+ import { GetTokenListOptions, GetTokenListResponse, TransferFaucetsData, TransferFaucetsResponse, FetchGalaBalanceOptions, FetchGalaBalanceResponse, UpdateProfileData, UpdateProfileResponse, UploadProfileImageOptions, UploadProfileImageResponse, GetTokenBalanceResponse, UserTokenType } from '../types/user.dto';
13
+ /**
14
+ * User API controller for user operations
15
+ *
16
+ * Provides methods for:
17
+ * - Fetching user token lists with optional filtering
18
+ * - Transferring faucets to users
19
+ * - Retrieving GALA balance for users
20
+ * - Updating user profiles
21
+ * - Uploading profile images
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Get user's token list with filtering
26
+ * const tokens = await sdk.user.getTokenList({
27
+ * type: "DEFI",
28
+ * search: "gala",
29
+ * page: 1,
30
+ * limit: 10
31
+ * });
32
+ *
33
+ * // Transfer faucets to user
34
+ * const transferResult = await sdk.user.transferFaucets({
35
+ * userAddress: "eth|1234567890abcdef1234567890abcdef12345678",
36
+ * amount: "1000000000000000000" // 1 token with 18 decimals
37
+ * });
38
+ *
39
+ * // Get user's GALA balance
40
+ * const balance = await sdk.user.getGalaBalance({
41
+ * userAddress: "eth|1234567890abcdef1234567890abcdef12345678"
42
+ * });
43
+ *
44
+ * // Update user profile
45
+ * const updateResult = await sdk.user.updateProfile({
46
+ * profileImage: "https://example.com/avatar.jpg",
47
+ * fullName: "John Doe",
48
+ * userAddress: "eth|1234567890abcdef1234567890abcdef12345678"
49
+ * });
50
+ * ```
51
+ */
52
+ export declare class UserAPI {
53
+ private readonly http;
54
+ constructor(http: HttpClient);
55
+ /**
56
+ * Fetches user token list with optional filtering and pagination
57
+ *
58
+ * ✅ VERIFIED: Real API payload confirmed - endpoint /user/token-created
59
+ *
60
+ * @param options Filtering and pagination options
61
+ * @returns Promise<GetTokenListResponse> Token list with pagination
62
+ * @throws ValidationError if input validation fails
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * // Get all user tokens with pagination
67
+ * const tokens = await userAPI.getTokenList({
68
+ * page: 1,
69
+ * limit: 10
70
+ * });
71
+ *
72
+ * // Get filtered tokens by type
73
+ * const defiTokens = await userAPI.getTokenList({
74
+ * type: "DEFI",
75
+ * page: 1,
76
+ * limit: 5
77
+ * });
78
+ *
79
+ * // Search for specific tokens
80
+ * const searchResults = await userAPI.getTokenList({
81
+ * search: "gala",
82
+ * page: 1,
83
+ * limit: 20
84
+ * });
85
+ * ```
86
+ */
87
+ getTokenList(options: GetTokenListOptions): Promise<GetTokenListResponse>;
88
+ /**
89
+ * Fetches tokens held by user (balances)
90
+ *
91
+ * ✅ VERIFIED: Real API payload confirmed - endpoint /user/token-hold
92
+ *
93
+ * @param options Token held filtering options
94
+ * @returns Promise<GetTokenListResponse> Tokens held with pagination
95
+ * @throws ValidationError if input validation fails
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * // Get tokens held by user
100
+ * const heldTokens = await userAPI.getTokensHeld({
101
+ * address: "eth|1234567890abcdef1234567890abcdef12345678",
102
+ * page: 1,
103
+ * limit: 10
104
+ * });
105
+ * ```
106
+ */
107
+ getTokensHeld(options: GetTokenListOptions): Promise<GetTokenListResponse>;
108
+ /**
109
+ * Gets token balance for a specific wallet address
110
+ *
111
+ * ✅ VERIFIED: Real API payload confirmed - endpoint /user/token-list with tokenName parameter
112
+ *
113
+ * @param tokenName Token name to check balance for
114
+ * @param walletAddress Wallet address to check (in backend format eth|[40-hex-chars])
115
+ * @param type Token type to filter by (default: 'DEFI')
116
+ * @returns Promise<GetTokenBalanceResponse> Token balance information or empty if not held
117
+ * @throws ValidationError if input validation fails
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * // Check if wallet holds specific token
122
+ * const balance = await userAPI.getTokenBalance(
123
+ * "WB",
124
+ * "eth|5AD173F004990940b20e7A5C64C72E8b6B91a783",
125
+ * "DEFI"
126
+ * );
127
+ *
128
+ * // Response contains balance details or empty data if not held
129
+ * if (balance.data?.count > 0) {
130
+ * console.log(`Wallet holds ${balance.data.token[0].quantity} ${balance.data.token[0].symbol}`);
131
+ * } else {
132
+ * console.log('Wallet does not hold this token');
133
+ * }
134
+ * ```
135
+ */
136
+ getTokenBalanceByTokenName(tokenName: string, walletAddress: string, type?: UserTokenType): Promise<GetTokenBalanceResponse>;
137
+ /**
138
+ * Transfers faucets to a user address
139
+ *
140
+ * @param data Transfer faucets data
141
+ * @returns Promise<TransferFaucetsResponse> Transfer result
142
+ * @throws ValidationError if input validation fails
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * const transferData = {
147
+ * userAddress: "eth|1234567890abcdef1234567890abcdef12345678",
148
+ * amount: "1000000000000000000" // 1 token with 18 decimals
149
+ * };
150
+ * const result = await userAPI.transferFaucets(transferData);
151
+ * if (result.status === 200 && !result.error) {
152
+ * console.log('Transfer successful:', result.message);
153
+ * }
154
+ * ```
155
+ */
156
+ transferFaucets(data: TransferFaucetsData): Promise<TransferFaucetsResponse>;
157
+ /**
158
+ * Fetches user profile information
159
+ *
160
+ * ✅ VERIFIED: Real API payload confirmed - endpoint /user/profile (GET)
161
+ *
162
+ * @param walletAddress Optional wallet address (defaults to SDK wallet address)
163
+ * @returns Promise<any> User profile information
164
+ * @throws ValidationError if input validation fails
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * // Get current user's profile
169
+ * const profile = await userAPI.getProfile();
170
+ *
171
+ * // Get specific user's profile
172
+ * const otherProfile = await userAPI.getProfile("eth|1234567890abcdef1234567890abcdef12345678");
173
+ * ```
174
+ */
175
+ getProfile(walletAddress?: string): Promise<any>;
176
+ /**
177
+ * Fetches GALA balance for a user address
178
+ *
179
+ * ✅ VERIFIED: Real API payload confirmed - endpoint /user/fetch-gala-balance
180
+ *
181
+ * @param options GALA balance fetch options
182
+ * @returns Promise<FetchGalaBalanceResponse> Balance information
183
+ * @throws ValidationError if input validation fails
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * const balanceOptions = {
188
+ * userAddress: "eth|1234567890abcdef1234567890abcdef12345678"
189
+ * };
190
+ * const balance = await userAPI.getGalaBalance(balanceOptions);
191
+ * ```
192
+ */
193
+ getGalaBalance(options: FetchGalaBalanceOptions): Promise<FetchGalaBalanceResponse>;
194
+ /**
195
+ * Updates user profile information
196
+ *
197
+ * ✅ VERIFIED: Real API payload confirmed - endpoint /user/profile (PUT)
198
+ *
199
+ * **Smart Image Preservation**: If profileImage is empty or not provided,
200
+ * the method automatically fetches and preserves the existing profile image
201
+ * to prevent accidental image loss.
202
+ *
203
+ * @param data Profile update data
204
+ * @returns Promise<UpdateProfileResponse> Update result
205
+ * @throws ValidationError if input validation fails
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * // Update with new image
210
+ * const profileData = {
211
+ * profileImage: "https://example.com/avatar.jpg",
212
+ * fullName: "John Doe",
213
+ * userAddress: "eth|1234567890abcdef1234567890abcdef12345678"
214
+ * };
215
+ * const result = await userAPI.updateProfile(profileData);
216
+ *
217
+ * // Update name only - existing image will be preserved automatically
218
+ * const nameOnlyUpdate = {
219
+ * profileImage: "", // or omit entirely
220
+ * fullName: "Jane Doe",
221
+ * userAddress: "eth|1234567890abcdef1234567890abcdef12345678"
222
+ * };
223
+ * const result2 = await userAPI.updateProfile(nameOnlyUpdate);
224
+ * ```
225
+ */
226
+ updateProfile(data: UpdateProfileData): Promise<UpdateProfileResponse>;
227
+ /**
228
+ * Uploads a profile image and returns the image URL
229
+ *
230
+ * ✅ VERIFIED: Real API payload confirmed - endpoint /launchpad/upload-image (for profile)
231
+ *
232
+ * @param options Profile image upload options
233
+ * @returns Promise<UploadProfileImageResponse> Upload result with image URL
234
+ * @throws ValidationError if input validation fails
235
+ *
236
+ * @example
237
+ * ```typescript
238
+ * // Upload profile image file
239
+ * const fileInput = document.getElementById('avatar') as HTMLInputElement;
240
+ * const file = fileInput.files[0];
241
+ * const uploadResult = await userAPI.uploadProfileImage({
242
+ * file: file,
243
+ * walletAddress: "eth|1234567890abcdef1234567890abcdef12345678"
244
+ * });
245
+ *
246
+ * // Use the uploaded image URL in profile update
247
+ * await userAPI.updateProfile({
248
+ * profileImage: uploadResult.data?.imageUrl,
249
+ * fullName: "John Doe",
250
+ * walletAddress: "eth|1234567890abcdef1234567890abcdef12345678"
251
+ * });
252
+ * ```
253
+ */
254
+ uploadProfileImage(options: UploadProfileImageOptions): Promise<UploadProfileImageResponse>;
255
+ /**
256
+ * Validates get token list options
257
+ */
258
+ private validateGetTokenListOptions;
259
+ /**
260
+ * Validates transfer faucets data
261
+ */
262
+ private validateTransferFaucetsData;
263
+ /**
264
+ * Validates fetch GALA balance options
265
+ */
266
+ private validateFetchGalaBalanceOptions;
267
+ /**
268
+ * Validates update profile data
269
+ */
270
+ private validateUpdateProfileData;
271
+ /**
272
+ * Validates upload profile image options
273
+ */
274
+ private validateUploadProfileImageOptions;
275
+ /**
276
+ * Validates pagination parameters
277
+ */
278
+ private validatePagination;
279
+ /**
280
+ * Builds query parameters for token list fetching
281
+ * Note: GET /user/token-list expects page/limit as STRINGS (backend quirk)
282
+ */
283
+ private buildTokenListQueryParams;
284
+ /**
285
+ * Builds query parameters for token hold endpoint (excludes type parameter)
286
+ *
287
+ * @param options GetTokenListOptions
288
+ * @returns Record<string, any> Query parameters for backend
289
+ */
290
+ private buildTokenHoldQueryParams;
291
+ /**
292
+ * Gets all tokens for current user (convenience method)
293
+ *
294
+ * @param page Page number (default: 1)
295
+ * @param limit Items per page (default: 10)
296
+ * @returns Promise<GetTokenListResponse> All tokens for the user
297
+ */
298
+ getAllTokens(page?: number, limit?: number): Promise<GetTokenListResponse>;
299
+ /**
300
+ * Gets tokens created by current user (convenience method)
301
+ *
302
+ * @param page Page number (default: 1)
303
+ * @param limit Items per page (default: 10)
304
+ * @returns Promise<GetTokenListResponse> Tokens created by the user
305
+ */
306
+ getCreatedTokens(page?: number, limit?: number): Promise<GetTokenListResponse>;
307
+ /**
308
+ * Gets tokens owned by current user (convenience method)
309
+ *
310
+ * @param page Page number (default: 1)
311
+ * @param limit Items per page (default: 10)
312
+ * @returns Promise<GetTokenListResponse> Tokens owned by the user
313
+ */
314
+ getOwnedTokens(page?: number, limit?: number): Promise<GetTokenListResponse>;
315
+ /**
316
+ * Searches for tokens by name or symbol (convenience method)
317
+ *
318
+ * @param searchQuery Search query
319
+ * @param page Page number (default: 1)
320
+ * @param limit Items per page (default: 10)
321
+ * @returns Promise<GetTokenListResponse> Search results
322
+ */
323
+ searchTokens(searchQuery: string, page?: number, limit?: number): Promise<GetTokenListResponse>;
324
+ /**
325
+ * Gets tokens for a specific address (convenience method)
326
+ *
327
+ * @param userAddress User address to get tokens for
328
+ * @param page Page number (default: 1)
329
+ * @param limit Items per page (default: 10)
330
+ * @returns Promise<GetTokenListResponse> Tokens for the address
331
+ */
332
+ getTokensForAddress(userAddress: string, page?: number, limit?: number): Promise<GetTokenListResponse>;
333
+ /**
334
+ * Checks if a wallet holds a specific token (convenience method)
335
+ *
336
+ * @param tokenName Token name to check
337
+ * @param walletAddress Wallet address to check
338
+ * @param type Token type (default: 'DEFI')
339
+ * @returns Promise<boolean> True if wallet holds the token
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * const hasWBToken = await userAPI.hasToken(
344
+ * "WB",
345
+ * "eth|5AD173F004990940b20e7A5C64C72E8b6B91a783"
346
+ * );
347
+ * ```
348
+ */
349
+ hasTokenByTokenName(tokenName: string, walletAddress: string, type?: UserTokenType): Promise<boolean>;
350
+ /**
351
+ * Gets token balance for the current SDK wallet (convenience method)
352
+ *
353
+ * @param tokenName Token name to check balance for
354
+ * @param type Token type (default: 'DEFI')
355
+ * @returns Promise<GetTokenBalanceResponse> Token balance for current wallet
356
+ *
357
+ * @example
358
+ * ```typescript
359
+ * const balance = await userAPI.getOwnTokenBalance("WB");
360
+ * if (balance.data?.count > 0) {
361
+ * console.log(`I hold ${balance.data.token[0].quantity} WB tokens`);
362
+ * }
363
+ * ```
364
+ */
365
+ getOwnTokenBalance(tokenName: string, type?: UserTokenType): Promise<GetTokenBalanceResponse>;
366
+ /**
367
+ * Gets just the token quantity for a wallet (convenience method)
368
+ *
369
+ * @param tokenName Token name to check
370
+ * @param walletAddress Wallet address to check
371
+ * @param type Token type (default: 'DEFI')
372
+ * @returns Promise<string> Token quantity as decimal string, '0' if not held
373
+ *
374
+ * @example
375
+ * ```typescript
376
+ * const quantity = await userAPI.getTokenQuantity(
377
+ * "WB",
378
+ * "eth|5AD173F004990940b20e7A5C64C72E8b6B91a783"
379
+ * );
380
+ * console.log(`Wallet holds ${quantity} WB tokens`);
381
+ * ```
382
+ */
383
+ getTokenQuantity(tokenName: string, walletAddress: string, type?: UserTokenType): Promise<string>;
384
+ /**
385
+ * Gets the authenticated user's address in backend format
386
+ *
387
+ * @returns Address in eth|{40-hex-chars} format
388
+ */
389
+ getAddress(): string;
390
+ /**
391
+ * Validates a user address format (exposed for external validation)
392
+ *
393
+ * @param userAddress User address to validate
394
+ * @returns True if valid user address format
395
+ */
396
+ validateUserAddress(userAddress: string): boolean;
397
+ /**
398
+ * Validates a token type (exposed for external validation)
399
+ *
400
+ * @param tokenType Token type to validate
401
+ * @returns True if valid token type
402
+ */
403
+ validateTokenType(tokenType: string): boolean;
404
+ /**
405
+ * Validates a search query (exposed for external validation)
406
+ *
407
+ * @param searchQuery Search query to validate
408
+ * @returns True if valid search query
409
+ */
410
+ validateSearchQuery(searchQuery: string): boolean;
411
+ /**
412
+ * Validates a token name for user operations (exposed for external validation)
413
+ *
414
+ * @param tokenName Token name to validate
415
+ * @returns True if valid token name
416
+ */
417
+ validateTokenName(tokenName: string): boolean;
418
+ /**
419
+ * Validates a full name (exposed for external validation)
420
+ *
421
+ * @param fullName Full name to validate
422
+ * @returns True if valid full name
423
+ */
424
+ validateFullName(fullName: string): boolean;
425
+ }
426
+ //# sourceMappingURL=UserAPI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserAPI.d.ts","sourceRoot":"","sources":["../../src/api/UserAPI.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EAEpB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EAad,MAAM,mBAAmB,CAAC;AAO3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAU/E;;;;;;;;;;;;;;;;;;OAkBG;IACG,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAUhF;;;;;;;;;;;;;;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