@defindex/sdk 0.1.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 (46) hide show
  1. package/README.md +402 -0
  2. package/dist/clients/http-client.d.ts +21 -0
  3. package/dist/clients/http-client.d.ts.map +1 -0
  4. package/dist/clients/http-client.js +75 -0
  5. package/dist/clients/http-client.js.map +1 -0
  6. package/dist/defindex-sdk.d.ts +230 -0
  7. package/dist/defindex-sdk.d.ts.map +1 -0
  8. package/dist/defindex-sdk.js +270 -0
  9. package/dist/defindex-sdk.js.map +1 -0
  10. package/dist/index.d.ts +6 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +29 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/types/auth.types.d.ts +82 -0
  15. package/dist/types/auth.types.d.ts.map +1 -0
  16. package/dist/types/auth.types.js +4 -0
  17. package/dist/types/auth.types.js.map +1 -0
  18. package/dist/types/base.types.d.ts +12 -0
  19. package/dist/types/base.types.d.ts.map +1 -0
  20. package/dist/types/base.types.js +3 -0
  21. package/dist/types/base.types.js.map +1 -0
  22. package/dist/types/error.types.d.ts +123 -0
  23. package/dist/types/error.types.d.ts.map +1 -0
  24. package/dist/types/error.types.js +68 -0
  25. package/dist/types/error.types.js.map +1 -0
  26. package/dist/types/factory.types.d.ts +15 -0
  27. package/dist/types/factory.types.d.ts.map +1 -0
  28. package/dist/types/factory.types.js +3 -0
  29. package/dist/types/factory.types.js.map +1 -0
  30. package/dist/types/index.d.ts +7 -0
  31. package/dist/types/index.d.ts.map +1 -0
  32. package/dist/types/index.js +24 -0
  33. package/dist/types/index.js.map +1 -0
  34. package/dist/types/network.types.d.ts +5 -0
  35. package/dist/types/network.types.d.ts.map +1 -0
  36. package/dist/types/network.types.js +10 -0
  37. package/dist/types/network.types.js.map +1 -0
  38. package/dist/types/stellar.types.d.ts +29 -0
  39. package/dist/types/stellar.types.d.ts.map +1 -0
  40. package/dist/types/stellar.types.js +3 -0
  41. package/dist/types/stellar.types.js.map +1 -0
  42. package/dist/types/vault.types.d.ts +253 -0
  43. package/dist/types/vault.types.d.ts.map +1 -0
  44. package/dist/types/vault.types.js +3 -0
  45. package/dist/types/vault.types.js.map +1 -0
  46. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,402 @@
