@cetusprotocol/aggregator-sdk 0.2.2 → 0.3.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
@@ -71,6 +71,8 @@ declare const AFTERMATH = "AFTERMATH";
71
71
  declare const HAEDAL = "HAEDAL";
72
72
  declare const VOLO = "VOLO";
73
73
  declare const AFSUI = "AFSUI";
74
+ declare const BLUEMOVE = "BLUEMOVE";
75
+ declare const DEEPBOOKV3 = "DEEPBOOKV3";
74
76
  type BuildRouterSwapParams = {
75
77
  routers: Router[];
76
78
  byAmountIn: boolean;
@@ -220,4 +222,4 @@ declare enum Env {
220
222
  Testnet = 1
221
223
  }
222
224
 
223
- export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
225
+ export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
package/dist/index.d.ts CHANGED
@@ -71,6 +71,8 @@ declare const AFTERMATH = "AFTERMATH";
71
71
  declare const HAEDAL = "HAEDAL";
72
72
  declare const VOLO = "VOLO";
73
73
  declare const AFSUI = "AFSUI";
74
+ declare const BLUEMOVE = "BLUEMOVE";
75
+ declare const DEEPBOOKV3 = "DEEPBOOKV3";
74
76
  type BuildRouterSwapParams = {
75
77
  routers: Router[];
76
78
  byAmountIn: boolean;
@@ -220,4 +222,4 @@ declare enum Env {
220
222
  Testnet = 1
221
223
  }
222
224
 
223
- export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
225
+ export { AFSUI, AFTERMATH, AggregatorClient, type AggregatorResponse, BLUEMOVE, type BuildFastRouterSwapParams, type BuildRouterSwapParams, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, type Dex, Env, type ExtendedDetails, FLOWXV2, FLOWXV3, type FindRouterParams, HAEDAL, KRIYA, KRIYAV3, ONE, type Path, type PreSwapLpChangeParams, type Router, type RouterData, type RouterError, type SwapInPoolsParams, type SwapInPoolsResult, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
package/dist/index.js CHANGED
@@ -5145,6 +5145,34 @@ var KriyaV2 = class {
5145
5145
  }
5146
5146
  };
5147
5147
 
5148
+ // src/transaction/kriya_v3.ts
5149
+ var KriyaV3 = class {
5150
+ constructor(env) {
5151
+ if (env !== 0 /* Mainnet */) {
5152
+ throw new Error("Kriya clmm only supported on mainnet");
5153
+ }
5154
+ this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
5155
+ }
5156
+ swap(client, txb, path, inputCoin) {
5157
+ return __async(this, null, function* () {
5158
+ const { direction, from, target } = path;
5159
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5160
+ const args = [
5161
+ txb.object(path.id),
5162
+ inputCoin,
5163
+ txb.object(this.version),
5164
+ txb.object(CLOCK_ADDRESS)
5165
+ ];
5166
+ const res = txb.moveCall({
5167
+ target: `${client.publishedAt()}::kriya_clmm::${func}`,
5168
+ typeArguments: [coinAType, coinBType],
5169
+ arguments: args
5170
+ });
5171
+ return res;
5172
+ });
5173
+ }
5174
+ };
5175
+
5148
5176
  // src/transaction/flowx_v2.ts
5149
5177
  var FlowxV2 = class {
5150
5178
  constructor(env) {
@@ -5168,6 +5196,36 @@ var FlowxV2 = class {
5168
5196
  }
5169
5197
  };
5170
5198
 
5199
+ // src/transaction/flowx_v3.ts
5200
+ var FlowxV3 = class {
5201
+ constructor(env) {
5202
+ if (env !== 0 /* Mainnet */) {
5203
+ throw new Error("Flowx clmm only supported on mainnet");
5204
+ }
5205
+ this.versioned = "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656";
5206
+ this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
5207
+ }
5208
+ swap(client, txb, path, inputCoin) {
5209
+ return __async(this, null, function* () {
5210
+ const { direction, from, target } = path;
5211
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5212
+ const args = [
5213
+ txb.object(this.poolRegistry),
5214
+ txb.pure.u64(path.feeRate * 1e6),
5215
+ inputCoin,
5216
+ txb.object(this.versioned),
5217
+ txb.object(CLOCK_ADDRESS)
5218
+ ];
5219
+ const res = txb.moveCall({
5220
+ target: `${client.publishedAt()}::flowx_clmm::${func}`,
5221
+ typeArguments: [coinAType, coinBType],
5222
+ arguments: args
5223
+ });
5224
+ return res;
5225
+ });
5226
+ }
5227
+ };
5228
+
5171
5229
  // src/transaction/turbos.ts
5172
5230
  var Turbos = class {
5173
5231
  constructor(env) {
@@ -5818,34 +5876,6 @@ function swapInPools(client, params, sender) {
5818
5876
  });
5819
5877
  }
5820
5878
 
5821
- // src/transaction/kriya_v3.ts
5822
- var KriyaV3 = class {
5823
- constructor(env) {
5824
- if (env !== 0 /* Mainnet */) {
5825
- throw new Error("Kriya clmm only supported on mainnet");
5826
- }
5827
- this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
5828
- }
5829
- swap(client, txb, path, inputCoin) {
5830
- return __async(this, null, function* () {
5831
- const { direction, from, target } = path;
5832
- const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5833
- const args = [
5834
- txb.object(path.id),
5835
- inputCoin,
5836
- txb.object(this.version),
5837
- txb.object(CLOCK_ADDRESS)
5838
- ];
5839
- const res = txb.moveCall({
5840
- target: `${client.publishedAt()}::kriya_clmm::${func}`,
5841
- typeArguments: [coinAType, coinBType],
5842
- arguments: args
5843
- });
5844
- return res;
5845
- });
5846
- }
5847
- };
5848
-
5849
5879
  // src/transaction/haedal.ts
5850
5880
  var Haedal = class {
5851
5881
  constructor(env) {
@@ -5939,28 +5969,49 @@ var Volo = class {
5939
5969
  }
5940
5970
  };
5941
5971
 
5942
- // src/transaction/flowx_v3.ts
5943
- var FlowxV3 = class {
5972
+ // src/transaction/bluemove.ts
5973
+ var Bluemove = class {
5944
5974
  constructor(env) {
5945
5975
  if (env !== 0 /* Mainnet */) {
5946
- throw new Error("Flowx clmm only supported on mainnet");
5976
+ throw new Error("Bluemove only supported on mainnet");
5947
5977
  }
5948
- this.versioned = "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656";
5949
- this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
5978
+ this.dexInfo = "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92";
5950
5979
  }
5951
5980
  swap(client, txb, path, inputCoin) {
5952
5981
  return __async(this, null, function* () {
5953
5982
  const { direction, from, target } = path;
5954
5983
  const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5984
+ const args = [txb.object(this.dexInfo), inputCoin];
5985
+ const res = txb.moveCall({
5986
+ target: `${client.publishedAt()}::bluemove::${func}`,
5987
+ typeArguments: [coinAType, coinBType],
5988
+ arguments: args
5989
+ });
5990
+ return res;
5991
+ });
5992
+ }
5993
+ };
5994
+
5995
+ // src/transaction/deepbook_v3.ts
5996
+ var DeepbookV3 = class {
5997
+ constructor(env) {
5998
+ this.deepbookV3Config = env === 0 /* Mainnet */ ? "0x0" : "0x77018927a5d7ed7b4c49312b71581f5f12ba52ba7e1219a15181ffc3d459f527";
5999
+ this.deepCoinType = env === 0 /* Mainnet */ ? "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP" : "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP";
6000
+ }
6001
+ swap(client, txb, path, inputCoin) {
6002
+ return __async(this, null, function* () {
6003
+ const { direction, from, target } = path;
6004
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6005
+ const zeroDeep = mintZeroCoin(txb, this.deepCoinType);
5955
6006
  const args = [
5956
- txb.object(this.poolRegistry),
5957
- txb.pure.u64(path.feeRate * 1e6),
6007
+ txb.object(this.deepbookV3Config),
6008
+ txb.object(path.id),
5958
6009
  inputCoin,
5959
- txb.object(this.versioned),
6010
+ zeroDeep,
5960
6011
  txb.object(CLOCK_ADDRESS)
5961
6012
  ];
5962
6013
  const res = txb.moveCall({
5963
- target: `${client.publishedAt()}::flowx_clmm::${func}`,
6014
+ target: `${client.publishedAt()}::deepbookv3::${func}`,
5964
6015
  typeArguments: [coinAType, coinBType],
5965
6016
  arguments: args
5966
6017
  });
@@ -5981,7 +6032,9 @@ var AFTERMATH = "AFTERMATH";
5981
6032
  var HAEDAL = "HAEDAL";
5982
6033
  var VOLO = "VOLO";
5983
6034
  var AFSUI = "AFSUI";
5984
- var AggregatorClient6 = class {
6035
+ var BLUEMOVE = "BLUEMOVE";
6036
+ var DEEPBOOKV3 = "DEEPBOOKV3";
6037
+ var AggregatorClient7 = class {
5985
6038
  constructor(endpoint, signer, client, env) {
5986
6039
  this.endpoint = endpoint;
5987
6040
  this.client = client;
@@ -6218,9 +6271,9 @@ var AggregatorClient6 = class {
6218
6271
  }
6219
6272
  publishedAt() {
6220
6273
  if (this.env === 0 /* Mainnet */) {
6221
- return "0xeffc8ae61f439bb34c9b905ff8f29ec56873dcedf81c7123ff2f1f67c45ec302";
6274
+ return "0xf98ed029af555e4a103febf26243dc33ac09a7ea1b2da7e414c728b25b729086";
6222
6275
  } else {
6223
- return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
6276
+ return "0xb2db335c85473e7ed952351bb594100eb8f61122703219c6b8dbcdcade2795b3";
6224
6277
  }
6225
6278
  }
6226
6279
  transferOrDestoryCoin(txb, coin, coinType) {
@@ -6254,6 +6307,8 @@ var AggregatorClient6 = class {
6254
6307
  return new Cetus(this.env, partner);
6255
6308
  case DEEPBOOKV2:
6256
6309
  return new DeepbookV2(this.env);
6310
+ case DEEPBOOKV3:
6311
+ return new DeepbookV3(this.env);
6257
6312
  case KRIYA:
6258
6313
  return new KriyaV2(this.env);
6259
6314
  case KRIYAV3:
@@ -6272,6 +6327,8 @@ var AggregatorClient6 = class {
6272
6327
  return new Afsui(this.env);
6273
6328
  case VOLO:
6274
6329
  return new Volo(this.env);
6330
+ case BLUEMOVE:
6331
+ return new Bluemove(this.env);
6275
6332
  default:
6276
6333
  throw new Error(`Unsupported dex ${provider}`);
6277
6334
  }
@@ -6460,6 +6517,7 @@ function getRouter(endpoint, params) {
6460
6517
  url += `&providers=${providers.join(",")}`;
6461
6518
  }
6462
6519
  }
6520
+ url += "&v=1000301";
6463
6521
  const response = yield fetch(url);
6464
6522
  return response;
6465
6523
  } catch (error) {
@@ -6540,10 +6598,12 @@ decimal.js/decimal.mjs:
6540
6598
 
6541
6599
  exports.AFSUI = AFSUI;
6542
6600
  exports.AFTERMATH = AFTERMATH;
6543
- exports.AggregatorClient = AggregatorClient6;
6601
+ exports.AggregatorClient = AggregatorClient7;
6602
+ exports.BLUEMOVE = BLUEMOVE;
6544
6603
  exports.CETUS = CETUS;
6545
6604
  exports.CLOCK_ADDRESS = CLOCK_ADDRESS;
6546
6605
  exports.DEEPBOOKV2 = DEEPBOOKV2;
6606
+ exports.DEEPBOOKV3 = DEEPBOOKV3;
6547
6607
  exports.Env = Env;
6548
6608
  exports.FLOWXV2 = FLOWXV2;
6549
6609
  exports.FLOWXV3 = FLOWXV3;
package/dist/index.mjs CHANGED
@@ -5143,6 +5143,34 @@ var KriyaV2 = class {
5143
5143
  }
5144
5144
  };
5145
5145
 
5146
+ // src/transaction/kriya_v3.ts
5147
+ var KriyaV3 = class {
5148
+ constructor(env) {
5149
+ if (env !== 0 /* Mainnet */) {
5150
+ throw new Error("Kriya clmm only supported on mainnet");
5151
+ }
5152
+ this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
5153
+ }
5154
+ swap(client, txb, path, inputCoin) {
5155
+ return __async(this, null, function* () {
5156
+ const { direction, from, target } = path;
5157
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5158
+ const args = [
5159
+ txb.object(path.id),
5160
+ inputCoin,
5161
+ txb.object(this.version),
5162
+ txb.object(CLOCK_ADDRESS)
5163
+ ];
5164
+ const res = txb.moveCall({
5165
+ target: `${client.publishedAt()}::kriya_clmm::${func}`,
5166
+ typeArguments: [coinAType, coinBType],
5167
+ arguments: args
5168
+ });
5169
+ return res;
5170
+ });
5171
+ }
5172
+ };
5173
+
5146
5174
  // src/transaction/flowx_v2.ts
5147
5175
  var FlowxV2 = class {
5148
5176
  constructor(env) {
@@ -5166,6 +5194,36 @@ var FlowxV2 = class {
5166
5194
  }
5167
5195
  };
5168
5196
 
5197
+ // src/transaction/flowx_v3.ts
5198
+ var FlowxV3 = class {
5199
+ constructor(env) {
5200
+ if (env !== 0 /* Mainnet */) {
5201
+ throw new Error("Flowx clmm only supported on mainnet");
5202
+ }
5203
+ this.versioned = "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656";
5204
+ this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
5205
+ }
5206
+ swap(client, txb, path, inputCoin) {
5207
+ return __async(this, null, function* () {
5208
+ const { direction, from, target } = path;
5209
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5210
+ const args = [
5211
+ txb.object(this.poolRegistry),
5212
+ txb.pure.u64(path.feeRate * 1e6),
5213
+ inputCoin,
5214
+ txb.object(this.versioned),
5215
+ txb.object(CLOCK_ADDRESS)
5216
+ ];
5217
+ const res = txb.moveCall({
5218
+ target: `${client.publishedAt()}::flowx_clmm::${func}`,
5219
+ typeArguments: [coinAType, coinBType],
5220
+ arguments: args
5221
+ });
5222
+ return res;
5223
+ });
5224
+ }
5225
+ };
5226
+
5169
5227
  // src/transaction/turbos.ts
5170
5228
  var Turbos = class {
5171
5229
  constructor(env) {
@@ -5816,34 +5874,6 @@ function swapInPools(client, params, sender) {
5816
5874
  });
5817
5875
  }
5818
5876
 
5819
- // src/transaction/kriya_v3.ts
5820
- var KriyaV3 = class {
5821
- constructor(env) {
5822
- if (env !== 0 /* Mainnet */) {
5823
- throw new Error("Kriya clmm only supported on mainnet");
5824
- }
5825
- this.version = "0xf5145a7ac345ca8736cf8c76047d00d6d378f30e81be6f6eb557184d9de93c78";
5826
- }
5827
- swap(client, txb, path, inputCoin) {
5828
- return __async(this, null, function* () {
5829
- const { direction, from, target } = path;
5830
- const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5831
- const args = [
5832
- txb.object(path.id),
5833
- inputCoin,
5834
- txb.object(this.version),
5835
- txb.object(CLOCK_ADDRESS)
5836
- ];
5837
- const res = txb.moveCall({
5838
- target: `${client.publishedAt()}::kriya_clmm::${func}`,
5839
- typeArguments: [coinAType, coinBType],
5840
- arguments: args
5841
- });
5842
- return res;
5843
- });
5844
- }
5845
- };
5846
-
5847
5877
  // src/transaction/haedal.ts
5848
5878
  var Haedal = class {
5849
5879
  constructor(env) {
@@ -5937,28 +5967,49 @@ var Volo = class {
5937
5967
  }
5938
5968
  };
5939
5969
 
5940
- // src/transaction/flowx_v3.ts
5941
- var FlowxV3 = class {
5970
+ // src/transaction/bluemove.ts
5971
+ var Bluemove = class {
5942
5972
  constructor(env) {
5943
5973
  if (env !== 0 /* Mainnet */) {
5944
- throw new Error("Flowx clmm only supported on mainnet");
5974
+ throw new Error("Bluemove only supported on mainnet");
5945
5975
  }
5946
- this.versioned = "0x67624a1533b5aff5d0dfcf5e598684350efd38134d2d245f475524c03a64e656";
5947
- this.poolRegistry = "0x27565d24a4cd51127ac90e4074a841bbe356cca7bf5759ddc14a975be1632abc";
5976
+ this.dexInfo = "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92";
5948
5977
  }
5949
5978
  swap(client, txb, path, inputCoin) {
5950
5979
  return __async(this, null, function* () {
5951
5980
  const { direction, from, target } = path;
5952
5981
  const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
5982
+ const args = [txb.object(this.dexInfo), inputCoin];
5983
+ const res = txb.moveCall({
5984
+ target: `${client.publishedAt()}::bluemove::${func}`,
5985
+ typeArguments: [coinAType, coinBType],
5986
+ arguments: args
5987
+ });
5988
+ return res;
5989
+ });
5990
+ }
5991
+ };
5992
+
5993
+ // src/transaction/deepbook_v3.ts
5994
+ var DeepbookV3 = class {
5995
+ constructor(env) {
5996
+ this.deepbookV3Config = env === 0 /* Mainnet */ ? "0x0" : "0x77018927a5d7ed7b4c49312b71581f5f12ba52ba7e1219a15181ffc3d459f527";
5997
+ this.deepCoinType = env === 0 /* Mainnet */ ? "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP" : "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP";
5998
+ }
5999
+ swap(client, txb, path, inputCoin) {
6000
+ return __async(this, null, function* () {
6001
+ const { direction, from, target } = path;
6002
+ const [func, coinAType, coinBType] = direction ? ["swap_a2b", from, target] : ["swap_b2a", target, from];
6003
+ const zeroDeep = mintZeroCoin(txb, this.deepCoinType);
5953
6004
  const args = [
5954
- txb.object(this.poolRegistry),
5955
- txb.pure.u64(path.feeRate * 1e6),
6005
+ txb.object(this.deepbookV3Config),
6006
+ txb.object(path.id),
5956
6007
  inputCoin,
5957
- txb.object(this.versioned),
6008
+ zeroDeep,
5958
6009
  txb.object(CLOCK_ADDRESS)
5959
6010
  ];
5960
6011
  const res = txb.moveCall({
5961
- target: `${client.publishedAt()}::flowx_clmm::${func}`,
6012
+ target: `${client.publishedAt()}::deepbookv3::${func}`,
5962
6013
  typeArguments: [coinAType, coinBType],
5963
6014
  arguments: args
5964
6015
  });
@@ -5979,7 +6030,9 @@ var AFTERMATH = "AFTERMATH";
5979
6030
  var HAEDAL = "HAEDAL";
5980
6031
  var VOLO = "VOLO";
5981
6032
  var AFSUI = "AFSUI";
5982
- var AggregatorClient6 = class {
6033
+ var BLUEMOVE = "BLUEMOVE";
6034
+ var DEEPBOOKV3 = "DEEPBOOKV3";
6035
+ var AggregatorClient7 = class {
5983
6036
  constructor(endpoint, signer, client, env) {
5984
6037
  this.endpoint = endpoint;
5985
6038
  this.client = client;
@@ -6216,9 +6269,9 @@ var AggregatorClient6 = class {
6216
6269
  }
6217
6270
  publishedAt() {
6218
6271
  if (this.env === 0 /* Mainnet */) {
6219
- return "0xeffc8ae61f439bb34c9b905ff8f29ec56873dcedf81c7123ff2f1f67c45ec302";
6272
+ return "0xf98ed029af555e4a103febf26243dc33ac09a7ea1b2da7e414c728b25b729086";
6220
6273
  } else {
6221
- return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595";
6274
+ return "0xb2db335c85473e7ed952351bb594100eb8f61122703219c6b8dbcdcade2795b3";
6222
6275
  }
6223
6276
  }
6224
6277
  transferOrDestoryCoin(txb, coin, coinType) {
@@ -6252,6 +6305,8 @@ var AggregatorClient6 = class {
6252
6305
  return new Cetus(this.env, partner);
6253
6306
  case DEEPBOOKV2:
6254
6307
  return new DeepbookV2(this.env);
6308
+ case DEEPBOOKV3:
6309
+ return new DeepbookV3(this.env);
6255
6310
  case KRIYA:
6256
6311
  return new KriyaV2(this.env);
6257
6312
  case KRIYAV3:
@@ -6270,6 +6325,8 @@ var AggregatorClient6 = class {
6270
6325
  return new Afsui(this.env);
6271
6326
  case VOLO:
6272
6327
  return new Volo(this.env);
6328
+ case BLUEMOVE:
6329
+ return new Bluemove(this.env);
6273
6330
  default:
6274
6331
  throw new Error(`Unsupported dex ${provider}`);
6275
6332
  }
@@ -6458,6 +6515,7 @@ function getRouter(endpoint, params) {
6458
6515
  url += `&providers=${providers.join(",")}`;
6459
6516
  }
6460
6517
  }
6518
+ url += "&v=1000301";
6461
6519
  const response = yield fetch(url);
6462
6520
  return response;
6463
6521
  } catch (error) {
@@ -6536,4 +6594,4 @@ decimal.js/decimal.mjs:
6536
6594
  *)
6537
6595
  */
6538
6596
 
6539
- export { AFSUI, AFTERMATH, AggregatorClient6 as AggregatorClient, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, Env, FLOWXV2, FLOWXV3, HAEDAL, KRIYA, KRIYAV3, ONE, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
6597
+ export { AFSUI, AFTERMATH, AggregatorClient7 as AggregatorClient, BLUEMOVE, CETUS, CLOCK_ADDRESS, DEEPBOOKV2, DEEPBOOKV3, Env, FLOWXV2, FLOWXV3, HAEDAL, KRIYA, KRIYAV3, ONE, TEN_POW_NINE, TURBOS, TWO, U128, U64_MAX, U64_MAX_BN, VOLO, ZERO, composeType, createTarget, dealWithFastRouterSwapParamsForMsafe, extractAddressFromType, extractStructTagFromType, fixSuiObjectId, getRouterResult, isSortedSymbols, normalizeCoinType, parseRouterResponse, patchFixSuiObjectId, restituteMsafeFastRouterSwapParams };
@@ -15,6 +15,8 @@ export declare const AFTERMATH = "AFTERMATH";
15
15
  export declare const HAEDAL = "HAEDAL";
16
16
  export declare const VOLO = "VOLO";
17
17
  export declare const AFSUI = "AFSUI";
18
+ export declare const BLUEMOVE = "BLUEMOVE";
19
+ export declare const DEEPBOOKV3 = "DEEPBOOKV3";
18
20
  export type BuildRouterSwapParams = {
19
21
  routers: Router[];
20
22
  byAmountIn: boolean;
@@ -0,0 +1,7 @@
1
+ import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
2
+ import { AggregatorClient, Dex, Env, Path } from "..";
3
+ export declare class Bluemove implements Dex {
4
+ private dexInfo;
5
+ constructor(env: Env);
6
+ swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
7
+ }
@@ -0,0 +1,13 @@
1
+ import { Transaction, TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
2
+ import { AggregatorClient, Dex, Env, Path } from "..";
3
+ export type CetusFlashSwapResult = {
4
+ targetCoin: TransactionObjectArgument;
5
+ flashReceipt: TransactionObjectArgument;
6
+ payAmount: TransactionArgument;
7
+ };
8
+ export declare class DeepbookV3 implements Dex {
9
+ private deepbookV3Config;
10
+ private deepCoinType;
11
+ constructor(env: Env);
12
+ swap(client: AggregatorClient, txb: Transaction, path: Path, inputCoin: TransactionObjectArgument): Promise<TransactionObjectArgument>;
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api.ts CHANGED
@@ -164,6 +164,9 @@ async function getRouter(endpoint: string, params: FindRouterParams) {
164
164
  }
165
165
  }
166
166
 
167
+ // set newest sdk version
168
+ url += "&v=1000301"
169
+
167
170
  const response = await fetch(url)
168
171
  return response
169
172
  } catch (error) {
package/src/client.ts CHANGED
@@ -19,18 +19,20 @@ import {
19
19
  import { Aftermath } from "./transaction/aftermath"
20
20
  import { DeepbookV2 } from "./transaction/deepbook_v2"
21
21
  import { KriyaV2 } from "./transaction/kriya_v2"
22
+ import { KriyaV3 } from "./transaction/kriya_v3"
22
23
  import { FlowxV2 } from "./transaction/flowx_v2"
24
+ import { FlowxV3 } from "./transaction/flowx_v3"
23
25
  import { Turbos } from "./transaction/turbos"
24
26
  import { Cetus } from "./transaction/cetus"
25
27
  import { swapInPools } from "./transaction/swap"
26
28
  import { CalculateAmountLimit } from "./math"
27
- import { buildInputCoin } from "./utils/coin"
28
- import { CoinAsset } from "./types/sui"
29
- import { KriyaV3 } from "./transaction/kriya_v3"
30
29
  import { Haedal } from "./transaction/haedal"
31
30
  import { Afsui } from "./transaction/afsui"
32
31
  import { Volo } from "./transaction/volo"
33
- import { FlowxV3 } from "./transaction/flowx_v3"
32
+ import { Bluemove } from "./transaction/bluemove"
33
+ import { CoinAsset } from "./types/sui"
34
+ import { buildInputCoin } from "./utils/coin"
35
+ import { DeepbookV3 } from "./transaction/deepbook_v3"
34
36
 
35
37
  export const CETUS = "CETUS"
36
38
  export const DEEPBOOKV2 = "DEEPBOOK"
@@ -43,7 +45,8 @@ export const AFTERMATH = "AFTERMATH"
43
45
  export const HAEDAL = "HAEDAL"
44
46
  export const VOLO = "VOLO"
45
47
  export const AFSUI = "AFSUI"
46
-
48
+ export const BLUEMOVE = "BLUEMOVE"
49
+ export const DEEPBOOKV3 = "DEEPBOOKV3"
47
50
  export type BuildRouterSwapParams = {
48
51
  routers: Router[]
49
52
  byAmountIn: boolean
@@ -335,9 +338,9 @@ export class AggregatorClient {
335
338
 
336
339
  publishedAt(): string {
337
340
  if (this.env === Env.Mainnet) {
338
- return "0xeffc8ae61f439bb34c9b905ff8f29ec56873dcedf81c7123ff2f1f67c45ec302"
341
+ return "0xf98ed029af555e4a103febf26243dc33ac09a7ea1b2da7e414c728b25b729086"
339
342
  } else {
340
- return "0x6cbaa3e9fbe902d90191b12f315932bc58079cba422bafbd4b4369f80e61f595"
343
+ return "0xb2db335c85473e7ed952351bb594100eb8f61122703219c6b8dbcdcade2795b3"
341
344
  }
342
345
  }
343
346
 
@@ -370,7 +373,7 @@ export class AggregatorClient {
370
373
  targetCoin = coins[0]
371
374
  }
372
375
 
373
- const res = txb.moveCall({
376
+ txb.moveCall({
374
377
  target: `${this.publishedAt()}::utils::check_coin_threshold`,
375
378
  typeArguments: [coinType],
376
379
  arguments: [targetCoin, txb.pure.u64(amountLimit.toString())],
@@ -384,6 +387,8 @@ export class AggregatorClient {
384
387
  return new Cetus(this.env, partner)
385
388
  case DEEPBOOKV2:
386
389
  return new DeepbookV2(this.env)
390
+ case DEEPBOOKV3:
391
+ return new DeepbookV3(this.env)
387
392
  case KRIYA:
388
393
  return new KriyaV2(this.env)
389
394
  case KRIYAV3:
@@ -402,6 +407,8 @@ export class AggregatorClient {
402
407
  return new Afsui(this.env)
403
408
  case VOLO:
404
409
  return new Volo(this.env)
410
+ case BLUEMOVE:
411
+ return new Bluemove(this.env)
405
412
  default:
406
413
  throw new Error(`Unsupported dex ${provider}`)
407
414
  }
@@ -0,0 +1,41 @@
1
+ import {
2
+ Transaction,
3
+ TransactionObjectArgument,
4
+ } from "@mysten/sui/transactions"
5
+ import { AggregatorClient, Dex, Env, Path } from ".."
6
+
7
+ export class Bluemove implements Dex {
8
+ private dexInfo: string
9
+
10
+ constructor(env: Env) {
11
+ if (env !== Env.Mainnet) {
12
+ throw new Error("Bluemove only supported on mainnet")
13
+ }
14
+
15
+ this.dexInfo =
16
+ "0x3f2d9f724f4a1ce5e71676448dc452be9a6243dac9c5b975a588c8c867066e92"
17
+ }
18
+
19
+ async swap(
20
+ client: AggregatorClient,
21
+ txb: Transaction,
22
+ path: Path,
23
+ inputCoin: TransactionObjectArgument
24
+ ): Promise<TransactionObjectArgument> {
25
+ const { direction, from, target } = path
26
+
27
+ const [func, coinAType, coinBType] = direction
28
+ ? ["swap_a2b", from, target]
29
+ : ["swap_b2a", target, from]
30
+
31
+ const args = [txb.object(this.dexInfo), inputCoin]
32
+
33
+ const res = txb.moveCall({
34
+ target: `${client.publishedAt()}::bluemove::${func}`,
35
+ typeArguments: [coinAType, coinBType],
36
+ arguments: args,
37
+ }) as TransactionObjectArgument
38
+
39
+ return res
40
+ }
41
+ }
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  Transaction,
3
- TransactionArgument,
4
3
  TransactionObjectArgument,
5
4
  } from "@mysten/sui/transactions"
6
5
  import { AggregatorClient, CLOCK_ADDRESS, Dex, Env, Path } from ".."
@@ -0,0 +1,56 @@
1
+ import {
2
+ Transaction,
3
+ TransactionArgument,
4
+ TransactionObjectArgument,
5
+ } from "@mysten/sui/transactions"
6
+ import { AggregatorClient, CLOCK_ADDRESS, Dex, Env, Path } from ".."
7
+ import { mintZeroCoin } from "~/utils/coin"
8
+
9
+ export type CetusFlashSwapResult = {
10
+ targetCoin: TransactionObjectArgument
11
+ flashReceipt: TransactionObjectArgument
12
+ payAmount: TransactionArgument
13
+ }
14
+
15
+ export class DeepbookV3 implements Dex {
16
+ private deepbookV3Config: string
17
+ private deepCoinType: string
18
+
19
+ constructor(env: Env) {
20
+ this.deepbookV3Config =
21
+ env === Env.Mainnet
22
+ ? "0x0"
23
+ : "0x77018927a5d7ed7b4c49312b71581f5f12ba52ba7e1219a15181ffc3d459f527"
24
+ this.deepCoinType =
25
+ env === Env.Mainnet
26
+ ? "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP"
27
+ : "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"
28
+ }
29
+
30
+ async swap(
31
+ client: AggregatorClient,
32
+ txb: Transaction,
33
+ path: Path,
34
+ inputCoin: TransactionObjectArgument
35
+ ): Promise<TransactionObjectArgument> {
36
+ const { direction, from, target } = path
37
+ const [func, coinAType, coinBType] = direction
38
+ ? ["swap_a2b", from, target]
39
+ : ["swap_b2a", target, from]
40
+
41
+ const zeroDeep = mintZeroCoin(txb, this.deepCoinType)
42
+ const args = [
43
+ txb.object(this.deepbookV3Config),
44
+ txb.object(path.id),
45
+ inputCoin,
46
+ zeroDeep,
47
+ txb.object(CLOCK_ADDRESS),
48
+ ]
49
+ const res = txb.moveCall({
50
+ target: `${client.publishedAt()}::deepbookv3::${func}`,
51
+ typeArguments: [coinAType, coinBType],
52
+ arguments: args,
53
+ }) as TransactionArgument
54
+ return res
55
+ }
56
+ }
package/test.json ADDED
@@ -0,0 +1,5 @@
1
+ [
2
+ [Path { id: "0x0d1b1746d220bd5ebac5231c7685480a16f1c707a46306095a4c67dc7ce4dcae", edge_id: "0x0d1b1746d220bd5ebac5231c7685480a16f1c707a46306095a4c67dc7ce4dcae", provider: "DEEPBOOKV3", from: "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP", target: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI", direction: true, fee_rate: Decimal(0), lot_size: 1000000, amount_in: 0, amount_out: 0, max_depth: 3, extended_details: None, allow_bidirection: true
3
+ }
4
+ ]
5
+ ]
@@ -45,7 +45,7 @@ describe("router module", () => {
45
45
  // console.log("wallet", wallet, "\n", wallet.toString())
46
46
 
47
47
  const wallet =
48
- "0xfba94aa36e93ccc7d84a6a57040fc51983223f1b522a8d0be3c3bf2c98977ebb"
48
+ "0xf7b8d77dd06a6bb51c37ad3ce69e0a44c6f1064f52ac54606ef47763c8a71be6"
49
49
  // const wallet =
50
50
  // "0xa459702162b73204eed77420d93d9453b7a7b893a0edea1e268607cf7fa76e03"
51
51
  // const wallet =
@@ -137,9 +137,6 @@ describe("router module", () => {
137
137
  const byAmountIn = true
138
138
  const amount = "1000000000"
139
139
 
140
- // const from = M_USDC
141
- // const target = M_SUI
142
-
143
140
  const from = M_SUI
144
141
  // const target =
145
142
  // "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
@@ -162,7 +159,7 @@ describe("router module", () => {
162
159
  // "KRIYA",
163
160
  // "KRIYAV3",
164
161
  // "TURBOS",
165
- "FLOWXV3",
162
+ "BLUEMOVE",
166
163
  ],
167
164
  })
168
165