@cetusprotocol/aggregator-sdk 0.11.0 → 0.12.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/README.md CHANGED
@@ -29,7 +29,9 @@ Multi-Platform Support: Currently, we have integrated multiple mainstream DEXs o
29
29
 
30
30
  By using our aggregator, you can trade more efficiently and securely on the Sui blockchain, fully leveraging the various opportunities brought by decentralized finance (DeFi).
31
31
 
32
- # Install
32
+ # Aggregator SDK
33
+
34
+ ## Install
33
35
 
34
36
  The SDK is published to npm registry. To use the SDK in your project, you can
35
37
 
@@ -37,33 +39,15 @@ The SDK is published to npm registry. To use the SDK in your project, you can
37
39
  npm install @cetusprotocol/aggregator-sdk
38
40
  ```
39
41
 
40
- # Usage
41
-
42
- ## 1. Init client with rpc and package config
42
+ ## Usage
43
43
 
44
- 1. Fast init:
45
- ```typescript
46
- const client = new AggregatorClient({})
47
- ```
44
+ ### 1. Init client with rpc and package config
48
45
 
49
- 2. Full init:
50
- > Note: overlayFeeRate and overlayFeeReceiver are used for additional fee logic beyond protocol fees, allowing project parties to collect extra fees.
51
-
52
- ```typescript
53
- const client = new AggregatorClient({
54
- // endpoint, // If you do not have a exclusive aggregator api domain,just use cetus default aggregator endpoints.
55
- signer: wallet,
56
- client: suiClient,
57
- env: Env.Mainnet,
58
- pythUrls: ["YOUR_PYTH_URL", "ANOTHER_PYTH_URL"],
59
- partner: "YOUR_PARTNER_ID", // Partner ID for fee sharing. Set once during initialization instead of per swap.
60
- overlayFeeRate: 0.01, // Overlay fee rate (0.01 represents 1%). The denominator is 1000000, so 0.01% = 100
61
- overlayFeeReceiver: "0x..", // Address to receive the overlay fees
62
- })
63
- ```
64
- **Notes**: Some providers, such as HaedalHMM and Metastable, rely on Pyth oracle prices when build transactions. Currently, we have a default configuration that connects to Pyth's publicly available node. However, if you frequently build transactions, we recommend setting up a private Pyth node interface as an additional backup. This will ensure uninterrupted access to HaedalHMM and Metastable, even if the public node experiences occasional downtime.
46
+ ```typescript
47
+ const client = new AggregatorClient({})
48
+ ```
65
49
 
66
- ## 2. Get best router swap result from aggregator service
50
+ ### 2. Get best router swap result from aggregator service
67
51
 
68
52
  ```typescript
69
53
  const amount = new BN(1000000)
@@ -79,72 +63,97 @@ const routers = await client.findRouters({
79
63
  })
80
64
  ```
81
65
 
82
- ## 3. Confirm and do fast swap
66
+ ### 3. Confirm and do fast swap
67
+
83
68
  ```typescript
84
- const routerTx = new Transaction()
69
+ const txb = new Transaction()
85
70
 
86
71
  if (routerRes != null) {
87
72
  await client.fastRouterSwap({
88
73
  routers,
89
- txb: routerTx,
74
+ txb,
90
75
  slippage: 0.01,
91
- isMergeTragetCoin: true,
92
- refreshAllCoins: true
93
76
  })
94
77
 
95
- let result = await client.devInspectTransactionBlock(routerTx, keypair)
78
+ const result = await client.devInspectTransactionBlock(txb, keypair)
96
79
 
97
80
  if (result.effects.status.status === "success") {
98
- console.log("[Cetus] Transaction simulation successful")
99
- const result = await client.signAndExecuteTransaction(routerTx, keypair)
100
- console.log("[Cetus] Transaction executed successfully:", {
101
- digest: result.digest,
102
- status: result.effects?.status,
103
- gasUsed: result.effects?.gasUsed
104
- })
105
- } else {
106
- console.error("[Cetus] Transaction simulation failed:", result.effects?.status)
81
+ console.log("Sim exec transaction success")
82
+ const result = await client.signAndExecuteTransaction(txb, keypair)
107
83
  }
84
+ console.log("result", result)
108
85
  }
