@cetusprotocol/aggregator-sdk 1.1.4 → 1.1.6

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 = "0x550dcd6070230d8bf18d99d34e3b2ca1d3657b76cc80ffdacdb2b5d28d7e0124";
630
+ declare const CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
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";
@@ -679,9 +679,9 @@ declare const DEEPBOOK_V3_DEEP_FEE_TYPES: {
679
679
  declare const CLIENT_CONFIG: {
680
680
  readonly DEFAULT_PYTH_URL: "https://hermes.pyth.network";
681
681
  readonly PYTH_TIMEOUT: 3000;
682
- readonly MAX_OVERLAY_FEE_RATE_PARAMS: 0.1;
682
+ readonly MAX_OVERLAY_FEE_RATE: 0.1;
683
+ readonly MAX_OVERLAY_FEE_RATE_NUMERATOR: 100000;
683
684
  readonly FEE_RATE_MULTIPLIER: 1000000;
684
- readonly MAX_FEE_RATE: 100000;
685
685
  readonly DEFAULT_OVERLAY_FEE_RECEIVER: "0x0";
686
686
  readonly ERRORS: {
687
687
  readonly SIGNER_REQUIRED: "Signer is required, but not provided.";
@@ -702,7 +702,7 @@ declare const AGGREGATOR_V3_CONFIG: {
702
702
  readonly MAX_FEE_RATE: 100000;
703
703
  readonly MAX_AMOUNT_IN: "18446744073709551615";
704
704
  readonly DEFAULT_PUBLISHED_AT: {
705
- readonly Mainnet: "0x07c27e879ba9282506284b0fef26d393978906fc9496550d978c6f493dbfa3e5";
705
+ readonly Mainnet: "0x33ec64e9bb369bf045ddc198c81adbf2acab424da37465d95296ee02045d2b17";
706
706
  readonly Testnet: "0x0";
707
707
  };
708
708
  };
@@ -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
 
@@ -794,7 +794,7 @@ declare const GAS_TYPE_ARG = "0x2::sui::SUI";
794
794
  declare const GAS_TYPE_ARG_LONG = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
795
795
  declare const GAS_SYMBOL = "SUI";
796
796
  declare const DEFAULT_NFT_TRANSFER_GAS_FEE = 450;
797
- declare const SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
797
+ declare const SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000005";
798
798
  /**
799
799
  * This class provides helper methods for working with coins.
800
800
  */
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 = "0x550dcd6070230d8bf18d99d34e3b2ca1d3657b76cc80ffdacdb2b5d28d7e0124";
630
+ declare const CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
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";
@@ -679,9 +679,9 @@ declare const DEEPBOOK_V3_DEEP_FEE_TYPES: {
679
679
  declare const CLIENT_CONFIG: {
680
680
  readonly DEFAULT_PYTH_URL: "https://hermes.pyth.network";
681
681
  readonly PYTH_TIMEOUT: 3000;
682
- readonly MAX_OVERLAY_FEE_RATE_PARAMS: 0.1;
682
+ readonly MAX_OVERLAY_FEE_RATE: 0.1;
683
+ readonly MAX_OVERLAY_FEE_RATE_NUMERATOR: 100000;
683
684
  readonly FEE_RATE_MULTIPLIER: 1000000;
684
- readonly MAX_FEE_RATE: 100000;
685
685
  readonly DEFAULT_OVERLAY_FEE_RECEIVER: "0x0";
686
686
  readonly ERRORS: {
687
687
  readonly SIGNER_REQUIRED: "Signer is required, but not provided.";
@@ -702,7 +702,7 @@ declare const AGGREGATOR_V3_CONFIG: {
702
702
  readonly MAX_FEE_RATE: 100000;
703
703
  readonly MAX_AMOUNT_IN: "18446744073709551615";
704
704
  readonly DEFAULT_PUBLISHED_AT: {
705
- readonly Mainnet: "0x07c27e879ba9282506284b0fef26d393978906fc9496550d978c6f493dbfa3e5";
705
+ readonly Mainnet: "0x33ec64e9bb369bf045ddc198c81adbf2acab424da37465d95296ee02045d2b17";
706
706
  readonly Testnet: "0x0";
707
707
  };
708
708
  };
@@ -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
 
@@ -794,7 +794,7 @@ declare const GAS_TYPE_ARG = "0x2::sui::SUI";
794
794
  declare const GAS_TYPE_ARG_LONG = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
795
795
  declare const GAS_SYMBOL = "SUI";
796
796
  declare const DEFAULT_NFT_TRANSFER_GAS_FEE = 450;
797
- declare const SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
797
+ declare const SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000005";
798
798
  /**
799
799
  * This class provides helper methods for working with coins.
800
800
  */
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) {
@@ -2999,7 +3000,7 @@ var GAS_TYPE_ARG = "0x2::sui::SUI";
2999
3000
  var GAS_TYPE_ARG_LONG = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
3000
3001
  var GAS_SYMBOL = "SUI";
3001
3002
  var DEFAULT_NFT_TRANSFER_GAS_FEE = 450;
3002
- var SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
3003
+ var SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000005";
3003
3004
  var CoinUtils = class _CoinUtils {
3004
3005
  /**
3005
3006
  * Get the coin type argument from a SuiMoveObject.
@@ -3107,18 +3108,10 @@ var CoinUtils = class _CoinUtils {
3107
3108
  * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
3108
3109
  */
3109
3110
  static selectCoinObjectIdGreaterThanOrEqual(coins, amount, exclude = []) {
3110
- const selectedResult = _CoinUtils.selectCoinAssetGreaterThanOrEqual(
3111
- coins,
3112
- amount,
3113
- exclude
3114
- );
3115
- const objectArray = selectedResult.selectedCoins.map(
3116
- (item) => item.coinObjectId
3117
- );
3111
+ const selectedResult = _CoinUtils.selectCoinAssetGreaterThanOrEqual(coins, amount, exclude);
3112
+ const objectArray = selectedResult.selectedCoins.map((item) => item.coinObjectId);
3118
3113
  const remainCoins = selectedResult.remainingCoins;
3119
- const amountArray = selectedResult.selectedCoins.map(
3120
- (item) => item.balance.toString()
3121
- );
3114
+ const amountArray = selectedResult.selectedCoins.map((item) => item.balance.toString());
3122
3115
  return { objectArray, remainCoins, amountArray };
3123
3116
  }
3124
3117
  /**
@@ -3130,9 +3123,7 @@ var CoinUtils = class _CoinUtils {
3130
3123
  * @returns The CoinAsset objects that have a balance greater than or equal to the given amount.
3131
3124
  */
3132
3125
  static selectCoinAssetGreaterThanOrEqual(coins, amount, exclude = []) {
3133
- const sortedCoins = _CoinUtils.sortByBalance(
3134
- coins.filter((c) => !exclude.includes(c.coinObjectId))
3135
- );
3126
+ const sortedCoins = _CoinUtils.sortByBalance(coins.filter((c) => !exclude.includes(c.coinObjectId)));
3136
3127
  const total = _CoinUtils.calculateTotalBalance(sortedCoins);
3137
3128
  if (total < amount) {
3138
3129
  return { selectedCoins: [], remainingCoins: sortedCoins };
@@ -3145,13 +3136,9 @@ var CoinUtils = class _CoinUtils {
3145
3136
  const remainingCoins = [...sortedCoins];
3146
3137
  while (sum2 < total) {
3147
3138
  const target = amount - sum2;
3148
- const coinWithSmallestSufficientBalanceIndex = remainingCoins.findIndex(
3149
- (c) => c.balance >= target
3150
- );
3139
+ const coinWithSmallestSufficientBalanceIndex = remainingCoins.findIndex((c) => c.balance >= target);
3151
3140
  if (coinWithSmallestSufficientBalanceIndex !== -1) {
3152
- selectedCoins.push(
3153
- remainingCoins[coinWithSmallestSufficientBalanceIndex]
3154
- );
3141
+ selectedCoins.push(remainingCoins[coinWithSmallestSufficientBalanceIndex]);
3155
3142
  remainingCoins.splice(coinWithSmallestSufficientBalanceIndex, 1);
3156
3143
  break;
3157
3144
  }
@@ -3161,10 +3148,7 @@ var CoinUtils = class _CoinUtils {
3161
3148
  sum2 += coinWithLargestBalance.balance;
3162
3149
  }
3163
3150
  }
3164
- return {
3165
- selectedCoins: _CoinUtils.sortByBalance(selectedCoins),
3166
- remainingCoins: _CoinUtils.sortByBalance(remainingCoins)
3167
- };
3151
+ return { selectedCoins: _CoinUtils.sortByBalance(selectedCoins), remainingCoins: _CoinUtils.sortByBalance(remainingCoins) };
3168
3152
  }
3169
3153
  /**
3170
3154
  * Sort the CoinAsset objects by their balance.
@@ -3173,14 +3157,10 @@ var CoinUtils = class _CoinUtils {
3173
3157
  * @returns The sorted CoinAsset objects.
3174
3158
  */
3175
3159
  static sortByBalance(coins) {
3176
- return coins.sort(
3177
- (a, b) => a.balance < b.balance ? -1 : a.balance > b.balance ? 1 : 0
3178
- );
3160
+ return coins.sort((a, b) => a.balance < b.balance ? -1 : a.balance > b.balance ? 1 : 0);
3179
3161
  }
3180
3162
  static sortByBalanceDes(coins) {
3181
- return coins.sort(
3182
- (a, b) => a.balance > b.balance ? -1 : a.balance < b.balance ? 0 : 1
3183
- );
3163
+ return coins.sort((a, b) => a.balance > b.balance ? -1 : a.balance < b.balance ? 0 : 1);
3184
3164
  }
3185
3165
  /**
3186
3166
  * Calculate the total balance of a list of CoinAsset objects.
@@ -3267,7 +3247,7 @@ function buildInputCoin(txb, allCoins, amount, coinType) {
3267
3247
  }
3268
3248
  let totalCoinBalance = CoinUtils.calculateTotalBalance(usedCoinAsests);
3269
3249
  if (totalCoinBalance < amount) {
3270
- throw new AggregateError(
3250
+ throw new AggregatorError(
3271
3251
  "Insufficient balance when build merge coin, coinType: " + coinType,
3272
3252
  "InsufficientBalance" /* InsufficientBalance */ + coinType
3273
3253
  );
@@ -3361,7 +3341,7 @@ var SuiZeroCoinFn = "0x2::coin::zero";
3361
3341
  var DEEPBOOK_PACKAGE_ID = "0x000000000000000000000000000000000000000000000000000000000000dee9";
3362
3342
  var DEEPBOOK_PUBLISHED_AT = "0x000000000000000000000000000000000000000000000000000000000000dee9";
3363
3343
  var CETUS_PUBLISHED_AT = "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a";
3364
- var CETUS_V3_PUBLISHED_AT = "0x550dcd6070230d8bf18d99d34e3b2ca1d3657b76cc80ffdacdb2b5d28d7e0124";
3344
+ var CETUS_V3_PUBLISHED_AT = "0xb1e11ceaf3e7cd3031ef5e24804478ec3441c5aecdace910bdaca317a0c1c535";
3365
3345
  var MAINNET_CETUS_GLOBAL_CONFIG_ID = "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f";
3366
3346
  var TESTNET_CETUS_GLOBAL_CONFIG_ID = "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a";
3367
3347
  var MAINNET_FLOWX_AMM_CONTAINER_ID = "0xb65dcbf63fd3ad5d0ebfbf334780dc9f785eff38a4459e37ab08fa79576ee511";
@@ -3418,9 +3398,9 @@ var DEEPBOOK_V3_DEEP_FEE_TYPES = {
3418
3398
  var CLIENT_CONFIG = {
3419
3399
  DEFAULT_PYTH_URL: "https://hermes.pyth.network",
3420
3400
  PYTH_TIMEOUT: 3e3,
3421
- MAX_OVERLAY_FEE_RATE_PARAMS: 0.1,
3401
+ MAX_OVERLAY_FEE_RATE: 0.1,
3402
+ MAX_OVERLAY_FEE_RATE_NUMERATOR: 1e5,
3422
3403
  FEE_RATE_MULTIPLIER: 1e6,
3423
- MAX_FEE_RATE: 1e5,
3424
3404
  DEFAULT_OVERLAY_FEE_RECEIVER: "0x0",
3425
3405
  // Error Messages
3426
3406
  ERRORS: {
@@ -3443,13 +3423,13 @@ var AGGREGATOR_V3_CONFIG = {
3443
3423
  // 10%
3444
3424
  MAX_AMOUNT_IN: U64_MAX,
3445
3425
  DEFAULT_PUBLISHED_AT: {
3446
- Mainnet: "0x07c27e879ba9282506284b0fef26d393978906fc9496550d978c6f493dbfa3e5",
3426
+ Mainnet: "0x33ec64e9bb369bf045ddc198c81adbf2acab424da37465d95296ee02045d2b17",
3447
3427
  Testnet: "0x0"
3448
3428
  }
3449
3429
  };
3450
3430
 
3451
3431
  // src/api.ts
3452
- var SDK_VERSION = 1010104;
3432
+ var SDK_VERSION = 1010106;
3453
3433
  function parseRouterResponse(data, byAmountIn) {
3454
3434
  let packages = /* @__PURE__ */ new Map();
3455
3435
  if (data.packages) {
@@ -3612,7 +3592,6 @@ function getRouter(endpoint, apiKey, params) {
3612
3592
  url += `&apiKey=${apiKey}`;
3613
3593
  }
3614
3594
  url += `&v=${SDK_VERSION}`;
3615
- console.log("url", url);
3616
3595
  const response = yield fetch(url);
3617
3596
  return response;
3618
3597
  } catch (error) {
@@ -3703,7 +3682,6 @@ function processFlattenRoutes(routerData) {
3703
3682
  flattenedPaths[i].isLastUseOfIntermediateToken = true;
3704
3683
  }
3705
3684
  }
3706
- console.log("flattenedPaths", flattenedPaths);
3707
3685
  return {
3708
3686
  quoteID: routerData.quoteID || "",
3709
3687
  amountIn: routerData.amountIn,
@@ -4022,18 +4000,17 @@ P.hyperbolicTangent = P.tanh = function() {
4022
4000
  return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
4023
4001
  };
4024
4002
  P.inverseCosine = P.acos = function() {
4025
- 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;
4026
4004
  if (k !== -1) {
4027
4005
  return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
4028
4006
  }
4029
4007
  if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
4030
4008
  Ctor.precision = pr + 6;
4031
4009
  Ctor.rounding = 1;
4032
- x = x.asin();
4033
- halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
4010
+ x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
4034
4011
  Ctor.precision = pr;
4035
4012
  Ctor.rounding = rm;
4036
- return halfPi.minus(x);
4013
+ return x.times(2);
4037
4014
  };
4038
4015
  P.inverseHyperbolicCosine = P.acosh = function() {
4039
4016
  var pr, rm, x = this, Ctor = x.constructor;
@@ -4805,7 +4782,7 @@ function cosine(Ctor, x) {
4805
4782
  Ctor.precision -= k;
4806
4783
  return x;
4807
4784
  }
4808
- var divide = /* @__PURE__ */ function() {
4785
+ var divide = /* @__PURE__ */ (function() {
4809
4786
  function multiplyInteger(x, k, base) {
4810
4787
  var temp, carry = 0, i = x.length;
4811
4788
  for (x = x.slice(); i--; ) {
@@ -4963,7 +4940,7 @@ var divide = /* @__PURE__ */ function() {
4963
4940
  }
4964
4941
  return q;
4965
4942
  };
4966
- }();
4943
+ })();
4967
4944
  function finalise(x, sd, rm, isTruncated) {
4968
4945
  var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor;
4969
4946
  out: if (sd != null) {
@@ -5131,14 +5108,16 @@ function intPow(Ctor, x, n, pr) {
5131
5108
  function isOdd(n) {
5132
5109
  return n.d[n.d.length - 1] & 1;
5133
5110
  }
5134
- function maxOrMin(Ctor, args, ltgt) {
5135
- 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;
5136
5113
  for (; ++i < args.length; ) {
5137
5114
  y = new Ctor(args[i]);
5138
5115
  if (!y.s) {
5139
5116
  x = y;
5140
5117
  break;
5141
- } else if (x[ltgt](y)) {
5118
+ }
5119
+ k = x.cmp(y);
5120
+ if (k === n || k === 0 && x.s === n) {
5142
5121
  x = y;
5143
5122
  }
5144
5123
  }
@@ -5681,24 +5660,35 @@ function clone(obj) {
5681
5660
  x.d = [v];
5682
5661
  }
5683
5662
  return;
5684
- } else if (v * 0 !== 0) {
5663
+ }
5664
+ if (v * 0 !== 0) {
5685
5665
  if (!v) x.s = NaN;
5686
5666
  x.e = NaN;
5687
5667
  x.d = null;
5688
5668
  return;
5689
5669
  }
5690
5670
  return parseDecimal(x, v.toString());
5691
- } else if (t !== "string") {
5692
- throw Error(invalidArgument + v);
5693
5671
  }
5694
- if ((i2 = v.charCodeAt(0)) === 45) {
5695
- v = v.slice(1);
5696
- x.s = -1;
5697
- } else {
5698
- if (i2 === 43) v = v.slice(1);
5699
- 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);
5681
+ }
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());
5700
5690
  }
5701
- return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
5691
+ throw Error(invalidArgument + v);
5702
5692
  }
5703
5693
  Decimal2.prototype = P;
5704
5694
  Decimal2.ROUND_UP = 0;
@@ -5805,10 +5795,10 @@ function log10(x) {
5805
5795
  return new this(x).log(10);
5806
5796
  }
5807
5797
  function max() {
5808
- return maxOrMin(this, arguments, "lt");
5798
+ return maxOrMin(this, arguments, -1);
5809
5799
  }
5810
5800
  function min() {
5811
- return maxOrMin(this, arguments, "gt");
5801
+ return maxOrMin(this, arguments, 1);
5812
5802
  }
5813
5803
  function mod(x, y) {
5814
5804
  return new this(x).mod(y);
@@ -6719,7 +6709,7 @@ var SpringsuiRouter = class {
6719
6709
  const args = [
6720
6710
  swapContext,
6721
6711
  txb.object(swapData.poolId),
6722
- txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
6712
+ txb.object("0x5"),
6723
6713
  txb.pure.u64(swapData.amountIn),
6724
6714
  txb.pure.bool(swapData.direction)
6725
6715
  ];
@@ -7401,7 +7391,8 @@ var VoloRouter = class {
7401
7391
  swapContext,
7402
7392
  txb.object(this.stakePool),
7403
7393
  txb.object(this.metadata),
7404
- txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
7394
+ txb.object("0x5"),
7395
+ // SuiSystemState
7405
7396
  txb.pure.bool(swapData.direction),
7406
7397
  txb.pure.u64(swapData.amountIn)
7407
7398
  ];
@@ -7452,7 +7443,8 @@ var AfsuiRouter = class {
7452
7443
  swapContext,
7453
7444
  txb.object(this.stakedSuiVault),
7454
7445
  txb.object(this.safe),
7455
- txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
7446
+ txb.object("0x5"),
7447
+ // SuiSystemState
7456
7448
  txb.object(this.referVault),
7457
7449
  txb.object(this.validator),
7458
7450
  txb.pure.bool(swapData.direction),
@@ -7497,7 +7489,8 @@ var HaedalRouter = class {
7497
7489
  const args = [
7498
7490
  swapContext,
7499
7491
  txb.object(swapData.poolId),
7500
- txb.object(SUI_SYSTEM_STATE_OBJECT_ID),
7492
+ txb.object("0x5"),
7493
+ // SuiSystemState
7501
7494
  txb.pure.bool(swapData.direction),
7502
7495
  txb.pure.u64(swapData.amountIn)
7503
7496
  ];
@@ -8256,7 +8249,7 @@ var _AggregatorClient = class _AggregatorClient {
8256
8249
  this.apiKey = params.apiKey || "";
8257
8250
  this.partner = params.partner;
8258
8251
  if (params.overlayFeeRate) {
8259
- if (params.overlayFeeRate > 0 && params.overlayFeeRate <= CLIENT_CONFIG.MAX_OVERLAY_FEE_RATE_PARAMS) {
8252
+ if (params.overlayFeeRate > 0 && params.overlayFeeRate <= CLIENT_CONFIG.MAX_OVERLAY_FEE_RATE) {
8260
8253
  this.overlayFeeRate = params.overlayFeeRate * AGGREGATOR_V3_CONFIG.FEE_DENOMINATOR;
8261
8254
  if (this.overlayFeeRate > AGGREGATOR_V3_CONFIG.MAX_FEE_RATE) {
8262
8255
  throw new Error(
@@ -8897,7 +8890,7 @@ function recordFirstCoinIndex(paths) {
8897
8890
  return newCoinRecord;
8898
8891
  }
8899
8892
  function checkOverlayFeeConfig(overlayFeeRate, overlayFeeReceiver) {
8900
- if (overlayFeeRate > CLIENT_CONFIG.MAX_FEE_RATE) {
8893
+ if (overlayFeeRate > CLIENT_CONFIG.MAX_OVERLAY_FEE_RATE_NUMERATOR) {
8901
8894
  throw new Error(CLIENT_CONFIG.ERRORS.INVALID_OVERLAY_FEE_RATE);
8902
8895
  }
8903
8896
  if (overlayFeeReceiver === "0x0" && overlayFeeRate > 0) {
@@ -8918,16 +8911,19 @@ var getDefaultSuiInputType = (value) => {
8918
8911
  if (typeof value === "boolean") {
8919
8912
  return "bool";
8920
8913
  }
8921
- throw new AggregateError(`Unknown type for value: ${value}`, "InvalidType" /* InvalidType */);
8914
+ throw new AggregatorError(
8915
+ `Unknown type for value: ${value}`,
8916
+ "InvalidType" /* InvalidType */
8917
+ );
8922
8918
  };
8923
8919
  /*! Bundled license information:
8924
8920
 
8925
8921
  decimal.js/decimal.mjs:
8926
8922
  (*!
8927
- * decimal.js v10.4.3
8923
+ * decimal.js v10.6.0
8928
8924
  * An arbitrary-precision Decimal type for JavaScript.
8929
8925
  * https://github.com/MikeMcl/decimal.js
8930
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
8926
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
8931
8927
  * MIT Licence
8932
8928
  *)
8933
8929
  */