@smoothsend/sdk 2.2.1 → 2.2.3

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 (81) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +349 -349
  3. package/dist/aptos/index.cjs +1256 -0
  4. package/dist/aptos/index.cjs.map +1 -0
  5. package/dist/aptos/index.d.ts +783 -0
  6. package/dist/aptos/index.js +1230 -0
  7. package/dist/aptos/index.js.map +1 -0
  8. package/dist/aptos-entry.d.ts +36 -0
  9. package/dist/aptos-entry.d.ts.map +1 -0
  10. package/dist/avax/SmoothSendAvaxSubmitter.d.ts +79 -0
  11. package/dist/avax/SmoothSendAvaxSubmitter.d.ts.map +1 -0
  12. package/dist/avax/index.cjs +1869 -0
  13. package/dist/avax/index.cjs.map +1 -0
  14. package/dist/avax/index.d.ts +306 -0
  15. package/dist/avax/index.d.ts.map +1 -0
  16. package/dist/avax/index.js +1849 -0
  17. package/dist/avax/index.js.map +1 -0
  18. package/dist/avax/publicAaDefaults.d.ts +16 -0
  19. package/dist/avax/publicAaDefaults.d.ts.map +1 -0
  20. package/dist/avax/simpleAccountFactory.d.ts +44 -0
  21. package/dist/avax/simpleAccountFactory.d.ts.map +1 -0
  22. package/dist/avax/types.d.ts +86 -0
  23. package/dist/avax/types.d.ts.map +1 -0
  24. package/dist/avax/useSmoothSendAvax.d.ts +60 -0
  25. package/dist/avax/useSmoothSendAvax.d.ts.map +1 -0
  26. package/dist/avax/viemHelpers.d.ts +40 -0
  27. package/dist/avax/viemHelpers.d.ts.map +1 -0
  28. package/dist/avax-entry.d.ts +24 -0
  29. package/dist/avax-entry.d.ts.map +1 -0
  30. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs +1519 -0
  31. package/dist/chunks/SmoothSendSDK-C_ofuBkk.cjs.map +1 -0
  32. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js +1511 -0
  33. package/dist/chunks/SmoothSendSDK-CaV_PCIG.js.map +1 -0
  34. package/dist/chunks/SmoothSendSDK.d-9GBgZONY.d.ts +262 -0
  35. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs +1237 -0
  36. package/dist/chunks/TrueGaslessClient-DThO4Tpb.cjs.map +1 -0
  37. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js +1228 -0
  38. package/dist/chunks/TrueGaslessClient-l2uFvNAa.js.map +1 -0
  39. package/dist/chunks/shared-CNF22ESH.js +557 -0
  40. package/dist/chunks/shared-CNF22ESH.js.map +1 -0
  41. package/dist/chunks/shared-CaQMAGQR.js +1511 -0
  42. package/dist/chunks/shared-CaQMAGQR.js.map +1 -0
  43. package/dist/chunks/shared-Cn4duBJT.d.ts +1279 -0
  44. package/dist/chunks/shared-DEurKmpI.cjs +1519 -0
  45. package/dist/chunks/shared-DEurKmpI.cjs.map +1 -0
  46. package/dist/chunks/shared-RVkwmkG7.d.ts +262 -0
  47. package/dist/chunks/shared-x1-VC-Li.cjs +568 -0
  48. package/dist/chunks/shared-x1-VC-Li.cjs.map +1 -0
  49. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs +1865 -0
  50. package/dist/chunks/useSmoothSendAvax-BHeW_6x8.cjs.map +1 -0
  51. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js +1848 -0
  52. package/dist/chunks/useSmoothSendAvax-ZuHw1aYi.js.map +1 -0
  53. package/dist/chunks/version-CNF22ESH.js +557 -0
  54. package/dist/chunks/version-CNF22ESH.js.map +1 -0
  55. package/dist/chunks/version-x1-VC-Li.cjs +568 -0
  56. package/dist/chunks/version-x1-VC-Li.cjs.map +1 -0
  57. package/dist/chunks/version.d-Cn4duBJT.d.ts +1279 -0
  58. package/dist/index.cjs +5209 -0
  59. package/dist/index.cjs.map +1 -0
  60. package/dist/index.d.ts +11 -2552
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.esm.js +1846 -3
  63. package/dist/index.esm.js.map +1 -1
  64. package/dist/index.js +1880 -62
  65. package/dist/index.js.map +1 -1
  66. package/dist/stellar/index.cjs +27 -0
  67. package/dist/stellar/index.cjs.map +1 -0
  68. package/dist/stellar/index.d.ts +214 -0
  69. package/dist/stellar/index.js +3 -0
  70. package/dist/stellar/index.js.map +1 -0
  71. package/dist/stellar-entry.d.ts +37 -0
  72. package/dist/stellar-entry.d.ts.map +1 -0
  73. package/dist/version.d.ts +2 -0
  74. package/dist/version.d.ts.map +1 -0
  75. package/package.json +120 -110
  76. package/dist/adapters/evm.d.ts +0 -39
  77. package/dist/adapters/evm.d.ts.map +0 -1
  78. package/dist/config/chains.d.ts +0 -7
  79. package/dist/config/chains.d.ts.map +0 -1
  80. package/dist/services/chainConfigService.d.ts +0 -49
  81. package/dist/services/chainConfigService.d.ts.map +0 -1
