@cetusprotocol/aggregator-sdk 0.10.0 → 0.11.1

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
@@ -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
@@ -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;
@@ -6821,7 +6857,9 @@ var _AggregatorClient = class _AggregatorClient {
6821
6857
  if (!pythUrls.includes("https://hermes.pyth.network")) {
6822
6858
  pythUrls.push("https://hermes.pyth.network");
6823
6859
  }
6824
- const connections = pythUrls.map((url) => new pythSuiJs.SuiPriceServiceConnection(url, { timeout: 3e3 }));
6860
+ const connections = pythUrls.map(
6861
+ (url) => new pythSuiJs.SuiPriceServiceConnection(url, { timeout: 3e3 })
6862
+ );
6825
6863
  return connections;
6826
6864
  }
6827
6865
  getCoins(coinType, refresh = true) {
@@ -6868,7 +6906,13 @@ var _AggregatorClient = class _AggregatorClient {
6868
6906
  }
6869
6907
  findRouters(params) {
6870
6908
  return __async(this, null, function* () {
6871
- return getRouterResult(this.endpoint, this.apiKey, params, this.overlayFeeRate, this.overlayFeeReceiver);
6909
+ return getRouterResult(
6910
+ this.endpoint,
6911
+ this.apiKey,
6912
+ params,
6913
+ this.overlayFeeRate,
6914
+ this.overlayFeeReceiver
6915
+ );
6872
6916
  });
6873
6917
  }
6874
6918
  executeFlexibleInputSwap(txb, inputCoin, routers, expectedAmountOut, amountLimit, pythPriceIDs, partner, deepbookv3DeepFee, packages) {
@@ -6882,7 +6926,9 @@ var _AggregatorClient = class _AggregatorClient {
6882
6926
  if (routers[i].path.length === 0) {
6883
6927
  throw new Error("Empty path");
6884
6928
  }
6885
- const splitCoin = txb.splitCoins(inputCoin, [routers[i].amountIn.toString()]);
6929
+ const splitCoin = txb.splitCoins(inputCoin, [
6930
+ routers[i].amountIn.toString()
6931
+ ]);
6886
6932
  let nextCoin = splitCoin[0];
6887
6933
  for (const path of routers[i].path) {
6888
6934
  const dex = this.newDex(path.provider, pythPriceIDs, partner);
@@ -7059,7 +7105,9 @@ var _AggregatorClient = class _AggregatorClient {
7059
7105
  return __async(this, null, function* () {
7060
7106
  const { routers, inputCoin, slippage, txb, deepbookv3DeepFee, partner } = params;
7061
7107
  if (slippage > 1 || slippage < 0) {
7062
- throw new Error("Invalid slippage value. Must be between 0 and 1 (e.g., 0.01 represents 1% slippage)");
7108
+ throw new Error(
7109
+ "Invalid slippage value. Must be between 0 and 1 (e.g., 0.01 represents 1% slippage)"
7110
+ );
7063
7111
  }
7064
7112
  const routerData = Array.isArray(routers) ? routers : routers.routes;
7065
7113
  const byAmountIn = isBuilderRouterSwapParams(params) ? params.byAmountIn : params.routers.byAmountIn;
@@ -7108,9 +7156,7 @@ var _AggregatorClient = class _AggregatorClient {
7108
7156
  return targetCoin2;
7109
7157
  }
7110
7158
  if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
7111
- const overlayFeeCoin = txb.splitCoins(inputCoin, [
7112
- overlayFee.toString()
7113
- ]);
7159
+ const overlayFeeCoin = txb.splitCoins(inputCoin, [overlayFee.toString()]);
7114
7160
  txb.transferObjects([overlayFeeCoin], this.overlayFeeReceiver);
7115
7161
  }
7116
7162
  const splitedInputCoins = txb.splitCoins(inputCoin, [
@@ -7147,9 +7193,13 @@ var _AggregatorClient = class _AggregatorClient {
7147
7193
  let overlayFee = 0;
7148
7194
  if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
7149
7195
  if (byAmountIn) {
7150
- overlayFee = Number(amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7196
+ overlayFee = Number(
7197
+ amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7198
+ );
7151
7199
  } else {
7152
- overlayFee = Number(amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7200
+ overlayFee = Number(
7201
+ amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7202
+ );
7153
7203
  }
7154
7204
  }
7155
7205
  const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
@@ -7213,9 +7263,13 @@ var _AggregatorClient = class _AggregatorClient {
7213
7263
  let overlayFee = 0;
7214
7264
  if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
7215
7265
  if (byAmountIn) {
7216
- overlayFee = Number(amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7266
+ overlayFee = Number(
7267
+ amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7268
+ );
7217
7269
  } else {
7218
- overlayFee = Number(amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7270
+ overlayFee = Number(
7271
+ amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7272
+ );
7219
7273
  }
7220
7274
  }
7221
7275
  const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
@@ -7290,7 +7344,7 @@ var _AggregatorClient = class _AggregatorClient {
7290
7344
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7291
7345
  publishedAtV2() {
7292
7346
  if (this.env === 0 /* Mainnet */) {
7293
- return "0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032";
7347
+ return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
7294
7348
  } else {
7295
7349
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7296
7350
  }
@@ -7298,14 +7352,14 @@ var _AggregatorClient = class _AggregatorClient {
7298
7352
  // Include deepbookv3, scallop, bluefin
7299
7353
  publishedAtV2Extend() {
7300
7354
  if (this.env === 0 /* Mainnet */) {
7301
- return "0xa2fe8e900d719813fee1ffaea14d5a2b5516a4d15b75f14aa0cf27c531c20ae3";
7355
+ return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
7302
7356
  } else {
7303
7357
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7304
7358
  }
7305
7359
  }
7306
7360
  publishedAtV2Extend2() {
7307
7361
  if (this.env === 0 /* Mainnet */) {
7308
- return "0xed2b71968fb6b74c2161bad4c98561c28c69ce82df2cb3707c3b8bc947f2162d";
7362
+ return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
7309
7363
  } else {
7310
7364
  return "0x0";
7311
7365
  }
@@ -7487,7 +7541,9 @@ var _AggregatorClient = class _AggregatorClient {
7487
7541
  priceIDs
7488
7542
  );
7489
7543
  } catch (e) {
7490
- throw new Error(`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${e}`);
7544
+ throw new Error(
7545
+ `All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${e}`
7546
+ );
7491
7547
  }
7492
7548
  let priceInfoObjectIdsMap = /* @__PURE__ */ new Map();
7493
7549
  for (let i = 0; i < priceIDs.length; i++) {
@@ -7704,7 +7760,7 @@ function processEndpoint(endpoint) {
7704
7760
 
7705
7761
  // src/api.ts
7706
7762
  var import_bn7 = __toESM(require_bn());
7707
- var SDK_VERSION = 1001e3;
7763
+ var SDK_VERSION = 1001101;
7708
7764
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7709
7765
  return __async(this, null, function* () {
7710
7766
  let response;
@@ -7913,6 +7969,7 @@ exports.AFTERMATH = AFTERMATH;
7913
7969
  exports.AGGREGATOR_V2 = AGGREGATOR_V2;
7914
7970
  exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
7915
7971
  exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
7972
+ exports.ALL_DEXES = ALL_DEXES;
7916
7973
  exports.ALPHAFI = ALPHAFI;
7917
7974
  exports.AggregatorClient = AggregatorClient26;
7918
7975
  exports.BLUEFIN = BLUEFIN;
@@ -7962,7 +8019,10 @@ exports.fixSuiObjectId = fixSuiObjectId;
7962
8019
  exports.getAggregatorV2Extend2PublishedAt = getAggregatorV2Extend2PublishedAt;
7963
8020
  exports.getAggregatorV2ExtendPublishedAt = getAggregatorV2ExtendPublishedAt;
7964
8021
  exports.getAggregatorV2PublishedAt = getAggregatorV2PublishedAt;
8022
+ exports.getAllProviders = getAllProviders;
7965
8023
  exports.getDeepbookV3Config = getDeepbookV3Config;
8024
+ exports.getProvidersExcluding = getProvidersExcluding;
8025
+ exports.getProvidersIncluding = getProvidersIncluding;
7966
8026
  exports.getRouterResult = getRouterResult;
7967
8027
  exports.isSortedSymbols = isSortedSymbols;
7968
8028
  exports.mintZeroCoin = mintZeroCoin;
package/dist/index.mjs CHANGED
@@ -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;
@@ -6819,7 +6855,9 @@ var _AggregatorClient = class _AggregatorClient {
6819
6855
  if (!pythUrls.includes("https://hermes.pyth.network")) {
6820
6856
  pythUrls.push("https://hermes.pyth.network");
6821
6857
  }
6822
- const connections = pythUrls.map((url) => new SuiPriceServiceConnection(url, { timeout: 3e3 }));
6858
+ const connections = pythUrls.map(
6859
+ (url) => new SuiPriceServiceConnection(url, { timeout: 3e3 })
6860
+ );
6823
6861
  return connections;
6824
6862
  }
6825
6863
  getCoins(coinType, refresh = true) {
@@ -6866,7 +6904,13 @@ var _AggregatorClient = class _AggregatorClient {
6866
6904
  }
6867
6905
  findRouters(params) {
6868
6906
  return __async(this, null, function* () {
6869
- return getRouterResult(this.endpoint, this.apiKey, params, this.overlayFeeRate, this.overlayFeeReceiver);
6907
+ return getRouterResult(
6908
+ this.endpoint,
6909
+ this.apiKey,
6910
+ params,
6911
+ this.overlayFeeRate,
6912
+ this.overlayFeeReceiver
6913
+ );
6870
6914
  });
6871
6915
  }
6872
6916
  executeFlexibleInputSwap(txb, inputCoin, routers, expectedAmountOut, amountLimit, pythPriceIDs, partner, deepbookv3DeepFee, packages) {
@@ -6880,7 +6924,9 @@ var _AggregatorClient = class _AggregatorClient {
6880
6924
  if (routers[i].path.length === 0) {
6881
6925
  throw new Error("Empty path");
6882
6926
  }
6883
- const splitCoin = txb.splitCoins(inputCoin, [routers[i].amountIn.toString()]);
6927
+ const splitCoin = txb.splitCoins(inputCoin, [
6928
+ routers[i].amountIn.toString()
6929
+ ]);
6884
6930
  let nextCoin = splitCoin[0];
6885
6931
  for (const path of routers[i].path) {
6886
6932
  const dex = this.newDex(path.provider, pythPriceIDs, partner);
@@ -7057,7 +7103,9 @@ var _AggregatorClient = class _AggregatorClient {
7057
7103
  return __async(this, null, function* () {
7058
7104
  const { routers, inputCoin, slippage, txb, deepbookv3DeepFee, partner } = params;
7059
7105
  if (slippage > 1 || slippage < 0) {
7060
- throw new Error("Invalid slippage value. Must be between 0 and 1 (e.g., 0.01 represents 1% slippage)");
7106
+ throw new Error(
7107
+ "Invalid slippage value. Must be between 0 and 1 (e.g., 0.01 represents 1% slippage)"
7108
+ );
7061
7109
  }
7062
7110
  const routerData = Array.isArray(routers) ? routers : routers.routes;
7063
7111
  const byAmountIn = isBuilderRouterSwapParams(params) ? params.byAmountIn : params.routers.byAmountIn;
@@ -7106,9 +7154,7 @@ var _AggregatorClient = class _AggregatorClient {
7106
7154
  return targetCoin2;
7107
7155
  }
7108
7156
  if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
7109
- const overlayFeeCoin = txb.splitCoins(inputCoin, [
7110
- overlayFee.toString()
7111
- ]);
7157
+ const overlayFeeCoin = txb.splitCoins(inputCoin, [overlayFee.toString()]);
7112
7158
  txb.transferObjects([overlayFeeCoin], this.overlayFeeReceiver);
7113
7159
  }
7114
7160
  const splitedInputCoins = txb.splitCoins(inputCoin, [
@@ -7145,9 +7191,13 @@ var _AggregatorClient = class _AggregatorClient {
7145
7191
  let overlayFee = 0;
7146
7192
  if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
7147
7193
  if (byAmountIn) {
7148
- overlayFee = Number(amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7194
+ overlayFee = Number(
7195
+ amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7196
+ );
7149
7197
  } else {
7150
- overlayFee = Number(amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7198
+ overlayFee = Number(
7199
+ amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7200
+ );
7151
7201
  }
7152
7202
  }
7153
7203
  const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
@@ -7211,9 +7261,13 @@ var _AggregatorClient = class _AggregatorClient {
7211
7261
  let overlayFee = 0;
7212
7262
  if (this.overlayFeeRate > 0 && this.overlayFeeReceiver !== "0x0") {
7213
7263
  if (byAmountIn) {
7214
- overlayFee = Number(amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7264
+ overlayFee = Number(
7265
+ amountOut.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7266
+ );
7215
7267
  } else {
7216
- overlayFee = Number(amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString());
7268
+ overlayFee = Number(
7269
+ amountIn.mul(new import_bn5.default(this.overlayFeeRate)).div(new import_bn5.default(1e6)).toString()
7270
+ );
7217
7271
  }
7218
7272
  }
7219
7273
  const expectedAmountOut = byAmountIn ? amountOut.sub(new import_bn5.default(overlayFee)) : amountOut;
@@ -7288,7 +7342,7 @@ var _AggregatorClient = class _AggregatorClient {
7288
7342
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7289
7343
  publishedAtV2() {
7290
7344
  if (this.env === 0 /* Mainnet */) {
7291
- return "0x3864c7c59a4889fec05d1aae4bc9dba5a0e0940594b424fbed44cb3f6ac4c032";
7345
+ return "0x51966dc1d9d3e6d85aed55aa87eb9e78e928b4e74b4844a15ef7e3dfb5af3bae";
7292
7346
  } else {
7293
7347
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7294
7348
  }
@@ -7296,14 +7350,14 @@ var _AggregatorClient = class _AggregatorClient {
7296
7350
  // Include deepbookv3, scallop, bluefin
7297
7351
  publishedAtV2Extend() {
7298
7352
  if (this.env === 0 /* Mainnet */) {
7299
- return "0xa2fe8e900d719813fee1ffaea14d5a2b5516a4d15b75f14aa0cf27c531c20ae3";
7353
+ return "0x7cdd26c4aa40c990d5ca780e0919b2de796be9bb41fba461d133bfacb0f677bc";
7300
7354
  } else {
7301
7355
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7302
7356
  }
7303
7357
  }
7304
7358
  publishedAtV2Extend2() {
7305
7359
  if (this.env === 0 /* Mainnet */) {
7306
- return "0xed2b71968fb6b74c2161bad4c98561c28c69ce82df2cb3707c3b8bc947f2162d";
7360
+ return "0x186d6d71cedd341ad744e40873cc1513ac539ffac860d0c3ebd27ec5da63d9ba";
7307
7361
  } else {
7308
7362
  return "0x0";
7309
7363
  }
@@ -7485,7 +7539,9 @@ var _AggregatorClient = class _AggregatorClient {
7485
7539
  priceIDs
7486
7540
  );
7487
7541
  } catch (e) {
7488
- throw new Error(`All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${e}`);
7542
+ throw new Error(
7543
+ `All Pyth price nodes are unavailable. Cannot fetch price data. Please switch to or add new available Pyth nodes in the pythUrls parameter when initializing AggregatorClient, for example: new AggregatorClient({ pythUrls: ["https://your-pyth-node-url"] }). Detailed error: ${e}`
7544
+ );
7489
7545
  }
7490
7546
  let priceInfoObjectIdsMap = /* @__PURE__ */ new Map();
7491
7547
  for (let i = 0; i < priceIDs.length; i++) {
@@ -7702,7 +7758,7 @@ function processEndpoint(endpoint) {
7702
7758
 
7703
7759
  // src/api.ts
7704
7760
  var import_bn7 = __toESM(require_bn());
7705
- var SDK_VERSION = 1001e3;
7761
+ var SDK_VERSION = 1001101;
7706
7762
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7707
7763
  return __async(this, null, function* () {
7708
7764
  let response;
@@ -7906,4 +7962,4 @@ decimal.js/decimal.mjs:
7906
7962
  *)
7907
7963
  */
7908
7964
 
7909
- 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.10.0",
3
+ "version": "0.11.1",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",