@cetusprotocol/deepbook-utils 1.1.3 → 1.3.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/index.d.ts CHANGED
@@ -270,6 +270,87 @@ type MarginPoolInfo = {
270
270
  baseCoin: MarginCoinInfo;
271
271
  quoteCoin: MarginCoinInfo;
272
272
  };
273
+ type PendingMarketOrderOptions = {
274
+ client_order_id: string;
275
+ self_matching_option: SelfMatchingOption;
276
+ quantity: string;
277
+ is_bid: boolean;
278
+ pay_with_deep: boolean;
279
+ };
280
+ type PendingLimitOrderOptions = {
281
+ client_order_id: string;
282
+ order_type: OrderType;
283
+ self_matching_option: SelfMatchingOption;
284
+ price: string;
285
+ quantity: string;
286
+ is_bid: boolean;
287
+ pay_with_deep: boolean;
288
+ expire_timestamp: string;
289
+ };
290
+ type AddConditionalOrderOptions = {
291
+ margin_manager_id: string;
292
+ pool_id: string;
293
+ base_coin: MarginCoinInfo;
294
+ quote_coin: MarginCoinInfo;
295
+ conditional_order_id: string;
296
+ is_trigger_below_price: boolean;
297
+ trigger_price: string;
298
+ pending_order: PendingMarketOrderOptions | PendingLimitOrderOptions;
299
+ };
300
+ type CancelAllConditionalOrdersOptions = {
301
+ margin_manager_id: string;
302
+ base_coin_type: string;
303
+ quote_coin_type: string;
304
+ };
305
+ type CancelConditionalOrdersOptions = {
306
+ margin_manager_id: string;
307
+ base_coin_type: string;
308
+ quote_coin_type: string;
309
+ conditional_order_id: string;
310
+ };
311
+ type GetConditionalOrdersOptions = {
312
+ margin_manager_id: string;
313
+ conditional_order_ids: string[];
314
+ base_coin_type: string;
315
+ quote_coin_type: string;
316
+ };
317
+ type GetConditionalIdsOptions = {
318
+ margin_manager_id: string;
319
+ base_coin_type: string;
320
+ quote_coin_type: string;
321
+ };
322
+ type GetConditionalOrderIdsResponse = {
323
+ margin_manager_id: string;
324
+ base_coin_type: string;
325
+ quote_coin_type: string;
326
+ conditional_order_ids: string[];
327
+ };
328
+ /** Condition for triggering a conditional order (trigger_below_price, trigger_price). */
329
+ type Condition = {
330
+ trigger_below_price: boolean;
331
+ trigger_price: string;
332
+ };
333
+ /** Pending order embedded in a conditional order (matches Move PendingOrder). */
334
+ type PendingOrder = {
335
+ is_limit_order: boolean;
336
+ client_order_id: string;
337
+ order_type?: OrderType;
338
+ self_matching_option: SelfMatchingOption;
339
+ price?: string;
340
+ quantity: string;
341
+ is_bid: boolean;
342
+ pay_with_deep: boolean;
343
+ expire_timestamp?: string;
344
+ };
345
+ /** Conditional order (matches Move ConditionalOrder). */
346
+ type ConditionalOrder = {
347
+ margin_manager_id: string;
348
+ base_coin_type: string;
349
+ quote_coin_type: string;
350
+ conditional_order_id: string;
351
+ condition: Condition;
352
+ pending_order: PendingOrder;
353
+ };
273
354
 
274
355
  type BigNumber = Decimal.Value | number | string;
275
356
 
@@ -1298,12 +1379,22 @@ declare class MarginUtilsModule implements IModule {
1298
1379
  maintainer_fees: any;
1299
1380
  protocol_fees: any;
1300
1381
  }[]>;
1382
+ getBaseQuantityIn(poolInfo: any, quantity: string, payWithDeep: boolean, slippage?: number): Promise<{
1383
+ quantityOut: string;
1384
+ quantityInLeft: string;
1385
+ deep_fee_amount: string;
1386
+ }>;
1387
+ getQuoteQuantityIn(poolInfo: any, quantity: string, payWithDeep: boolean, slippage?: number): Promise<{
1388
+ quantityOut: string;
1389
+ quantityInLeft: string;
1390
+ deep_fee_amount: string;
1391
+ }>;
1301
1392
  getBaseQuantityOutInput(poolInfo: any, quantity: string, payWithDeep: boolean): Promise<{
1302
1393
  base_amount: string;
1303
1394
  quote_amount: string;
1304
1395
  deep_fee_amount: string;
1305
1396
  }>;
