@ember-finance/sdk 2.13.0 → 2.15.0-ccip.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/CcipRouter.json +58 -0
- package/dist/src/abis/index.d.ts +3 -1
- package/dist/src/abis/index.js +4 -1
- package/dist/src/api/v2/models/account-transaction-transaction-data.d.ts +2 -1
- package/dist/src/api/v2/models/account-transaction.d.ts +2 -0
- package/dist/src/api/v2/models/account-transaction.js +3 -1
- package/dist/src/api/v2/models/bridge-transaction.d.ts +50 -0
- package/dist/src/api/v2/models/bridge-transaction.js +14 -0
- package/dist/src/api/v2/models/chain.d.ts +6 -0
- package/dist/src/api/v2/models/evm-ccip-lane.d.ts +73 -0
- package/dist/src/api/v2/models/evm-ccip-lane.js +14 -0
- package/dist/src/api/v2/models/evm-ccip-rate-limits.d.ts +36 -0
- package/dist/src/api/v2/models/evm-ccip-rate-limits.js +14 -0
- package/dist/src/api/v2/models/evm-ccip-token-pool.d.ts +122 -0
- package/dist/src/api/v2/models/evm-ccip-token-pool.js +17 -0
- package/dist/src/api/v2/models/evm-contracts.d.ts +9 -0
- package/dist/src/api/v2/models/evm-oftadapter.d.ts +11 -0
- package/dist/src/api/v2/models/evm-oftadapter.js +4 -1
- package/dist/src/api/v2/models/evm-oftpeer.d.ts +12 -0
- package/dist/src/api/v2/models/index.d.ts +4 -0
- package/dist/src/api/v2/models/index.js +4 -0
- package/dist/src/evm-vaults/interfaces/index.d.ts +39 -0
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +15 -1
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +36 -0
- package/dist/src/evm-vaults/on-chain-calls/user.d.ts +40 -1
- package/dist/src/evm-vaults/on-chain-calls/user.js +75 -0
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +14 -1
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +30 -0
- package/dist/src/evm-vaults/utils/ccip.d.ts +23 -0
- package/dist/src/evm-vaults/utils/ccip.js +32 -0
- package/dist/src/evm-vaults/utils/deployment-parser.d.ts +46 -1
- package/dist/src/evm-vaults/utils/deployment-parser.js +74 -0
- package/dist/src/evm-vaults/utils/index.d.ts +1 -0
- package/dist/src/evm-vaults/utils/index.js +1 -0
- package/dist/src/sui-vaults/on-chain-calls/operator.d.ts +124 -0
- package/dist/src/sui-vaults/on-chain-calls/operator.js +174 -0
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.d.ts +197 -5
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.js +493 -7
- package/dist/src/sui-vaults/on-chain-calls/user.d.ts +82 -3
- package/dist/src/sui-vaults/on-chain-calls/user.js +129 -6
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.d.ts +10 -2
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.js +11 -6
- package/package.json +1 -1
|
@@ -125,10 +125,16 @@ export declare class UserCalls extends OnChainCalls {
|
|
|
125
125
|
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
126
126
|
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
127
127
|
* @param amount The amount of source shares to swap
|
|
128
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
129
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
130
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
131
|
+
* utilization) and the source rate can change between quoting and
|
|
132
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
133
|
+
* the guard entirely.
|
|
128
134
|
* @param options Optional tx execution params
|
|
129
135
|
* @returns OnChainCallResponse
|
|
130
136
|
*/
|
|
131
|
-
atomicSwapEmberShares(vaultId: string, sourceReceiptType: string, sourceVaultId: string, amount: NumStr, options?: IVaultOptionalParams & {
|
|
137
|
+
atomicSwapEmberShares(vaultId: string, sourceReceiptType: string, sourceVaultId: string, amount: NumStr, minNetOut: NumStr, options?: IVaultOptionalParams & {
|
|
132
138
|
coinId?: string;
|
|
133
139
|
receiver?: SuiAddress;
|
|
134
140
|
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
@@ -140,10 +146,16 @@ export declare class UserCalls extends OnChainCalls {
|
|
|
140
146
|
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
141
147
|
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
142
148
|
* @param amount The amount of source shares to swap
|
|
149
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
150
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
151
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
152
|
+
* utilization) and the source rate can change between quoting and
|
|
153
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
154
|
+
* the guard entirely.
|
|
143
155
|
* @param options Optional tx execution params
|
|
144
156
|
* @returns OnChainCallResponse
|
|
145
157
|
*/
|
|
146
|
-
atomicSwapEmberSharesWithSuilend(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, amount: NumStr, options?: IVaultOptionalParams & {
|
|
158
|
+
atomicSwapEmberSharesWithSuilend(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, amount: NumStr, minNetOut: NumStr, options?: IVaultOptionalParams & {
|
|
147
159
|
coinId?: string;
|
|
148
160
|
receiver?: SuiAddress;
|
|
149
161
|
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
@@ -154,11 +166,78 @@ export declare class UserCalls extends OnChainCalls {
|
|
|
154
166
|
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
155
167
|
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
156
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.
|
|
157
175
|
* @param options Optional tx execution params
|
|
158
176
|
* @returns OnChainCallResponse
|
|
159
177
|
*/
|
|
160
|
-
atomicSwapEmberSharesWithAlphalend(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, amount: NumStr, options?: IVaultOptionalParams & {
|
|
178
|
+
atomicSwapEmberSharesWithAlphalend(vaultId: string, sourceReceiptType: string, sourceVaultId: string, lendingProtocolId: string, amount: NumStr, minNetOut: NumStr, options?: IVaultOptionalParams & {
|
|
161
179
|
coinId?: string;
|
|
162
180
|
receiver?: SuiAddress;
|
|
163
181
|
} & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* Swap ember shares into a SUI-collateral atomic vault via Suilend
|
|
184
|
+
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
185
|
+
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
186
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
187
|
+
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
188
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
189
|
+
* @param amount The amount of source shares to swap
|
|
190
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
191
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
192
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
193
|
+
* utilization) and the source rate can change between quoting and
|
|
194
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
195
|
+
* the guard entirely.
|
|
196
|
+
* @param options Optional tx execution params
|
|
197
|
+
* @returns OnChainCallResponse
|
|
198
|
+
*/
|
|
199
|
+
atomicSwapEmberSharesWithSuilendSui(vaultId: string, sourceReceiptType: string, poolCoinType: string, sourceVaultId: string, lendingMarketId: string, amount: NumStr, minNetOut: NumStr, options?: IVaultOptionalParams & {
|
|
200
|
+
coinId?: string;
|
|
201
|
+
receiver?: SuiAddress;
|
|
202
|
+
} & 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
|
+
/**
|
|
219
|
+
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
220
|
+
* from Suilend
|
|
221
|
+
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
222
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
223
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
224
|
+
* @param shares The number of atomic shares to burn
|
|
225
|
+
* @param options Optional tx execution params
|
|
226
|
+
* @returns OnChainCallResponse
|
|
227
|
+
*/
|
|
228
|
+
atomicInstantWithdrawWithSuilendSui(vaultId: string, poolCoinType: string, lendingMarketId: string, shares: NumStr, options?: IVaultOptionalParams & {
|
|
229
|
+
receiver?: SuiAddress;
|
|
230
|
+
} & 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>;
|
|
164
243
|
}
|
|
@@ -233,10 +233,16 @@ export class UserCalls extends OnChainCalls {
|
|
|
233
233
|
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
234
234
|
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
235
235
|
* @param amount The amount of source shares to swap
|
|
236
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
237
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
238
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
239
|
+
* utilization) and the source rate can change between quoting and
|
|
240
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
241
|
+
* the guard entirely.
|
|
236
242
|
* @param options Optional tx execution params
|
|
237
243
|
* @returns OnChainCallResponse
|
|
238
244
|
*/
|
|
239
|
-
async atomicSwapEmberShares(vaultId, sourceReceiptType, sourceVaultId, amount, options) {
|
|
245
|
+
async atomicSwapEmberShares(vaultId, sourceReceiptType, sourceVaultId, amount, minNetOut, options) {
|
|
240
246
|
let coinId = options?.coinId;
|
|
241
247
|
const txb = options?.txBlock || new TransactionBlock();
|
|
242
248
|
let split;
|
|
@@ -249,7 +255,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
249
255
|
[split, merged] = await CoinUtils.validateCoinBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), coinId);
|
|
250
256
|
coinId = split;
|
|
251
257
|
}
|
|
252
|
-
this.txBuilder.atomicSwapEmberShares(vaultId, sourceReceiptType, sourceVaultId, coinId, options?.receiver ?? null, { ...options, txBlock: txb });
|
|
258
|
+
this.txBuilder.atomicSwapEmberShares(vaultId, sourceReceiptType, sourceVaultId, coinId, options?.receiver ?? null, minNetOut, { ...options, txBlock: txb });
|
|
253
259
|
if (merged) {
|
|
254
260
|
txb.transferObjects([merged], this.walletAddress);
|
|
255
261
|
}
|
|
@@ -263,10 +269,16 @@ export class UserCalls extends OnChainCalls {
|
|
|
263
269
|
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
264
270
|
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
265
271
|
* @param amount The amount of source shares to swap
|
|
272
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
273
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
274
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
275
|
+
* utilization) and the source rate can change between quoting and
|
|
276
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
277
|
+
* the guard entirely.
|
|
266
278
|
* @param options Optional tx execution params
|
|
267
279
|
* @returns OnChainCallResponse
|
|
268
280
|
*/
|
|
269
|
-
async atomicSwapEmberSharesWithSuilend(vaultId, sourceReceiptType, poolCoinType, sourceVaultId, lendingMarketId, amount, options) {
|
|
281
|
+
async atomicSwapEmberSharesWithSuilend(vaultId, sourceReceiptType, poolCoinType, sourceVaultId, lendingMarketId, amount, minNetOut, options) {
|
|
270
282
|
let coinId = options?.coinId;
|
|
271
283
|
const txb = options?.txBlock || new TransactionBlock();
|
|
272
284
|
let split;
|
|
@@ -279,7 +291,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
279
291
|
[split, merged] = await CoinUtils.validateCoinBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), coinId);
|
|
280
292
|
coinId = split;
|
|
281
293
|
}
|
|
282
|
-
this.txBuilder.atomicSwapEmberSharesWithSuilend(vaultId, sourceReceiptType, poolCoinType, sourceVaultId, lendingMarketId, coinId, options?.receiver ?? null, { ...options, txBlock: txb });
|
|
294
|
+
this.txBuilder.atomicSwapEmberSharesWithSuilend(vaultId, sourceReceiptType, poolCoinType, sourceVaultId, lendingMarketId, coinId, options?.receiver ?? null, minNetOut, { ...options, txBlock: txb });
|
|
283
295
|
if (merged) {
|
|
284
296
|
txb.transferObjects([merged], this.walletAddress);
|
|
285
297
|
}
|
|
@@ -292,10 +304,16 @@ export class UserCalls extends OnChainCalls {
|
|
|
292
304
|
* @param sourceVaultId Object id of the source Vault<T, R>
|
|
293
305
|
* @param lendingProtocolId Object id of the AlphaLend LendingProtocol
|
|
294
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.
|
|
295
313
|
* @param options Optional tx execution params
|
|
296
314
|
* @returns OnChainCallResponse
|
|
297
315
|
*/
|
|
298
|
-
async atomicSwapEmberSharesWithAlphalend(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, amount, options) {
|
|
316
|
+
async atomicSwapEmberSharesWithAlphalend(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, amount, minNetOut, options) {
|
|
299
317
|
let coinId = options?.coinId;
|
|
300
318
|
const txb = options?.txBlock || new TransactionBlock();
|
|
301
319
|
let split;
|
|
@@ -308,10 +326,115 @@ export class UserCalls extends OnChainCalls {
|
|
|
308
326
|
[split, merged] = await CoinUtils.validateCoinBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), coinId);
|
|
309
327
|
coinId = split;
|
|
310
328
|
}
|
|
311
|
-
this.txBuilder.atomicSwapEmberSharesWithAlphalend(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, coinId, options?.receiver ?? null, { ...options, txBlock: txb });
|
|
329
|
+
this.txBuilder.atomicSwapEmberSharesWithAlphalend(vaultId, sourceReceiptType, sourceVaultId, lendingProtocolId, coinId, options?.receiver ?? null, minNetOut, { ...options, txBlock: txb });
|
|
312
330
|
if (merged) {
|
|
313
331
|
txb.transferObjects([merged], this.walletAddress);
|
|
314
332
|
}
|
|
315
333
|
return this.execCall(txb, options);
|
|
316
334
|
}
|
|
335
|
+
// === Vault<SUI> variants ===
|
|
336
|
+
//
|
|
337
|
+
// For a SUI-collateral atomic vault the lending protocols must unwrap and
|
|
338
|
+
// rewrap SUI through the system state, so these are separate monomorphic
|
|
339
|
+
// entry functions rather than the generic ones above.
|
|
340
|
+
//
|
|
341
|
+
// The SUILEND variants take a bare `address` receiver on chain, not an
|
|
342
|
+
// Option, so there is no "default to sender" behaviour to inherit — these
|
|
343
|
+
// wrappers fall back to the SDK's wallet address explicitly. The ALPHALEND
|
|
344
|
+
// variants do take an Option and keep the usual on-chain default.
|
|
345
|
+
/**
|
|
346
|
+
* Swap ember shares into a SUI-collateral atomic vault via Suilend
|
|
347
|
+
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
348
|
+
* @param sourceReceiptType The receipt coin type of the source vault (R)
|
|
349
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
350
|
+
* @param sourceVaultId Object id of the source Vault<SUI, R>
|
|
351
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
352
|
+
* @param amount The amount of source shares to swap
|
|
353
|
+
* @param minNetOut Minimum collateral to receive, in base units. The swap
|
|
354
|
+
* aborts below it. This is the A-9 slippage guard: the payout is
|
|
355
|
+
* gross - fee - holdback, and both the fee multiplier (which moves with
|
|
356
|
+
* utilization) and the source rate can change between quoting and
|
|
357
|
+
* landing. Pass the value from `previewSwapInstantWithdraw`; 0 disables
|
|
358
|
+
* the guard entirely.
|
|
359
|
+
* @param options Optional tx execution params
|
|
360
|
+
* @returns OnChainCallResponse
|
|
361
|
+
*/
|
|
362
|
+
async atomicSwapEmberSharesWithSuilendSui(vaultId, sourceReceiptType, poolCoinType, sourceVaultId, lendingMarketId, amount, minNetOut, options) {
|
|
363
|
+
let coinId = options?.coinId;
|
|
364
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
365
|
+
let split;
|
|
366
|
+
let merged;
|
|
367
|
+
if (!coinId) {
|
|
368
|
+
[split, merged] = await CoinUtils.createCoinWithBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), sourceReceiptType, this.walletAddress);
|
|
369
|
+
coinId = split;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
[split, merged] = await CoinUtils.validateCoinBalance(this.suiClient, txb, bigNumber(amount).toFixed(0), coinId);
|
|
373
|
+
coinId = split;
|
|
374
|
+
}
|
|
375
|
+
this.txBuilder.atomicSwapEmberSharesWithSuilendSui(vaultId, sourceReceiptType, poolCoinType, sourceVaultId, lendingMarketId, coinId, options?.receiver ?? this.walletAddress, minNetOut, { ...options, txBlock: txb });
|
|
376
|
+
if (merged) {
|
|
377
|
+
txb.transferObjects([merged], this.walletAddress);
|
|
378
|
+
}
|
|
379
|
+
return this.execCall(txb, options);
|
|
380
|
+
}
|
|
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
|
+
/**
|
|
412
|
+
* Instant withdraw from a SUI-collateral atomic vault, pulling liquidity
|
|
413
|
+
* from Suilend
|
|
414
|
+
* @param vaultId The id of the atomic vault (collateral must be SUI)
|
|
415
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
416
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
417
|
+
* @param shares The number of atomic shares to burn
|
|
418
|
+
* @param options Optional tx execution params
|
|
419
|
+
* @returns OnChainCallResponse
|
|
420
|
+
*/
|
|
421
|
+
async atomicInstantWithdrawWithSuilendSui(vaultId, poolCoinType, lendingMarketId, shares, options) {
|
|
422
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
423
|
+
this.txBuilder.atomicInstantWithdrawWithSuilendSui(vaultId, poolCoinType, lendingMarketId, shares, options?.receiver ?? this.walletAddress, { ...options, txBlock: txb });
|
|
424
|
+
return this.execCall(txb, options);
|
|
425
|
+
}
|
|
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
|
+
}
|
|
317
440
|
}
|
|
@@ -278,13 +278,21 @@ export declare class VaultAdminCalls extends OnChainCalls {
|
|
|
278
278
|
*/
|
|
279
279
|
atomicSetDepositUserList(vaultId: string, user: SuiAddress, status: boolean, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
280
280
|
/**
|
|
281
|
-
*
|
|
281
|
+
* Step 1 of 2 for Suilend activation. Commits the reserve index, market
|
|
282
|
+
* object and collateral type; step 2 is `atomicOpenSuilendObligation` on
|
|
283
|
+
* the operator client, without which every supply aborts.
|
|
284
|
+
*
|
|
285
|
+
* `poolCoinType` and `lendingMarketId` became required in the I-11 fix —
|
|
286
|
+
* previously only the reserve index was committed, so a wrong market was
|
|
287
|
+
* undetectable on chain.
|
|
282
288
|
* @param vaultId The id of the atomic vault
|
|
289
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
290
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
283
291
|
* @param reserveArrayIndex The Suilend reserve array index
|
|
284
292
|
* @param options Optional tx execution params
|
|
285
293
|
* @returns OnChainCallResponse
|
|
286
294
|
*/
|
|
287
|
-
atomicSetStrategySuilend(vaultId: string, reserveArrayIndex: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
295
|
+
atomicSetStrategySuilend(vaultId: string, poolCoinType: string, lendingMarketId: string, reserveArrayIndex: NumStr, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
288
296
|
/**
|
|
289
297
|
* Set the AlphaLend strategy for an atomic vault
|
|
290
298
|
* @param vaultId The id of the atomic vault
|
|
@@ -483,18 +483,23 @@ export class VaultAdminCalls extends OnChainCalls {
|
|
|
483
483
|
return this.execCall(txb, options);
|
|
484
484
|
}
|
|
485
485
|
/**
|
|
486
|
-
*
|
|
486
|
+
* Step 1 of 2 for Suilend activation. Commits the reserve index, market
|
|
487
|
+
* object and collateral type; step 2 is `atomicOpenSuilendObligation` on
|
|
488
|
+
* the operator client, without which every supply aborts.
|
|
489
|
+
*
|
|
490
|
+
* `poolCoinType` and `lendingMarketId` became required in the I-11 fix —
|
|
491
|
+
* previously only the reserve index was committed, so a wrong market was
|
|
492
|
+
* undetectable on chain.
|
|
487
493
|
* @param vaultId The id of the atomic vault
|
|
494
|
+
* @param poolCoinType The Suilend pool coin type (P)
|
|
495
|
+
* @param lendingMarketId Object id of the Suilend LendingMarket<P>
|
|
488
496
|
* @param reserveArrayIndex The Suilend reserve array index
|
|
489
497
|
* @param options Optional tx execution params
|
|
490
498
|
* @returns OnChainCallResponse
|
|
491
499
|
*/
|
|
492
|
-
async atomicSetStrategySuilend(vaultId, reserveArrayIndex, options) {
|
|
500
|
+
async atomicSetStrategySuilend(vaultId, poolCoinType, lendingMarketId, reserveArrayIndex, options) {
|
|
493
501
|
const txb = options?.txBlock || new TransactionBlock();
|
|
494
|
-
this.txBuilder.atomicSetStrategySuilend(vaultId, reserveArrayIndex, {
|
|
495
|
-
...options,
|
|
496
|
-
txBlock: txb
|
|
497
|
-
});
|
|
502
|
+
this.txBuilder.atomicSetStrategySuilend(vaultId, poolCoinType, lendingMarketId, reserveArrayIndex, { ...options, txBlock: txb });
|
|
498
503
|
return this.execCall(txb, options);
|
|
499
504
|
}
|
|
500
505
|
/**
|