@cetusprotocol/deepbook-utils 1.4.2 → 1.4.3
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 +36 -0
- package/dist/index.js +6 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -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
|
/**
|