@cetusprotocol/aggregator-sdk 0.0.0-experimental-20250608024551 → 0.0.0-experimental-20250613180845

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.js CHANGED
@@ -5271,18 +5271,17 @@ var Turbos = class {
5271
5271
  // src/transaction/cetus.ts
5272
5272
  var Cetus = class {
5273
5273
  constructor(env, partner) {
5274
- this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
5275
- this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
5274
+ this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x92aa3ffab80fe7ed518442413aa26d91d13c5e95aca6c3d9c03bdc7663119fd5";
5275
+ this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0xd67361aaecc23e5fdfd77970a61153ca183dfcb2ae466e65a60e3859eeb8aad0";
5276
5276
  }
5277
- flash_swap(client, txb, path, by_amount_in, packages) {
5277
+ flash_swap(client, txb, path, amount_arg, by_amount_in, packages) {
5278
5278
  const { direction, from, target } = path;
5279
5279
  const [func, coinAType, coinBType] = direction ? ["flash_swap_a2b", from, target] : ["flash_swap_b2a", target, from];
5280
- let amount = by_amount_in ? path.amountIn : path.amountOut;
5281
5280
  const args = [
5282
5281
  txb.object(this.globalConfig),
5283
5282
  txb.object(path.id),
5284
5283
  txb.object(this.partner),
5285
- txb.pure.u64(amount),
5284
+ amount_arg,
5286
5285
  txb.pure.bool(by_amount_in),
5287
5286
  txb.object(CLOCK_ADDRESS)
5288
5287
  ];
@@ -5805,7 +5804,7 @@ function swapInPools(client, params, sender, env) {
5805
5804
  const targetCoin = completionCoin(target);
5806
5805
  const tx = new transactions.Transaction();
5807
5806
  const direction = compareCoins(fromCoin, targetCoin);
5808
- const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5807
+ const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x36187418dd79415d50e2e5903f9b3caca582052005f062959c86da64e82107a9";
5809
5808
  const coinA = direction ? fromCoin : targetCoin;
5810
5809
  const coinB = direction ? targetCoin : fromCoin;
5811
5810
  const typeArguments = [coinA, coinB];
@@ -7039,9 +7038,11 @@ var _AggregatorClient = class _AggregatorClient {
7039
7038
  );
7040
7039
  for (let i = 0; i < routers.length; i++) {
7041
7040
  const router = routers[i];
7041
+ let amount_arg = txb.pure.u64(router.amountOut.toString());
7042
7042
  for (let j = router.path.length - 1; j >= 0; j--) {
7043
7043
  const path = router.path[j];
7044
- const flashSwapResult = dex.flash_swap(this, txb, path, false);
7044
+ const flashSwapResult = dex.flash_swap(this, txb, path, amount_arg, false);
7045
+ amount_arg = flashSwapResult.payAmount;
7045
7046
  returnCoins.unshift(flashSwapResult.targetCoin);
7046
7047
  receipts.unshift(flashSwapResult.flashReceipt);
7047
7048
  }
@@ -7279,6 +7280,7 @@ var _AggregatorClient = class _AggregatorClient {
7279
7280
  byAmountIn,
7280
7281
  slippage
7281
7282
  );
7283
+ console.log("amountLimit", amountLimit.toString());
7282
7284
  const amount = byAmountIn ? expectedAmountIn : amountLimit;
7283
7285
  const buildFromCoinRes = buildInputCoin(
7284
7286
  txb,
@@ -7346,7 +7348,7 @@ var _AggregatorClient = class _AggregatorClient {
7346
7348
  if (this.env === 0 /* Mainnet */) {
7347
7349
  return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7348
7350
  } else {
7349
- return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7351
+ return "0xdf49f2dc1c8090372a8c0d1542f33313f430cfbe9fa656c1386559e2a0bd2ffd";
7350
7352
  }
7351
7353
  }
7352
7354
  // Include deepbookv3, scallop, bluefin
@@ -7354,14 +7356,14 @@ var _AggregatorClient = class _AggregatorClient {
7354
7356
  if (this.env === 0 /* Mainnet */) {
7355
7357
  return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7356
7358
  } else {
7357
- return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7359
+ return "0xdf49f2dc1c8090372a8c0d1542f33313f430cfbe9fa656c1386559e2a0bd2ffd";
7358
7360
  }
7359
7361
  }
7360
7362
  publishedAtV2Extend2() {
7361
7363
  if (this.env === 0 /* Mainnet */) {
7362
7364
  return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7363
7365
  } else {
7364
- return "0x0";
7366
+ return "0xdf49f2dc1c8090372a8c0d1542f33313f430cfbe9fa656c1386559e2a0bd2ffd";
7365
7367
  }
7366
7368
  }
7367
7369
  deepbookv3DeepFeeType() {
@@ -7760,7 +7762,7 @@ function processEndpoint(endpoint) {
7760
7762
 
7761
7763
  // src/api.ts
7762
7764
  var import_bn7 = __toESM(require_bn());
7763
- var SDK_VERSION = 1001200;
7765
+ var SDK_VERSION = 1001201;
7764
7766
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7765
7767
  return __async(this, null, function* () {
7766
7768
  let response;
package/dist/index.mjs CHANGED
@@ -5269,18 +5269,17 @@ var Turbos = class {
5269
5269
  // src/transaction/cetus.ts
5270
5270
  var Cetus = class {
5271
5271
  constructor(env, partner) {
5272
- this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x9774e359588ead122af1c7e7f64e14ade261cfeecdb5d0eb4a5b3b4c8ab8bd3e";
5273
- this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0x1f5fa5c820f40d43fc47815ad06d95e40a1942ff72a732a92e8ef4aa8cde70a5";
5272
+ this.globalConfig = env === 0 /* Mainnet */ ? "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f" : "0x92aa3ffab80fe7ed518442413aa26d91d13c5e95aca6c3d9c03bdc7663119fd5";
5273
+ this.partner = partner != null ? partner : env === 0 /* Mainnet */ ? "0x639b5e433da31739e800cd085f356e64cae222966d0f1b11bd9dc76b322ff58b" : "0xd67361aaecc23e5fdfd77970a61153ca183dfcb2ae466e65a60e3859eeb8aad0";
5274
5274
  }
5275
- flash_swap(client, txb, path, by_amount_in, packages) {
5275
+ flash_swap(client, txb, path, amount_arg, by_amount_in, packages) {
5276
5276
  const { direction, from, target } = path;
5277
5277
  const [func, coinAType, coinBType] = direction ? ["flash_swap_a2b", from, target] : ["flash_swap_b2a", target, from];
5278
- let amount = by_amount_in ? path.amountIn : path.amountOut;
5279
5278
  const args = [
5280
5279
  txb.object(this.globalConfig),
5281
5280
  txb.object(path.id),
5282
5281
  txb.object(this.partner),
5283
- txb.pure.u64(amount),
5282
+ amount_arg,
5284
5283
  txb.pure.bool(by_amount_in),
5285
5284
  txb.object(CLOCK_ADDRESS)
5286
5285
  ];
@@ -5803,7 +5802,7 @@ function swapInPools(client, params, sender, env) {
5803
5802
  const targetCoin = completionCoin(target);
5804
5803
  const tx = new Transaction();
5805
5804
  const direction = compareCoins(fromCoin, targetCoin);
5806
- const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
5805
+ const integratePublishedAt = env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x36187418dd79415d50e2e5903f9b3caca582052005f062959c86da64e82107a9";
5807
5806
  const coinA = direction ? fromCoin : targetCoin;
5808
5807
  const coinB = direction ? targetCoin : fromCoin;
5809
5808
  const typeArguments = [coinA, coinB];
@@ -7037,9 +7036,11 @@ var _AggregatorClient = class _AggregatorClient {
7037
7036
  );
7038
7037
  for (let i = 0; i < routers.length; i++) {
7039
7038
  const router = routers[i];
7039
+ let amount_arg = txb.pure.u64(router.amountOut.toString());
7040
7040
  for (let j = router.path.length - 1; j >= 0; j--) {
7041
7041
  const path = router.path[j];
7042
- const flashSwapResult = dex.flash_swap(this, txb, path, false);
7042
+ const flashSwapResult = dex.flash_swap(this, txb, path, amount_arg, false);
7043
+ amount_arg = flashSwapResult.payAmount;
7043
7044
  returnCoins.unshift(flashSwapResult.targetCoin);
7044
7045
  receipts.unshift(flashSwapResult.flashReceipt);
7045
7046
  }
@@ -7277,6 +7278,7 @@ var _AggregatorClient = class _AggregatorClient {
7277
7278
  byAmountIn,
7278
7279
  slippage
7279
7280
  );
7281
+ console.log("amountLimit", amountLimit.toString());
7280
7282
  const amount = byAmountIn ? expectedAmountIn : amountLimit;
7281
7283
  const buildFromCoinRes = buildInputCoin(
7282
7284
  txb,
@@ -7344,7 +7346,7 @@ var _AggregatorClient = class _AggregatorClient {
7344
7346
  if (this.env === 0 /* Mainnet */) {
7345
7347
  return "0x47a7b90756fba96fe649c2aaa10ec60dec6b8cb8545573d621310072721133aa";
7346
7348
  } else {
7347
- return "0x52eae33adeb44de55cfb3f281d4cc9e02d976181c0952f5323648b5717b33934";
7349
+ return "0xdf49f2dc1c8090372a8c0d1542f33313f430cfbe9fa656c1386559e2a0bd2ffd";
7348
7350
  }
7349
7351
  }
7350
7352
  // Include deepbookv3, scallop, bluefin
@@ -7352,14 +7354,14 @@ var _AggregatorClient = class _AggregatorClient {
7352
7354
  if (this.env === 0 /* Mainnet */) {
7353
7355
  return "0x8093d002bba575f1378b0da206a8df1fc55c4b5b3718752304f1b67a505d2be4";
7354
7356
  } else {
7355
- return "0xabb6a81c8a216828e317719e06125de5bb2cb0fe8f9916ff8c023ca5be224c78";
7357
+ return "0xdf49f2dc1c8090372a8c0d1542f33313f430cfbe9fa656c1386559e2a0bd2ffd";
7356
7358
  }
7357
7359
  }
7358
7360
  publishedAtV2Extend2() {
7359
7361
  if (this.env === 0 /* Mainnet */) {
7360
7362
  return "0x96356d1cfc7a4dec5bc0171f085ddaf1f650b1c6c412f209518d496c8ffed212";
7361
7363
  } else {
7362
- return "0x0";
7364
+ return "0xdf49f2dc1c8090372a8c0d1542f33313f430cfbe9fa656c1386559e2a0bd2ffd";
7363
7365
  }
7364
7366
  }
7365
7367
  deepbookv3DeepFeeType() {
@@ -7758,7 +7760,7 @@ function processEndpoint(endpoint) {
7758
7760
 
7759
7761
  // src/api.ts
7760
7762
  var import_bn7 = __toESM(require_bn());
7761
- var SDK_VERSION = 1001200;
7763
+ var SDK_VERSION = 1001201;
7762
7764
  function getRouterResult(endpoint, apiKey, params, overlayFee, overlayFeeReceiver) {
7763
7765
  return __async(this, null, function* () {
7764
7766
  let response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.0.0-experimental-20250608024551",
3
+ "version": "0.0.0-experimental-20250613180845",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",