@cetusprotocol/aggregator-sdk 0.0.0-experimental-20250114195420 → 0.0.0-experimental-20250118224413

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -78,6 +78,7 @@ declare const SUILEND = "SUILEND";
78
78
  declare const BLUEFIN = "BLUEFIN";
79
79
  declare const HAEDALPMM = "HAEDALPMM";
80
80
  declare const ALPHAFI = "ALPHAFI";
81
+ declare const SPRINGSUI = "SPRINGSUI";
81
82
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
82
83
  type BuildRouterSwapParams = {
83
84
  routers: Router[];
@@ -292,4 +293,4 @@ declare enum Env {
292
293
  Testnet = 1
293
294
  }
294
295
 
295
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, 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, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, 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, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
296
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, 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, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, 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, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.d.ts CHANGED
@@ -78,6 +78,7 @@ declare const SUILEND = "SUILEND";
78
78
  declare const BLUEFIN = "BLUEFIN";
79
79
  declare const HAEDALPMM = "HAEDALPMM";
80
80
  declare const ALPHAFI = "ALPHAFI";
81
+ declare const SPRINGSUI = "SPRINGSUI";
81
82
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
82
83
  type BuildRouterSwapParams = {
83
84
  routers: Router[];
@@ -292,4 +293,4 @@ declare enum Env {
292
293
  Testnet = 1
293
294
  }
294
295
 
295
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, 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, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, 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, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
296
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient, 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, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SPRINGSUI, 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, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.js CHANGED
@@ -6270,6 +6270,7 @@ var SUILEND = "SUILEND";
6270
6270
  var BLUEFIN = "BLUEFIN";
6271
6271
  var HAEDALPMM = "HAEDALPMM";
6272
6272
  var ALPHAFI = "ALPHAFI";
6273
+ var SPRINGSUI = "SPRINGSUI";
6273
6274
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6274
6275
  function isBuilderRouterSwapParams(params) {
6275
6276
  return Array.isArray(params.routers);
@@ -6447,6 +6448,7 @@ var AggregatorClient19 = class {
6447
6448
  slippage
6448
6449
  );
6449
6450
  const packages = isBuilderRouterSwapParams(params) ? void 0 : params.routers.packages;
6451
+ console.log("packages11", packages);
6450
6452
  const aggregatorV2PublishedAt = getAggregatorV2PublishedAt(this.publishedAtV2(), packages);
6451
6453
  if (byAmountIn) {
6452
6454
  const targetCoin2 = yield this.expectInputSwap(
@@ -6573,7 +6575,7 @@ var AggregatorClient19 = class {
6573
6575
  // Include deepbookv3, scallop, bluefin
6574
6576
  publishedAtV2Extend() {
6575
6577
  if (this.env === 0 /* Mainnet */) {
6576
- return "0x4069913c4953297b7f08f67f6722e3b04aa5ab2976b4e1b8a456b81590b34ab4";
6578
+ return "0xf2fcea41dc217385019828375764fa06d9bd25e8e4726ba1962680849fb8d613";
6577
6579
  } else {
6578
6580
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
6579
6581
  }
@@ -6642,6 +6644,8 @@ var AggregatorClient19 = class {
6642
6644
  return new Scallop(this.env);
6643
6645
  case SUILEND:
6644
6646
  return new Suilend(this.env);
6647
+ case SPRINGSUI:
6648
+ return new Suilend(this.env);
6645
6649
  case BLUEFIN:
6646
6650
  return new Bluefin(this.env);
6647
6651
  case HAEDALPMM:
@@ -6782,24 +6786,34 @@ function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt, package
6782
6786
  // src/utils/msafe.ts
6783
6787
  var import_bn6 = __toESM(require_bn());
6784
6788
  var dealWithFastRouterSwapParamsForMsafe = (data) => {
6785
- const result = data.map((route) => {
6786
- return __spreadProps(__spreadValues({}, route), {
6787
- amountIn: route.amountIn.toString(),
6788
- amountOut: route.amountOut.toString(),
6789
- initialPrice: route.initialPrice.toString(),
6790
- path: route.path
6791
- });
6789
+ var _a, _b, _c;
6790
+ const result = __spreadProps(__spreadValues({}, data), {
6791
+ amountIn: (_a = data == null ? void 0 : data.amountIn) == null ? void 0 : _a.toString(),
6792
+ amountOut: (_b = data == null ? void 0 : data.amountIn) == null ? void 0 : _b.toString(),
6793
+ routes: (_c = data == null ? void 0 : data.routes) == null ? void 0 : _c.map((item) => {
6794
+ var _a2, _b2, _c2;
6795
+ return __spreadProps(__spreadValues({}, item), {
6796
+ amountIn: (_a2 = item == null ? void 0 : item.amountIn) == null ? void 0 : _a2.toString(),
6797
+ amountOut: (_b2 = item == null ? void 0 : item.amountOut) == null ? void 0 : _b2.toString(),
6798
+ initialPrice: (_c2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _c2.toString()
6799
+ });
6800
+ })
6792
6801
  });
6793
6802
  return result;
6794
6803
  };
6795
6804
  var restituteMsafeFastRouterSwapParams = (data) => {
6796
- const result = data.map((route) => {
6797
- return __spreadProps(__spreadValues({}, route), {
6798
- amountIn: new import_bn6.default(route.amountIn),
6799
- amountOut: new import_bn6.default(route.amountOut),
6800
- initialPrice: new decimal_default(route.initialPrice.toString()),
6801
- path: route.path
6802
- });
6805
+ var _a;
6806
+ const result = __spreadProps(__spreadValues({}, data), {
6807
+ amountIn: new import_bn6.default(data == null ? void 0 : data.amountIn),
6808
+ amountOut: new import_bn6.default(data == null ? void 0 : data.amountIn),
6809
+ routes: (_a = data == null ? void 0 : data.routes) == null ? void 0 : _a.map((item) => {
6810
+ var _a2;
6811
+ return __spreadProps(__spreadValues({}, item), {
6812
+ amountIn: new import_bn6.default(item == null ? void 0 : item.amountIn),
6813
+ amountOut: new import_bn6.default(item == null ? void 0 : item.amountOut),
6814
+ initialPrice: new decimal_default((_a2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _a2.toString())
6815
+ });
6816
+ })
6803
6817
  });
6804
6818
  return result;
6805
6819
  };
@@ -6909,7 +6923,7 @@ function getRouter(endpoint, params) {
6909
6923
  url += `&providers=${providers.join(",")}`;
6910
6924
  }
6911
6925
  }
6912
- url += "&v=1000318";
6926
+ url += "&v=1000319";
6913
6927
  const response = yield fetch(url);
6914
6928
  return response;
6915
6929
  } catch (error) {
@@ -7021,6 +7035,7 @@ exports.KRIYA = KRIYA;
7021
7035
  exports.KRIYAV3 = KRIYAV3;
7022
7036
  exports.ONE = ONE;
7023
7037
  exports.SCALLOP = SCALLOP;
7038
+ exports.SPRINGSUI = SPRINGSUI;
7024
7039
  exports.SUILEND = SUILEND;
7025
7040
  exports.TEN_POW_NINE = TEN_POW_NINE;
7026
7041
  exports.TURBOS = TURBOS;
package/dist/index.mjs CHANGED
@@ -6268,6 +6268,7 @@ var SUILEND = "SUILEND";
6268
6268
  var BLUEFIN = "BLUEFIN";
6269
6269
  var HAEDALPMM = "HAEDALPMM";
6270
6270
  var ALPHAFI = "ALPHAFI";
6271
+ var SPRINGSUI = "SPRINGSUI";
6271
6272
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6272
6273
  function isBuilderRouterSwapParams(params) {
6273
6274
  return Array.isArray(params.routers);
@@ -6445,6 +6446,7 @@ var AggregatorClient19 = class {
6445
6446
  slippage
6446
6447
  );
6447
6448
  const packages = isBuilderRouterSwapParams(params) ? void 0 : params.routers.packages;
6449
+ console.log("packages11", packages);
6448
6450
  const aggregatorV2PublishedAt = getAggregatorV2PublishedAt(this.publishedAtV2(), packages);
6449
6451
  if (byAmountIn) {
6450
6452
  const targetCoin2 = yield this.expectInputSwap(
@@ -6571,7 +6573,7 @@ var AggregatorClient19 = class {
6571
6573
  // Include deepbookv3, scallop, bluefin
6572
6574
  publishedAtV2Extend() {
6573
6575
  if (this.env === 0 /* Mainnet */) {
6574
- return "0x4069913c4953297b7f08f67f6722e3b04aa5ab2976b4e1b8a456b81590b34ab4";
6576
+ return "0xf2fcea41dc217385019828375764fa06d9bd25e8e4726ba1962680849fb8d613";
6575
6577
  } else {
6576
6578
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
6577
6579
  }
@@ -6640,6 +6642,8 @@ var AggregatorClient19 = class {
6640
6642
  return new Scallop(this.env);
6641
6643
  case SUILEND:
6642
6644
  return new Suilend(this.env);
6645
+ case SPRINGSUI:
6646
+ return new Suilend(this.env);
6643
6647
  case BLUEFIN:
6644
6648
  return new Bluefin(this.env);
6645
6649
  case HAEDALPMM:
@@ -6780,24 +6784,34 @@ function getAggregatorV2ExtendPublishedAt(aggregatorV2ExtendPublishedAt, package
6780
6784
  // src/utils/msafe.ts
6781
6785
  var import_bn6 = __toESM(require_bn());
6782
6786
  var dealWithFastRouterSwapParamsForMsafe = (data) => {
6783
- const result = data.map((route) => {
6784
- return __spreadProps(__spreadValues({}, route), {
6785
- amountIn: route.amountIn.toString(),
6786
- amountOut: route.amountOut.toString(),
6787
- initialPrice: route.initialPrice.toString(),
6788
- path: route.path
6789
- });
6787
+ var _a, _b, _c;
6788
+ const result = __spreadProps(__spreadValues({}, data), {
6789
+ amountIn: (_a = data == null ? void 0 : data.amountIn) == null ? void 0 : _a.toString(),
6790
+ amountOut: (_b = data == null ? void 0 : data.amountIn) == null ? void 0 : _b.toString(),
6791
+ routes: (_c = data == null ? void 0 : data.routes) == null ? void 0 : _c.map((item) => {
6792
+ var _a2, _b2, _c2;
6793
+ return __spreadProps(__spreadValues({}, item), {
6794
+ amountIn: (_a2 = item == null ? void 0 : item.amountIn) == null ? void 0 : _a2.toString(),
6795
+ amountOut: (_b2 = item == null ? void 0 : item.amountOut) == null ? void 0 : _b2.toString(),
6796
+ initialPrice: (_c2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _c2.toString()
6797
+ });
6798
+ })
6790
6799
  });
6791
6800
  return result;
6792
6801
  };
6793
6802
  var restituteMsafeFastRouterSwapParams = (data) => {
6794
- const result = data.map((route) => {
6795
- return __spreadProps(__spreadValues({}, route), {
6796
- amountIn: new import_bn6.default(route.amountIn),
6797
- amountOut: new import_bn6.default(route.amountOut),
6798
- initialPrice: new decimal_default(route.initialPrice.toString()),
6799
- path: route.path
6800
- });
6803
+ var _a;
6804
+ const result = __spreadProps(__spreadValues({}, data), {
6805
+ amountIn: new import_bn6.default(data == null ? void 0 : data.amountIn),
6806
+ amountOut: new import_bn6.default(data == null ? void 0 : data.amountIn),
6807
+ routes: (_a = data == null ? void 0 : data.routes) == null ? void 0 : _a.map((item) => {
6808
+ var _a2;
6809
+ return __spreadProps(__spreadValues({}, item), {
6810
+ amountIn: new import_bn6.default(item == null ? void 0 : item.amountIn),
6811
+ amountOut: new import_bn6.default(item == null ? void 0 : item.amountOut),
6812
+ initialPrice: new decimal_default((_a2 = item == null ? void 0 : item.initialPrice) == null ? void 0 : _a2.toString())
6813
+ });
6814
+ })
6801
6815
  });
6802
6816
  return result;
6803
6817
  };
@@ -6907,7 +6921,7 @@ function getRouter(endpoint, params) {
6907
6921
  url += `&providers=${providers.join(",")}`;
6908
6922
  }
6909
6923
  }
6910
- url += "&v=1000318";
6924
+ url += "&v=1000319";
6911
6925
  const response = yield fetch(url);
6912
6926
  return response;
6913
6927
  } catch (error) {
@@ -6997,4 +7011,4 @@ decimal.js/decimal.mjs:
6997
7011
  *)
6998
7012
  */
6999
7013
 
7000
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient19 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, SCALLOP, SUILEND, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
7014
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, ALPHAFI, AggregatorClient19 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, KRIYA, KRIYAV3, ONE, SCALLOP, SPRINGSUI, SUILEND, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, buildInputCoin, checkInvalidSuiAddress, compareCoins, completionCoin, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getAggregatorV2ExtendPublishedAt, getAggregatorV2PublishedAt, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
@@ -22,6 +22,7 @@ export declare const SUILEND = "SUILEND";
22
22
  export declare const BLUEFIN = "BLUEFIN";
23
23
  export declare const HAEDALPMM = "HAEDALPMM";
24
24
  export declare const ALPHAFI = "ALPHAFI";
25
+ export declare const SPRINGSUI = "SPRINGSUI";
25
26
  export declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
26
27
  export type BuildRouterSwapParams = {
27
28
  routers: Router[];
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "aggregator-example",
3
+ "version": "1.0.0",
4
+ "description": "Cetus Aggregator SDK usage example",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "swap": "ts-node swap.ts"
8
+ },
9
+ "dependencies": {
10
+ "@cetusprotocol/aggregator-sdk": "^0.3.18",
11
+ "@mysten/sui.js": "^0.49.1"
12
+ },
13
+ "devDependencies": {
14
+ "typescript": "^5.0.0",
15
+ "ts-node": "^10.9.1"
16
+ }
17
+ }
@@ -0,0 +1,21 @@
1
+ import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
2
+ import BN from "bn.js"
3
+
4
+ async function main() {
5
+ // default to mainnet
6
+ const client = new AggregatorClient()
7
+
8
+ const from = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
9
+ const target = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
10
+
11
+ const routers = await client.findRouters({
12
+ from,
13
+ target,
14
+ amount: new BN(1000000000),
15
+ byAmountIn: true,
16
+ })
17
+
18
+ console.log(routers)
19
+ }
20
+
21
+ main()
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2020",
4
+ "module": "commonjs",
5
+ "strict": true,
6
+ "esModuleInterop": true,
7
+ "skipLibCheck": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "outDir": "./dist"
10
+ },
11
+ "include": ["examples/**/*"]
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.0.0-experimental-20250114195420",
3
+ "version": "0.0.0-experimental-20250118224413",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api.ts CHANGED
@@ -190,7 +190,7 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
190
190
  }
191
191
 
192
192
  // set newest sdk version
193
- url += "&v=1000318"
193
+ url += "&v=1000319"
194
194
 
195
195
  const response = await fetch(url)
196
196
  return response
package/src/client.ts CHANGED
@@ -63,6 +63,7 @@ export const SUILEND = "SUILEND"
63
63
  export const BLUEFIN = "BLUEFIN"
64
64
  export const HAEDALPMM = "HAEDALPMM"
65
65
  export const ALPHAFI = "ALPHAFI"
66
+ export const SPRINGSUI = "SPRINGSUI"
66
67
  export const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2"
67
68
 
68
69
  export type BuildRouterSwapParams = {
@@ -347,6 +348,8 @@ export class AggregatorClient {
347
348
 
348
349
  const packages = isBuilderRouterSwapParams(params) ? undefined : params.routers.packages
349
350
 
351
+ console.log("packages11", packages)
352
+
350
353
  const aggregatorV2PublishedAt = getAggregatorV2PublishedAt(this.publishedAtV2(), packages)
351
354
 
352
355
  if (byAmountIn) {
@@ -494,7 +497,7 @@ export class AggregatorClient {
494
497
  // return "0x3b6d71bdeb8ce5b06febfd3cfc29ecd60d50da729477c8b8038ecdae34541b91" // version 5, add bluefin
495
498
  // return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502" // version 6, force upgrade scallop
496
499
  // return "0x347dd58bbd11cd82c8b386b344729717c04a998da73386e82a239cc196d5706b" // version 7
497
- return "0x4069913c4953297b7f08f67f6722e3b04aa5ab2976b4e1b8a456b81590b34ab4" // pre
500
+ return "0xf2fcea41dc217385019828375764fa06d9bd25e8e4726ba1962680849fb8d613" // version 8
498
501
  } else {
499
502
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"
500
503
  }
@@ -579,6 +582,8 @@ export class AggregatorClient {
579
582
  return new Scallop(this.env)
580
583
  case SUILEND:
581
584
  return new Suilend(this.env)
585
+ case SPRINGSUI:
586
+ return new Suilend(this.env)
582
587
  case BLUEFIN:
583
588
  return new Bluefin(this.env)
584
589
  case HAEDALPMM:
@@ -3,29 +3,38 @@ import BN from 'bn.js'
3
3
  import Decimal from "decimal.js"
4
4
 
5
5
  export const dealWithFastRouterSwapParamsForMsafe = (data: any) => {
6
- const result =data.map((route: any) => {
6
+ const result = {
7
+ ...data,
8
+ amountIn: data?.amountIn?.toString(),
9
+ amountOut: data?.amountIn?.toString(),
10
+ routes: data?.routes?.map((item:any) => {
7
11
  return {
8
- ...route,
9
- amountIn: route.amountIn.toString(),
10
- amountOut: route.amountOut.toString(),
11
- initialPrice: route.initialPrice.toString(),
12
- path: route.path
12
+ ...item,
13
+ amountIn: item?.amountIn?.toString(),
14
+ amountOut: item?.amountOut?.toString(),
15
+ initialPrice: item?.initialPrice?.toString()
13
16
  }
14
17
  })
15
-
16
- return result
17
18
  }
18
19
 
19
- export const restituteMsafeFastRouterSwapParams = (data: any) => {
20
- const result =data.map((route: any) => {
20
+ return result
21
+ }
22
+
23
+
24
+ export const restituteMsafeFastRouterSwapParams = (data: any) => {
25
+ const result = {
26
+ ...data,
27
+ amountIn: new BN(data?.amountIn),
28
+ amountOut: new BN(data?.amountIn),
29
+ routes: data?.routes?.map((item:any) => {
21
30
  return {
22
- ...route,
23
- amountIn: new BN(route.amountIn),
24
- amountOut: new BN(route.amountOut),
25
- initialPrice: new Decimal(route.initialPrice.toString()),
26
- path: route.path
31
+ ...item,
32
+ amountIn: new BN(item?.amountIn),
33
+ amountOut: new BN(item?.amountOut),
34
+ initialPrice: new Decimal(item?.initialPrice?.toString())
27
35
  }
28
36
  })
29
-
30
- return result
31
- }
37
+ }
38
+
39
+ return result
40
+ }