@defindex/sdk 0.1.1 → 0.2.0-alpha.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.
- package/README.md +3 -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/base.types.d.ts +5 -1
- package/dist/types/base.types.d.ts.map +1 -1
- package/dist/types/factory.types.d.ts +75 -0
- package/dist/types/factory.types.d.ts.map +1 -1
- package/dist/types/vault.types.d.ts +2 -0
- package/dist/types/vault.types.d.ts.map +1 -1
- package/dist/types/vault.types.js.map +1 -1
- package/package.json +14 -16
- package/dist/types/auth.types.d.ts +0 -82
- package/dist/types/auth.types.d.ts.map +0 -1
- package/dist/types/auth.types.js +0 -4
- package/dist/types/auth.types.js.map +0 -1
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/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,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"defindex-sdk.d.ts","sourceRoot":"","sources":["../src/defindex-sdk.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,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,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,cAAc,CAAC,CAAoB;IAE3C;;;OAGG;gBACS,MAAM,EAAE,iBAAiB;IAUrC;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IA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