@cetusprotocol/deepbook-utils 1.4.2 → 1.4.4
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/index.d.ts +38 -2
- package/dist/index.js +10 -10
- package/package.json +1 -1
- package/jest.config.js +0 -15
package/dist/index.d.ts
CHANGED
|
@@ -424,7 +424,7 @@ declare class DeepbookUtilsModule implements IModule {
|
|
|
424
424
|
amountToWithdraw: string;
|
|
425
425
|
returnAssets?: boolean;
|
|
426
426
|
txb?: Transaction;
|
|
427
|
-
}): Transaction | _mysten_sui_transactions.TransactionResult
|
|
427
|
+
}): Promise<Transaction | _mysten_sui_transactions.TransactionResult>;
|
|
428
428
|
/**
|
|
429
429
|
* Withdraws free balances from multiple managers into the owner account.
|
|
430
430
|
*/
|
|
@@ -994,6 +994,34 @@ declare class MarginUtilsModule implements IModule {
|
|
|
994
994
|
lowestTriggerAbovePrice: bigint;
|
|
995
995
|
highestTriggerBelowPrice: bigint;
|
|
996
996
|
}>;
|
|
997
|
+
/**
|
|
998
|
+
* Detects whether `price` is exactly on the tolerance boundary used by margin price checks.
|
|
999
|
+
*
|
|
1000
|
+
* Mapping (from `getManagerState`):
|
|
1001
|
+
* - For bids (`is_bid=true`): the relevant boundary is `lowestTriggerAbovePrice` (upper bound).
|
|
1002
|
+
* - For asks (`is_bid=false`): the relevant boundary is `highestTriggerBelowPrice` (lower bound).
|
|
1003
|
+
*
|
|
1004
|
+
* NOTE: `price` must be in the same scaled `u64` units used by the on-chain margin module.
|
|
1005
|
+
*/
|
|
1006
|
+
detectPriceBoundary({ account, marginManager, baseCoin, quoteCoin, pool, baseMarginPool, quoteMarginPool, price, is_bid, decimals, }: {
|
|
1007
|
+
account: string;
|
|
1008
|
+
marginManager: string;
|
|
1009
|
+
baseCoin: MarginCoinInfo;
|
|
1010
|
+
quoteCoin: MarginCoinInfo;
|
|
1011
|
+
pool: string;
|
|
1012
|
+
baseMarginPool: string;
|
|
1013
|
+
quoteMarginPool: string;
|
|
1014
|
+
price: bigint | string | number;
|
|
1015
|
+
is_bid: boolean;
|
|
1016
|
+
decimals?: number;
|
|
1017
|
+
}): Promise<{
|
|
1018
|
+
is_bid: boolean;
|
|
1019
|
+
price: bigint;
|
|
1020
|
+
lower_bound: bigint;
|
|
1021
|
+
upper_bound: bigint;
|
|
1022
|
+
is_within: boolean;
|
|
1023
|
+
is_boundary: boolean;
|
|
1024
|
+
}>;
|
|
997
1025
|
/**
|
|
998
1026
|
* Calculates the current assets (base and quote) for a margin manager.
|
|
999
1027
|
*
|
|
@@ -1510,6 +1538,14 @@ declare class MarginUtilsModule implements IModule {
|
|
|
1510
1538
|
getConditionalOrders(options: GetConditionalOrdersOptions[], tx: Transaction): Promise<ConditionalOrder[]>;
|
|
1511
1539
|
getConditionalOrderIds(options: GetConditionalIdsOptions[], tx?: Transaction): Promise<Record<string, GetConditionalOrderIdsResponse>>;
|
|
1512
1540
|
private normalizeConditionalOrder;
|
|
1541
|
+
getPoolsPriceBounds(poolInfos: {
|
|
1542
|
+
poolId: string;
|
|
1543
|
+
baseDecimals: number;
|
|
1544
|
+
quoteDecimals: number;
|
|
1545
|
+
}[]): Promise<{
|
|
1546
|
+
priceBounds: any;
|
|
1547
|
+
priceBoundsMap: Map<string, any>;
|
|
1548
|
+
}>;
|
|
1513
1549
|
}
|
|
1514
1550
|
|
|
1515
1551
|
/**
|
|
@@ -1741,7 +1777,7 @@ declare class TransactionUtil {
|
|
|
1741
1777
|
newTx?: Transaction;
|
|
1742
1778
|
}>;
|
|
1743
1779
|
static buildCoinForAmount(tx: Transaction, allCoins: CoinAsset[], amount: bigint, coinType: string, buildVector?: boolean, fixAmount?: boolean): BuildCoinResult;
|
|
1744
|
-
|
|
1780
|
+
static buildCoin(tx: Transaction, allCoins: CoinAsset[], coinAssets: CoinAsset[], amount: bigint, coinType: string, buildVector?: boolean, fixAmount?: boolean): BuildCoinResult;
|
|
1745
1781
|
private static buildZeroValueCoin;
|
|
1746
1782
|
static buildCoinForAmountInterval(tx: Transaction, allCoins: CoinAsset[], amounts: CoinInputInterval, coinType: string, buildVector?: boolean): BuildCoinResult;
|
|
1747
1783
|
static callMintZeroValueCoin: (txb: Transaction, coinType: string) => _mysten_sui_transactions.TransactionResult;
|