1306
- getQuoteQuantityOutInput(poolInfo: any, quantity: string): Promise<{
1397
+ getQuoteQuantityOutInput(poolInfo: any, quantity: string, payWithDeep: boolean): Promise<{
1307
1398
  base_amount: string;
1308
1399
  quote_amount: string;
1309
1400
  deep_fee_amount: string;
@@ -1351,6 +1442,69 @@ declare class MarginUtilsModule implements IModule {
1351
1442
  * @returns {Promise<bigint>} The current chain timestamp in milliseconds
1352
1443
  */
1353
1444
  getChainTimestamp(): Promise<bigint>;
1445
+ batchGetBorrowedShares({ account, marginManagerList, }: {
1446
+ account: string;
1447
+ marginManagerList: {
1448
+ marginManagerId: string;
1449
+ baseCoinType: string;
1450
+ quoteCoinType: string;
1451
+ }[];
1452
+ }): Promise<any>;
1453
+ betchGetOpenOrders({ account, marginManagerList, }: {
1454
+ account: string;
1455
+ marginManagerList: {
1456
+ marginManagerId: string;
1457
+ poolId: string;
1458
+ baseCoinType: string;
1459
+ quoteCoinType: string;
1460
+ baseMarginPool: string;
1461
+ quoteMarginPool: string;
1462
+ }[];
1463
+ }, tx?: Transaction, isReturnTx?: boolean): Promise<{
1464
+ openOrders: any;
1465
+ settledBalances: any;
1466
+ lockedBalances: any;
1467
+ }>;
1468
+ getSingleMarginManagerOpenOrders({ account, marginManagerId, poolId, baseCoinType, quoteCoinType, baseMarginPool, quoteMarginPool, }: {
1469
+ account: string;
1470
+ marginManagerId: string;
1471
+ poolId: string;
1472
+ baseCoinType: string;
1473
+ quoteCoinType: string;
1474
+ baseMarginPool: string;
1475
+ quoteMarginPool: string;
1476
+ }): Promise<{
1477
+ openOrders: any;
1478
+ settledBalances: {
1479
+ base: string;
1480
+ quote: string;
1481
+ deep: string;
1482
+ }[];
1483
+ lockedBalances: {
1484
+ marginManagerId: string;
1485
+ base: string;
1486
+ quote: string;
1487
+ deep: string;
1488
+ }[];
1489
+ }>;
1490
+ getAllPosRelevantData({ account, marginManagerList, }: {
1491
+ account: string;
1492
+ marginManagerList: {
1493
+ marginManagerId: string;
1494
+ poolId: string;
1495
+ baseCoinType: string;
1496
+ quoteCoinType: string;
1497
+ baseMarginPool: string;
1498
+ quoteMarginPool: string;
1499
+ }[];
1500
+ }): Promise<any>;
1501
+ addConditionalOrder(options: AddConditionalOrderOptions, tx: Transaction): Promise<void>;
1502
+ private newPendingOrder;
1503
+ cancelAllConditionalOrders(options: CancelAllConditionalOrdersOptions, tx: Transaction): void;
1504
+ cancelConditionalOrders(options: CancelConditionalOrdersOptions, tx: Transaction): void;
1505
+ getConditionalOrders(options: GetConditionalOrdersOptions[], tx: Transaction): Promise<ConditionalOrder[]>;
1506
+ getConditionalOrderIds(options: GetConditionalIdsOptions[], tx?: Transaction): Promise<Record<string, GetConditionalOrderIdsResponse>>;
1507
+ private normalizeConditionalOrder;
1354
1508
  }
1355
1509
 
1356
1510
  /**
@@ -1954,4 +2108,4 @@ declare class CoinAssist {
1954
2108
  static buildCoinWithBalance(amount: bigint, coin_type: string, tx: Transaction): TransactionObjectArgument;
1955
2109
  }
1956
2110
 
1957
- export { AdjustResult, Balances, BigNumber, BuildCoinResult, CLOCK_ADDRESS, CachedContent, DeepbookUtilsSDK as CetusClmmSDK, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinStoreAddress, DEEP_SCALAR, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, DataPage, DebtDetail, DeepCoin, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookUtilsModule, FLOAT_SCALAR, FLOAT_SCALING, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, InterestConfig, MarginCoinInfo, MarginPoolConfig, MarginPoolInfo, MarginUtilsModule, NFT, NORMALIZED_SUI_COIN_TYPE, OrderDeepPrice, OrderFee, OrderType, Package, PageQuery, PaginationArgs, PoolInfo, PoolState, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, SdkOptions, SelfMatchingOption, StateAccount, SuiAddressType, SuiBasicTypes, SuiInputTypes, SuiObjectDataWithContent, SuiObjectIdType, SuiResource, SuiStructTag, SuiTxArg, Token, TransactionUtil, UserBorrowInfo, YEAR_MS, addHexPrefix, asIntN, asUintN, bufferToHex, cacheTime1min, cacheTime24h, cacheTime5min, calc100PercentRepay, calcDebtDetail, calcInterestRate, calcUtilizationRate, calculateRiskRatio, checkAddress, composeType, d, decimalsMultiplier, DeepbookUtilsSDK as default, extractAddressFromType, extractStructTagFromType, fixCoinType, fixDown, fixSuiObjectId, fromDecimalsAmount, getDefaultSuiInputType, getFutureTime, getMoveObject, getMoveObjectType, getMovePackageContent, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getSuiObjectData, hasPublicTransfer, hexToNumber, hexToString, isSortedSymbols, isSuiObjectResponse, maxDecimal, mulRoundUp, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, sleepTime, toBuffer, toDecimalsAmount, utf8to16, wrapDeepBookMarginPoolInfo, wrapDeepBookPoolInfo };
2111
+ export { AddConditionalOrderOptions, AdjustResult, Balances, BigNumber, BuildCoinResult, CLOCK_ADDRESS, CachedContent, CancelAllConditionalOrdersOptions, CancelConditionalOrdersOptions, DeepbookUtilsSDK as CetusClmmSDK, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinStoreAddress, Condition, ConditionalOrder, DEEP_SCALAR, DEFAULT_GAS_BUDGET_FOR_MERGE, DEFAULT_GAS_BUDGET_FOR_SPLIT, DEFAULT_GAS_BUDGET_FOR_STAKE, DEFAULT_GAS_BUDGET_FOR_TRANSFER, DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI, DEFAULT_NFT_TRANSFER_GAS_FEE, DataPage, DebtDetail, DeepCoin, DeepbookClobV2Moudle, DeepbookCustodianV2Moudle, DeepbookEndpointsV2Moudle, DeepbookUtilsModule, FLOAT_SCALAR, FLOAT_SCALING, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, GetConditionalIdsOptions, GetConditionalOrderIdsResponse, GetConditionalOrdersOptions, InterestConfig, MarginCoinInfo, MarginPoolConfig, MarginPoolInfo, MarginUtilsModule, NFT, NORMALIZED_SUI_COIN_TYPE, OrderDeepPrice, OrderFee, OrderType, Package, PageQuery, PaginationArgs, PendingLimitOrderOptions, PendingMarketOrderOptions, PendingOrder, PoolInfo, PoolState, RpcModule, SUI_SYSTEM_STATE_OBJECT_ID, SdkOptions, SelfMatchingOption, StateAccount, SuiAddressType, SuiBasicTypes, SuiInputTypes, SuiObjectDataWithContent, SuiObjectIdType, SuiResource, SuiStructTag, SuiTxArg, Token, TransactionUtil, UserBorrowInfo, YEAR_MS, addHexPrefix, asIntN, asUintN, bufferToHex, cacheTime1min, cacheTime24h, cacheTime5min, calc100PercentRepay, calcDebtDetail, calcInterestRate, calcUtilizationRate, calculateRiskRatio, checkAddress, composeType, d, decimalsMultiplier, DeepbookUtilsSDK as default, extractAddressFromType, extractStructTagFromType, fixCoinType, fixDown, fixSuiObjectId, fromDecimalsAmount, getDefaultSuiInputType, getFutureTime, getMoveObject, getMoveObjectType, getMovePackageContent, getObjectDeletedResponse, getObjectDisplay, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectOwner, getObjectPreviousTransactionDigest, getObjectReference, getObjectType, getObjectVersion, getSuiObjectData, hasPublicTransfer, hexToNumber, hexToString, isSortedSymbols, isSuiObjectResponse, maxDecimal, mulRoundUp, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, sleepTime, toBuffer, toDecimalsAmount, utf8to16, wrapDeepBookMarginPoolInfo, wrapDeepBookPoolInfo };