riskmarket-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of riskmarket-sdk might be problematic. Click here for more details.

package/dist/index.js ADDED
@@ -0,0 +1,746 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var axios = require('axios');
6
+ var ethers = require('ethers');
7
+
8
+ /**
9
+ * Error types
10
+ */
11
+ exports.ErrorType = void 0;
12
+ (function (ErrorType) {
13
+ ErrorType["API_ERROR"] = "API_ERROR";
14
+ ErrorType["TRANSACTION_ERROR"] = "TRANSACTION_ERROR";
15
+ ErrorType["VALIDATION_ERROR"] = "VALIDATION_ERROR";
16
+ ErrorType["NETWORK_ERROR"] = "NETWORK_ERROR";
17
+ })(exports.ErrorType || (exports.ErrorType = {}));
18
+ /**
19
+ * Custom SDK Error
20
+ */
21
+ class SDKError extends Error {
22
+ constructor(message, type, details) {
23
+ super(message);
24
+ this.name = 'SDKError';
25
+ this.type = type;
26
+ this.details = details;
27
+ }
28
+ }
29
+
30
+ /**
31
+ * APIClient class for interacting with backend APIs
32
+ */
33
+ class APIClient {
34
+ /**
35
+ * Initialize API client
36
+ * @param baseURL - Base URL for API endpoints
37
+ * @param apiKey - Optional API key for authentication
38
+ */
39
+ constructor(baseURL, apiKey) {
40
+ this.baseURL = baseURL;
41
+ this.apiKey = apiKey;
42
+ this.client = axios.create({
43
+ baseURL,
44
+ timeout: 30000,
45
+ headers: {
46
+ "Content-Type": "application/json",
47
+ ...(apiKey && { Authorization: `Bearer ${apiKey}` }),
48
+ },
49
+ });
50
+ // Add response interceptor for error handling
51
+ this.client.interceptors.response.use((response) => response, (error) => {
52
+ throw this.handleAPIError(error);
53
+ });
54
+ }
55
+ /**
56
+ * Handle API errors
57
+ * @private
58
+ */
59
+ handleAPIError(error) {
60
+ if (error.response) {
61
+ // Server responded with error status
62
+ const message = error.response.data?.message || error.message;
63
+ return new SDKError(`API Error: ${message}`, exports.ErrorType.API_ERROR, {
64
+ status: error.response.status,
65
+ data: error.response.data,
66
+ });
67
+ }
68
+ else if (error.request) {
69
+ // Request was made but no response
70
+ return new SDKError("No response from server", exports.ErrorType.NETWORK_ERROR, {
71
+ originalError: error,
72
+ });
73
+ }
74
+ else {
75
+ // Something else happened
76
+ return new SDKError(`Request failed: ${error.message}`, exports.ErrorType.API_ERROR);
77
+ }
78
+ }
79
+ // ============================================
80
+ // ADD YOUR API METHODS HERE
81
+ // ============================================
82
+ /**
83
+ * Example method - Replace with your actual API calls
84
+ *
85
+ * Template for a GET request:
86
+ *
87
+ * async getYourData(id: string): Promise<YourDataType> {
88
+ * try {
89
+ * const response = await this.client.get<APIResponse<YourDataType>>(
90
+ * `/your-endpoint/${id}`
91
+ * );
92
+ *
93
+ * if (!response.data.success) {
94
+ * throw new SDKError(
95
+ * response.data.error || 'Failed to fetch data',
96
+ * ErrorType.API_ERROR
97
+ * );
98
+ * }
99
+ *
100
+ * return response.data.data;
101
+ * } catch (error) {
102
+ * if (error instanceof SDKError) throw error;
103
+ * throw new SDKError(
104
+ * `Failed to fetch data: ${error}`,
105
+ * ErrorType.API_ERROR
106
+ * );
107
+ * }
108
+ * }
109
+ *
110
+ * Template for a POST request:
111
+ *
112
+ * async createYourData(data: YourInputType): Promise<YourDataType> {
113
+ * try {
114
+ * const response = await this.client.post<APIResponse<YourDataType>>(
115
+ * '/your-endpoint',
116
+ * data
117
+ * );
118
+ *
119
+ * if (!response.data.success) {
120
+ * throw new SDKError(
121
+ * response.data.error || 'Failed to create data',
122
+ * ErrorType.API_ERROR
123
+ * );
124
+ * }
125
+ *
126
+ * return response.data.data;
127
+ * } catch (error) {
128
+ * if (error instanceof SDKError) throw error;
129
+ * throw new SDKError(
130
+ * `Failed to create data: ${error}`,
131
+ * ErrorType.API_ERROR
132
+ * );
133
+ * }
134
+ * }
135
+ */
136
+ // ============================================
137
+ // GENERIC REQUEST METHODS (Keep these - they're useful!)
138
+ // ============================================
139
+ /**
140
+ * Generic GET request
141
+ * @param endpoint - API endpoint (relative to baseURL)
142
+ * @param params - Query parameters
143
+ */
144
+ async get(endpoint, params) {
145
+ try {
146
+ const response = await this.client.get(endpoint, {
147
+ params,
148
+ });
149
+ if (!response.data.success) {
150
+ throw new SDKError(response.data.error || "Request failed", exports.ErrorType.API_ERROR);
151
+ }
152
+ return response.data.data;
153
+ }
154
+ catch (error) {
155
+ if (error instanceof SDKError)
156
+ throw error;
157
+ throw new SDKError(`GET request failed: ${error}`, exports.ErrorType.API_ERROR);
158
+ }
159
+ }
160
+ /**
161
+ * Generic POST request
162
+ * @param endpoint - API endpoint (relative to baseURL)
163
+ * @param data - Request body data
164
+ */
165
+ async post(endpoint, data) {
166
+ try {
167
+ const response = await this.client.post(endpoint, data);
168
+ if (!response.data.success) {
169
+ throw new SDKError(response.data.error || "Request failed", exports.ErrorType.API_ERROR);
170
+ }
171
+ return response.data.data;
172
+ }
173
+ catch (error) {
174
+ if (error instanceof SDKError)
175
+ throw error;
176
+ throw new SDKError(`POST request failed: ${error}`, exports.ErrorType.API_ERROR);
177
+ }
178
+ }
179
+ /**
180
+ * Generic PUT request
181
+ * @param endpoint - API endpoint (relative to baseURL)
182
+ * @param data - Request body data
183
+ */
184
+ async put(endpoint, data) {
185
+ try {
186
+ const response = await this.client.put(endpoint, data);
187
+ if (!response.data.success) {
188
+ throw new SDKError(response.data.error || "Request failed", exports.ErrorType.API_ERROR);
189
+ }
190
+ return response.data.data;
191
+ }
192
+ catch (error) {
193
+ if (error instanceof SDKError)
194
+ throw error;
195
+ throw new SDKError(`PUT request failed: ${error}`, exports.ErrorType.API_ERROR);
196
+ }
197
+ }
198
+ /**
199
+ * Generic DELETE request
200
+ * @param endpoint - API endpoint (relative to baseURL)
201
+ */
202
+ async delete(endpoint) {
203
+ try {
204
+ const response = await this.client.delete(endpoint);
205
+ if (!response.data.success) {
206
+ throw new SDKError(response.data.error || "Request failed", exports.ErrorType.API_ERROR);
207
+ }
208
+ return response.data.data;
209
+ }
210
+ catch (error) {
211
+ if (error instanceof SDKError)
212
+ throw error;
213
+ throw new SDKError(`DELETE request failed: ${error}`, exports.ErrorType.API_ERROR);
214
+ }
215
+ }
216
+ /**
217
+ * Get the base URL
218
+ */
219
+ getBaseURL() {
220
+ return this.baseURL;
221
+ }
222
+ /**
223
+ * Get the axios instance for advanced usage
224
+ */
225
+ getClient() {
226
+ return this.client;
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Utility class with helper functions
232
+ */
233
+ class Utils {
234
+ /**
235
+ * Validate Ethereum address
236
+ */
237
+ static isValidAddress(address) {
238
+ try {
239
+ return ethers.ethers.isAddress(address);
240
+ }
241
+ catch {
242
+ return false;
243
+ }
244
+ }
245
+ /**
246
+ * Validate and checksum an address
247
+ */
248
+ static validateAddress(address) {
249
+ if (!this.isValidAddress(address)) {
250
+ throw new SDKError(`Invalid Ethereum address: ${address}`, exports.ErrorType.VALIDATION_ERROR);
251
+ }
252
+ return ethers.ethers.getAddress(address);
253
+ }
254
+ /**
255
+ * Format token amount from wei to human-readable format
256
+ */
257
+ static formatAmount(amount, decimals = 18) {
258
+ try {
259
+ return ethers.ethers.formatUnits(amount, decimals);
260
+ }
261
+ catch (error) {
262
+ throw new SDKError(`Failed to format amount: ${error}`, exports.ErrorType.VALIDATION_ERROR);
263
+ }
264
+ }
265
+ /**
266
+ * Parse human-readable amount to wei
267
+ */
268
+ static parseAmount(amount, decimals = 18) {
269
+ try {
270
+ return ethers.ethers.parseUnits(amount, decimals).toString();
271
+ }
272
+ catch (error) {
273
+ throw new SDKError(`Failed to parse amount: ${error}`, exports.ErrorType.VALIDATION_ERROR);
274
+ }
275
+ }
276
+ /**
277
+ * Validate amount is positive and not zero
278
+ */
279
+ static validateAmount(amount) {
280
+ const amountBN = BigInt(amount);
281
+ if (amountBN <= 0n) {
282
+ throw new SDKError('Amount must be greater than zero', exports.ErrorType.VALIDATION_ERROR);
283
+ }
284
+ }
285
+ /**
286
+ * Calculate deadline timestamp (current time + minutes)
287
+ */
288
+ static getDeadline(minutes = 20) {
289
+ return Math.floor(Date.now() / 1000) + minutes * 60;
290
+ }
291
+ /**
292
+ * Calculate percentage difference
293
+ */
294
+ static calculatePercentageChange(oldValue, newValue) {
295
+ const old = parseFloat(oldValue);
296
+ const newVal = parseFloat(newValue);
297
+ if (old === 0)
298
+ return '0';
299
+ const change = ((newVal - old) / old) * 100;
300
+ return change.toFixed(2);
301
+ }
302
+ /**
303
+ * Estimate gas with buffer (adds 20% buffer)
304
+ */
305
+ static addGasBuffer(gasEstimate, bufferPercent = 20) {
306
+ const estimate = BigInt(gasEstimate);
307
+ const buffer = estimate * BigInt(bufferPercent) / 100n;
308
+ return (estimate + buffer).toString();
309
+ }
310
+ /**
311
+ * Parse error message from contract call
312
+ */
313
+ static parseContractError(error) {
314
+ // Check for common error patterns
315
+ if (error.reason) {
316
+ return error.reason;
317
+ }
318
+ if (error.message) {
319
+ // Extract revert reason if present
320
+ const revertMatch = error.message.match(/reason="([^"]*)"/);
321
+ if (revertMatch) {
322
+ return revertMatch[1];
323
+ }
324
+ return error.message;
325
+ }
326
+ if (error.data?.message) {
327
+ return error.data.message;
328
+ }
329
+ return 'Unknown error occurred';
330
+ }
331
+ /**
332
+ * Wait for transaction confirmation
333
+ */
334
+ static async waitForTransaction(txHash, provider, confirmations = 1) {
335
+ try {
336
+ const receipt = await provider.waitForTransaction(txHash, confirmations);
337
+ return receipt;
338
+ }
339
+ catch (error) {
340
+ throw new SDKError(`Transaction failed: ${this.parseContractError(error)}`, exports.ErrorType.TRANSACTION_ERROR, { txHash });
341
+ }
342
+ }
343
+ /**
344
+ * Get current gas prices
345
+ */
346
+ static async getGasPrices(provider) {
347
+ try {
348
+ const feeData = await provider.getFeeData();
349
+ return {
350
+ gasPrice: feeData.gasPrice || undefined,
351
+ maxFeePerGas: feeData.maxFeePerGas || undefined,
352
+ maxPriorityFeePerGas: feeData.maxPriorityFeePerGas || undefined,
353
+ };
354
+ }
355
+ catch (error) {
356
+ throw new SDKError(`Failed to fetch gas prices: ${error}`, exports.ErrorType.NETWORK_ERROR);
357
+ }
358
+ }
359
+ /**
360
+ * Convert chain ID to network name
361
+ */
362
+ static getNetworkName(chainId) {
363
+ const networks = {
364
+ 1: 'Ethereum Mainnet',
365
+ 5: 'Goerli',
366
+ 11155111: 'Sepolia',
367
+ 137: 'Polygon',
368
+ 42161: 'Arbitrum One',
369
+ 10: 'Optimism',
370
+ };
371
+ return networks[chainId] || `Unknown Network (${chainId})`;
372
+ }
373
+ /**
374
+ * Sleep/delay utility
375
+ */
376
+ static sleep(ms) {
377
+ return new Promise(resolve => setTimeout(resolve, ms));
378
+ }
379
+ /**
380
+ * Retry logic for API calls
381
+ */
382
+ static async retry(fn, maxRetries = 3, delayMs = 1000) {
383
+ let lastError;
384
+ for (let i = 0; i < maxRetries; i++) {
385
+ try {
386
+ return await fn();
387
+ }
388
+ catch (error) {
389
+ lastError = error;
390
+ if (i < maxRetries - 1) {
391
+ await this.sleep(delayMs * (i + 1));
392
+ }
393
+ }
394
+ }
395
+ throw lastError;
396
+ }
397
+ /**
398
+ * Format transaction hash with ellipsis
399
+ */
400
+ static shortenHash(hash, startLength = 6, endLength = 4) {
401
+ if (hash.length <= startLength + endLength) {
402
+ return hash;
403
+ }
404
+ return `${hash.slice(0, startLength)}...${hash.slice(-endLength)}`;
405
+ }
406
+ /**
407
+ * Check if a transaction was successful
408
+ */
409
+ static isTransactionSuccessful(receipt) {
410
+ return receipt?.status === 1;
411
+ }
412
+ }
413
+
414
+ /**
415
+ * TransactionBuilder class for creating blockchain transactions
416
+ * Returns unsigned transaction data that can be signed and sent by the frontend
417
+ *
418
+ * This is a TEMPLATE - add your own transaction methods based on your contract functions
419
+ */
420
+ class TransactionBuilder {
421
+ /**
422
+ * Initialize TransactionBuilder
423
+ * @param provider - Ethers provider instance
424
+ * @param contractAddress - Main protocol contract address
425
+ * @param abi - Contract ABI
426
+ */
427
+ constructor(provider, contractAddress, abi) {
428
+ this.provider = provider;
429
+ this.contractAddress = Utils.validateAddress(contractAddress);
430
+ this.contract = new ethers.ethers.Contract(this.contractAddress, abi, provider);
431
+ }
432
+ // ============================================
433
+ // ADD YOUR TRANSACTION PREPARATION METHODS HERE
434
+ // ============================================
435
+ /**
436
+ * Example method - Replace with your actual contract functions
437
+ *
438
+ * Template for preparing a transaction:
439
+ *
440
+ * async prepareYourTransaction(params: YourParams): Promise<TransactionRequest> {
441
+ * try {
442
+ * // 1. Validate inputs
443
+ * Utils.validateAddress(params.someAddress);
444
+ * Utils.validateAmount(params.amount);
445
+ *
446
+ * // 2. Populate transaction from your contract
447
+ * const tx = await this.contract.yourFunction.populateTransaction(
448
+ * params.arg1,
449
+ * params.arg2,
450
+ * // ... your parameters
451
+ * );
452
+ *
453
+ * // 3. Estimate gas (optional but recommended)
454
+ * try {
455
+ * const gasEstimate = await this.contract.yourFunction.estimateGas(
456
+ * params.arg1,
457
+ * params.arg2
458
+ * );
459
+ * tx.gasLimit = Utils.addGasBuffer(gasEstimate);
460
+ * } catch (error) {
461
+ * // Fallback to a default gas limit if estimation fails
462
+ * tx.gasLimit = BigInt(200000);
463
+ * console.warn('Gas estimation failed, using default:', error);
464
+ * }
465
+ *
466
+ * // 4. Return the unsigned transaction
467
+ * return tx;
468
+ * } catch (error) {
469
+ * throw new SDKError(
470
+ * `Failed to prepare transaction: ${Utils.parseContractError(error)}`,
471
+ * ErrorType.TRANSACTION_ERROR,
472
+ * { params }
473
+ * );
474
+ * }
475
+ * }
476
+ */
477
+ // ============================================
478
+ // UTILITY METHODS (Keep these - they're useful for any protocol)
479
+ // ============================================
480
+ /**
481
+ * Create a contract instance for custom interactions
482
+ * @param abi - Contract ABI
483
+ * @param address - Contract address (optional, defaults to main contract)
484
+ */
485
+ getContractInstance(abi, address) {
486
+ const contractAddress = address || this.contractAddress;
487
+ Utils.validateAddress(contractAddress);
488
+ return new ethers.ethers.Contract(contractAddress, abi, this.provider);
489
+ }
490
+ /**
491
+ * Get the main contract instance
492
+ */
493
+ getContract() {
494
+ return this.contract;
495
+ }
496
+ /**
497
+ * Get the provider
498
+ */
499
+ getProvider() {
500
+ return this.provider;
501
+ }
502
+ /**
503
+ * Estimate gas for any transaction
504
+ * @param tx - Transaction request
505
+ */
506
+ async estimateGas(tx) {
507
+ try {
508
+ const gasEstimate = await this.provider.estimateGas(tx);
509
+ return BigInt(Utils.addGasBuffer(gasEstimate));
510
+ }
511
+ catch (error) {
512
+ throw new SDKError(`Failed to estimate gas: ${Utils.parseContractError(error)}`, exports.ErrorType.TRANSACTION_ERROR);
513
+ }
514
+ }
515
+ /**
516
+ * Get current gas prices
517
+ */
518
+ async getGasPrices() {
519
+ return Utils.getGasPrices(this.provider);
520
+ }
521
+ }
522
+
523
+ /**
524
+ * Main SDK class that combines all functionality
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * import { ProtocolSDK } from '@yourorg/protocol-sdk';
529
+ * import { ethers } from 'ethers';
530
+ *
531
+ * const provider = new ethers.JsonRpcProvider('YOUR_RPC_URL');
532
+ *
533
+ * const sdk = new ProtocolSDK({
534
+ * apiBaseURL: 'https://api.yourprotocol.com',
535
+ * provider: provider,
536
+ * contractAddress: '0x...',
537
+ * abi: YourContractABI,
538
+ * apiKey: 'your-api-key', // optional
539
+ * });
540
+ *
541
+ * // Use the SDK
542
+ * const markets = await sdk.api.getAllMarkets();
543
+ * const tx = await sdk.tx.prepareSwapTransaction({ ... });
544
+ * ```
545
+ */
546
+ class ProtocolSDK {
547
+ /**
548
+ * Initialize the SDK
549
+ * @param config - SDK configuration
550
+ */
551
+ constructor(config) {
552
+ // Validate configuration
553
+ this.validateConfig(config);
554
+ // Initialize components
555
+ this.provider = config.provider;
556
+ this.contractAddress = config.contractAddress;
557
+ this.chainId = config.chainId;
558
+ this.api = new APIClient(config.apiBaseURL, config.apiKey);
559
+ this.tx = new TransactionBuilder(config.provider, config.contractAddress, config.abi);
560
+ this.utils = Utils;
561
+ }
562
+ /**
563
+ * Validate SDK configuration
564
+ */
565
+ validateConfig(config) {
566
+ if (!config.apiBaseURL) {
567
+ throw new SDKError('apiBaseURL is required', exports.ErrorType.VALIDATION_ERROR);
568
+ }
569
+ if (!config.provider) {
570
+ throw new SDKError('provider is required', exports.ErrorType.VALIDATION_ERROR);
571
+ }
572
+ if (!config.contractAddress) {
573
+ throw new SDKError('contractAddress is required', exports.ErrorType.VALIDATION_ERROR);
574
+ }
575
+ if (!config.abi || !Array.isArray(config.abi)) {
576
+ throw new SDKError('abi must be an array', exports.ErrorType.VALIDATION_ERROR);
577
+ }
578
+ // Validate contract address format
579
+ if (!Utils.isValidAddress(config.contractAddress)) {
580
+ throw new SDKError('Invalid contract address', exports.ErrorType.VALIDATION_ERROR);
581
+ }
582
+ }
583
+ /**
584
+ * Get network information
585
+ */
586
+ async getNetworkInfo() {
587
+ try {
588
+ const network = await this.provider.getNetwork();
589
+ return {
590
+ name: Utils.getNetworkName(Number(network.chainId)),
591
+ chainId: Number(network.chainId),
592
+ };
593
+ }
594
+ catch (error) {
595
+ throw new SDKError(`Failed to get network info: ${error}`, exports.ErrorType.NETWORK_ERROR);
596
+ }
597
+ }
598
+ /**
599
+ * Get current block number
600
+ */
601
+ async getBlockNumber() {
602
+ try {
603
+ return await this.provider.getBlockNumber();
604
+ }
605
+ catch (error) {
606
+ throw new SDKError(`Failed to get block number: ${error}`, exports.ErrorType.NETWORK_ERROR);
607
+ }
608
+ }
609
+ /**
610
+ * Check if provider is connected
611
+ */
612
+ async isConnected() {
613
+ try {
614
+ await this.provider.getBlockNumber();
615
+ return true;
616
+ }
617
+ catch {
618
+ return false;
619
+ }
620
+ }
621
+ /**
622
+ * Get transaction receipt
623
+ * @param txHash - Transaction hash
624
+ */
625
+ async getTransactionReceipt(txHash) {
626
+ try {
627
+ return await this.provider.getTransactionReceipt(txHash);
628
+ }
629
+ catch (error) {
630
+ throw new SDKError(`Failed to get transaction receipt: ${error}`, exports.ErrorType.NETWORK_ERROR, { txHash });
631
+ }
632
+ }
633
+ /**
634
+ * Wait for transaction confirmation
635
+ * @param txHash - Transaction hash
636
+ * @param confirmations - Number of confirmations to wait for
637
+ */
638
+ async waitForTransaction(txHash, confirmations = 1) {
639
+ return Utils.waitForTransaction(txHash, this.provider, confirmations);
640
+ }
641
+ /**
642
+ * Get SDK version
643
+ */
644
+ static getVersion() {
645
+ return '1.0.0'; // This should match package.json version
646
+ }
647
+ }
648
+
649
+ /**
650
+ * Network configuration
651
+ */
652
+ const NETWORKS = {
653
+ MAINNET: {
654
+ chainId: 1,
655
+ name: 'Ethereum Mainnet',
656
+ rpcUrl: 'https://eth.llamarpc.com',
657
+ },
658
+ GOERLI: {
659
+ chainId: 5,
660
+ name: 'Goerli Testnet',
661
+ rpcUrl: 'https://goerli.infura.io/v3/',
662
+ },
663
+ SEPOLIA: {
664
+ chainId: 11155111,
665
+ name: 'Sepolia Testnet',
666
+ rpcUrl: 'https://sepolia.infura.io/v3/',
667
+ },
668
+ POLYGON: {
669
+ chainId: 137,
670
+ name: 'Polygon Mainnet',
671
+ rpcUrl: 'https://polygon-rpc.com',
672
+ },
673
+ ARBITRUM: {
674
+ chainId: 42161,
675
+ name: 'Arbitrum One',
676
+ rpcUrl: 'https://arb1.arbitrum.io/rpc',
677
+ },
678
+ };
679
+ /**
680
+ * API endpoints
681
+ */
682
+ const API_ENDPOINTS = {
683
+ MARKET_DATA: '/markets',
684
+ USER_BALANCE: '/balance',
685
+ TRANSACTIONS: '/transactions',
686
+ PRICES: '/prices',
687
+ };
688
+ /**
689
+ * Contract method names
690
+ */
691
+ const CONTRACT_METHODS = {
692
+ SWAP: 'swap',
693
+ DEPOSIT: 'deposit',
694
+ WITHDRAW: 'withdraw',
695
+ APPROVE: 'approve',
696
+ BALANCE_OF: 'balanceOf',
697
+ ALLOWANCE: 'allowance',
698
+ };
699
+ /**
700
+ * Token decimals (common tokens)
701
+ */
702
+ const TOKEN_DECIMALS = {
703
+ ETH: 18,
704
+ USDC: 6,
705
+ USDT: 6,
706
+ DAI: 18,
707
+ WBTC: 8,
708
+ };
709
+ /**
710
+ * Gas limit estimates for different operations
711
+ */
712
+ const GAS_LIMITS = {
713
+ APPROVE: 50000,
714
+ SWAP: 200000,
715
+ DEPOSIT: 150000,
716
+ WITHDRAW: 150000,
717
+ TRANSFER: 21000,
718
+ };
719
+ /**
720
+ * Default transaction deadline (20 minutes from now)
721
+ */
722
+ const DEFAULT_DEADLINE_MINUTES = 20;
723
+ /**
724
+ * Maximum uint256 value for unlimited approvals
725
+ */
726
+ const MAX_UINT256 = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
727
+ /**
728
+ * Zero address
729
+ */
730
+ const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
731
+
732
+ exports.APIClient = APIClient;
733
+ exports.API_ENDPOINTS = API_ENDPOINTS;
734
+ exports.CONTRACT_METHODS = CONTRACT_METHODS;
735
+ exports.DEFAULT_DEADLINE_MINUTES = DEFAULT_DEADLINE_MINUTES;
736
+ exports.GAS_LIMITS = GAS_LIMITS;
737
+ exports.MAX_UINT256 = MAX_UINT256;
738
+ exports.NETWORKS = NETWORKS;
739
+ exports.ProtocolSDK = ProtocolSDK;
740
+ exports.SDKError = SDKError;
741
+ exports.TOKEN_DECIMALS = TOKEN_DECIMALS;
742
+ exports.TransactionBuilder = TransactionBuilder;
743
+ exports.Utils = Utils;
744
+ exports.ZERO_ADDRESS = ZERO_ADDRESS;
745
+ exports.default = ProtocolSDK;
746
+ //# sourceMappingURL=index.js.map