@cetusprotocol/deepbook-utils 1.4.0 → 1.4.2

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
@@ -1,11 +1,11 @@
1
- import { SuiTransactionBlockResponse, SuiClient, SuiEventFilter, SuiObjectResponseQuery, SuiObjectDataOptions, CoinBalance, SuiObjectResponse, SuiObjectData, SuiObjectRef, OwnedObjectRef, SuiMoveObject, ObjectOwner, DisplayFieldsResponse, SuiParsedData } from '@mysten/sui/client';
1
+ import { PythPriceModule as PythPriceModule$1, FullClient } from '@cetusprotocol/common-sdk';
2
2
  import { SuiGraphQLClient } from '@mysten/sui/graphql';
3
+ import { SuiTransactionBlockResponse, CoinBalance, SuiObjectResponse, SuiObjectData, SuiObjectRef, OwnedObjectRef, SuiMoveObject, ObjectOwner, DisplayFieldsResponse, SuiParsedData } from '@mysten/sui/jsonRpc';
3
4
  import * as _mysten_sui_transactions from '@mysten/sui/transactions';
4
- import { TransactionArgument, Transaction, TransactionResult, TransactionObjectArgument } from '@mysten/sui/transactions';
5
- import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-js';
5
+ import { TransactionArgument, Transaction, TransactionObjectArgument, TransactionResult } from '@mysten/sui/transactions';
6
+ import Decimal from 'decimal.js';
6
7
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
7
8
  import { Secp256k1Keypair } from '@mysten/sui/keypairs/secp256k1';
8
- import Decimal from 'decimal.js';
9
9
 
