@cetusprotocol/aggregator-sdk 1.1.5 → 1.2.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
@@ -435,7 +435,7 @@ type SuiStructTag = {
435
435
  /**
436
436
  * Represents basic SUI data types.
437
437
  */
438
- type SuiBasicTypes = 'address' | 'bool' | 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'u256';
438
+ type SuiBasicTypes = "address" | "bool" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256";
439
439
  /**
440
440
  * Represents a SUI transaction argument, which can be of various types.
441
441
  */
@@ -443,7 +443,7 @@ type SuiTxArg = TransactionArgument | string | number | bigint | boolean;
443
443
  /**
444
444
  * Represents input types for SUI data.
445
445
  */
446
- type SuiInputTypes = 'object' | SuiBasicTypes;
446
+ type SuiInputTypes = "object" | SuiBasicTypes;
447
447
  /**
448
448
  * Gets the default SUI input type based on the provided value.
449
449
  * @param value - The value to determine the default input type for.
@@ -627,7 +627,7 @@ declare const SuiZeroCoinFn = "0x2::coin::zero";
627
627
  declare const DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
628
628
  declare const DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
629
629
  declare const CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
630
- declare const CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
630
+ declare const CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
631
631
  declare const MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
632
632
  declare const TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
633
633
  declare const MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
@@ -741,8 +741,8 @@ declare function getAggregatorServerErrorMessage(code: AggregatorServerErrorCode
741
741
  */
742
742
  declare class AggregatorError extends Error {
743
743
  message: string;
744
- errorCode?: AggregatorErrorCode;
745
- constructor(message: string, errorCode?: AggregatorErrorCode);
744
+ errorCode?: AggregatorErrorCode | string;
745
+ constructor(message: string, errorCode?: AggregatorErrorCode | string);
746
746
  static isAggregatorErrorCode(e: any, code: AggregatorErrorCode): boolean;
747
747
  }
748
748
 
package/dist/index.d.ts CHANGED
@@ -435,7 +435,7 @@ type SuiStructTag = {
435
435
  /**
436
436
  * Represents basic SUI data types.
437
437
  */
438
- type SuiBasicTypes = 'address' | 'bool' | 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'u256';
438
+ type SuiBasicTypes = "address" | "bool" | "u8" | "u16" | "u32" | "u64" | "u128" | "u256";
439
439
  /**
440
440
  * Represents a SUI transaction argument, which can be of various types.
441
441
  */
@@ -443,7 +443,7 @@ type SuiTxArg = TransactionArgument | string | number | bigint | boolean;
443
443
  /**
444
444
  * Represents input types for SUI data.
445
445
  */
446
- type SuiInputTypes = 'object' | SuiBasicTypes;
446
+ type SuiInputTypes = "object" | SuiBasicTypes;
447
447
  /**
448
448
  * Gets the default SUI input type based on the provided value.
449
449
  * @param value - The value to determine the default input type for.
@@ -627,7 +627,7 @@ declare const SuiZeroCoinFn = "0x2::coin::zero";
627
627
  declare const DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
628
628
  declare const DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
629
629
  declare const CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
630
- declare const CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
630
+ declare const CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
631
631
  declare const MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
632
632
  declare const TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
633
633
  declare const MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
@@ -741,8 +741,8 @@ declare function getAggregatorServerErrorMessage(code: AggregatorServerErrorCode
741
741
  */
742
742
  declare class AggregatorError extends Error {
743
743
  message: string;
744
- errorCode?: AggregatorErrorCode;
745
- constructor(message: string, errorCode?: AggregatorErrorCode);
744
+ errorCode?: AggregatorErrorCode | string;
745
+ constructor(message: string, errorCode?: AggregatorErrorCode | string);
746
746
  static isAggregatorErrorCode(e: any, code: AggregatorErrorCode): boolean;
747
747
  }
748
748
 
package/dist/index.js CHANGED
@@ -1658,6 +1658,7 @@ var require_bn = __commonJS({
1658
1658
  this.words[i] = carry;
1659
1659
  this.length++;
1660
1660
  }
1661
+ this.length = num === 0 ? 1 : this.length;
1661
1662
  return isNegNum ? this.ineg() : this;
1662
1663
  };
1663
1664
  BN7.prototype.muln = function muln(num) {
@@ -3246,7 +3247,7 @@ function buildInputCoin(txb, allCoins, amount, coinType) {
3246
3247
  }
3247
3248
  let totalCoinBalance = CoinUtils.calculateTotalBalance(usedCoinAsests);
3248
3249
  if (totalCoinBalance < amount) {
3249
- throw new AggregateError(
3250
+ throw new AggregatorError(
3250
3251
  "Insufficient balance when build merge coin, coinType: " + coinType,
3251
3252
  "InsufficientBalance" /* InsufficientBalance */ + coinType
3252
3253
  );
@@ -3340,7 +3341,7 @@ var SuiZeroCoinFn = "0x2::coin::zero";
3340
3341
  var DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
3341
3342
  var DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
3342
3343
  var CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
3343
- var CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
3344
+ var CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
3344
3345
  var MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
3345
3346
  var TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
3346
3347
  var MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
@@ -3428,7 +3429,7 @@ var AGGREGATOR_V3_CONFIG = {
3428
3429
  };
3429
3430
 
3430
3431
  // src/api.ts
3431
- var SDK_VERSION = 1010105;
3432
+ var SDK_VERSION = 1010200;
3432
3433
  function parseRouterResponse(data, byAmountIn) {
3433
3434
  let packages = /* @__PURE__ */ new Map();
3434
3435
  if (data.packages) {
@@ -3999,18 +4000,17 @@ P.hyperbolicTangent = P.tanh = function() {
3999
4000
  return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
4000
4001
  };
4001
4002
  P.inverseCosine = P.acos = function() {
4002
- var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
4003
+ var x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
4003
4004
  if (k !== -1) {
4004
4005
  return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
4005
4006
  }
4006
4007
  if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
4007
4008
  Ctor.precision = pr + 6;
4008
4009
  Ctor.rounding = 1;
4009
- x = x.asin();
4010
- halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
4010
+ x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
4011
4011
  Ctor.precision = pr;
4012
4012
  Ctor.rounding = rm;
4013
- return halfPi.minus(x);
4013
+ return x.times(2);
4014
4014
  };
4015
4015
  P.inverseHyperbolicCosine = P.acosh = function() {
4016
4016
  var pr, rm, x = this, Ctor = x.constructor;
@@ -4782,7 +4782,7 @@ function cosine(Ctor, x) {
4782
4782
  Ctor.precision -= k;
4783
4783
  return x;
4784
4784
  }
4785
- var divide = /* @__PURE__ */ function() {
4785
+ var divide = /* @__PURE__ */ (function() {
4786
4786
  function multiplyInteger(x, k, base) {
4787
4787
  var temp, carry = 0, i = x.length;
4788
4788
  for (x = x.slice(); i--; ) {
@@ -4940,7 +4940,7 @@ var divide = /* @__PURE__ */ function() {
4940
4940
  }
4941
4941
  return q;
4942
4942
  };
4943
- }();
4943
+ })();
4944
4944
  function finalise(x, sd, rm, isTruncated) {
4945
4945
  var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor;
4946
4946
  out: if (sd != null) {
@@ -5108,14 +5108,16 @@ function intPow(Ctor, x, n, pr) {
5108
5108
  function isOdd(n) {
5109
5109
  return n.d[n.d.length - 1] & 1;
5110
5110
  }
5111
- function maxOrMin(Ctor, args, ltgt) {
5112
- var y, x = new Ctor(args[0]), i = 0;
5111
+ function maxOrMin(Ctor, args, n) {
5112
+ var k, y, x = new Ctor(args[0]), i = 0;
5113
5113
  for (; ++i < args.length; ) {
5114
5114
  y = new Ctor(args[i]);
5115
5115
  if (!y.s) {
5116
5116
  x = y;
5117
5117
  break;
5118
- } else if (x[ltgt](y)) {
5118
+ }
5119
+ k = x.cmp(y);
5120
+ if (k === n || k === 0 && x.s === n) {
5119
5121
  x = y;
5120
5122
  }
5121
5123
  }
@@ -5658,24 +5660,35 @@ function clone(obj) {
5658
5660
  x.d = [v];
5659
5661
  }
5660
5662
  return;
5661
- } else if (v * 0 !== 0) {
5663
+ }
5664
+ if (v * 0 !== 0) {
5662
5665
  if (!v) x.s = NaN;
5663
5666
  x.e = NaN;
5664
5667
  x.d = null;
5665
5668
  return;
5666
5669
  }
5667
5670
  return parseDecimal(x, v.toString());
5668
- } else if (t !== "string") {
5669
- throw Error(invalidArgument + v);
5670
5671
  }
5671
- if ((i2 = v.charCodeAt(0)) === 45) {
5672
- v = v.slice(1);
5673
- x.s = -1;
5674
- } else {
5675
- if (i2 === 43) v = v.slice(1);
5676
- x.s = 1;
5672
+ if (t === "string") {
5673
+ if ((i2 = v.charCodeAt(0)) === 45) {
5674
+ v = v.slice(1);
5675
+ x.s = -1;
5676
+ } else {
5677
+ if (i2 === 43) v = v.slice(1);
5678
+ x.s = 1;
5679
+ }
5680
+ return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
5677
5681
  }
5678
- return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
5682
+ if (t === "bigint") {
5683
+ if (v < 0) {
5684
+ v = -v;
5685
+ x.s = -1;
5686
+ } else {
5687
+ x.s = 1;
5688
+ }
5689
+ return parseDecimal(x, v.toString());
5690
+ }
5691
+ throw Error(invalidArgument + v);
5679
5692
  }
5680
5693
  Decimal2.prototype = P;
5681
5694
  Decimal2.ROUND_UP = 0;
@@ -5782,10 +5795,10 @@ function log10(x) {
5782
5795
  return new this(x).log(10);
5783
5796
  }
5784
5797
  function max() {
5785
- return maxOrMin(this, arguments, "lt");
5798
+ return maxOrMin(this, arguments, -1);
5786
5799
  }
5787
5800
  function min() {
5788
- return maxOrMin(this, arguments, "gt");
5801
+ return maxOrMin(this, arguments, 1);
5789
5802
  }
5790
5803
  function mod(x, y) {
5791
5804
  return new this(x).mod(y);
@@ -8693,7 +8706,7 @@ var _AggregatorClient = class _AggregatorClient {
8693
8706
  const coinA = direction ? fromCoin : targetCoin;
8694
8707
  const coinB = direction ? targetCoin : fromCoin;
8695
8708
  const typeArguments = [coinA, coinB];
8696
- const integratePublishedAt = this.env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
8709
+ const integratePublishedAt = this.env === 0 /* Mainnet */ ? "0x5bcd02f33d65c7ce98cd1ffb88174629210e59230b41c4b4572de1541f94946e" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
8697
8710
  for (let i = 0; i < pools.length; i++) {
8698
8711
  const args = [
8699
8712
  tx.object(pools[i]),
@@ -8898,16 +8911,19 @@ var getDefaultSuiInputType = (value) => {
8898
8911
  if (typeof value === "boolean") {
8899
8912
  return "bool";
8900
8913
  }
8901
- throw new AggregateError(`Unknown type for value: ${value}`, "InvalidType" /* InvalidType */);
8914
+ throw new AggregatorError(
8915
+ `Unknown type for value: ${value}`,
8916
+ "InvalidType" /* InvalidType */
8917
+ );
8902
8918
  };
8903
8919
  /*! Bundled license information:
8904
8920
 
8905
8921
  decimal.js/decimal.mjs:
8906
8922
  (*!
8907
- * decimal.js v10.4.3
8923
+ * decimal.js v10.6.0
8908
8924
  * An arbitrary-precision Decimal type for JavaScript.
8909
8925
  * https://github.com/MikeMcl/decimal.js
8910
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
8926
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
8911
8927
  * MIT Licence
8912
8928
  *)
8913
8929
  */
package/dist/index.mjs CHANGED
@@ -1652,6 +1652,7 @@ var require_bn = __commonJS({
1652
1652
  this.words[i] = carry;
1653
1653
  this.length++;
1654
1654
  }
1655
+ this.length = num === 0 ? 1 : this.length;
1655
1656
  return isNegNum ? this.ineg() : this;
1656
1657
  };
1657
1658
  BN7.prototype.muln = function muln(num) {
@@ -3240,7 +3241,7 @@ function buildInputCoin(txb, allCoins, amount, coinType) {
3240
3241
  }
3241
3242
  let totalCoinBalance = CoinUtils.calculateTotalBalance(usedCoinAsests);
3242
3243
  if (totalCoinBalance < amount) {
3243
- throw new AggregateError(
3244
+ throw new AggregatorError(
3244
3245
  "Insufficient balance when build merge coin, coinType: " + coinType,
3245
3246
  "InsufficientBalance" /* InsufficientBalance */ + coinType
3246
3247
  );
@@ -3334,7 +3335,7 @@ var SuiZeroCoinFn = "0x2::coin::zero";
3334
3335
  var DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
3335
3336
  var DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
3336
3337
  var CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
3337
- var CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
3338
+ var CETUS_V3_PUBLISHED_AT = "0xd7b0cfc33a3b46c0ae0e2584c44028385da11724d4c94ec5b21a78117c5c1ab9";
3338
3339
  var MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
3339
3340
  var TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
3340
3341
  var MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
@@ -3422,7 +3423,7 @@ var AGGREGATOR_V3_CONFIG = {
3422
3423
  };
3423
3424
 
3424
3425
  // src/api.ts
3425
- var SDK_VERSION = 1010105;
3426
+ var SDK_VERSION = 1010200;
3426
3427
  function parseRouterResponse(data, byAmountIn) {
3427
3428
  let packages = /* @__PURE__ */ new Map();
3428
3429
  if (data.packages) {
@@ -3993,18 +3994,17 @@ P.hyperbolicTangent = P.tanh = function() {
3993
3994
  return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
3994
3995
  };
3995
3996
  P.inverseCosine = P.acos = function() {
3996
- var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
3997
+ var x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
3997
3998
  if (k !== -1) {
3998
3999
  return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
3999
4000
  }
4000
4001
  if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
4001
4002
  Ctor.precision = pr + 6;
4002
4003
  Ctor.rounding = 1;
4003
- x = x.asin();
4004
- halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
4004
+ x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
4005
4005
  Ctor.precision = pr;
4006
4006
  Ctor.rounding = rm;
4007
- return halfPi.minus(x);
4007
+ return x.times(2);
4008
4008
  };
4009
4009
  P.inverseHyperbolicCosine = P.acosh = function() {
4010
4010
  var pr, rm, x = this, Ctor = x.constructor;
@@ -4776,7 +4776,7 @@ function cosine(Ctor, x) {
4776
4776
  Ctor.precision -= k;
4777
4777
  return x;
4778
4778
  }
4779
- var divide = /* @__PURE__ */ function() {
4779
+ var divide = /* @__PURE__ */ (function() {
4780
4780
  function multiplyInteger(x, k, base) {
4781
4781
  var temp, carry = 0, i = x.length;
4782
4782
  for (x = x.slice(); i--; ) {
@@ -4934,7 +4934,7 @@ var divide = /* @__PURE__ */ function() {
4934
4934
  }
4935
4935
  return q;
4936
4936
  };
4937
- }();
4937
+ })();
4938
4938
  function finalise(x, sd, rm, isTruncated) {
4939
4939
  var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor;
4940
4940
  out: if (sd != null) {
@@ -5102,14 +5102,16 @@ function intPow(Ctor, x, n, pr) {
5102
5102
  function isOdd(n) {
5103
5103
  return n.d[n.d.length - 1] & 1;
5104
5104
  }
5105
- function maxOrMin(Ctor, args, ltgt) {
5106
- var y, x = new Ctor(args[0]), i = 0;
5105
+ function maxOrMin(Ctor, args, n) {
5106
+ var k, y, x = new Ctor(args[0]), i = 0;
5107
5107
  for (; ++i < args.length; ) {
5108
5108
  y = new Ctor(args[i]);
5109
5109
  if (!y.s) {
5110
5110
  x = y;
5111
5111
  break;
5112
- } else if (x[ltgt](y)) {
5112
+ }
5113
+ k = x.cmp(y);
5114
+ if (k === n || k === 0 && x.s === n) {
5113
5115
  x = y;
5114
5116
  }
5115
5117
  }
@@ -5652,24 +5654,35 @@ function clone(obj) {
5652
5654
  x.d = [v];
5653
5655
  }
5654
5656
  return;
5655
- } else if (v * 0 !== 0) {
5657
+ }
5658
+ if (v * 0 !== 0) {
5656
5659
  if (!v) x.s = NaN;
5657
5660
  x.e = NaN;
5658
5661
  x.d = null;
5659
5662
  return;
5660
5663
  }
5661
5664
  return parseDecimal(x, v.toString());
5662
- } else if (t !== "string") {
5663
- throw Error(invalidArgument + v);
5664
5665
  }
5665
- if ((i2 = v.charCodeAt(0)) === 45) {
5666
- v = v.slice(1);
5667
- x.s = -1;
5668
- } else {
5669
- if (i2 === 43) v = v.slice(1);
5670
- x.s = 1;
5666
+ if (t === "string") {
5667
+ if ((i2 = v.charCodeAt(0)) === 45) {
5668
+ v = v.slice(1);
5669
+ x.s = -1;
5670
+ } else {
5671
+ if (i2 === 43) v = v.slice(1);
5672
+ x.s = 1;
5673
+ }
5674
+ return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
5671
5675
  }
5672
- return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
5676
+ if (t === "bigint") {
5677
+ if (v < 0) {
5678
+ v = -v;
5679
+ x.s = -1;
5680
+ } else {
5681
+ x.s = 1;
5682
+ }
5683
+ return parseDecimal(x, v.toString());
5684
+ }
5685
+ throw Error(invalidArgument + v);
5673
5686
  }
5674
5687
  Decimal2.prototype = P;
5675
5688
  Decimal2.ROUND_UP = 0;
@@ -5776,10 +5789,10 @@ function log10(x) {
5776
5789
  return new this(x).log(10);
5777
5790
  }
5778
5791
  function max() {
5779
- return maxOrMin(this, arguments, "lt");
5792
+ return maxOrMin(this, arguments, -1);
5780
5793
  }
5781
5794
  function min() {
5782
- return maxOrMin(this, arguments, "gt");
5795
+ return maxOrMin(this, arguments, 1);
5783
5796
  }
5784
5797
  function mod(x, y) {
5785
5798
  return new this(x).mod(y);
@@ -8687,7 +8700,7 @@ var _AggregatorClient = class _AggregatorClient {
8687
8700
  const coinA = direction ? fromCoin : targetCoin;
8688
8701
  const coinB = direction ? targetCoin : fromCoin;
8689
8702
  const typeArguments = [coinA, coinB];
8690
- const integratePublishedAt = this.env === 0 /* Mainnet */ ? "0xb2db7142fa83210a7d78d9c12ac49c043b3cbbd482224fea6e3da00aa5a5ae2d" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
8703
+ const integratePublishedAt = this.env === 0 /* Mainnet */ ? "0x5bcd02f33d65c7ce98cd1ffb88174629210e59230b41c4b4572de1541f94946e" : "0x4f920e1ef6318cfba77e20a0538a419a5a504c14230169438b99aba485db40a6";
8691
8704
  for (let i = 0; i < pools.length; i++) {
8692
8705
  const args = [
8693
8706
  tx.object(pools[i]),
@@ -8892,16 +8905,19 @@ var getDefaultSuiInputType = (value) => {
8892
8905
  if (typeof value === "boolean") {
8893
8906
  return "bool";
8894
8907
  }
8895
- throw new AggregateError(`Unknown type for value: ${value}`, "InvalidType" /* InvalidType */);
8908
+ throw new AggregatorError(
8909
+ `Unknown type for value: ${value}`,
8910
+ "InvalidType" /* InvalidType */
8911
+ );
8896
8912
  };
8897
8913
  /*! Bundled license information:
8898
8914
 
8899
8915
  decimal.js/decimal.mjs:
8900
8916
  (*!
8901
- * decimal.js v10.4.3
8917
+ * decimal.js v10.6.0
8902
8918
  * An arbitrary-precision Decimal type for JavaScript.
8903
8919
  * https://github.com/MikeMcl/decimal.js
8904
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
8920
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
8905
8921
  * MIT Licence
8906
8922
  *)
8907
8923
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cetusprotocol/aggregator-sdk",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,33 +16,42 @@
16
16
  "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
17
17
  "publish:test": "node version.mjs && npm publish --tag experimental"
18
18
  },
19
- "devDependencies": {
20
- "@types/bn.js": "^5.1.5",
21
- "@types/bun": "latest",
22
- "@types/json-bigint": "^1.0.4",
23
- "bn.js": "^5.2.1",
24
- "decimal.js": "^10.4.3",
25
- "tsup": "^8.0.2"
26
- },
27
19
  "peerDependencies": {
28
20
  "typescript": "^5.0.0"
29
21
  },
30
22
  "dependencies": {
23
+ "@mysten/sui": "^1.0.5",
24
+ "@pythnetwork/pyth-sui-js": "^2.1.0",
25
+ "bip39": "^3.1.0",
26
+ "dotenv": "^16.4.5",
27
+ "json-bigint": "^1.0.0",
28
+ "node-fetch": "^3.3.2"
29
+ },
30
+ "devDependencies": {
31
31
  "@babel/core": "^7.24.5",
32
32
  "@babel/preset-env": "^7.24.5",
33
33
  "@babel/preset-typescript": "^7.24.1",
34
34
  "@jest/globals": "^29.7.0",
35
- "@mysten/sui": "^1.0.5",
36
- "@pythnetwork/pyth-sui-js": "^2.1.0",
37
35
  "@types/jest": "^29.5.12",
38
36
  "@types/node": "^20.12.12",
39
37
  "babel-jest": "^29.7.0",
40
- "bip39": "^3.1.0",
41
- "dotenv": "^16.4.5",
42
38
  "jest": "^29.7.0",
43
- "json-bigint": "^1.0.0",
44
- "node-fetch": "^3.3.2",
45
39
  "ts-jest": "^29.1.3",
46
- "typescript": "^5.0.0"
40
+ "typescript": "^5.0.0",
41
+ "@types/bn.js": "^5.1.5",
42
+ "@types/bun": "latest",
43
+ "@types/json-bigint": "^1.0.4",
44
+ "bn.js": "^5.2.1",
45
+ "decimal.js": "^10.4.3",
46
+ "tsup": "^8.0.2"
47
+ },
48
+ "overrides": {
49
+ "chalk": "5.3.0",
50
+ "strip-ansi": "7.1.0",
51
+ "color-convert": "2.0.1",
52
+ "color-name": "1.1.4",
53
+ "is-core-module": "2.13.1",
54
+ "error-ex": "1.3.2",
55
+ "has-ansi": "5.0.1"
47
56
  }
48
57
  }