109
86
  ```
110
87
 
111
- ## 4. Build PTB and return target coin
88
+ ### 4. Build PTB and return target coin
112
89
 
113
90
  ```typescript
114
- const routerTx = new Transaction()
115
- const byAmountIn = true;
91
+ const txb = new Transaction()
92
+ const byAmountIn = true
116
93
 
117
94
  if (routerRes != null) {
118
95
  const targetCoin = await client.routerSwap({
119
96
  routers,
120
- txb: routerTx,
97
+ txb,
121
98
  inputCoin,
122
99
  slippage: 0.01,
123
100
  })
124
101
 
125
102
  // you can use this target coin object argument to build your ptb.
126
- client.transferOrDestroyCoin(
127
- txb,
128
- targetCoin,
129
- targetCoinType
130
- )
103
+ client.transferOrDestoryCoin(txb, targetCoin, targetCoinType)
131
104
 
132
- let result = await client.devInspectTransactionBlock(routerTx, keypair)
105
+ const result = await client.devInspectTransactionBlock(txb, keypair)
133
106
 
134
107
  if (result.effects.status.status === "success") {
135
- console.log("[Cetus] Transaction simulation successful")
136
- const result = await client.signAndExecuteTransaction(routerTx, keypair)
137
- console.log("[Cetus] Transaction executed successfully:", {
138
- digest: result.digest,
139
- status: result.effects?.status,
140
- gasUsed: result.effects?.gasUsed
141
- })
142
- } else {
143
- console.error("[Cetus] Transaction simulation failed:", result.effects?.status)
108
+ console.log("Sim exec transaction success")
109
+ const result = await client.signAndExecuteTransaction(txb, keypair)
144
110
  }
111
+ console.log("result", result)
145
112
  }
