@cetusprotocol/deepbook-utils 1.2.0 → 1.4.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
 
@@ -768,7 +849,10 @@ declare class MarginUtilsModule implements IModule {
768
849
  * @returns {Promise<any[]>} Array of margin manager information
769
850
  * @throws {Error} If account is invalid or query fails
770
851
  */
771
- getMarginManagerByAccount(account: string): Promise<any[]>;
852
+ getMarginManagerByAccount(account: string): Promise<never[] | {
853
+ finalResult: any[];
854
+ referralMap: Map<string, any>;
855
+ }>;
772
856
  /**
773
857
  * Gets the base coin balance for a margin manager.
774
858
  *
@@ -1104,6 +1188,7 @@ declare class MarginUtilsModule implements IModule {
1104
1188
  isBase: boolean;
1105
1189
  amount?: string;
1106
1190
  }, tx?: Transaction): Promise<Transaction>;
1191
+ removeReferralKey: (marginManager: string | TransactionArgument, poolId: string, baseCoinType: string, quoteCoinType: string, tx?: Transaction) => TransactionResult;
1107
1192
  /**
1108
1193
  * Places a market order for margin trading.
1109
1194
  * Market orders are executed immediately at the current market price.
@@ -1119,7 +1204,7 @@ declare class MarginUtilsModule implements IModule {
1119
1204
  * @returns {Promise<Transaction>} The transaction object with market order operation
1120
1205
  * @throws {Error} If parameters are invalid or decimals are missing
1121
1206
  */
1122
- placeMarginMarketOrder({ marginManager, poolInfo, selfMatchingOption, quantity, amountLimit, isBid, payWithDeep, exactBase, }: {
1207
+ placeMarginMarketOrder({ marginManager, poolInfo, selfMatchingOption, quantity, amountLimit, isBid, payWithDeep, exactBase, referralKey, }: {
1123
1208
  marginManager: string | TransactionArgument;
1124
1209
  poolInfo: MarginPoolInfo;
1125
1210
  selfMatchingOption: SelfMatchingOption;
@@ -1128,6 +1213,7 @@ declare class MarginUtilsModule implements IModule {
1128
1213
  isBid: boolean;
1129
1214
  payWithDeep: boolean;
1130
1215
  exactBase?: boolean;
1216
+ referralKey?: string;
1131
1217
  }, tx?: Transaction): Promise<Transaction>;
1132
1218
  /**
1133
1219
  * Places a limit order for margin trading.
@@ -1147,7 +1233,7 @@ declare class MarginUtilsModule implements IModule {
1147
1233
  * @returns {Promise<Transaction>} The transaction object with limit order operation
1148
1234
  * @throws {Error} If parameters are invalid or decimals are missing
1149
1235
  */
1150
- placeMarginLimitOrder({ marginManager, poolInfo, orderType, selfMatchingOption, priceInput, quantity, isBid, payWithDeep, expirationTimestamp, }: {
1236
+ placeMarginLimitOrder({ marginManager, poolInfo, orderType, selfMatchingOption, priceInput, quantity, isBid, payWithDeep, expirationTimestamp, referralKey, }: {
1151
1237
  marginManager: string;
1152
1238
  poolInfo: MarginPoolInfo;
1153
1239
  orderType: OrderType;
@@ -1157,6 +1243,7 @@ declare class MarginUtilsModule implements IModule {
1157
1243
  isBid: boolean;
1158
1244
  payWithDeep: boolean;
1159
1245
  expirationTimestamp?: number;
1246
+ referralKey?: string;
1160
1247
  }, tx?: Transaction): Promise<Transaction>;
1161
1248
  /**
1162
1249
  * Modifies an existing margin order by updating its quantity.
@@ -1417,6 +1504,13 @@ declare class MarginUtilsModule implements IModule {
1417
1504
  quoteMarginPool: string;
1418
1505
  }[];
1419
1506
  }): Promise<any>;
1507
+ addConditionalOrder(options: AddConditionalOrderOptions, tx: Transaction): Promise<void>;
1508
+ private newPendingOrder;
1509
+ cancelAllConditionalOrders(options: CancelAllConditionalOrdersOptions, tx: Transaction): void;
1510
+ cancelConditionalOrders(options: CancelConditionalOrdersOptions, tx: Transaction): void;
1511
+ getConditionalOrders(options: GetConditionalOrdersOptions[], tx: Transaction): Promise<ConditionalOrder[]>;
1512
+ getConditionalOrderIds(options: GetConditionalIdsOptions[], tx?: Transaction): Promise<Record<string, GetConditionalOrderIdsResponse>>;
1513
+ private normalizeConditionalOrder;
1420
1514
  }
1421
1515
 
1422
1516
  /**
@@ -2020,4 +2114,4 @@ declare class CoinAssist {
2020
2114
  static buildCoinWithBalance(amount: bigint, coin_type: string, tx: Transaction): TransactionObjectArgument;
2021
2115
  }
2022
2116
 
2023
- 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 };
2117
+ 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 };