@defindex/sdk 0.1.0 → 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 +4 -1
- package/dist/.DS_Store +0 -0
- package/dist/defindex-sdk.d.ts +247 -51
- package/dist/defindex-sdk.d.ts.map +1 -1
- package/dist/defindex-sdk.js +300 -50
- 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/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/stellar.types.d.ts +46 -20
- package/dist/types/stellar.types.d.ts.map +1 -1
- package/dist/types/vault.types.d.ts +93 -135
- package/dist/types/vault.types.d.ts.map +1 -1
- package/dist/types/vault.types.js +68 -0
- package/dist/types/vault.types.js.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
|
|
|
@@ -18,7 +21,7 @@ Official TypeScript SDK for [DeFindex](https://defindex.io) - A decentralized va
|
|
|
18
21
|
## 🚀 Installation
|
|
19
22
|
|
|
20
23
|
```bash
|
|
21
|
-
|
|
24
|
+
pnpm install @defindex/sdk
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
## 📖 Quick Start
|
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, FactoryAddressResponse, PauseStrategyParams, RescueFromVaultParams,
|
|
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,57 +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
|
-
* 'GVAULT...',
|
|
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
|
-
* 'GVAULT...',
|
|
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>;
|
|
192
|
+
/**
|
|
193
|
+
* Get vault report with transaction details
|
|
194
|
+
* @param vaultAddress - The vault contract address
|
|
195
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
196
|
+
* @returns Vault report with transaction XDR and simulation response
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const report = await sdk.getReport('CVAULT...');
|
|
200
|
+
* console.log(`Report XDR: ${report.xdr}`);
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
getReport(vaultAddress: string, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
128
204
|
/**
|
|
129
205
|
* Deposit assets into a vault
|
|
130
206
|
* @param vaultAddress - The vault contract address
|
|
131
207
|
* @param depositData - Deposit parameters including amounts and caller address
|
|
132
|
-
* @param network - Stellar network (
|
|
208
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
133
209
|
* @returns Transaction XDR for signing and simulation response
|
|
134
210
|
*/
|
|
135
|
-
depositToVault(vaultAddress: string, depositData: DepositToVaultParams, network
|
|
211
|
+
depositToVault(vaultAddress: string, depositData: DepositToVaultParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
136
212
|
/**
|
|
137
213
|
* Withdraw specific asset amounts from vault
|
|
138
214
|
* @param vaultAddress - The vault contract address
|
|
139
215
|
* @param withdrawData - Withdrawal parameters including amounts and caller
|
|
140
|
-
* @param network - Stellar network (
|
|
216
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
141
217
|
* @returns Transaction XDR for signing and simulation response
|
|
142
218
|
* @example
|
|
143
219
|
* ```typescript
|
|
@@ -146,85 +222,205 @@ export declare class DefindexSDK {
|
|
|
146
222
|
* caller: 'GUSER...',
|
|
147
223
|
* slippageBps: 100 // 1% slippage tolerance
|
|
148
224
|
* };
|
|
149
|
-
* const response = await sdk.withdrawFromVault('
|
|
225
|
+
* const response = await sdk.withdrawFromVault('CVAULT...', withdrawData);
|
|
150
226
|
* ```
|
|
151
227
|
*/
|
|
152
|
-
withdrawFromVault(vaultAddress: string, withdrawData:
|
|
228
|
+
withdrawFromVault(vaultAddress: string, withdrawData: WithdrawParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
153
229
|
/**
|
|
154
230
|
* Withdraw vault shares for underlying assets
|
|
155
231
|
* @param vaultAddress - The vault contract address
|
|
156
232
|
* @param shareData - Share withdrawal parameters including share amount and caller
|
|
157
|
-
* @param network - Stellar network (
|
|
233
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
158
234
|
* @returns Transaction XDR for signing and simulation response
|
|
159
235
|
*/
|
|
160
|
-
withdrawShares(vaultAddress: string, shareData: WithdrawSharesParams, network
|
|
236
|
+
withdrawShares(vaultAddress: string, shareData: WithdrawSharesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
161
237
|
/**
|
|
162
238
|
* Get vault's Annual Percentage Yield (APY)
|
|
163
239
|
* @param vaultAddress - The vault contract address
|
|
164
|
-
* @param network - Stellar network (
|
|
240
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
165
241
|
* @returns APY information including percentage and calculation period
|
|
166
242
|
* @example
|
|
167
243
|
* ```typescript
|
|
168
|
-
* const apy = await sdk.getVaultAPY('
|
|
244
|
+
* const apy = await sdk.getVaultAPY('CVAULT...');
|
|
169
245
|
* console.log(`APY: ${apy.apyPercent}% (calculated over ${apy.period})`);
|
|
170
246
|
* ```
|
|
171
247
|
*/
|
|
172
|
-
getVaultAPY(vaultAddress: string, network
|
|
248
|
+
getVaultAPY(vaultAddress: string, network?: SupportedNetworks): Promise<VaultApyResponse>;
|
|
249
|
+
/**
|
|
250
|
+
* Rebalance vault strategies (Rebalance Manager role required)
|
|
251
|
+
* @param vaultAddress - The vault contract address
|
|
252
|
+
* @param rebalanceData - Rebalance parameters including investment instructions
|
|
253
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
254
|
+
* @returns Transaction XDR for Rebalance Manager signing
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const rebalanceData = {
|
|
258
|
+
* caller: 'GREBALANCE_MANAGER...',
|
|
259
|
+
* instructions: [
|
|
260
|
+
* { type: 'Unwind', strategy_address: 'CSTRATEGY1...', amount: 500000 },
|
|
261
|
+
* { type: 'Invest', strategy_address: 'CSTRATEGY2...', amount: 1000000 },
|
|
262
|
+
* {
|
|
263
|
+
* type: 'SwapExactIn',
|
|
264
|
+
* token_in: 'GTOKEN1...',
|
|
265
|
+
* token_out: 'GTOKEN2...',
|
|
266
|
+
* amount: 250000,
|
|
267
|
+
* slippageToleranceBps: 100
|
|
268
|
+
* }
|
|
269
|
+
* ]
|
|
270
|
+
* };
|
|
271
|
+
* const response = await sdk.rebalanceVault('CVAULT...', rebalanceData);
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
rebalanceVault(vaultAddress: string, rebalanceData: RebalanceParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
173
275
|
/**
|
|
174
276
|
* Emergency rescue assets from strategy (Emergency Manager role required)
|
|
175
277
|
* @param vaultAddress - The vault contract address
|
|
176
278
|
* @param rescueData - Rescue parameters including strategy address and caller
|
|
177
|
-
* @param network - Stellar network (
|
|
279
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
178
280
|
* @returns Transaction XDR for Emergency Manager signing and rescued assets info
|
|
179
281
|
* @example
|
|
180
282
|
* ```typescript
|
|
181
283
|
* const rescueData = {
|
|
182
|
-
* strategy_address: '
|
|
284
|
+
* strategy_address: 'CSTRATEGY...',
|
|
183
285
|
* caller: 'GEMERGENCY_MANAGER...'
|
|
184
286
|
* };
|
|
185
|
-
* const response = await sdk.emergencyRescue('
|
|
287
|
+
* const response = await sdk.emergencyRescue('CVAULT...', rescueData);
|
|
186
288
|
* ```
|
|
187
289
|
*/
|
|
188
|
-
emergencyRescue(vaultAddress: string, rescueData: RescueFromVaultParams, network
|
|
290
|
+
emergencyRescue(vaultAddress: string, rescueData: RescueFromVaultParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
189
291
|
/**
|
|
190
292
|
* Pause a specific strategy (Strategy Manager role required)
|
|
191
293
|
* @param vaultAddress - The vault contract address
|
|
192
294
|
* @param strategyData - Strategy pause parameters
|
|
193
|
-
* @param network - Stellar network (
|
|
295
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
194
296
|
* @returns Transaction XDR for Strategy Manager signing
|
|
195
297
|
* @example
|
|
196
298
|
* ```typescript
|
|
197
299
|
* const strategyData = {
|
|
198
|
-
* strategy_address: '
|
|
199
|
-
* caller: '
|
|
300
|
+
* strategy_address: 'CSTRATEGY...',
|
|
301
|
+
* caller: 'CSTRATEGY_MANAGER...'
|
|
200
302
|
* };
|
|
201
|
-
* const response = await sdk.pauseStrategy('
|
|
303
|
+
* const response = await sdk.pauseStrategy('CVAULT...', strategyData);
|
|
202
304
|
* ```
|
|
203
305
|
*/
|
|
204
|
-
pauseStrategy(vaultAddress: string, strategyData: PauseStrategyParams, network
|
|
306
|
+
pauseStrategy(vaultAddress: string, strategyData: PauseStrategyParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
205
307
|
/**
|
|
206
308
|
* Unpause a specific strategy (Strategy Manager role required)
|
|
207
309
|
* @param vaultAddress - The vault contract address
|
|
208
310
|
* @param strategyData - Strategy unpause parameters
|
|
209
|
-
* @param network - Stellar network (
|
|
311
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
210
312
|
* @returns Transaction XDR for Strategy Manager signing
|
|
211
313
|
* @example
|
|
212
314
|
* ```typescript
|
|
213
315
|
* const strategyData = {
|
|
214
|
-
* strategy_address: '
|
|
316
|
+
* strategy_address: 'CSTRATEGY...',
|
|
215
317
|
* caller: 'GSTRATEGY_MANAGER...'
|
|
216
318
|
* };
|
|
217
|
-
* const response = await sdk.unpauseStrategy('
|
|
319
|
+
* const response = await sdk.unpauseStrategy('CVAULT...', strategyData);
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
unpauseStrategy(vaultAddress: string, strategyData: UnpauseStrategyParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
323
|
+
/**
|
|
324
|
+
* Get a specific vault role address
|
|
325
|
+
* @param vaultAddress - The vault contract address
|
|
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)
|
|
328
|
+
* @returns Role information with address
|
|
329
|
+
* @example
|
|
330
|
+
* ```typescript
|
|
331
|
+
* const role = await sdk.getVaultRole('CVAULT...', VaultRoles.MANAGER);
|
|
332
|
+
* console.log(`Manager address: ${role.address}`);
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
getVaultRole(vaultAddress: string, roleToGet: VaultRoles, network?: SupportedNetworks): Promise<VaultRoleResponse>;
|
|
336
|
+
/**
|
|
337
|
+
* Set a vault role to a new address (Manager role required)
|
|
338
|
+
* @param vaultAddress - The vault contract address
|
|
339
|
+
* @param roleToSet - The role to set
|
|
340
|
+
* @param roleData - Role assignment parameters including new address and caller
|
|
341
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
342
|
+
* @returns Transaction XDR for Manager signing
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* const roleData = {
|
|
346
|
+
* caller: 'GMANAGER...',
|
|
347
|
+
* new_address: 'GNEW_MANAGER...'
|
|
348
|
+
* };
|
|
349
|
+
* const response = await sdk.setVaultRole('CVAULT...', VaultRoles.MANAGER, roleData);
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
setVaultRole(vaultAddress: string, roleToSet: VaultRoles, roleData: SetVaultRoleParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
353
|
+
/**
|
|
354
|
+
* Lock vault fees and optionally update fee rate (Manager role required)
|
|
355
|
+
* @param vaultAddress - The vault contract address
|
|
356
|
+
* @param lockData - Lock fees parameters including optional new fee rate
|
|
357
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
358
|
+
* @returns Transaction XDR for Manager signing
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* const lockData = {
|
|
362
|
+
* caller: 'GMANAGER...',
|
|
363
|
+
* new_fee_bps: 150 // Optional: new fee rate in basis points (1.5%)
|
|
364
|
+
* };
|
|
365
|
+
* const response = await sdk.lockVaultFees('CVAULT...', lockData);
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
lockVaultFees(vaultAddress: string, lockData: LockFeesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
369
|
+
/**
|
|
370
|
+
* Release fees from a specific strategy (Manager role required)
|
|
371
|
+
* @param vaultAddress - The vault contract address
|
|
372
|
+
* @param releaseData - Release fees parameters including strategy address and amount
|
|
373
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
374
|
+
* @returns Transaction XDR for Manager signing
|
|
375
|
+
* @example
|
|
376
|
+
* ```typescript
|
|
377
|
+
* const releaseData = {
|
|
378
|
+
* caller: 'GMANAGER...',
|
|
379
|
+
* strategy_address: 'CSTRATEGY...',
|
|
380
|
+
* amount: 100000
|
|
381
|
+
* };
|
|
382
|
+
* const response = await sdk.releaseVaultFees('CVAULT...', releaseData);
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
releaseVaultFees(vaultAddress: string, releaseData: ReleaseFeesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
386
|
+
/**
|
|
387
|
+
* Distribute accumulated vault fees to fee receiver (Manager role required)
|
|
388
|
+
* @param vaultAddress - The vault contract address
|
|
389
|
+
* @param distributeData - Distribution parameters including caller
|
|
390
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
391
|
+
* @returns Transaction XDR for Manager signing
|
|
392
|
+
* @example
|
|
393
|
+
* ```typescript
|
|
394
|
+
* const distributeData = {
|
|
395
|
+
* caller: 'GMANAGER...'
|
|
396
|
+
* };
|
|
397
|
+
* const response = await sdk.distributeVaultFees('CVAULT...', distributeData);
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
distributeVaultFees(vaultAddress: string, distributeData: DistributeFeesParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
401
|
+
/**
|
|
402
|
+
* Upgrade vault WASM contract (Manager role required)
|
|
403
|
+
* @param vaultAddress - The vault contract address
|
|
404
|
+
* @param newWasmHash - Upgrade parameters including new WASM hash and caller
|
|
405
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
406
|
+
* @returns Transaction XDR for Manager signing
|
|
407
|
+
* @example
|
|
408
|
+
* ```typescript
|
|
409
|
+
* const upgradeData = {
|
|
410
|
+
* caller: 'GMANAGER...',
|
|
411
|
+
* new_wasm_hash: 'abcd1234...' // New WASM hash to upgrade to
|
|
412
|
+
* };
|
|
413
|
+
* const response = await sdk.upgradeVaultWasm('CVAULT...', upgradeData);
|
|
218
414
|
* ```
|
|
219
415
|
*/
|
|
220
|
-
|
|
416
|
+
upgradeVaultWasm(vaultAddress: string, newWasmHash: UpgradeWasmParams, network?: SupportedNetworks): Promise<VaultTransactionResponse>;
|
|
221
417
|
/**
|
|
222
418
|
* Submit a signed transaction to the Stellar blockchain
|
|
223
419
|
* @param xdr - Base64 encoded signed transaction XDR
|
|
224
|
-
* @param network - Stellar network (
|
|
420
|
+
* @param network - Stellar network (optional, uses default if not specified)
|
|
225
421
|
* @param launchtube - Whether to use LaunchTube service (defaults to false)
|
|
226
422
|
* @returns Transaction response with hash and status
|
|
227
423
|
*/
|
|
228
|
-
sendTransaction(xdr: string, network
|
|
424
|
+
sendTransaction(xdr: string, network?: SupportedNetworks, launchtube?: boolean): Promise<SendTransactionResponse | LaunchTubeResponse>;
|
|
229
425
|
}
|
|
230
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,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,
|
|
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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