@ember-finance/sdk 2.13.0 → 2.14.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/dist/src/sui-vaults/on-chain-calls/operator.d.ts +124 -0
- package/dist/src/sui-vaults/on-chain-calls/operator.js +174 -0
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.d.ts +197 -5
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.js +493 -7
- package/dist/src/sui-vaults/on-chain-calls/user.d.ts +82 -3
- package/dist/src/sui-vaults/on-chain-calls/user.js +129 -6
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.d.ts +10 -2
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.js +11 -6
- package/package.json +1 -1
|
@@ -137,6 +137,79 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
137
137
|
* @returns OnChainCallResponse
|
|
138
138
|
*/
|
|
139
139
|
atomicCollectPlatformFee(vaultId: string, loss: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
140
|
+
/**
|
|
141
|
+
* Step 2 of 2 for Suilend activation: opens the obligation the supply is
|
|
142
|
+
* held in. Must run after `atomicSetStrategySuilend` and before the first
|
|
143
|
+
* supply, which aborts `ESuilendObligationMissing` until it has.
|
|
144
|
+
*
|
|
145
|
+
* Not optional — Suilend accounts rewards against an obligation, so cTokens
|
|
146
|
+
* held outside one earn base interest and no rewards. Callable by either
|
|
147
|
+
* the vault admin or the operator.
|
|
148
|
+
* @param vaultId The id of the atomic vault
|
|
149
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
150
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
151
|
+
* @param options Optional tx execution params
|
|
152
|
+
* @returns OnChainCallResponse
|
|
153
|
+
*/
|
|
154
|
+
atomicOpenSuilendObligation(vaultId: string, poolCoinType: string, lendingMarketId: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Claim one accrued Suilend pool reward into an allowlisted sub-account.
|
|
157
|
+
* One call per (reserve, reward slot, deposit-or-borrow) triple — batch in
|
|
158
|
+
* a PTB, and sweep every occupied slot rather than only the live campaign.
|
|
159
|
+
* @param vaultId The id of the atomic vault
|
|
160
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
161
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
162
|
+
* @param rewardSourceType Coin type identifying the reserve the reward
|
|
163
|
+
* accrues on — the vault's collateral for the strategy position, the
|
|
164
|
+
* foreign type's own reserve for secondary-collateral rewards
|
|
165
|
+
* @param rewardType Coin type of the reward being claimed
|
|
166
|
+
* @param subAccount Allowlisted sub-account to receive the reward
|
|
167
|
+
* @param rewardIndex Slot index in the reserve's pool_rewards vector
|
|
168
|
+
* @param isDepositReward True for the deposit-side reward manager
|
|
169
|
+
* @param options Optional tx execution params
|
|
170
|
+
* @returns OnChainCallResponse
|
|
171
|
+
*/
|
|
172
|
+
atomicClaimSuilendStrategyReward(vaultId: string, poolCoinType: string, lendingMarketId: string, rewardSourceType: string, rewardType: string, subAccount: string, rewardIndex: NumStr, isDepositReward: boolean, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* Drain a foreign collateral position from the vault's Suilend obligation.
|
|
175
|
+
* Only needed when a third party has deposited into it via Suilend's
|
|
176
|
+
* permissionless `claim_rewards_and_deposit`; teardown refuses to run while
|
|
177
|
+
* any deposit remains, so this is the unblock.
|
|
178
|
+
* @param vaultId The id of the atomic vault
|
|
179
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
180
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
181
|
+
* @param rewardType Coin type of the foreign collateral position
|
|
182
|
+
* @param subAccount Allowlisted sub-account to receive the proceeds
|
|
183
|
+
* @param options Optional tx execution params
|
|
184
|
+
* @returns OnChainCallResponse
|
|
185
|
+
*/
|
|
186
|
+
atomicWithdrawSuilendSecondaryCollateral(vaultId: string, poolCoinType: string, lendingMarketId: string, rewardType: string, subAccount: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
187
|
+
/**
|
|
188
|
+
* SUI variant of `atomicWithdrawSuilendSecondaryCollateral`. Use whenever
|
|
189
|
+
* the foreign position is SUI — the generic call rejects it, because
|
|
190
|
+
* Suilend stakes idle SUI reserve balance and the combined redemption path
|
|
191
|
+
* has no unstake step.
|
|
192
|
+
* @param vaultId The id of the atomic vault
|
|
193
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
194
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
195
|
+
* @param subAccount Allowlisted sub-account to receive the proceeds
|
|
196
|
+
* @param options Optional tx execution params
|
|
197
|
+
* @returns OnChainCallResponse
|
|
198
|
+
*/
|
|
199
|
+
atomicWithdrawSuilendSecondaryCollateralSui(vaultId: string, poolCoinType: string, lendingMarketId: string, subAccount: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
200
|
+
/**
|
|
201
|
+
* Collect accrued AlphaLend rewards into an allowlisted sub-account. Call
|
|
202
|
+
* once per reward type BEFORE exiting the strategy — the exit burns the
|
|
203
|
+
* PositionCap and strands anything uncollected. Requires an AlphaLend Pyth
|
|
204
|
+
* price refresh earlier in the same PTB. `rewardType` must not be SUI.
|
|
205
|
+
* @param vaultId The id of the atomic vault
|
|
206
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
207
|
+
* @param rewardType Coin type of the reward being collected
|
|
208
|
+
* @param subAccount Allowlisted sub-account to receive the reward
|
|
209
|
+
* @param options Optional tx execution params
|
|
210
|
+
* @returns OnChainCallResponse
|
|
211
|
+
*/
|
|
212
|
+
atomicCollectAlphalendStrategyReward(vaultId: string, lendingProtocolId: string, rewardType: string, subAccount: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
140
213
|
/**
|
|
141
214
|
* Supply collateral from an atomic vault into the Suilend strategy
|
|
142
215
|
* @param vaultId The id of the atomic vault
|
|
@@ -240,4 +313,55 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
240
313
|
* @returns OnChainCallResponse
|
|
241
314
|
*/
|
|
242
315
|
atomicUpdateVaultRate(vaultId: string, newRate: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
316
|
+
/**
|
|
317
|
+
* Exits the Suilend strategy on a SUI-collateral vault
|
|
318
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
319
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
320
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
321
|
+
* @param options Optional tx execution params
|
|
322
|
+
* @returns OnChainCallResponse
|
|
323
|
+
*/
|
|
324
|
+
atomicSetStrategyNoneFromSuilendSui(vaultId: string, poolCoinType: string, lendingMarketId: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
325
|
+
/**
|
|
326
|
+
* Exits the AlphaLend strategy on a SUI-collateral vault
|
|
327
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
328
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
329
|
+
* @param acceptResidual Abandon a dust residual rather than aborting the
|
|
330
|
+
* exit. Only pass true deliberately: the residual is forfeited.
|
|
331
|
+
* @param options Optional tx execution params
|
|
332
|
+
* @returns OnChainCallResponse
|
|
333
|
+
*/
|
|
334
|
+
atomicSetStrategyNoneFromAlphalendSui(vaultId: string, lendingProtocolId: string, acceptResidual: boolean, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
335
|
+
/**
|
|
336
|
+
* Withdraws collateral from the Suilend strategy on a SUI-collateral vault
|
|
337
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
338
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
339
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
340
|
+
* @param amount Amount of collateral to withdraw, in base units
|
|
341
|
+
* @param options Optional tx execution params
|
|
342
|
+
* @returns OnChainCallResponse
|
|
343
|
+
*/
|
|
344
|
+
atomicWithdrawFromSuilendStrategySui(vaultId: string, poolCoinType: string, lendingMarketId: string, amount: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
345
|
+
/**
|
|
346
|
+
* Withdraws collateral from the AlphaLend strategy on a SUI-collateral vault
|
|
347
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
348
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
349
|
+
* @param amount Amount of collateral to withdraw, in base units
|
|
350
|
+
* @param options Optional tx execution params
|
|
351
|
+
* @returns OnChainCallResponse
|
|
352
|
+
*/
|
|
353
|
+
atomicWithdrawFromAlphalendStrategySui(vaultId: string, lendingProtocolId: string, amount: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
354
|
+
/**
|
|
355
|
+
* Collects accrued AlphaLend rewards through the SUI system state and
|
|
356
|
+
* forwards them to an allowlisted sub-account.
|
|
357
|
+
*
|
|
358
|
+
* Call before exiting the strategy — the exit burns the `PositionCap` and
|
|
359
|
+
* strands anything uncollected.
|
|
360
|
+
* @param vaultId Id of the atomic vault
|
|
361
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
362
|
+
* @param subAccount Allowlisted sub-account to receive the rewards
|
|
363
|
+
* @param options Optional tx execution params
|
|
364
|
+
* @returns OnChainCallResponse
|
|
365
|
+
*/
|
|
366
|
+
atomicCollectAlphalendStrategyRewardSui(vaultId: string, lendingProtocolId: string, subAccount: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
243
367
|
}
|
|
@@ -244,6 +244,102 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
244
244
|
});
|
|
245
245
|
return this.execCall(txb, options);
|
|
246
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Step 2 of 2 for Suilend activation: opens the obligation the supply is
|
|
249
|
+
* held in. Must run after `atomicSetStrategySuilend` and before the first
|
|
250
|
+
* supply, which aborts `ESuilendObligationMissing` until it has.
|
|
251
|
+
*
|
|
252
|
+
* Not optional — Suilend accounts rewards against an obligation, so cTokens
|
|
253
|
+
* held outside one earn base interest and no rewards. Callable by either
|
|
254
|
+
* the vault admin or the operator.
|
|
255
|
+
* @param vaultId The id of the atomic vault
|
|
256
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
257
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
258
|
+
* @param options Optional tx execution params
|
|
259
|
+
* @returns OnChainCallResponse
|
|
260
|
+
*/
|
|
261
|
+
async atomicOpenSuilendObligation(vaultId, poolCoinType, lendingMarketId, options) {
|
|
262
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
263
|
+
this.txBuilder.atomicOpenSuilendObligation(vaultId, poolCoinType, lendingMarketId, {
|
|
264
|
+
...options,
|
|
265
|
+
txBlock: txb
|
|
266
|
+
});
|
|
267
|
+
return this.execCall(txb, options);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Claim one accrued Suilend pool reward into an allowlisted sub-account.
|
|
271
|
+
* One call per (reserve, reward slot, deposit-or-borrow) triple — batch in
|
|
272
|
+
* a PTB, and sweep every occupied slot rather than only the live campaign.
|
|
273
|
+
* @param vaultId The id of the atomic vault
|
|
274
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
275
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
276
|
+
* @param rewardSourceType Coin type identifying the reserve the reward
|
|
277
|
+
* accrues on — the vault's collateral for the strategy position, the
|
|
278
|
+
* foreign type's own reserve for secondary-collateral rewards
|
|
279
|
+
* @param rewardType Coin type of the reward being claimed
|
|
280
|
+
* @param subAccount Allowlisted sub-account to receive the reward
|
|
281
|
+
* @param rewardIndex Slot index in the reserve's pool_rewards vector
|
|
282
|
+
* @param isDepositReward True for the deposit-side reward manager
|
|
283
|
+
* @param options Optional tx execution params
|
|
284
|
+
* @returns OnChainCallResponse
|
|
285
|
+
*/
|
|
286
|
+
async atomicClaimSuilendStrategyReward(vaultId, poolCoinType, lendingMarketId, rewardSourceType, rewardType, subAccount, rewardIndex, isDepositReward, options) {
|
|
287
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
288
|
+
this.txBuilder.atomicClaimSuilendStrategyReward(vaultId, poolCoinType, lendingMarketId, rewardSourceType, rewardType, subAccount, rewardIndex, isDepositReward, { ...options, txBlock: txb });
|
|
289
|
+
return this.execCall(txb, options);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Drain a foreign collateral position from the vault's Suilend obligation.
|
|
293
|
+
* Only needed when a third party has deposited into it via Suilend's
|
|
294
|
+
* permissionless `claim_rewards_and_deposit`; teardown refuses to run while
|
|
295
|
+
* any deposit remains, so this is the unblock.
|
|
296
|
+
* @param vaultId The id of the atomic vault
|
|
297
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
298
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
299
|
+
* @param rewardType Coin type of the foreign collateral position
|
|
300
|
+
* @param subAccount Allowlisted sub-account to receive the proceeds
|
|
301
|
+
* @param options Optional tx execution params
|
|
302
|
+
* @returns OnChainCallResponse
|
|
303
|
+
*/
|
|
304
|
+
async atomicWithdrawSuilendSecondaryCollateral(vaultId, poolCoinType, lendingMarketId, rewardType, subAccount, options) {
|
|
305
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
306
|
+
this.txBuilder.atomicWithdrawSuilendSecondaryCollateral(vaultId, poolCoinType, lendingMarketId, rewardType, subAccount, { ...options, txBlock: txb });
|
|
307
|
+
return this.execCall(txb, options);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* SUI variant of `atomicWithdrawSuilendSecondaryCollateral`. Use whenever
|
|
311
|
+
* the foreign position is SUI — the generic call rejects it, because
|
|
312
|
+
* Suilend stakes idle SUI reserve balance and the combined redemption path
|
|
313
|
+
* has no unstake step.
|
|
314
|
+
* @param vaultId The id of the atomic vault
|
|
315
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
316
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
317
|
+
* @param subAccount Allowlisted sub-account to receive the proceeds
|
|
318
|
+
* @param options Optional tx execution params
|
|
319
|
+
* @returns OnChainCallResponse
|
|
320
|
+
*/
|
|
321
|
+
async atomicWithdrawSuilendSecondaryCollateralSui(vaultId, poolCoinType, lendingMarketId, subAccount, options) {
|
|
322
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
323
|
+
this.txBuilder.atomicWithdrawSuilendSecondaryCollateralSui(vaultId, poolCoinType, lendingMarketId, subAccount, { ...options, txBlock: txb });
|
|
324
|
+
return this.execCall(txb, options);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Collect accrued AlphaLend rewards into an allowlisted sub-account. Call
|
|
328
|
+
* once per reward type BEFORE exiting the strategy — the exit burns the
|
|
329
|
+
* PositionCap and strands anything uncollected. Requires an AlphaLend Pyth
|
|
330
|
+
* price refresh earlier in the same PTB. `rewardType` must not be SUI.
|
|
331
|
+
* @param vaultId The id of the atomic vault
|
|
332
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
333
|
+
* @param rewardType Coin type of the reward being collected
|
|
334
|
+
* @param subAccount Allowlisted sub-account to receive the reward
|
|
335
|
+
* @param options Optional tx execution params
|
|
336
|
+
* @returns OnChainCallResponse
|
|
337
|
+
*/
|
|
338
|
+
async atomicCollectAlphalendStrategyReward(vaultId, lendingProtocolId, rewardType, subAccount, options) {
|
|
339
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
340
|
+
this.txBuilder.atomicCollectAlphalendStrategyReward(vaultId, lendingProtocolId, rewardType, subAccount, { ...options, txBlock: txb });
|
|
341
|
+
return this.execCall(txb, options);
|
|
342
|
+
}
|
|
247
343
|
/**
|
|
248
344
|
* Supply collateral from an atomic vault into the Suilend strategy
|
|
249
345
|
* @param vaultId The id of the atomic vault
|
|
@@ -406,4 +502,82 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
406
502
|
});
|
|
407
503
|
return this.execCall(txb, options);
|
|
408
504
|
}
|
|
505
|
+
// === Vault<SUI> strategy variants ===
|
|
506
|
+
//
|
|
507
|
+
// SUI-collateral vaults route through the system state to unwrap/rewrap
|
|
508
|
+
// SUI, so the strategy entrypoints are monomorphic in `T = SUI` and take
|
|
509
|
+
// `&mut SuiSystemState`. Use these instead of the generic ones above when
|
|
510
|
+
// the vault's collateral is SUI; the generic entrypoints will not typecheck
|
|
511
|
+
// against such a vault.
|
|
512
|
+
/**
|
|
513
|
+
* Exits the Suilend strategy on a SUI-collateral vault
|
|
514
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
515
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
516
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
517
|
+
* @param options Optional tx execution params
|
|
518
|
+
* @returns OnChainCallResponse
|
|
519
|
+
*/
|
|
520
|
+
async atomicSetStrategyNoneFromSuilendSui(vaultId, poolCoinType, lendingMarketId, options) {
|
|
521
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
522
|
+
this.txBuilder.atomicSetStrategyNoneFromSuilendSui(vaultId, poolCoinType, lendingMarketId, { ...options, txBlock: txb });
|
|
523
|
+
return this.execCall(txb, options);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Exits the AlphaLend strategy on a SUI-collateral vault
|
|
527
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
528
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
529
|
+
* @param acceptResidual Abandon a dust residual rather than aborting the
|
|
530
|
+
* exit. Only pass true deliberately: the residual is forfeited.
|
|
531
|
+
* @param options Optional tx execution params
|
|
532
|
+
* @returns OnChainCallResponse
|
|
533
|
+
*/
|
|
534
|
+
async atomicSetStrategyNoneFromAlphalendSui(vaultId, lendingProtocolId, acceptResidual, options) {
|
|
535
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
536
|
+
this.txBuilder.atomicSetStrategyNoneFromAlphalendSui(vaultId, lendingProtocolId, acceptResidual, { ...options, txBlock: txb });
|
|
537
|
+
return this.execCall(txb, options);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Withdraws collateral from the Suilend strategy on a SUI-collateral vault
|
|
541
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
542
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
543
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
544
|
+
* @param amount Amount of collateral to withdraw, in base units
|
|
545
|
+
* @param options Optional tx execution params
|
|
546
|
+
* @returns OnChainCallResponse
|
|
547
|
+
*/
|
|
548
|
+
async atomicWithdrawFromSuilendStrategySui(vaultId, poolCoinType, lendingMarketId, amount, options) {
|
|
549
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
550
|
+
this.txBuilder.atomicWithdrawFromSuilendStrategySui(vaultId, poolCoinType, lendingMarketId, amount, { ...options, txBlock: txb });
|
|
551
|
+
return this.execCall(txb, options);
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Withdraws collateral from the AlphaLend strategy on a SUI-collateral vault
|
|
555
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
556
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
557
|
+
* @param amount Amount of collateral to withdraw, in base units
|
|
558
|
+
* @param options Optional tx execution params
|
|
559
|
+
* @returns OnChainCallResponse
|
|
560
|
+
*/
|
|
561
|
+
async atomicWithdrawFromAlphalendStrategySui(vaultId, lendingProtocolId, amount, options) {
|
|
562
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
563
|
+
this.txBuilder.atomicWithdrawFromAlphalendStrategySui(vaultId, lendingProtocolId, amount, { ...options, txBlock: txb });
|
|
564
|
+
return this.execCall(txb, options);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Collects accrued AlphaLend rewards through the SUI system state and
|
|
568
|
+
* forwards them to an allowlisted sub-account.
|
|
569
|
+
*
|
|
570
|
+
* Call before exiting the strategy — the exit burns the `PositionCap` and
|
|
571
|
+
* strands anything uncollected.
|
|
572
|
+
* @param vaultId Id of the atomic vault
|
|
573
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
574
|
+
* @param subAccount Allowlisted sub-account to receive the rewards
|
|
575
|
+
* @param options Optional tx execution params
|
|
576
|
+
* @returns OnChainCallResponse
|
|
577
|
+
*/
|
|
578
|
+
async atomicCollectAlphalendStrategyRewardSui(vaultId, lendingProtocolId, subAccount, options) {
|
|
579
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
580
|
+
this.txBuilder.atomicCollectAlphalendStrategyRewardSui(vaultId, lendingProtocolId, subAccount, { ...options, txBlock: txb });
|
|
581
|
+
return this.execCall(txb, options);
|
|
582
|
+
}
|
|
409
583
|
}
|
|
@@ -558,13 +558,124 @@ export declare class TxBuilder {
|
|
|
558
558
|
*/
|
|
559
559
|
atomicSetStrategyNoneFromAlphalend(vaultId: string, lendingProtocolId: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
560
560
|
/**
|
|
561
|
-
*
|
|
561
|
+
* Step 1 of 2 for Suilend activation: commits the reserve index, the market
|
|
562
|
+
* object and the collateral type. Step 2 is `atomicOpenSuilendObligation`,
|
|
563
|
+
* without which every supply aborts `ESuilendObligationMissing`.
|
|
564
|
+
*
|
|
565
|
+
* The market object and `poolCoinType` became required in the I-11 fix —
|
|
566
|
+
* previously only the reserve index was committed, so a wrong market was
|
|
567
|
+
* undetectable on chain.
|
|
562
568
|
* @param vaultId Id of the atomic vault
|
|
569
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
570
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
563
571
|
* @param reserveArrayIndex Suilend reserve array index
|
|
564
572
|
* @param options Optional tx building params
|
|
565
573
|
* @returns TransactionBlock
|
|
566
574
|
*/
|
|
567
|
-
atomicSetStrategySuilend(vaultId: string, reserveArrayIndex: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
575
|
+
atomicSetStrategySuilend(vaultId: string, poolCoinType: string, lendingMarketId: string, reserveArrayIndex: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
576
|
+
/**
|
|
577
|
+
* Step 2 of 2 for Suilend activation: opens the obligation the vault's
|
|
578
|
+
* supply is held in. Must run after `atomicSetStrategySuilend` and before
|
|
579
|
+
* the first supply.
|
|
580
|
+
*
|
|
581
|
+
* Not optional. Suilend accounts liquidity-mining rewards against an
|
|
582
|
+
* obligation, so cTokens held outside one earn base interest and no
|
|
583
|
+
* rewards; supplying before this aborts rather than silently falling back.
|
|
584
|
+
* Callable by either the vault admin or the operator.
|
|
585
|
+
* @param vaultId Id of the atomic vault
|
|
586
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
587
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
588
|
+
* @param options Optional tx building params
|
|
589
|
+
* @returns TransactionBlock
|
|
590
|
+
*/
|
|
591
|
+
atomicOpenSuilendObligation(vaultId: string, poolCoinType: string, lendingMarketId: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
592
|
+
/**
|
|
593
|
+
* Claims one accrued Suilend pool reward and forwards it to `subAccount`,
|
|
594
|
+
* which must be on the vault's sub-account allowlist (`EInvalidAccount`).
|
|
595
|
+
*
|
|
596
|
+
* Suilend accounts rewards per (reserve, reward slot, deposit-or-borrow)
|
|
597
|
+
* triple, so call once per triple and batch them in one PTB. Sweep EVERY
|
|
598
|
+
* occupied slot, not just the live campaign — ended campaigns keep
|
|
599
|
+
* claimable `earned_rewards`.
|
|
600
|
+
*
|
|
601
|
+
* `rewardIndex` must be resolved off chain per claim and never cached:
|
|
602
|
+
* `add_pool_reward` fills the first vacant slot, so indices are reused, and
|
|
603
|
+
* a stale (index, rewardType) pair aborts on Suilend's `EInvalidType`.
|
|
604
|
+
* @param vaultId Id of the atomic vault
|
|
605
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
606
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
607
|
+
* @param rewardSourceType Coin type identifying the reserve the reward
|
|
608
|
+
* accrues on. The vault's collateral for the strategy position itself,
|
|
609
|
+
* but the foreign type's own reserve for rewards earned by secondary
|
|
610
|
+
* collateral sitting in the obligation — those accrue separately and are
|
|
611
|
+
* lost at exit if not claimed.
|
|
612
|
+
* @param rewardType Coin type of the reward being claimed
|
|
613
|
+
* @param subAccount Allowlisted sub-account to receive the reward
|
|
614
|
+
* @param rewardIndex Slot index in the reserve's pool_rewards vector
|
|
615
|
+
* @param isDepositReward True for the deposit-side reward manager
|
|
616
|
+
* @param options Optional tx building params
|
|
617
|
+
* @returns TransactionBlock
|
|
618
|
+
*/
|
|
619
|
+
atomicClaimSuilendStrategyReward(vaultId: string, poolCoinType: string, lendingMarketId: string, rewardSourceType: string, rewardType: string, subAccount: string, rewardIndex: NumStr, isDepositReward: boolean, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
620
|
+
/**
|
|
621
|
+
* Drains a foreign collateral position from the vault's Suilend obligation
|
|
622
|
+
* to an allowlisted sub-account.
|
|
623
|
+
*
|
|
624
|
+
* Needed because Suilend's `claim_rewards_and_deposit` takes an obligation
|
|
625
|
+
* id rather than the owner cap, so anyone can deposit this vault's claimed
|
|
626
|
+
* rewards into its obligation as collateral in a type the vault never
|
|
627
|
+
* chose. Teardown refuses to discard the obligation cap while any deposit
|
|
628
|
+
* remains, so this is what stops a third party blocking the exit. Read the
|
|
629
|
+
* foreign types off the obligation's `deposits` vector; one call per type.
|
|
630
|
+
*
|
|
631
|
+
* Aborts if `rewardType` is the vault's collateral — that position exits
|
|
632
|
+
* through `atomicWithdrawFromSuilendStrategy`.
|
|
633
|
+
* @param vaultId Id of the atomic vault
|
|
634
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
635
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
636
|
+
* @param rewardType Coin type of the foreign collateral position
|
|
637
|
+
* @param subAccount Allowlisted sub-account to receive the proceeds
|
|
638
|
+
* @param options Optional tx building params
|
|
639
|
+
* @returns TransactionBlock
|
|
640
|
+
*/
|
|
641
|
+
atomicWithdrawSuilendSecondaryCollateral(vaultId: string, poolCoinType: string, lendingMarketId: string, rewardType: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
642
|
+
/**
|
|
643
|
+
* SUI variant of `atomicWithdrawSuilendSecondaryCollateral`. Threads the Sui
|
|
644
|
+
* system state for Suilend's request -> unstake -> fulfill path.
|
|
645
|
+
*
|
|
646
|
+
* Use this whenever the foreign position is SUI, regardless of the vault's
|
|
647
|
+
* own collateral type. The generic call rejects SUI, because Suilend stakes
|
|
648
|
+
* idle SUI reserve balance and the combined redemption helper has no
|
|
649
|
+
* unstake step — it pays from a liquid balance that may be empty. A SUI
|
|
650
|
+
* position here is likely rather than exotic: SUI and sSUI are what these
|
|
651
|
+
* reserves pay out.
|
|
652
|
+
* @param vaultId Id of the atomic vault
|
|
653
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
654
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
655
|
+
* @param subAccount Allowlisted sub-account to receive the proceeds
|
|
656
|
+
* @param options Optional tx building params
|
|
657
|
+
* @returns TransactionBlock
|
|
658
|
+
*/
|
|
659
|
+
atomicWithdrawSuilendSecondaryCollateralSui(vaultId: string, poolCoinType: string, lendingMarketId: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
660
|
+
/**
|
|
661
|
+
* Collects accrued AlphaLend rewards of coin type `rewardType` and forwards
|
|
662
|
+
* them to an allowlisted sub-account.
|
|
663
|
+
*
|
|
664
|
+
* Call once per reward type BEFORE exiting the strategy — the exit burns
|
|
665
|
+
* the `PositionCap` and strands anything uncollected. `rewardType` must not
|
|
666
|
+
* be SUI; AlphaLend settles SUI through the staking system and needs the
|
|
667
|
+
* monomorphic variant, which this SDK does not yet expose.
|
|
668
|
+
*
|
|
669
|
+
* PTB REQUIREMENT: refresh AlphaLend Pyth prices for the active market
|
|
670
|
+
* earlier in the same transaction.
|
|
671
|
+
* @param vaultId Id of the atomic vault
|
|
672
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
673
|
+
* @param rewardType Coin type of the reward being collected
|
|
674
|
+
* @param subAccount Allowlisted sub-account to receive the reward
|
|
675
|
+
* @param options Optional tx building params
|
|
676
|
+
* @returns TransactionBlock
|
|
677
|
+
*/
|
|
678
|
+
atomicCollectAlphalendStrategyReward(vaultId: string, lendingProtocolId: string, rewardType: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
568
679
|
/**
|
|
569
680
|
* Sets the AlphaLend strategy for an atomic vault
|
|
570
681
|
* @param vaultId Id of the atomic vault
|
|
@@ -782,10 +893,16 @@ export declare class TxBuilder {
|
|
|
782
893
|
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
783
894
|
* @param shareCoinId Object id of the Coin<R> to swap
|
|
784
895
|
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
896
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
897
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
898
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
899
|
+
* utilization) and the source rate can change between quoting and
|
|
900
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
901
|
+
* the guard entirely.
|
|
785
902
|
* @param options Optional tx building params
|
|
786
903
|
* @returns TransactionBlock
|
|
787
904
|
*/
|
|
788
|
-
atomicSwapEmberShares(vaultId: string, sourceReceiptType: string, sourceVaultId: string, shareCoinId: string, receiver: string | null | undefined, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
905
|
+
atomicSwapEmberShares(vaultId: string, sourceReceiptType: string, sourceVaultId: string, shareCoinId: string, receiver: string | null | undefined, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
789
906
|
/**
|
|
790
907
|
* Swaps ember shares (Coin<R>) into an atomic vault, routing collateral
|
|
791
908
|
* through the Suilend strategy
|
|
@@ -796,10 +913,16 @@ export declare class TxBuilder {
|
|
|
796
913
|
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
797
914
|
* @param shareCoinId Object id of the Coin<R> to swap
|
|
798
915
|
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
916
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
917
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
918
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
919
|
+
* utilization) and the source rate can change between quoting and
|
|
920
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
921
|
+
* the guard entirely.
|
|
799
922
|
* @param options Optional tx building params
|
|
800
923
|
* @returns TransactionBlock
|
|
801
924
|
*/
|
|
802
|
-
atomicSwapEmberSharesWithSuilend(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, shareCoinId: string, receiver: string | null | undefined, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
925
|
+
atomicSwapEmberSharesWithSuilend(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, shareCoinId: string, receiver: string | null | undefined, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
803
926
|
/**
|
|
804
927
|
* Swaps ember shares (Coin<R>) into an atomic vault, routing collateral
|
|
805
928
|
* through the AlphaLend strategy
|
|
@@ -809,8 +932,77 @@ export declare class TxBuilder {
|
|
|
809
932
|
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
810
933
|
* @param shareCoinId Object id of the Coin<R> to swap
|
|
811
934
|
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
935
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
936
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
937
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
938
|
+
* utilization) and the source rate can change between quoting and
|
|
939
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
940
|
+
* the guard entirely.
|
|
941
|
+
* @param options Optional tx building params
|
|
942
|
+
* @returns TransactionBlock
|
|
943
|
+
*/
|
|
944
|
+
atomicSwapEmberSharesWithAlphalend(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, shareCoinId: string, receiver: string | null | undefined, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
945
|
+
/**
|
|
946
|
+
* Swaps ember shares into a SUI-collateral atomic vault, sourcing payout
|
|
947
|
+
* liquidity from Suilend.
|
|
948
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
949
|
+
* @param sourceReceiptType Receipt coin type of the source vault (R)
|
|
950
|
+
* @param poolCoinType Suilend pool coin type (P)
|
|
951
|
+
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
952
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
953
|
+
* @param shareCoinId Object id of the Coin<R> to swap
|
|
954
|
+
* @param receiver Payout recipient. REQUIRED — this entry function takes a
|
|
955
|
+
* bare address, so unlike the generic variant there is no on-chain
|
|
956
|
+
* fallback to the sender.
|
|
957
|
+
* @param minNetOut Minimum collateral to receive, in base units (A-9 guard)
|
|
958
|
+
* @param options Optional tx building params
|
|
959
|
+
* @returns TransactionBlock
|
|
960
|
+
*/
|
|
961
|
+
atomicSwapEmberSharesWithSuilendSui(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, shareCoinId: string, receiver: string, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
962
|
+
/**
|
|
963
|
+
* Swaps ember shares into a SUI-collateral atomic vault, sourcing payout
|
|
964
|
+
* liquidity from AlphaLend.
|
|
965
|
+
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
966
|
+
* @param sourceReceiptType Receipt coin type of the source vault (R)
|
|
967
|
+
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
968
|
+
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
969
|
+
* @param shareCoinId Object id of the Coin<R> to swap
|
|
970
|
+
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
971
|
+
* @param minNetOut Minimum collateral to receive, in base units (A-9 guard)
|
|
812
972
|
* @param options Optional tx building params
|
|
813
973
|
* @returns TransactionBlock
|
|
814
974
|
*/
|
|
815
|
-
|
|
975
|
+
atomicSwapEmberSharesWithAlphalendSui(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, shareCoinId: string, receiver: string | null | undefined, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
976
|
+
/**
|
|
977
|
+
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
978
|
+
* from Suilend.
|
|
979
|
+
* @param receiver Payout recipient. REQUIRED — bare address on chain.
|
|
980
|
+
*/
|
|
981
|
+
atomicInstantWithdrawWithSuilendSui(vaultId: string, poolCoinType: string, lendingMarketId: string, shares: NumStr, receiver: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
982
|
+
/**
|
|
983
|
+
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
984
|
+
* from AlphaLend.
|
|
985
|
+
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
986
|
+
*/
|
|
987
|
+
atomicInstantWithdrawWithAlphalendSui(vaultId: string, lendingProtocolId: string, shares: NumStr, receiver: string | null | undefined, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
988
|
+
/** Exits the Suilend strategy on a SUI-collateral vault (operator). */
|
|
989
|
+
atomicSetStrategyNoneFromSuilendSui(vaultId: string, poolCoinType: string, lendingMarketId: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
990
|
+
/**
|
|
991
|
+
* Exits the AlphaLend strategy on a SUI-collateral vault (operator).
|
|
992
|
+
* @param acceptResidual Abandon a dust residual rather than aborting the exit
|
|
993
|
+
*/
|
|
994
|
+
atomicSetStrategyNoneFromAlphalendSui(vaultId: string, lendingProtocolId: string, acceptResidual: boolean, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
995
|
+
/** Withdraws from the Suilend strategy on a SUI-collateral vault (operator). */
|
|
996
|
+
atomicWithdrawFromSuilendStrategySui(vaultId: string, poolCoinType: string, lendingMarketId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
997
|
+
/** Withdraws from the AlphaLend strategy on a SUI-collateral vault (operator). */
|
|
998
|
+
atomicWithdrawFromAlphalendStrategySui(vaultId: string, lendingProtocolId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
999
|
+
/**
|
|
1000
|
+
* Collects AlphaLend rewards through the SUI system state and forwards them
|
|
1001
|
+
* to an allowlisted sub-account (operator).
|
|
1002
|
+
*
|
|
1003
|
+
* Unlike the other `_sui` entrypoints this one is still generic in `T` — it
|
|
1004
|
+
* is the reward path, not the collateral path, so the vault's own collateral
|
|
1005
|
+
* type is still a type argument.
|
|
1006
|
+
*/
|
|
1007
|
+
atomicCollectAlphalendStrategyRewardSui(vaultId: string, lendingProtocolId: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
816
1008
|
}
|