@ember-finance/sdk 2.20.0 → 2.21.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 +0 -63
- package/dist/src/sui-vaults/on-chain-calls/operator.js +0 -90
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.d.ts +0 -120
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.js +6 -357
- package/dist/src/sui-vaults/on-chain-calls/user.d.ts +0 -58
- package/dist/src/sui-vaults/on-chain-calls/user.js +3 -96
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.d.ts +0 -21
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.js +0 -32
- package/package.json +1 -1
|
@@ -197,19 +197,6 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
197
197
|
* @returns OnChainCallResponse
|
|
198
198
|
*/
|
|
199
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>;
|
|
213
200
|
/**
|
|
214
201
|
* Supply collateral from an atomic vault into the Suilend strategy
|
|
215
202
|
* @param vaultId The id of the atomic vault
|
|
@@ -220,15 +207,6 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
220
207
|
* @returns OnChainCallResponse
|
|
221
208
|
*/
|
|
222
209
|
atomicSupplyToSuilendStrategy(vaultId: string, poolCoinType: string, lendingMarketId: string, amount: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
223
|
-
/**
|
|
224
|
-
* Supply collateral from an atomic vault into the AlphaLend strategy
|
|
225
|
-
* @param vaultId The id of the atomic vault
|
|
226
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
227
|
-
* @param amount The amount to supply
|
|
228
|
-
* @param options Optional tx execution params
|
|
229
|
-
* @returns OnChainCallResponse
|
|
230
|
-
*/
|
|
231
|
-
atomicSupplyToAlphalendStrategy(vaultId: string, lendingProtocolId: string, amount: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
232
210
|
/**
|
|
233
211
|
* Withdraw collateral from the Suilend strategy back into an atomic vault
|
|
234
212
|
* @param vaultId The id of the atomic vault
|
|
@@ -239,15 +217,6 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
239
217
|
* @returns OnChainCallResponse
|
|
240
218
|
*/
|
|
241
219
|
atomicWithdrawFromSuilendStrategy(vaultId: string, poolCoinType: string, lendingMarketId: string, amount: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
242
|
-
/**
|
|
243
|
-
* Withdraw collateral from the AlphaLend strategy back into an atomic vault
|
|
244
|
-
* @param vaultId The id of the atomic vault
|
|
245
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
246
|
-
* @param amount The amount to withdraw
|
|
247
|
-
* @param options Optional tx execution params
|
|
248
|
-
* @returns OnChainCallResponse
|
|
249
|
-
*/
|
|
250
|
-
atomicWithdrawFromAlphalendStrategy(vaultId: string, lendingProtocolId: string, amount: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
251
220
|
/**
|
|
252
221
|
* Supply collateral from an atomic vault to one of its sub accounts
|
|
253
222
|
* @param vaultId The id of the atomic vault
|
|
@@ -322,16 +291,6 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
322
291
|
* @returns OnChainCallResponse
|
|
323
292
|
*/
|
|
324
293
|
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
294
|
/**
|
|
336
295
|
* Withdraws collateral from the Suilend strategy on a SUI-collateral vault
|
|
337
296
|
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
@@ -342,26 +301,4 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
342
301
|
* @returns OnChainCallResponse
|
|
343
302
|
*/
|
|
344
303
|
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>;
|
|
367
304
|
}
|
|
@@ -323,23 +323,6 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
323
323
|
this.txBuilder.atomicWithdrawSuilendSecondaryCollateralSui(vaultId, poolCoinType, lendingMarketId, subAccount, { ...options, txBlock: txb });
|
|
324
324
|
return this.execCall(txb, options);
|
|
325
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
|
-
}
|
|
343
326
|
/**
|
|
344
327
|
* Supply collateral from an atomic vault into the Suilend strategy
|
|
345
328
|
* @param vaultId The id of the atomic vault
|
|
@@ -354,22 +337,6 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
354
337
|
this.txBuilder.atomicSupplyToSuilendStrategy(vaultId, poolCoinType, lendingMarketId, amount, { ...options, txBlock: txb });
|
|
355
338
|
return this.execCall(txb, options);
|
|
356
339
|
}
|
|
357
|
-
/**
|
|
358
|
-
* Supply collateral from an atomic vault into the AlphaLend strategy
|
|
359
|
-
* @param vaultId The id of the atomic vault
|
|
360
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
361
|
-
* @param amount The amount to supply
|
|
362
|
-
* @param options Optional tx execution params
|
|
363
|
-
* @returns OnChainCallResponse
|
|
364
|
-
*/
|
|
365
|
-
async atomicSupplyToAlphalendStrategy(vaultId, lendingProtocolId, amount, options) {
|
|
366
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
367
|
-
this.txBuilder.atomicSupplyToAlphalendStrategy(vaultId, lendingProtocolId, amount, {
|
|
368
|
-
...options,
|
|
369
|
-
txBlock: txb
|
|
370
|
-
});
|
|
371
|
-
return this.execCall(txb, options);
|
|
372
|
-
}
|
|
373
340
|
/**
|
|
374
341
|
* Withdraw collateral from the Suilend strategy back into an atomic vault
|
|
375
342
|
* @param vaultId The id of the atomic vault
|
|
@@ -384,19 +351,6 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
384
351
|
this.txBuilder.atomicWithdrawFromSuilendStrategy(vaultId, poolCoinType, lendingMarketId, amount, { ...options, txBlock: txb });
|
|
385
352
|
return this.execCall(txb, options);
|
|
386
353
|
}
|
|
387
|
-
/**
|
|
388
|
-
* Withdraw collateral from the AlphaLend strategy back into an atomic vault
|
|
389
|
-
* @param vaultId The id of the atomic vault
|
|
390
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
391
|
-
* @param amount The amount to withdraw
|
|
392
|
-
* @param options Optional tx execution params
|
|
393
|
-
* @returns OnChainCallResponse
|
|
394
|
-
*/
|
|
395
|
-
async atomicWithdrawFromAlphalendStrategy(vaultId, lendingProtocolId, amount, options) {
|
|
396
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
397
|
-
this.txBuilder.atomicWithdrawFromAlphalendStrategy(vaultId, lendingProtocolId, amount, { ...options, txBlock: txb });
|
|
398
|
-
return this.execCall(txb, options);
|
|
399
|
-
}
|
|
400
354
|
/**
|
|
401
355
|
* Supply collateral from an atomic vault to one of its sub accounts
|
|
402
356
|
* @param vaultId The id of the atomic vault
|
|
@@ -522,20 +476,6 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
522
476
|
this.txBuilder.atomicSetStrategyNoneFromSuilendSui(vaultId, poolCoinType, lendingMarketId, { ...options, txBlock: txb });
|
|
523
477
|
return this.execCall(txb, options);
|
|
524
478
|
}
|
|
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
479
|
/**
|
|
540
480
|
* Withdraws collateral from the Suilend strategy on a SUI-collateral vault
|
|
541
481
|
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
@@ -550,34 +490,4 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
550
490
|
this.txBuilder.atomicWithdrawFromSuilendStrategySui(vaultId, poolCoinType, lendingMarketId, amount, { ...options, txBlock: txb });
|
|
551
491
|
return this.execCall(txb, options);
|
|
552
492
|
}
|
|
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
|
-
}
|
|
583
493
|
}
|
|
@@ -615,15 +615,6 @@ export declare class TxBuilder {
|
|
|
615
615
|
* @returns TransactionBlock
|
|
616
616
|
*/
|
|
617
617
|
atomicSetStrategyNoneFromSuilend(vaultId: string, poolCoinType: string, lendingMarketId: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
618
|
-
/**
|
|
619
|
-
* Switches an atomic vault from the AlphaLend strategy to STRATEGY_NONE,
|
|
620
|
-
* draining the full position collateral back into the vault balance.
|
|
621
|
-
* @param vaultId Id of the atomic vault
|
|
622
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
623
|
-
* @param options Optional tx building params
|
|
624
|
-
* @returns TransactionBlock
|
|
625
|
-
*/
|
|
626
|
-
atomicSetStrategyNoneFromAlphalend(vaultId: string, lendingProtocolId: string, acceptResidual: boolean, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
627
618
|
/**
|
|
628
619
|
* Step 1 of 2 for Suilend activation: commits the reserve index, the market
|
|
629
620
|
* object and the collateral type. Step 2 is `atomicOpenSuilendObligation`,
|
|
@@ -724,34 +715,6 @@ export declare class TxBuilder {
|
|
|
724
715
|
* @returns TransactionBlock
|
|
725
716
|
*/
|
|
726
717
|
atomicWithdrawSuilendSecondaryCollateralSui(vaultId: string, poolCoinType: string, lendingMarketId: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
727
|
-
/**
|
|
728
|
-
* Collects accrued AlphaLend rewards of coin type `rewardType` and forwards
|
|
729
|
-
* them to an allowlisted sub-account.
|
|
730
|
-
*
|
|
731
|
-
* Call once per reward type BEFORE exiting the strategy — the exit burns
|
|
732
|
-
* the `PositionCap` and strands anything uncollected. `rewardType` must not
|
|
733
|
-
* be SUI; AlphaLend settles SUI through the staking system and needs the
|
|
734
|
-
* monomorphic variant, which this SDK does not yet expose.
|
|
735
|
-
*
|
|
736
|
-
* PTB REQUIREMENT: refresh AlphaLend Pyth prices for the active market
|
|
737
|
-
* earlier in the same transaction.
|
|
738
|
-
* @param vaultId Id of the atomic vault
|
|
739
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
740
|
-
* @param rewardType Coin type of the reward being collected
|
|
741
|
-
* @param subAccount Allowlisted sub-account to receive the reward
|
|
742
|
-
* @param options Optional tx building params
|
|
743
|
-
* @returns TransactionBlock
|
|
744
|
-
*/
|
|
745
|
-
atomicCollectAlphalendStrategyReward(vaultId: string, lendingProtocolId: string, rewardType: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
746
|
-
/**
|
|
747
|
-
* Sets the AlphaLend strategy for an atomic vault
|
|
748
|
-
* @param vaultId Id of the atomic vault
|
|
749
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
750
|
-
* @param marketId AlphaLend market id
|
|
751
|
-
* @param options Optional tx building params
|
|
752
|
-
* @returns TransactionBlock
|
|
753
|
-
*/
|
|
754
|
-
atomicSetStrategyAlphalend(vaultId: string, lendingProtocolId: string, marketId: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
755
718
|
/**
|
|
756
719
|
* Sets / unsets a blacklisted account on an atomic vault
|
|
757
720
|
* @param vaultId Id of the atomic vault
|
|
@@ -822,15 +785,6 @@ export declare class TxBuilder {
|
|
|
822
785
|
* @returns TransactionBlock
|
|
823
786
|
*/
|
|
824
787
|
atomicSupplyToSuilendStrategy(vaultId: string, poolCoinType: string, lendingMarketId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
825
|
-
/**
|
|
826
|
-
* Supplies collateral from an atomic vault into the AlphaLend strategy
|
|
827
|
-
* @param vaultId Id of the atomic vault
|
|
828
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
829
|
-
* @param amount Amount to supply
|
|
830
|
-
* @param options Optional tx building params
|
|
831
|
-
* @returns TransactionBlock
|
|
832
|
-
*/
|
|
833
|
-
atomicSupplyToAlphalendStrategy(vaultId: string, lendingProtocolId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
834
788
|
/**
|
|
835
789
|
* Withdraws collateral from the Suilend strategy back into an atomic vault
|
|
836
790
|
* @param vaultId Id of the atomic vault
|
|
@@ -841,15 +795,6 @@ export declare class TxBuilder {
|
|
|
841
795
|
* @returns TransactionBlock
|
|
842
796
|
*/
|
|
843
797
|
atomicWithdrawFromSuilendStrategy(vaultId: string, poolCoinType: string, lendingMarketId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
844
|
-
/**
|
|
845
|
-
* Withdraws collateral from the AlphaLend strategy back into an atomic vault
|
|
846
|
-
* @param vaultId Id of the atomic vault
|
|
847
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
848
|
-
* @param amount Amount to withdraw
|
|
849
|
-
* @param options Optional tx building params
|
|
850
|
-
* @returns TransactionBlock
|
|
851
|
-
*/
|
|
852
|
-
atomicWithdrawFromAlphalendStrategy(vaultId: string, lendingProtocolId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
853
798
|
/**
|
|
854
799
|
* Releases users' holdback for an ember share source vault
|
|
855
800
|
* @param vaultId Id of the atomic vault
|
|
@@ -943,16 +888,6 @@ export declare class TxBuilder {
|
|
|
943
888
|
* @returns TransactionBlock
|
|
944
889
|
*/
|
|
945
890
|
atomicInstantWithdrawWithSuilend(vaultId: string, poolCoinType: string, lendingMarketId: string, shares: NumStr, receiver: string | null | undefined, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
946
|
-
/**
|
|
947
|
-
* Performs an instant withdraw from an atomic vault routed through AlphaLend
|
|
948
|
-
* @param vaultId Id of the atomic vault
|
|
949
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
950
|
-
* @param shares Number of shares to withdraw
|
|
951
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
952
|
-
* @param options Optional tx building params
|
|
953
|
-
* @returns TransactionBlock
|
|
954
|
-
*/
|
|
955
|
-
atomicInstantWithdrawWithAlphalend(vaultId: string, lendingProtocolId: string, shares: NumStr, receiver: string | null | undefined, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
956
891
|
/**
|
|
957
892
|
* Swaps ember shares (Coin<R>) into an atomic vault, minting atomic shares
|
|
958
893
|
* @param vaultId Id of the atomic vault
|
|
@@ -990,25 +925,6 @@ export declare class TxBuilder {
|
|
|
990
925
|
* @returns TransactionBlock
|
|
991
926
|
*/
|
|
992
927
|
atomicSwapEmberSharesWithSuilend(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, shareCoinId: string, receiver: string | null | undefined, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
993
|
-
/**
|
|
994
|
-
* Swaps ember shares (Coin<R>) into an atomic vault, routing collateral
|
|
995
|
-
* through the AlphaLend strategy
|
|
996
|
-
* @param vaultId Id of the atomic vault
|
|
997
|
-
* @param sourceReceiptType Receipt coin type of the source vault (R)
|
|
998
|
-
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
999
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
1000
|
-
* @param shareCoinId Object id of the Coin<R> to swap
|
|
1001
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
1002
|
-
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
1003
|
-
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
1004
|
-
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
1005
|
-
* utilization) and the source rate can change between quoting and
|
|
1006
|
-
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
1007
|
-
* the guard entirely.
|
|
1008
|
-
* @param options Optional tx building params
|
|
1009
|
-
* @returns TransactionBlock
|
|
1010
|
-
*/
|
|
1011
|
-
atomicSwapEmberSharesWithAlphalend(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, shareCoinId: string, receiver: string | null | undefined, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1012
928
|
/**
|
|
1013
929
|
* Swaps ember shares into a SUI-collateral atomic vault, sourcing payout
|
|
1014
930
|
* liquidity from Suilend.
|
|
@@ -1026,50 +942,14 @@ export declare class TxBuilder {
|
|
|
1026
942
|
* @returns TransactionBlock
|
|
1027
943
|
*/
|
|
1028
944
|
atomicSwapEmberSharesWithSuilendSui(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, shareCoinId: string, receiver: string, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1029
|
-
/**
|
|
1030
|
-
* Swaps ember shares into a SUI-collateral atomic vault, sourcing payout
|
|
1031
|
-
* liquidity from AlphaLend.
|
|
1032
|
-
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
1033
|
-
* @param sourceReceiptType Receipt coin type of the source vault (R)
|
|
1034
|
-
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
1035
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
1036
|
-
* @param shareCoinId Object id of the Coin<R> to swap
|
|
1037
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
1038
|
-
* @param minNetOut Minimum collateral to receive, in base units (A-9 guard)
|
|
1039
|
-
* @param options Optional tx building params
|
|
1040
|
-
* @returns TransactionBlock
|
|
1041
|
-
*/
|
|
1042
|
-
atomicSwapEmberSharesWithAlphalendSui(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, shareCoinId: string, receiver: string | null | undefined, minNetOut: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1043
945
|
/**
|
|
1044
946
|
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
1045
947
|
* from Suilend.
|
|
1046
948
|
* @param receiver Payout recipient. REQUIRED — bare address on chain.
|
|
1047
949
|
*/
|
|
1048
950
|
atomicInstantWithdrawWithSuilendSui(vaultId: string, poolCoinType: string, lendingMarketId: string, shares: NumStr, receiver: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1049
|
-
/**
|
|
1050
|
-
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
1051
|
-
* from AlphaLend.
|
|
1052
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
1053
|
-
*/
|
|
1054
|
-
atomicInstantWithdrawWithAlphalendSui(vaultId: string, lendingProtocolId: string, shares: NumStr, receiver: string | null | undefined, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1055
951
|
/** Exits the Suilend strategy on a SUI-collateral vault (operator). */
|
|
1056
952
|
atomicSetStrategyNoneFromSuilendSui(vaultId: string, poolCoinType: string, lendingMarketId: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1057
|
-
/**
|
|
1058
|
-
* Exits the AlphaLend strategy on a SUI-collateral vault (operator).
|
|
1059
|
-
* @param acceptResidual Abandon a dust residual rather than aborting the exit
|
|
1060
|
-
*/
|
|
1061
|
-
atomicSetStrategyNoneFromAlphalendSui(vaultId: string, lendingProtocolId: string, acceptResidual: boolean, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1062
953
|
/** Withdraws from the Suilend strategy on a SUI-collateral vault (operator). */
|
|
1063
954
|
atomicWithdrawFromSuilendStrategySui(vaultId: string, poolCoinType: string, lendingMarketId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1064
|
-
/** Withdraws from the AlphaLend strategy on a SUI-collateral vault (operator). */
|
|
1065
|
-
atomicWithdrawFromAlphalendStrategySui(vaultId: string, lendingProtocolId: string, amount: NumStr, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1066
|
-
/**
|
|
1067
|
-
* Collects AlphaLend rewards through the SUI system state and forwards them
|
|
1068
|
-
* to an allowlisted sub-account (operator).
|
|
1069
|
-
*
|
|
1070
|
-
* Unlike the other `_sui` entrypoints this one is still generic in `T` — it
|
|
1071
|
-
* is the reward path, not the collateral path, so the vault's own collateral
|
|
1072
|
-
* type is still a type argument.
|
|
1073
|
-
*/
|
|
1074
|
-
atomicCollectAlphalendStrategyRewardSui(vaultId: string, lendingProtocolId: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
1075
955
|
}
|
|
@@ -1210,8 +1210,8 @@ export class TxBuilder {
|
|
|
1210
1210
|
// being passed explicitly. Functions that also need `R` (the source ember
|
|
1211
1211
|
// vault receipt) or `P` (the Suilend pool coin type) take those type strings
|
|
1212
1212
|
// as explicit method params. External objects (Suilend `LendingMarket<P>`,
|
|
1213
|
-
//
|
|
1214
|
-
//
|
|
1213
|
+
// source `Vault<T, R>`, and `Receiving<Coin>` payment objects) are passed as
|
|
1214
|
+
// object id strings.
|
|
1215
1215
|
//
|
|
1216
1216
|
// JUDGMENT CALLS NEEDING SUI-NODE VALIDATION:
|
|
1217
1217
|
// - `Coin<T>` / `Coin<R>` arguments (atomicDeposit, atomicSwapEmberShares*,
|
|
@@ -1855,33 +1855,6 @@ export class TxBuilder {
|
|
|
1855
1855
|
txb.setSenderIfNotSet(options.sender);
|
|
1856
1856
|
return txb;
|
|
1857
1857
|
}
|
|
1858
|
-
/**
|
|
1859
|
-
* Switches an atomic vault from the AlphaLend strategy to STRATEGY_NONE,
|
|
1860
|
-
* draining the full position collateral back into the vault balance.
|
|
1861
|
-
* @param vaultId Id of the atomic vault
|
|
1862
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
1863
|
-
* @param options Optional tx building params
|
|
1864
|
-
* @returns TransactionBlock
|
|
1865
|
-
*/
|
|
1866
|
-
atomicSetStrategyNoneFromAlphalend(vaultId, lendingProtocolId, acceptResidual, options) {
|
|
1867
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
1868
|
-
txb.moveCall({
|
|
1869
|
-
arguments: [
|
|
1870
|
-
txb.object(vaultId),
|
|
1871
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
1872
|
-
txb.object(lendingProtocolId),
|
|
1873
|
-
txb.pure.bool(acceptResidual),
|
|
1874
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
1875
|
-
],
|
|
1876
|
-
typeArguments: [this.parser.getAtomicCollateralType(vaultId)],
|
|
1877
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_set_strategy_none_from_alphalend`
|
|
1878
|
-
});
|
|
1879
|
-
if (options?.gasBudget)
|
|
1880
|
-
txb.setGasBudget(options.gasBudget);
|
|
1881
|
-
if (options?.sender)
|
|
1882
|
-
txb.setSenderIfNotSet(options.sender);
|
|
1883
|
-
return txb;
|
|
1884
|
-
}
|
|
1885
1858
|
/**
|
|
1886
1859
|
* Step 1 of 2 for Suilend activation: commits the reserve index, the market
|
|
1887
1860
|
* object and the collateral type. Step 2 is `atomicOpenSuilendObligation`,
|
|
@@ -2081,69 +2054,6 @@ export class TxBuilder {
|
|
|
2081
2054
|
txb.setSenderIfNotSet(options.sender);
|
|
2082
2055
|
return txb;
|
|
2083
2056
|
}
|
|
2084
|
-
/**
|
|
2085
|
-
* Collects accrued AlphaLend rewards of coin type `rewardType` and forwards
|
|
2086
|
-
* them to an allowlisted sub-account.
|
|
2087
|
-
*
|
|
2088
|
-
* Call once per reward type BEFORE exiting the strategy — the exit burns
|
|
2089
|
-
* the `PositionCap` and strands anything uncollected. `rewardType` must not
|
|
2090
|
-
* be SUI; AlphaLend settles SUI through the staking system and needs the
|
|
2091
|
-
* monomorphic variant, which this SDK does not yet expose.
|
|
2092
|
-
*
|
|
2093
|
-
* PTB REQUIREMENT: refresh AlphaLend Pyth prices for the active market
|
|
2094
|
-
* earlier in the same transaction.
|
|
2095
|
-
* @param vaultId Id of the atomic vault
|
|
2096
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
2097
|
-
* @param rewardType Coin type of the reward being collected
|
|
2098
|
-
* @param subAccount Allowlisted sub-account to receive the reward
|
|
2099
|
-
* @param options Optional tx building params
|
|
2100
|
-
* @returns TransactionBlock
|
|
2101
|
-
*/
|
|
2102
|
-
atomicCollectAlphalendStrategyReward(vaultId, lendingProtocolId, rewardType, subAccount, options) {
|
|
2103
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2104
|
-
txb.moveCall({
|
|
2105
|
-
arguments: [
|
|
2106
|
-
txb.object(vaultId),
|
|
2107
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2108
|
-
txb.object(lendingProtocolId),
|
|
2109
|
-
txb.pure.address(subAccount),
|
|
2110
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
2111
|
-
],
|
|
2112
|
-
typeArguments: [this.parser.getAtomicCollateralType(vaultId), rewardType],
|
|
2113
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_collect_alphalend_strategy_reward`
|
|
2114
|
-
});
|
|
2115
|
-
if (options?.gasBudget)
|
|
2116
|
-
txb.setGasBudget(options.gasBudget);
|
|
2117
|
-
if (options?.sender)
|
|
2118
|
-
txb.setSenderIfNotSet(options.sender);
|
|
2119
|
-
return txb;
|
|
2120
|
-
}
|
|
2121
|
-
/**
|
|
2122
|
-
* Sets the AlphaLend strategy for an atomic vault
|
|
2123
|
-
* @param vaultId Id of the atomic vault
|
|
2124
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
2125
|
-
* @param marketId AlphaLend market id
|
|
2126
|
-
* @param options Optional tx building params
|
|
2127
|
-
* @returns TransactionBlock
|
|
2128
|
-
*/
|
|
2129
|
-
atomicSetStrategyAlphalend(vaultId, lendingProtocolId, marketId, options) {
|
|
2130
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2131
|
-
txb.moveCall({
|
|
2132
|
-
arguments: [
|
|
2133
|
-
txb.object(vaultId),
|
|
2134
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2135
|
-
txb.object(lendingProtocolId),
|
|
2136
|
-
txb.pure.u64(marketId)
|
|
2137
|
-
],
|
|
2138
|
-
typeArguments: [this.parser.getAtomicCollateralType(vaultId)],
|
|
2139
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_set_strategy_alphalend`
|
|
2140
|
-
});
|
|
2141
|
-
if (options?.gasBudget)
|
|
2142
|
-
txb.setGasBudget(options.gasBudget);
|
|
2143
|
-
if (options?.sender)
|
|
2144
|
-
txb.setSenderIfNotSet(options.sender);
|
|
2145
|
-
return txb;
|
|
2146
|
-
}
|
|
2147
2057
|
/**
|
|
2148
2058
|
* Sets / unsets a blacklisted account on an atomic vault
|
|
2149
2059
|
* @param vaultId Id of the atomic vault
|
|
@@ -2351,33 +2261,6 @@ export class TxBuilder {
|
|
|
2351
2261
|
txb.setSenderIfNotSet(options.sender);
|
|
2352
2262
|
return txb;
|
|
2353
2263
|
}
|
|
2354
|
-
/**
|
|
2355
|
-
* Supplies collateral from an atomic vault into the AlphaLend strategy
|
|
2356
|
-
* @param vaultId Id of the atomic vault
|
|
2357
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
2358
|
-
* @param amount Amount to supply
|
|
2359
|
-
* @param options Optional tx building params
|
|
2360
|
-
* @returns TransactionBlock
|
|
2361
|
-
*/
|
|
2362
|
-
atomicSupplyToAlphalendStrategy(vaultId, lendingProtocolId, amount, options) {
|
|
2363
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2364
|
-
txb.moveCall({
|
|
2365
|
-
arguments: [
|
|
2366
|
-
txb.object(vaultId),
|
|
2367
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2368
|
-
txb.object(lendingProtocolId),
|
|
2369
|
-
txb.pure.u64(amount),
|
|
2370
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
2371
|
-
],
|
|
2372
|
-
typeArguments: [this.parser.getAtomicCollateralType(vaultId)],
|
|
2373
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_supply_to_alphalend_strategy`
|
|
2374
|
-
});
|
|
2375
|
-
if (options?.gasBudget)
|
|
2376
|
-
txb.setGasBudget(options.gasBudget);
|
|
2377
|
-
if (options?.sender)
|
|
2378
|
-
txb.setSenderIfNotSet(options.sender);
|
|
2379
|
-
return txb;
|
|
2380
|
-
}
|
|
2381
2264
|
/**
|
|
2382
2265
|
* Withdraws collateral from the Suilend strategy back into an atomic vault
|
|
2383
2266
|
* @param vaultId Id of the atomic vault
|
|
@@ -2406,33 +2289,6 @@ export class TxBuilder {
|
|
|
2406
2289
|
txb.setSenderIfNotSet(options.sender);
|
|
2407
2290
|
return txb;
|
|
2408
2291
|
}
|
|
2409
|
-
/**
|
|
2410
|
-
* Withdraws collateral from the AlphaLend strategy back into an atomic vault
|
|
2411
|
-
* @param vaultId Id of the atomic vault
|
|
2412
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
2413
|
-
* @param amount Amount to withdraw
|
|
2414
|
-
* @param options Optional tx building params
|
|
2415
|
-
* @returns TransactionBlock
|
|
2416
|
-
*/
|
|
2417
|
-
atomicWithdrawFromAlphalendStrategy(vaultId, lendingProtocolId, amount, options) {
|
|
2418
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2419
|
-
txb.moveCall({
|
|
2420
|
-
arguments: [
|
|
2421
|
-
txb.object(vaultId),
|
|
2422
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2423
|
-
txb.object(lendingProtocolId),
|
|
2424
|
-
txb.pure.u64(amount),
|
|
2425
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
2426
|
-
],
|
|
2427
|
-
typeArguments: [this.parser.getAtomicCollateralType(vaultId)],
|
|
2428
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_withdraw_from_alphalend_strategy`
|
|
2429
|
-
});
|
|
2430
|
-
if (options?.gasBudget)
|
|
2431
|
-
txb.setGasBudget(options.gasBudget);
|
|
2432
|
-
if (options?.sender)
|
|
2433
|
-
txb.setSenderIfNotSet(options.sender);
|
|
2434
|
-
return txb;
|
|
2435
|
-
}
|
|
2436
2292
|
/**
|
|
2437
2293
|
* Releases users' holdback for an ember share source vault
|
|
2438
2294
|
* @param vaultId Id of the atomic vault
|
|
@@ -2713,35 +2569,6 @@ export class TxBuilder {
|
|
|
2713
2569
|
txb.setSenderIfNotSet(options.sender);
|
|
2714
2570
|
return txb;
|
|
2715
2571
|
}
|
|
2716
|
-
/**
|
|
2717
|
-
* Performs an instant withdraw from an atomic vault routed through AlphaLend
|
|
2718
|
-
* @param vaultId Id of the atomic vault
|
|
2719
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
2720
|
-
* @param shares Number of shares to withdraw
|
|
2721
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
2722
|
-
* @param options Optional tx building params
|
|
2723
|
-
* @returns TransactionBlock
|
|
2724
|
-
*/
|
|
2725
|
-
atomicInstantWithdrawWithAlphalend(vaultId, lendingProtocolId, shares, receiver, options) {
|
|
2726
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2727
|
-
txb.moveCall({
|
|
2728
|
-
arguments: [
|
|
2729
|
-
txb.object(vaultId),
|
|
2730
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2731
|
-
txb.object(lendingProtocolId),
|
|
2732
|
-
txb.pure.u64(shares),
|
|
2733
|
-
txb.pure.option("address", receiver ?? null),
|
|
2734
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
2735
|
-
],
|
|
2736
|
-
typeArguments: [this.parser.getAtomicCollateralType(vaultId)],
|
|
2737
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_instant_withdraw_with_alphalend`
|
|
2738
|
-
});
|
|
2739
|
-
if (options?.gasBudget)
|
|
2740
|
-
txb.setGasBudget(options.gasBudget);
|
|
2741
|
-
if (options?.sender)
|
|
2742
|
-
txb.setSenderIfNotSet(options.sender);
|
|
2743
|
-
return txb;
|
|
2744
|
-
}
|
|
2745
2572
|
/**
|
|
2746
2573
|
* Swaps ember shares (Coin<R>) into an atomic vault, minting atomic shares
|
|
2747
2574
|
* @param vaultId Id of the atomic vault
|
|
@@ -2827,49 +2654,6 @@ export class TxBuilder {
|
|
|
2827
2654
|
txb.setSenderIfNotSet(options.sender);
|
|
2828
2655
|
return txb;
|
|
2829
2656
|
}
|
|
2830
|
-
/**
|
|
2831
|
-
* Swaps ember shares (Coin<R>) into an atomic vault, routing collateral
|
|
2832
|
-
* through the AlphaLend strategy
|
|
2833
|
-
* @param vaultId Id of the atomic vault
|
|
2834
|
-
* @param sourceReceiptType Receipt coin type of the source vault (R)
|
|
2835
|
-
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
2836
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
2837
|
-
* @param shareCoinId Object id of the Coin<R> to swap
|
|
2838
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
2839
|
-
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
2840
|
-
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
2841
|
-
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
2842
|
-
* utilization) and the source rate can change between quoting and
|
|
2843
|
-
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
2844
|
-
* the guard entirely.
|
|
2845
|
-
* @param options Optional tx building params
|
|
2846
|
-
* @returns TransactionBlock
|
|
2847
|
-
*/
|
|
2848
|
-
atomicSwapEmberSharesWithAlphalend(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, shareCoinId, receiver, minNetOut, options) {
|
|
2849
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2850
|
-
txb.moveCall({
|
|
2851
|
-
arguments: [
|
|
2852
|
-
txb.object(vaultId),
|
|
2853
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2854
|
-
txb.object(sourceVaultId),
|
|
2855
|
-
txb.object(lendingProtocolId),
|
|
2856
|
-
txb.object(shareCoinId),
|
|
2857
|
-
txb.pure.option("address", receiver ?? null),
|
|
2858
|
-
txb.pure.u64(minNetOut),
|
|
2859
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
2860
|
-
],
|
|
2861
|
-
typeArguments: [
|
|
2862
|
-
this.parser.getAtomicCollateralType(vaultId),
|
|
2863
|
-
sourceReceiptType
|
|
2864
|
-
],
|
|
2865
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_swap_ember_shares_with_alphalend`
|
|
2866
|
-
});
|
|
2867
|
-
if (options?.gasBudget)
|
|
2868
|
-
txb.setGasBudget(options.gasBudget);
|
|
2869
|
-
if (options?.sender)
|
|
2870
|
-
txb.setSenderIfNotSet(options.sender);
|
|
2871
|
-
return txb;
|
|
2872
|
-
}
|
|
2873
2657
|
// === Vault<SUI> variants ===
|
|
2874
2658
|
//
|
|
2875
2659
|
// A SUI-collateral atomic vault cannot use the generic builders above. The
|
|
@@ -2878,10 +2662,10 @@ export class TxBuilder {
|
|
|
2878
2662
|
// `&mut SuiSystemState` as an extra argument. `T` therefore drops out of
|
|
2879
2663
|
// typeArguments — passing it is the easy mistake here.
|
|
2880
2664
|
//
|
|
2881
|
-
// Note the receiver
|
|
2882
|
-
//
|
|
2883
|
-
//
|
|
2884
|
-
//
|
|
2665
|
+
// Note the receiver shape, which is in the contract rather than here: the
|
|
2666
|
+
// SUI variants take a bare `address`, not `Option<address>`. The builders
|
|
2667
|
+
// below therefore require an explicit receiver — there is no on-chain
|
|
2668
|
+
// "default to sender" for them.
|
|
2885
2669
|
/**
|
|
2886
2670
|
* Swaps ember shares into a SUI-collateral atomic vault, sourcing payout
|
|
2887
2671
|
* liquidity from Suilend.
|
|
@@ -2921,42 +2705,6 @@ export class TxBuilder {
|
|
|
2921
2705
|
txb.setSenderIfNotSet(options.sender);
|
|
2922
2706
|
return txb;
|
|
2923
2707
|
}
|
|
2924
|
-
/**
|
|
2925
|
-
* Swaps ember shares into a SUI-collateral atomic vault, sourcing payout
|
|
2926
|
-
* liquidity from AlphaLend.
|
|
2927
|
-
* @param vaultId Id of the atomic vault (collateral must be SUI)
|
|
2928
|
-
* @param sourceReceiptType Receipt coin type of the source vault (R)
|
|
2929
|
-
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
2930
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
2931
|
-
* @param shareCoinId Object id of the Coin<R> to swap
|
|
2932
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
2933
|
-
* @param minNetOut Minimum collateral to receive, in base units (A-9 guard)
|
|
2934
|
-
* @param options Optional tx building params
|
|
2935
|
-
* @returns TransactionBlock
|
|
2936
|
-
*/
|
|
2937
|
-
atomicSwapEmberSharesWithAlphalendSui(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, shareCoinId, receiver, minNetOut, options) {
|
|
2938
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2939
|
-
txb.moveCall({
|
|
2940
|
-
arguments: [
|
|
2941
|
-
txb.object(vaultId),
|
|
2942
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2943
|
-
txb.object(sourceVaultId),
|
|
2944
|
-
txb.object(lendingProtocolId),
|
|
2945
|
-
txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
2946
|
-
txb.object(shareCoinId),
|
|
2947
|
-
txb.pure.option("address", receiver ?? null),
|
|
2948
|
-
txb.pure.u64(minNetOut),
|
|
2949
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
2950
|
-
],
|
|
2951
|
-
typeArguments: [sourceReceiptType],
|
|
2952
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_swap_ember_shares_with_alphalend_sui`
|
|
2953
|
-
});
|
|
2954
|
-
if (options?.gasBudget)
|
|
2955
|
-
txb.setGasBudget(options.gasBudget);
|
|
2956
|
-
if (options?.sender)
|
|
2957
|
-
txb.setSenderIfNotSet(options.sender);
|
|
2958
|
-
return txb;
|
|
2959
|
-
}
|
|
2960
2708
|
/**
|
|
2961
2709
|
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
2962
2710
|
* from Suilend.
|
|
@@ -2983,32 +2731,6 @@ export class TxBuilder {
|
|
|
2983
2731
|
txb.setSenderIfNotSet(options.sender);
|
|
2984
2732
|
return txb;
|
|
2985
2733
|
}
|
|
2986
|
-
/**
|
|
2987
|
-
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
2988
|
-
* from AlphaLend.
|
|
2989
|
-
* @param receiver Optional receiver address (defaults on-chain to the sender)
|
|
2990
|
-
*/
|
|
2991
|
-
atomicInstantWithdrawWithAlphalendSui(vaultId, lendingProtocolId, shares, receiver, options) {
|
|
2992
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
2993
|
-
txb.moveCall({
|
|
2994
|
-
arguments: [
|
|
2995
|
-
txb.object(vaultId),
|
|
2996
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
2997
|
-
txb.object(lendingProtocolId),
|
|
2998
|
-
txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
2999
|
-
txb.pure.u64(shares),
|
|
3000
|
-
txb.pure.option("address", receiver ?? null),
|
|
3001
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
3002
|
-
],
|
|
3003
|
-
typeArguments: [],
|
|
3004
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_instant_withdraw_with_alphalend_sui`
|
|
3005
|
-
});
|
|
3006
|
-
if (options?.gasBudget)
|
|
3007
|
-
txb.setGasBudget(options.gasBudget);
|
|
3008
|
-
if (options?.sender)
|
|
3009
|
-
txb.setSenderIfNotSet(options.sender);
|
|
3010
|
-
return txb;
|
|
3011
|
-
}
|
|
3012
2734
|
/** Exits the Suilend strategy on a SUI-collateral vault (operator). */
|
|
3013
2735
|
atomicSetStrategyNoneFromSuilendSui(vaultId, poolCoinType, lendingMarketId, options) {
|
|
3014
2736
|
const txb = options?.txBlock || new TransactionBlock();
|
|
@@ -3029,30 +2751,6 @@ export class TxBuilder {
|
|
|
3029
2751
|
txb.setSenderIfNotSet(options.sender);
|
|
3030
2752
|
return txb;
|
|
3031
2753
|
}
|
|
3032
|
-
/**
|
|
3033
|
-
* Exits the AlphaLend strategy on a SUI-collateral vault (operator).
|
|
3034
|
-
* @param acceptResidual Abandon a dust residual rather than aborting the exit
|
|
3035
|
-
*/
|
|
3036
|
-
atomicSetStrategyNoneFromAlphalendSui(vaultId, lendingProtocolId, acceptResidual, options) {
|
|
3037
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
3038
|
-
txb.moveCall({
|
|
3039
|
-
arguments: [
|
|
3040
|
-
txb.object(vaultId),
|
|
3041
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
3042
|
-
txb.object(lendingProtocolId),
|
|
3043
|
-
txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
3044
|
-
txb.pure.bool(acceptResidual),
|
|
3045
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
3046
|
-
],
|
|
3047
|
-
typeArguments: [],
|
|
3048
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_set_strategy_none_from_alphalend_sui`
|
|
3049
|
-
});
|
|
3050
|
-
if (options?.gasBudget)
|
|
3051
|
-
txb.setGasBudget(options.gasBudget);
|
|
3052
|
-
if (options?.sender)
|
|
3053
|
-
txb.setSenderIfNotSet(options.sender);
|
|
3054
|
-
return txb;
|
|
3055
|
-
}
|
|
3056
2754
|
/** Withdraws from the Suilend strategy on a SUI-collateral vault (operator). */
|
|
3057
2755
|
atomicWithdrawFromSuilendStrategySui(vaultId, poolCoinType, lendingMarketId, amount, options) {
|
|
3058
2756
|
const txb = options?.txBlock || new TransactionBlock();
|
|
@@ -3074,53 +2772,4 @@ export class TxBuilder {
|
|
|
3074
2772
|
txb.setSenderIfNotSet(options.sender);
|
|
3075
2773
|
return txb;
|
|
3076
2774
|
}
|
|
3077
|
-
/** Withdraws from the AlphaLend strategy on a SUI-collateral vault (operator). */
|
|
3078
|
-
atomicWithdrawFromAlphalendStrategySui(vaultId, lendingProtocolId, amount, options) {
|
|
3079
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
3080
|
-
txb.moveCall({
|
|
3081
|
-
arguments: [
|
|
3082
|
-
txb.object(vaultId),
|
|
3083
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
3084
|
-
txb.object(lendingProtocolId),
|
|
3085
|
-
txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
3086
|
-
txb.pure.u64(amount),
|
|
3087
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
3088
|
-
],
|
|
3089
|
-
typeArguments: [],
|
|
3090
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_withdraw_from_alphalend_strategy_sui`
|
|
3091
|
-
});
|
|
3092
|
-
if (options?.gasBudget)
|
|
3093
|
-
txb.setGasBudget(options.gasBudget);
|
|
3094
|
-
if (options?.sender)
|
|
3095
|
-
txb.setSenderIfNotSet(options.sender);
|
|
3096
|
-
return txb;
|
|
3097
|
-
}
|
|
3098
|
-
/**
|
|
3099
|
-
* Collects AlphaLend rewards through the SUI system state and forwards them
|
|
3100
|
-
* to an allowlisted sub-account (operator).
|
|
3101
|
-
*
|
|
3102
|
-
* Unlike the other `_sui` entrypoints this one is still generic in `T` — it
|
|
3103
|
-
* is the reward path, not the collateral path, so the vault's own collateral
|
|
3104
|
-
* type is still a type argument.
|
|
3105
|
-
*/
|
|
3106
|
-
atomicCollectAlphalendStrategyRewardSui(vaultId, lendingProtocolId, subAccount, options) {
|
|
3107
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
3108
|
-
txb.moveCall({
|
|
3109
|
-
arguments: [
|
|
3110
|
-
txb.object(vaultId),
|
|
3111
|
-
txb.object(this.parser.getProtocolConfig()),
|
|
3112
|
-
txb.object(lendingProtocolId),
|
|
3113
|
-
txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
|
|
3114
|
-
txb.pure.address(subAccount),
|
|
3115
|
-
txb.object(SUI_CLOCK_OBJECT_ID)
|
|
3116
|
-
],
|
|
3117
|
-
typeArguments: [this.parser.getAtomicCollateralType(vaultId)],
|
|
3118
|
-
target: `${this.parser.getPackageId()}::gateway::atomic_collect_alphalend_strategy_reward_sui`
|
|
3119
|
-
});
|
|
3120
|
-
if (options?.gasBudget)
|
|
3121
|
-
txb.setGasBudget(options.gasBudget);
|
|
3122
|
-
if (options?.sender)
|
|
3123
|
-
txb.setSenderIfNotSet(options.sender);
|
|
3124
|
-
return txb;
|
|
3125
|
-
}
|
|
3126
2775
|
}
|
|
@@ -108,17 +108,6 @@ export declare class UserCalls extends OnChainCalls {
|
|
|
108
108
|
atomicInstantWithdrawWithSuilend(vaultId: string, poolCoinType: string, lendingMarketId: string, shares: NumStr, options?: IVaultOptionalParams & {
|
|
109
109
|
receiver?: SuiAddress;
|
|
110
110
|
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
111
|
-
/**
|
|
112
|
-
* Instantly withdraw collateral from an atomic vault routed through AlphaLend
|
|
113
|
-
* @param vaultId The id of the atomic vault
|
|
114
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
115
|
-
* @param shares The number of shares to withdraw
|
|
116
|
-
* @param options Optional tx execution params
|
|
117
|
-
* @returns OnChainCallResponse
|
|
118
|
-
*/
|
|
119
|
-
atomicInstantWithdrawWithAlphalend(vaultId: string, lendingProtocolId: string, shares: NumStr, options?: IVaultOptionalParams & {
|
|
120
|
-
receiver?: SuiAddress;
|
|
121
|
-
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
122
111
|
/**
|
|
123
112
|
* Swap ember shares (source vault receipt coin) into an atomic vault
|
|
124
113
|
* @param vaultId The id of the atomic vault
|
|
@@ -159,26 +148,6 @@ export declare class UserCalls extends OnChainCalls {
|
|
|
159
148
|
coinId?: string;
|
|
160
149
|
receiver?: SuiAddress;
|
|
161
150
|
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
162
|
-
/**
|
|
163
|
-
* Swap ember shares into an atomic vault, routing collateral through AlphaLend
|
|
164
|
-
* @param vaultId The id of the atomic vault
|
|
165
|
-
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
166
|
-
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
167
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
168
|
-
* @param amount The amount of source shares to swap
|
|
169
|
-
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
170
|
-
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
171
|
-
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
172
|
-
* utilization) and the source rate can change between quoting and
|
|
173
|
-
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
174
|
-
* the guard entirely.
|
|
175
|
-
* @param options Optional tx execution params
|
|
176
|
-
* @returns OnChainCallResponse
|
|
177
|
-
*/
|
|
178
|
-
atomicSwapEmberSharesWithAlphalend(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, amount: NumStr, minNetOut: NumStr, options?: IVaultOptionalParams & {
|
|
179
|
-
coinId?: string;
|
|
180
|
-
receiver?: SuiAddress;
|
|
181
|
-
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
182
151
|
/**
|
|
183
152
|
* Swap ember shares into a SUI-collateral atomic vault via Suilend
|
|
184
153
|
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
@@ -200,21 +169,6 @@ export declare class UserCalls extends OnChainCalls {
|
|
|
200
169
|
coinId?: string;
|
|
201
170
|
receiver?: SuiAddress;
|
|
202
171
|
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
203
|
-
/**
|
|
204
|
-
* Swap ember shares into a SUI-collateral atomic vault via AlphaLend
|
|
205
|
-
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
206
|
-
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
207
|
-
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
208
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
209
|
-
* @param amount The amount of source shares to swap
|
|
210
|
-
* @param minNetOut Minimum collateral to receive, in base units (A-9 guard)
|
|
211
|
-
* @param options Optional tx execution params
|
|
212
|
-
* @returns OnChainCallResponse
|
|
213
|
-
*/
|
|
214
|
-
atomicSwapEmberSharesWithAlphalendSui(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, amount: NumStr, minNetOut: NumStr, options?: IVaultOptionalParams & {
|
|
215
|
-
coinId?: string;
|
|
216
|
-
receiver?: SuiAddress;
|
|
217
|
-
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
218
172
|
/**
|
|
219
173
|
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
220
174
|
* from Suilend
|
|
@@ -228,16 +182,4 @@ export declare class UserCalls extends OnChainCalls {
|
|
|
228
182
|
atomicInstantWithdrawWithSuilendSui(vaultId: string, poolCoinType: string, lendingMarketId: string, shares: NumStr, options?: IVaultOptionalParams & {
|
|
229
183
|
receiver?: SuiAddress;
|
|
230
184
|
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
231
|
-
/**
|
|
232
|
-
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
233
|
-
* from AlphaLend
|
|
234
|
-
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
235
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
236
|
-
* @param shares The number of atomic shares to burn
|
|
237
|
-
* @param options Optional tx execution params
|
|
238
|
-
* @returns OnChainCallResponse
|
|
239
|
-
*/
|
|
240
|
-
atomicInstantWithdrawWithAlphalendSui(vaultId: string, lendingProtocolId: string, shares: NumStr, options?: IVaultOptionalParams & {
|
|
241
|
-
receiver?: SuiAddress;
|
|
242
|
-
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
243
185
|
}
|
|
@@ -214,19 +214,6 @@ export class UserCalls extends OnChainCalls {
|
|
|
214
214
|
this.txBuilder.atomicInstantWithdrawWithSuilend(vaultId, poolCoinType, lendingMarketId, shares, options?.receiver ?? null, { ...options, txBlock: txb });
|
|
215
215
|
return this.execCall(txb, options);
|
|
216
216
|
}
|
|
217
|
-
/**
|
|
218
|
-
* Instantly withdraw collateral from an atomic vault routed through AlphaLend
|
|
219
|
-
* @param vaultId The id of the atomic vault
|
|
220
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
221
|
-
* @param shares The number of shares to withdraw
|
|
222
|
-
* @param options Optional tx execution params
|
|
223
|
-
* @returns OnChainCallResponse
|
|
224
|
-
*/
|
|
225
|
-
async atomicInstantWithdrawWithAlphalend(vaultId, lendingProtocolId, shares, options) {
|
|
226
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
227
|
-
this.txBuilder.atomicInstantWithdrawWithAlphalend(vaultId, lendingProtocolId, shares, options?.receiver ?? null, { ...options, txBlock: txb });
|
|
228
|
-
return this.execCall(txb, options);
|
|
229
|
-
}
|
|
230
217
|
/**
|
|
231
218
|
* Swap ember shares (source vault receipt coin) into an atomic vault
|
|
232
219
|
* @param vaultId The id of the atomic vault
|
|
@@ -297,51 +284,15 @@ export class UserCalls extends OnChainCalls {
|
|
|
297
284
|
}
|
|
298
285
|
return this.execCall(txb, options);
|
|
299
286
|
}
|
|
300
|
-
/**
|
|
301
|
-
* Swap ember shares into an atomic vault, routing collateral through AlphaLend
|
|
302
|
-
* @param vaultId The id of the atomic vault
|
|
303
|
-
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
304
|
-
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
305
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
306
|
-
* @param amount The amount of source shares to swap
|
|
307
|
-
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
308
|
-
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
309
|
-
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
310
|
-
* utilization) and the source rate can change between quoting and
|
|
311
|
-
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
312
|
-
* the guard entirely.
|
|
313
|
-
* @param options Optional tx execution params
|
|
314
|
-
* @returns OnChainCallResponse
|
|
315
|
-
*/
|
|
316
|
-
async atomicSwapEmberSharesWithAlphalend(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, amount, minNetOut, options) {
|
|
317
|
-
let coinId = options?.coinId;
|
|
318
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
319
|
-
let split;
|
|
320
|
-
let merged;
|
|
321
|
-
if (!coinId) {
|
|
322
|
-
[split, merged] = await CoinUtils.createCoinWithBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), sourceReceiptType, this.walletAddress);
|
|
323
|
-
coinId = split;
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
[split, merged] = await CoinUtils.validateCoinBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), coinId);
|
|
327
|
-
coinId = split;
|
|
328
|
-
}
|
|
329
|
-
this.txBuilder.atomicSwapEmberSharesWithAlphalend(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, coinId, options?.receiver ?? null, minNetOut, { ...options, txBlock: txb });
|
|
330
|
-
if (merged) {
|
|
331
|
-
txb.transferObjects([merged], this.walletAddress);
|
|
332
|
-
}
|
|
333
|
-
return this.execCall(txb, options);
|
|
334
|
-
}
|
|
335
287
|
// === Vault<SUI> variants ===
|
|
336
288
|
//
|
|
337
289
|
// For a SUI-collateral atomic vault the lending protocols must unwrap and
|
|
338
290
|
// rewrap SUI through the system state, so these are separate monomorphic
|
|
339
291
|
// entry functions rather than the generic ones above.
|
|
340
292
|
//
|
|
341
|
-
//
|
|
342
|
-
//
|
|
343
|
-
//
|
|
344
|
-
// variants do take an Option and keep the usual on-chain default.
|
|
293
|
+
// These take a bare `address` receiver on chain, not an Option, so there is
|
|
294
|
+
// no "default to sender" behaviour to inherit — the wrappers fall back to
|
|
295
|
+
// the SDK's wallet address explicitly.
|
|
345
296
|
/**
|
|
346
297
|
* Swap ember shares into a SUI-collateral atomic vault via Suilend
|
|
347
298
|
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
@@ -378,36 +329,6 @@ export class UserCalls extends OnChainCalls {
|
|
|
378
329
|
}
|
|
379
330
|
return this.execCall(txb, options);
|
|
380
331
|
}
|
|
381
|
-
/**
|
|
382
|
-
* Swap ember shares into a SUI-collateral atomic vault via AlphaLend
|
|
383
|
-
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
384
|
-
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
385
|
-
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
386
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
387
|
-
* @param amount The amount of source shares to swap
|
|
388
|
-
* @param minNetOut Minimum collateral to receive, in base units (A-9 guard)
|
|
389
|
-
* @param options Optional tx execution params
|
|
390
|
-
* @returns OnChainCallResponse
|
|
391
|
-
*/
|
|
392
|
-
async atomicSwapEmberSharesWithAlphalendSui(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, amount, minNetOut, options) {
|
|
393
|
-
let coinId = options?.coinId;
|
|
394
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
395
|
-
let split;
|
|
396
|
-
let merged;
|
|
397
|
-
if (!coinId) {
|
|
398
|
-
[split, merged] = await CoinUtils.createCoinWithBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), sourceReceiptType, this.walletAddress);
|
|
399
|
-
coinId = split;
|
|
400
|
-
}
|
|
401
|
-
else {
|
|
402
|
-
[split, merged] = await CoinUtils.validateCoinBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), coinId);
|
|
403
|
-
coinId = split;
|
|
404
|
-
}
|
|
405
|
-
this.txBuilder.atomicSwapEmberSharesWithAlphalendSui(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, coinId, options?.receiver ?? null, minNetOut, { ...options, txBlock: txb });
|
|
406
|
-
if (merged) {
|
|
407
|
-
txb.transferObjects([merged], this.walletAddress);
|
|
408
|
-
}
|
|
409
|
-
return this.execCall(txb, options);
|
|
410
|
-
}
|
|
411
332
|
/**
|
|
412
333
|
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
413
334
|
* from Suilend
|
|
@@ -423,18 +344,4 @@ export class UserCalls extends OnChainCalls {
|
|
|
423
344
|
this.txBuilder.atomicInstantWithdrawWithSuilendSui(vaultId, poolCoinType, lendingMarketId, shares, options?.receiver ?? this.walletAddress, { ...options, txBlock: txb });
|
|
424
345
|
return this.execCall(txb, options);
|
|
425
346
|
}
|
|
426
|
-
/**
|
|
427
|
-
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
428
|
-
* from AlphaLend
|
|
429
|
-
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
430
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
431
|
-
* @param shares The number of atomic shares to burn
|
|
432
|
-
* @param options Optional tx execution params
|
|
433
|
-
* @returns OnChainCallResponse
|
|
434
|
-
*/
|
|
435
|
-
async atomicInstantWithdrawWithAlphalendSui(vaultId, lendingProtocolId, shares, options) {
|
|
436
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
437
|
-
this.txBuilder.atomicInstantWithdrawWithAlphalendSui(vaultId, lendingProtocolId, shares, options?.receiver ?? null, { ...options, txBlock: txb });
|
|
438
|
-
return this.execCall(txb, options);
|
|
439
|
-
}
|
|
440
347
|
}
|
|
@@ -326,15 +326,6 @@ export declare class VaultAdminCalls extends OnChainCalls {
|
|
|
326
326
|
* @returns OnChainCallResponse
|
|
327
327
|
*/
|
|
328
328
|
atomicSetStrategySuilend(vaultId: string, poolCoinType: string, lendingMarketId: string, reserveArrayIndex: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
329
|
-
/**
|
|
330
|
-
* Set the AlphaLend strategy for an atomic vault
|
|
331
|
-
* @param vaultId The id of the atomic vault
|
|
332
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
333
|
-
* @param marketId The AlphaLend market id
|
|
334
|
-
* @param options Optional tx execution params
|
|
335
|
-
* @returns OnChainCallResponse
|
|
336
|
-
*/
|
|
337
|
-
atomicSetStrategyAlphalend(vaultId: string, lendingProtocolId: string, marketId: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
338
329
|
/**
|
|
339
330
|
* Switch an atomic vault from the Suilend strategy to STRATEGY_NONE,
|
|
340
331
|
* draining cTokens back into the vault balance
|
|
@@ -345,16 +336,4 @@ export declare class VaultAdminCalls extends OnChainCalls {
|
|
|
345
336
|
* @returns OnChainCallResponse
|
|
346
337
|
*/
|
|
347
338
|
atomicSetStrategyNoneFromSuilend(vaultId: string, poolCoinType: string, lendingMarketId: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
348
|
-
/**
|
|
349
|
-
* Switch an atomic vault from the AlphaLend strategy to STRATEGY_NONE,
|
|
350
|
-
* draining the full position collateral back into the vault balance
|
|
351
|
-
* @param vaultId The id of the atomic vault
|
|
352
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
353
|
-
* @param acceptResidual Abandon a dust residual rather than aborting the exit.
|
|
354
|
-
* Only pass true deliberately: the residual is forfeited, and the exit burns the
|
|
355
|
-
* PositionCap that could otherwise reach it.
|
|
356
|
-
* @param options Optional tx execution params
|
|
357
|
-
* @returns OnChainCallResponse
|
|
358
|
-
*/
|
|
359
|
-
atomicSetStrategyNoneFromAlphalend(vaultId: string, lendingProtocolId: string, acceptResidual: boolean, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
360
339
|
}
|
|
@@ -549,22 +549,6 @@ export class VaultAdminCalls extends OnChainCalls {
|
|
|
549
549
|
this.txBuilder.atomicSetStrategySuilend(vaultId, poolCoinType, lendingMarketId, reserveArrayIndex, { ...options, txBlock: txb });
|
|
550
550
|
return this.execCall(txb, options);
|
|
551
551
|
}
|
|
552
|
-
/**
|
|
553
|
-
* Set the AlphaLend strategy for an atomic vault
|
|
554
|
-
* @param vaultId The id of the atomic vault
|
|
555
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
556
|
-
* @param marketId The AlphaLend market id
|
|
557
|
-
* @param options Optional tx execution params
|
|
558
|
-
* @returns OnChainCallResponse
|
|
559
|
-
*/
|
|
560
|
-
async atomicSetStrategyAlphalend(vaultId, lendingProtocolId, marketId, options) {
|
|
561
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
562
|
-
this.txBuilder.atomicSetStrategyAlphalend(vaultId, lendingProtocolId, marketId, {
|
|
563
|
-
...options,
|
|
564
|
-
txBlock: txb
|
|
565
|
-
});
|
|
566
|
-
return this.execCall(txb, options);
|
|
567
|
-
}
|
|
568
552
|
/**
|
|
569
553
|
* Switch an atomic vault from the Suilend strategy to STRATEGY_NONE,
|
|
570
554
|
* draining cTokens back into the vault balance
|
|
@@ -579,20 +563,4 @@ export class VaultAdminCalls extends OnChainCalls {
|
|
|
579
563
|
this.txBuilder.atomicSetStrategyNoneFromSuilend(vaultId, poolCoinType, lendingMarketId, { ...options, txBlock: txb });
|
|
580
564
|
return this.execCall(txb, options);
|
|
581
565
|
}
|
|
582
|
-
/**
|
|
583
|
-
* Switch an atomic vault from the AlphaLend strategy to STRATEGY_NONE,
|
|
584
|
-
* draining the full position collateral back into the vault balance
|
|
585
|
-
* @param vaultId The id of the atomic vault
|
|
586
|
-
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
587
|
-
* @param acceptResidual Abandon a dust residual rather than aborting the exit.
|
|
588
|
-
* Only pass true deliberately: the residual is forfeited, and the exit burns the
|
|
589
|
-
* PositionCap that could otherwise reach it.
|
|
590
|
-
* @param options Optional tx execution params
|
|
591
|
-
* @returns OnChainCallResponse
|
|
592
|
-
*/
|
|
593
|
-
async atomicSetStrategyNoneFromAlphalend(vaultId, lendingProtocolId, acceptResidual, options) {
|
|
594
|
-
const txb = options?.txBlock || new TransactionBlock();
|
|
595
|
-
this.txBuilder.atomicSetStrategyNoneFromAlphalend(vaultId, lendingProtocolId, acceptResidual, { ...options, txBlock: txb });
|
|
596
|
-
return this.execCall(txb, options);
|
|
597
|
-
}
|
|
598
566
|
}
|