146
113
  ```
147
114
 
115
+ # Aggregator Contract Interface
116
+
117
+ ## Tags corresponding to different networks
118
+
119
+ | Contract | Tag of Repo | Latest published at address |
120
+ | ------------------------- | ----------- | ------------------------------------------------------------------ |
121
+ | CetusAggregatorV2 | mainnet | 0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032 |
122
+ | CetusAggregatorV2ExtendV1 | mainnet | 0x39402d188b7231036e52266ebafad14413b4bf3daea4ac17115989444e6cd516 |
123
+ | CetusAggregatorV2ExtendV2 | mainnet | 0x368d13376443a8051b22b42a9125f6a3bc836422bb2d9c4a53984b8d6624c326 |
124
+
125
+ ## Example
126
+
127
+ ```
128
+ CetusAggregatorV2 = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2/mainnet", rev = "mainnet", override = true }
129
+
130
+ CetusAggregatorV2ExtendV1 = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2-extend-v1", rev = "mainnet", override = true }
131
+
132
+ CetusAggregatorV2ExtendV2 = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2-extend-v2", rev = "mainnet", override = true }
133
+ ```
134
+
135
+ # Simple Aggregator Contract Interface(include cetus, flowxv3, turbos, bluefin)
136
+
137
+ ## Tags corresponding to different networks
138
+
139
+ | Contract | Tag of Repo | Latest published at address |
140
+ | --------------------- | ----------- | ------------------------------------------------------------------ |
141
+ | CetusAggregatorSimple | mainnet | 0x594d67abc0778023ac852800578271dd7e18698ad06e6298034858c77612333d |
142
+
143
+ ## Example
144
+
145
+ ```
146
+ CetusAggregatorSimple = { git = "https://github.com/CetusProtocol/aggregator.git", subdir = "packages/cetus-aggregator-v2/simple-mainnet", rev = "mainnet-v1.49.1", override = true }
147
+ ```
148
+
149
+ ## Usage
150
+
151
+ Cetus clmm interface is not complete(just have function definition), so it will fails when sui client check the code version. However, this does not affect its actual functionality. Therefore, we need to add a --dependencies-are-root during the build.
152
+
153
+ ```
154
+ sui move build --dependencies-are-root && sui client publish --dependencies-are-root
155
+ ```
156
+
148
157
  # More About Cetus
149
158
 
150
159
  Use the following links to learn more about Cetus:
package/dist/index.d.mts CHANGED
@@ -88,6 +88,7 @@ declare const STEAMM_OMM = "STEAMM_OMM";
88
88
  declare const MOMENTUM = "MOMENTUM";
89
89
  declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
90
90
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
91
+ declare const ALL_DEXES: string[];
91
92
  type BuildRouterSwapParams = {
92
93
  routers: Router[];
93
94
  byAmountIn: boolean;
@@ -133,6 +134,19 @@ interface SwapInPoolsResult {
133
134
  isExceed: boolean;
134
135
  routeData?: RouterData;
135
136
  }
137
+ declare function getAllProviders(): string[];
138
+ /**
139
+ * Get all providers excluding the specified ones
140
+ * @param excludeProviders Array of provider names to exclude
141
+ * @returns Filtered provider list
142
+ */
143
+ declare function getProvidersExcluding(excludeProviders: string[]): string[];
144
+ /**
145
+ * Get only the specified providers
146
+ * @param includeProviders Array of provider names to include
147
+ * @returns Filtered provider list
148
+ */
149
+ declare function getProvidersIncluding(includeProviders: string[]): string[];
136
150
  type AggregatorClientParams = {
137
151
  endpoint?: string;
138
152
  signer?: string;
@@ -351,4 +365,4 @@ declare enum Env {
351
365
  Testnet = 1
352
366
  }
353
367
 
354
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
368
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.d.ts CHANGED
@@ -88,6 +88,7 @@ declare const STEAMM_OMM = "STEAMM_OMM";
88
88
  declare const MOMENTUM = "MOMENTUM";
89
89
  declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
90
90
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
91
+ declare const ALL_DEXES: string[];
91
92
  type BuildRouterSwapParams = {
92
93
  routers: Router[];
93
94
  byAmountIn: boolean;
@@ -133,6 +134,19 @@ interface SwapInPoolsResult {
133
134
  isExceed: boolean;
134
135
  routeData?: RouterData;
135
136
  }
137
+ declare function getAllProviders(): string[];
138
+ /**
139
+ * Get all providers excluding the specified ones
140
+ * @param excludeProviders Array of provider names to exclude
141
+ * @returns Filtered provider list
142
+ */
143
+ declare function getProvidersExcluding(excludeProviders: string[]): string[];
144
+ /**
145
+ * Get only the specified providers
146
+ * @param includeProviders Array of provider names to include
147
+ * @returns Filtered provider list
148
+ */
149
+ declare function getProvidersIncluding(includeProviders: string[]): string[];
136
150
  type AggregatorClientParams = {
137
151
  endpoint?: string;
138
152
  signer?: string;
@@ -351,4 +365,4 @@ declare enum Env {
351
365
  Testnet = 1
352
366
  }
353
367
 
354
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
368
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient, type AggregatorClientParams, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildFastRouterSwapParamsV2, type BuildRouterSwapParams, type BuildRouterSwapParamsV2, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.js CHANGED
@@ -5805,7 +5805,7 @@ function swapInPools(client, params, sender, env) {
5805
5805
  const targetCoin = completionCoin(target);
5806
5806
  const tx = new transactions.Transaction();
5807
5807
  const direction = compareCoins(fromCoin, targetCoin);
5808
- const integratePublishedAt = env === 0 /* Mainnet */ ? "0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5808
+ const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5809
5809
  const coinA = direction ? fromCoin : targetCoin;
5810
5810
  const coinB = direction ? targetCoin : fromCoin;
5811
5811
  const typeArguments = [coinA, coinB];
@@ -6783,12 +6783,48 @@ var STEAMM_OMM = "STEAMM_OMM";
6783
6783
  var MOMENTUM = "MOMENTUM";
6784
6784
  var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
6785
6785
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6786
+ var ALL_DEXES = [
6787
+ CETUS,
6788
+ KRIYA,
6789
+ FLOWXV2,
6790
+ FLOWXV3,
6791
+ KRIYAV3,
6792
+ TURBOS,
6793
+ AFTERMATH,
6794
+ HAEDAL,
6795
+ VOLO,
6796
+ AFSUI,
6797
+ BLUEMOVE,
6798
+ DEEPBOOKV3,
6799
+ SCALLOP,
6800
+ SUILEND,
6801
+ BLUEFIN,
6802
+ HAEDALPMM,
6803
+ ALPHAFI,
6804
+ SPRINGSUI,
6805
+ STEAMM,
6806
+ METASTABLE,
6807
+ OBRIC,
6808
+ HAWAL,
6809
+ MOMENTUM,
6810
+ STEAMM_OMM,
6811
+ STEAMM_OMM_V2
6812
+ ];
6786
6813
  function isBuilderRouterSwapParams(params) {
6787
6814
  return Array.isArray(params.routers);
6788
6815
  }
6789
6816
  function isBuilderFastRouterSwapParams(params) {
6790
6817
  return Array.isArray(params.routers);
6791
6818
  }
6819
+ function getAllProviders() {
6820
+ return ALL_DEXES;
6821
+ }
6822
+ function getProvidersExcluding(excludeProviders) {
6823
+ return ALL_DEXES.filter((provider) => !excludeProviders.includes(provider));
6824
+ }
6825
+ function getProvidersIncluding(includeProviders) {
6826
+ return ALL_DEXES.filter((provider) => includeProviders.includes(provider));
6827
+ }
6792
6828
  var _AggregatorClient = class _AggregatorClient {
6793
6829
  constructor(params) {
6794
6830
  var _a, _b;
@@ -7308,7 +7344,7 @@ var _AggregatorClient = class _AggregatorClient {
7308
7344
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7309
7345
  publishedAtV2() {
7310
7346
  if (this.env === 0 /* Mainnet */) {
7311
- return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
7347
+ return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7312
7348
  } else {
7313
7349
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7314
7350
  }
@@ -7316,14 +7352,14 @@ var _AggregatorClient = class _AggregatorClient {
7316
7352
  // Include deepbookv3, scallop, bluefin
7317
7353
  publishedAtV2Extend() {
7318
7354
  if (this.env === 0 /* Mainnet */) {
7319
- return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
7355
+ return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7320
7356
  } else {
7321
7357
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7322
7358
  }
7323
7359
  }
7324
7360
  publishedAtV2Extend2() {
7325
7361
  if (this.env === 0 /* Mainnet */) {
7326
- return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
7362
+ return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7327
7363
  } else {
7328
7364
  return "0x0";
7329
7365
  }
@@ -7724,7 +7760,7 @@ function processEndpoint(endpoint) {
7724
7760
 
7725
7761
  // src/api.ts
7726
7762
  var import_bn7 = __toESM(require_bn());
7727
- var SDK_VERSION = 1001100;
7763
+ var SDK_VERSION = 1001200;
7728
7764
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7729
7765
  return __async(this, null, function* () {
7730
7766
  let response;
@@ -7933,6 +7969,7 @@ exports.AFTERMATH = AFTERMATH;
7933
7969
  exports.AGGREGATOR_V2 = AGGREGATOR_V2;
7934
7970
  exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
7935
7971
  exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
7972
+ exports.ALL_DEXES = ALL_DEXES;
7936
7973
  exports.ALPHAFI = ALPHAFI;
7937
7974
  exports.AggregatorClient = AggregatorClient26;
7938
7975
  exports.BLUEFIN = BLUEFIN;
@@ -7982,7 +8019,10 @@ exports.fixSuiObjectId = fixSuiObjectId;
7982
8019
  exports.getAggregatorV2Extend2PublishedAt = getAggregatorV2Extend2PublishedAt;
7983
8020
  exports.getAggregatorV2ExtendPublishedAt = getAggregatorV2ExtendPublishedAt;
7984
8021
  exports.getAggregatorV2PublishedAt = getAggregatorV2PublishedAt;
8022
+ exports.getAllProviders = getAllProviders;
7985
8023
  exports.getDeepbookV3Config = getDeepbookV3Config;
8024
+ exports.getProvidersExcluding = getProvidersExcluding;
8025
+ exports.getProvidersIncluding = getProvidersIncluding;
7986
8026
  exports.getRouterResult = getRouterResult;
7987
8027
  exports.isSortedSymbols = isSortedSymbols;
7988
8028
  exports.mintZeroCoin = mintZeroCoin;
package/dist/index.mjs CHANGED
@@ -5803,7 +5803,7 @@ function swapInPools(client, params, sender, env) {
5803
5803
  const targetCoin = completionCoin(target);
5804
5804
  const tx = new Transaction();
5805
5805
  const direction = compareCoins(fromCoin, targetCoin);
5806
- const integratePublishedAt = env === 0 /* Mainnet */ ? "0x2d8c2e0fc6dd25b0214b3fa747e0fd27fd54608142cd2e4f64c1cd350cc4add4" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5806
+ const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5807
5807
  const coinA = direction ? fromCoin : targetCoin;
5808
5808
  const coinB = direction ? targetCoin : fromCoin;
5809
5809
  const typeArguments = [coinA, coinB];
@@ -6781,12 +6781,48 @@ var STEAMM_OMM = "STEAMM_OMM";
6781
6781
  var MOMENTUM = "MOMENTUM";
6782
6782
  var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
6783
6783
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6784
+ var ALL_DEXES = [
6785
+ CETUS,
6786
+ KRIYA,
6787
+ FLOWXV2,
6788
+ FLOWXV3,
6789
+ KRIYAV3,
6790
+ TURBOS,
6791
+ AFTERMATH,
6792
+ HAEDAL,
6793
+ VOLO,
6794
+ AFSUI,
6795
+ BLUEMOVE,
6796
+ DEEPBOOKV3,
6797
+ SCALLOP,
6798
+ SUILEND,
6799
+ BLUEFIN,
6800
+ HAEDALPMM,
6801
+ ALPHAFI,
6802
+ SPRINGSUI,
6803
+ STEAMM,
6804
+ METASTABLE,
6805
+ OBRIC,
6806
+ HAWAL,
6807
+ MOMENTUM,
6808
+ STEAMM_OMM,
6809
+ STEAMM_OMM_V2
6810
+ ];
6784
6811
  function isBuilderRouterSwapParams(params) {
6785
6812
  return Array.isArray(params.routers);
6786
6813
  }
6787
6814
  function isBuilderFastRouterSwapParams(params) {
6788
6815
  return Array.isArray(params.routers);
6789
6816
  }
6817
+ function getAllProviders() {
6818
+ return ALL_DEXES;
6819
+ }
6820
+ function getProvidersExcluding(excludeProviders) {
6821
+ return ALL_DEXES.filter((provider) => !excludeProviders.includes(provider));
6822
+ }
6823
+ function getProvidersIncluding(includeProviders) {
6824
+ return ALL_DEXES.filter((provider) => includeProviders.includes(provider));
6825
+ }
6790
6826
  var _AggregatorClient = class _AggregatorClient {
6791
6827
  constructor(params) {
6792
6828
  var _a, _b;
@@ -7306,7 +7342,7 @@ var _AggregatorClient = class _AggregatorClient {
7306
7342
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7307
7343
  publishedAtV2() {
7308
7344
  if (this.env === 0 /* Mainnet */) {
7309
- return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
7345
+ return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7310
7346
  } else {
7311
7347
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7312
7348
  }
@@ -7314,14 +7350,14 @@ var _AggregatorClient = class _AggregatorClient {
7314
7350
  // Include deepbookv3, scallop, bluefin
7315
7351
  publishedAtV2Extend() {
7316
7352
  if (this.env === 0 /* Mainnet */) {
7317
- return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
7353
+ return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7318
7354
  } else {
7319
7355
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7320
7356
  }
7321
7357
  }
7322
7358
  publishedAtV2Extend2() {
7323
7359
  if (this.env === 0 /* Mainnet */) {
7324
- return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
7360
+ return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7325
7361
  } else {
7326
7362
  return "0x0";
7327
7363
  }
@@ -7722,7 +7758,7 @@ function processEndpoint(endpoint) {
7722
7758
 
7723
7759
  // src/api.ts
7724
7760
  var import_bn7 = __toESM(require_bn());
7725
- var SDK_VERSION = 1001100;
7761
+ var SDK_VERSION = 1001200;
7726
7762
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7727
7763
  return __async(this, null, function* () {
7728
7764
  let response;
@@ -7926,4 +7962,4 @@ decimal.js/decimal.mjs:
7926
7962
  *)
7927
7963
  */
7928
7964
 
7929
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALPHAFI, AggregatorClient26 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, MOMENTUM, OBRIC, ONE, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
7965
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient26 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, METASTABLE, MOMENTUM, OBRIC, ONE, SCALLOP, SPRINGSUI, STEAMM, STEAMM_OMM, STEAMM_OMM_V2, SUILEND, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, findPythPriceIDs, fixSuiObjectId, getAggregatorV2Extend2PublishedAt, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getAllProviders, getDeepbookV3Config, getProvidersExcluding, getProvidersIncluding, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,85 @@
1
+ #!/bin/bash
2
+
3
+ # 复制 aggregator-sdk 文件到 sui/aggregator 目录的脚本
4
+ # 作者: Auto Generated Script
5
+ # 日期: $(date)
6
+
7
+ set -e # 遇到错误时退出
8
+
9
+ # 定义源目录和目标目录
10
+ SOURCE_DIR="/home/ccbond/github/cetus/aggregator-sdk"
11
+ TARGET_DIR="/home/ccbond/github/sui/aggregator"
12
+
13
+ # 颜色定义
14
+ RED='\033[0;31m'
15
+ GREEN='\033[0;32m'
16
+ YELLOW='\033[1;33m'
17
+ NC='\033[0m' # No Color
18
+
19
+ # 打印带颜色的消息
20
+ print_message() {
21
+ local color=$1
22
+ local message=$2
23
+ echo -e "${color}${message}${NC}"
24
+ }
25
+
26
+ # 检查源目录是否存在
27
+ if [ ! -d "$SOURCE_DIR" ]; then
28
+ print_message $RED "错误: 源目录 $SOURCE_DIR 不存在!"
29
+ exit 1
30
+ fi
31
+
32
+ # 创建目标目录(如果不存在)
33
+ if [ ! -d "$TARGET_DIR" ]; then
34
+ print_message $YELLOW "目标目录 $TARGET_DIR 不存在,正在创建..."
35
+ mkdir -p "$TARGET_DIR"
36
+ fi
37
+
38
+ print_message $GREEN "开始复制文件..."
39
+ print_message $YELLOW "源目录: $SOURCE_DIR"
40
+ print_message $YELLOW "目标目录: $TARGET_DIR"
41
+ echo
42
+
43
+ # 复制 src 目录
44
+ if [ -d "$SOURCE_DIR/src" ]; then
45
+ print_message $GREEN "复制 src 目录..."
46
+ cp -r "$SOURCE_DIR/src" "$TARGET_DIR/"
47
+ else
48
+ print_message $RED "警告: src 目录不存在于源路径中"
49
+ fi
50
+
51
+ # 复制 package.json
52
+ if [ -f "$SOURCE_DIR/package.json" ]; then
53
+ print_message $GREEN "复制 package.json..."
54
+ cp "$SOURCE_DIR/package.json" "$TARGET_DIR/"
55
+ else
56
+ print_message $RED "警告: package.json 不存在于源路径中"
57
+ fi
58
+
59
+ # 复制 README.md (假设是 README.md)
60
+ if [ -f "$SOURCE_DIR/README.md" ]; then
61
+ print_message $GREEN "复制 README.md..."
62
+ cp "$SOURCE_DIR/README.md" "$TARGET_DIR/"
63
+ elif [ -f "$SOURCE_DIR/README" ]; then
64
+ print_message $GREEN "复制 README..."
65
+ cp "$SOURCE_DIR/README" "$TARGET_DIR/"
66
+ else
67
+ print_message $RED "警告: README 或 README.md 不存在于源路径中"
68
+ fi
69
+
70
+ # 复制 tests 目录
71
+ if [ -d "$SOURCE_DIR/tests" ]; then
72
+ print_message $GREEN "复制 tests 目录..."
73
+ cp -r "$SOURCE_DIR/tests" "$TARGET_DIR/"
74
+ else
75
+ print_message $RED "警告: tests 目录不存在于源路径中"
76
+ fi
77
+
78
+ echo
79
+ print_message $GREEN "复制完成!"
80
+ print_message $YELLOW "复制的文件和目录位于: $TARGET_DIR"
81
+
82
+ # 显示目标目录内容
83
+ echo
84
+ print_message $YELLOW "目标目录内容:"
85
+ ls -la "$TARGET_DIR"