@cetusprotocol/aggregator-sdk 0.0.0-experimental-20241216203328 → 0.0.0-experimental-20241217153013

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
@@ -76,7 +76,6 @@ declare const DEEPBOOKV3 = "DEEPBOOKV3";
76
76
  declare const SCALLOP = "SCALLOP";
77
77
  declare const SUILEND = "SUILEND";
78
78
  declare const BLUEFIN = "BLUEFIN";
79
- declare const HAEDALPMM = "HAEDALPMM";
80
79
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
81
80
  type BuildRouterSwapParams = {
82
81
  routers: Router[];
@@ -270,4 +269,4 @@ declare enum Env {
270
269
  Testnet = 1
271
270
  }
272
271
 
273
- export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildRouterSwapParams, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
272
+ export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.d.ts CHANGED
@@ -76,7 +76,6 @@ declare const DEEPBOOKV3 = "DEEPBOOKV3";
76
76
  declare const SCALLOP = "SCALLOP";
77
77
  declare const SUILEND = "SUILEND";
78
78
  declare const BLUEFIN = "BLUEFIN";
79
- declare const HAEDALPMM = "HAEDALPMM";
80
79
  declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
81
80
  type BuildRouterSwapParams = {
82
81
  routers: Router[];
@@ -270,4 +269,4 @@ declare enum Env {
270
269
  Testnet = 1
271
270
  }
272
271
 
273
- export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildRouterSwapParams, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
272
+ export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEFIN, BLUEMOVE, type BuildCoinResult, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, type DeepbookV3Config, type DeepbookV3ConfigResponse, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  var client = require('@mysten/sui/client');
4
4
  var utils = require('@mysten/sui/utils');
5
5
  var transactions = require('@mysten/sui/transactions');
6
- var pythSuiJs = require('@pythnetwork/pyth-sui-js');
7
6
 
8
7
  var __create = Object.create;
9
8
  var __defProp = Object.defineProperty;
@@ -6139,54 +6138,6 @@ var Bluefin = class {
6139
6138
  });
6140
6139
  }
6141
6140
  };
6142
- var HaedalPmm = class {
6143
- constructor(env, suiClient) {
6144
- if (env === 1 /* Testnet */) {
6145
- this.connection = new pythSuiJs.SuiPriceServiceConnection("https://hermes-beta.pyth.network");
6146
- const wormholeStateId = "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790";
6147
- const pythStateId = "0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";
6148
- this.pythClient = new pythSuiJs.SuiPythClient(suiClient, pythStateId, wormholeStateId);
6149
- } else {
6150
- this.connection = new pythSuiJs.SuiPriceServiceConnection("https://hermes.pyth.network");
6151
- const wormholeStateId = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
6152
- const pythStateId = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
6153
- this.pythClient = new pythSuiJs.SuiPythClient(suiClient, pythStateId, wormholeStateId);
6154
- }
6155
- }
6156
- swap(client, txb, path, inputCoin) {
6157
- return __async(this, null, function* () {
6158
- const { direction, from, target } = path;
6159
- const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6160
- let basePriceSeed;
6161
- let quotePriceSeed;
6162
- if (path.extendedDetails == null) {
6163
- throw new Error("Extended details not supported haedal pmm");
6164
- } else {
6165
- if (!path.extendedDetails.haedalPmmBasePriceSeed || !path.extendedDetails.haedalPmmQuotePriceSeed) {
6166
- throw new Error("Base price seed or quote price seed not supported");
6167
- }
6168
- basePriceSeed = path.extendedDetails.haedalPmmBasePriceSeed;
6169
- quotePriceSeed = path.extendedDetails.haedalPmmQuotePriceSeed;
6170
- }
6171
- const priceIDs = [basePriceSeed, quotePriceSeed];
6172
- const priceUpdateData = yield this.connection.getPriceFeedsUpdateData(priceIDs);
6173
- const priceInfoObjectIds = yield this.pythClient.updatePriceFeeds(txb, priceUpdateData, priceIDs);
6174
- const args = [
6175
- txb.object(path.id),
6176
- txb.object(priceInfoObjectIds[0]),
6177
- txb.object(priceInfoObjectIds[1]),
6178
- inputCoin,
6179
- txb.object(CLOCK_ADDRESS)
6180
- ];
6181
- const res = txb.moveCall({
6182
- target: `${client.publishedAtV2()}::haedalpmm::${func}`,
6183
- typeArguments: [coinAType, coinBType],
6184
- arguments: args
6185
- });
6186
- return res;
6187
- });
6188
- }
6189
- };
6190
6141
 
