@cetusprotocol/aggregator-sdk 0.4.0 → 0.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.
Files changed (102) hide show
  1. package/README.md +19 -8
  2. package/dist/index.d.mts +14 -3
  3. package/dist/index.d.ts +14 -3
  4. package/dist/index.js +25 -27
  5. package/dist/index.mjs +26 -28
  6. package/package.json +1 -1
  7. package/dist/src/api.d.ts +0 -104
  8. package/dist/src/client.d.ts +0 -107
  9. package/dist/src/const.d.ts +0 -8
  10. package/dist/src/errors.d.ts +0 -40
  11. package/dist/src/index.d.ts +0 -9
  12. package/dist/src/math.d.ts +0 -6
  13. package/dist/src/transaction/afsui.d.ts +0 -10
  14. package/dist/src/transaction/aftermath.d.ts +0 -13
  15. package/dist/src/transaction/alphafi.d.ts +0 -7
  16. package/dist/src/transaction/bluefin.d.ts +0 -7
  17. package/dist/src/transaction/bluemove.d.ts +0 -7
  18. package/dist/src/transaction/cetus.d.ts +0 -15
  19. package/dist/src/transaction/deepbook_v2.d.ts +0 -14
  20. package/dist/src/transaction/deepbook_v3.d.ts +0 -12
  21. package/dist/src/transaction/flowx_v2.d.ts +0 -7
  22. package/dist/src/transaction/flowx_v3.d.ts +0 -8
  23. package/dist/src/transaction/haedal.d.ts +0 -6
  24. package/dist/src/transaction/haedal_pmm.d.ts +0 -7
  25. package/dist/src/transaction/index.d.ts +0 -10
  26. package/dist/src/transaction/kriya_v2.d.ts +0 -6
  27. package/dist/src/transaction/kriya_v3.d.ts +0 -7
  28. package/dist/src/transaction/metastable.d.ts +0 -8
  29. package/dist/src/transaction/obric.d.ts +0 -8
  30. package/dist/src/transaction/scallop.d.ts +0 -8
  31. package/dist/src/transaction/steamm.d.ts +0 -6
  32. package/dist/src/transaction/suilend.d.ts +0 -7
  33. package/dist/src/transaction/swap.d.ts +0 -4
  34. package/dist/src/transaction/turbos.d.ts +0 -7
  35. package/dist/src/transaction/volo.d.ts +0 -8
  36. package/dist/src/types/CoinAssist.d.ts +0 -122
  37. package/dist/src/types/sui.d.ts +0 -112
  38. package/dist/src/utils/api.d.ts +0 -1
  39. package/dist/src/utils/coin.d.ts +0 -11
  40. package/dist/src/utils/contracts.d.ts +0 -16
  41. package/dist/src/utils/index.d.ts +0 -5
  42. package/dist/src/utils/msafe.d.ts +0 -2
  43. package/dist/src/utils/transaction.d.ts +0 -3
  44. package/dist/tests/math.test.d.ts +0 -1
  45. package/dist/tests/router/metastable.test.d.ts +0 -2
  46. package/dist/tests/router/obric.test.d.ts +0 -2
  47. package/dist/tests/router/scallop.test.d.ts +0 -2
  48. package/dist/tests/router/steamm.test.d.ts +0 -2
  49. package/dist/tests/router.test.d.ts +0 -2
  50. package/dist/tests/test_data.test.d.ts +0 -18
  51. package/dist/tests/wallet.test.d.ts +0 -1
  52. package/example/package.json +0 -17
  53. package/example/swap.ts +0 -21
  54. package/example/tsconfig.json +0 -12
  55. package/jest.config.mjs +0 -13
  56. package/src/api.ts +0 -320
  57. package/src/client.ts +0 -1081
  58. package/src/const.ts +0 -15
  59. package/src/errors.ts +0 -77
  60. package/src/index.ts +0 -10
  61. package/src/math.ts +0 -66
  62. package/src/transaction/afsui.ts +0 -62
  63. package/src/transaction/aftermath.ts +0 -88
  64. package/src/transaction/alphafi.ts +0 -50
  65. package/src/transaction/bluefin.ts +0 -46
  66. package/src/transaction/bluemove.ts +0 -42
  67. package/src/transaction/cetus.ts +0 -118
  68. package/src/transaction/deepbook_v2.ts +0 -122
  69. package/src/transaction/deepbook_v3.ts +0 -60
  70. package/src/transaction/flowx_v2.ts +0 -42
  71. package/src/transaction/flowx_v3.ts +0 -52
  72. package/src/transaction/haedal.ts +0 -33
  73. package/src/transaction/haedal_pmm.ts +0 -80
  74. package/src/transaction/index.ts +0 -42
  75. package/src/transaction/kriya_v2.ts +0 -37
  76. package/src/transaction/kriya_v3.ts +0 -47
  77. package/src/transaction/metastable.ts +0 -141
  78. package/src/transaction/obric.ts +0 -90
  79. package/src/transaction/scallop.ts +0 -64
  80. package/src/transaction/steamm.ts +0 -77
  81. package/src/transaction/suilend.ts +0 -48
  82. package/src/transaction/swap.ts +0 -162
  83. package/src/transaction/turbos.ts +0 -56
  84. package/src/transaction/volo.ts +0 -53
  85. package/src/types/CoinAssist.ts +0 -217
  86. package/src/types/sui.ts +0 -148
  87. package/src/utils/api.ts +0 -6
  88. package/src/utils/coin.ts +0 -136
  89. package/src/utils/contracts.ts +0 -136
  90. package/src/utils/index.ts +0 -5
  91. package/src/utils/msafe.ts +0 -40
  92. package/src/utils/transaction.ts +0 -20
  93. package/tests/math.test.ts +0 -21
  94. package/tests/router/metastable.test.ts +0 -377
  95. package/tests/router/obric.test.ts +0 -197
  96. package/tests/router/scallop.test.ts +0 -127
  97. package/tests/router/steamm.test.ts +0 -124
  98. package/tests/router.test.ts +0 -373
  99. package/tests/test_data.test.ts +0 -28
  100. package/tests/wallet.test.ts +0 -21
  101. package/tsup.config.ts +0 -23
  102. package/version.mjs +0 -28
