@defindex/sdk 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/.DS_Store +0 -0
- package/dist/defindex-sdk.d.ts +136 -78
- package/dist/defindex-sdk.d.ts.map +1 -1
- package/dist/defindex-sdk.js +168 -78
- package/dist/defindex-sdk.js.map +1 -1
- package/dist/types/factory.types.d.ts +71 -0
- package/dist/types/factory.types.d.ts.map +1 -1
- package/package.json +14 -16
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
# DeFindex SDK
|
|
2
|
+
[](https://deepwiki.com/defindex/sdk)
|
|
3
|
+
[](https://www.npmjs.com/package/@defindex/sdk)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
5
|
|
|
3
6
|
Official TypeScript SDK for [DeFindex](https://defindex.io) - A decentralized vault management system built on Stellar using Soroban smart contracts.
|
|
4
7
|
|
package/dist/.DS_Store
ADDED
|
Binary file
|
package/dist/defindex-sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateDefindexVault, CreateDefindexVaultDepositDto, CreateVaultDepositResponse, CreateVaultResponse, DepositToVaultParams, DistributeFeesParams, FactoryAddressResponse, LaunchTubeResponse, LockFeesParams, PauseStrategyParams, RebalanceParams, ReleaseFeesParams, RescueFromVaultParams, SendTransactionResponse, SetVaultRoleParams, SupportedNetworks, UnpauseStrategyParams, UpgradeWasmParams, VaultApyResponse, VaultBalanceResponse, VaultInfoResponse, VaultRoleResponse, VaultRoles, VaultTransactionResponse, WithdrawParams, WithdrawSharesParams } from './types';
|
|
1
|
+
import { CreateDefindexVault, CreateDefindexVaultDepositDto, CreateVaultAutoInvestParams, CreateVaultAutoInvestResponse, CreateVaultDepositResponse, CreateVaultResponse, DepositToVaultParams, DistributeFeesParams, FactoryAddressResponse, LaunchTubeResponse, LockFeesParams, PauseStrategyParams, RebalanceParams, ReleaseFeesParams, RescueFromVaultParams, SendTransactionResponse, SetVaultRoleParams, SupportedNetworks, UnpauseStrategyParams, UpgradeWasmParams, VaultApyResponse, VaultBalanceResponse, VaultInfoResponse, VaultRoleResponse, VaultRoles, VaultTransactionResponse, WithdrawParams, WithdrawSharesParams } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Configuration options for the DeFindex SDK
|
|
4
4
|
*/
|
|
@@ -8,32 +8,60 @@ export interface DefindexSDKConfig {
|
|
|
8
8
|
baseUrl?: string;
|
|
9
9
|
/** Request timeout in milliseconds (defaults to 30000) */
|
|
10
10
|
timeout?: number;
|
|
11
|
+
/** Default network for all operations (can be overridden per method call) */
|
|
12
|
+
defaultNetwork?: SupportedNetworks;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* DeFindex SDK - TypeScript client for DeFindex API
|
|
14
16
|
*
|
|
15
17
|
* @example
|
|
16
18
|
* ```typescript
|
|
17
|
-
* // Basic initialization
|
|
19
|
+
* // Basic initialization with default network
|
|
18
20
|
* const sdk = new DefindexSDK({
|
|
19
|
-
* baseUrl: 'https://api.defindex.io'
|
|
21
|
+
* baseUrl: 'https://api.defindex.io',
|
|
22
|
+
* defaultNetwork: SupportedNetworks.TESTNET
|
|
20
23
|
* });
|
|
21
24
|
*
|
|
22
25
|
* // With API key authentication
|
|
23
26
|
* const sdk = new DefindexSDK({
|
|
24
27
|
* apiKey: 'sk_your_api_key_here',
|
|
25
|
-
* baseUrl: 'https://api.defindex.io'
|
|
28
|
+
* baseUrl: 'https://api.defindex.io',
|
|
29
|
+
* defaultNetwork: SupportedNetworks.MAINNET
|
|
26
30
|
* });
|
|
31
|
+
*
|
|
32
|
+
* // Now you can call methods without specifying network
|
|
33
|
+
* const vaultInfo = await sdk.getVaultInfo('CVAULT...');
|
|
34
|
+
*
|
|
35
|
+
* // Or override for a specific call
|
|
36
|
+
* const testnetInfo = await sdk.getVaultInfo('CVAULT...', SupportedNetworks.TESTNET);
|
|
27
37
|
* ```
|
|
28
38
|
*/
|
|
29
39
|
export declare class DefindexSDK {
|
|
30
40
|
private httpClient;
|
|
31
41
|
private config;
|
|
42
|
+
private defaultNetwork?;
|
|
32
43
|
/**
|
|
33
44
|
* Create a new DeFindex SDK instance
|
|
34
45
|
* @param config - SDK configuration options
|
|
35
46
|
*/
|
|
36
47
|
constructor(config: DefindexSDKConfig);
|
|
48
|
+
/**
|
|
49
|
+
* Get the network to use for a request
|
|
50
|
+
* @param network - Optional network override
|
|
51
|
+
* @returns The network to use (provided network or default)
|
|
52
|
+
* @throws Error if no network is provided and no default is set
|
|
53
|
+
*/
|
|
54
|
+
private getNetwork;
|
|
55
|
+
/**
|
|
56
|
+
* Get the current default network
|
|
57
|
+
* @returns The default network or undefined if not set
|
|
58
|
+
*/
|
|
59
|
+
getDefaultNetwork(): SupportedNetworks | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Set the default network for all operations
|
|
62
|
+
* @param network - The network to use as default
|
|
63
|
+
*/
|
|
64
|
+
setDefaultNetwork(network: SupportedNetworks): void;
|
|
37
65
|
/**
|
|
38
66
|
* Check API health status
|
|
39
67
|
* @returns Health status information
|
|
@@ -48,19 +76,19 @@ export declare class DefindexSDK {
|
|
|
48
76
|
healthCheck(): Promise<any>;
|
|
49
77
|
/**
|
|
50
78
|
* Get the factory contract address for a specific network
|
|
51
|
-
* @param network - Stellar network (
|
|
79
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
52
80
|
* @returns Factory contract address
|
|
53
81
|
* @example
|
|
54
82
|
* ```typescript
|
|
55
|
-
* const factory = await sdk.getFactoryAddress(
|
|
83
|
+
* const factory = await sdk.getFactoryAddress();
|
|
56
84
|
* console.log('Factory address:', factory.address);
|
|
57
85
|
* ```
|
|
58
86
|
*/
|
|
59
|
-
getFactoryAddress(network
|
|
87
|
+
getFactoryAddress(network?: SupportedNetworks): Promise<FactoryAddressResponse>;
|
|
60
88
|
/**
|
|
61
89
|
* Create a new vault (requires Vault Manager role)
|
|
62
90
|
* @param vaultConfig - Vault configuration including assets, fees, and roles
|
|
63
|
-
* @param network - Stellar network (
|
|
91
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
64
92
|
* @returns Transaction XDR for vault creation
|
|
65
93
|
* @example
|
|
66
94
|
* ```typescript
|
|
@@ -72,14 +100,14 @@ export declare class DefindexSDK {
|
|
|
72
100
|
* upgradable: true,
|
|
73
101
|
* caller: "GCALLER..."
|
|
74
102
|
* };
|
|
75
|
-
* const response = await sdk.createVault(vaultConfig
|
|
103
|
+
* const response = await sdk.createVault(vaultConfig);
|
|
76
104
|
* ```
|
|
77
105
|
*/
|
|
78
|
-
createVault(vaultConfig: CreateDefindexVault, network
|
|
106
|
+
createVault(vaultConfig: CreateDefindexVault, network?: SupportedNetworks): Promise<CreateVaultResponse>;
|
|
79
107
|
/**
|
|
80
108
|
* Create a new vault with initial deposit in a single transaction
|
|
81
109
|
* @param vaultConfig - Vault configuration with initial deposit amounts
|
|
82
|
-
* @param network - Stellar network (
|
|
110
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
83
111
|
* @returns Transaction XDR for vault creation and deposit
|
|
84
112
|
* @example
|
|
85
113
|
* ```typescript
|
|
@@ -87,72 +115,105 @@ export declare class DefindexSDK {
|
|
|
87
115
|
* // ... vault config
|
|
88
116
|
* deposit_amounts: [1000000, 2000000] // Initial deposit amounts
|
|
89
117
|
* };
|
|
90
|
-
* const response = await sdk.createVaultWithDeposit(vaultConfig
|
|
118
|
+
* const response = await sdk.createVaultWithDeposit(vaultConfig);
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
createVaultWithDeposit(vaultConfig: CreateDefindexVaultDepositDto, network?: SupportedNetworks): Promise<CreateVaultDepositResponse>;
|
|
122
|
+
/**
|
|
123
|
+
* Create a new vault with auto-invest in a single atomic transaction
|
|
124
|
+
*
|
|
125
|
+
* This endpoint creates a batched transaction that:
|
|
126
|
+
* 1. Creates the vault with initial deposit
|
|
127
|
+
* 2. Invests funds in specified strategies (rebalance)
|
|
128
|
+
* 3. Changes manager to the final address
|
|
129
|
+
*
|
|
130
|
+
* All operations are atomic - either all succeed or all fail.
|
|
131
|
+
*
|
|
132
|
+
* @param params - Auto-invest vault configuration with asset allocations and strategies
|
|
133
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
134
|
+
* @returns Transaction XDR, predicted vault address, and warning about address prediction
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const params = {
|
|
138
|
+
* caller: 'GCALLER...',
|
|
139
|
+
* roles: {
|
|
140
|
+
* emergencyManager: 'GEMERGENCY...',
|
|
141
|
+
* rebalanceManager: 'GREBALANCE...',
|
|
142
|
+
* feeReceiver: 'GFEE...',
|
|
143
|
+
* manager: 'GMANAGER...'
|
|
144
|
+
* },
|
|
145
|
+
* name: 'My Auto-Invest Vault',
|
|
146
|
+
* symbol: 'MAIV',
|
|
147
|
+
* vaultFee: 10, // 0.1% in basis points
|
|
148
|
+
* upgradable: true,
|
|
149
|
+
* assets: [{
|
|
150
|
+
* address: 'CASSET...',
|
|
151
|
+
* symbol: 'XLM',
|
|
152
|
+
* amount: 2000000000, // 200 XLM in stroops
|
|
153
|
+
* strategies: [
|
|
154
|
+
* { address: 'CSTRAT1...', name: 'hodl_strategy', amount: 1000000000 },
|
|
155
|
+
* { address: 'CSTRAT2...', name: 'yield_strategy', amount: 1000000000 }
|
|
156
|
+
* ]
|
|
157
|
+
* }]
|
|
158
|
+
* };
|
|
159
|
+
* const response = await sdk.createVaultAutoInvest(params);
|
|
160
|
+
* console.log('Sign this XDR:', response.xdr);
|
|
161
|
+
* console.log('Predicted vault address:', response.predictedVaultAddress);
|
|
91
162
|
* ```
|
|
92
163
|
*/
|
|
93
|
-
|
|
164
|
+
createVaultAutoInvest(params: CreateVaultAutoInvestParams, network?: SupportedNetworks): Promise<CreateVaultAutoInvestResponse>;
|
|
94
165
|
/**
|
|
95
166
|
* Get comprehensive vault information
|
|
96
167
|
* @param vaultAddress - The vault contract address
|
|
97
|
-
* @param network - Stellar network (
|
|
168
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
98
169
|
* @returns Vault metadata, assets, strategies, and TVL information
|
|
99
170
|
* @example
|
|
100
171
|
* ```typescript
|
|
101
|
-
* const vaultInfo = await sdk.getVaultInfo(
|
|
102
|
-
* 'CVAULT...',
|
|
103
|
-
* SupportedNetworks.TESTNET
|
|
104
|
-
* );
|
|
172
|
+
* const vaultInfo = await sdk.getVaultInfo('CVAULT...');
|
|
105
173
|
* console.log(`Vault: ${vaultInfo.name} (${vaultInfo.symbol})`);
|
|
106
174
|
* console.log(`Total Assets: ${vaultInfo.totalAssets}`);
|
|
107
175
|
* ```
|
|
108
176
|
*/
|
|
109
|
-
getVaultInfo(vaultAddress: string, network
|
|
177
|
+
getVaultInfo(vaultAddress: string, network?: SupportedNetworks): Promise<VaultInfoResponse>;
|
|
110
178
|
/**
|
|
111
179
|
* Get user's vault balance and shares
|
|
112
180
|
* @param vaultAddress - The vault contract address
|
|
113
181
|
* @param userAddress - User's wallet address
|
|
114
|
-
* @param network - Stellar network (
|
|
182
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
115
183
|
* @returns User's vault shares and underlying asset values
|
|
116
184
|
* @example
|
|
117
185
|
* ```typescript
|
|
118
|
-
* const balance = await sdk.getVaultBalance(
|
|
119
|
-
* 'CVAULT...',
|
|
120
|
-
* 'GUSER...',
|
|
121
|
-
* SupportedNetworks.TESTNET
|
|
122
|
-
* );
|
|
186
|
+
* const balance = await sdk.getVaultBalance('CVAULT...', 'GUSER...');
|
|
123
187
|
* console.log(`Shares: ${balance.dfTokens}`);
|
|
124
188
|
* console.log(`Underlying values: ${balance.underlyingBalance}`);
|
|
125
189
|
* ```
|
|
126
190
|
*/
|
|
127
|
-
getVaultBalance(vaultAddress: string, userAddress: string, network
|
|
191
|
+
getVaultBalance(vaultAddress: string, userAddress: string, network?: SupportedNetworks): Promise<VaultBalanceResponse>;
|
|
128
192
|
/**
|
|
129
193
|
* Get vault report with transaction details
|
|
130
194
|
* @param vaultAddress - The vault contract address
|
|
131
|
-
* @param network - Stellar network (
|
|
195
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
132
196
|
* @returns Vault report with transaction XDR and simulation response
|
|
133
197
|
* @example
|
|
134
198
|
* ```typescript
|
|
135
|
-
* const report = await sdk.getReport(
|
|
136
|
-
* 'CVAULT...',
|
|
137
|
-
* SupportedNetworks.TESTNET
|
|
138
|
-
* );
|
|
199
|
+
* const report = await sdk.getReport('CVAULT...');
|
|
139
200
|
* console.log(`Report XDR: ${report.xdr}`);
|
|
140
201
|
* ```
|
|
141
202
|
*/
|
|
142
|
-
getReport(vaultAddress: string, network
|
|
203
|
+
getReport(vaultAddress: string, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
143
204
|
/**
|
|
144
205
|
* Deposit assets into a vault
|
|
145
206
|
* @param vaultAddress - The vault contract address
|
|
146
207
|
* @param depositData - Deposit parameters including amounts and caller address
|
|
147
|
-
* @param network - Stellar network (
|
|
208
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
148
209
|
* @returns Transaction XDR for signing and simulation response
|
|
149
210
|
*/
|
|
150
|
-
depositToVault(vaultAddress: string, depositData: DepositToVaultParams, network
|
|
211
|
+
depositToVault(vaultAddress: string, depositData: DepositToVaultParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
151
212
|
/**
|
|
152
213
|
* Withdraw specific asset amounts from vault
|
|
153
214
|
* @param vaultAddress - The vault contract address
|
|
154
215
|
* @param withdrawData - Withdrawal parameters including amounts and caller
|
|
155
|
-
* @param network - Stellar network (
|
|
216
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
156
217
|
* @returns Transaction XDR for signing and simulation response
|
|
157
218
|
* @example
|
|
158
219
|
* ```typescript
|
|
@@ -161,35 +222,35 @@ export declare class DefindexSDK {
|
|
|
161
222
|
* caller: 'GUSER...',
|
|
162
223
|
* slippageBps: 100 // 1% slippage tolerance
|
|
163
224
|
* };
|
|
164
|
-
* const response = await sdk.withdrawFromVault('CVAULT...', withdrawData
|
|
225
|
+
* const response = await sdk.withdrawFromVault('CVAULT...', withdrawData);
|
|
165
226
|
* ```
|
|
166
227
|
*/
|
|
167
|
-
withdrawFromVault(vaultAddress: string, withdrawData: WithdrawParams, network
|
|
228
|
+
withdrawFromVault(vaultAddress: string, withdrawData: WithdrawParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
168
229
|
/**
|
|
169
230
|
* Withdraw vault shares for underlying assets
|
|
170
231
|
* @param vaultAddress - The vault contract address
|
|
171
232
|
* @param shareData - Share withdrawal parameters including share amount and caller
|
|
172
|
-
* @param network - Stellar network (
|
|
233
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
173
234
|
* @returns Transaction XDR for signing and simulation response
|
|
174
235
|
*/
|
|
175
|
-
withdrawShares(vaultAddress: string, shareData: WithdrawSharesParams, network
|
|
236
|
+
withdrawShares(vaultAddress: string, shareData: WithdrawSharesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
176
237
|
/**
|
|
177
238
|
* Get vault's Annual Percentage Yield (APY)
|
|
178
239
|
* @param vaultAddress - The vault contract address
|
|
179
|
-
* @param network - Stellar network (
|
|
240
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
180
241
|
* @returns APY information including percentage and calculation period
|
|
181
242
|
* @example
|
|
182
243
|
* ```typescript
|
|
183
|
-
* const apy = await sdk.getVaultAPY('CVAULT...'
|
|
244
|
+
* const apy = await sdk.getVaultAPY('CVAULT...');
|
|
184
245
|
* console.log(`APY: ${apy.apyPercent}% (calculated over ${apy.period})`);
|
|
185
246
|
* ```
|
|
186
247
|
*/
|
|
187
|
-
getVaultAPY(vaultAddress: string, network
|
|
248
|
+
getVaultAPY(vaultAddress: string, network?: SupportedNetworks): Promise<VaultApyResponse>;
|
|
188
249
|
/**
|
|
189
250
|
* Rebalance vault strategies (Rebalance Manager role required)
|
|
190
251
|
* @param vaultAddress - The vault contract address
|
|
191
252
|
* @param rebalanceData - Rebalance parameters including investment instructions
|
|
192
|
-
* @param network - Stellar network (
|
|
253
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
193
254
|
* @returns Transaction XDR for Rebalance Manager signing
|
|
194
255
|
* @example
|
|
195
256
|
* ```typescript
|
|
@@ -207,15 +268,15 @@ export declare class DefindexSDK {
|
|
|
207
268
|
* }
|
|
208
269
|
* ]
|
|
209
270
|
* };
|
|
210
|
-
* const response = await sdk.rebalanceVault('CVAULT...', rebalanceData
|
|
271
|
+
* const response = await sdk.rebalanceVault('CVAULT...', rebalanceData);
|
|
211
272
|
* ```
|
|
212
273
|
*/
|
|
213
|
-
rebalanceVault(vaultAddress: string, rebalanceData: RebalanceParams, network
|
|
274
|
+
rebalanceVault(vaultAddress: string, rebalanceData: RebalanceParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
214
275
|
/**
|
|
215
276
|
* Emergency rescue assets from strategy (Emergency Manager role required)
|
|
216
277
|
* @param vaultAddress - The vault contract address
|
|
217
278
|
* @param rescueData - Rescue parameters including strategy address and caller
|
|
218
|
-
* @param network - Stellar network (
|
|
279
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
219
280
|
* @returns Transaction XDR for Emergency Manager signing and rescued assets info
|
|
220
281
|
* @example
|
|
221
282
|
* ```typescript
|
|
@@ -223,15 +284,15 @@ export declare class DefindexSDK {
|
|
|
223
284
|
* strategy_address: 'CSTRATEGY...',
|
|
224
285
|
* caller: 'GEMERGENCY_MANAGER...'
|
|
225
286
|
* };
|
|
226
|
-
* const response = await sdk.emergencyRescue('CVAULT...', rescueData
|
|
287
|
+
* const response = await sdk.emergencyRescue('CVAULT...', rescueData);
|
|
227
288
|
* ```
|
|
228
289
|
*/
|
|
229
|
-
emergencyRescue(vaultAddress: string, rescueData: RescueFromVaultParams, network
|
|
290
|
+
emergencyRescue(vaultAddress: string, rescueData: RescueFromVaultParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
230
291
|
/**
|
|
231
292
|
* Pause a specific strategy (Strategy Manager role required)
|
|
232
293
|
* @param vaultAddress - The vault contract address
|
|
233
294
|
* @param strategyData - Strategy pause parameters
|
|
234
|
-
* @param network - Stellar network (
|
|
295
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
235
296
|
* @returns Transaction XDR for Strategy Manager signing
|
|
236
297
|
* @example
|
|
237
298
|
* ```typescript
|
|
@@ -239,15 +300,15 @@ export declare class DefindexSDK {
|
|
|
239
300
|
* strategy_address: 'CSTRATEGY...',
|
|
240
301
|
* caller: 'CSTRATEGY_MANAGER...'
|
|
241
302
|
* };
|
|
242
|
-
* const response = await sdk.pauseStrategy('CVAULT...', strategyData
|
|
303
|
+
* const response = await sdk.pauseStrategy('CVAULT...', strategyData);
|
|
243
304
|
* ```
|
|
244
305
|
*/
|
|
245
|
-
pauseStrategy(vaultAddress: string, strategyData: PauseStrategyParams, network
|
|
306
|
+
pauseStrategy(vaultAddress: string, strategyData: PauseStrategyParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
246
307
|
/**
|
|
247
308
|
* Unpause a specific strategy (Strategy Manager role required)
|
|
248
309
|
* @param vaultAddress - The vault contract address
|
|
249
310
|
* @param strategyData - Strategy unpause parameters
|
|
250
|
-
* @param network - Stellar network (
|
|
311
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
251
312
|
* @returns Transaction XDR for Strategy Manager signing
|
|
252
313
|
* @example
|
|
253
314
|
* ```typescript
|
|
@@ -255,32 +316,29 @@ export declare class DefindexSDK {
|
|
|
255
316
|
* strategy_address: 'CSTRATEGY...',
|
|
256
317
|
* caller: 'GSTRATEGY_MANAGER...'
|
|
257
318
|
* };
|
|
258
|
-
* const response = await sdk.unpauseStrategy('CVAULT...', strategyData
|
|
319
|
+
* const response = await sdk.unpauseStrategy('CVAULT...', strategyData);
|
|
259
320
|
* ```
|
|
260
321
|
*/
|
|
261
|
-
unpauseStrategy(vaultAddress: string, strategyData: UnpauseStrategyParams, network
|
|
322
|
+
unpauseStrategy(vaultAddress: string, strategyData: UnpauseStrategyParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
262
323
|
/**
|
|
263
324
|
* Get a specific vault role address
|
|
264
325
|
* @param vaultAddress - The vault contract address
|
|
265
|
-
* @param network - Stellar network (testnet or mainnet)
|
|
266
326
|
* @param roleToGet - The role to retrieve (manager, emergency_manager, rebalance_manager, fee_receiver)
|
|
327
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
267
328
|
* @returns Role information with address
|
|
268
329
|
* @example
|
|
269
330
|
* ```typescript
|
|
270
|
-
* const role = await sdk.getVaultRole(
|
|
271
|
-
* 'CVAULT...',
|
|
272
|
-
* SupportedNetworks.TESTNET,
|
|
273
|
-
* VaultGetRoleMethods.GET_MANAGER
|
|
274
|
-
* );
|
|
331
|
+
* const role = await sdk.getVaultRole('CVAULT...', VaultRoles.MANAGER);
|
|
275
332
|
* console.log(`Manager address: ${role.address}`);
|
|
276
333
|
* ```
|
|
277
334
|
*/
|
|
278
|
-
getVaultRole(vaultAddress: string,
|
|
335
|
+
getVaultRole(vaultAddress: string, roleToGet: VaultRoles, network?: SupportedNetworks): Promise<VaultRoleResponse>;
|
|
279
336
|
/**
|
|
280
337
|
* Set a vault role to a new address (Manager role required)
|
|
281
338
|
* @param vaultAddress - The vault contract address
|
|
339
|
+
* @param roleToSet - The role to set
|
|
282
340
|
* @param roleData - Role assignment parameters including new address and caller
|
|
283
|
-
* @param network - Stellar network (
|
|
341
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
284
342
|
* @returns Transaction XDR for Manager signing
|
|
285
343
|
* @example
|
|
286
344
|
* ```typescript
|
|
@@ -288,15 +346,15 @@ export declare class DefindexSDK {
|
|
|
288
346
|
* caller: 'GMANAGER...',
|
|
289
347
|
* new_address: 'GNEW_MANAGER...'
|
|
290
348
|
* };
|
|
291
|
-
* const response = await sdk.setVaultRole('CVAULT...',
|
|
349
|
+
* const response = await sdk.setVaultRole('CVAULT...', VaultRoles.MANAGER, roleData);
|
|
292
350
|
* ```
|
|
293
351
|
*/
|
|
294
|
-
setVaultRole(vaultAddress: string, roleToSet: VaultRoles, roleData: SetVaultRoleParams, network
|
|
352
|
+
setVaultRole(vaultAddress: string, roleToSet: VaultRoles, roleData: SetVaultRoleParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
295
353
|
/**
|
|
296
354
|
* Lock vault fees and optionally update fee rate (Manager role required)
|
|
297
355
|
* @param vaultAddress - The vault contract address
|
|
298
356
|
* @param lockData - Lock fees parameters including optional new fee rate
|
|
299
|
-
* @param network - Stellar network (
|
|
357
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
300
358
|
* @returns Transaction XDR for Manager signing
|
|
301
359
|
* @example
|
|
302
360
|
* ```typescript
|
|
@@ -304,15 +362,15 @@ export declare class DefindexSDK {
|
|
|
304
362
|
* caller: 'GMANAGER...',
|
|
305
363
|
* new_fee_bps: 150 // Optional: new fee rate in basis points (1.5%)
|
|
306
364
|
* };
|
|
307
|
-
* const response = await sdk.lockVaultFees('CVAULT...', lockData
|
|
365
|
+
* const response = await sdk.lockVaultFees('CVAULT...', lockData);
|
|
308
366
|
* ```
|
|
309
367
|
*/
|
|
310
|
-
lockVaultFees(vaultAddress: string, lockData: LockFeesParams, network
|
|
368
|
+
lockVaultFees(vaultAddress: string, lockData: LockFeesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
311
369
|
/**
|
|
312
370
|
* Release fees from a specific strategy (Manager role required)
|
|
313
371
|
* @param vaultAddress - The vault contract address
|
|
314
372
|
* @param releaseData - Release fees parameters including strategy address and amount
|
|
315
|
-
* @param network - Stellar network (
|
|
373
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
316
374
|
* @returns Transaction XDR for Manager signing
|
|
317
375
|
* @example
|
|
318
376
|
* ```typescript
|
|
@@ -321,30 +379,30 @@ export declare class DefindexSDK {
|
|
|
321
379
|
* strategy_address: 'CSTRATEGY...',
|
|
322
380
|
* amount: 100000
|
|
323
381
|
* };
|
|
324
|
-
* const response = await sdk.releaseVaultFees('CVAULT...', releaseData
|
|
382
|
+
* const response = await sdk.releaseVaultFees('CVAULT...', releaseData);
|
|
325
383
|
* ```
|
|
326
384
|
*/
|
|
327
|
-
releaseVaultFees(vaultAddress: string, releaseData: ReleaseFeesParams, network
|
|
385
|
+
releaseVaultFees(vaultAddress: string, releaseData: ReleaseFeesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
328
386
|
/**
|
|
329
387
|
* Distribute accumulated vault fees to fee receiver (Manager role required)
|
|
330
388
|
* @param vaultAddress - The vault contract address
|
|
331
389
|
* @param distributeData - Distribution parameters including caller
|
|
332
|
-
* @param network - Stellar network (
|
|
390
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
333
391
|
* @returns Transaction XDR for Manager signing
|
|
334
392
|
* @example
|
|
335
393
|
* ```typescript
|
|
336
394
|
* const distributeData = {
|
|
337
395
|
* caller: 'GMANAGER...'
|
|
338
396
|
* };
|
|
339
|
-
* const response = await sdk.distributeVaultFees('CVAULT...', distributeData
|
|
397
|
+
* const response = await sdk.distributeVaultFees('CVAULT...', distributeData);
|
|
340
398
|
* ```
|
|
341
399
|
*/
|
|
342
|
-
distributeVaultFees(vaultAddress: string, distributeData: DistributeFeesParams, network
|
|
400
|
+
distributeVaultFees(vaultAddress: string, distributeData: DistributeFeesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
343
401
|
/**
|
|
344
402
|
* Upgrade vault WASM contract (Manager role required)
|
|
345
403
|
* @param vaultAddress - The vault contract address
|
|
346
404
|
* @param newWasmHash - Upgrade parameters including new WASM hash and caller
|
|
347
|
-
* @param network - Stellar network (
|
|
405
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
348
406
|
* @returns Transaction XDR for Manager signing
|
|
349
407
|
* @example
|
|
350
408
|
* ```typescript
|
|
@@ -352,17 +410,17 @@ export declare class DefindexSDK {
|
|
|
352
410
|
* caller: 'GMANAGER...',
|
|
353
411
|
* new_wasm_hash: 'abcd1234...' // New WASM hash to upgrade to
|
|
354
412
|
* };
|
|
355
|
-
* const response = await sdk.upgradeVaultWasm('CVAULT...', upgradeData
|
|
413
|
+
* const response = await sdk.upgradeVaultWasm('CVAULT...', upgradeData);
|
|
356
414
|
* ```
|
|
357
415
|
*/
|
|
358
|
-
upgradeVaultWasm(vaultAddress: string, newWasmHash: UpgradeWasmParams, network
|
|
416
|
+
upgradeVaultWasm(vaultAddress: string, newWasmHash: UpgradeWasmParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
359
417
|
/**
|
|
360
418
|
* Submit a signed transaction to the Stellar blockchain
|
|
361
419
|
* @param xdr - Base64 encoded signed transaction XDR
|
|
362
|
-
* @param network - Stellar network (
|
|
420
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
363
421
|
* @param launchtube - Whether to use LaunchTube service (defaults to false)
|
|
364
422
|
* @returns Transaction response with hash and status
|
|
365
423
|
*/
|
|
366
|
-
sendTransaction(xdr: string, network
|
|
424
|
+
sendTransaction(xdr: string, network?: SupportedNetworks, launchtube?: boolean): Promise<SendTransactionResponse | LaunchTubeResponse>;
|
|
367
425
|
}
|
|
368
426
|
//# sourceMappingURL=defindex-sdk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defindex-sdk.d.ts","sourceRoot":"","sources":["../src/defindex-sdk.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,gBAA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CAAC,wBAAwB,CAAC;IAYpC;;;;;;;;;;;;;;OAcG;IACU,aAAa,CACxB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,wBAAwB,CAAC;IAQpC;;;;;;;;;;;;;;;OAeG;IACU,gBAAgB,CAC3B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,wBAAwB,CAAC;IAQpC;;;;;;;;;;;;;OAaG;IACU,mBAAmB,CAC9B,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,oBAAoB,EACpC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,wBAAwB,CAAC;IAQpC;;;;;;;;;;;;;;OAcG;IACU,gBAAgB,CAC3B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,wBAAwB,CAAC;IAapC;;;;;;OAMG;IACU,eAAe,CAC1B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,iBAAiB,EAC3B,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,uBAAuB,GAAG,kBAAkB,CAAC;CAQzD"}
|
package/dist/defindex-sdk.js
CHANGED
|
@@ -7,16 +7,24 @@ const http_client_1 = require("./clients/http-client");
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* // Basic initialization
|
|
10
|
+
* // Basic initialization with default network
|
|
11
11
|
* const sdk = new DefindexSDK({
|
|
12
|
-
* baseUrl: 'https://api.defindex.io'
|
|
12
|
+
* baseUrl: 'https://api.defindex.io',
|
|
13
|
+
* defaultNetwork: SupportedNetworks.TESTNET
|
|
13
14
|
* });
|
|
14
15
|
*
|
|
15
16
|
* // With API key authentication
|
|
16
17
|
* const sdk = new DefindexSDK({
|
|
17
18
|
* apiKey: 'sk_your_api_key_here',
|
|
18
|
-
* baseUrl: 'https://api.defindex.io'
|
|
19
|
+
* baseUrl: 'https://api.defindex.io',
|
|
20
|
+
* defaultNetwork: SupportedNetworks.MAINNET
|
|
19
21
|
* });
|
|
22
|
+
*
|
|
23
|
+
* // Now you can call methods without specifying network
|
|
24
|
+
* const vaultInfo = await sdk.getVaultInfo('CVAULT...');
|
|
25
|
+
*
|
|
26
|
+
* // Or override for a specific call
|
|
27
|
+
* const testnetInfo = await sdk.getVaultInfo('CVAULT...', SupportedNetworks.TESTNET);
|
|
20
28
|
* ```
|
|
21
29
|
*/
|
|
22
30
|
class DefindexSDK {
|
|
@@ -26,9 +34,37 @@ class DefindexSDK {
|
|
|
26
34
|
*/
|
|
27
35
|
constructor(config) {
|
|
28
36
|
this.config = config;
|
|
37
|
+
this.defaultNetwork = config.defaultNetwork;
|
|
29
38
|
this.httpClient = new http_client_1.HttpClient(config.baseUrl || 'https://api.defindex.io', config.apiKey || '', // API key or empty string
|
|
30
39
|
config.timeout || 30000);
|
|
31
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the network to use for a request
|
|
43
|
+
* @param network - Optional network override
|
|
44
|
+
* @returns The network to use (provided network or default)
|
|
45
|
+
* @throws Error if no network is provided and no default is set
|
|
46
|
+
*/
|
|
47
|
+
getNetwork(network) {
|
|
48
|
+
const resolvedNetwork = network ?? this.defaultNetwork;
|
|
49
|
+
if (!resolvedNetwork) {
|
|
50
|
+
throw new Error('No network specified. Either provide a network parameter or set defaultNetwork in SDK config.');
|
|
51
|
+
}
|
|
52
|
+
return resolvedNetwork;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the current default network
|
|
56
|
+
* @returns The default network or undefined if not set
|
|
57
|
+
*/
|
|
58
|
+
getDefaultNetwork() {
|
|
59
|
+
return this.defaultNetwork;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Set the default network for all operations
|
|
63
|
+
* @param network - The network to use as default
|
|
64
|
+
*/
|
|
65
|
+
setDefaultNetwork(network) {
|
|
66
|
+
this.defaultNetwork = network;
|
|
67
|
+
}
|
|
32
68
|
//=======================================================================
|
|
33
69
|
// System Operations
|
|
34
70
|
//=======================================================================
|
|
@@ -51,21 +87,22 @@ class DefindexSDK {
|
|
|
51
87
|
//=======================================================================
|
|
52
88
|
/**
|
|
53
89
|
* Get the factory contract address for a specific network
|
|
54
|
-
* @param network - Stellar network (
|
|
90
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
55
91
|
* @returns Factory contract address
|
|
56
92
|
* @example
|
|
57
93
|
* ```typescript
|
|
58
|
-
* const factory = await sdk.getFactoryAddress(
|
|
94
|
+
* const factory = await sdk.getFactoryAddress();
|
|
59
95
|
* console.log('Factory address:', factory.address);
|
|
60
96
|
* ```
|
|
61
97
|
*/
|
|
62
98
|
async getFactoryAddress(network) {
|
|
63
|
-
|
|
99
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
100
|
+
return this.httpClient.get(`/factory/address?network=${resolvedNetwork}`);
|
|
64
101
|
}
|
|
65
102
|
/**
|
|
66
103
|
* Create a new vault (requires Vault Manager role)
|
|
67
104
|
* @param vaultConfig - Vault configuration including assets, fees, and roles
|
|
68
|
-
* @param network - Stellar network (
|
|
105
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
69
106
|
* @returns Transaction XDR for vault creation
|
|
70
107
|
* @example
|
|
71
108
|
* ```typescript
|
|
@@ -77,16 +114,17 @@ class DefindexSDK {
|
|
|
77
114
|
* upgradable: true,
|
|
78
115
|
* caller: "GCALLER..."
|
|
79
116
|
* };
|
|
80
|
-
* const response = await sdk.createVault(vaultConfig
|
|
117
|
+
* const response = await sdk.createVault(vaultConfig);
|
|
81
118
|
* ```
|
|
82
119
|
*/
|
|
83
120
|
async createVault(vaultConfig, network) {
|
|
84
|
-
|
|
121
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
122
|
+
return this.httpClient.post(`/factory/create-vault?network=${resolvedNetwork}`, vaultConfig);
|
|
85
123
|
}
|
|
86
124
|
/**
|
|
87
125
|
* Create a new vault with initial deposit in a single transaction
|
|
88
126
|
* @param vaultConfig - Vault configuration with initial deposit amounts
|
|
89
|
-
* @param network - Stellar network (
|
|
127
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
90
128
|
* @returns Transaction XDR for vault creation and deposit
|
|
91
129
|
* @example
|
|
92
130
|
* ```typescript
|
|
@@ -94,11 +132,58 @@ class DefindexSDK {
|
|
|
94
132
|
* // ... vault config
|
|
95
133
|
* deposit_amounts: [1000000, 2000000] // Initial deposit amounts
|
|
96
134
|
* };
|
|
97
|
-
* const response = await sdk.createVaultWithDeposit(vaultConfig
|
|
135
|
+
* const response = await sdk.createVaultWithDeposit(vaultConfig);
|
|
98
136
|
* ```
|
|
99
137
|
*/
|
|
100
138
|
async createVaultWithDeposit(vaultConfig, network) {
|
|
101
|
-
|
|
139
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
140
|
+
return this.httpClient.post(`/factory/create-vault-deposit?network=${resolvedNetwork}`, vaultConfig);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Create a new vault with auto-invest in a single atomic transaction
|
|
144
|
+
*
|
|
145
|
+
* This endpoint creates a batched transaction that:
|
|
146
|
+
* 1. Creates the vault with initial deposit
|
|
147
|
+
* 2. Invests funds in specified strategies (rebalance)
|
|
148
|
+
* 3. Changes manager to the final address
|
|
149
|
+
*
|
|
150
|
+
* All operations are atomic - either all succeed or all fail.
|
|
151
|
+
*
|
|
152
|
+
* @param params - Auto-invest vault configuration with asset allocations and strategies
|
|
153
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
154
|
+
* @returns Transaction XDR, predicted vault address, and warning about address prediction
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const params = {
|
|
158
|
+
* caller: 'GCALLER...',
|
|
159
|
+
* roles: {
|
|
160
|
+
* emergencyManager: 'GEMERGENCY...',
|
|
161
|
+
* rebalanceManager: 'GREBALANCE...',
|
|
162
|
+
* feeReceiver: 'GFEE...',
|
|
163
|
+
* manager: 'GMANAGER...'
|
|
164
|
+
* },
|
|
165
|
+
* name: 'My Auto-Invest Vault',
|
|
166
|
+
* symbol: 'MAIV',
|
|
167
|
+
* vaultFee: 10, // 0.1% in basis points
|
|
168
|
+
* upgradable: true,
|
|
169
|
+
* assets: [{
|
|
170
|
+
* address: 'CASSET...',
|
|
171
|
+
* symbol: 'XLM',
|
|
172
|
+
* amount: 2000000000, // 200 XLM in stroops
|
|
173
|
+
* strategies: [
|
|
174
|
+
* { address: 'CSTRAT1...', name: 'hodl_strategy', amount: 1000000000 },
|
|
175
|
+
* { address: 'CSTRAT2...', name: 'yield_strategy', amount: 1000000000 }
|
|
176
|
+
* ]
|
|
177
|
+
* }]
|
|
178
|
+
* };
|
|
179
|
+
* const response = await sdk.createVaultAutoInvest(params);
|
|
180
|
+
* console.log('Sign this XDR:', response.xdr);
|
|
181
|
+
* console.log('Predicted vault address:', response.predictedVaultAddress);
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
async createVaultAutoInvest(params, network) {
|
|
185
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
186
|
+
return this.httpClient.post(`/factory/create-vault-auto-invest?network=${resolvedNetwork}`, params);
|
|
102
187
|
}
|
|
103
188
|
//=======================================================================
|
|
104
189
|
// Vault Operations
|
|
@@ -106,73 +191,67 @@ class DefindexSDK {
|
|
|
106
191
|
/**
|
|
107
192
|
* Get comprehensive vault information
|
|
108
193
|
* @param vaultAddress - The vault contract address
|
|
109
|
-
* @param network - Stellar network (
|
|
194
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
110
195
|
* @returns Vault metadata, assets, strategies, and TVL information
|
|
111
196
|
* @example
|
|
112
197
|
* ```typescript
|
|
113
|
-
* const vaultInfo = await sdk.getVaultInfo(
|
|
114
|
-
* 'CVAULT...',
|
|
115
|
-
* SupportedNetworks.TESTNET
|
|
116
|
-
* );
|
|
198
|
+
* const vaultInfo = await sdk.getVaultInfo('CVAULT...');
|
|
117
199
|
* console.log(`Vault: ${vaultInfo.name} (${vaultInfo.symbol})`);
|
|
118
200
|
* console.log(`Total Assets: ${vaultInfo.totalAssets}`);
|
|
119
201
|
* ```
|
|
120
202
|
*/
|
|
121
203
|
async getVaultInfo(vaultAddress, network) {
|
|
122
|
-
|
|
204
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
205
|
+
return this.httpClient.get(`/vault/${vaultAddress}?network=${resolvedNetwork}`);
|
|
123
206
|
}
|
|
124
207
|
/**
|
|
125
208
|
* Get user's vault balance and shares
|
|
126
209
|
* @param vaultAddress - The vault contract address
|
|
127
210
|
* @param userAddress - User's wallet address
|
|
128
|
-
* @param network - Stellar network (
|
|
211
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
129
212
|
* @returns User's vault shares and underlying asset values
|
|
130
213
|
* @example
|
|
131
214
|
* ```typescript
|
|
132
|
-
* const balance = await sdk.getVaultBalance(
|
|
133
|
-
* 'CVAULT...',
|
|
134
|
-
* 'GUSER...',
|
|
135
|
-
* SupportedNetworks.TESTNET
|
|
136
|
-
* );
|
|
215
|
+
* const balance = await sdk.getVaultBalance('CVAULT...', 'GUSER...');
|
|
137
216
|
* console.log(`Shares: ${balance.dfTokens}`);
|
|
138
217
|
* console.log(`Underlying values: ${balance.underlyingBalance}`);
|
|
139
218
|
* ```
|
|
140
219
|
*/
|
|
141
220
|
async getVaultBalance(vaultAddress, userAddress, network) {
|
|
142
|
-
|
|
221
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
222
|
+
return this.httpClient.get(`/vault/${vaultAddress}/balance?from=${userAddress}&network=${resolvedNetwork}`);
|
|
143
223
|
}
|
|
144
224
|
/**
|
|
145
225
|
* Get vault report with transaction details
|
|
146
226
|
* @param vaultAddress - The vault contract address
|
|
147
|
-
* @param network - Stellar network (
|
|
227
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
148
228
|
* @returns Vault report with transaction XDR and simulation response
|
|
149
229
|
* @example
|
|
150
230
|
* ```typescript
|
|
151
|
-
* const report = await sdk.getReport(
|
|
152
|
-
* 'CVAULT...',
|
|
153
|
-
* SupportedNetworks.TESTNET
|
|
154
|
-
* );
|
|
231
|
+
* const report = await sdk.getReport('CVAULT...');
|
|
155
232
|
* console.log(`Report XDR: ${report.xdr}`);
|
|
156
233
|
* ```
|
|
157
234
|
*/
|
|
158
235
|
async getReport(vaultAddress, network) {
|
|
159
|
-
|
|
236
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
237
|
+
return this.httpClient.get(`/vault/${vaultAddress}/report?network=${resolvedNetwork}`);
|
|
160
238
|
}
|
|
161
239
|
/**
|
|
162
240
|
* Deposit assets into a vault
|
|
163
241
|
* @param vaultAddress - The vault contract address
|
|
164
242
|
* @param depositData - Deposit parameters including amounts and caller address
|
|
165
|
-
* @param network - Stellar network (
|
|
243
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
166
244
|
* @returns Transaction XDR for signing and simulation response
|
|
167
245
|
*/
|
|
168
246
|
async depositToVault(vaultAddress, depositData, network) {
|
|
169
|
-
|
|
247
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
248
|
+
return this.httpClient.post(`/vault/${vaultAddress}/deposit?network=${resolvedNetwork}`, depositData);
|
|
170
249
|
}
|
|
171
250
|
/**
|
|
172
251
|
* Withdraw specific asset amounts from vault
|
|
173
252
|
* @param vaultAddress - The vault contract address
|
|
174
253
|
* @param withdrawData - Withdrawal parameters including amounts and caller
|
|
175
|
-
* @param network - Stellar network (
|
|
254
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
176
255
|
* @returns Transaction XDR for signing and simulation response
|
|
177
256
|
* @example
|
|
178
257
|
* ```typescript
|
|
@@ -181,35 +260,38 @@ class DefindexSDK {
|
|
|
181
260
|
* caller: 'GUSER...',
|
|
182
261
|
* slippageBps: 100 // 1% slippage tolerance
|
|
183
262
|
* };
|
|
184
|
-
* const response = await sdk.withdrawFromVault('CVAULT...', withdrawData
|
|
263
|
+
* const response = await sdk.withdrawFromVault('CVAULT...', withdrawData);
|
|
185
264
|
* ```
|
|
186
265
|
*/
|
|
187
266
|
async withdrawFromVault(vaultAddress, withdrawData, network) {
|
|
188
|
-
|
|
267
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
268
|
+
return this.httpClient.post(`/vault/${vaultAddress}/withdraw?network=${resolvedNetwork}`, withdrawData);
|
|
189
269
|
}
|
|
190
270
|
/**
|
|
191
271
|
* Withdraw vault shares for underlying assets
|
|
192
272
|
* @param vaultAddress - The vault contract address
|
|
193
273
|
* @param shareData - Share withdrawal parameters including share amount and caller
|
|
194
|
-
* @param network - Stellar network (
|
|
274
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
195
275
|
* @returns Transaction XDR for signing and simulation response
|
|
196
276
|
*/
|
|
197
277
|
async withdrawShares(vaultAddress, shareData, network) {
|
|
198
|
-
|
|
278
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
279
|
+
return this.httpClient.post(`/vault/${vaultAddress}/withdraw-shares?network=${resolvedNetwork}`, shareData);
|
|
199
280
|
}
|
|
200
281
|
/**
|
|
201
282
|
* Get vault's Annual Percentage Yield (APY)
|
|
202
283
|
* @param vaultAddress - The vault contract address
|
|
203
|
-
* @param network - Stellar network (
|
|
284
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
204
285
|
* @returns APY information including percentage and calculation period
|
|
205
286
|
* @example
|
|
206
287
|
* ```typescript
|
|
207
|
-
* const apy = await sdk.getVaultAPY('CVAULT...'
|
|
288
|
+
* const apy = await sdk.getVaultAPY('CVAULT...');
|
|
208
289
|
* console.log(`APY: ${apy.apyPercent}% (calculated over ${apy.period})`);
|
|
209
290
|
* ```
|
|
210
291
|
*/
|
|
211
292
|
async getVaultAPY(vaultAddress, network) {
|
|
212
|
-
|
|
293
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
294
|
+
return this.httpClient.get(`/vault/${vaultAddress}/apy?network=${resolvedNetwork}`);
|
|
213
295
|
}
|
|
214
296
|
//=======================================================================
|
|
215
297
|
// Vault Management Operations
|
|
@@ -218,7 +300,7 @@ class DefindexSDK {
|
|
|
218
300
|
* Rebalance vault strategies (Rebalance Manager role required)
|
|
219
301
|
* @param vaultAddress - The vault contract address
|
|
220
302
|
* @param rebalanceData - Rebalance parameters including investment instructions
|
|
221
|
-
* @param network - Stellar network (
|
|
303
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
222
304
|
* @returns Transaction XDR for Rebalance Manager signing
|
|
223
305
|
* @example
|
|
224
306
|
* ```typescript
|
|
@@ -236,17 +318,18 @@ class DefindexSDK {
|
|
|
236
318
|
* }
|
|
237
319
|
* ]
|
|
238
320
|
* };
|
|
239
|
-
* const response = await sdk.rebalanceVault('CVAULT...', rebalanceData
|
|
321
|
+
* const response = await sdk.rebalanceVault('CVAULT...', rebalanceData);
|
|
240
322
|
* ```
|
|
241
323
|
*/
|
|
242
324
|
async rebalanceVault(vaultAddress, rebalanceData, network) {
|
|
243
|
-
|
|
325
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
326
|
+
return this.httpClient.post(`/vault/${vaultAddress}/rebalance?network=${resolvedNetwork}`, rebalanceData);
|
|
244
327
|
}
|
|
245
328
|
/**
|
|
246
329
|
* Emergency rescue assets from strategy (Emergency Manager role required)
|
|
247
330
|
* @param vaultAddress - The vault contract address
|
|
248
331
|
* @param rescueData - Rescue parameters including strategy address and caller
|
|
249
|
-
* @param network - Stellar network (
|
|
332
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
250
333
|
* @returns Transaction XDR for Emergency Manager signing and rescued assets info
|
|
251
334
|
* @example
|
|
252
335
|
* ```typescript
|
|
@@ -254,17 +337,18 @@ class DefindexSDK {
|
|
|
254
337
|
* strategy_address: 'CSTRATEGY...',
|
|
255
338
|
* caller: 'GEMERGENCY_MANAGER...'
|
|
256
339
|
* };
|
|
257
|
-
* const response = await sdk.emergencyRescue('CVAULT...', rescueData
|
|
340
|
+
* const response = await sdk.emergencyRescue('CVAULT...', rescueData);
|
|
258
341
|
* ```
|
|
259
342
|
*/
|
|
260
343
|
async emergencyRescue(vaultAddress, rescueData, network) {
|
|
261
|
-
|
|
344
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
345
|
+
return this.httpClient.post(`/vault/${vaultAddress}/rescue?network=${resolvedNetwork}`, rescueData);
|
|
262
346
|
}
|
|
263
347
|
/**
|
|
264
348
|
* Pause a specific strategy (Strategy Manager role required)
|
|
265
349
|
* @param vaultAddress - The vault contract address
|
|
266
350
|
* @param strategyData - Strategy pause parameters
|
|
267
|
-
* @param network - Stellar network (
|
|
351
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
268
352
|
* @returns Transaction XDR for Strategy Manager signing
|
|
269
353
|
* @example
|
|
270
354
|
* ```typescript
|
|
@@ -272,17 +356,18 @@ class DefindexSDK {
|
|
|
272
356
|
* strategy_address: 'CSTRATEGY...',
|
|
273
357
|
* caller: 'CSTRATEGY_MANAGER...'
|
|
274
358
|
* };
|
|
275
|
-
* const response = await sdk.pauseStrategy('CVAULT...', strategyData
|
|
359
|
+
* const response = await sdk.pauseStrategy('CVAULT...', strategyData);
|
|
276
360
|
* ```
|
|
277
361
|
*/
|
|
278
362
|
async pauseStrategy(vaultAddress, strategyData, network) {
|
|
279
|
-
|
|
363
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
364
|
+
return this.httpClient.post(`/vault/${vaultAddress}/pause-strategy?network=${resolvedNetwork}`, strategyData);
|
|
280
365
|
}
|
|
281
366
|
/**
|
|
282
367
|
* Unpause a specific strategy (Strategy Manager role required)
|
|
283
368
|
* @param vaultAddress - The vault contract address
|
|
284
369
|
* @param strategyData - Strategy unpause parameters
|
|
285
|
-
* @param network - Stellar network (
|
|
370
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
286
371
|
* @returns Transaction XDR for Strategy Manager signing
|
|
287
372
|
* @example
|
|
288
373
|
* ```typescript
|
|
@@ -290,11 +375,12 @@ class DefindexSDK {
|
|
|
290
375
|
* strategy_address: 'CSTRATEGY...',
|
|
291
376
|
* caller: 'GSTRATEGY_MANAGER...'
|
|
292
377
|
* };
|
|
293
|
-
* const response = await sdk.unpauseStrategy('CVAULT...', strategyData
|
|
378
|
+
* const response = await sdk.unpauseStrategy('CVAULT...', strategyData);
|
|
294
379
|
* ```
|
|
295
380
|
*/
|
|
296
381
|
async unpauseStrategy(vaultAddress, strategyData, network) {
|
|
297
|
-
|
|
382
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
383
|
+
return this.httpClient.post(`/vault/${vaultAddress}/unpause-strategy?network=${resolvedNetwork}`, strategyData);
|
|
298
384
|
}
|
|
299
385
|
//=======================================================================
|
|
300
386
|
// Role Operations
|
|
@@ -302,27 +388,25 @@ class DefindexSDK {
|
|
|
302
388
|
/**
|
|
303
389
|
* Get a specific vault role address
|
|
304
390
|
* @param vaultAddress - The vault contract address
|
|
305
|
-
* @param network - Stellar network (testnet or mainnet)
|
|
306
391
|
* @param roleToGet - The role to retrieve (manager, emergency_manager, rebalance_manager, fee_receiver)
|
|
392
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
307
393
|
* @returns Role information with address
|
|
308
394
|
* @example
|
|
309
395
|
* ```typescript
|
|
310
|
-
* const role = await sdk.getVaultRole(
|
|
311
|
-
* 'CVAULT...',
|
|
312
|
-
* SupportedNetworks.TESTNET,
|
|
313
|
-
* VaultGetRoleMethods.GET_MANAGER
|
|
314
|
-
* );
|
|
396
|
+
* const role = await sdk.getVaultRole('CVAULT...', VaultRoles.MANAGER);
|
|
315
397
|
* console.log(`Manager address: ${role.address}`);
|
|
316
398
|
* ```
|
|
317
399
|
*/
|
|
318
|
-
async getVaultRole(vaultAddress,
|
|
319
|
-
|
|
400
|
+
async getVaultRole(vaultAddress, roleToGet, network) {
|
|
401
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
402
|
+
return this.httpClient.get(`/vault/${vaultAddress}/get/${roleToGet}?network=${resolvedNetwork}`);
|
|
320
403
|
}
|
|
321
404
|
/**
|
|
322
405
|
* Set a vault role to a new address (Manager role required)
|
|
323
406
|
* @param vaultAddress - The vault contract address
|
|
407
|
+
* @param roleToSet - The role to set
|
|
324
408
|
* @param roleData - Role assignment parameters including new address and caller
|
|
325
|
-
* @param network - Stellar network (
|
|
409
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
326
410
|
* @returns Transaction XDR for Manager signing
|
|
327
411
|
* @example
|
|
328
412
|
* ```typescript
|
|
@@ -330,11 +414,12 @@ class DefindexSDK {
|
|
|
330
414
|
* caller: 'GMANAGER...',
|
|
331
415
|
* new_address: 'GNEW_MANAGER...'
|
|
332
416
|
* };
|
|
333
|
-
* const response = await sdk.setVaultRole('CVAULT...',
|
|
417
|
+
* const response = await sdk.setVaultRole('CVAULT...', VaultRoles.MANAGER, roleData);
|
|
334
418
|
* ```
|
|
335
419
|
*/
|
|
336
420
|
async setVaultRole(vaultAddress, roleToSet, roleData, network) {
|
|
337
|
-
|
|
421
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
422
|
+
return this.httpClient.post(`/vault/${vaultAddress}/set/${roleToSet}?network=${resolvedNetwork}`, roleData);
|
|
338
423
|
}
|
|
339
424
|
//=======================================================================
|
|
340
425
|
// Vault Management Operations
|
|
@@ -343,7 +428,7 @@ class DefindexSDK {
|
|
|
343
428
|
* Lock vault fees and optionally update fee rate (Manager role required)
|
|
344
429
|
* @param vaultAddress - The vault contract address
|
|
345
430
|
* @param lockData - Lock fees parameters including optional new fee rate
|
|
346
|
-
* @param network - Stellar network (
|
|
431
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
347
432
|
* @returns Transaction XDR for Manager signing
|
|
348
433
|
* @example
|
|
349
434
|
* ```typescript
|
|
@@ -351,17 +436,18 @@ class DefindexSDK {
|
|
|
351
436
|
* caller: 'GMANAGER...',
|
|
352
437
|
* new_fee_bps: 150 // Optional: new fee rate in basis points (1.5%)
|
|
353
438
|
* };
|
|
354
|
-
* const response = await sdk.lockVaultFees('CVAULT...', lockData
|
|
439
|
+
* const response = await sdk.lockVaultFees('CVAULT...', lockData);
|
|
355
440
|
* ```
|
|
356
441
|
*/
|
|
357
442
|
async lockVaultFees(vaultAddress, lockData, network) {
|
|
358
|
-
|
|
443
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
444
|
+
return this.httpClient.post(`/vault/${vaultAddress}/lock-fees?network=${resolvedNetwork}`, lockData);
|
|
359
445
|
}
|
|
360
446
|
/**
|
|
361
447
|
* Release fees from a specific strategy (Manager role required)
|
|
362
448
|
* @param vaultAddress - The vault contract address
|
|
363
449
|
* @param releaseData - Release fees parameters including strategy address and amount
|
|
364
|
-
* @param network - Stellar network (
|
|
450
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
365
451
|
* @returns Transaction XDR for Manager signing
|
|
366
452
|
* @example
|
|
367
453
|
* ```typescript
|
|
@@ -370,34 +456,36 @@ class DefindexSDK {
|
|
|
370
456
|
* strategy_address: 'CSTRATEGY...',
|
|
371
457
|
* amount: 100000
|
|
372
458
|
* };
|
|
373
|
-
* const response = await sdk.releaseVaultFees('CVAULT...', releaseData
|
|
459
|
+
* const response = await sdk.releaseVaultFees('CVAULT...', releaseData);
|
|
374
460
|
* ```
|
|
375
461
|
*/
|
|
376
462
|
async releaseVaultFees(vaultAddress, releaseData, network) {
|
|
377
|
-
|
|
463
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
464
|
+
return this.httpClient.post(`/vault/${vaultAddress}/release-fees?network=${resolvedNetwork}`, releaseData);
|
|
378
465
|
}
|
|
379
466
|
/**
|
|
380
467
|
* Distribute accumulated vault fees to fee receiver (Manager role required)
|
|
381
468
|
* @param vaultAddress - The vault contract address
|
|
382
469
|
* @param distributeData - Distribution parameters including caller
|
|
383
|
-
* @param network - Stellar network (
|
|
470
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
384
471
|
* @returns Transaction XDR for Manager signing
|
|
385
472
|
* @example
|
|
386
473
|
* ```typescript
|
|
387
474
|
* const distributeData = {
|
|
388
475
|
* caller: 'GMANAGER...'
|
|
389
476
|
* };
|
|
390
|
-
* const response = await sdk.distributeVaultFees('CVAULT...', distributeData
|
|
477
|
+
* const response = await sdk.distributeVaultFees('CVAULT...', distributeData);
|
|
391
478
|
* ```
|
|
392
479
|
*/
|
|
393
480
|
async distributeVaultFees(vaultAddress, distributeData, network) {
|
|
394
|
-
|
|
481
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
482
|
+
return this.httpClient.post(`/vault/${vaultAddress}/distribute-fees?network=${resolvedNetwork}`, distributeData);
|
|
395
483
|
}
|
|
396
484
|
/**
|
|
397
485
|
* Upgrade vault WASM contract (Manager role required)
|
|
398
486
|
* @param vaultAddress - The vault contract address
|
|
399
487
|
* @param newWasmHash - Upgrade parameters including new WASM hash and caller
|
|
400
|
-
* @param network - Stellar network (
|
|
488
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
401
489
|
* @returns Transaction XDR for Manager signing
|
|
402
490
|
* @example
|
|
403
491
|
* ```typescript
|
|
@@ -405,11 +493,12 @@ class DefindexSDK {
|
|
|
405
493
|
* caller: 'GMANAGER...',
|
|
406
494
|
* new_wasm_hash: 'abcd1234...' // New WASM hash to upgrade to
|
|
407
495
|
* };
|
|
408
|
-
* const response = await sdk.upgradeVaultWasm('CVAULT...', upgradeData
|
|
496
|
+
* const response = await sdk.upgradeVaultWasm('CVAULT...', upgradeData);
|
|
409
497
|
* ```
|
|
410
498
|
*/
|
|
411
499
|
async upgradeVaultWasm(vaultAddress, newWasmHash, network) {
|
|
412
|
-
|
|
500
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
501
|
+
return this.httpClient.post(`/vault/${vaultAddress}/upgrade?network=${resolvedNetwork}`, newWasmHash);
|
|
413
502
|
}
|
|
414
503
|
//=======================================================================
|
|
415
504
|
// Transaction Operations
|
|
@@ -417,13 +506,14 @@ class DefindexSDK {
|
|
|
417
506
|
/**
|
|
418
507
|
* Submit a signed transaction to the Stellar blockchain
|
|
419
508
|
* @param xdr - Base64 encoded signed transaction XDR
|
|
420
|
-
* @param network - Stellar network (
|
|
509
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
421
510
|
* @param launchtube - Whether to use LaunchTube service (defaults to false)
|
|
422
511
|
* @returns Transaction response with hash and status
|
|
423
512
|
*/
|
|
424
513
|
async sendTransaction(xdr, network, launchtube) {
|
|
514
|
+
const resolvedNetwork = this.getNetwork(network);
|
|
425
515
|
const payload = { xdr, launchtube: launchtube ?? false };
|
|
426
|
-
return this.httpClient.post(`/send?network=${
|
|
516
|
+
return this.httpClient.post(`/send?network=${resolvedNetwork}`, payload);
|
|
427
517
|
}
|
|
428
518
|
}
|
|
429
519
|
exports.DefindexSDK = DefindexSDK;
|
package/dist/defindex-sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defindex-sdk.js","sourceRoot":"","sources":["../src/defindex-sdk.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;
|
|
1
|
+
{"version":3,"file":"defindex-sdk.js","sourceRoot":"","sources":["../src/defindex-sdk.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AA6CnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,WAAW;IAKtB;;;OAGG;IACH,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAU,CAC9B,MAAM,CAAC,OAAO,IAAI,yBAAyB,EAC3C,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,0BAA0B;QAC/C,MAAM,CAAC,OAAO,IAAI,KAAK,CACxB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACK,UAAU,CAAC,OAA2B;QAC5C,MAAM,eAAe,GAAG,OAAO,IAAI,I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CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACzB,UAAU,YAAY,oBAAoB,eAAe,EAAE,EAC3D,WAAW,CACZ,CAAC;IACJ,CAAC;IAGD,yEAAyE;IACzE,yBAAyB;IACzB,yEAAyE;IAEzE;;;;;;OAMG;IACI,KAAK,CAAC,eAAe,CAC1B,GAAW,EACX,OAA2B,EAC3B,UAAoB;QAEpB,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,IAAI,KAAK,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACzB,iBAAiB,eAAe,EAAE,EAClC,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AA5pBD,kCA4pBC"}
|
|
@@ -12,4 +12,75 @@ export interface CreateVaultDepositResponse extends BaseTransactionResponse {
|
|
|
12
12
|
export interface CreateDefindexVaultDepositDto extends CreateDefindexVault {
|
|
13
13
|
deposit_amounts: number[];
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Strategy allocation for auto-invest operations
|
|
17
|
+
*/
|
|
18
|
+
export interface StrategyAllocation {
|
|
19
|
+
/** Strategy contract address */
|
|
20
|
+
address: string;
|
|
21
|
+
/** Strategy name */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Amount to invest in this strategy (in stroops) */
|
|
24
|
+
amount: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Asset configuration with strategies for auto-invest
|
|
28
|
+
*/
|
|
29
|
+
export interface AssetAllocation {
|
|
30
|
+
/** Asset contract address */
|
|
31
|
+
address: string;
|
|
32
|
+
/** Asset symbol */
|
|
33
|
+
symbol: string;
|
|
34
|
+
/** Total amount to deposit for this asset (in stroops) */
|
|
35
|
+
amount: number;
|
|
36
|
+
/** Strategies for this asset with allocation amounts */
|
|
37
|
+
strategies: StrategyAllocation[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Vault roles configuration for auto-invest
|
|
41
|
+
*/
|
|
42
|
+
export interface VaultRolesConfig {
|
|
43
|
+
/** Emergency manager address */
|
|
44
|
+
emergencyManager: string;
|
|
45
|
+
/** Rebalance manager address */
|
|
46
|
+
rebalanceManager: string;
|
|
47
|
+
/** Fee receiver address */
|
|
48
|
+
feeReceiver: string;
|
|
49
|
+
/** Final vault manager address (will be set after auto-invest) */
|
|
50
|
+
manager: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parameters for creating a vault with auto-invest
|
|
54
|
+
* Creates vault, deposits funds, and invests in strategies atomically
|
|
55
|
+
*/
|
|
56
|
+
export interface CreateVaultAutoInvestParams {
|
|
57
|
+
/** Caller address who will deposit and initially manage */
|
|
58
|
+
caller: string;
|
|
59
|
+
/** Vault roles configuration */
|
|
60
|
+
roles: VaultRolesConfig;
|
|
61
|
+
/** Vault name (1-32 characters) */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Vault symbol (1-10 characters) */
|
|
64
|
+
symbol: string;
|
|
65
|
+
/** Vault fee in basis points (0-10000, where 10000 = 100%) */
|
|
66
|
+
vaultFee: number;
|
|
67
|
+
/** Whether vault is upgradable */
|
|
68
|
+
upgradable: boolean;
|
|
69
|
+
/** Asset allocations with strategies (1-10 assets) */
|
|
70
|
+
assets: AssetAllocation[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Response from creating a vault with auto-invest
|
|
74
|
+
*/
|
|
75
|
+
export interface CreateVaultAutoInvestResponse {
|
|
76
|
+
/** Transaction XDR to sign and submit */
|
|
77
|
+
xdr: string;
|
|
78
|
+
/**
|
|
79
|
+
* Predicted vault address from simulation.
|
|
80
|
+
* Note: actual address may differ if network state changes between simulation and execution.
|
|
81
|
+
*/
|
|
82
|
+
predictedVaultAddress: string;
|
|
83
|
+
/** Warning about address prediction reliability */
|
|
84
|
+
warning?: string;
|
|
85
|
+
}
|
|
15
86
|
//# sourceMappingURL=factory.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.types.d.ts","sourceRoot":"","sources":["../../src/types/factory.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIpD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAClE,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB;IACxE,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B"}
|
|
1
|
+
{"version":3,"file":"factory.types.d.ts","sourceRoot":"","sources":["../../src/types/factory.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIpD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAClE,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB;IACxE,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAID;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,KAAK,EAAE,gBAAgB,CAAC;IACxB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,sDAAsD;IACtD,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defindex/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Official TypeScript SDK for DeFindex API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,21 +12,6 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsc",
|
|
17
|
-
"build:watch": "tsc --watch",
|
|
18
|
-
"test": "jest",
|
|
19
|
-
"test:unit": "jest",
|
|
20
|
-
"test:integration": "jest --config=jest.integration.config.js",
|
|
21
|
-
"test:all": "pnpm run test:unit && pnpm run test:integration",
|
|
22
|
-
"test:watch": "jest --watch",
|
|
23
|
-
"test:coverage": "jest --coverage",
|
|
24
|
-
"lint": "eslint src/**/*.ts",
|
|
25
|
-
"lint:fix": "eslint src/**/*.ts --fix",
|
|
26
|
-
"prepare": "pnpm run build",
|
|
27
|
-
"prepublishOnly": "pnpm test && pnpm run lint",
|
|
28
|
-
"example": "npx ts-node -r dotenv/config examples/basic-example.ts"
|
|
29
|
-
},
|
|
30
15
|
"keywords": [
|
|
31
16
|
"DeFindex",
|
|
32
17
|
"stellar",
|
|
@@ -68,5 +53,18 @@
|
|
|
68
53
|
},
|
|
69
54
|
"engines": {
|
|
70
55
|
"node": ">=16.0.0"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsc",
|
|
59
|
+
"build:watch": "tsc --watch",
|
|
60
|
+
"test": "jest",
|
|
61
|
+
"test:unit": "jest",
|
|
62
|
+
"test:integration": "jest --config=jest.integration.config.js",
|
|
63
|
+
"test:all": "pnpm run test:unit && pnpm run test:integration",
|
|
64
|
+
"test:watch": "jest --watch",
|
|
65
|
+
"test:coverage": "jest --coverage",
|
|
66
|
+
"lint": "eslint src/**/*.ts",
|
|
67
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
68
|
+
"example": "npx ts-node -r dotenv/config examples/basic-example.ts"
|
|
71
69
|
}
|
|
72
70
|
}
|