6191
6142
  // src/client.ts
6192
6143
  var CETUS = "CETUS";
@@ -6205,9 +6156,8 @@ var DEEPBOOKV3 = "DEEPBOOKV3";
6205
6156
  var SCALLOP = "SCALLOP";
6206
6157
  var SUILEND = "SUILEND";
6207
6158
  var BLUEFIN = "BLUEFIN";
6208
- var HAEDALPMM = "HAEDALPMM";
6209
6159
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6210
- var AggregatorClient10 = class {
6160
+ var AggregatorClient9 = class {
6211
6161
  constructor(endpoint, signer, client$1, env) {
6212
6162
  this.endpoint = endpoint ? processEndpoint(endpoint) : DEFAULT_ENDPOINT;
6213
6163
  this.client = client$1 || new client.SuiClient({ url: client.getFullnodeUrl("mainnet") });
@@ -6484,7 +6434,7 @@ var AggregatorClient10 = class {
6484
6434
  // Include deepbookv3, scallop, bluefin
6485
6435
  publishedAtV2() {
6486
6436
  if (this.env === 0 /* Mainnet */) {
6487
- return "0x0d1db90786844fac861cead35d66f954df4e940d32a4c9dcba3544d942ea0806";
6437
+ return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502";
6488
6438
  } else {
6489
6439
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
6490
6440
  }
@@ -6555,8 +6505,6 @@ var AggregatorClient10 = class {
6555
6505
  return new Suilend(this.env);
6556
6506
  case BLUEFIN:
6557
6507
  return new Bluefin(this.env);
6558
- case HAEDALPMM:
6559
- return new HaedalPmm(this.env, this.client);
6560
6508
  default:
6561
6509
  throw new Error(`Unsupported dex ${provider}`);
6562
6510
  }
@@ -6626,7 +6574,7 @@ function parseRouterResponse(data) {
6626
6574
  version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
6627
6575
  }
6628
6576
  let extendedDetails;
6629
- if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM) {
6577
+ if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP) {
6630
6578
  extendedDetails = {
6631
6579
  aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
6632
6580
  turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
@@ -6776,7 +6724,7 @@ function getRouter(endpoint, params) {
6776
6724
  url += `&providers=${providers.join(",")}`;
6777
6725
  }
6778
6726
  }
6779
- url += "&v=1000309";
6727
+ url += "&v=1000312";
6780
6728
  const response = yield fetch(url);
6781
6729
  return response;
6782
6730
  } catch (error) {
@@ -6868,7 +6816,7 @@ decimal.js/decimal.mjs:
6868
6816
 
6869
6817
  exports.AFSUI = AFSUI;
6870
6818
  exports.AFTERMATH = AFTERMATH;
6871
- exports.AggregatorClient = AggregatorClient10;
6819
+ exports.AggregatorClient = AggregatorClient9;
6872
6820
  exports.BLUEFIN = BLUEFIN;
6873
6821
  exports.BLUEMOVE = BLUEMOVE;
6874
6822
  exports.CETUS = CETUS;
@@ -6880,7 +6828,6 @@ exports.Env = Env;
6880
6828
  exports.FLOWXV2 = FLOWXV2;
6881
6829
  exports.FLOWXV3 = FLOWXV3;
6882
6830
  exports.HAEDAL = HAEDAL;
6883
- exports.HAEDALPMM = HAEDALPMM;
6884
6831
  exports.KRIYA = KRIYA;
6885
6832
  exports.KRIYAV3 = KRIYAV3;
6886
6833
  exports.ONE = ONE;
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
2
2
  import { normalizeSuiObjectId, SUI_FRAMEWORK_ADDRESS } from '@mysten/sui/utils';
3
3
  import { Transaction } from '@mysten/sui/transactions';
4
- import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-js';
5
4
 
6
5
  var __create = Object.create;
7
6
  var __defProp = Object.defineProperty;
@@ -6137,54 +6136,6 @@ var Bluefin = class {
6137
6136
  });
6138
6137
  }
6139
6138
  };
6140
- var HaedalPmm = class {
6141
- constructor(env, suiClient) {
6142
- if (env === 1 /* Testnet */) {
6143
- this.connection = new SuiPriceServiceConnection("https://hermes-beta.pyth.network");
6144
- const wormholeStateId = "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790";
6145
- const pythStateId = "0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";
6146
- this.pythClient = new SuiPythClient(suiClient, pythStateId, wormholeStateId);
6147
- } else {
6148
- this.connection = new SuiPriceServiceConnection("https://hermes.pyth.network");
6149
- const wormholeStateId = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
6150
- const pythStateId = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
6151
- this.pythClient = new SuiPythClient(suiClient, pythStateId, wormholeStateId);
6152
- }
6153
- }
6154
- swap(client, txb, path, inputCoin) {
6155
- return __async(this, null, function* () {
6156
- const { direction, from, target } = path;
6157
- const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6158
- let basePriceSeed;
6159
- let quotePriceSeed;
6160
- if (path.extendedDetails == null) {
6161
- throw new Error("Extended details not supported haedal pmm");
6162
- } else {
6163
- if (!path.extendedDetails.haedalPmmBasePriceSeed || !path.extendedDetails.haedalPmmQuotePriceSeed) {
6164
- throw new Error("Base price seed or quote price seed not supported");
6165
- }
6166
- basePriceSeed = path.extendedDetails.haedalPmmBasePriceSeed;
6167
- quotePriceSeed = path.extendedDetails.haedalPmmQuotePriceSeed;
6168
- }
6169
- const priceIDs = [basePriceSeed, quotePriceSeed];
6170
- const priceUpdateData = yield this.connection.getPriceFeedsUpdateData(priceIDs);
6171
- const priceInfoObjectIds = yield this.pythClient.updatePriceFeeds(txb, priceUpdateData, priceIDs);
6172
- const args = [
6173
- txb.object(path.id),
6174
- txb.object(priceInfoObjectIds[0]),
6175
- txb.object(priceInfoObjectIds[1]),
6176
- inputCoin,
6177
- txb.object(CLOCK_ADDRESS)
6178
- ];
6179
- const res = txb.moveCall({
6180
- target: `${client.publishedAtV2()}::haedalpmm::${func}`,
6181
- typeArguments: [coinAType, coinBType],
6182
- arguments: args
6183
- });
6184
- return res;
6185
- });
6186
- }
6187
- };
6188
6139
 
6189
6140
  // src/client.ts
6190
6141
  var CETUS = "CETUS";
@@ -6203,9 +6154,8 @@ var DEEPBOOKV3 = "DEEPBOOKV3";
6203
6154
  var SCALLOP = "SCALLOP";
6204
6155
  var SUILEND = "SUILEND";
6205
6156
  var BLUEFIN = "BLUEFIN";
6206
- var HAEDALPMM = "HAEDALPMM";
6207
6157
  var DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
6208
- var AggregatorClient10 = class {
6158
+ var AggregatorClient9 = class {
6209
6159
  constructor(endpoint, signer, client, env) {
6210
6160
  this.endpoint = endpoint ? processEndpoint(endpoint) : DEFAULT_ENDPOINT;
6211
6161
  this.client = client || new SuiClient({ url: getFullnodeUrl("mainnet") });
@@ -6482,7 +6432,7 @@ var AggregatorClient10 = class {
6482
6432
  // Include deepbookv3, scallop, bluefin
6483
6433
  publishedAtV2() {
6484
6434
  if (this.env === 0 /* Mainnet */) {
6485
- return "0x0d1db90786844fac861cead35d66f954df4e940d32a4c9dcba3544d942ea0806";
6435
+ return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502";
6486
6436
  } else {
6487
6437
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
6488
6438
  }
@@ -6553,8 +6503,6 @@ var AggregatorClient10 = class {
6553
6503
  return new Suilend(this.env);
6554
6504
  case BLUEFIN:
6555
6505
  return new Bluefin(this.env);
6556
- case HAEDALPMM:
6557
- return new HaedalPmm(this.env, this.client);
6558
6506
  default:
6559
6507
  throw new Error(`Unsupported dex ${provider}`);
6560
6508
  }
@@ -6624,7 +6572,7 @@ function parseRouterResponse(data) {
6624
6572
  version = path.extended_details.aftermath_pool_flatness === 0 ? "v2" : "v3";
6625
6573
  }
6626
6574
  let extendedDetails;
6627
- if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP || path.provider === HAEDALPMM) {
6575
+ if (path.provider === TURBOS || path.provider === AFTERMATH || path.provider === CETUS || path.provider === DEEPBOOKV3 || path.provider === SCALLOP) {
6628
6576
  extendedDetails = {
6629
6577
  aftermathLpSupplyType: (_a = path.extended_details) == null ? void 0 : _a.aftermath_lp_supply_type,
6630
6578
  turbosFeeType: (_b = path.extended_details) == null ? void 0 : _b.turbos_fee_type,
@@ -6774,7 +6722,7 @@ function getRouter(endpoint, params) {
6774
6722
  url += `&providers=${providers.join(",")}`;
6775
6723
  }
6776
6724
  }
6777
- url += "&v=1000309";
6725
+ url += "&v=1000312";
6778
6726
  const response = yield fetch(url);
6779
6727
  return response;
6780
6728
  } catch (error) {
@@ -6864,4 +6812,4 @@ decimal.js/decimal.mjs:
6864
6812
  *)
6865
6813
  */
6866
6814
 
6867
- export { AFSUI, AFTERMATH, AggregatorClient10 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
6815
+ export { AFSUI, AFTERMATH, AggregatorClient9 as AggregatorClient, BLUEFIN, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, DEFAULT_ENDPOINT, Env, FLOWXV2, FLOWXV3, HAEDAL, 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, getDeepbookV3Config, getRouterResult, isSortedSymbols, mintZeroCoin, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, printTransaction, processEndpoint, restituteMsafeFastRouterSwapParams };
@@ -20,7 +20,6 @@ export declare const DEEPBOOKV3 = "DEEPBOOKV3";
20
20
  export declare const SCALLOP = "SCALLOP";
21
21
  export declare const SUILEND = "SUILEND";
22
22
  export declare const BLUEFIN = "BLUEFIN";
23
- export declare const HAEDALPMM = "HAEDALPMM";
24
23
  export declare const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2";
25
24
  export type BuildRouterSwapParams = {
26
25
  routers: Router[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.0.0-experimental-20241216203328",
3
+ "version": "0.0.0-experimental-20241217153013",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api.ts CHANGED
@@ -170,7 +170,7 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
170
170
  }
171
171
 
172
172
  // set newest sdk version
173
- url += "&v=1000309"
173
+ url += "&v=1000312"
174
174
 
175
175
  const response = await fetch(url)
176
176
  return response
package/src/client.ts CHANGED
@@ -39,8 +39,6 @@ import { DeepbookV3 } from "./transaction/deepbook_v3"
39
39
  import { Scallop } from "./transaction/scallop"
40
40
  import { Suilend } from "./transaction/suilend"
41
41
  import { Bluefin } from "./transaction/bluefin"
42
- import { HaedalPmm } from "./transaction/haedal_pmm"
43
- import { TsJestCompiler } from "ts-jest"
44
42
 
45
43
  export const CETUS = "CETUS"
46
44
  export const DEEPBOOKV2 = "DEEPBOOK"
@@ -58,7 +56,6 @@ export const DEEPBOOKV3 = "DEEPBOOKV3"
58
56
  export const SCALLOP = "SCALLOP"
59
57
  export const SUILEND = "SUILEND"
60
58
  export const BLUEFIN = "BLUEFIN"
61
- export const HAEDALPMM = "HAEDALPMM"
62
59
  export const DEFAULT_ENDPOINT = "https://api-sui.cetus.zone/router_v2"
63
60
 
64
61
  export type BuildRouterSwapParams = {
@@ -420,7 +417,7 @@ export class AggregatorClient {
420
417
  // return "0x6d70ffa7aa3f924c3f0b573d27d29895a0ee666aaff821073f75cb14af7fd01a" // version 3, deepbookv3 & scallop
421
418
  // return "0x16d9418726c26d8cb4ce8c9dd75917fa9b1c7bf47d38d7a1a22603135f0f2a56" // version 4, add suilend
422
419
  // return "0x3b6d71bdeb8ce5b06febfd3cfc29ecd60d50da729477c8b8038ecdae34541b91" // version 5, add bluefin
423
- return "0x0d1db90786844fac861cead35d66f954df4e940d32a4c9dcba3544d942ea0806" // pre
420
+ return "0x81ade554cb24a7564ca43a4bfb7381b08d9e5c5f375162c95215b696ab903502" // version 6, force upgrade scallop
424
421
  } else {
425
422
  return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78"
426
423
  }
@@ -505,8 +502,6 @@ export class AggregatorClient {
505
502
  return new Suilend(this.env)
506
503
  case BLUEFIN:
507
504
  return new Bluefin(this.env)
508
- case HAEDALPMM:
509
- return new HaedalPmm(this.env, this.client)
510
505
  default:
511
506
  throw new Error(`Unsupported dex ${provider}`)
512
507
  }
@@ -581,8 +576,7 @@ export function parseRouterResponse(data: any): RouterData {
581
576
  path.provider === AFTERMATH ||
582
577
  path.provider === CETUS ||
583
578
  path.provider === DEEPBOOKV3 ||
584
- path.provider === SCALLOP ||
585
- path.provider === HAEDALPMM
579
+ path.provider === SCALLOP
586
580
  ) {
587
581
  extendedDetails = {
588
582
  aftermathLpSupplyType:
@@ -108,7 +108,7 @@ describe("router module", () => {
108
108
  test("Build router tx", async () => {
109
109
  const byAmountIn = true
110
110
  const amount = "3574839"
111
- const target = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
111
+ const target = "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI"
112
112
  const from = "0x2::sui::SUI"
113
113
 
114
114
  const res = await client.findRouters({
@@ -117,7 +117,7 @@ describe("router module", () => {
117
117
  amount: new BN(amount),
118
118
  byAmountIn,
119
119
  depth: 3,
120
- providers: ["HAEDALPMM"],
120
+ providers: ["SCALLOP"],
121
121
  })
122
122
 
123
123
  if (res != null) {
@@ -1,9 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
- import { AggregatorClient, Dex, Env, Path } from "..";
3
- import { SuiClient } from "@mysten/sui/client";
4
- export declare class HaedalPmm implements Dex {
5
- private connection;
6
- private pythClient;
7
- constructor(env: Env, suiClient: SuiClient);
8
- swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
9
- }
@@ -1,69 +0,0 @@
1
- import {
2
- Transaction,
3
- TransactionArgument,
4
- TransactionObjectArgument,
5
- } from "@mysten/sui/transactions"
6
- import { AggregatorClient, CLOCK_ADDRESS, Dex, Env, Path } from ".."
7
- import { SuiPriceServiceConnection, SuiPythClient } from "@pythnetwork/pyth-sui-js"
8
- import { SuiClient } from "@mysten/sui/client"
9
-
10
- export class HaedalPmm implements Dex {
11
- private connection: SuiPriceServiceConnection
12
- private pythClient: SuiPythClient
13
-
14
- constructor(env: Env, suiClient: SuiClient) {
15
- if (env === Env.Testnet) {
16
- this.connection = new SuiPriceServiceConnection("https://hermes-beta.pyth.network")
17
- const wormholeStateId = "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790";
18
- const pythStateId = "0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";
19
- this.pythClient = new SuiPythClient(suiClient, pythStateId, wormholeStateId)
20
- } else {
21
- this.connection = new SuiPriceServiceConnection("https://hermes.pyth.network")
22
- const wormholeStateId = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
23
- const pythStateId = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
24
- this.pythClient = new SuiPythClient(suiClient, pythStateId, wormholeStateId)
25
- }
26
- }
27
-
28
- async swap(
29
- client: AggregatorClient,
30
- txb: Transaction,
31
- path: Path,
32
- inputCoin: TransactionObjectArgument
33
- ): Promise<TransactionObjectArgument> {
34
- const { direction, from, target } = path
35
- const [func, coinAType, coinBType] = direction
36
- ? ["swap_a2b", from, target]
37
- : ["swap_b2a", target, from]
38
-
39
- let basePriceSeed: string
40
- let quotePriceSeed: string
41
-
42
- if (path.extendedDetails == null) {
43
- throw new Error("Extended details not supported haedal pmm")
44
- } else {
45
- if (!path.extendedDetails.haedalPmmBasePriceSeed || !path.extendedDetails.haedalPmmQuotePriceSeed) {
46
- throw new Error("Base price seed or quote price seed not supported")
47
- }
48
- basePriceSeed = path.extendedDetails.haedalPmmBasePriceSeed
49
- quotePriceSeed = path.extendedDetails.haedalPmmQuotePriceSeed
50
- }
51
-
52
- const priceIDs = [basePriceSeed, quotePriceSeed]
53
- const priceUpdateData = await this.connection.getPriceFeedsUpdateData(priceIDs);
54
- const priceInfoObjectIds = await this.pythClient.updatePriceFeeds(txb, priceUpdateData, priceIDs);
55
- const args = [
56
- txb.object(path.id),
57
- txb.object(priceInfoObjectIds[0]),
58
- txb.object(priceInfoObjectIds[1]),
59
- inputCoin,
60
- txb.object(CLOCK_ADDRESS),
61
- ]
62
- const res = txb.moveCall({
63
- target: `${client.publishedAtV2()}::haedalpmm::${func}`,
64
- typeArguments: [coinAType, coinBType],
65
- arguments: args,
66
- }) as TransactionArgument
67
- return res
68
- }
69
- }