@ember-finance/sdk 2.21.0-ccip.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/abis/index.d.ts +1 -3
- package/dist/src/abis/index.js +1 -4
- package/dist/src/api/v2/models/account-transaction-transaction-data.d.ts +1 -2
- package/dist/src/api/v2/models/account-transaction.d.ts +0 -2
- package/dist/src/api/v2/models/account-transaction.js +1 -3
- package/dist/src/api/v2/models/chain.d.ts +0 -6
- package/dist/src/api/v2/models/evm-contracts.d.ts +0 -9
- package/dist/src/api/v2/models/evm-oftadapter.d.ts +0 -11
- package/dist/src/api/v2/models/evm-oftadapter.js +1 -4
- package/dist/src/api/v2/models/evm-oftpeer.d.ts +0 -12
- package/dist/src/api/v2/models/index.d.ts +0 -4
- package/dist/src/api/v2/models/index.js +0 -4
- package/dist/src/evm-vaults/interfaces/index.d.ts +0 -39
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +1 -15
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +0 -36
- package/dist/src/evm-vaults/on-chain-calls/user.d.ts +1 -40
- package/dist/src/evm-vaults/on-chain-calls/user.js +0 -75
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +1 -14
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +0 -30
- package/dist/src/evm-vaults/utils/deployment-parser.d.ts +1 -46
- package/dist/src/evm-vaults/utils/deployment-parser.js +0 -74
- package/dist/src/evm-vaults/utils/index.d.ts +0 -1
- package/dist/src/evm-vaults/utils/index.js +0 -1
- 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
- package/dist/src/abis/CcipRouter.json +0 -58
- package/dist/src/api/v2/models/bridge-transaction.d.ts +0 -50
- package/dist/src/api/v2/models/bridge-transaction.js +0 -14
- package/dist/src/api/v2/models/evm-ccip-lane.d.ts +0 -73
- package/dist/src/api/v2/models/evm-ccip-lane.js +0 -14
- package/dist/src/api/v2/models/evm-ccip-rate-limits.d.ts +0 -36
- package/dist/src/api/v2/models/evm-ccip-rate-limits.js +0 -14
- package/dist/src/api/v2/models/evm-ccip-token-pool.d.ts +0 -122
- package/dist/src/api/v2/models/evm-ccip-token-pool.js +0 -17
- package/dist/src/evm-vaults/utils/ccip.d.ts +0 -23
- package/dist/src/evm-vaults/utils/ccip.js +0 -32
|
@@ -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
|
}
|