@cetusprotocol/aggregator-sdk 0.0.0-experimental-20250723103308 → 0.0.0-experimental-20250724183511

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
@@ -65,9 +65,9 @@ type ExtendedDetails = {
65
65
  steamm_bank_b?: string;
66
66
  steamm_lending_market?: string;
67
67
  steamm_lending_market_type?: string;
68
- steamm_b_coin_a_type?: string;
69
- steamm_b_coin_b_type?: string;
70
- steamm_lp_token?: string;
68
+ steamm_btoken_a_type?: string;
69
+ steamm_btoken_b_type?: string;
70
+ steamm_lp_token_type?: string;
71
71
  steamm_oracle_registry_id?: string;
72
72
  steamm_oracle_pyth_price_seed_a?: string;
73
73
  steamm_oracle_pyth_price_seed_b?: string;
package/dist/index.d.ts CHANGED
@@ -65,9 +65,9 @@ type ExtendedDetails = {
65
65
  steamm_bank_b?: string;
66
66
  steamm_lending_market?: string;
67
67
  steamm_lending_market_type?: string;
68
- steamm_b_coin_a_type?: string;
69
- steamm_b_coin_b_type?: string;
70
- steamm_lp_token?: string;
68
+ steamm_btoken_a_type?: string;
69
+ steamm_btoken_b_type?: string;
70
+ steamm_lp_token_type?: string;
71
71
  steamm_oracle_registry_id?: string;
72
72
  steamm_oracle_pyth_price_seed_a?: string;
73
73
  steamm_oracle_pyth_price_seed_b?: string;
package/dist/index.js CHANGED
@@ -5360,7 +5360,7 @@ var AGGREGATOR_V3_CONFIG = {
5360
5360
  "SCALLOP",
5361
5361
  "SUILEND",
5362
5362
  "SPRINGSUI",
5363
- // Phase 4: Oracle-driven Routers
5363
+ // Phase 4: Oracle-driven Routers
5364
5364
  "HAEDALPMM",
5365
5365
  "OBRIC",
5366
5366
  "SEVENK",
@@ -6917,21 +6917,29 @@ var Cetus = class {
6917
6917
  var import_bn7 = __toESM(require_bn());
6918
6918
 
6919
6919
  // src/math.ts
6920
- __toESM(require_bn());
6920
+ var import_bn6 = __toESM(require_bn());
6921
6921
  function CalculateAmountLimit(expectAmount, byAmountIn, slippage) {
6922
- let amountLimit = ZERO;
6923
- if (byAmountIn) {
6924
- amountLimit = expectAmount.muln(1 - slippage);
6925
- } else {
6926
- amountLimit = expectAmount.muln(1 + slippage);
6927
- }
6928
- return Number(amountLimit.toString());
6922
+ return Number(
6923
+ CalculateAmountLimitByDecimal(
6924
+ new decimal_default(expectAmount.toString()),
6925
+ byAmountIn,
6926
+ slippage
6927
+ ).toFixed(0)
6928
+ );
6929
6929
  }
6930
6930
  function CalculateAmountLimitBN(expectAmount, byAmountIn, slippage) {
6931
+ const amountLimit = CalculateAmountLimitByDecimal(
6932
+ new decimal_default(expectAmount.toString()),
6933
+ byAmountIn,
6934
+ slippage
6935
+ );
6936
+ return new import_bn6.default(amountLimit.toFixed(0));
6937
+ }
6938
+ function CalculateAmountLimitByDecimal(expectAmount, byAmountIn, slippage) {
6931
6939
  if (byAmountIn) {
6932
- return expectAmount.muln(1 - slippage);
6940
+ return expectAmount.mul(1 - slippage);
6933
6941
  } else {
6934
- return expectAmount.muln(1 + slippage);
6942
+ return expectAmount.mul(1 + slippage);
6935
6943
  }
6936
6944
  }
6937
6945
  function sqrtPriceX64ToPrice(sqrtPriceStr, decimalsA, decimalsB) {
@@ -7413,13 +7421,13 @@ var SteammCPMM = class {
7413
7421
  if (path.extendedDetails.steamm_lending_market_type == null) {
7414
7422
  throw new Error("Steamm lending market type not supported");
7415
7423
  }
7416
- if (path.extendedDetails.steamm_b_coin_a_type == null) {
7424
+ if (path.extendedDetails.steamm_btoken_a_type == null) {
7417
7425
  throw new Error("Steamm b coin a type not supported");
7418
7426
  }
7419
- if (path.extendedDetails.steamm_b_coin_b_type == null) {
7427
+ if (path.extendedDetails.steamm_btoken_b_type == null) {
7420
7428
  throw new Error("Steamm b coin b type not supported");
7421
7429
  }
7422
- if (path.extendedDetails.steamm_lp_token == null) {
7430
+ if (path.extendedDetails.steamm_lp_token_type == null) {
7423
7431
  throw new Error("Steamm lp token not supported");
7424
7432
  }
7425
7433
  }
@@ -7441,9 +7449,9 @@ var SteammCPMM = class {
7441
7449
  path.extendedDetails.steamm_lending_market_type,
7442
7450
  coinAType,
7443
7451
  coinBType,
7444
- path.extendedDetails.steamm_b_coin_a_type,
7445
- path.extendedDetails.steamm_b_coin_b_type,
7446
- path.extendedDetails.steamm_lp_token
7452
+ path.extendedDetails.steamm_btoken_a_type,
7453
+ path.extendedDetails.steamm_btoken_b_type,
7454
+ path.extendedDetails.steamm_lp_token_type
7447
7455
  ],
7448
7456
  arguments: args
7449
7457
  });
@@ -7479,13 +7487,13 @@ var SteammOmm = class {
7479
7487
  if (path.extendedDetails.steamm_lending_market_type == null) {
7480
7488
  throw new Error("Steamm lending market type not supported");
7481
7489
  }
7482
- if (path.extendedDetails.steamm_b_coin_a_type == null) {
7490
+ if (path.extendedDetails.steamm_btoken_a_type == null) {
7483
7491
  throw new Error("Steamm b coin a type not supported");
7484
7492
  }
7485
- if (path.extendedDetails.steamm_b_coin_b_type == null) {
7493
+ if (path.extendedDetails.steamm_btoken_b_type == null) {
7486
7494
  throw new Error("Steamm b coin b type not supported");
7487
7495
  }
7488
- if (path.extendedDetails.steamm_lp_token == null) {
7496
+ if (path.extendedDetails.steamm_lp_token_type == null) {
7489
7497
  throw new Error("Steamm lp token not supported");
7490
7498
  }
7491
7499
  if (path.extendedDetails.steamm_oracle_registry_id == null) {
@@ -7554,9 +7562,9 @@ var SteammOmm = class {
7554
7562
  path.extendedDetails.steamm_lending_market_type,
7555
7563
  coinAType,
7556
7564
  coinBType,
7557
- path.extendedDetails.steamm_b_coin_a_type,
7558
- path.extendedDetails.steamm_b_coin_b_type,
7559
- path.extendedDetails.steamm_lp_token
7565
+ path.extendedDetails.steamm_btoken_a_type,
7566
+ path.extendedDetails.steamm_btoken_b_type,
7567
+ path.extendedDetails.steamm_lp_token_type
7560
7568
  ],
7561
7569
  arguments: args
7562
7570
  });
@@ -7837,13 +7845,13 @@ var SteammOmmV2 = class {
7837
7845
  if (path.extendedDetails.steamm_lending_market_type == null) {
7838
7846
  throw new Error("Steamm lending market type not supported");
7839
7847
  }
7840
- if (path.extendedDetails.steamm_b_coin_a_type == null) {
7848
+ if (path.extendedDetails.steamm_btoken_a_type == null) {
7841
7849
  throw new Error("Steamm b coin a type not supported");
7842
7850
  }
7843
- if (path.extendedDetails.steamm_b_coin_b_type == null) {
7851
+ if (path.extendedDetails.steamm_btoken_b_type == null) {
7844
7852
  throw new Error("Steamm b coin b type not supported");
7845
7853
  }
7846
- if (path.extendedDetails.steamm_lp_token == null) {
7854
+ if (path.extendedDetails.steamm_lp_token_type == null) {
7847
7855
  throw new Error("Steamm lp token not supported");
7848
7856
  }
7849
7857
  if (path.extendedDetails.steamm_oracle_registry_id == null) {
@@ -7912,9 +7920,9 @@ var SteammOmmV2 = class {
7912
7920
  path.extendedDetails.steamm_lending_market_type,
7913
7921
  coinAType,
7914
7922
  coinBType,
7915
- path.extendedDetails.steamm_b_coin_a_type,
7916
- path.extendedDetails.steamm_b_coin_b_type,
7917
- path.extendedDetails.steamm_lp_token
7923
+ path.extendedDetails.steamm_btoken_a_type,
7924
+ path.extendedDetails.steamm_btoken_b_type,
7925
+ path.extendedDetails.steamm_lp_token_type
7918
7926
  ],
7919
7927
  arguments: args
7920
7928
  });
@@ -10677,6 +10685,8 @@ var AggregatorClientV3 = class extends AggregatorClient {
10677
10685
  throw new Error(CLIENT_CONFIG.ERRORS.QUOTE_ID_REQUIRED);
10678
10686
  }
10679
10687
  const processedData = sortAndFlattenRoutes(routerData);
10688
+ console.log("expectAmountOut", expectAmountOut);
10689
+ console.log("amountOutLimit", amountOutLimit);
10680
10690
  const swapCtx = newSwapContext(
10681
10691
  {
10682
10692
  quoteID: processedData.quoteID,
@@ -10813,6 +10823,9 @@ var AggregatorClientV3 = class extends AggregatorClient {
10813
10823
  byAmountIn,
10814
10824
  slippage
10815
10825
  );
10826
+ console.log("expectedAmountOut", expectedAmountOut.toString());
10827
+ console.log("expectedAmountIn", expectedAmountIn.toString());
10828
+ console.log("amountLimit", amountLimit.toString());
10816
10829
  if (!params.routers.packages || !params.routers.packages.get(PACKAGE_NAMES.AGGREGATOR_V3)) {
10817
10830
  throw new Error(CLIENT_CONFIG.ERRORS.PACKAGES_REQUIRED);
10818
10831
  }
@@ -11041,7 +11054,6 @@ var AggregatorClientV3 = class extends AggregatorClient {
11041
11054
  if (!this.signer) {
11042
11055
  this.signer = "0x0";
11043
11056
  }
11044
- printTransaction(tx);
11045
11057
  const simulateRes = yield this.client.devInspectTransactionBlock({
11046
11058
  transactionBlock: tx,
11047
11059
  sender: this.signer
package/dist/index.mjs CHANGED
@@ -5354,7 +5354,7 @@ var AGGREGATOR_V3_CONFIG = {
5354
5354
  "SCALLOP",
5355
5355
  "SUILEND",
5356
5356
  "SPRINGSUI",
5357
- // Phase 4: Oracle-driven Routers
5357
+ // Phase 4: Oracle-driven Routers
5358
5358
  "HAEDALPMM",
5359
5359
  "OBRIC",
5360
5360
  "SEVENK",
@@ -6911,21 +6911,29 @@ var Cetus = class {
6911
6911
  var import_bn7 = __toESM(require_bn());
6912
6912
 
6913
6913
  // src/math.ts
6914
- __toESM(require_bn());
6914
+ var import_bn6 = __toESM(require_bn());
6915
6915
  function CalculateAmountLimit(expectAmount, byAmountIn, slippage) {
6916
- let amountLimit = ZERO;
6917
- if (byAmountIn) {
6918
- amountLimit = expectAmount.muln(1 - slippage);
6919
- } else {
6920
- amountLimit = expectAmount.muln(1 + slippage);
6921
- }
6922
- return Number(amountLimit.toString());
6916
+ return Number(
6917
+ CalculateAmountLimitByDecimal(
6918
+ new decimal_default(expectAmount.toString()),
6919
+ byAmountIn,
6920
+ slippage
6921
+ ).toFixed(0)
6922
+ );
6923
6923
  }
6924
6924
  function CalculateAmountLimitBN(expectAmount, byAmountIn, slippage) {
6925
+ const amountLimit = CalculateAmountLimitByDecimal(
6926
+ new decimal_default(expectAmount.toString()),
6927
+ byAmountIn,
6928
+ slippage
6929
+ );
6930
+ return new import_bn6.default(amountLimit.toFixed(0));
6931
+ }
6932
+ function CalculateAmountLimitByDecimal(expectAmount, byAmountIn, slippage) {
6925
6933
  if (byAmountIn) {
6926
- return expectAmount.muln(1 - slippage);
6934
+ return expectAmount.mul(1 - slippage);
6927
6935
  } else {
6928
- return expectAmount.muln(1 + slippage);
6936
+ return expectAmount.mul(1 + slippage);
6929
6937
  }
6930
6938
  }
6931
6939
  function sqrtPriceX64ToPrice(sqrtPriceStr, decimalsA, decimalsB) {
@@ -7407,13 +7415,13 @@ var SteammCPMM = class {
7407
7415
  if (path.extendedDetails.steamm_lending_market_type == null) {
7408
7416
  throw new Error("Steamm lending market type not supported");
7409
7417
  }
7410
- if (path.extendedDetails.steamm_b_coin_a_type == null) {
7418
+ if (path.extendedDetails.steamm_btoken_a_type == null) {
7411
7419
  throw new Error("Steamm b coin a type not supported");
7412
7420
  }
7413
- if (path.extendedDetails.steamm_b_coin_b_type == null) {
7421
+ if (path.extendedDetails.steamm_btoken_b_type == null) {
7414
7422
  throw new Error("Steamm b coin b type not supported");
7415
7423
  }
7416
- if (path.extendedDetails.steamm_lp_token == null) {
7424
+ if (path.extendedDetails.steamm_lp_token_type == null) {
7417
7425
  throw new Error("Steamm lp token not supported");
7418
7426
  }
7419
7427
  }
@@ -7435,9 +7443,9 @@ var SteammCPMM = class {
7435
7443
  path.extendedDetails.steamm_lending_market_type,
7436
7444
  coinAType,
7437
7445
  coinBType,
7438
- path.extendedDetails.steamm_b_coin_a_type,
7439
- path.extendedDetails.steamm_b_coin_b_type,
7440
- path.extendedDetails.steamm_lp_token
7446
+ path.extendedDetails.steamm_btoken_a_type,
7447
+ path.extendedDetails.steamm_btoken_b_type,
7448
+ path.extendedDetails.steamm_lp_token_type
7441
7449
  ],
7442
7450
  arguments: args
7443
7451
  });
@@ -7473,13 +7481,13 @@ var SteammOmm = class {
7473
7481
  if (path.extendedDetails.steamm_lending_market_type == null) {
7474
7482
  throw new Error("Steamm lending market type not supported");
7475
7483
  }
7476
- if (path.extendedDetails.steamm_b_coin_a_type == null) {
7484
+ if (path.extendedDetails.steamm_btoken_a_type == null) {
7477
7485
  throw new Error("Steamm b coin a type not supported");
7478
7486
  }
7479
- if (path.extendedDetails.steamm_b_coin_b_type == null) {
7487
+ if (path.extendedDetails.steamm_btoken_b_type == null) {
7480
7488
  throw new Error("Steamm b coin b type not supported");
7481
7489
  }
7482
- if (path.extendedDetails.steamm_lp_token == null) {
7490
+ if (path.extendedDetails.steamm_lp_token_type == null) {
7483
7491
  throw new Error("Steamm lp token not supported");
7484
7492
  }
7485
7493
  if (path.extendedDetails.steamm_oracle_registry_id == null) {
@@ -7548,9 +7556,9 @@ var SteammOmm = class {
7548
7556
  path.extendedDetails.steamm_lending_market_type,
7549
7557
  coinAType,
7550
7558
  coinBType,
7551
- path.extendedDetails.steamm_b_coin_a_type,
7552
- path.extendedDetails.steamm_b_coin_b_type,
7553
- path.extendedDetails.steamm_lp_token
7559
+ path.extendedDetails.steamm_btoken_a_type,
7560
+ path.extendedDetails.steamm_btoken_b_type,
7561
+ path.extendedDetails.steamm_lp_token_type
7554
7562
  ],
7555
7563
  arguments: args
7556
7564
  });
@@ -7831,13 +7839,13 @@ var SteammOmmV2 = class {
7831
7839
  if (path.extendedDetails.steamm_lending_market_type == null) {
7832
7840
  throw new Error("Steamm lending market type not supported");
7833
7841
  }
7834
- if (path.extendedDetails.steamm_b_coin_a_type == null) {
7842
+ if (path.extendedDetails.steamm_btoken_a_type == null) {
7835
7843
  throw new Error("Steamm b coin a type not supported");
7836
7844
  }
7837
- if (path.extendedDetails.steamm_b_coin_b_type == null) {
7845
+ if (path.extendedDetails.steamm_btoken_b_type == null) {
7838
7846
  throw new Error("Steamm b coin b type not supported");
7839
7847
  }
7840
- if (path.extendedDetails.steamm_lp_token == null) {
7848
+ if (path.extendedDetails.steamm_lp_token_type == null) {
7841
7849
  throw new Error("Steamm lp token not supported");
7842
7850
  }
7843
7851
  if (path.extendedDetails.steamm_oracle_registry_id == null) {
@@ -7906,9 +7914,9 @@ var SteammOmmV2 = class {
7906
7914
  path.extendedDetails.steamm_lending_market_type,
7907
7915
  coinAType,
7908
7916
  coinBType,
7909
- path.extendedDetails.steamm_b_coin_a_type,
7910
- path.extendedDetails.steamm_b_coin_b_type,
7911
- path.extendedDetails.steamm_lp_token
7917
+ path.extendedDetails.steamm_btoken_a_type,
7918
+ path.extendedDetails.steamm_btoken_b_type,
7919
+ path.extendedDetails.steamm_lp_token_type
7912
7920
  ],
7913
7921
  arguments: args
7914
7922
  });
@@ -10671,6 +10679,8 @@ var AggregatorClientV3 = class extends AggregatorClient {
10671
10679
  throw new Error(CLIENT_CONFIG.ERRORS.QUOTE_ID_REQUIRED);
10672
10680
  }
10673
10681
  const processedData = sortAndFlattenRoutes(routerData);
10682
+ console.log("expectAmountOut", expectAmountOut);
10683
+ console.log("amountOutLimit", amountOutLimit);
10674
10684
  const swapCtx = newSwapContext(
10675
10685
  {
10676
10686
  quoteID: processedData.quoteID,
@@ -10807,6 +10817,9 @@ var AggregatorClientV3 = class extends AggregatorClient {
10807
10817
  byAmountIn,
10808
10818
  slippage
10809
10819
  );
10820
+ console.log("expectedAmountOut", expectedAmountOut.toString());
10821
+ console.log("expectedAmountIn", expectedAmountIn.toString());
10822
+ console.log("amountLimit", amountLimit.toString());
10810
10823
  if (!params.routers.packages || !params.routers.packages.get(PACKAGE_NAMES.AGGREGATOR_V3)) {
10811
10824
  throw new Error(CLIENT_CONFIG.ERRORS.PACKAGES_REQUIRED);
10812
10825
  }
@@ -11035,7 +11048,6 @@ var AggregatorClientV3 = class extends AggregatorClient {
11035
11048
  if (!this.signer) {
11036
11049
  this.signer = "0x0";
11037
11050
  }
11038
- printTransaction(tx);
11039
11051
  const simulateRes = yield this.client.devInspectTransactionBlock({
11040
11052
  transactionBlock: tx,
11041
11053
  sender: this.signer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "0.0.0-experimental-20250723103308",
3
+ "version": "0.0.0-experimental-20250724183511",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",