10
10
  interface IModule {
11
11
  readonly sdk: DeepbookUtilsSDK;
@@ -527,7 +527,7 @@ declare class DeepbookUtilsModule implements IModule {
527
527
  /**
528
528
  * Builds coin assets for the requested amount, sourcing from the owner's coins.
529
529
  */
530
- getCoinAssets(coin: string, amount: string, allCoinAsset: any, txb: any): TransactionArgument;
530
+ getCoinAssets(coin: string, amount: string, txb: any): TransactionObjectArgument;
531
531
  /**
532
532
  * Retrieves balances related to an upcoming transaction to determine deposit needs.
533
533
  */
@@ -539,7 +539,7 @@ declare class DeepbookUtilsModule implements IModule {
539
539
  /**
540
540
  * Determines the fee asset to use and whether additional deposits are required.
541
541
  */
542
- getFeeAsset(maxFee: string, feeCoin: string, baseAmount: string, quoteAmount: string, feeManaerBalance: string, quoteIsDeep: boolean, baseIsDeep: boolean, allCoinAsset: any, payWithDeep: boolean, txb: Transaction): {
542
+ getFeeAsset(maxFee: string, feeCoin: string, baseAmount: string, quoteAmount: string, feeManaerBalance: string, quoteIsDeep: boolean, baseIsDeep: boolean, payWithDeep: boolean, txb: Transaction): {
543
543
  feeAsset: any;
544
544
  haveDepositFee: string;
545
545
  };
@@ -741,9 +741,8 @@ type Price = {
741
741
  };
742
742
  declare class PythPriceModule implements IModule {
743
743
  protected _sdk: DeepbookUtilsSDK;
744
- protected connection: SuiPriceServiceConnection;
745
- protected suiPythClient: SuiPythClient;
746
744
  protected hasChangeConnection: boolean;
745
+ protected _commonPythPrice: PythPriceModule$1;
747
746
  private readonly _cache;
748
747
  constructor(sdk: DeepbookUtilsSDK);
749
748
  get sdk(): DeepbookUtilsSDK;
@@ -807,23 +806,23 @@ declare class MarginUtilsModule implements IModule {
807
806
  createAndShareMarginManager(poolInfo: MarginPoolInfo, tx?: Transaction): {
808
807
  tx: Transaction;
809
808
  margin_manager: {
810
- $kind: "NestedResult";
811
809
  NestedResult: [number, number];
810
+ $kind: "NestedResult";
812
811
  };
813
812
  initializer: {
814
- $kind: "NestedResult";
815
813
  NestedResult: [number, number];
814
+ $kind: "NestedResult";
816
815
  };
817
816
  };
818
817
  createMarginManager(poolInfo: MarginPoolInfo, tx?: Transaction): {
819
818
  tx: Transaction;
820
819
  margin_manager: {
821
- $kind: "NestedResult";
822
820
  NestedResult: [number, number];
821
+ $kind: "NestedResult";
823
822
  };
824
823
  initializer: {
825
- $kind: "NestedResult";
826
824
  NestedResult: [number, number];
825
+ $kind: "NestedResult";
827
826
  };
828
827
  };
829
828
  shareMarginManager({ marginManager, initializer, baseCoin, quoteCoin, }: {
@@ -1513,57 +1512,6 @@ declare class MarginUtilsModule implements IModule {
1513
1512
  private normalizeConditionalOrder;
1514
1513
  }
1515
1514
 
1516
- /**
1517
- * Represents a module for making RPC (Remote Procedure Call) requests.
1518
- */
1519
- declare class RpcModule extends SuiClient {
1520
- /**
1521
- * Get events for a given query criteria
1522
- * @param query
1523
- * @param paginationArgs
1524
- * @returns
1525
- */
1526
- queryEventsByPage(query: SuiEventFilter, paginationArgs?: PaginationArgs): Promise<DataPage<any>>;
1527
- /**
1528
- * Get all objects owned by an address
1529
- * @param owner
1530
- * @param query
1531
- * @param paginationArgs
1532
- * @returns
1533
- */
1534
- getOwnedObjectsByPage(owner: string, query: SuiObjectResponseQuery, paginationArgs?: PaginationArgs): Promise<DataPage<any>>;
1535
- /**
1536
- * Return the list of dynamic field objects owned by an object
1537
- * @param parentId
1538
- * @param paginationArgs
1539
- * @returns
1540
- */
1541
- getDynamicFieldsByPage(parentId: SuiObjectIdType, paginationArgs?: PaginationArgs): Promise<DataPage<any>>;
1542
- /**
1543
- * Batch get details about a list of objects. If any of the object ids are duplicates the call will fail
1544
- * @param ids
1545
- * @param options
1546
- * @param limit
1547
- * @returns
1548
- */
1549
- batchGetObjects(ids: SuiObjectIdType[], options?: SuiObjectDataOptions, limit?: number): Promise<any[]>;
1550
- /**
1551
- * Calculates the gas cost of a transaction block.
1552
- * @param {Transaction} tx - The transaction block to calculate gas for.
1553
- * @returns {Promise<number>} - The estimated gas cost of the transaction block.
1554
- * @throws {Error} - Throws an error if the sender is empty.
1555
- */
1556
- calculationTxGas(tx: Transaction): Promise<number>;
1557
- /**
1558
- * Sends a transaction block after signing it with the provided keypair.
1559
- *
1560
- * @param {Ed25519Keypair | Secp256k1Keypair} keypair - The keypair used for signing the transaction.
1561
- * @param {Transaction} tx - The transaction block to send.
1562
- * @returns {Promise<SuiTransactionBlockResponse | undefined>} - The response of the sent transaction block.
1563
- */
1564
- sendTransaction(keypair: Ed25519Keypair | Secp256k1Keypair, tx: Transaction): Promise<SuiTransactionBlockResponse | undefined>;
1565
- }
1566
-
1567
1515
  /**
1568
1516
  * Represents options and configurations for an SDK.
1569
1517
  */
@@ -1628,7 +1576,7 @@ declare class DeepbookUtilsSDK {
1628
1576
  /**
1629
1577
  * RPC provider on the SUI chain
1630
1578
  */
1631
- protected _rpcModule: RpcModule;
1579
+ protected _rpcModule: FullClient;
1632
1580
  protected _deepbookUtils: any;
1633
1581
  protected _marginUtils: any;
1634
1582
  protected _pythPrice: PythPriceModule;
@@ -1657,9 +1605,9 @@ declare class DeepbookUtilsSDK {
1657
1605
  get PythPrice(): PythPriceModule;
1658
1606
  /**
1659
1607
  * Getter for the fullClient property.
1660
- * @returns {RpcModule} The fullClient property value.
1608
+ * @returns {FullClient} The fullClient property value.
1661
1609
  */
1662
- get fullClient(): RpcModule;
1610
+ get fullClient(): FullClient;
1663
1611
  get graphqlClient(): SuiGraphQLClient;
1664
1612
  /**
1665
1613
  * Getter for the sdkOptions property.
@@ -2114,4 +2062,4 @@ declare class CoinAssist {
2114
2062
  static buildCoinWithBalance(amount: bigint, coin_type: string, tx: Transaction): TransactionObjectArgument;
2115
2063
  }
2116
2064
 
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 };
2065
+ 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, 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 };