1
+ # DeFindex SDK
2
+
3
+ Official TypeScript SDK for [DeFindex](https://defindex.io) - A decentralized vault management system built on Stellar using Soroban smart contracts.
4
+
5
+ ## ๐ŸŒŸ Features
6
+
7
+ - **๐Ÿ” API Key Authentication**: Secure API key authentication with Bearer tokens (recommended)
8
+ - **๐Ÿฆ Vault Operations**: Create, deposit, withdraw, and manage decentralized vaults
9
+ - **๐Ÿญ Factory Operations**: Deploy new vaults with custom configurations
10
+ - **๐Ÿ‘‘ Admin Operations**: Emergency rescue, strategy management for vault operators
11
+ - **๐Ÿ“Š Real-time Data**: Vault balances, APY tracking, and comprehensive vault information
12
+ - **๐Ÿ”’ Server-Side Focused**: Secure handling of credentials and sensitive operations
13
+ - **๐Ÿ“ TypeScript Support**: Full type safety with comprehensive interfaces
14
+ - **โšก Lightweight**: Simple authentication and comprehensive error handling
15
+ - **๐Ÿงช Well Tested**: Comprehensive unit and integration test coverage
16
+ - **๐Ÿ“š Complete Examples**: Functional TypeScript examples and comprehensive documentation
17
+
18
+ ## ๐Ÿš€ Installation
19
+
20
+ ```bash
21
+ npm install @defindex/sdk
22
+ ```
23
+
24
+ ## ๐Ÿ“– Quick Start
25
+
26
+ ```typescript
27
+ import { DefindexSDK, SupportedNetworks } from '@defindex/sdk';
28
+
29
+ // Initialize with API key
30
+ const sdk = new DefindexSDK({
31
+ apiKey: 'sk_your_api_key_here',
32
+ baseUrl: 'https://api.defindex.io'
33
+ });
34
+
35
+ // Check API health
36
+ const health = await sdk.healthCheck();
37
+ console.log('API Status:', health.status.reachable);
38
+
39
+ // Get factory address
40
+ const factory = await sdk.getFactoryAddress(SupportedNetworks.TESTNET);
41
+ console.log('Factory Address:', factory.address);
42
+
43
+ // Get vault information
44
+ const vaultAddress = 'CVAULT_CONTRACT_ADDRESS...';
45
+ const vaultInfo = await sdk.getVaultInfo(vaultAddress, SupportedNetworks.TESTNET);
46
+ console.log(`Vault: ${vaultInfo.name} (${vaultInfo.symbol})`);
47
+
48
+ // Deposit to vault
49
+ const depositResponse = await sdk.depositToVault(vaultAddress, {
50
+ amounts: [1000000], // Amount for each asset (considering decimals)
51
+ caller: 'GUSER_ADDRESS...',
52
+ invest: true,
53
+ slippageBps: 100 // 1% slippage tolerance
54
+ }, SupportedNetworks.TESTNET);
55
+
56
+ // Sign the XDR with your wallet and submit
57
+ const signedXdr = await yourWallet.sign(depositResponse.xdr);
58
+ const result = await sdk.sendTransaction(signedXdr, SupportedNetworks.TESTNET, false);
59
+ ```
60
+
61
+ ## ๐Ÿš€ Running the Example
62
+
63
+ The SDK includes a comprehensive functional example:
64
+
65
+ ```bash
66
+ # Install dependencies
67
+ pnpm install
68
+
69
+ # Copy environment configuration
70
+ cp .env.example .env
71
+
72
+ # Edit .env with your credentials
73
+ # DEFINDEX_API_KEY=sk_your_api_key_here
74
+
75
+ # Run the example
76
+ pnpm run example
77
+ ```
78
+
79
+ The example demonstrates:
80
+ - SDK initialization and authentication
81
+ - API health checking
82
+ - Factory operations
83
+ - Vault creation, deposits, and withdrawals
84
+ - Administrative vault management
85
+ - Error handling and best practices
86
+
87
+ ## ๐Ÿ”ง Configuration
88
+
89
+ ### SDK Configuration Options
90
+
91
+ ```typescript
92
+ interface DefindexSDKConfig {
93
+ apiKey?: string; // API key for authentication (recommended)
94
+ baseUrl?: string; // Custom API base URL (defaults to 'https://api.defindex.io')
95
+ timeout?: number; // Request timeout in ms (defaults to 30000)
96
+ }
97
+ ```
98
+
99
+ ### Environment Variables
100
+
101
+ For better security, use environment variables:
102
+
103
+ ```typescript
104
+ // Using API key (recommended)
105
+ const sdk = new DefindexSDK({
106
+ apiKey: process.env.DEFINDEX_API_KEY,
107
+ baseUrl: process.env.DEFINDEX_API_URL || 'https://api.defindex.io'
108
+ });
109
+ ```
110
+
111
+ ## โœ… Current Status
112
+
113
+ **Great News!** The DeFindex API is now fully operational on testnet:
114
+
115
+ - โœ… **Health Check**: Working correctly
116
+ - โœ… **SDK Authentication**: API key authentication implemented
117
+ - โœ… **Factory Operations**: Factory deployed and working on testnet
118
+ - โœ… **Vault Creation**: Create vaults with custom configurations
119
+ - โœ… **Vault Operations**: Full deposit, withdrawal, and balance operations
120
+ - โœ… **Vault Management**: Administrative operations (pause/unpause strategies, emergency rescue)
121
+ - โœ… **Transaction Building**: All operations return signed XDR for wallet integration
122
+ - โš ๏ธ **APY Calculation**: Working but some fields may be undefined for new vaults
123
+
124
+ ### Recent Updates
125
+
126
+ 1. โœ… **Factory Deployed**: Factory contract now available on testnet
127
+ 2. โœ… **Full Vault Operations**: Create, manage, and interact with vaults
128
+ 3. โœ… **Complete Example**: Run `pnpm run example` to see all functionality
129
+ 4. โœ… **Ready for Production**: All core functionality is operational
130
+
131
+ ## ๐Ÿ“š API Reference
132
+
133
+ ### System Operations
134
+
135
+ #### Health Check
136
+ ```typescript
137
+ const health = await sdk.healthCheck();
138
+ if (health.status.reachable) {
139
+ console.log('API is healthy');
140
+ }
141
+ ```
142
+
143
+ ### Factory Operations
144
+
145
+ #### Get Factory Address
146
+ ```typescript
147
+ const factory = await sdk.getFactoryAddress(SupportedNetworks.TESTNET);
148
+ console.log('Factory address:', factory.address);
149
+ ```
150
+
151
+ #### Create Vault
152
+ ```typescript
153
+ const vaultConfig: CreateDefindexVault = {
154
+ roles: {
155
+ 0: "GEMERGENCY_MANAGER_ADDRESS...", // Emergency Manager
156
+ 1: "GFEE_RECEIVER_ADDRESS...", // Fee Receiver
157
+ 2: "GVAULT_MANAGER_ADDRESS...", // Vault Manager
158
+ 3: "GREBALANCE_MANAGER_ADDRESS..." // Rebalance Manager
159
+ },
160
+ vault_fee_bps: 100, // 1% fee
161
+ assets: [{
162
+ address: "CXLM_CONTRACT_ADDRESS...",
163
+ strategies: [{
164
+ address: "GSTRATEGY_CONTRACT_ADDRESS...",
165
+ name: "XLM Strategy",
166
+ paused: false
167
+ }]
168
+ }],
169
+ name_symbol: {
170
+ name: "My DeFi Vault",
171
+ symbol: "MDV"
172
+ },
173
+ upgradable: true,
174
+ caller: "GCREATOR_ADDRESS..."
175
+ };
176
+
177
+ const response = await sdk.createVault(vaultConfig, SupportedNetworks.TESTNET);
178
+ console.log('Vault XDR:', response.xdr);
179
+ ```
180
+
181
+ ### Vault Operations
182
+
183
+ #### Get Vault Information
184
+ ```typescript
185
+ const vaultInfo = await sdk.getVaultInfo(vaultAddress, SupportedNetworks.TESTNET);
186
+ console.log(`Total Assets: ${vaultInfo.totalAssets}`);
187
+ console.log(`Vault Fee: ${vaultInfo.feesBps.vaultFee / 100}%`);
188
+ ```
189
+
190
+ #### Get Vault Balance
191
+ ```typescript
192
+ const balance = await sdk.getVaultBalance(
193
+ vaultAddress,
194
+ userAddress,
195
+ SupportedNetworks.TESTNET
196
+ );
197
+ console.log(`Vault Shares: ${balance.dfTokens}`);
198
+ ```
199
+
200
+ #### Deposit to Vault
201
+ ```typescript
202
+ const depositResponse = await sdk.depositToVault(vaultAddress, {
203
+ amounts: [1000000, 2000000],
204
+ caller: 'GUSER_ADDRESS...',
205
+ invest: true,
206
+ slippageBps: 100
207
+ }, SupportedNetworks.TESTNET);
208
+ ```
209
+
210
+ #### Withdraw from Vault
211
+ ```typescript
212
+ // Withdraw specific amounts
213
+ const withdrawResponse = await sdk.withdrawFromVault(vaultAddress, {
214
+ amounts: [500000, 1000000],
215
+ caller: 'GUSER_ADDRESS...',
216
+ slippageBps: 100
217
+ }, SupportedNetworks.TESTNET);
218
+
219
+ // Withdraw by shares
220
+ const shareResponse = await sdk.withdrawShares(vaultAddress, {
221
+ shares: 1000000,
222
+ caller: 'GUSER_ADDRESS...',
223
+ slippageBps: 100
224
+ }, SupportedNetworks.TESTNET);
225
+ ```
226
+
227
+ #### Get Vault APY
228
+ ```typescript
229
+ const apy = await sdk.getVaultAPY(vaultAddress, SupportedNetworks.TESTNET);
230
+ console.log(`Current APY: ${apy.apyPercent}%`);
231
+ ```
232
+
233
+ ### Vault Management (Admin Operations)
234
+
235
+ #### Emergency Rescue
236
+ ```typescript
237
+ // Requires Emergency Manager role
238
+ const response = await sdk.emergencyRescue(vaultAddress, {
239
+ strategy_address: 'GSTRATEGY_TO_RESCUE...',
240
+ caller: 'GEMERGENCY_MANAGER_ADDRESS...'
241
+ }, SupportedNetworks.TESTNET);
242
+ ```
243
+
244
+ #### Pause/Unpause Strategy
245
+ ```typescript
246
+ // Requires Strategy Manager role
247
+ await sdk.pauseStrategy(vaultAddress, {
248
+ strategy_address: 'GSTRATEGY_TO_PAUSE...',
249
+ caller: 'GSTRATEGY_MANAGER_ADDRESS...'
250
+ }, SupportedNetworks.TESTNET);
251
+
252
+ await sdk.unpauseStrategy(vaultAddress, {
253
+ strategy_address: 'GSTRATEGY_TO_UNPAUSE...',
254
+ caller: 'GSTRATEGY_MANAGER_ADDRESS...'
255
+ }, SupportedNetworks.TESTNET);
256
+ ```
257
+
258
+ ### Transaction Management
259
+
260
+ #### Send Transaction
261
+ ```typescript
262
+ // Submit via Stellar directly
263
+ const response = await sdk.sendTransaction(
264
+ signedXDR,
265
+ SupportedNetworks.TESTNET,
266
+ false // Don't use LaunchTube
267
+ );
268
+
269
+ // Submit via LaunchTube (faster, more reliable)
270
+ const response = await sdk.sendTransaction(
271
+ signedXDR,
272
+ SupportedNetworks.TESTNET,
273
+ true // Use LaunchTube
274
+ );
275
+ ```
276
+
277
+ ### System Operations
278
+
279
+ #### Health Check
280
+ ```typescript
281
+ const health = await sdk.healthCheck();
282
+ if (health.status.reachable) {
283
+ console.log('API is healthy');
284
+ }
285
+ ```
286
+
287
+ ## ๐Ÿ” Security Best Practices
288
+
289
+ 1. **Environment Variables**: Store credentials in environment variables, not in code
290
+ 2. **Server-Side Only**: This SDK is designed for server-side use only
291
+ 3. **Credential Security**: Keep credentials secure and never commit them to version control
292
+ 4. **Error Handling**: Always wrap API calls in try-catch blocks
293
+ 5. **Token Management**: Use refresh tokens for long-running applications
294
+
295
+ ```typescript
296
+ try {
297
+ const vaultInfo = await sdk.getVaultInfo(vaultAddress, network);
298
+ // Handle success
299
+ } catch (error) {
300
+ console.error('Operation failed:', error.message);
301
+ // Handle error appropriately
302
+ }
303
+ ```
304
+
305
+ ## ๐Ÿ”’ Vault Management Roles
306
+
307
+ The SDK supports different operational roles:
308
+ - **Vault Managers**: Can create and configure vaults
309
+ - **Emergency Managers**: Can execute emergency rescues
310
+ - **Strategy Managers**: Can pause/unpause individual strategies
311
+ - **Regular Users**: Can deposit, withdraw, and view vault information
312
+
313
+ ## ๐Ÿ—๏ธ Development
314
+
315
+ ### Building
316
+ ```bash
317
+ pnpm run build
318
+ ```
319
+
320
+ ### Testing
321
+
322
+ #### Unit Tests (Mocked)
323
+ ```bash
324
+ # Run unit tests
325
+ pnpm test
326
+
327
+ # Run with coverage
328
+ pnpm run test:coverage
329
+
330
+ # Watch mode
331
+ pnpm run test:watch
332
+
333
+ # Run integration tests
334
+ pnpm run test:integration
335
+
336
+ # Run all tests
337
+ pnpm run test:all
338
+ ```
339
+
340
+ ### Code Quality
341
+ ```bash
342
+ pnpm run lint
343
+ pnpm run lint:fix
344
+ ```
345
+
346
+ ## ๐Ÿ“Š Type Definitions
347
+
348
+ The SDK exports comprehensive TypeScript types:
349
+
350
+ ```typescript
351
+ import {
352
+ DefindexSDK,
353
+ DefindexSDKConfig,
354
+ SupportedNetworks,
355
+ CreateDefindexVault,
356
+ DepositToVaultParams,
357
+ WithdrawFromVaultParams,
358
+ WithdrawSharesParams,
359
+ VaultInfo,
360
+ VaultBalance,
361
+ VaultAPY,
362
+ // ... and many more
363
+ } from '@defindex/sdk';
364
+ ```
365
+
366
+ ## ๐ŸŒ Frontend Integration
367
+
368
+ While server-side focused, you can create secure frontend integrations:
369
+
370
+ ```typescript
371
+ // Backend API endpoint using API key
372
+ app.post('/api/vault-info', async (req, res) => {
373
+ try {
374
+ const sdk = new DefindexSDK({
375
+ apiKey: process.env.DEFINDEX_API_KEY
376
+ });
377
+
378
+ const vaultInfo = await sdk.getVaultInfo(req.body.vaultAddress, req.body.network);
379
+ res.json(vaultInfo);
380
+ } catch (error) {
381
+ res.status(500).json({ error: error.message });
382
+ }
383
+ });
384
+ ```
385
+
386
+ ## ๐Ÿ“– Documentation
387
+
388
+ For comprehensive examples and detailed API documentation, see:
389
+ - [examples/basic-example.ts](./examples/basic-example.ts) - Complete functional example
390
+ - [EXAMPLES.md](./EXAMPLES.md) - Comprehensive usage examples
391
+ - [docs/defindex-sdk-docs.md](./docs/defindex-sdk-docs.md) - Complete SDK documentation
392
+ - [CLAUDE.md](./CLAUDE.md) - Development guidance and architecture notes
393
+ - [API Documentation](https://api.defindex.io) - Complete API reference
394
+
395
+ ## ๐Ÿ”— Links
396
+
397
+ - [DeFindex](https://defindex.io)
398
+ - [GitHub Repository](https://github.com/paltalabs/defindex-sdk)
399
+
400
+ ---
401
+
402
+ Built with โค๏ธ by the PaltaLabs team.
@@ -0,0 +1,21 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ /**
3
+ * HTTP client wrapper with API key authentication and error handling
4
+ */
5
+ export declare class HttpClient {
6
+ private client;
7
+ constructor(baseURL: string, apiKey: string, timeout?: number);
8
+ /**
9
+ * GET request
10
+ */
11
+ get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
12
+ /**
13
+ * POST request
14
+ */
15
+ post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
16
+ /**
17
+ * Build URL with query parameters
18
+ */
19
+ buildUrlWithQuery(baseUrl: string, params: Record<string, any>): string;
20
+ }
21
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/clients/http-client.ts"],"names":[],"mappings":"AACA,OAAc,EAAiB,kBAAkB,EAAiB,MAAM,OAAO,CAAC;AAEhF;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAgB;gBAG5B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAc;IAwCzB;;OAEG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAKlE;;OAEG;IACG,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAK/E;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;CAaxE"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HttpClient = void 0;
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ const axios_1 = __importDefault(require("axios"));
9
+ /**
10
+ * HTTP client wrapper with API key authentication and error handling
11
+ */
12
+ class HttpClient {
13
+ constructor(baseURL, apiKey, timeout = 30000) {
14
+ this.client = axios_1.default.create({
15
+ baseURL,
16
+ timeout,
17
+ headers: {
18
+ 'Content-Type': 'application/json',
19
+ ...(apiKey && { 'Authorization': `Bearer ${apiKey}` }),
20
+ },
21
+ // Add custom transformRequest to handle BigInt serialization
22
+ transformRequest: [
23
+ (data) => {
24
+ if (data && typeof data === 'object') {
25
+ return JSON.stringify(data, (_, value) => typeof value === 'bigint' ? value.toString() : value);
26
+ }
27
+ return data;
28
+ }
29
+ ],
30
+ });
31
+ // Add response interceptor for error handling
32
+ this.client.interceptors.response.use((response) => response, (error) => {
33
+ // Return the exact same error content from the API
34
+ if (error.response) {
35
+ // Server responded with error status - return the exact response data
36
+ return Promise.reject(error.response.data);
37
+ }
38
+ else {
39
+ // Network or other errors - return the original error
40
+ return Promise.reject(error);
41
+ }
42
+ });
43
+ }
44
+ /**
45
+ * GET request
46
+ */
47
+ async get(url, config) {
48
+ const response = await this.client.get(url, config);
49
+ return response.data;
50
+ }
51
+ /**
52
+ * POST request
53
+ */
54
+ async post(url, data, config) {
55
+ const response = await this.client.post(url, data, config);
56
+ return response.data;
57
+ }
58
+ /**
59
+ * Build URL with query parameters
60
+ */
61
+ buildUrlWithQuery(baseUrl, params) {
62
+ const queryString = Object.entries(params)
63
+ .filter(([, value]) => value !== undefined && value !== null)
64
+ .map(([key, value]) => {
65
+ if (Array.isArray(value)) {
66
+ return value.map(v => `${encodeURIComponent(key)}=${encodeURIComponent(v)}`).join('&');
67
+ }
68
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
69
+ })
70
+ .join('&');
71
+ return queryString ? `${baseUrl}?${queryString}` : baseUrl;
72
+ }
73
+ }
74
+ exports.HttpClient = HttpClient;
75
+ //# sourceMappingURL=http-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/clients/http-client.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,kDAAgF;AAEhF;;GAEG;AACH,MAAa,UAAU;IAGrB,YACE,OAAe,EACf,MAAc,EACd,UAAkB,KAAK;QAGvB,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO;YACP,OAAO;YACP,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,GAAG,CAAC,MAAM,IAAI,EAAE,eAAe,EAAE,UAAU,MAAM,EAAE,EAAE,CAAC;aACvD;YACD,6DAA6D;YAC7D,gBAAgB,EAAE;gBAChB,CAAC,IAAS,EAAE,EAAE;oBACZ,IAAI,IAAI,IAAI,OAAO,IAAI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