@@ -0,0 +1,1279 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+
3
+ /**
4
+ * Error handling system for SmoothSend SDK v2
5
+ * Provides typed error classes for different failure scenarios
6
+ *
7
+ * @remarks
8
+ * All SDK errors extend SmoothSendError for consistent error handling
9
+ * Use instanceof checks to handle specific error types
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * try {
14
+ * await sdk.transfer(request, wallet);
15
+ * } catch (error) {
16
+ * if (error instanceof AuthenticationError) {
17
+ * console.error('Invalid API key');
18
+ * } else if (error instanceof RateLimitError) {
19
+ * console.error('Rate limit exceeded');
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ /**
25
+ * Base error class for all SmoothSend SDK errors
26
+ *
27
+ * @remarks
28
+ * All SDK-specific errors extend this class
29
+ * Contains error code, HTTP status code, and additional details
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * throw new SmoothSendError(
34
+ * 'Something went wrong',
35
+ * 'CUSTOM_ERROR',
36
+ * 500,
37
+ * { additionalInfo: 'details' }
38
+ * );
39
+ * ```
40
+ */
41
+ declare class SmoothSendError extends Error {
42
+ code: string;
43
+ statusCode?: number | undefined;
44
+ details?: any | undefined;
45
+ /**
46
+ * Creates a new SmoothSendError
47
+ *
48
+ * @param message - Human-readable error message
49
+ * @param code - Error code for programmatic handling
50
+ * @param statusCode - HTTP status code (if applicable)
51
+ * @param details - Additional error details
52
+ */
53
+ constructor(message: string, code: string, statusCode?: number | undefined, details?: any | undefined);
54
+ }
55
+ /**
56
+ * Authentication error - thrown when API key is invalid, missing, or expired
57
+ *
58
+ * @remarks
59
+ * HTTP Status Code: 401
60
+ * Indicates authentication failure with the proxy worker
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * try {
65
+ * await sdk.transfer(request, wallet);
66
+ * } catch (error) {
67
+ * if (error instanceof AuthenticationError) {
68
+ * console.error('Invalid API key:', error.message);
69
+ * console.log('Get a new key at:', error.details.suggestion);
70
+ * }
71
+ * }
72
+ * ```
73
+ */
74
+ declare class AuthenticationError extends SmoothSendError {
75
+ /**
76
+ * Creates a new AuthenticationError
77
+ *
78
+ * @param message - Human-readable error message
79
+ * @param details - Additional error details
80
+ */
81
+ constructor(message: string, details?: any);
82
+ }
83
+ /**
84
+ * Rate limit error - thrown when request rate limit is exceeded
85
+ *
86
+ * @remarks
87
+ * HTTP Status Code: 429
88
+ * Contains rate limit details including reset time
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * try {
93
+ * await sdk.transfer(request, wallet);
94
+ * } catch (error) {
95
+ * if (error instanceof RateLimitError) {
96
+ * console.error('Rate limit exceeded');
97
+ * console.log(`Limit: ${error.limit}`);
98
+ * console.log(`Remaining: ${error.remaining}`);
99
+ * console.log(`Resets at: ${error.resetTime}`);
100
+ * }
101
+ * }
102
+ * ```
103
+ */
104
+ declare class RateLimitError extends SmoothSendError {
105
+ limit: number;
106
+ remaining: number;
107
+ resetTime: string;
108
+ /**
109
+ * Creates a new RateLimitError
110
+ *
111
+ * @param message - Human-readable error message
112
+ * @param limit - Maximum requests allowed per period
113
+ * @param remaining - Remaining requests in current period
114
+ * @param resetTime - When the rate limit resets (ISO 8601 timestamp)
115
+ */
116
+ constructor(message: string, limit: number, remaining: number, resetTime: string);
117
+ }
118
+ /**
119
+ * Validation error - thrown when request parameters are invalid
120
+ *
121
+ * @remarks
122
+ * HTTP Status Code: 400
123
+ * Contains field name that failed validation
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * try {
128
+ * await sdk.transfer(request, wallet);
129
+ * } catch (error) {
130
+ * if (error instanceof ValidationError) {
131
+ * console.error(`Invalid ${error.field}:`, error.message);
132
+ * }
133
+ * }
134
+ * ```
135
+ */
136
+ declare class ValidationError extends SmoothSendError {
137
+ field: string;
138
+ /**
139
+ * Creates a new ValidationError
140
+ *
141
+ * @param message - Human-readable error message
142
+ * @param field - Name of the field that failed validation
143
+ * @param details - Additional error details
144
+ */
145
+ constructor(message: string, field: string, details?: any);
146
+ }
147
+ /**
148
+ * Network error - thrown when network connectivity issues occur
149
+ *
150
+ * @remarks
151
+ * HTTP Status Code: 0 (no HTTP response)
152
+ * Indicates network connectivity problems
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * try {
157
+ * await sdk.transfer(request, wallet);
158
+ * } catch (error) {
159
+ * if (error instanceof NetworkError) {
160
+ * console.error('Network error:', error.message);
161
+ * console.log('Original error:', error.originalError);
162
+ * }
163
+ * }
164
+ * ```
165
+ */
166
+ declare class NetworkError extends SmoothSendError {
167
+ originalError?: Error | undefined;
168
+ /**
169
+ * Creates a new NetworkError
170
+ *
171
+ * @param message - Human-readable error message
172
+ * @param originalError - Original error that caused the network failure
173
+ */
174
+ constructor(message: string, originalError?: Error | undefined);
175
+ }
176
+ /**
177
+ * Helper function to create appropriate error from HTTP response
178
+ *
179
+ * @remarks
180
+ * Parses HTTP error response and creates typed error object
181
+ * Used internally by HTTP client
182
+ *
183
+ * @param statusCode - HTTP status code
184
+ * @param errorData - Error response data from API
185
+ * @param defaultMessage - Default message if none provided in response
186
+ * @returns Typed error object
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * const error = createErrorFromResponse(401, {
191
+ * error: 'Invalid API key',
192
+ * details: { field: 'apiKey' }
193
+ * });
194
+ * throw error;
195
+ * ```
196
+ */
197
+ declare function createErrorFromResponse(statusCode: number, errorData: any, defaultMessage?: string): SmoothSendError;
198
+ /**
199
+ * Helper function to create network error from exception
200
+ *
201
+ * @remarks
202
+ * Wraps generic exceptions in NetworkError for consistent error handling
203
+ * Used internally by HTTP client
204
+ *
205
+ * @param error - Original error or exception
206
+ * @returns NetworkError instance
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * try {
211
+ * await fetch(url);
212
+ * } catch (error) {
213
+ * throw createNetworkError(error);
214
+ * }
215
+ * ```
216
+ */
217
+ declare function createNetworkError(error: any): NetworkError;
218
+
219
+ /**
220
+ * Supported blockchain chains in the SmoothSend SDK
221
+ *
222
+ * @remarks
223
+ * - `avalanche`: Avalanche C-Chain (EVM-compatible)
224
+ * - `aptos-testnet`: Aptos testnet
225
+ * - `aptos-mainnet`: Aptos mainnet
226
+ */
227
+ type SupportedChain = 'avalanche' | 'aptos-testnet' | 'aptos-mainnet' | 'stellar-testnet' | 'stellar-mainnet';
228
+ /**
229
+ * Chain ecosystem types for routing to correct relayers
230
+ *
231
+ * @remarks
232
+ * - `evm`: Ethereum Virtual Machine compatible chains (Avalanche, Base, Arbitrum, etc.)
233
+ * - `aptos`: Aptos blockchain ecosystem
234
+ * - `stellar`: Stellar blockchain ecosystem
235
+ */
236
+ type ChainEcosystem = 'evm' | 'aptos' | 'stellar';
237
+ /**
238
+ * Mapping of supported chains to their respective ecosystems
239
+ * Used internally for adapter selection and routing
240
+ */
241
+ declare const CHAIN_ECOSYSTEM_MAP: Record<SupportedChain, ChainEcosystem>;
242
+ /**
243
+ * Base success response structure
244
+ * All successful API responses extend this interface
245
+ */
246
+ interface SuccessResponse {
247
+ /** Indicates the request was successful */
248
+ success: true;
249
+ }
250
+ /**
251
+ * Base error response structure
252
+ * All error API responses extend this interface
253
+ */
254
+ interface ErrorResponse {
255
+ /** Indicates the request failed */
256
+ success: false;
257
+ /** Human-readable error message */
258
+ error: string;
259
+ /** Additional error details or validation errors */
260
+ details?: string[];
261
+ /** Unique request identifier for debugging */
262
+ requestId?: string;
263
+ }
264
+ /**
265
+ * Chain information structure
266
+ * Contains metadata about a supported blockchain
267
+ */
268
+ interface ChainInfo {
269
+ /** Chain identifier (e.g., 'aptos-testnet') */
270
+ name: string;
271
+ /** Human-readable chain name */
272
+ displayName: string;
273
+ /** Numeric chain ID */
274
+ chainId: number;
275
+ /** Block explorer base URL */
276
+ explorerUrl: string;
277
+ /** List of supported token symbols */
278
+ tokens: string[];
279
+ }
280
+ /**
281
+ * Token information structure
282
+ * Contains metadata about a supported token
283
+ */
284
+ interface TokenInfo {
285
+ /** Token symbol (e.g., 'USDC') */
286
+ symbol: string;
287
+ /** Token contract address */
288
+ address: string;
289
+ /** Number of decimal places */
290
+ decimals: number;
291
+ /** Full token name */
292
+ name: string;
293
+ }
294
+ /**
295
+ * Chain configuration structure
296
+ * Complete configuration for a blockchain network
297
+ */
298
+ interface ChainConfig {
299
+ /** Chain identifier */
300
+ name: string;
301
+ /** Human-readable chain name */
302
+ displayName: string;
303
+ /** Numeric chain ID */
304
+ chainId: number;
305
+ /** RPC endpoint URL */
306
+ rpcUrl: string;
307
+ /** Relayer service URL */
308
+ relayerUrl: string;
309
+ /** Block explorer base URL */
310
+ explorerUrl: string;
311
+ /** List of supported token symbols */
312
+ tokens: string[];
313
+ /** Native currency information */
314
+ nativeCurrency: {
315
+ /** Currency name */
316
+ name: string;
317
+ /** Currency symbol */
318
+ symbol: string;
319
+ /** Number of decimal places */
320
+ decimals: number;
321
+ };
322
+ }
323
+ /**
324
+ * Transfer request parameters
325
+ * Used to initiate a gasless token transfer
326
+ *
327
+ * @example
328
+ * ```typescript
329
+ * const request: TransferRequest = {
330
+ * from: '0x123...',
331
+ * to: '0x456...',
332
+ * token: 'USDC',
333
+ * amount: '1000000', // 1 USDC (6 decimals)
334
+ * chain: 'aptos-testnet'
335
+ * };
336
+ * ```
337
+ */
338
+ interface TransferRequest {
339
+ /** Sender's wallet address */
340
+ from: string;
341
+ /** Recipient's wallet address */
342
+ to: string;
343
+ /** Token symbol or contract address */
344
+ token: string;
345
+ /** Amount in smallest unit (wei, octas, etc.) */
346
+ amount: string;
347
+ /** Target blockchain */
348
+ chain: SupportedChain;
349
+ }
350
+ /**
351
+ * Transfer quote response from API
352
+ * Contains fee information for a transfer
353
+ */
354
+ interface TransferQuoteResponse extends SuccessResponse {
355
+ /** Chain identifier */
356
+ chainName: string;
357
+ /** Token symbol */
358
+ token: string;
359
+ /** Transfer amount */
360
+ amount: string;
361
+ /** Relayer fee amount */
362
+ relayerFee: string;
363
+ /** Total amount (amount + fee) */
364
+ total: string;
365
+ /** Fee as percentage of amount */
366
+ feePercentage: number;
367
+ /** Token contract address */
368
+ contractAddress: string;
369
+ }
370
+ /**
371
+ * Fee estimate response from proxy worker
372
+ * Contains detailed fee information for a transfer
373
+ *
374
+ * @remarks
375
+ * Returned by `estimateFee()` method
376
+ */
377
+ interface FeeEstimate {
378
+ /** Fee charged by relayer in token units */
379
+ relayerFee: string;
380
+ /** Fee in USD for reference */
381
+ feeInUSD: string;
382
+ /** Full coin type identifier (e.g., '0x1::aptos_coin::AptosCoin') */
383
+ coinType: string;
384
+ /** Estimated gas units */
385
+ estimatedGas: string;
386
+ /** Network (testnet or mainnet) */
387
+ network: 'testnet' | 'mainnet';
388
+ }
389
+ /**
390
+ * Transfer quote information
391
+ * Contains fee breakdown and contract details
392
+ */
393
+ interface TransferQuote {
394
+ /** Transfer amount */
395
+ amount: string;
396
+ /** Relayer fee amount */
397
+ relayerFee: string;
398
+ /** Total amount (amount + fee) */
399
+ total: string;
400
+ /** Fee as percentage of amount */
401
+ feePercentage: number;
402
+ /** Token contract address */
403
+ contractAddress: string;
404
+ /** Aptos-specific transaction data (optional for backward compatibility) */
405
+ aptosTransactionData?: any;
406
+ }
407
+ /**
408
+ * Relay transfer response from API
409
+ * Contains transaction execution details
410
+ */
411
+ interface RelayTransferResponse extends SuccessResponse {
412
+ /** Unique transfer identifier */
413
+ transferId: string;
414
+ /** Transaction hash */
415
+ txHash: string;
416
+ /** Block number where transaction was included */
417
+ blockNumber: number;
418
+ /** Gas units consumed */
419
+ gasUsed: string;
420
+ /** Block explorer URL for transaction */
421
+ explorerUrl: string;
422
+ /** Fee paid for the transfer */
423
+ fee: string;
424
+ /** Execution time in milliseconds */
425
+ executionTime: number;
426
+ }
427
+ /**
428
+ * Transfer result structure
429
+ * Contains complete information about a transfer execution
430
+ *
431
+ * @remarks
432
+ * Returned by `executeGaslessTransfer()` and `transfer()` methods
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * const result = await sdk.executeGaslessTransfer(signedData);
437
+ * console.log(`Transaction: ${result.txHash}`);
438
+ * console.log(`Explorer: ${result.explorerUrl}`);
439
+ * console.log(`Rate limit remaining: ${result.metadata?.rateLimit.remaining}`);
440
+ * ```
441
+ */
442
+ interface TransferResult {
443
+ /** Indicates if transfer was successful */
444
+ success: boolean;
445
+ /** Transaction hash */
446
+ txHash: string;
447
+ /** Block number where transaction was included */
448
+ blockNumber?: number;
449
+ /** Gas units consumed */
450
+ gasUsed?: string;
451
+ /** Unique transfer identifier */
452
+ transferId?: string;
453
+ /** Block explorer URL for transaction */
454
+ explorerUrl?: string;
455
+ /** Fee paid for the transfer */
456
+ fee?: string;
457
+ /** Execution time in milliseconds */
458
+ executionTime?: number;
459
+ /** Address that paid the gas fee (Aptos-specific) */
460
+ gasFeePaidBy?: string;
461
+ /** Whether user paid in APT (Aptos-specific) */
462
+ userPaidAPT?: boolean;
463
+ /** Transparency information (Aptos-specific) */
464
+ transparency?: string;
465
+ /** VM execution status (Aptos-specific) */
466
+ vmStatus?: string;
467
+ /** Sender address (Aptos-specific) */
468
+ sender?: string;
469
+ /** Chain identifier (Aptos-specific) */
470
+ chain?: string;
471
+ /** Relayer fee amount (Aptos-specific) */
472
+ relayerFee?: string;
473
+ /** Additional message or status information */
474
+ message?: string;
475
+ /** Usage metadata from proxy worker (v2) */
476
+ metadata?: UsageMetadata;
477
+ }
478
+ /**
479
+ * Batch transfer request parameters
480
+ * Used to execute multiple transfers in a single transaction
481
+ *
482
+ * @remarks
483
+ * Batch transfers are more gas-efficient than individual transfers
484
+ */
485
+ interface BatchTransferRequest {
486
+ /** Array of transfer requests to execute */
487
+ transfers: TransferRequest[];
488
+ /** Target blockchain */
489
+ chain: SupportedChain;
490
+ }
491
+ /**
492
+ * EVM transfer data structure
493
+ * Contains signed transfer data for EVM-compatible chains
494
+ *
495
+ * @remarks
496
+ * Used for Avalanche and other EVM chains
497
+ */
498
+ interface EVMTransferData {
499
+ /** Chain identifier */
500
+ chainName: string;
501
+ /** Sender address */
502
+ from: string;
503
+ /** Recipient address */
504
+ to: string;
505
+ /** Token symbol */
506
+ tokenSymbol: string;
507
+ /** Transfer amount */
508
+ amount: string;
509
+ /** Relayer fee amount */
510
+ relayerFee: string;
511
+ /** Transaction nonce */
512
+ nonce: string;
513
+ /** Signature deadline timestamp */
514
+ deadline: number;
515
+ /** EIP-712 signature */
516
+ signature: string;
517
+ /** ERC-2612 permit data (optional) */
518
+ permitData?: {
519
+ /** Permit value */
520
+ value: string;
521
+ /** Permit deadline */
522
+ deadline: number;
523
+ /** Signature v component */
524
+ v: number;
525
+ /** Signature r component */
526
+ r: string;
527
+ /** Signature s component */
528
+ s: string;
529
+ };
530
+ }
531
+ /**
532
+ * Legacy type alias for Avalanche transfers
533
+ * @deprecated Use EVMTransferData instead
534
+ */
535
+ type AvalancheTransferData = EVMTransferData;
536
+ /**
537
+ * Aptos transfer data structure
538
+ * Contains serialized transaction data for secure Aptos transfers
539
+ *
540
+ * @remarks
541
+ * Uses serialized transaction approach for enhanced security
542
+ * Transaction must be built and signed by wallet before submission
543
+ *
544
+ * @example
545
+ * ```typescript
546
+ * const aptosData: AptosTransferData = {
547
+ * transactionBytes: Array.from(signedTx.transactionBytes),
548
+ * authenticatorBytes: Array.from(signedTx.authenticatorBytes)
549
+ * };
550
+ * ```
551
+ */
552
+ interface AptosTransferData {
553
+ /** Serialized SimpleTransaction as byte array */
554
+ transactionBytes: number[];
555
+ /** Serialized AccountAuthenticator as byte array */
556
+ authenticatorBytes: number[];
557
+ /** Optional function name for debugging/tracking */
558
+ functionName?: string;
559
+ /** Sender address (optional metadata) */
560
+ fromAddress?: string;
561
+ /** Recipient address (optional metadata) */
562
+ toAddress?: string;
563
+ /** Transfer amount (optional metadata) */
564
+ amount?: string;
565
+ /** Coin type identifier (optional metadata) */
566
+ coinType?: string;
567
+ }
568
+ /**
569
+ * EIP-712 signature data structure
570
+ * Contains typed data for signature verification
571
+ */
572
+ interface SignatureData {
573
+ /** EIP-712 domain separator */
574
+ domain: any;
575
+ /** Type definitions */
576
+ types: any;
577
+ /** Message to sign */
578
+ message: any;
579
+ /** Primary type name */
580
+ primaryType: string;
581
+ /** Enhanced metadata for signature verification */
582
+ metadata?: {
583
+ /** Target chain */
584
+ chain?: SupportedChain;
585
+ /** Sender address */
586
+ fromAddress?: string;
587
+ /** Recipient address */
588
+ toAddress?: string;
589
+ /** Transfer amount */
590
+ amount?: string;
591
+ /** Token symbol */
592
+ token?: string;
593
+ /** Relayer fee */
594
+ relayerFee?: string;
595
+ /** Signature version */
596
+ signatureVersion?: string;
597
+ /** Whether public key is required */
598
+ requiresPublicKey?: boolean;
599
+ /** Verification method */
600
+ verificationMethod?: string;
601
+ };
602
+ }
603
+ /**
604
+ * Signed transfer data for SDK v2
605
+ * Contains serialized transaction bytes for secure Aptos transfers
606
+ *
607
+ * @remarks
608
+ * Used with `executeGaslessTransfer()` method
609
+ * Transaction must be built and signed by wallet before creating this structure
610
+ *
611
+ * @example
612
+ * ```typescript
613
+ * const signedData: SignedTransferData = {
614
+ * transactionBytes: Array.from(signedTx.transactionBytes),
615
+ * authenticatorBytes: Array.from(signedTx.authenticatorBytes),
616
+ * chain: 'aptos-testnet',
617
+ * network: 'testnet'
618
+ * };
619
+ * const result = await sdk.executeGaslessTransfer(signedData);
620
+ * ```
621
+ */
622
+ interface SignedTransferData {
623
+ /** Serialized transaction (Aptos) */
624
+ transactionBytes?: number[];
625
+ /** Serialized authenticator (Aptos) */
626
+ authenticatorBytes?: number[];
627
+ /** Signed XDR transaction (Stellar) */
628
+ signedTransaction?: string;
629
+ /** Target blockchain */
630
+ chain: SupportedChain;
631
+ /** Optional network override (testnet or mainnet) */
632
+ network?: 'testnet' | 'mainnet';
633
+ }
634
+ /**
635
+ * Token balance information
636
+ * Contains balance and metadata for a specific token
637
+ */
638
+ interface TokenBalance {
639
+ /** Token symbol or address */
640
+ token: string;
641
+ /** Balance in smallest unit */
642
+ balance: string;
643
+ /** Number of decimal places */
644
+ decimals: number;
645
+ /** Token symbol */
646
+ symbol: string;
647
+ /** Full token name (optional) */
648
+ name?: string;
649
+ }
650
+ /**
651
+ * Transfer quote request parameters
652
+ * Used to request fee estimate from API
653
+ */
654
+ interface TransferQuoteRequest {
655
+ /** Chain identifier */
656
+ chainName: string;
657
+ /** Token symbol */
658
+ token: string;
659
+ /** Transfer amount */
660
+ amount: string;
661
+ }
662
+ /**
663
+ * Prepare signature request parameters
664
+ * Used to get typed data for EIP-712 signature
665
+ */
666
+ interface PrepareSignatureRequest {
667
+ /** Chain identifier */
668
+ chainName: string;
669
+ /** Sender address */
670
+ from: string;
671
+ /** Recipient address */
672
+ to: string;
673
+ /** Token symbol */
674
+ tokenSymbol: string;
675
+ /** Transfer amount */
676
+ amount: string;
677
+ /** Relayer fee amount */
678
+ relayerFee: string;
679
+ /** Transaction nonce */
680
+ nonce: string;
681
+ /** Signature deadline timestamp */
682
+ deadline: number;
683
+ }
684
+ /**
685
+ * Relay transfer request parameters
686
+ * Used to submit signed transfer to relayer
687
+ */
688
+ interface RelayTransferRequest {
689
+ /** Chain identifier */
690
+ chainName: string;
691
+ /** Sender address */
692
+ from: string;
693
+ /** Recipient address */
694
+ to: string;
695
+ /** Token symbol */
696
+ tokenSymbol: string;
697
+ /** Transfer amount */
698
+ amount: string;
699
+ /** Relayer fee amount */
700
+ relayerFee: string;
701
+ /** Transaction nonce */
702
+ nonce: string;
703
+ /** Signature deadline timestamp */
704
+ deadline: number;
705
+ /** EIP-712 signature */
706
+ signature: string;
707
+ /** ERC-2612 permit data (optional) */
708
+ permitData?: PermitData;
709
+ }
710
+ /**
711
+ * Batch relay transfer request parameters
712
+ * Used to submit multiple signed transfers in one transaction
713
+ */
714
+ interface BatchRelayTransferRequest {
715
+ /** Chain identifier */
716
+ chainName: string;
717
+ /** Array of transfer requests */
718
+ transfers: RelayTransferRequest[];
719
+ }
720
+ /**
721
+ * Gas estimate request parameters
722
+ * Used to estimate gas cost for transfers
723
+ */
724
+ interface EstimateGasRequest {
725
+ /** Chain identifier */
726
+ chainName: string;
727
+ /** Array of transfer data */
728
+ transfers: TransferData[];
729
+ }
730
+ /**
731
+ * Transfer data structure
732
+ * Contains complete transfer information including signature
733
+ */
734
+ interface TransferData {
735
+ /** Sender address */
736
+ from: string;
737
+ /** Recipient address */
738
+ to: string;
739
+ /** Token symbol or address */
740
+ token: string;
741
+ /** Transfer amount */
742
+ amount: string;
743
+ /** Relayer fee amount */
744
+ relayerFee: string;
745
+ /** Transaction nonce */
746
+ nonce: string;
747
+ /** Signature deadline timestamp */
748
+ deadline: number;
749
+ /** EIP-712 signature */
750
+ signature: string;
751
+ /** ERC-2612 permit data (optional) */
752
+ permitData?: PermitData;
753
+ }
754
+ /**
755
+ * ERC-2612 permit data structure
756
+ * Used for gasless token approvals
757
+ */
758
+ interface PermitData {
759
+ /** Permit value (amount) */
760
+ value: string;
761
+ /** Permit deadline timestamp */
762
+ deadline: number;
763
+ /** Signature v component */
764
+ v: number;
765
+ /** Signature r component */
766
+ r: string;
767
+ /** Signature s component */
768
+ s: string;
769
+ }
770
+ /**
771
+ * Prepare signature response from API
772
+ * Contains EIP-712 typed data for signing
773
+ */
774
+ interface PrepareSignatureResponse extends SuccessResponse {
775
+ /** EIP-712 typed data structure */
776
+ typedData: any;
777
+ /** Keccak256 hash of the message */
778
+ messageHash: string;
779
+ /** Human-readable message */
780
+ message: string;
781
+ }
782
+ /**
783
+ * Gas estimate response from API
784
+ * Contains estimated gas cost for transfers
785
+ */
786
+ interface GasEstimateResponse extends SuccessResponse {
787
+ /** Chain identifier */
788
+ chainName: string;
789
+ /** Estimated gas units */
790
+ gasEstimate: string;
791
+ /** Current gas price */
792
+ gasPrice: string;
793
+ /** Estimated cost in native currency */
794
+ estimatedCost: string;
795
+ /** Number of transfers in batch */
796
+ transferCount: number;
797
+ }
798
+ /**
799
+ * Health check response
800
+ * Contains service health status information
801
+ *
802
+ * @remarks
803
+ * Returned by `getHealth()` and `getChainHealth()` methods
804
+ */
805
+ interface HealthResponse extends SuccessResponse {
806
+ /** Service status (e.g., 'healthy', 'degraded') */
807
+ status: string;
808
+ /** Response timestamp (ISO 8601) */
809
+ timestamp: string;
810
+ /** Service version */
811
+ version: string;
812
+ }
813
+ /**
814
+ * Domain separator response from API
815
+ * Contains EIP-712 domain separator for a chain
816
+ */
817
+ interface DomainSeparatorResponse extends SuccessResponse {
818
+ /** Chain identifier */
819
+ chainName: string;
820
+ /** EIP-712 domain separator hash */
821
+ domainSeparator: string;
822
+ }
823
+ /**
824
+ * Transfer status response from API
825
+ * Contains execution status of a transfer
826
+ */
827
+ interface TransferStatusResponse extends SuccessResponse {
828
+ /** Chain identifier */
829
+ chainName: string;
830
+ /** Transfer transaction hash */
831
+ transferHash: string;
832
+ /** Whether transfer has been executed */
833
+ executed: boolean;
834
+ }
835
+ /**
836
+ * Aptos-specific error codes
837
+ * Used for detailed error handling in Aptos adapter
838
+ *
839
+ * @remarks
840
+ * Error codes are prefixed with APTOS_ for easy identification
841
+ */
842
+ declare const APTOS_ERROR_CODES: {
843
+ /** Missing signature in request */
844
+ readonly MISSING_SIGNATURE: "APTOS_MISSING_SIGNATURE";
845
+ /** Missing public key for verification */
846
+ readonly MISSING_PUBLIC_KEY: "APTOS_MISSING_PUBLIC_KEY";
847
+ /** Invalid signature format */
848
+ readonly INVALID_SIGNATURE_FORMAT: "APTOS_INVALID_SIGNATURE_FORMAT";
849
+ /** Invalid public key format */
850
+ readonly INVALID_PUBLIC_KEY_FORMAT: "APTOS_INVALID_PUBLIC_KEY_FORMAT";
851
+ /** Address doesn't match public key */
852
+ readonly ADDRESS_MISMATCH: "APTOS_ADDRESS_MISMATCH";
853
+ /** Signature verification failed */
854
+ readonly SIGNATURE_VERIFICATION_FAILED: "APTOS_SIGNATURE_VERIFICATION_FAILED";
855
+ /** Missing transaction data */
856
+ readonly MISSING_TRANSACTION_DATA: "APTOS_MISSING_TRANSACTION_DATA";
857
+ /** Invalid transaction format */
858
+ readonly INVALID_TRANSACTION_FORMAT: "APTOS_INVALID_TRANSACTION_FORMAT";
859
+ /** Empty address provided */
860
+ readonly EMPTY_ADDRESS: "APTOS_EMPTY_ADDRESS";
861
+ /** Invalid address format */
862
+ readonly INVALID_ADDRESS_FORMAT: "APTOS_INVALID_ADDRESS_FORMAT";
863
+ /** Error fetching quote */
864
+ readonly QUOTE_ERROR: "APTOS_QUOTE_ERROR";
865
+ /** Error executing transfer */
866
+ readonly EXECUTE_ERROR: "APTOS_EXECUTE_ERROR";
867
+ /** Error fetching balance */
868
+ readonly BALANCE_ERROR: "APTOS_BALANCE_ERROR";
869
+ /** Error fetching token info */
870
+ readonly TOKEN_INFO_ERROR: "APTOS_TOKEN_INFO_ERROR";
871
+ /** Error checking status */
872
+ readonly STATUS_ERROR: "APTOS_STATUS_ERROR";
873
+ /** Error calling Move function */
874
+ readonly MOVE_CALL_ERROR: "APTOS_MOVE_CALL_ERROR";
875
+ /** Unsupported token */
876
+ readonly UNSUPPORTED_TOKEN: "APTOS_UNSUPPORTED_TOKEN";
877
+ };
878
+ /**
879
+ * Type for Aptos error codes
880
+ * Ensures type safety when using error codes
881
+ */
882
+ type AptosErrorCode = typeof APTOS_ERROR_CODES[keyof typeof APTOS_ERROR_CODES];
883
+ /**
884
+ * Stellar adapter error codes
885
+ */
886
+ declare const STELLAR_ERROR_CODES: {
887
+ readonly MISSING_SIGNED_TRANSACTION: "STELLAR_MISSING_SIGNED_TRANSACTION";
888
+ readonly GASLESS_TRANSACTION_ERROR: "STELLAR_GASLESS_TRANSACTION_ERROR";
889
+ readonly STATUS_ERROR: "STELLAR_STATUS_ERROR";
890
+ readonly HEALTH_ERROR: "STELLAR_HEALTH_ERROR";
891
+ readonly INVALID_ADDRESS_FORMAT: "STELLAR_INVALID_ADDRESS_FORMAT";
892
+ };
893
+ /**
894
+ * Generic API response structure
895
+ * Used for all API responses with optional data payload
896
+ *
897
+ * @typeParam T - Type of the response data
898
+ *
899
+ * @example
900
+ * ```typescript
901
+ * const response: ApiResponse<TransferResult> = await api.transfer(data);
902
+ * if (response.success && response.data) {
903
+ * console.log('Transfer successful:', response.data.txHash);
904
+ * }
905
+ * ```
906
+ */
907
+ interface ApiResponse<T = any> {
908
+ /** Indicates if request was successful */
909
+ success: boolean;
910
+ /** Response data (present on success) */
911
+ data?: T;
912
+ /** Error message (present on failure) */
913
+ error?: string;
914
+ /** Additional error details */
915
+ details?: string[];
916
+ /** Unique request identifier */
917
+ requestId?: string;
918
+ /** Error code for programmatic handling */
919
+ errorCode?: string;
920
+ /** Chain where request was made */
921
+ chain?: SupportedChain;
922
+ /** Response timestamp (ISO 8601) */
923
+ timestamp?: string;
924
+ /** Usage metadata from proxy worker (v2) */
925
+ metadata?: UsageMetadata;
926
+ }
927
+ /**
928
+ * SDK configuration for v2 - Proxy-based architecture
929
+ *
930
+ * @remarks
931
+ * All requests route through proxy.smoothsend.xyz with API key authentication
932
+ *
933
+ * @example
934
+ * ```typescript
935
+ * const config: SmoothSendConfig = {
936
+ * apiKey: 'no_gas_abc123...',
937
+ * network: 'testnet',
938
+ * timeout: 30000,
939
+ * retries: 3
940
+ * };
941
+ * const sdk = new SmoothSendSDK(config);
942
+ * ```
943
+ */
944
+ interface SmoothSendConfig {
945
+ /** API key with no_gas_ prefix for authentication (required) */
946
+ apiKey: string;
947
+ /** Network to use: testnet or mainnet (default: testnet) */
948
+ network?: 'testnet' | 'mainnet';
949
+ /** Request timeout in milliseconds (default: 30000) */
950
+ timeout?: number;
951
+ /** Maximum retry attempts for failed requests (default: 3) */
952
+ retries?: number;
953
+ /** Additional headers to include in requests */
954
+ customHeaders?: Record<string, string>;
955
+ }
956
+ /**
957
+ * Usage metadata from proxy worker response headers
958
+ * Contains rate limiting and usage tracking information
959
+ *
960
+ * @remarks
961
+ * Attached to all transfer results and available via `getUsageStats()`
962
+ *
963
+ * @example
964
+ * ```typescript
965
+ * const result = await sdk.transfer(request, wallet);
966
+ * console.log('Rate limit:', result.metadata?.rateLimit);
967
+ * console.log('Monthly usage:', result.metadata?.monthly);
968
+ *
969
+ * // Check if approaching limits
970
+ * if (parseInt(result.metadata.rateLimit.remaining) < 2) {
971
+ * console.warn('Approaching rate limit!');
972
+ * }
973
+ * ```
974
+ */
975
+ interface UsageMetadata {
976
+ /** Rate limit information (per minute) */
977
+ rateLimit: {
978
+ /** Maximum requests per minute */
979
+ limit: string;
980
+ /** Remaining requests this minute */
981
+ remaining: string;
982
+ /** When rate limit resets (ISO 8601 timestamp) */
983
+ reset: string;
984
+ };
985
+ /** Monthly usage information */
986
+ monthly: {
987
+ /** Total monthly request limit */
988
+ limit: string;
989
+ /** Requests used this month */
990
+ usage: string;
991
+ /** Remaining requests this month */
992
+ remaining: string;
993
+ };
994
+ /** Unique request identifier for debugging */
995
+ requestId: string;
996
+ }
997
+ /**
998
+ * Aptos wallet interface for sdk.transfer()
999
+ */
1000
+ interface AptosWallet {
1001
+ buildTransaction: (params: {
1002
+ sender: string;
1003
+ recipient: string;
1004
+ amount: string;
1005
+ coinType: string;
1006
+ relayerFee: string;
1007
+ }) => Promise<any>;
1008
+ signTransaction: (transaction: any) => Promise<{
1009
+ transactionBytes: number[];
1010
+ authenticatorBytes: number[];
1011
+ }>;
1012
+ }
1013
+ /**
1014
+ * Stellar wallet interface for sdk.transfer()
1015
+ * Use with Freighter, Stellar Wallets Kit, or any Stellar-compatible wallet
1016
+ */
1017
+ interface StellarWallet {
1018
+ buildTransaction: (params: {
1019
+ from: string;
1020
+ to: string;
1021
+ amount: string;
1022
+ token: string;
1023
+ }) => Promise<any>;
1024
+ signTransaction: (transaction: any) => Promise<string>;
1025
+ }
1026
+ /**
1027
+ * Transfer event types
1028
+ * Emitted during transfer lifecycle for monitoring and debugging
1029
+ */
1030
+ interface TransferEvent {
1031
+ /** Event type */
1032
+ type: 'transfer_initiated' | 'transfer_signed' | 'transfer_submitted' | 'transfer_confirmed' | 'transfer_failed';
1033
+ /** Event data (varies by type) */
1034
+ data: any;
1035
+ /** Event timestamp (Unix milliseconds) */
1036
+ timestamp: number;
1037
+ /** Chain where event occurred */
1038
+ chain: SupportedChain;
1039
+ }
1040
+ /**
1041
+ * Event listener callback function
1042
+ * Called when transfer events are emitted
1043
+ *
1044
+ * @param event - Transfer event object
1045
+ *
1046
+ * @example
1047
+ * ```typescript
1048
+ * const listener: EventListener = (event) => {
1049
+ * console.log(`Event: ${event.type} on ${event.chain}`);
1050
+ * };
1051
+ * sdk.addEventListener(listener);
1052
+ * ```
1053
+ */
1054
+ type EventListener = (event: TransferEvent) => void;
1055
+ /**
1056
+ * Chain Adapter Interface - v2 Proxy Architecture
1057
+ *
1058
+ * @remarks
1059
+ * All adapters route requests through proxy.smoothsend.xyz with API key authentication.
1060
+ * The proxy handles relayer URL routing, so adapters no longer need direct relayer configuration.
1061
+ *
1062
+ * Key changes from v1:
1063
+ * - Removed `config` property (relayer URLs handled by proxy)
1064
+ * - Simplified to core methods: estimateFee, executeGaslessTransfer
1065
+ * - Removed getQuote, prepareTransfer, getNonce, getTokenInfo (not needed for proxy flow)
1066
+ * - Network parameter (testnet/mainnet) passed via HTTP headers, not method parameters
1067
+ * - Client-side validation methods remain for address and amount validation
1068
+ *
1069
+ * Design rationale:
1070
+ * - Consistent interface across all chains
1071
+ * - Minimal surface area - only essential methods
1072
+ * - Async by default for all I/O operations
1073
+ * - Client-side validation done locally without network calls
1074
+ * - Wallet libraries handle balance queries and transaction building
1075
+ *
1076
+ * @example
1077
+ * ```typescript
1078
+ * class MyChainAdapter implements IChainAdapter {
1079
+ * readonly chain: SupportedChain = 'aptos-testnet';
1080
+ *
1081
+ * async estimateFee(request: TransferRequest): Promise<FeeEstimate> {
1082
+ * // Implementation
1083
+ * }
1084
+ *
1085
+ * async executeGaslessTransfer(signedData: SignedTransferData): Promise<TransferResult> {
1086
+ * // Implementation
1087
+ * }
1088
+ *
1089
+ * // ... other methods
1090
+ * }
1091
+ * ```
1092
+ */
1093
+ interface IChainAdapter {
1094
+ /** Chain identifier this adapter handles */
1095
+ readonly chain: SupportedChain;
1096
+ /**
1097
+ * Estimate fee for a transfer
1098
+ *
1099
+ * @param request - Transfer request parameters
1100
+ * @returns Fee estimate with relayer fee and gas information
1101
+ * @throws {ValidationError} If request parameters are invalid
1102
+ * @throws {NetworkError} If unable to reach proxy/relayer
1103
+ *
1104
+ * @example
1105
+ * ```typescript
1106
+ * const estimate = await adapter.estimateFee({
1107
+ * from: '0x123...',
1108
+ * to: '0x456...',
1109
+ * token: 'USDC',
1110
+ * amount: '1000000',
1111
+ * chain: 'aptos-testnet'
1112
+ * });
1113
+ * console.log('Fee:', estimate.relayerFee);
1114
+ * ```
1115
+ */
1116
+ estimateFee(request: TransferRequest): Promise<FeeEstimate>;
1117
+ /**
1118
+ * Execute a gasless transfer with signed transaction data
1119
+ *
1120
+ * @param signedData - Signed transfer data with serialized transaction
1121
+ * @returns Transfer result with transaction hash and metadata
1122
+ * @throws {AuthenticationError} If API key is invalid
1123
+ * @throws {RateLimitError} If rate limit is exceeded
1124
+ * @throws {ValidationError} If signed data is invalid
1125
+ * @throws {NetworkError} If unable to reach proxy/relayer
1126
+ *
1127
+ * @example
1128
+ * ```typescript
1129
+ * const result = await adapter.executeGaslessTransfer({
1130
+ * transactionBytes: [1, 2, 3, ...],
1131
+ * authenticatorBytes: [4, 5, 6, ...],
1132
+ * chain: 'aptos-testnet',
1133
+ * network: 'testnet'
1134
+ * });
1135
+ * console.log('Transaction:', result.txHash);
1136
+ * ```
1137
+ */
1138
+ executeGaslessTransfer(signedData: SignedTransferData): Promise<TransferResult>;
1139
+ /**
1140
+ * Get transaction status by hash
1141
+ *
1142
+ * @param txHash - Transaction hash to query
1143
+ * @returns Transaction status information
1144
+ * @throws {ValidationError} If transaction hash is invalid
1145
+ * @throws {NetworkError} If unable to reach proxy/relayer
1146
+ *
1147
+ * @example
1148
+ * ```typescript
1149
+ * const status = await adapter.getTransactionStatus('0xabc123...');
1150
+ * console.log('Status:', status);
1151
+ * ```
1152
+ */
1153
+ getTransactionStatus(txHash: string): Promise<any>;
1154
+ /**
1155
+ * Check health status of the chain's relayer
1156
+ *
1157
+ * @returns Health response with status and version
1158
+ * @throws {NetworkError} If unable to reach proxy/relayer
1159
+ *
1160
+ * @example
1161
+ * ```typescript
1162
+ * const health = await adapter.getHealth();
1163
+ * console.log('Status:', health.status);
1164
+ * ```
1165
+ */
1166
+ getHealth(): Promise<HealthResponse>;
1167
+ /**
1168
+ * Validate address format (client-side, no network call)
1169
+ *
1170
+ * @param address - Address to validate
1171
+ * @returns true if address format is valid, false otherwise
1172
+ *
1173
+ * @example
1174
+ * ```typescript
1175
+ * const isValid = adapter.validateAddress('0x123...');
1176
+ * if (!isValid) {
1177
+ * console.error('Invalid address format');
1178
+ * }
1179
+ * ```
1180
+ */
1181
+ validateAddress(address: string): boolean;
1182
+ /**
1183
+ * Validate amount format (client-side, no network call)
1184
+ *
1185
+ * @param amount - Amount to validate (in smallest unit)
1186
+ * @returns true if amount format is valid, false otherwise
1187
+ *
1188
+ * @example
1189
+ * ```typescript
1190
+ * const isValid = adapter.validateAmount('1000000');
1191
+ * if (!isValid) {
1192
+ * console.error('Invalid amount format');
1193
+ * }
1194
+ * ```
1195
+ */
1196
+ validateAmount(amount: string): boolean;
1197
+ }
1198
+
1199
+ /**
1200
+ * Configuration for HTTP client
1201
+ */
1202
+ interface HttpClientConfig {
1203
+ apiKey: string;
1204
+ network?: 'testnet' | 'mainnet';
1205
+ timeout?: number;
1206
+ retries?: number;
1207
+ customHeaders?: Record<string, string>;
1208
+ includeOrigin?: boolean;
1209
+ /** Override the default proxy base URL (e.g. for self-hosted relayers) */
1210
+ baseUrl?: string;
1211
+ }
1212
+ /**
1213
+ * HTTP Client for proxy worker integration
1214
+ * Handles authentication, rate limiting, usage tracking, and retry logic
1215
+ */
1216
+ declare class HttpClient {
1217
+ private client;
1218
+ private apiKey?;
1219
+ private network;
1220
+ private maxRetries;
1221
+ private baseURL;
1222
+ private isProxyMode;
1223
+ private includeOrigin;
1224
+ /**
1225
+ * Constructor supports both old (baseURL, timeout) and new (config object) patterns
1226
+ * for backward compatibility during migration
1227
+ */
1228
+ constructor(configOrBaseURL: HttpClientConfig | string, timeout?: number);
1229
+ /**
1230
+ * Extract usage metadata from response headers (proxy mode only)
1231
+ * Uses USAGE_HEADERS constants for consistency across systems
1232
+ */
1233
+ private extractMetadata;
1234
+ /**
1235
+ * Determine if an error should be retried
1236
+ */
1237
+ private shouldRetry;
1238
+ /**
1239
+ * Calculate exponential backoff delay with jitter
1240
+ */
1241
+ private calculateBackoff;
1242
+ /**
1243
+ * Execute request with retry logic (proxy mode) or single attempt (legacy mode)
1244
+ */
1245
+ private executeWithRetry;
1246
+ /**
1247
+ * Handle errors and create appropriate error responses
1248
+ */
1249
+ private handleError;
1250
+ /**
1251
+ * GET request
1252
+ */
1253
+ get<T = any>(url: string, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
1254
+ /**
1255
+ * POST request
1256
+ */
1257
+ post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
1258
+ /**
1259
+ * PUT request
1260
+ */
1261
+ put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
1262
+ /**
1263
+ * DELETE request
1264
+ */
1265
+ delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
1266
+ /**
1267
+ * Update network parameter for subsequent requests
1268
+ */
1269
+ setNetwork(network: 'testnet' | 'mainnet'): void;
1270
+ /**
1271
+ * Get current network
1272
+ */
1273
+ getNetwork(): 'testnet' | 'mainnet';
1274
+ }
1275
+
1276
+ declare const VERSION = "2.2.3";
1277
+
1278
+ export { HttpClient as H, SmoothSendError as O, AuthenticationError as Q, VERSION as V, RateLimitError as W, ValidationError as X, NetworkError as Y, createErrorFromResponse as Z, createNetworkError as _, CHAIN_ECOSYSTEM_MAP as a, APTOS_ERROR_CODES as w, STELLAR_ERROR_CODES as y };
1279
+ export type { AvalancheTransferData as A, BatchTransferRequest as B, ChainEcosystem as C, DomainSeparatorResponse as D, ErrorResponse as E, FeeEstimate as F, GasEstimateResponse as G, SmoothSendConfig as I, AptosWallet as J, StellarWallet as K, TransferEvent as L, EventListener as M, IChainAdapter as N, PrepareSignatureRequest as P, RelayTransferResponse as R, SupportedChain as S, TokenInfo as T, UsageMetadata as U, SuccessResponse as b, ChainInfo as c, ChainConfig as d, TransferRequest as e, TransferQuoteResponse as f, TransferQuote as g, TransferResult as h, EVMTransferData as i, AptosTransferData as j, SignatureData as k, SignedTransferData as l, TokenBalance as m, TransferQuoteRequest as n, RelayTransferRequest as o, BatchRelayTransferRequest as p, EstimateGasRequest as q, TransferData as r, PermitData as s, PrepareSignatureResponse as t, HealthResponse as u, TransferStatusResponse as v, AptosErrorCode as x, ApiResponse as z };