@cetusprotocol/aggregator-sdk 0.12.1 → 0.13.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
@@ -87,6 +87,7 @@ declare const HAWAL = "HAWAL";
87
87
  declare const STEAMM_OMM = "STEAMM_OMM";
88
88
  declare const MOMENTUM = "MOMENTUM";
89
89
  declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
90
+ declare const MAGMA = "MAGMA";
90
91
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
91
92
  declare const ALL_DEXES: string[];
92
93
  type BuildRouterSwapParams = {
@@ -365,4 +366,4 @@ declare enum Env {
365
366
  Testnet = 1
366
367
  }
367
368
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -87,6 +87,7 @@ declare const HAWAL = "HAWAL";
87
87
  declare const STEAMM_OMM = "STEAMM_OMM";
88
88
  declare const MOMENTUM = "MOMENTUM";
89
89
  declare const STEAMM_OMM_V2 = "STEAMM_OMM_V2";
90
+ declare const MAGMA = "MAGMA";
90
91
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
91
92
  declare const ALL_DEXES: string[];
92
93
  type BuildRouterSwapParams = {
@@ -365,4 +366,4 @@ declare enum Env {
365
366
  Testnet = 1
366
367
  }
367
368
 
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 };
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 };
package/dist/index.js CHANGED
@@ -6754,6 +6754,35 @@ var SteammOmmV2 = class {
6754
6754
  }
6755
6755
  };
6756
6756
 
6757
+ // src/transaction/magma.ts
6758
+ var Magma = class {
6759
+ constructor(env) {
6760
+ if (env !== 0 /* Mainnet */) {
6761
+ throw new Error("Magma CLMM only supported on mainnet");
6762
+ }
6763
+ this.globalConfig = "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a";
6764
+ }
6765
+ swap(client, txb, path, inputCoin, packages) {
6766
+ return __async(this, null, function* () {
6767
+ const { direction, from, target } = path;
6768
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6769
+ const args = [
6770
+ txb.object(this.globalConfig),
6771
+ txb.object(path.id),
6772
+ inputCoin,
6773
+ txb.object(CLOCK_ADDRESS)
6774
+ ];
6775
+ const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
6776
+ const res = txb.moveCall({
6777
+ target: `${publishedAt}::magma::${func}`,
6778
+ typeArguments: [coinAType, coinBType],
6779
+ arguments: args
6780
+ });
6781
+ return res;
6782
+ });
6783
+ }
6784
+ };
6785
+
6757
6786
  // src/client.ts
6758
6787
  var CETUS = "CETUS";
6759
6788
  var DEEPBOOKV2 = "DEEPBOOK";
@@ -6781,6 +6810,7 @@ var HAWAL = "HAWAL";
6781
6810
  var STEAMM_OMM = "STEAMM_OMM";
6782
6811
  var MOMENTUM = "MOMENTUM";
6783
6812
  var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
