@cetusprotocol/aggregator-sdk 0.13.1 → 0.14.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/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 MAGMA = "MAGMA";
91
+ declare const SEVENK = "SEVENK";
91
92
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
92
93
  declare const ALL_DEXES: string[];
93
94
  type BuildRouterSwapParams = {
@@ -302,6 +303,11 @@ type ExtendedDetails = {
302
303
  obricCoinBPriceSeed?: string;
303
304
  obricCoinAPriceId?: string;
304
305
  obricCoinBPriceId?: string;
306
+ sevenkCoinAPriceSeed?: string;
307
+ sevenkCoinBPriceSeed?: string;
308
+ sevenkCoinAOracleId?: string;
309
+ sevenkCoinBOracleId?: string;
310
+ sevenkLPCapType?: string;
305
311
  };
306
312
  type Path = {
307
313
  id: string;
@@ -366,4 +372,4 @@ declare enum Env {
366
372
  Testnet = 1
367
373
  }
368
374
 
369
- 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, MAGMA, 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 };
375
+ 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, MAGMA, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SEVENK, 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 MAGMA = "MAGMA";
91
+ declare const SEVENK = "SEVENK";
91
92
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
92
93
  declare const ALL_DEXES: string[];
93
94
  type BuildRouterSwapParams = {
@@ -302,6 +303,11 @@ type ExtendedDetails = {
302
303
  obricCoinBPriceSeed?: string;
303
304
  obricCoinAPriceId?: string;
304
305
  obricCoinBPriceId?: string;
306
+ sevenkCoinAPriceSeed?: string;
307
+ sevenkCoinBPriceSeed?: string;
308
+ sevenkCoinAOracleId?: string;
309
+ sevenkCoinBOracleId?: string;
310
+ sevenkLPCapType?: string;
305
311
  };
306
312
  type Path = {
307
313
  id: string;
@@ -366,4 +372,4 @@ declare enum Env {
366
372
  Testnet = 1
367
373
  }
368
374
 
369
- 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, MAGMA, 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 };
375
+ 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, MAGMA, METASTABLE, MOMENTUM, OBRIC, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, SCALLOP, SEVENK, 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
@@ -6788,6 +6788,87 @@ var Magma = class {
6788
6788
  }
6789
6789
  };
6790
6790
 
6791
+ // src/transaction/sevenk.ts
6792
+ var Sevenk = class {
6793
+ constructor(env, pythPriceIDs) {
6794
+ if (env === 1 /* Testnet */) {
6795
+ throw new Error("Sevenk is not supported on testnet");
6796
+ }
6797
+ this.pythPriceIDs = pythPriceIDs;
6798
+ this.oraclePublishedAt = "0x8c36ea167c5e6da8c3d60b4fc897416105dcb986471bd81cfbfd38720a4487c0";
6799
+ }
6800
+ swap(client, txb, path, inputCoin, packages) {
6801
+ return __async(this, null, function* () {
6802
+ const { direction, from, target } = path;
6803
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6804
+ let coinAPriceSeed;
6805
+ let coinBPriceSeed;
6806
+ let coinAOracleId;
6807
+ let coinBOracleId;
6808
+ let lpCapType;
6809
+ if (path.extendedDetails == null) {
6810
+ throw new Error("Extended details not supported haedal pmm");
6811
+ } else {
6812
+ if (!path.extendedDetails.sevenkCoinAPriceSeed || !path.extendedDetails.sevenkCoinBPriceSeed || !path.extendedDetails.sevenkCoinAOracleId || !path.extendedDetails.sevenkCoinBOracleId || !path.extendedDetails.sevenkLPCapType) {
6813
+ throw new Error("Base price seed or quote price seed not supported");
6814
+ }
6815
+ coinAPriceSeed = path.extendedDetails.sevenkCoinAPriceSeed;
6816
+ coinBPriceSeed = path.extendedDetails.sevenkCoinBPriceSeed;
6817
+ coinAOracleId = path.extendedDetails.sevenkCoinAOracleId;
6818
+ coinBOracleId = path.extendedDetails.sevenkCoinBOracleId;
6819
+ lpCapType = path.extendedDetails.sevenkLPCapType;
6820
+ }
6821
+ const coinAPriceInfoObjectId = this.pythPriceIDs.get(coinAPriceSeed);
6822
+ const coinBPriceInfoObjectId = this.pythPriceIDs.get(coinBPriceSeed);
6823
+ if (!coinAPriceInfoObjectId || !coinBPriceInfoObjectId) {
6824
+ throw new Error(
6825
+ "Base price info object id or quote price info object id not found"
6826
+ );
6827
+ }
6828
+ const holder = txb.moveCall({
6829
+ target: `${this.oraclePublishedAt}::oracle::new_holder`,
6830
+ typeArguments: [],
6831
+ arguments: []
6832
+ });
6833
+ txb.moveCall({
6834
+ target: `${this.oraclePublishedAt}::pyth::get_price`,
6835
+ typeArguments: [],
6836
+ arguments: [
6837
+ txb.object(coinAOracleId),
6838
+ holder,
6839
+ txb.object(coinAPriceInfoObjectId),
6840
+ txb.object(CLOCK_ADDRESS)
6841
+ ]
6842
+ });
6843
+ txb.moveCall({
6844
+ target: `${this.oraclePublishedAt}::pyth::get_price`,
6845
+ typeArguments: [],
6846
+ arguments: [
6847
+ txb.object(coinBOracleId),
6848
+ holder,
6849
+ txb.object(coinBPriceInfoObjectId),
6850
+ txb.object(CLOCK_ADDRESS)
6851
+ ]
6852
+ });
6853
+ const args = [
6854
+ txb.object(path.id),
6855
+ holder,
6856
+ inputCoin
6857
+ ];
6858
+ const publishedAt = getAggregatorV2Extend2PublishedAt(
6859
+ client.publishedAtV2Extend2(),
6860
+ packages
6861
+ );
6862
+ const res = txb.moveCall({
6863
+ target: `${publishedAt}::sevenk::${func}`,
6864
+ typeArguments: [coinAType, coinBType, lpCapType],
6865
+ arguments: args
6866
+ });
6867
+ return res;
6868
+ });
6869
+ }
6870
+ };
6871
+
6791
6872
  // src/client.ts
6792
6873
  var CETUS = "CETUS";
6793
6874
  var DEEPBOOKV2 = "DEEPBOOK";
@@ -6816,6 +6897,7 @@ var STEAMM_OMM = "STEAMM_OMM";
6816
6897
  var MOMENTUM = "MOMENTUM";
6817
6898
  var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
6818
6899
  var MAGMA = "MAGMA";
6900
+ var SEVENK = "SEVENK";
6819
6901
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6820
6902
  var ALL_DEXES = [
6821
6903
  CETUS,
@@ -6843,7 +6925,8 @@ var ALL_DEXES = [
6843
6925
  MOMENTUM,
6844
6926
  STEAMM_OMM,
6845
6927
  STEAMM_OMM_V2,
6846
- MAGMA
6928
+ MAGMA,
6929
+ SEVENK
6847
6930
  ];
6848
6931
  function isBuilderRouterSwapParams(params) {
6849
6932
  return Array.isArray(params.routers);
@@ -7390,7 +7473,7 @@ var _AggregatorClient = class _AggregatorClient {
7390
7473
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7391
7474
  publishedAtV2() {
7392
7475
  if (this.env === 0 /* Mainnet */) {
7393
- return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7476
+ return "0x8ae871505a80d8bf6bf9c05906cda6edfeea460c85bebe2e26a4313f5e67874a";
7394
7477
  } else {
7395
7478
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7396
7479
  }
@@ -7398,14 +7481,14 @@ var _AggregatorClient = class _AggregatorClient {
7398
7481
  // Include deepbookv3, scallop, bluefin
7399
7482
  publishedAtV2Extend() {
7400
7483
  if (this.env === 0 /* Mainnet */) {
7401
- return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7484
+ return "0x8a2f7a5b20665eeccc79de3aa37c3b6c473eca233ada1e1cd4678ec07d4d4073";
7402
7485
  } else {
7403
7486
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7404
7487
  }
7405
7488
  }
7406
7489
  publishedAtV2Extend2() {
7407
7490
  if (this.env === 0 /* Mainnet */) {
7408
- return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
7491
+ return "0x5cb7499fc49c2642310e24a4ecffdbee00133f97e80e2b45bca90c64d55de880";
7409
7492
  } else {
7410
7493
  return "0x0";
7411
7494
  }
@@ -7516,6 +7599,8 @@ var _AggregatorClient = class _AggregatorClient {
7516
7599
  return new SteammOmmV2(this.env, pythPriceIDs);
7517
7600
  case MAGMA:
7518
7601
  return new Magma(this.env);
7602
+ case SEVENK:
7603
+ return new Sevenk(this.env, pythPriceIDs);
7519
7604
  default:
7520
7605
  throw new Error(`Unsupported dex ${provider}`);
7521
7606
  }
@@ -7611,7 +7696,7 @@ _AggregatorClient.CONFIG = {
7611
7696
  pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
7612
7697
  }
7613
7698
  };
7614
- var AggregatorClient27 = _AggregatorClient;
7699
+ var AggregatorClient28 = _AggregatorClient;
7615
7700
  function findPythPriceIDs(routes) {
7616
7701
  const priceIDs = /* @__PURE__ */ new Set();
7617
7702
  for (const route of routes) {
@@ -7646,6 +7731,14 @@ function findPythPriceIDs(routes) {
7646
7731
  priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedB);
7647
7732
  }
7648
7733
  }
7734
+ if (path.provider === SEVENK) {
7735
+ if (path.extendedDetails && path.extendedDetails.sevenkCoinAPriceSeed) {
7736
+ priceIDs.add(path.extendedDetails.sevenkCoinAPriceSeed);
7737
+ }
7738
+ if (path.extendedDetails && path.extendedDetails.sevenkCoinBPriceSeed) {
7739
+ priceIDs.add(path.extendedDetails.sevenkCoinBPriceSeed);
7740
+ }
7741
+ }
7649
7742
  }
7650
7743
  }
7651
7744
  return Array.from(priceIDs);
@@ -7674,13 +7767,13 @@ function parseRouterResponse(data, byAmountIn) {
7674
7767
  routes: data.routes.map((route) => {
7675
7768
  return {
7676
7769
  path: route.path.map((path) => {
7677
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
7770
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I;
7678
7771
  let version;
7679
7772
  if (path.provider === AFTERMATH) {
7680
7773
  version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
7681
7774
  }
7682
7775
  let extendedDetails;
7683
- if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider === METASTABLE || path.provider === OBRIC || path.provider === STEAMM || path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2) {
7776
+ if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider === METASTABLE || path.provider === OBRIC || path.provider === STEAMM || path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2 || path.provider === SEVENK) {
7684
7777
  extendedDetails = {
7685
7778
  aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
7686
7779
  turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
@@ -7711,7 +7804,12 @@ function parseRouterResponse(data, byAmountIn) {
7711
7804
  obricCoinAPriceSeed: (_A = path.extended_details) == null ? void 0 : _A.obric_coin_a_price_seed,
7712
7805
  obricCoinBPriceSeed: (_B = path.extended_details) == null ? void 0 : _B.obric_coin_b_price_seed,
7713
7806
  obricCoinAPriceId: (_C = path.extended_details) == null ? void 0 : _C.obric_coin_a_price_id,
7714
- obricCoinBPriceId: (_D = path.extended_details) == null ? void 0 : _D.obric_coin_b_price_id
7807
+ obricCoinBPriceId: (_D = path.extended_details) == null ? void 0 : _D.obric_coin_b_price_id,
7808
+ sevenkCoinAPriceSeed: (_E = path.extended_details) == null ? void 0 : _E.sevenk_coin_a_price_seed,
7809
+ sevenkCoinBPriceSeed: (_F = path.extended_details) == null ? void 0 : _F.sevenk_coin_b_price_seed,
7810
+ sevenkCoinAOracleId: (_G = path.extended_details) == null ? void 0 : _G.sevenk_oracle_config_a,
7811
+ sevenkCoinBOracleId: (_H = path.extended_details) == null ? void 0 : _H.sevenk_oracle_config_b,
7812
+ sevenkLPCapType: (_I = path.extended_details) == null ? void 0 : _I.sevenk_lp_cap_type
7715
7813
  };
7716
7814
  }
7717
7815
  return {
@@ -7808,7 +7906,7 @@ function processEndpoint(endpoint) {
7808
7906
 
7809
7907
  // src/api.ts
7810
7908
  var import_bn7 = __toESM(require_bn());
7811
- var SDK_VERSION = 1001300;
7909
+ var SDK_VERSION = 1001400;
7812
7910
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7813
7911
  return __async(this, null, function* () {
7814
7912
  let response;
@@ -8019,7 +8117,7 @@ exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
8019
8117
  exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
8020
8118
  exports.ALL_DEXES = ALL_DEXES;
8021
8119
  exports.ALPHAFI = ALPHAFI;
8022
- exports.AggregatorClient = AggregatorClient27;
8120
+ exports.AggregatorClient = AggregatorClient28;
8023
8121
  exports.BLUEFIN = BLUEFIN;
8024
8122
  exports.BLUEMOVE = BLUEMOVE;
8025
8123
  exports.CETUS = CETUS;
@@ -8041,6 +8139,7 @@ exports.MOMENTUM = MOMENTUM;
8041
8139
  exports.OBRIC = OBRIC;
8042
8140
  exports.ONE = ONE;
8043
8141
  exports.SCALLOP = SCALLOP;
8142
+ exports.SEVENK = SEVENK;
8044
8143
  exports.SPRINGSUI = SPRINGSUI;
8045
8144
  exports.STEAMM = STEAMM;
8046
8145
  exports.STEAMM_OMM = STEAMM_OMM;
package/dist/index.mjs CHANGED
@@ -6782,6 +6782,87 @@ var Magma = class {
6782
6782
  }
6783
6783
  };
6784
6784
 
6785
+ // src/transaction/sevenk.ts
6786
+ var Sevenk = class {
6787
+ constructor(env, pythPriceIDs) {
6788
+ if (env === 1 /* Testnet */) {
6789
+ throw new Error("Sevenk is not supported on testnet");
6790
+ }
6791
+ this.pythPriceIDs = pythPriceIDs;
6792
+ this.oraclePublishedAt = "0x8c36ea167c5e6da8c3d60b4fc897416105dcb986471bd81cfbfd38720a4487c0";
6793
+ }
6794
+ swap(client, txb, path, inputCoin, packages) {
6795
+ return __async(this, null, function* () {
6796
+ const { direction, from, target } = path;
6797
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6798
+ let coinAPriceSeed;
6799
+ let coinBPriceSeed;
6800
+ let coinAOracleId;
6801
+ let coinBOracleId;
6802
+ let lpCapType;
6803
+ if (path.extendedDetails == null) {
6804
+ throw new Error("Extended details not supported haedal pmm");
6805
+ } else {
6806
+ if (!path.extendedDetails.sevenkCoinAPriceSeed || !path.extendedDetails.sevenkCoinBPriceSeed || !path.extendedDetails.sevenkCoinAOracleId || !path.extendedDetails.sevenkCoinBOracleId || !path.extendedDetails.sevenkLPCapType) {
6807
+ throw new Error("Base price seed or quote price seed not supported");
6808
+ }
6809
+ coinAPriceSeed = path.extendedDetails.sevenkCoinAPriceSeed;
6810
+ coinBPriceSeed = path.extendedDetails.sevenkCoinBPriceSeed;
6811
+ coinAOracleId = path.extendedDetails.sevenkCoinAOracleId;
6812
+ coinBOracleId = path.extendedDetails.sevenkCoinBOracleId;
6813
+ lpCapType = path.extendedDetails.sevenkLPCapType;
6814
+ }
6815
+ const coinAPriceInfoObjectId = this.pythPriceIDs.get(coinAPriceSeed);
6816
+ const coinBPriceInfoObjectId = this.pythPriceIDs.get(coinBPriceSeed);
6817
+ if (!coinAPriceInfoObjectId || !coinBPriceInfoObjectId) {
6818
+ throw new Error(
6819
+ "Base price info object id or quote price info object id not found"
6820
+ );
6821
+ }
6822
+ const holder = txb.moveCall({
6823
+ target: `${this.oraclePublishedAt}::oracle::new_holder`,
6824
+ typeArguments: [],
6825
+ arguments: []
6826
+ });
6827
+ txb.moveCall({
6828
+ target: `${this.oraclePublishedAt}::pyth::get_price`,
6829
+ typeArguments: [],
6830
+ arguments: [
6831
+ txb.object(coinAOracleId),
6832
+ holder,
6833
+ txb.object(coinAPriceInfoObjectId),
6834
+ txb.object(CLOCK_ADDRESS)
6835
+ ]
6836
+ });
6837
+ txb.moveCall({
6838
+ target: `${this.oraclePublishedAt}::pyth::get_price`,
6839
+ typeArguments: [],
6840
+ arguments: [
6841
+ txb.object(coinBOracleId),
6842
+ holder,
6843
+ txb.object(coinBPriceInfoObjectId),
6844
+ txb.object(CLOCK_ADDRESS)
6845
+ ]
6846
+ });
6847
+ const args = [
6848
+ txb.object(path.id),
6849
+ holder,
6850
+ inputCoin
6851
+ ];
6852
+ const publishedAt = getAggregatorV2Extend2PublishedAt(
6853
+ client.publishedAtV2Extend2(),
6854
+ packages
6855
+ );
6856
+ const res = txb.moveCall({
6857
+ target: `${publishedAt}::sevenk::${func}`,
6858
+ typeArguments: [coinAType, coinBType, lpCapType],
6859
+ arguments: args
6860
+ });
6861
+ return res;
6862
+ });
6863
+ }
6864
+ };
6865
+
6785
6866
  // src/client.ts
6786
6867
  var CETUS = "CETUS";
6787
6868
  var DEEPBOOKV2 = "DEEPBOOK";
@@ -6810,6 +6891,7 @@ var STEAMM_OMM = "STEAMM_OMM";
6810
6891
  var MOMENTUM = "MOMENTUM";
6811
6892
  var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
6812
6893
  var MAGMA = "MAGMA";
6894
+ var SEVENK = "SEVENK";
6813
6895
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6814
6896
  var ALL_DEXES = [
6815
6897
  CETUS,
@@ -6837,7 +6919,8 @@ var ALL_DEXES = [
6837
6919
  MOMENTUM,
6838
6920
  STEAMM_OMM,
6839
6921
  STEAMM_OMM_V2,
6840
- MAGMA
6922
+ MAGMA,
6923
+ SEVENK
6841
6924
  ];
6842
6925
  function isBuilderRouterSwapParams(params) {
6843
6926
  return Array.isArray(params.routers);
@@ -7384,7 +7467,7 @@ var _AggregatorClient = class _AggregatorClient {
7384
7467
  // Include cetus、deepbookv2、flowxv2 & v3、kriyav2 & v3、turbos、aftermath、haedal、afsui、volo、bluemove
7385
7468
  publishedAtV2() {
7386
7469
  if (this.env === 0 /* Mainnet */) {
7387
- return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7470
+ return "0x8ae871505a80d8bf6bf9c05906cda6edfeea460c85bebe2e26a4313f5e67874a";
7388
7471
  } else {
7389
7472
  return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7390
7473
  }
@@ -7392,14 +7475,14 @@ var _AggregatorClient = class _AggregatorClient {
7392
7475
  // Include deepbookv3, scallop, bluefin
7393
7476
  publishedAtV2Extend() {
7394
7477
  if (this.env === 0 /* Mainnet */) {
7395
- return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7478
+ return "0x8a2f7a5b20665eeccc79de3aa37c3b6c473eca233ada1e1cd4678ec07d4d4073";
7396
7479
  } else {
7397
7480
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7398
7481
  }
7399
7482
  }
7400
7483
  publishedAtV2Extend2() {
7401
7484
  if (this.env === 0 /* Mainnet */) {
7402
- return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
7485
+ return "0x5cb7499fc49c2642310e24a4ecffdbee00133f97e80e2b45bca90c64d55de880";
7403
7486
  } else {
7404
7487
  return "0x0";
7405
7488
  }
@@ -7510,6 +7593,8 @@ var _AggregatorClient = class _AggregatorClient {
7510
7593
  return new SteammOmmV2(this.env, pythPriceIDs);
7511
7594
  case MAGMA:
7512
7595
  return new Magma(this.env);
7596
+ case SEVENK:
7597
+ return new Sevenk(this.env, pythPriceIDs);
7513
7598
  default:
7514
7599
  throw new Error(`Unsupported dex ${provider}`);
7515
7600
  }
@@ -7605,7 +7690,7 @@ _AggregatorClient.CONFIG = {
7605
7690
  pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
7606
7691
  }
7607
7692
  };
7608
- var AggregatorClient27 = _AggregatorClient;
7693
+ var AggregatorClient28 = _AggregatorClient;
7609
7694
  function findPythPriceIDs(routes) {
7610
7695
  const priceIDs = /* @__PURE__ */ new Set();
7611
7696
  for (const route of routes) {
@@ -7640,6 +7725,14 @@ function findPythPriceIDs(routes) {
7640
7725
  priceIDs.add(path.extendedDetails.steammOraclePythPriceSeedB);
7641
7726
  }
7642
7727
  }
7728
+ if (path.provider === SEVENK) {
7729
+ if (path.extendedDetails && path.extendedDetails.sevenkCoinAPriceSeed) {
7730
+ priceIDs.add(path.extendedDetails.sevenkCoinAPriceSeed);
7731
+ }
7732
+ if (path.extendedDetails && path.extendedDetails.sevenkCoinBPriceSeed) {
7733
+ priceIDs.add(path.extendedDetails.sevenkCoinBPriceSeed);
7734
+ }
7735
+ }
7643
7736
  }
7644
7737
  }
7645
7738
  return Array.from(priceIDs);
@@ -7668,13 +7761,13 @@ function parseRouterResponse(data, byAmountIn) {
7668
7761
  routes: data.routes.map((route) => {
7669
7762
  return {
7670
7763
  path: route.path.map((path) => {
7671
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
7764
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I;
7672
7765
  let version;
7673
7766
  if (path.provider === AFTERMATH) {
7674
7767
  version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
7675
7768
  }
7676
7769
  let extendedDetails;
7677
- if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider === METASTABLE || path.provider === OBRIC || path.provider === STEAMM || path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2) {
7770
+ if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM || path.provider === METASTABLE || path.provider === OBRIC || path.provider === STEAMM || path.provider === STEAMM_OMM || path.provider === STEAMM_OMM_V2 || path.provider === SEVENK) {
7678
7771
  extendedDetails = {
7679
7772
  aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
7680
7773
  turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
@@ -7705,7 +7798,12 @@ function parseRouterResponse(data, byAmountIn) {
7705
7798
  obricCoinAPriceSeed: (_A = path.extended_details) == null ? void 0 : _A.obric_coin_a_price_seed,
7706
7799
  obricCoinBPriceSeed: (_B = path.extended_details) == null ? void 0 : _B.obric_coin_b_price_seed,
7707
7800
  obricCoinAPriceId: (_C = path.extended_details) == null ? void 0 : _C.obric_coin_a_price_id,
7708
- obricCoinBPriceId: (_D = path.extended_details) == null ? void 0 : _D.obric_coin_b_price_id
7801
+ obricCoinBPriceId: (_D = path.extended_details) == null ? void 0 : _D.obric_coin_b_price_id,
7802
+ sevenkCoinAPriceSeed: (_E = path.extended_details) == null ? void 0 : _E.sevenk_coin_a_price_seed,
7803
+ sevenkCoinBPriceSeed: (_F = path.extended_details) == null ? void 0 : _F.sevenk_coin_b_price_seed,
7804
+ sevenkCoinAOracleId: (_G = path.extended_details) == null ? void 0 : _G.sevenk_oracle_config_a,
7805
+ sevenkCoinBOracleId: (_H = path.extended_details) == null ? void 0 : _H.sevenk_oracle_config_b,
7806
+ sevenkLPCapType: (_I = path.extended_details) == null ? void 0 : _I.sevenk_lp_cap_type
7709
7807
  };
7710
7808
  }
7711
7809
  return {
@@ -7802,7 +7900,7 @@ function processEndpoint(endpoint) {
7802
7900
 
7803
7901
  // src/api.ts
7804
7902
  var import_bn7 = __toESM(require_bn());
7805
- var SDK_VERSION = 1001300;
7903
+ var SDK_VERSION = 1001400;
7806
7904
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7807
7905
  return __async(this, null, function* () {
7808
7906
  let response;
@@ -8006,4 +8104,4 @@ decimal.js/decimal.mjs:
8006
8104
  *)
8007
8105
  */
8008
8106
 
8009
- export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient27 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, MAGMA, 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 };
8107
+ export { AFSUI, AFTERMATH, AGGREGATOR_V2, AGGREGATOR_V2_EXTEND, AGGREGATOR_V2_EXTEND2, ALL_DEXES, ALPHAFI, AggregatorClient28 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, HAEDALPMM, HAWAL, KRIYA, KRIYAV3, MAGMA, METASTABLE, MOMENTUM, OBRIC, ONE, SCALLOP, SEVENK, 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.13.1",
3
+ "version": "0.14.0",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",