@@ -1,40 +0,0 @@
1
- export declare enum TypesErrorCode {
2
- InvalidType = "InvalidType"
3
- }
4
- export declare enum ConfigErrorCode {
5
- MissAggregatorPackage = "MissAggregatorPackage",
6
- MissGlobalConfig = "MissGlobalConfig",
7
- InvalidWallet = "InvalidWallet",
8
- SimulateError = "SimulateError"
9
- }
10
- export declare enum TransactionErrorCode {
11
- InsufficientBalance = "InsufficientBalance",
12
- SimulateEventError = "simulateEventError",
13
- CannotGetDecimals = "CannotGetDecimals",
14
- MissCoinA = "MissCoinA",
15
- MissCoinB = "MissCoinB",
16
- MissTurbosFeeType = "MissTurbosFeeType",
17
- MissAftermathLpSupplyType = "MissAftermathLpSupplyType"
18
- }
19
- export type AggregatorErrorCode = TypesErrorCode | ConfigErrorCode | TransactionErrorCode;
20
- /**
21
- * AggregatorError is a custom error class that extends the built-in Error class. It is used to represent errors that occur during aggregation operations.
22
- * The key functionality of this code includes:
23
- * - Defining the AggregatorError class that represents an error during aggregation. It includes a message property and an optional errorCode property.
24
- * - Providing a static method isAggregatorErrorCode() that checks if a given error instance is an instance of AggregatorError and has a specific error code.
25
- */
26
- export declare class AggregatorError extends Error {
27
- message: string;
28
- errorCode?: AggregatorErrorCode;
29
- constructor(message: string, errorCode?: AggregatorErrorCode);
30
- static isAggregatorErrorCode(e: any, code: AggregatorErrorCode): boolean;
31
- }
32
- export declare enum AggregatorServerErrorCode {
33
- CalculateError = 10000,
34
- NumberTooLarge = 10001,
35
- NoRouter = 10002,
36
- InsufficientLiquidity = 10003,
37
- HoneyPot = 10004,
38
- RateLimitExceeded = 10005
39
- }
40
- export declare function getAggregatorServerErrorMessage(code: AggregatorServerErrorCode): string;
@@ -1,9 +0,0 @@
1
- export * from "./client";
2
- export * from "./transaction";
3
- export * from "./utils";
4
- export * from "./const";
5
- export * from "./api";
6
- export declare enum Env {
7
- Mainnet = 0,
8
- Testnet = 1
9
- }
@@ -1,6 +0,0 @@
1
- import BN from "bn.js";
2
- import Decimal from "decimal.js";
3
- export declare function CalculateAmountLimit(expectAmount: BN, byAmountIn: boolean, slippage: number): number;
4
- export declare function CalculateAmountLimitBN(expectAmount: BN, byAmountIn: boolean, slippage: number): BN;
5
- export declare function GetDefaultSqrtPriceLimit(a2b: boolean): BN;
6
- export declare function sqrtPriceX64ToPrice(sqrtPriceStr: string, decimalsA: number, decimalsB: number): Decimal;
@@ -1,10 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Afsui implements Dex {
4
- private stakedSuiVault;
5
- private safe;
6
- private referVault;
7
- private validator;
8
- constructor(env: Env);
9
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
10
- }
@@ -1,13 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Aftermath implements Dex {
4
- private slippage;
5
- private poolRegistry;
6
- private protocolFeeVault;
7
- private treasury;
8
- private insuranceFund;
9
- private referrealVault;
10
- constructor(env: Env);
11
- amountLimit(exportAmountOut: string): string;
12
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
13
- }
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Alphafi implements Dex {
4
- private sui_system_state;
5
- constructor(env: Env);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Bluefin implements Dex {
4
- private globalConfig;
5
- constructor(env: Env);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Bluemove implements Dex {
4
- private dexInfo;
5
- constructor(env: Env);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,15 +0,0 @@
1
- import { Transaction, TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export type CetusFlashSwapResult = {
4
- targetCoin: TransactionObjectArgument;
5
- flashReceipt: TransactionObjectArgument;
6
- payAmount: TransactionArgument;
7
- };
8
- export declare class Cetus implements Dex {
9
- private globalConfig;
10
- private partner;
11
- constructor(env: Env, partner?: string);
12
- flash_swap(client: AggregatorClient, txb: Transaction, path: Path, by_amount_in: boolean, packages?: Map<string, string>): CetusFlashSwapResult;
13
- repay_flash_swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, receipt: TransactionArgument, packages?: Map<string, string>): TransactionObjectArgument;
14
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
15
- }
@@ -1,14 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- import { SuiClient } from "@mysten/sui/client";
4
- type GetOrCreateAccountCapResult = {
5
- accountCap: TransactionObjectArgument;
6
- isCreate: boolean;
7
- };
8
- export declare class DeepbookV2 implements Dex {
9
- constructor(env: Env);
10
- getAccountCap(client: SuiClient, owner: string): Promise<string | null>;
11
- getOrCreateAccountCap(txb: Transaction, client: SuiClient, owner: string): Promise<GetOrCreateAccountCapResult>;
12
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
13
- }
14
- export {};
@@ -1,12 +0,0 @@
1
- import { Transaction, TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export type CetusFlashSwapResult = {
4
- targetCoin: TransactionObjectArgument;
5
- flashReceipt: TransactionObjectArgument;
6
- payAmount: TransactionArgument;
7
- };
8
- export declare class DeepbookV3 implements Dex {
9
- private deepbookV3Config;
10
- constructor(env: Env);
11
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
12
- }
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class FlowxV2 implements Dex {
4
- private container;
5
- constructor(env: Env);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,8 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class FlowxV3 implements Dex {
4
- private versioned;
5
- private poolRegistry;
6
- constructor(env: Env);
7
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
8
- }
@@ -1,6 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Haedal implements Dex {
4
- constructor(env: Env);
5
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
6
- }
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class HaedalPmm implements Dex {
4
- private pythPriceIDs;
5
- constructor(env: Env, pythPriceIDs: Map<string, string>);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,10 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Path } from "..";
3
- export declare const CLOCK_ADDRESS: string;
4
- export declare const AGGREGATOR_V2 = "aggregator_v2";
5
- export declare const AGGREGATOR_V2_EXTEND = "aggregator_v2_extend";
6
- export declare function getAggregatorV2PublishedAt(aggregatorV2PublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
7
- export declare function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt: string, packages?: Map<string, string> | Record<string, string>): string;
8
- export interface Dex {
9
- swap(client: AggregatorClient, ptb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>, deepbookv3DeepFee?: TransactionObjectArgument): Promise<TransactionObjectArgument>;
10
- }
@@ -1,6 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class KriyaV2 implements Dex {
4
- constructor(env: Env);
5
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
6
- }
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class KriyaV3 implements Dex {
4
- private version;
5
- constructor(env: Env);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,8 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Metastable implements Dex {
4
- private pythPriceIDs;
5
- private versionID;
6
- constructor(env: Env, pythPriceIDs: Map<string, string>);
7
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
8
- }
@@ -1,8 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Obric implements Dex {
4
- private pythPriceIDs;
5
- private pythStateObjectId;
6
- constructor(env: Env, pythPriceIDs: Map<string, string>);
7
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
8
- }
@@ -1,8 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Scallop implements Dex {
4
- private version;
5
- private market;
6
- constructor(env: Env);
7
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
8
- }
@@ -1,6 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Steamm implements Dex {
4
- constructor(env: Env);
5
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
6
- }
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Suilend implements Dex {
4
- private sui_system_state;
5
- constructor(env: Env);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,4 +0,0 @@
1
- import { SwapInPoolsParams } from "~/client";
2
- import { Env, SwapInPoolsResult } from "..";
3
- import { SuiClient } from "@mysten/sui/client";
4
- export declare function swapInPools(client: SuiClient, params: SwapInPoolsParams, sender: string, env: Env): Promise<SwapInPoolsResult>;
@@ -1,7 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Turbos implements Dex {
4
- private versioned;
5
- constructor(env: Env);
6
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
7
- }
@@ -1,8 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- export declare class Volo implements Dex {
4
- private nativePool;
5
- private metadata;
6
- constructor(env: Env);
7
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument, packages?: Map<string, string>): Promise<TransactionObjectArgument>;
8
- }
@@ -1,122 +0,0 @@
1
- import type { SuiMoveObject } from '@mysten/sui/client';
2
- import type { CoinAsset, SuiAddress } from './sui';
3
- export declare const DEFAULT_GAS_BUDGET_FOR_SPLIT = 1000;
4
- export declare const DEFAULT_GAS_BUDGET_FOR_MERGE = 500;
5
- export declare const DEFAULT_GAS_BUDGET_FOR_TRANSFER = 100;
6
- export declare const DEFAULT_GAS_BUDGET_FOR_TRANSFER_SUI = 100;
7
- export declare const DEFAULT_GAS_BUDGET_FOR_STAKE = 1000;
8
- export declare const GAS_TYPE_ARG = "0x2::sui::SUI";
9
- export declare const GAS_TYPE_ARG_LONG = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
10
- export declare const GAS_SYMBOL = "SUI";
11
- export declare const DEFAULT_NFT_TRANSFER_GAS_FEE = 450;
12
- export declare const SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000005";
13
- /**
14
- * This class provides helper methods for working with coins.
15
- */
16
- export declare class CoinUtils {
17
- /**
18
- * Get the coin type argument from a SuiMoveObject.
19
- *
20
- * @param obj The SuiMoveObject to get the coin type argument from.
21
- * @returns The coin type argument, or null if it is not found.
22
- */
23
- static getCoinTypeArg(obj: SuiMoveObject): string | null;
24
- /**
25
- * Get whether a SuiMoveObject is a SUI coin.
26
- *
27
- * @param obj The SuiMoveObject to check.
28
- * @returns Whether the SuiMoveObject is a SUI coin.
29
- */
30
- static isSUI(obj: SuiMoveObject): boolean;
31
- /**
32
- * Get the coin symbol from a coin type argument.
33
- *
34
- * @param coinTypeArg The coin type argument to get the symbol from.
35
- * @returns The coin symbol.
36
- */
37
- static getCoinSymbol(coinTypeArg: string): string;
38
- /**
39
- * Get the balance of a SuiMoveObject.
40
- *
41
- * @param obj The SuiMoveObject to get the balance from.
42
- * @returns The balance of the SuiMoveObject.
43
- */
44
- static getBalance(obj: SuiMoveObject): bigint;
45
- /**
46
- * Get the total balance of a list of CoinAsset objects for a given coin address.
47
- *
48
- * @param objs The list of CoinAsset objects to get the total balance for.
49
- * @param coinAddress The coin address to get the total balance for.
50
- * @returns The total balance of the CoinAsset objects for the given coin address.
51
- */
52
- static totalBalance(objs: CoinAsset[], coinAddress: SuiAddress): bigint;
53
- /**
54
- * Get the ID of a SuiMoveObject.
55
- *
56
- * @param obj The SuiMoveObject to get the ID from.
57
- * @returns The ID of the SuiMoveObject.
58
- */
59
- static getID(obj: SuiMoveObject): string;
60
- /**
61
- * Get the coin type from a coin type argument.
62
- *
63
- * @param coinTypeArg The coin type argument to get the coin type from.
64
- * @returns The coin type.
65
- */
66
- static getCoinTypeFromArg(coinTypeArg: string): string;
67
- /**
68
- * Get the CoinAsset objects for a given coin type.
69
- *
70
- * @param coinType The coin type to get the CoinAsset objects for.
71
- * @param allSuiObjects The list of all SuiMoveObjects.
72
- * @returns The CoinAsset objects for the given coin type.
73
- */
74
- static getCoinAssets(coinType: string, allSuiObjects: CoinAsset[]): CoinAsset[];
75
- /**
76
- * Get whether a coin address is a SUI coin.
77
- *
78
- * @param coinAddress The coin address to check.
79
- * @returns Whether the coin address is a SUI coin.
80
- */
81
- static isSuiCoin(coinAddress: SuiAddress): boolean;
82
- /**
83
- * Select the CoinAsset objects from a list of CoinAsset objects that have a balance greater than or equal to a given amount.
84
- *
85
- * @param coins The list of CoinAsset objects to select from.
86
- * @param amount The amount to select CoinAsset objects with a balance greater than or equal to.
87
- * @param exclude A list of CoinAsset objects to exclude from the selection.
88
- * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
89
- */
90
- static selectCoinObjectIdGreaterThanOrEqual(coins: CoinAsset[], amount: bigint, exclude?: string[]): {
91
- objectArray: string[];
92
- remainCoins: CoinAsset[];
93
- amountArray: string[];
94
- };
95
- /**
96
- * Select the CoinAsset objects from a list of CoinAsset objects that have a balance greater than or equal to a given amount.
97
- *
98
- * @param coins The list of CoinAsset objects to select from.
99
- * @param amount The amount to select CoinAsset objects with a balance greater than or equal to.
100
- * @param exclude A list of CoinAsset objects to exclude from the selection.
101
- * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
102
- */
103
- static selectCoinAssetGreaterThanOrEqual(coins: CoinAsset[], amount: bigint, exclude?: string[]): {
104
- selectedCoins: CoinAsset[];
105
- remainingCoins: CoinAsset[];
106
- };
107
- /**
108
- * Sort the CoinAsset objects by their balance.
109
- *
110
- * @param coins The CoinAsset objects to sort.
111
- * @returns The sorted CoinAsset objects.
112
- */
113
- static sortByBalance(coins: CoinAsset[]): CoinAsset[];
114
- static sortByBalanceDes(coins: CoinAsset[]): CoinAsset[];
115
- /**
116
- * Calculate the total balance of a list of CoinAsset objects.
117
- *
118
- * @param coins The list of CoinAsset objects to calculate the total balance for.
119
- * @returns The total balance of the CoinAsset objects.
120
- */
121
- static calculateTotalBalance(coins: CoinAsset[]): bigint;
122
- }
@@ -1,112 +0,0 @@
1
- import type { TransactionArgument } from '@mysten/sui/transactions';
2
- import Decimal from 'decimal.js';
3
- /**
4
- * Represents a SUI address, which is a string.
5
- */
6
- export type SuiAddress = string;
7
- /**
8
- * Represents a SUI object identifier, which is a string.
9
- */
10
- export type SuiObjectIdType = string;
11
- /**
12
- * Represents a BigNumber, which can be a Decimal.Value, number, or string.
13
- */
14
- export type BigNumber = Decimal.Value | number | string;
15
- /**
16
- * Represents a SUI resource, which can be of any type.
17
- */
18
- export type SuiResource = any;
19
- /**
20
- * Represents a Non-Fungible Token (NFT) with associated metadata.
21
- */
22
- export type NFT = {
23
- /**
24
- * The address or identifier of the creator of the NFT.
25
- */
26
- creator: string;
27
- /**
28
- * A description providing additional information about the NFT.
29
- */
30
- description: string;
31
- /**
32
- * The URL to the image representing the NFT visually.
33
- */
34
- image_url: string;
35
- /**
36
- * A link associated with the NFT, providing more details or interactions.
37
- */
38
- link: string;
39
- /**
40
- * The name or title of the NFT.
41
- */
42
- name: string;
43
- /**
44
- * The URL to the project or collection associated with the NFT.
45
- */
46
- project_url: string;
47
- };
48
- /**
49
- * Represents a SUI struct tag.
50
- */
51
- export type SuiStructTag = {
52
- /**
53
- * The full address of the struct.
54
- */
55
- full_address: string;
56
- /**
57
- * The source address of the struct.
58
- */
59
- source_address: string;
60
- /**
61
- * The address of the struct.
62
- */
63
- address: SuiAddress;
64
- /**
65
- * The module to which the struct belongs.
66
- */
67
- module: string;
68
- /**
69
- * The name of the struct.
70
- */
71
- name: string;
72
- /**
73
- * An array of type arguments (SUI addresses) for the struct.
74
- */
75
- type_arguments: SuiAddress[];
76
- };
77
- /**
78
- * Represents basic SUI data types.
79
- */
80
- export type SuiBasicTypes = 'address' | 'bool' | 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'u256';
81
- /**
82
- * Represents a SUI transaction argument, which can be of various types.
83
- */
84
- export type SuiTxArg = TransactionArgument | string | number | bigint | boolean;
85
- /**
86
- * Represents input types for SUI data.
87
- */
88
- export type SuiInputTypes = 'object' | SuiBasicTypes;
89
- /**
90
- * Gets the default SUI input type based on the provided value.
91
- * @param value - The value to determine the default input type for.
92
- * @returns The default SUI input type.
93
- * @throws Error if the type of the value is unknown.
94
- */
95
- export declare const getDefaultSuiInputType: (value: any) => SuiInputTypes;
96
- /**
97
- * Represents a coin asset with address, object ID, and balance information.
98
- */
99
- export type CoinAsset = {
100
- /**
101
- * The address type of the coin asset.
102
- */
103
- coinAddress: SuiAddress;
104
- /**
105
- * The object identifier of the coin asset.
106
- */
107
- coinObjectId: SuiObjectIdType;
108
- /**
109
- * The balance amount of the coin asset.
110
- */
111
- balance: bigint;
112
- };
@@ -1 +0,0 @@
1
- export declare function processEndpoint(endpoint: string): string;
@@ -1,11 +0,0 @@
1
- import { CoinAsset } from "../types/sui";
2
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
3
- export declare function completionCoin(s: string): string;
4
- export declare function compareCoins(coinA: string, coinB: string): boolean;
5
- export declare function mintZeroCoin(txb: Transaction, coinType: string): TransactionObjectArgument;
6
- export type BuildCoinResult = {
7
- targetCoin: TransactionObjectArgument;
8
- isMintZeroCoin: boolean;
9
- targetCoinAmount: number;
10
- };
11
- export declare function buildInputCoin(txb: Transaction, allCoins: CoinAsset[], amount: bigint, coinType: string): BuildCoinResult;
@@ -1,16 +0,0 @@
1
- import type { SuiAddress, SuiStructTag } from '../types/sui';
2
- export declare function isSortedSymbols(symbolX: string, symbolY: string): boolean;
3
- export declare function composeType(address: string, generics: SuiAddress[]): SuiAddress;
4
- export declare function composeType(address: string, struct: string, generics?: SuiAddress[]): SuiAddress;
5
- export declare function composeType(address: string, module: string, struct: string, generics?: SuiAddress[]): SuiAddress;
6
- export declare function extractAddressFromType(type: string): string;
7
- export declare function extractStructTagFromType(type: string): SuiStructTag;
8
- export declare function normalizeCoinType(coinType: string): string;
9
- export declare function fixSuiObjectId(value: string): string;
10
- /**
11
- * Recursively traverses the given data object and patches any string values that represent Sui object IDs.
12
- *
13
- * @param {any} data - The data object to be patched.
14
- */
15
- export declare function patchFixSuiObjectId(data: any): void;
16
- export declare function createTarget(packageName: string, moduleName: string, functionName: string): `${string}::${string}::${string}`;
@@ -1,5 +0,0 @@
1
- export * from './contracts';
2
- export * from './msafe';
3
- export * from './api';
4
- export * from './coin';
5
- export * from './transaction';
@@ -1,2 +0,0 @@
1
- export declare const dealWithFastRouterSwapParamsForMsafe: (data: any) => any;
2
- export declare const restituteMsafeFastRouterSwapParams: (data: any) => any;
@@ -1,3 +0,0 @@
1
- import { Transaction } from "@mysten/sui/transactions";
2
- export declare function printTransaction(tx: Transaction, isPrint?: boolean): Promise<void>;
3
- export declare function checkInvalidSuiAddress(address: string): boolean;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
2
- export declare function buildTestAccount(): Ed25519Keypair;
@@ -1,2 +0,0 @@
1
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
2
- export declare function buildTestAccount(): Ed25519Keypair;
@@ -1,2 +0,0 @@
1
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
2
- export declare function buildTestAccount(): Ed25519Keypair;
@@ -1,2 +0,0 @@
1
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
2
- export declare function buildTestAccount(): Ed25519Keypair;
@@ -1,2 +0,0 @@
1
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
2
- export declare function buildTestAccount(): Ed25519Keypair;
@@ -1,18 +0,0 @@
1
- export declare const T_USDC = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC";
2
- export declare const T_USDT = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdt::USDT";
3
- export declare const T_DEEP = "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP";
4
- export declare const T_DBUSDC = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC";
5
- export declare const T_DBUSDT = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT";
6
- export declare const M_USDC = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
7
- export declare const M_wUSDC = "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN";
8
- export declare const M_CETUS = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS";
9
- export declare const M_NAVI = "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX";
10
- export declare const M_SUI = "0x2::sui::SUI";
11
- export declare const M_VSUI = "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT";
12
- export declare const M_VAPOR = "0xa1f2c11169f32165ad4efb4468ec5bdfc880cd66b22094024b32ab7b76d14d30::vapor::VAPOR";
13
- export declare const M_HASUI = "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI";
14
- export declare const M_SSWP = "0x361dd589b98e8fcda9a7ee53b85efabef3569d00416640d2faa516e3801d7ffc::TOKEN::TOKEN";
15
- export declare const M_MICHI = "0x50d796fde5709a97883e29e00bf511d66f2656de958ea0c2ce4c1147cdd20a23::MICHI::MICHI";
16
- export declare const M_SSUI = "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI";
17
- export declare const M_SHaSUI = "0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI";
18
- export declare const M_ETH = "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
@@ -1 +0,0 @@
1
- export {};