6813
+ var MAGMA = "MAGMA";
6784
6814
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6785
6815
  var ALL_DEXES = [
6786
6816
  CETUS,
@@ -6807,7 +6837,8 @@ var ALL_DEXES = [
6807
6837
  HAWAL,
6808
6838
  MOMENTUM,
6809
6839
  STEAMM_OMM,
6810
- STEAMM_OMM_V2
6840
+ STEAMM_OMM_V2,
6841
+ MAGMA
6811
6842
  ];
6812
6843
  function isBuilderRouterSwapParams(params) {
6813
6844
  return Array.isArray(params.routers);
@@ -7361,7 +7392,7 @@ var _AggregatorClient = class _AggregatorClient {
7361
7392
  }
7362
7393
  publishedAtV2Extend2() {
7363
7394
  if (this.env === 0 /* Mainnet */) {
7364
- return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7395
+ return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
7365
7396
  } else {
7366
7397
  return "0x0";
7367
7398
  }
@@ -7470,6 +7501,8 @@ var _AggregatorClient = class _AggregatorClient {
7470
7501
  return new Momentum(this.env);
7471
7502
  case STEAMM_OMM_V2:
7472
7503
  return new SteammOmmV2(this.env, pythPriceIDs);
7504
+ case MAGMA:
7505
+ return new Magma(this.env);
7473
7506
  default:
7474
7507
  throw new Error(`Unsupported dex ${provider}`);
7475
7508
  }
@@ -7565,7 +7598,7 @@ _AggregatorClient.CONFIG = {
7565
7598
  pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
7566
7599
  }
7567
7600
  };
7568
- var AggregatorClient26 = _AggregatorClient;
7601
+ var AggregatorClient27 = _AggregatorClient;
7569
7602
  function findPythPriceIDs(routes) {
7570
7603
  const priceIDs = /* @__PURE__ */ new Set();
7571
7604
  for (const route of routes) {
@@ -7762,7 +7795,7 @@ function processEndpoint(endpoint) {
7762
7795
 
7763
7796
  // src/api.ts
7764
7797
  var import_bn7 = __toESM(require_bn());
7765
- var SDK_VERSION = 1001201;
7798
+ var SDK_VERSION = 1001300;
7766
7799
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7767
7800
  return __async(this, null, function* () {
7768
7801
  let response;
@@ -7973,7 +8006,7 @@ exports.AGGREGATOR_V2_EXTEND = AGGREGATOR_V2_EXTEND;
7973
8006
  exports.AGGREGATOR_V2_EXTEND2 = AGGREGATOR_V2_EXTEND2;
7974
8007
  exports.ALL_DEXES = ALL_DEXES;
7975
8008
  exports.ALPHAFI = ALPHAFI;
7976
- exports.AggregatorClient = AggregatorClient26;
8009
+ exports.AggregatorClient = AggregatorClient27;
7977
8010
  exports.BLUEFIN = BLUEFIN;
7978
8011
  exports.BLUEMOVE = BLUEMOVE;
7979
8012
  exports.CETUS = CETUS;
@@ -7989,6 +8022,7 @@ exports.HAEDALPMM = HAEDALPMM;
7989
8022
  exports.HAWAL = HAWAL;
7990
8023
  exports.KRIYA = KRIYA;
7991
8024
  exports.KRIYAV3 = KRIYAV3;
8025
+ exports.MAGMA = MAGMA;
7992
8026
  exports.METASTABLE = METASTABLE;
7993
8027
  exports.MOMENTUM = MOMENTUM;
7994
8028
  exports.OBRIC = OBRIC;
package/dist/index.mjs CHANGED
@@ -6752,6 +6752,35 @@ var SteammOmmV2 = class {
6752
6752
  }
6753
6753
  };
6754
6754
 
6755
+ // src/transaction/magma.ts
6756
+ var Magma = class {
6757
+ constructor(env) {
6758
+ if (env !== 0 /* Mainnet */) {
6759
+ throw new Error("Magma CLMM only supported on mainnet");
6760
+ }
6761
+ this.globalConfig = "0x4c4e1402401f72c7d8533d0ed8d5f8949da363c7a3319ccef261ffe153d32f8a";
6762
+ }
6763
+ swap(client, txb, path, inputCoin, packages) {
6764
+ return __async(this, null, function* () {
6765
+ const { direction, from, target } = path;
6766
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6767
+ const args = [
6768
+ txb.object(this.globalConfig),
6769
+ txb.object(path.id),
6770
+ inputCoin,
6771
+ txb.object(CLOCK_ADDRESS)
6772
+ ];
6773
+ const publishedAt = getAggregatorV2Extend2PublishedAt(client.publishedAtV2Extend2(), packages);
6774
+ const res = txb.moveCall({
6775
+ target: `${publishedAt}::magma::${func}`,
6776
+ typeArguments: [coinAType, coinBType],
6777
+ arguments: args
6778
+ });
6779
+ return res;
6780
+ });
6781
+ }
6782
+ };
6783
+
6755
6784
  // src/client.ts
6756
6785
  var CETUS = "CETUS";
6757
6786
  var DEEPBOOKV2 = "DEEPBOOK";
@@ -6779,6 +6808,7 @@ var HAWAL = "HAWAL";
6779
6808
  var STEAMM_OMM = "STEAMM_OMM";
6780
6809
  var MOMENTUM = "MOMENTUM";
6781
6810
  var STEAMM_OMM_V2 = "STEAMM_OMM_V2";
6811
+ var MAGMA = "MAGMA";
6782
6812
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6783
6813
  var ALL_DEXES = [
6784
6814
  CETUS,
@@ -6805,7 +6835,8 @@ var ALL_DEXES = [
6805
6835
  HAWAL,
6806
6836
  MOMENTUM,
6807
6837
  STEAMM_OMM,
6808
- STEAMM_OMM_V2
6838
+ STEAMM_OMM_V2,
6839
+ MAGMA
6809
6840
  ];
6810
6841
  function isBuilderRouterSwapParams(params) {
6811
6842
  return Array.isArray(params.routers);
@@ -7359,7 +7390,7 @@ var _AggregatorClient = class _AggregatorClient {
7359
7390
  }
7360
7391
  publishedAtV2Extend2() {
7361
7392
  if (this.env === 0 /* Mainnet */) {
7362
- return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7393
+ return "0xc40b43f0aa4ba5a4d71e39770265d3698d0e6dcfd846b7d7c443207f4e919e04";
7363
7394
  } else {
7364
7395
  return "0x0";
7365
7396
  }
@@ -7468,6 +7499,8 @@ var _AggregatorClient = class _AggregatorClient {
7468
7499
  return new Momentum(this.env);
7469
7500
  case STEAMM_OMM_V2:
7470
7501
  return new SteammOmmV2(this.env, pythPriceIDs);
7502
+ case MAGMA:
7503
+ return new Magma(this.env);
7471
7504
  default:
7472
7505
  throw new Error(`Unsupported dex ${provider}`);
7473
7506
  }
@@ -7563,7 +7596,7 @@ _AggregatorClient.CONFIG = {
7563
7596
  pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8"
7564
7597
  }
7565
7598
  };
7566
- var AggregatorClient26 = _AggregatorClient;
7599
+ var AggregatorClient27 = _AggregatorClient;
7567
7600
  function findPythPriceIDs(routes) {
7568
7601
  const priceIDs = /* @__PURE__ */ new Set();
7569
7602
  for (const route of routes) {
@@ -7760,7 +7793,7 @@ function processEndpoint(endpoint) {
7760
7793
 
7761
7794
  // src/api.ts
7762
7795
  var import_bn7 = __toESM(require_bn());
7763
- var SDK_VERSION = 1001201;
7796
+ var SDK_VERSION = 1001300;
7764
7797
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7765
7798
  return __async(this, null, function* () {
7766
7799
  let response;
@@ -7964,4 +7997,4 @@ decimal.js/decimal.mjs:
7964
7997
  *)
7965
7998
  */
7966
7999
 
7967
- 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 };
8000
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",