@ember-finance/sdk 2.30.0 → 2.33.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/api/v2/models/vault-parking-lot-info.d.ts +12 -0
- package/dist/src/sui-vaults/on-chain-calls/operator.d.ts +10 -0
- package/dist/src/sui-vaults/on-chain-calls/operator.js +17 -0
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.d.ts +10 -0
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.js +27 -0
- package/dist/src/sui-vaults/on-chain-calls/user.d.ts +1 -0
- package/dist/src/sui-vaults/on-chain-calls/user.js +18 -7
- package/package.json +1 -1
|
@@ -57,4 +57,16 @@ export interface VaultParkingLotInfo {
|
|
|
57
57
|
* @memberof VaultParkingLotInfo
|
|
58
58
|
*/
|
|
59
59
|
processingDelayMs?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Total assets queued in this parking lot awaiting processing, in the deposit asset\'s native decimals. Always present; \"0\" when the queue is empty. Derived from indexed events, so it can lag the lot\'s on-chain totalPendingAssets; read on-chain for anything a user acts on.
|
|
62
|
+
* @type {string}
|
|
63
|
+
* @memberof VaultParkingLotInfo
|
|
64
|
+
*/
|
|
65
|
+
pendingAssets: string;
|
|
66
|
+
/**
|
|
67
|
+
* Number of deposit requests making up pendingAssets
|
|
68
|
+
* @type {number}
|
|
69
|
+
* @memberof VaultParkingLotInfo
|
|
70
|
+
*/
|
|
71
|
+
pendingCount: number;
|
|
60
72
|
}
|
|
@@ -244,6 +244,16 @@ export declare class OperatorCalls extends OnChainCalls {
|
|
|
244
244
|
* @returns OnChainCallResponse
|
|
245
245
|
*/
|
|
246
246
|
atomicDepositFromSubAccount(vaultId: string, tokenId: string, subAccount: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
247
|
+
/**
|
|
248
|
+
* Deposit collateral back into an atomic vault from its accumulator
|
|
249
|
+
* (address) balance, where `send_funds` transfers land
|
|
250
|
+
* @param vaultId The id of the atomic vault
|
|
251
|
+
* @param amount The amount to redeem from the vault's accumulator balance
|
|
252
|
+
* @param subAccount The sub account address
|
|
253
|
+
* @param options Optional tx execution params
|
|
254
|
+
* @returns OnChainCallResponse
|
|
255
|
+
*/
|
|
256
|
+
atomicDepositFromSubAccountV2(vaultId: string, amount: NumStr, subAccount: string, options?: IVaultOptionalParams & SuiTransactionBlockResponseOptions): Promise<OnChainCallResponse>;
|
|
247
257
|
/**
|
|
248
258
|
* Redeem collected ember shares from an atomic vault against a source vault
|
|
249
259
|
* @param vaultId The id of the atomic vault
|
|
@@ -405,6 +405,23 @@ export class OperatorCalls extends OnChainCalls {
|
|
|
405
405
|
});
|
|
406
406
|
return this.execCall(txb, options);
|
|
407
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* Deposit collateral back into an atomic vault from its accumulator
|
|
410
|
+
* (address) balance, where `send_funds` transfers land
|
|
411
|
+
* @param vaultId The id of the atomic vault
|
|
412
|
+
* @param amount The amount to redeem from the vault's accumulator balance
|
|
413
|
+
* @param subAccount The sub account address
|
|
414
|
+
* @param options Optional tx execution params
|
|
415
|
+
* @returns OnChainCallResponse
|
|
416
|
+
*/
|
|
417
|
+
async atomicDepositFromSubAccountV2(vaultId, amount, subAccount, options) {
|
|
418
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
419
|
+
this.txBuilder.atomicDepositFromSubAccountV2(vaultId, amount, subAccount, {
|
|
420
|
+
...options,
|
|
421
|
+
txBlock: txb
|
|
422
|
+
});
|
|
423
|
+
return this.execCall(txb, options);
|
|
424
|
+
}
|
|
408
425
|
/**
|
|
409
426
|
* Redeem collected ember shares from an atomic vault against a source vault
|
|
410
427
|
* @param vaultId The id of the atomic vault
|
|
@@ -758,6 +758,16 @@ export declare class TxBuilder {
|
|
|
758
758
|
* @returns TransactionBlock
|
|
759
759
|
*/
|
|
760
760
|
atomicDepositFromSubAccount(vaultId: string, tokenId: string, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
761
|
+
/**
|
|
762
|
+
* Deposits collateral back into an atomic vault from its accumulator
|
|
763
|
+
* (address) balance, where `send_funds` transfers land
|
|
764
|
+
* @param vaultId Id of the atomic vault
|
|
765
|
+
* @param amount Amount to redeem from the vault's accumulator balance
|
|
766
|
+
* @param subAccount Sub account address
|
|
767
|
+
* @param options Optional tx building params
|
|
768
|
+
* @returns TransactionBlock
|
|
769
|
+
*/
|
|
770
|
+
atomicDepositFromSubAccountV2(vaultId: string, amount: NumStr, subAccount: string, options?: ITxBuilderOptionalParams): TransactionBlock;
|
|
761
771
|
/**
|
|
762
772
|
* Collects the platform fee of an atomic vault
|
|
763
773
|
* @param vaultId Id of the atomic vault
|
|
@@ -2184,6 +2184,33 @@ export class TxBuilder {
|
|
|
2184
2184
|
txb.setSenderIfNotSet(options.sender);
|
|
2185
2185
|
return txb;
|
|
2186
2186
|
}
|
|
2187
|
+
/**
|
|
2188
|
+
* Deposits collateral back into an atomic vault from its accumulator
|
|
2189
|
+
* (address) balance, where `send_funds` transfers land
|
|
2190
|
+
* @param vaultId Id of the atomic vault
|
|
2191
|
+
* @param amount Amount to redeem from the vault's accumulator balance
|
|
2192
|
+
* @param subAccount Sub account address
|
|
2193
|
+
* @param options Optional tx building params
|
|
2194
|
+
* @returns TransactionBlock
|
|
2195
|
+
*/
|
|
2196
|
+
atomicDepositFromSubAccountV2(vaultId, amount, subAccount, options) {
|
|
2197
|
+
const txb = options?.txBlock || new TransactionBlock();
|
|
2198
|
+
txb.moveCall({
|
|
2199
|
+
arguments: [
|
|
2200
|
+
txb.object(vaultId),
|
|
2201
|
+
txb.object(this.parser.getProtocolConfig()),
|
|
2202
|
+
txb.pure.u64(amount),
|
|
2203
|
+
txb.pure.address(subAccount)
|
|
2204
|
+
],
|
|
2205
|
+
typeArguments: [this.parser.getAtomicCollateralType(vaultId)],
|
|
2206
|
+
target: `${this.parser.getPackageId()}::gateway::atomic_deposit_from_sub_account_v2`
|
|
2207
|
+
});
|
|
2208
|
+
if (options?.gasBudget)
|
|
2209
|
+
txb.setGasBudget(options.gasBudget);
|
|
2210
|
+
if (options?.sender)
|
|
2211
|
+
txb.setSenderIfNotSet(options.sender);
|
|
2212
|
+
return txb;
|
|
2213
|
+
}
|
|
2187
2214
|
/**
|
|
2188
2215
|
* Collects the platform fee of an atomic vault
|
|
2189
2216
|
* @param vaultId Id of the atomic vault
|
|
@@ -5,6 +5,7 @@ import { OnChainCallResponse, Signer, SuiAddress, SuiTransactionBlockResponseOpt
|
|
|
5
5
|
import { TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
6
6
|
export declare class UserCalls extends OnChainCalls {
|
|
7
7
|
constructor(_network: string, _suiClient: SuiClient, _deployment: ISuiDeployment, _signer?: Signer, _walletAddress?: string, _isUIWallet?: boolean);
|
|
8
|
+
private walletCoin;
|
|
8
9
|
/**
|
|
9
10
|
* Deposit asset into a vault
|
|
10
11
|
* @param vaultId The id of the vault to deposit into
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { OnChainCalls } from "./onchain-calls.js";
|
|
2
2
|
import { TransactionBlock, bigNumber, CoinUtils, SUI_NATIVE_BASE } from "@firefly-exchange/library-sui";
|
|
3
3
|
import { Vault } from "./vault.js";
|
|
4
|
+
import { coinWithBalance } from "@mysten/sui/transactions";
|
|
4
5
|
import { SuiAtomicLiquidityReader } from "./atomic-liquidity.js";
|
|
5
6
|
import { isSuiCoinType } from "../utils/common.js";
|
|
6
7
|
export class UserCalls extends OnChainCalls {
|
|
7
8
|
constructor(_network, _suiClient, _deployment, _signer, _walletAddress, _isUIWallet) {
|
|
8
9
|
super(_network, _suiClient, _deployment, _signer, _walletAddress, _isUIWallet);
|
|
9
10
|
}
|
|
11
|
+
walletCoin(txb, coinType, amount) {
|
|
12
|
+
// `send_funds` credits the wallet's address balance, which coin
|
|
13
|
+
// enumeration cannot see. The intent draws on coin objects and that
|
|
14
|
+
// balance together, resolved when the tx is built.
|
|
15
|
+
txb.setSenderIfNotSet(this.walletAddress);
|
|
16
|
+
return txb.add(coinWithBalance({
|
|
17
|
+
type: coinType,
|
|
18
|
+
balance: BigInt(bigNumber(amount).toFixed(0))
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
10
21
|
/**
|
|
11
22
|
* Deposit asset into a vault
|
|
12
23
|
* @param vaultId The id of the vault to deposit into
|
|
@@ -21,7 +32,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
21
32
|
let merged;
|
|
22
33
|
if (!coinId) {
|
|
23
34
|
const coinType = this.parser.getDepositCoinType(vaultId);
|
|
24
|
-
|
|
35
|
+
split = this.walletCoin(txb, coinType, bigNumber(amount).toFixed(0));
|
|
25
36
|
coinId = split;
|
|
26
37
|
}
|
|
27
38
|
else {
|
|
@@ -71,7 +82,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
71
82
|
let merged;
|
|
72
83
|
if (!coinId) {
|
|
73
84
|
const coinType = this.parser.getDepositCoinType(vaultId);
|
|
74
|
-
|
|
85
|
+
split = this.walletCoin(txb, coinType, assetAmountRequired);
|
|
75
86
|
coinId = split;
|
|
76
87
|
}
|
|
77
88
|
else {
|
|
@@ -98,7 +109,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
98
109
|
let split;
|
|
99
110
|
if (!coinId) {
|
|
100
111
|
const coinType = this.parser.getReceiptCoinType(vaultId);
|
|
101
|
-
|
|
112
|
+
split = this.walletCoin(txb, coinType, bigNumber(amountOfShares).toFixed(0));
|
|
102
113
|
coinId = split;
|
|
103
114
|
}
|
|
104
115
|
else {
|
|
@@ -144,7 +155,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
144
155
|
let merged;
|
|
145
156
|
if (!coinId) {
|
|
146
157
|
const coinType = this.parser.getAtomicCollateralType(vaultId);
|
|
147
|
-
|
|
158
|
+
split = this.walletCoin(txb, coinType, bigNumber(amount).toFixed(0));
|
|
148
159
|
coinId = split;
|
|
149
160
|
}
|
|
150
161
|
else {
|
|
@@ -249,7 +260,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
249
260
|
let split;
|
|
250
261
|
let merged;
|
|
251
262
|
if (!coinId) {
|
|
252
|
-
|
|
263
|
+
split = this.walletCoin(txb, sourceReceiptType, bigNumber(amount).toFixed(0));
|
|
253
264
|
coinId = split;
|
|
254
265
|
}
|
|
255
266
|
else {
|
|
@@ -298,7 +309,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
298
309
|
let split;
|
|
299
310
|
let merged;
|
|
300
311
|
if (!coinId) {
|
|
301
|
-
|
|
312
|
+
split = this.walletCoin(txb, sourceReceiptType, bigNumber(amount).toFixed(0));
|
|
302
313
|
coinId = split;
|
|
303
314
|
}
|
|
304
315
|
else {
|
|
@@ -343,7 +354,7 @@ export class UserCalls extends OnChainCalls {
|
|
|
343
354
|
let split;
|
|
344
355
|
let merged;
|
|
345
356
|
if (!coinId) {
|
|
346
|
-
|
|
357
|
+
split = this.walletCoin(txb, sourceReceiptType, bigNumber(amount).toFixed(0));
|
|
347
358
|
coinId = split;
|
|
348
359
|
}
|
|
349
360
|
else {
|