@cetusprotocol/deepbook-utils 1.4.7 → 1.4.8

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.
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ presets: [
3
+ [
4
+ '@babel/preset-env',
5
+ {
6
+ targets: { node: 'current' },
7
+ modules: 'commonjs'
8
+ }
9
+ ]
10
+ ]
11
+ }
package/biome.json CHANGED
@@ -47,12 +47,15 @@
47
47
  "noForEach": "off",
48
48
  "useOptionalChain": "off",
49
49
  "noStaticOnlyClass": "off",
50
- "noUselessTernary": "off"
50
+ "noUselessTernary": "off",
51
+ "noThisInStatic": "off"
51
52
  },
52
53
  "correctness": {
53
54
  "noUnusedImports": "warn",
54
55
  "useExhaustiveDependencies": "off",
55
- "noUnusedVariables": "off"
56
+ "noUnusedVariables": "off",
57
+ "noUnnecessaryContinue": "off",
58
+ "noConstantCondition": "off"
56
59
  },
57
60
  "style": {
58
61
  "noParameterAssign": "off",
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { PythPriceModule as PythPriceModule$1, FullClient } from '@cetusprotocol/common-sdk';
2
- import { SuiGraphQLClient } from '@mysten/sui/graphql';
3
- import { SuiObjectResponse, SuiTransactionBlockResponse, CoinBalance, SuiObjectData, SuiObjectRef, OwnedObjectRef, SuiMoveObject, ObjectOwner, DisplayFieldsResponse, SuiParsedData } from '@mysten/sui/jsonRpc';
4
2
  import * as _mysten_sui_transactions from '@mysten/sui/transactions';
5
- import { TransactionArgument, Transaction, TransactionObjectArgument, TransactionResult } from '@mysten/sui/transactions';
3
+ import { TransactionArgument, TransactionObjectArgument, Transaction, TransactionResult } from '@mysten/sui/transactions';
4
+ import { SuiClientTypes } from '@mysten/sui/client';
5
+ import { SuiObjectResponse, SuiObjectData, SuiObjectRef, OwnedObjectRef, SuiMoveObject, SuiParsedData } from '@mysten/sui/jsonRpc';
6
6
  import Decimal from 'decimal.js';
7
7
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
8
8
  import { Secp256k1Keypair } from '@mysten/sui/keypairs/secp256k1';
@@ -148,22 +148,9 @@ type SuiInputTypes = 'object' | SuiBasicTypes;
148
148
  */
149
149
  declare const getDefaultSuiInputType: (value: any) => SuiInputTypes;
150
150
  /**
151
- * Represents a coin asset with address, object ID, and balance information.
151
+ * Error handling RPC priority list
152
152
  */
153
- type CoinAsset = {
154
- /**
155
- * The address type of the coin asset.
156
- */
157
- coinAddress: SuiAddressType;
158
- /**
159
- * The object identifier of the coin asset.
160
- */
161
- coinObjectId: SuiObjectIdType;
162
- /**
163
- * The balance amount of the coin asset.
164
- */
165
- balance: bigint;
166
- };
153
+ declare const ERROR_HANDLING_RPC_LIST: string[];
167
154
 
168
155
  /**
169
156
  * Represents configuration data for a cryptocurrency coin.
@@ -352,6 +339,45 @@ type ConditionalOrder = {
352
339
  pending_order: PendingOrder;
353
340
  };
354
341
 
342
+ /**
343
+ * Represents a coin asset with address, object ID, and balance information.
344
+ */
345
+ type CoinAsset = {
346
+ /**
347
+ * The address type of the coin asset.
348
+ */
349
+ coin_type: string;
350
+ /**
351
+ * The object identifier of the coin asset.
352
+ */
353
+ coin_object_id: SuiObjectIdType;
354
+ /**
355
+ * The balance amount of the coin asset.
356
+ */
357
+ balance: bigint;
358
+ };
359
+ type BuildCoinResult = {
360
+ target_coin: TransactionObjectArgument;
361
+ selected_coins: string[];
362
+ remain_coins: CoinAsset[];
363
+ is_mint_zero_coin: boolean;
364
+ target_coin_amount: string;
365
+ original_spited_coin?: TransactionObjectArgument;
366
+ };
367
+ type CoinInputInterval = {
368
+ amount_second: bigint;
369
+ amount_first: bigint;
370
+ };
371
+ type MultiCoinInput = {
372
+ amount_coin_array: {
373
+ coin_object_id: TransactionObjectArgument;
374
+ amount: string;
375
+ used: boolean;
376
+ }[];
377
+ coin_type: string;
378
+ remain_coins: CoinAsset[];
379
+ };
380
+
355
381
  type BigNumber = Decimal.Value | number | string;
356
382
 
357
383
  declare const DEEP_SCALAR = 1000000;
@@ -544,17 +570,17 @@ declare class DeepbookUtilsModule implements IModule {
544
570
  * Determines the fee asset to use and whether additional deposits are required.
545
571
  */
546
572
  getFeeAsset(maxFee: string, feeCoin: string, baseAmount: string, quoteAmount: string, feeManaerBalance: string, quoteIsDeep: boolean, baseIsDeep: boolean, payWithDeep: boolean, txb: Transaction): {
547
- feeAsset: any;
573
+ feeAsset: TransactionObjectArgument;
548
574
  haveDepositFee: string;
549
575
  };
550
576
  /**
551
577
  * Prepares the assets necessary to execute a limit order transaction.
552
578
  */
553
579
  getTransactionRelatedAssets(poolInfo: any, baseAmount: string, quoteAmount: string, maxFee: string, isBid: boolean, account: string, payWithDeep: boolean, balanceManager: string, txb: Transaction): Promise<{
554
- baseAsset: any;
555
- quoteAsset: any;
580
+ baseAsset: TransactionObjectArgument;
581
+ quoteAsset: TransactionObjectArgument;
556
582
  feeAsset: {
557
- feeAsset: any;
583
+ feeAsset: TransactionObjectArgument;
558
584
  haveDepositFee: string;
559
585
  };
560
586
  haveDeposit: boolean;
@@ -566,9 +592,9 @@ declare class DeepbookUtilsModule implements IModule {
566
592
  base: string;
567
593
  quote: string;
568
594
  }): Promise<{
569
- baseAsset: any;
570
- quoteAsset: any;
571
- feeAsset: any;
595
+ baseAsset: TransactionObjectArgument | Transaction;
596
+ quoteAsset: TransactionObjectArgument | Transaction;
597
+ feeAsset: TransactionObjectArgument;
572
598
  }>;
573
599
  /**
574
600
  * Creates a transaction that deposits required assets and then places a limit order.
@@ -584,7 +610,7 @@ declare class DeepbookUtilsModule implements IModule {
584
610
  payWithDeep: boolean;
585
611
  expirationTimestamp?: number;
586
612
  }): Promise<any>;
587
- getEmptyCoin(txb: any, coin: string): any;
613
+ getEmptyCoin(txb: any, coin: string): TransactionObjectArgument;
588
614
  /**
589
615
  * Creates a transaction that deposits necessary assets and places a market order.
590
616
  */
@@ -687,7 +713,12 @@ declare class DeepbookUtilsModule implements IModule {
687
713
  ask?: undefined;
688
714
  }>;
689
715
  getWalletBalance(account: string): Promise<{
690
- [k: string]: any;
716
+ [k: string]: {
717
+ coinType: any;
718
+ totalBalance: any;
719
+ coinBalance: any;
720
+ addressBalance: any;
721
+ };
691
722
  }>;
692
723
  getAccount(balanceManager: string | TransactionArgument, poolList: any, txb?: Transaction): Promise<StateAccount[] | null>;
693
724
  /**
@@ -696,7 +727,7 @@ declare class DeepbookUtilsModule implements IModule {
696
727
  * @param forceRefresh - A boolean flag indicating whether to force a refresh of the response.
697
728
  * @returns A Promise that resolves with the SUI transaction block response or null if the response is not available.
698
729
  */
699
- getSuiTransactionResponse(digest: string, forceRefresh?: boolean): Promise<SuiTransactionBlockResponse | null>;
730
+ getSuiTransactionResponse(digest: string, forceRefresh?: boolean): Promise<SuiClientTypes.TransactionResult | null>;
700
731
  private transformExtensions;
701
732
  /**
702
733
  * Get coin config list.
@@ -754,7 +785,7 @@ declare class PythPriceModule implements IModule {
754
785
  private readonly _cache;
755
786
  constructor(sdk: DeepbookUtilsSDK);
756
787
  get sdk(): DeepbookUtilsSDK;
757
- updatePythPriceIDs(priceIDs: string[], txb: Transaction): Promise<Map<string, string>>;
788
+ updatePythPriceIDs(priceIDs: string[], txb: any): Promise<Map<string, string>>;
758
789
  /**
759
790
  * Checks if the price has been updated within the last 60 seconds.
760
791
  *
@@ -1351,6 +1382,7 @@ declare class MarginUtilsModule implements IModule {
1351
1382
  payWithDeep: boolean;
1352
1383
  expirationTimestamp: number;
1353
1384
  }, tx?: Transaction): Transaction;
1385
+ getOpenOrder(poolInfo: any, account: string, balanceManager: string | TransactionArgument, orders?: string[], isMargin?: boolean, tx?: Transaction): Promise<any>;
1354
1386
  getAccountOpenOrders({ poolInfo, marginManager }: {
1355
1387
  poolInfo: PoolInfo;
1356
1388
  marginManager: string;
@@ -1440,7 +1472,7 @@ declare class MarginUtilsModule implements IModule {
1440
1472
  quote_amount: string;
1441
1473
  deep_fee_amount: string;
1442
1474
  }>;
1443
- getAccount(marginManager: string, poolInfo: any): Promise<StateAccount[] | null>;
1475
+ getAccount(marginManager: string, poolInfo: any, txb?: Transaction): Promise<StateAccount[] | null>;
1444
1476
  withdrawSettledAmounts({ poolInfo, marginManager, }: {
1445
1477
  poolInfo: any;
1446
1478
  marginManager: string;
@@ -1616,7 +1648,6 @@ type SdkOptions = {
1616
1648
  * The entry class of CetusClmmSDK, which is almost responsible for all interactions with CLMM.
1617
1649
  */
1618
1650
  declare class DeepbookUtilsSDK {
1619
- private readonly _cache;
1620
1651
  /**
1621
1652
  * RPC provider on the SUI chain
1622
1653
  */
@@ -1624,7 +1655,6 @@ declare class DeepbookUtilsSDK {
1624
1655
  protected _deepbookUtils: any;
1625
1656
  protected _marginUtils: any;
1626
1657
  protected _pythPrice: PythPriceModule;
1627
- protected _graphqlClient: SuiGraphQLClient;
1628
1658
  /**
1629
1659
  * Provide sdk options
1630
1660
  */
@@ -1652,44 +1682,11 @@ declare class DeepbookUtilsSDK {
1652
1682
  * @returns {FullClient} The fullClient property value.
1653
1683
  */
1654
1684
  get fullClient(): FullClient;
1655
- get graphqlClient(): SuiGraphQLClient;
1656
1685
  /**
1657
1686
  * Getter for the sdkOptions property.
1658
1687
  * @returns {SdkOptions} The sdkOptions property value.
1659
1688
  */
1660
1689
  get sdkOptions(): SdkOptions;
1661
- /**
1662
- * Gets all coin assets for the given owner and coin type.
1663
- *
1664
- * @param suiAddress The address of the owner.
1665
- * @param coinType The type of the coin.
1666
- * @returns an array of coin assets.
1667
- */
1668
- getOwnerCoinAssets(suiAddress: string, coinType?: string | null, forceRefresh?: boolean): Promise<CoinAsset[]>;
1669
- /**
1670
- * Gets all coin balances for the given owner and coin type.
1671
- *
1672
- * @param suiAddress The address of the owner.
1673
- * @param coinType The type of the coin.
1674
- * @returns an array of coin balances.
1675
- */
1676
- getOwnerCoinBalances(suiAddress: string, coinType?: string | null): Promise<CoinBalance[]>;
1677
- /**
1678
- * Updates the cache for the given key.
1679
- *
1680
- * @param key The key of the cache entry to update.
1681
- * @param data The data to store in the cache.
1682
- * @param time The time in minutes after which the cache entry should expire.
1683
- */
1684
- updateCache(key: string, data: SuiResource, time?: number): void;
1685
- /**
1686
- * Gets the cache entry for the given key.
1687
- *
1688
- * @param key The key of the cache entry to get.
1689
- * @param forceRefresh Whether to force a refresh of the cache entry.
1690
- * @returns The cache entry for the given key, or undefined if the cache entry does not exist or is expired.
1691
- */
1692
- getCache<T>(key: string, forceRefresh?: boolean): T | undefined;
1693
1690
  }
1694
1691
 
1695
1692
  declare const cacheTime1min: number;
@@ -1756,66 +1753,17 @@ declare function decimalsMultiplier(decimals?: Decimal.Value): Decimal.Instance;
1756
1753
  declare const fixDown: (value: string | number, decimal: number) => string | number;
1757
1754
  declare const maxDecimal: (value1: Decimal.Value, value2: Decimal.Value) => Decimal.Instance;
1758
1755
 
1759
- type AdjustResult = {
1760
- isAdjustCoinA: boolean;
1761
- isAdjustCoinB: boolean;
1762
- };
1763
- type BuildCoinResult = {
1764
- targetCoin: TransactionArgument;
1765
- remainCoins: CoinAsset[];
1766
- isMintZeroCoin: boolean;
1767
- tragetCoinAmount: string;
1768
- originalSplitedCoin?: TransactionArgument;
1769
- };
1770
- type CoinInputInterval = {
1771
- amountSecond: bigint;
1772
- amountFirst: bigint;
1773
- };
1774
- declare function printTransaction(tx: Transaction, isPrint?: boolean): Promise<void>;
1775
- declare class TransactionUtil {
1776
- /**
1777
- * adjust transaction for gas
1778
- * @param sdk
1779
- * @param amount
1780
- * @param tx
1781
- * @returns
1782
- */
1783
- static adjustTransactionForGas(sdk: DeepbookUtilsSDK, allCoins: CoinAsset[], amount: bigint, tx: Transaction): Promise<{
1784
- fixAmount: bigint;
1785
- newTx?: Transaction;
1786
- }>;
1787
- static buildCoinForAmount(tx: Transaction, allCoins: CoinAsset[], amount: bigint, coinType: string, buildVector?: boolean, fixAmount?: boolean): BuildCoinResult;
1788
- static buildCoin(tx: Transaction, allCoins: CoinAsset[], coinAssets: CoinAsset[], amount: bigint, coinType: string, buildVector?: boolean, fixAmount?: boolean): BuildCoinResult;
1789
- private static buildZeroValueCoin;
1790
- static buildCoinForAmountInterval(tx: Transaction, allCoins: CoinAsset[], amounts: CoinInputInterval, coinType: string, buildVector?: boolean): BuildCoinResult;
1791
- static callMintZeroValueCoin: (txb: Transaction, coinType: string) => _mysten_sui_transactions.TransactionResult;
1792
- static buildCoinTypePair(coinTypes: string[], partitionQuantities: number[]): string[][];
1793
- }
1794
-
1795
1756
  declare function getSuiObjectData(resp: SuiObjectResponse): SuiObjectData | null | undefined;
1796
1757
  declare function getObjectDeletedResponse(resp: SuiObjectResponse): SuiObjectRef | undefined;
1797
1758
  declare function getObjectNotExistsResponse(resp: SuiObjectResponse): string | undefined;
1798
1759
  declare function getObjectReference(resp: SuiObjectResponse | OwnedObjectRef): SuiObjectRef | undefined;
1799
1760
  declare function getObjectId(data: SuiObjectResponse | SuiObjectRef | OwnedObjectRef): string;
1800
- declare function getObjectVersion(data: SuiObjectResponse | SuiObjectRef | SuiObjectData): string | number | undefined;
1801
1761
  declare function isSuiObjectResponse(resp: SuiObjectResponse | SuiObjectData): resp is SuiObjectResponse;
1802
- declare function getMovePackageContent(data: SuiObjectResponse): any | undefined;
1803
1762
  declare function getMoveObject(data: SuiObjectResponse | SuiObjectData): SuiMoveObject | undefined;
1804
- declare function getMoveObjectType(resp: SuiObjectResponse): string | undefined;
1805
- /**
1806
- * Deriving the object type from the object response
1807
- * @returns 'package' if the object is a package, move object type(e.g., 0x2::coin::Coin<0x2::sui::SUI>)
1808
- * if the object is a move object
1809
- */
1810
- declare function getObjectType(resp: SuiObjectResponse | SuiObjectData): string | null | undefined;
1811
- declare function getObjectPreviousTransactionDigest(resp: SuiObjectResponse): string | null | undefined;
1812
- declare function getObjectOwner(resp: SuiObjectResponse): ObjectOwner | null | undefined;
1813
- declare function getObjectDisplay(resp: SuiObjectResponse): DisplayFieldsResponse;
1814
1763
  declare function getObjectFields(resp: SuiObjectResponse | SuiObjectData): any | undefined;
1815
1764
  interface SuiObjectDataWithContent extends SuiObjectData {
1816
1765
  content: SuiParsedData;
1817
1766
  }
1818
- declare function hasPublicTransfer(data: SuiObjectResponse | SuiObjectData): boolean;
1819
1767
 
1820
1768
  /**
1821
1769
  * Converts an amount to a decimal value, based on the number of decimals specified.
@@ -1847,19 +1795,20 @@ declare function asIntN(int: bigint, bits?: number): number;
1847
1795
  declare function fromDecimalsAmount(amount: number | string, decimals: number | string): number;
1848
1796
  /**
1849
1797
  * Converts a secret key in string or Uint8Array format to an Ed25519 key pair.
1850
- * @param {string|Uint8Array} secretKey - The secret key to convert.
1798
+ * @param {string|Uint8Array} secret_key - The secret key to convert.
1851
1799
  * @param {string} ecode - The encoding of the secret key ('hex' or 'base64'). Defaults to 'hex'.
1852
1800
  * @returns {Ed25519Keypair} - Returns the Ed25519 key pair.
1853
1801
  */
1854
- declare function secretKeyToEd25519Keypair(secretKey: string | Uint8Array, ecode?: 'hex' | 'base64'): Ed25519Keypair;
1802
+ declare function secretKeyToEd25519Keypair(secret_key: string | Uint8Array, ecode?: 'hex' | 'base64'): Ed25519Keypair;
1855
1803
  /**
1856
1804
  * Converts a secret key in string or Uint8Array format to a Secp256k1 key pair.
1857
- * @param {string|Uint8Array} secretKey - The secret key to convert.
1805
+ * @param {string|Uint8Array} secret_key - The secret key to convert.
1858
1806
  * @param {string} ecode - The encoding of the secret key ('hex' or 'base64'). Defaults to 'hex'.
1859
1807
  * @returns {Ed25519Keypair} - Returns the Secp256k1 key pair.
1860
1808
  */
1861
- declare function secretKeyToSecp256k1Keypair(secretKey: string | Uint8Array, ecode?: 'hex' | 'base64'): Secp256k1Keypair;
1809
+ declare function secretKeyToSecp256k1Keypair(secret_key: string | Uint8Array, ecode?: 'hex' | 'base64'): Secp256k1Keypair;
1862
1810
  declare const sleepTime: (s: number) => Promise<unknown>;
1811
+ declare function printTransaction(tx: Transaction, is_print?: boolean): Promise<void>;
1863
1812
 
1864
1813
  declare const calculateRiskRatio: ({ totalAssetsValue, totalDebtValue }: {
1865
1814
  totalAssetsValue: string;
@@ -1992,77 +1941,29 @@ declare const SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000
1992
1941
  * This class provides helper methods for working with coins.
1993
1942
  */
1994
1943
  declare class CoinAssist {
1995
- /**
1996
- * Get the coin type argument from a SuiMoveObject.
1997
- *
1998
- * @param obj The SuiMoveObject to get the coin type argument from.
1999
- * @returns The coin type argument, or null if it is not found.
2000
- */
2001
- static getCoinTypeArg(obj: SuiMoveObject): string | null;
2002
- /**
2003
- * Get whether a SuiMoveObject is a SUI coin.
2004
- *
2005
- * @param obj The SuiMoveObject to check.
2006
- * @returns Whether the SuiMoveObject is a SUI coin.
2007
- */
2008
- static isSUI(obj: SuiMoveObject): boolean;
2009
- /**
2010
- * Get the coin symbol from a coin type argument.
2011
- *
2012
- * @param coinTypeArg The coin type argument to get the symbol from.
2013
- * @returns The coin symbol.
2014
- */
2015
- static getCoinSymbol(coinTypeArg: string): string;
2016
- /**
2017
- * Get the balance of a SuiMoveObject.
2018
- *
2019
- * @param obj The SuiMoveObject to get the balance from.
2020
- * @returns The balance of the SuiMoveObject.
2021
- */
2022
- static getBalance(obj: SuiMoveObject): bigint;
2023
1944
  /**
2024
1945
  * Get the total balance of a list of CoinAsset objects for a given coin address.
2025
1946
  *
2026
1947
  * @param objs The list of CoinAsset objects to get the total balance for.
2027
- * @param coinAddress The coin address to get the total balance for.
1948
+ * @param coin_address The coin address to get the total balance for.
2028
1949
  * @returns The total balance of the CoinAsset objects for the given coin address.
2029
1950
  */
2030
- static totalBalance(objs: CoinAsset[], coinAddress: SuiAddressType): bigint;
2031
- /**
2032
- * Get the ID of a SuiMoveObject.
2033
- *
2034
- * @param obj The SuiMoveObject to get the ID from.
2035
- * @returns The ID of the SuiMoveObject.
2036
- */
2037
- static getID(obj: SuiMoveObject): string;
2038
- /**
2039
- * Get the coin type from a coin type argument.
2040
- *
2041
- * @param coinTypeArg The coin type argument to get the coin type from.
2042
- * @returns The coin type.
2043
- */
2044
- static getCoinTypeFromArg(coinTypeArg: string): string;
2045
- /**
2046
- * Get the FaucetCoin objects from a SuiTransactionBlockResponse.
2047
- *
2048
- * @param suiTransactionResponse The SuiTransactionBlockResponse to get the FaucetCoin objects from.
2049
- * @returns The FaucetCoin objects.
2050
- */
1951
+ static totalBalance(objs: CoinAsset[], coin_address: SuiAddressType): bigint;
2051
1952
  /**
2052
1953
  * Get the CoinAsset objects for a given coin type.
2053
1954
  *
2054
- * @param coinType The coin type to get the CoinAsset objects for.
2055
- * @param allSuiObjects The list of all SuiMoveObjects.
1955
+ * @param coin_type The coin type to get the CoinAsset objects for.
1956
+ * @param all_sui_objects The list of all SuiMoveObjects.
2056
1957
  * @returns The CoinAsset objects for the given coin type.
2057
1958
  */
2058
- static getCoinAssets(coinType: string, allSuiObjects: CoinAsset[]): CoinAsset[];
1959
+ static getCoinAssets(coin_type: string, all_sui_objects: CoinAsset[]): CoinAsset[];
2059
1960
  /**
2060
1961
  * Get whether a coin address is a SUI coin.
2061
1962
  *
2062
- * @param coinAddress The coin address to check.
1963
+ * @param coin_address The coin address to check.
2063
1964
  * @returns Whether the coin address is a SUI coin.
2064
1965
  */
2065
- static isSuiCoin(coinAddress: SuiAddressType): boolean;
1966
+ static isSuiCoin(coin_address: SuiAddressType): boolean;
2066
1967
  /**
2067
1968
  * Select the CoinAsset objects from a list of CoinAsset objects that have a balance greater than or equal to a given amount.
2068
1969
  *
@@ -2072,9 +1973,9 @@ declare class CoinAssist {
2072
1973
  * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
2073
1974
  */
2074
1975
  static selectCoinObjectIdGreaterThanOrEqual(coins: CoinAsset[], amount: bigint, exclude?: string[]): {
2075
- objectArray: string[];
2076
- remainCoins: CoinAsset[];
2077
- amountArray: string[];
1976
+ object_array: string[];
1977
+ remain_coins: CoinAsset[];
1978
+ amount_array: string[];
2078
1979
  };
2079
1980
  /**
2080
1981
  * Select the CoinAsset objects from a list of CoinAsset objects that have a balance greater than or equal to a given amount.
@@ -2085,8 +1986,8 @@ declare class CoinAssist {
2085
1986
  * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
2086
1987
  */
2087
1988
  static selectCoinAssetGreaterThanOrEqual(coins: CoinAsset[], amount: bigint, exclude?: string[]): {
2088
- selectedCoins: CoinAsset[];
2089
- remainingCoins: CoinAsset[];
1989
+ selected_coins: CoinAsset[];
1990
+ remain_coins: CoinAsset[];
2090
1991
  };
2091
1992
  /**
2092
1993
  * Sort the CoinAsset objects by their balance.
@@ -2103,7 +2004,21 @@ declare class CoinAssist {
2103
2004
  * @returns The total balance of the CoinAsset objects.
2104
2005
  */
2105
2006
  static calculateTotalBalance(coins: CoinAsset[]): bigint;
2007
+ static buildCoinForAmount(tx: Transaction, all_coins: CoinAsset[], amount: bigint, coin_type: string, build_vector?: boolean, fix_amount?: boolean): BuildCoinResult;
2106
2008
  static buildCoinWithBalance(amount: bigint, coin_type: string, tx: Transaction): TransactionObjectArgument;
2009
+ private static buildVectorCoin;
2010
+ private static buildOneCoin;
2011
+ private static buildSpitTargeCoin;
2012
+ private static buildCoin;
2013
+ private static buildZeroValueCoin;
2014
+ static buildCoinForAmountInterval(tx: Transaction, all_coins: CoinAsset[], amounts: CoinInputInterval, coin_type: string, build_vector?: boolean, fix_amount?: boolean): BuildCoinResult;
2015
+ static callMintZeroValueCoin: (txb: Transaction, coin_type: string) => _mysten_sui_transactions.TransactionResult;
2016
+ static fromBalance(balance: TransactionObjectArgument, coin_type: string, tx: Transaction): TransactionObjectArgument;
2017
+ static intoBalance(coin_obj: TransactionObjectArgument | string, coin_type: string, tx: Transaction): TransactionObjectArgument;
2018
+ static mintBalanceZero(coin_type: string, tx: Transaction): TransactionObjectArgument;
2019
+ static destroyBalanceZero(balance: TransactionObjectArgument, coin_type: string, tx: Transaction): TransactionObjectArgument;
2020
+ static getCoinAmountObjId(coin_input: MultiCoinInput, amount: string): TransactionObjectArgument;
2021
+ static buildMultiCoinInput(tx: Transaction, all_coin_assets: CoinAsset[], coin_type: string, amount_arr: bigint[]): MultiCoinInput;
2107
2022
  }
2108
2023
 
2109
- 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 };
2024
+ export { AddConditionalOrderOptions, Balances, BigNumber, BuildCoinResult, CLOCK_ADDRESS, CachedContent, CancelAllConditionalOrdersOptions, CancelConditionalOrdersOptions, DeepbookUtilsSDK as CetusClmmSDK, ClmmExpectSwapModule, ClmmFetcherModule, ClmmIntegratePoolModule, ClmmIntegratePoolV2Module, ClmmIntegrateRouterModule, ClmmIntegrateRouterWithPartnerModule, ClmmIntegrateUtilsModule, CoinAsset, CoinAssist, CoinConfig, CoinInfoAddress, CoinInputInterval, 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, ERROR_HANDLING_RPC_LIST, FLOAT_SCALAR, FLOAT_SCALING, GAS_SYMBOL, GAS_TYPE_ARG, GAS_TYPE_ARG_LONG, GetConditionalIdsOptions, GetConditionalOrderIdsResponse, GetConditionalOrdersOptions, InterestConfig, MarginCoinInfo, MarginPoolConfig, MarginPoolInfo, MarginUtilsModule, MultiCoinInput, 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, 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, getObjectDeletedResponse, getObjectFields, getObjectId, getObjectNotExistsResponse, getObjectReference, getSuiObjectData, hexToNumber, hexToString, isSortedSymbols, isSuiObjectResponse, maxDecimal, mulRoundUp, normalizeCoinType, patchFixSuiObjectId, printTransaction, removeHexPrefix, secretKeyToEd25519Keypair, secretKeyToSecp256k1Keypair, shortAddress, shortString, sleepTime, toBuffer, toDecimalsAmount, utf8to16, wrapDeepBookMarginPoolInfo, wrapDeepBookPoolInfo };