@pancakeswap/v3-sdk 1.0.0 → 2.0.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.
Files changed (86) hide show
  1. package/LICENSE +674 -0
  2. package/dist/constants.d.ts +26 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/entities/index.d.ts +8 -0
  5. package/dist/entities/index.d.ts.map +1 -0
  6. package/dist/entities/pool.d.ts +82 -0
  7. package/dist/entities/pool.d.ts.map +1 -0
  8. package/dist/entities/position.d.ts +131 -0
  9. package/dist/entities/position.d.ts.map +1 -0
  10. package/dist/entities/route.d.ts +27 -0
  11. package/dist/entities/route.d.ts.map +1 -0
  12. package/dist/entities/tick.d.ts +13 -0
  13. package/dist/entities/tick.d.ts.map +1 -0
  14. package/dist/entities/tickDataProvider.d.ts +32 -0
  15. package/dist/entities/tickDataProvider.d.ts.map +1 -0
  16. package/dist/entities/tickListDataProvider.d.ts +16 -0
  17. package/dist/entities/tickListDataProvider.d.ts.map +1 -0
  18. package/dist/entities/trade.d.ts +221 -0
  19. package/dist/entities/trade.d.ts.map +1 -0
  20. package/dist/index.d.ts +12 -1223
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +214 -227
  23. package/dist/index.mjs +214 -229
  24. package/dist/internalConstants.d.ts +11 -0
  25. package/dist/internalConstants.d.ts.map +1 -0
  26. package/dist/masterchefV3.d.ts +39 -0
  27. package/dist/masterchefV3.d.ts.map +1 -0
  28. package/dist/multicall.d.ts +10 -0
  29. package/dist/multicall.d.ts.map +1 -0
  30. package/dist/nonfungiblePositionManager.d.ts +149 -0
  31. package/dist/nonfungiblePositionManager.d.ts.map +1 -0
  32. package/dist/payments.d.ts +24 -0
  33. package/dist/payments.d.ts.map +1 -0
  34. package/dist/quoter.d.ts +38 -0
  35. package/dist/quoter.d.ts.map +1 -0
  36. package/dist/selfPermit.d.ts +26 -0
  37. package/dist/selfPermit.d.ts.map +1 -0
  38. package/dist/staker.d.ts +102 -0
  39. package/dist/staker.d.ts.map +1 -0
  40. package/dist/swapRouter.d.ts +52 -0
  41. package/dist/swapRouter.d.ts.map +1 -0
  42. package/dist/utils/calldata.d.ts +21 -0
  43. package/dist/utils/calldata.d.ts.map +1 -0
  44. package/dist/utils/computePoolAddress.d.ts +19 -0
  45. package/dist/utils/computePoolAddress.d.ts.map +1 -0
  46. package/dist/utils/encodeRouteToPath.d.ts +9 -0
  47. package/dist/utils/encodeRouteToPath.d.ts.map +1 -0
  48. package/dist/utils/encodeSqrtRatioX96.d.ts +9 -0
  49. package/dist/utils/encodeSqrtRatioX96.d.ts.map +1 -0
  50. package/dist/utils/feeCalculator.d.ts +65 -0
  51. package/dist/utils/feeCalculator.d.ts.map +1 -0
  52. package/dist/utils/fullMath.d.ts +8 -0
  53. package/dist/utils/fullMath.d.ts.map +1 -0
  54. package/dist/utils/index.d.ts +22 -0
  55. package/dist/utils/index.d.ts.map +1 -0
  56. package/dist/utils/isSorted.d.ts +8 -0
  57. package/dist/utils/isSorted.d.ts.map +1 -0
  58. package/dist/utils/liquidityMath.d.ts +8 -0
  59. package/dist/utils/liquidityMath.d.ts.map +1 -0
  60. package/dist/utils/maxLiquidityForAmounts.d.ts +14 -0
  61. package/dist/utils/maxLiquidityForAmounts.d.ts.map +1 -0
  62. package/dist/utils/mostSignificantBit.d.ts +2 -0
  63. package/dist/utils/mostSignificantBit.d.ts.map +1 -0
  64. package/dist/utils/nearestUsableTick.d.ts +7 -0
  65. package/dist/utils/nearestUsableTick.d.ts.map +1 -0
  66. package/dist/utils/parseProtocolFees.d.ts +3 -0
  67. package/dist/utils/parseProtocolFees.d.ts.map +1 -0
  68. package/dist/utils/position.d.ts +8 -0
  69. package/dist/utils/position.d.ts.map +1 -0
  70. package/dist/utils/positionMath.d.ts +8 -0
  71. package/dist/utils/positionMath.d.ts.map +1 -0
  72. package/dist/utils/priceTickConversions.d.ts +16 -0
  73. package/dist/utils/priceTickConversions.d.ts.map +1 -0
  74. package/dist/utils/sqrtPriceMath.d.ts +13 -0
  75. package/dist/utils/sqrtPriceMath.d.ts.map +1 -0
  76. package/dist/utils/sqrtRatioX96ToPrice.d.ts +3 -0
  77. package/dist/utils/sqrtRatioX96ToPrice.d.ts.map +1 -0
  78. package/dist/utils/swapMath.d.ts +9 -0
  79. package/dist/utils/swapMath.d.ts.map +1 -0
  80. package/dist/utils/tickLibrary.d.ts +14 -0
  81. package/dist/utils/tickLibrary.d.ts.map +1 -0
  82. package/dist/utils/tickList.d.ts +25 -0
  83. package/dist/utils/tickList.d.ts.map +1 -0
  84. package/dist/utils/tickMath.d.ts +34 -0
  85. package/dist/utils/tickMath.d.ts.map +1 -0
  86. package/package.json +17 -14
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
- import { ChainId, JSBI as JSBI$1, MaxUint256, sqrt, Price, Fraction, ZERO as ZERO$1, CurrencyAmount, Percent as Percent$1, TradeType, sortedInsert, validateAndParseAddress, ONE as ONE$1 } from '@pancakeswap/sdk';
2
- import JSBI4 from 'jsbi';
1
+ import { ChainId, MaxUint256, sqrt, Price, CurrencyAmount, Fraction, ZERO as ZERO$1, Percent as Percent$1, TradeType, sortedInsert, validateAndParseAddress, ONE as ONE$1 } from '@pancakeswap/sdk';
3
2
  import invariant11 from 'tiny-invariant';
4
- import { JSBI, Percent, Price as Price$1, Fraction as Fraction$1 } from '@pancakeswap/swap-sdk-core';
3
+ import { Percent, Price as Price$1, Fraction as Fraction$1 } from '@pancakeswap/swap-sdk-core';
5
4
  import { Interface, defaultAbiCoder } from '@ethersproject/abi';
6
5
  import { getCreate2Address } from '@ethersproject/address';
7
6
  import { keccak256, pack } from '@ethersproject/solidity';
@@ -30,15 +29,15 @@ var TICK_SPACINGS = {
30
29
  [2500 /* MEDIUM */]: 50,
31
30
  [1e4 /* HIGH */]: 200
32
31
  };
33
- var NEGATIVE_ONE = JSBI.BigInt(-1);
34
- var ZERO = JSBI.BigInt(0);
35
- var ONE = JSBI.BigInt(1);
36
- var Q96 = JSBI.exponentiate(JSBI.BigInt(2), JSBI.BigInt(96));
37
- var Q192 = JSBI.exponentiate(Q96, JSBI.BigInt(2));
38
- var MAX_FEE = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(6));
32
+ var NEGATIVE_ONE = BigInt(-1);
33
+ var ZERO = 0n;
34
+ var ONE = 1n;
35
+ var Q96 = 2n ** 96n;
36
+ var Q192 = Q96 ** 2n;
37
+ var MAX_FEE = 10n ** 6n;
39
38
  var ONE_HUNDRED_PERCENT = new Percent("1");
40
39
  var ZERO_PERCENT = new Percent("0");
41
- var Q128 = JSBI.exponentiate(JSBI.BigInt(2), JSBI.BigInt(128));
40
+ var Q128 = 2n ** 128n;
42
41
  function computePoolAddress({
43
42
  deployerAddress,
44
43
  tokenA,
@@ -53,9 +52,11 @@ function computePoolAddress({
53
52
  ["bytes"],
54
53
  [defaultAbiCoder.encode(["address", "address", "uint24"], [token0.address, token1.address, fee])]
55
54
  ),
56
- initCodeHashManualOverride != null ? initCodeHashManualOverride : POOL_INIT_CODE_HASH
55
+ initCodeHashManualOverride ?? POOL_INIT_CODE_HASH
57
56
  );
58
57
  }
58
+
59
+ // src/utils/liquidityMath.ts
59
60
  var LiquidityMath = class {
60
61
  /**
61
62
  * Cannot be constructed.
@@ -63,12 +64,14 @@ var LiquidityMath = class {
63
64
  constructor() {
64
65
  }
65
66
  static addDelta(x, y) {
66
- if (JSBI4.lessThan(y, ZERO)) {
67
- return JSBI4.subtract(x, JSBI4.multiply(y, NEGATIVE_ONE));
67
+ if (y < ZERO) {
68
+ return x - y * NEGATIVE_ONE;
68
69
  }
69
- return JSBI4.add(x, y);
70
+ return x + y;
70
71
  }
71
72
  };
73
+
74
+ // src/utils/fullMath.ts
72
75
  var FullMath = class {
73
76
  /**
74
77
  * Cannot be constructed.
@@ -76,21 +79,21 @@ var FullMath = class {
76
79
  constructor() {
77
80
  }
78
81
  static mulDivRoundingUp(a, b, denominator) {
79
- const product = JSBI4.multiply(a, b);
80
- let result = JSBI4.divide(product, denominator);
81
- if (JSBI4.notEqual(JSBI4.remainder(product, denominator), ZERO))
82
- result = JSBI4.add(result, ONE);
82
+ const product = a * b;
83
+ let result = product / denominator;
84
+ if (product % denominator !== ZERO)
85
+ result = result + ONE;
83
86
  return result;
84
87
  }
85
88
  };
86
- var MaxUint160 = JSBI4.subtract(JSBI4.exponentiate(JSBI4.BigInt(2), JSBI4.BigInt(160)), ONE);
89
+ var MaxUint160 = 2n ** 160n - ONE;
87
90
  function multiplyIn256(x, y) {
88
- const product = JSBI4.multiply(x, y);
89
- return JSBI4.bitwiseAnd(product, MaxUint256);
91
+ const product = x * y;
92
+ return product & MaxUint256;
90
93
  }
91
94
  function addIn256(x, y) {
92
- const sum = JSBI4.add(x, y);
93
- return JSBI4.bitwiseAnd(sum, MaxUint256);
95
+ const sum = x + y;
96
+ return sum & MaxUint256;
94
97
  }
95
98
  var SqrtPriceMath = class {
96
99
  /**
@@ -99,59 +102,59 @@ var SqrtPriceMath = class {
99
102
  constructor() {
100
103
  }
101
104
  static getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, liquidity, roundUp) {
102
- if (JSBI4.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) {
105
+ if (sqrtRatioAX96 > sqrtRatioBX96) {
103
106
  sqrtRatioAX96 = sqrtRatioBX96;
104
107
  sqrtRatioBX96 = sqrtRatioAX96;
105
108
  }
106
- const numerator1 = JSBI4.leftShift(liquidity, JSBI4.BigInt(96));
107
- const numerator2 = JSBI4.subtract(sqrtRatioBX96, sqrtRatioAX96);
108
- return roundUp ? FullMath.mulDivRoundingUp(FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), ONE, sqrtRatioAX96) : JSBI4.divide(JSBI4.divide(JSBI4.multiply(numerator1, numerator2), sqrtRatioBX96), sqrtRatioAX96);
109
+ const numerator1 = liquidity << 96n;
110
+ const numerator2 = sqrtRatioBX96 - sqrtRatioAX96;
111
+ return roundUp ? FullMath.mulDivRoundingUp(FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), ONE, sqrtRatioAX96) : numerator1 * numerator2 / sqrtRatioBX96 / sqrtRatioAX96;
109
112
  }
110
113
  static getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, liquidity, roundUp) {
111
- if (JSBI4.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) {
114
+ if (sqrtRatioAX96 > sqrtRatioBX96) {
112
115
  sqrtRatioAX96 = sqrtRatioBX96;
113
116
  sqrtRatioBX96 = sqrtRatioAX96;
114
117
  }
115
- return roundUp ? FullMath.mulDivRoundingUp(liquidity, JSBI4.subtract(sqrtRatioBX96, sqrtRatioAX96), Q96) : JSBI4.divide(JSBI4.multiply(liquidity, JSBI4.subtract(sqrtRatioBX96, sqrtRatioAX96)), Q96);
118
+ return roundUp ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, Q96) : liquidity * (sqrtRatioBX96 - sqrtRatioAX96) / Q96;
116
119
  }
117
120
  static getNextSqrtPriceFromInput(sqrtPX96, liquidity, amountIn, zeroForOne) {
118
- invariant11(JSBI4.greaterThan(sqrtPX96, ZERO));
119
- invariant11(JSBI4.greaterThan(liquidity, ZERO));
121
+ invariant11(sqrtPX96 > ZERO);
122
+ invariant11(liquidity > ZERO);
120
123
  return zeroForOne ? this.getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true) : this.getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);
121
124
  }
122
125
  static getNextSqrtPriceFromOutput(sqrtPX96, liquidity, amountOut, zeroForOne) {
123
- invariant11(JSBI4.greaterThan(sqrtPX96, ZERO));
124
- invariant11(JSBI4.greaterThan(liquidity, ZERO));
126
+ invariant11(sqrtPX96 > ZERO);
127
+ invariant11(liquidity > ZERO);
125
128
  return zeroForOne ? this.getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false) : this.getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);
126
129
  }
127
130
  static getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amount, add) {
128
- if (JSBI4.equal(amount, ZERO))
131
+ if (amount === ZERO)
129
132
  return sqrtPX96;
130
- const numerator1 = JSBI4.leftShift(liquidity, JSBI4.BigInt(96));
133
+ const numerator1 = liquidity << 96n;
131
134
  if (add) {
132
135
  const product2 = multiplyIn256(amount, sqrtPX96);
133
- if (JSBI4.equal(JSBI4.divide(product2, amount), sqrtPX96)) {
136
+ if (product2 / amount === sqrtPX96) {
134
137
  const denominator2 = addIn256(numerator1, product2);
135
- if (JSBI4.greaterThanOrEqual(denominator2, numerator1)) {
138
+ if (denominator2 >= numerator1) {
136
139
  return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator2);
137
140
  }
138
141
  }
139
- return FullMath.mulDivRoundingUp(numerator1, ONE, JSBI4.add(JSBI4.divide(numerator1, sqrtPX96), amount));
142
+ return FullMath.mulDivRoundingUp(numerator1, ONE, numerator1 / sqrtPX96 + amount);
140
143
  }
141
144
  const product = multiplyIn256(amount, sqrtPX96);
142
- invariant11(JSBI4.equal(JSBI4.divide(product, amount), sqrtPX96));
143
- invariant11(JSBI4.greaterThan(numerator1, product));
144
- const denominator = JSBI4.subtract(numerator1, product);
145
+ invariant11(product / amount === sqrtPX96);
146
+ invariant11(numerator1 > product);
147
+ const denominator = numerator1 - product;
145
148
  return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator);
146
149
  }
147
150
  static getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amount, add) {
148
151
  if (add) {
149
- const quotient2 = JSBI4.lessThanOrEqual(amount, MaxUint160) ? JSBI4.divide(JSBI4.leftShift(amount, JSBI4.BigInt(96)), liquidity) : JSBI4.divide(JSBI4.multiply(amount, Q96), liquidity);
150
- return JSBI4.add(sqrtPX96, quotient2);
152
+ const quotient2 = amount <= MaxUint160 ? (amount << 96n) / liquidity : amount * Q96 / liquidity;
153
+ return sqrtPX96 + quotient2;
151
154
  }
152
155
  const quotient = FullMath.mulDivRoundingUp(amount, Q96, liquidity);
153
- invariant11(JSBI4.greaterThan(sqrtPX96, quotient));
154
- return JSBI4.subtract(sqrtPX96, quotient);
156
+ invariant11(sqrtPX96 > quotient);
157
+ return sqrtPX96 - quotient;
155
158
  }
156
159
  };
157
160
 
@@ -164,15 +167,12 @@ var SwapMath = class {
164
167
  }
165
168
  static computeSwapStep(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, amountRemaining, feePips) {
166
169
  const returnValues = {};
167
- const zeroForOne = JSBI4.greaterThanOrEqual(sqrtRatioCurrentX96, sqrtRatioTargetX96);
168
- const exactIn = JSBI4.greaterThanOrEqual(amountRemaining, ZERO);
170
+ const zeroForOne = sqrtRatioCurrentX96 >= sqrtRatioTargetX96;
171
+ const exactIn = amountRemaining >= ZERO;
169
172
  if (exactIn) {
170
- const amountRemainingLessFee = JSBI4.divide(
171
- JSBI4.multiply(amountRemaining, JSBI4.subtract(MAX_FEE, JSBI4.BigInt(feePips))),
172
- MAX_FEE
173
- );
173
+ const amountRemainingLessFee = amountRemaining * (MAX_FEE - BigInt(feePips)) / MAX_FEE;
174
174
  returnValues.amountIn = zeroForOne ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true) : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);
175
- if (JSBI4.greaterThanOrEqual(amountRemainingLessFee, returnValues.amountIn)) {
175
+ if (amountRemainingLessFee >= returnValues.amountIn) {
176
176
  returnValues.sqrtRatioNextX96 = sqrtRatioTargetX96;
177
177
  } else {
178
178
  returnValues.sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(
@@ -184,18 +184,18 @@ var SwapMath = class {
184
184
  }
185
185
  } else {
186
186
  returnValues.amountOut = zeroForOne ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false) : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);
187
- if (JSBI4.greaterThanOrEqual(JSBI4.multiply(amountRemaining, NEGATIVE_ONE), returnValues.amountOut)) {
187
+ if (amountRemaining * NEGATIVE_ONE >= returnValues.amountOut) {
188
188
  returnValues.sqrtRatioNextX96 = sqrtRatioTargetX96;
189
189
  } else {
190
190
  returnValues.sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(
191
191
  sqrtRatioCurrentX96,
192
192
  liquidity,
193
- JSBI4.multiply(amountRemaining, NEGATIVE_ONE),
193
+ amountRemaining * NEGATIVE_ONE,
194
194
  zeroForOne
195
195
  );
196
196
  }
197
197
  }
198
- const max = JSBI4.equal(sqrtRatioTargetX96, returnValues.sqrtRatioNextX96);
198
+ const max = sqrtRatioTargetX96 === returnValues.sqrtRatioNextX96;
199
199
  if (zeroForOne) {
200
200
  returnValues.amountIn = max && exactIn ? returnValues.amountIn : SqrtPriceMath.getAmount0Delta(returnValues.sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);
201
201
  returnValues.amountOut = max && !exactIn ? returnValues.amountOut : SqrtPriceMath.getAmount1Delta(returnValues.sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);
@@ -203,33 +203,30 @@ var SwapMath = class {
203
203
  returnValues.amountIn = max && exactIn ? returnValues.amountIn : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, returnValues.sqrtRatioNextX96, liquidity, true);
204
204
  returnValues.amountOut = max && !exactIn ? returnValues.amountOut : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, returnValues.sqrtRatioNextX96, liquidity, false);
205
205
  }
206
- if (!exactIn && JSBI4.greaterThan(returnValues.amountOut, JSBI4.multiply(amountRemaining, NEGATIVE_ONE))) {
207
- returnValues.amountOut = JSBI4.multiply(amountRemaining, NEGATIVE_ONE);
206
+ if (!exactIn && returnValues.amountOut > amountRemaining * NEGATIVE_ONE) {
207
+ returnValues.amountOut = amountRemaining * NEGATIVE_ONE;
208
208
  }
209
- if (exactIn && JSBI4.notEqual(returnValues.sqrtRatioNextX96, sqrtRatioTargetX96)) {
210
- returnValues.feeAmount = JSBI4.subtract(amountRemaining, returnValues.amountIn);
209
+ if (exactIn && returnValues.sqrtRatioNextX96 !== sqrtRatioTargetX96) {
210
+ returnValues.feeAmount = amountRemaining - returnValues.amountIn;
211
211
  } else {
212
212
  returnValues.feeAmount = FullMath.mulDivRoundingUp(
213
213
  returnValues.amountIn,
214
- JSBI4.BigInt(feePips),
215
- JSBI4.subtract(MAX_FEE, JSBI4.BigInt(feePips))
214
+ BigInt(feePips),
215
+ MAX_FEE - BigInt(feePips)
216
216
  );
217
217
  }
218
218
  return [returnValues.sqrtRatioNextX96, returnValues.amountIn, returnValues.amountOut, returnValues.feeAmount];
219
219
  }
220
220
  };
221
- var TWO = JSBI4.BigInt(2);
222
- var POWERS_OF_2 = [128, 64, 32, 16, 8, 4, 2, 1].map((pow) => [
223
- pow,
224
- JSBI4.exponentiate(TWO, JSBI4.BigInt(pow))
225
- ]);
221
+ var TWO = 2n;
222
+ var POWERS_OF_2 = [128, 64, 32, 16, 8, 4, 2, 1].map((pow) => [pow, TWO ** BigInt(pow)]);
226
223
  function mostSignificantBit(x) {
227
- invariant11(JSBI4.greaterThan(x, ZERO), "ZERO");
228
- invariant11(JSBI4.lessThanOrEqual(x, MaxUint256), "MAX");
224
+ invariant11(x > ZERO, "ZERO");
225
+ invariant11(x <= MaxUint256, "MAX");
229
226
  let msb = 0;
230
227
  for (const [power, min] of POWERS_OF_2) {
231
- if (JSBI4.greaterThanOrEqual(x, min)) {
232
- x = JSBI4.signedRightShift(x, JSBI4.BigInt(power));
228
+ if (x >= min) {
229
+ x = x >> BigInt(power);
233
230
  msb += power;
234
231
  }
235
232
  }
@@ -238,9 +235,9 @@ function mostSignificantBit(x) {
238
235
 
239
236
  // src/utils/tickMath.ts
240
237
  function mulShift(val, mulBy) {
241
- return JSBI$1.signedRightShift(JSBI$1.multiply(val, JSBI$1.BigInt(mulBy)), JSBI$1.BigInt(128));
238
+ return val * BigInt(mulBy) >> 128n;
242
239
  }
243
- var Q32 = JSBI$1.exponentiate(JSBI$1.BigInt(2), JSBI$1.BigInt(32));
240
+ var Q32 = 2n ** 32n;
244
241
  var _TickMath = class {
245
242
  /**
246
243
  * Cannot be constructed.
@@ -254,7 +251,7 @@ var _TickMath = class {
254
251
  static getSqrtRatioAtTick(tick) {
255
252
  invariant11(tick >= _TickMath.MIN_TICK && tick <= _TickMath.MAX_TICK && Number.isInteger(tick), "TICK");
256
253
  const absTick = tick < 0 ? tick * -1 : tick;
257
- let ratio = (absTick & 1) != 0 ? JSBI$1.BigInt("0xfffcb933bd6fad37aa2d162d1a594001") : JSBI$1.BigInt("0x100000000000000000000000000000000");
254
+ let ratio = (absTick & 1) != 0 ? BigInt("0xfffcb933bd6fad37aa2d162d1a594001") : BigInt("0x100000000000000000000000000000000");
258
255
  if ((absTick & 2) != 0)
259
256
  ratio = mulShift(ratio, "0xfff97272373d413259a46990580e213a");
260
257
  if ((absTick & 4) != 0)
@@ -294,8 +291,8 @@ var _TickMath = class {
294
291
  if ((absTick & 524288) != 0)
295
292
  ratio = mulShift(ratio, "0x48a170391f7dc42444e8fa2");
296
293
  if (tick > 0)
297
- ratio = JSBI$1.divide(MaxUint256, ratio);
298
- return JSBI$1.greaterThan(JSBI$1.remainder(ratio, Q32), ZERO) ? JSBI$1.add(JSBI$1.divide(ratio, Q32), ONE) : JSBI$1.divide(ratio, Q32);
294
+ ratio = MaxUint256 / ratio;
295
+ return ratio % Q32 > ZERO ? ratio / Q32 + ONE : ratio / Q32;
299
296
  }
300
297
  /**
301
298
  * Returns the tick corresponding to a given sqrt ratio, s.t. #getSqrtRatioAtTick(tick) <= sqrtRatioX96
@@ -303,39 +300,26 @@ var _TickMath = class {
303
300
  * @param sqrtRatioX96 the sqrt ratio as a Q64.96 for which to compute the tick
304
301
  */
305
302
  static getTickAtSqrtRatio(sqrtRatioX96) {
306
- invariant11(
307
- JSBI$1.greaterThanOrEqual(sqrtRatioX96, _TickMath.MIN_SQRT_RATIO) && JSBI$1.lessThan(sqrtRatioX96, _TickMath.MAX_SQRT_RATIO),
308
- "SQRT_RATIO"
309
- );
310
- const sqrtRatioX128 = JSBI$1.leftShift(sqrtRatioX96, JSBI$1.BigInt(32));
303
+ invariant11(sqrtRatioX96 >= _TickMath.MIN_SQRT_RATIO && sqrtRatioX96 < _TickMath.MAX_SQRT_RATIO, "SQRT_RATIO");
304
+ const sqrtRatioX128 = sqrtRatioX96 << 32n;
311
305
  const msb = mostSignificantBit(sqrtRatioX128);
312
306
  let r;
313
- if (JSBI$1.greaterThanOrEqual(JSBI$1.BigInt(msb), JSBI$1.BigInt(128))) {
314
- r = JSBI$1.signedRightShift(sqrtRatioX128, JSBI$1.BigInt(msb - 127));
307
+ if (BigInt(msb) >= 128n) {
308
+ r = sqrtRatioX128 >> BigInt(msb - 127);
315
309
  } else {
316
- r = JSBI$1.leftShift(sqrtRatioX128, JSBI$1.BigInt(127 - msb));
310
+ r = sqrtRatioX128 << BigInt(127 - msb);
317
311
  }
318
- let log_2 = JSBI$1.leftShift(JSBI$1.subtract(JSBI$1.BigInt(msb), JSBI$1.BigInt(128)), JSBI$1.BigInt(64));
312
+ let log_2 = BigInt(msb) - 128n << 64n;
319
313
  for (let i = 0; i < 14; i++) {
320
- r = JSBI$1.signedRightShift(JSBI$1.multiply(r, r), JSBI$1.BigInt(127));
321
- const f = JSBI$1.signedRightShift(r, JSBI$1.BigInt(128));
322
- log_2 = JSBI$1.bitwiseOr(log_2, JSBI$1.leftShift(f, JSBI$1.BigInt(63 - i)));
323
- r = JSBI$1.signedRightShift(r, f);
314
+ r = r * r >> 127n;
315
+ const f = r >> 128n;
316
+ log_2 = log_2 | f << BigInt(63 - i);
317
+ r = r >> f;
324
318
  }
325
- const log_sqrt10001 = JSBI$1.multiply(log_2, JSBI$1.BigInt("255738958999603826347141"));
326
- const tickLow = JSBI$1.toNumber(
327
- JSBI$1.signedRightShift(
328
- JSBI$1.subtract(log_sqrt10001, JSBI$1.BigInt("3402992956809132418596140100660247210")),
329
- JSBI$1.BigInt(128)
330
- )
331
- );
332
- const tickHigh = JSBI$1.toNumber(
333
- JSBI$1.signedRightShift(
334
- JSBI$1.add(log_sqrt10001, JSBI$1.BigInt("291339464771989622907027621153398088495")),
335
- JSBI$1.BigInt(128)
336
- )
337
- );
338
- return tickLow === tickHigh ? tickLow : JSBI$1.lessThanOrEqual(_TickMath.getSqrtRatioAtTick(tickHigh), sqrtRatioX96) ? tickHigh : tickLow;
319
+ const log_sqrt10001 = log_2 * 255738958999603826347141n;
320
+ const tickLow = Number(log_sqrt10001 - 3402992956809132418596140100660247210n >> 128n);
321
+ const tickHigh = Number(log_sqrt10001 + 291339464771989622907027621153398088495n >> 128n);
322
+ return tickLow === tickHigh ? tickLow : _TickMath.getSqrtRatioAtTick(tickHigh) <= sqrtRatioX96 ? tickHigh : tickLow;
339
323
  }
340
324
  };
341
325
  var TickMath = _TickMath;
@@ -351,11 +335,11 @@ TickMath.MAX_TICK = -_TickMath.MIN_TICK;
351
335
  /**
352
336
  * The sqrt ratio corresponding to the minimum tick that could be used on any pool.
353
337
  */
354
- TickMath.MIN_SQRT_RATIO = JSBI$1.BigInt("4295128739");
338
+ TickMath.MIN_SQRT_RATIO = 4295128739n;
355
339
  /**
356
340
  * The sqrt ratio corresponding to the maximum tick that could be used on any pool.
357
341
  */
358
- TickMath.MAX_SQRT_RATIO = JSBI$1.BigInt("1461446703485210103287273052203988822378723970342");
342
+ TickMath.MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342n;
359
343
 
360
344
  // src/entities/tickDataProvider.ts
361
345
  var _NoTickDataProvider = class {
@@ -395,13 +379,7 @@ var TickList = class {
395
379
  ticks.every(({ index }) => index % tickSpacing === 0),
396
380
  "TICK_SPACING"
397
381
  );
398
- invariant11(
399
- JSBI4.equal(
400
- ticks.reduce((accumulator, { liquidityNet }) => JSBI4.add(accumulator, liquidityNet), ZERO),
401
- ZERO
402
- ),
403
- "ZERO_NET"
404
- );
382
+ invariant11(ticks.reduce((accumulator, { liquidityNet }) => accumulator + liquidityNet, ZERO) === ZERO, "ZERO_NET");
405
383
  invariant11(isSorted(ticks, tickComparator), "SORTED");
406
384
  }
407
385
  static isBelowSmallest(ticks, tick) {
@@ -486,8 +464,10 @@ var TickList = class {
486
464
  return Math.abs(beforeIndex - afterIndex);
487
465
  }
488
466
  };
467
+
468
+ // src/utils/calldata.ts
489
469
  function toHex(bigintIsh) {
490
- const bigInt = JSBI4.BigInt(bigintIsh);
470
+ const bigInt = BigInt(bigintIsh);
491
471
  let hex = bigInt.toString(16);
492
472
  if (hex.length % 2 !== 0) {
493
473
  hex = `0${hex}`;
@@ -517,48 +497,50 @@ function encodeRouteToPath(route, exactOutput) {
517
497
  return exactOutput ? pack(types.reverse(), path.reverse()) : pack(types, path);
518
498
  }
519
499
  function encodeSqrtRatioX96(amount1, amount0) {
520
- const numerator = JSBI4.leftShift(JSBI4.BigInt(amount1), JSBI4.BigInt(192));
521
- const denominator = JSBI4.BigInt(amount0);
522
- const ratioX192 = JSBI4.divide(numerator, denominator);
500
+ const numerator = BigInt(amount1) << 192n;
501
+ const denominator = BigInt(amount0);
502
+ const ratioX192 = numerator / denominator;
523
503
  return sqrt(ratioX192);
524
504
  }
505
+
506
+ // src/utils/maxLiquidityForAmounts.ts
525
507
  function maxLiquidityForAmount0Imprecise(sqrtRatioAX96, sqrtRatioBX96, amount0) {
526
- if (JSBI4.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) {
508
+ if (sqrtRatioAX96 > sqrtRatioBX96) {
527
509
  sqrtRatioAX96 = sqrtRatioBX96;
528
510
  sqrtRatioBX96 = sqrtRatioAX96;
529
511
  }
530
- const intermediate = JSBI4.divide(JSBI4.multiply(sqrtRatioAX96, sqrtRatioBX96), Q96);
531
- return JSBI4.divide(JSBI4.multiply(JSBI4.BigInt(amount0), intermediate), JSBI4.subtract(sqrtRatioBX96, sqrtRatioAX96));
512
+ const intermediate = sqrtRatioAX96 * sqrtRatioBX96 / Q96;
513
+ return BigInt(amount0) * intermediate / (sqrtRatioBX96 - sqrtRatioAX96);
532
514
  }
533
515
  function maxLiquidityForAmount0Precise(sqrtRatioAX96, sqrtRatioBX96, amount0) {
534
- if (JSBI4.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) {
516
+ if (sqrtRatioAX96 > sqrtRatioBX96) {
535
517
  sqrtRatioAX96 = sqrtRatioBX96;
536
518
  sqrtRatioBX96 = sqrtRatioAX96;
537
519
  }
538
- const numerator = JSBI4.multiply(JSBI4.multiply(JSBI4.BigInt(amount0), sqrtRatioAX96), sqrtRatioBX96);
539
- const denominator = JSBI4.multiply(Q96, JSBI4.subtract(sqrtRatioBX96, sqrtRatioAX96));
540
- return JSBI4.divide(numerator, denominator);
520
+ const numerator = BigInt(amount0) * sqrtRatioAX96 * sqrtRatioBX96;
521
+ const denominator = Q96 * (sqrtRatioBX96 - sqrtRatioAX96);
522
+ return numerator / denominator;
541
523
  }
542
524
  function maxLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1) {
543
- if (JSBI4.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) {
525
+ if (sqrtRatioAX96 > sqrtRatioBX96) {
544
526
  sqrtRatioAX96 = sqrtRatioBX96;
545
527
  sqrtRatioBX96 = sqrtRatioAX96;
546
528
  }
547
- return JSBI4.divide(JSBI4.multiply(JSBI4.BigInt(amount1), Q96), JSBI4.subtract(sqrtRatioBX96, sqrtRatioAX96));
529
+ return BigInt(amount1) * Q96 / (sqrtRatioBX96 - sqrtRatioAX96);
548
530
  }
549
531
  function maxLiquidityForAmounts(sqrtRatioCurrentX96, sqrtRatioAX96, sqrtRatioBX96, amount0, amount1, useFullPrecision) {
550
- if (JSBI4.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) {
532
+ if (sqrtRatioAX96 > sqrtRatioBX96) {
551
533
  sqrtRatioAX96 = sqrtRatioBX96;
552
534
  sqrtRatioBX96 = sqrtRatioAX96;
553
535
  }
554
536
  const maxLiquidityForAmount0 = useFullPrecision ? maxLiquidityForAmount0Precise : maxLiquidityForAmount0Imprecise;
555
- if (JSBI4.lessThanOrEqual(sqrtRatioCurrentX96, sqrtRatioAX96)) {
537
+ if (sqrtRatioCurrentX96 <= sqrtRatioAX96) {
556
538
  return maxLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);
557
539
  }
558
- if (JSBI4.lessThan(sqrtRatioCurrentX96, sqrtRatioBX96)) {
540
+ if (sqrtRatioCurrentX96 < sqrtRatioBX96) {
559
541
  const liquidity0 = maxLiquidityForAmount0(sqrtRatioCurrentX96, sqrtRatioBX96, amount0);
560
542
  const liquidity1 = maxLiquidityForAmount1(sqrtRatioAX96, sqrtRatioCurrentX96, amount1);
561
- return JSBI4.lessThan(liquidity0, liquidity1) ? liquidity0 : liquidity1;
543
+ return liquidity0 < liquidity1 ? liquidity0 : liquidity1;
562
544
  }
563
545
  return maxLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);
564
546
  }
@@ -573,6 +555,8 @@ function nearestUsableTick(tick, tickSpacing) {
573
555
  return rounded - tickSpacing;
574
556
  return rounded;
575
557
  }
558
+
559
+ // src/utils/position.ts
576
560
  var PositionLibrary = class {
577
561
  /**
578
562
  * Cannot be constructed.
@@ -581,20 +565,14 @@ var PositionLibrary = class {
581
565
  }
582
566
  // replicates the portions of Position#update required to compute unaccounted fees
583
567
  static getTokensOwed(feeGrowthInside0LastX128, feeGrowthInside1LastX128, liquidity, feeGrowthInside0X128, feeGrowthInside1X128) {
584
- const tokensOwed0 = JSBI$1.divide(
585
- JSBI$1.multiply(subIn256(feeGrowthInside0X128, feeGrowthInside0LastX128), liquidity),
586
- Q128
587
- );
588
- const tokensOwed1 = JSBI$1.divide(
589
- JSBI$1.multiply(subIn256(feeGrowthInside1X128, feeGrowthInside1LastX128), liquidity),
590
- Q128
591
- );
568
+ const tokensOwed0 = subIn256(feeGrowthInside0X128, feeGrowthInside0LastX128) * liquidity / Q128;
569
+ const tokensOwed1 = subIn256(feeGrowthInside1X128, feeGrowthInside1LastX128) * liquidity / Q128;
592
570
  return [tokensOwed0, tokensOwed1];
593
571
  }
594
572
  };
595
573
  function tickToPrice(baseToken, quoteToken, tick) {
596
574
  const sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick);
597
- const ratioX192 = JSBI4.multiply(sqrtRatioX96, sqrtRatioX96);
575
+ const ratioX192 = sqrtRatioX96 * sqrtRatioX96;
598
576
  return baseToken.sortsBefore(quoteToken) ? new Price(baseToken, quoteToken, Q192, ratioX192) : new Price(baseToken, quoteToken, ratioX192, Q192);
599
577
  }
600
578
  function priceToClosestTick(price) {
@@ -611,11 +589,13 @@ function priceToClosestTick(price) {
611
589
  }
612
590
  return tick;
613
591
  }
614
- var Q256 = JSBI4.exponentiate(JSBI4.BigInt(2), JSBI4.BigInt(256));
592
+
593
+ // src/utils/tickLibrary.ts
594
+ var Q256 = 2n ** 256n;
615
595
  function subIn256(x, y) {
616
- const difference = JSBI4.subtract(x, y);
617
- if (JSBI4.lessThan(difference, ZERO)) {
618
- return JSBI4.add(Q256, difference);
596
+ const difference = x - y;
597
+ if (difference < ZERO) {
598
+ return Q256 + difference;
619
599
  }
620
600
  return difference;
621
601
  }
@@ -686,12 +666,13 @@ var PositionMath = {
686
666
  };
687
667
  function parseNumberToFraction(num, precision = 6) {
688
668
  const scalar = 10 ** precision;
689
- return new Fraction$1(JSBI.BigInt(Math.floor(num * scalar)), JSBI.BigInt(scalar));
669
+ return new Fraction$1(BigInt(Math.floor(num * scalar)), BigInt(scalar));
690
670
  }
691
671
 
692
672
  // src/utils/feeCalculator.ts
693
673
  var FeeCalculator = {
694
674
  getEstimatedLPFee,
675
+ getEstimatedLPFeeByAmounts,
695
676
  getLiquidityFromTick,
696
677
  getLiquidityFromSqrtRatioX96,
697
678
  getAverageLiquidity,
@@ -701,26 +682,40 @@ var FeeCalculator = {
701
682
  getAmountsByLiquidityAndPrice,
702
683
  getAmountsAtNewPrice
703
684
  };
704
- function getEstimatedLPFeeWithProtocolFee(options) {
685
+ function getEstimatedLPFeeWithProtocolFee({ amount, currency, ...rest }) {
686
+ return getEstimatedLPFeeByAmountsWithProtocolFee({
687
+ ...rest,
688
+ amountA: amount,
689
+ amountB: CurrencyAmount.fromRawAmount(currency, MaxUint256)
690
+ });
691
+ }
692
+ function getEstimatedLPFee({ amount, currency, ...rest }) {
693
+ return getEstimatedLPFeeByAmounts({
694
+ ...rest,
695
+ amountA: amount,
696
+ amountB: CurrencyAmount.fromRawAmount(currency, MaxUint256)
697
+ });
698
+ }
699
+ function getEstimatedLPFeeByAmountsWithProtocolFee(options) {
705
700
  try {
706
- return tryGetEstimatedLPFee(options);
701
+ return tryGetEstimatedLPFeeByAmounts(options);
707
702
  } catch (e) {
708
703
  console.error(e);
709
704
  return new Fraction(ZERO$1);
710
705
  }
711
706
  }
712
- function getEstimatedLPFee({ protocolFee = ZERO_PERCENT, ...rest }) {
707
+ function getEstimatedLPFeeByAmounts({ protocolFee = ZERO_PERCENT, ...rest }) {
713
708
  try {
714
- const fee = tryGetEstimatedLPFee(rest);
709
+ const fee = tryGetEstimatedLPFeeByAmounts(rest);
715
710
  return ONE_HUNDRED_PERCENT.subtract(protocolFee).multiply(fee).asFraction;
716
711
  } catch (e) {
717
712
  console.error(e);
718
713
  return new Fraction(ZERO$1);
719
714
  }
720
715
  }
721
- function tryGetEstimatedLPFee({
722
- amount,
723
- currency,
716
+ function tryGetEstimatedLPFeeByAmounts({
717
+ amountA,
718
+ amountB,
724
719
  volume24H,
725
720
  sqrtRatioX96,
726
721
  tickLower,
@@ -734,8 +729,14 @@ function tryGetEstimatedLPFee({
734
729
  if (tickCurrent < tickLower || tickCurrent > tickUpper) {
735
730
  return new Fraction(ZERO$1);
736
731
  }
737
- const liquidity = FeeCalculator.getLiquidityBySingleAmount({ amount, currency, tickUpper, tickLower, sqrtRatioX96 });
738
- return insidePercentage.multiply(parseNumberToFraction(volume24H).multiply(JSBI$1.BigInt(fee)).multiply(liquidity)).divide(JSBI$1.multiply(MAX_FEE, JSBI$1.add(liquidity, mostActiveLiquidity))).asFraction;
732
+ const liquidity = FeeCalculator.getLiquidityByAmountsAndPrice({
733
+ amountA,
734
+ amountB,
735
+ tickUpper,
736
+ tickLower,
737
+ sqrtRatioX96
738
+ });
739
+ return insidePercentage.multiply(parseNumberToFraction(volume24H).multiply(BigInt(fee)).multiply(liquidity)).divide(MAX_FEE * (liquidity + mostActiveLiquidity)).asFraction;
739
740
  }
740
741
  function getDependentAmount(options) {
741
742
  const { currency, amount, sqrtRatioX96, tickLower, tickUpper } = options;
@@ -802,42 +803,41 @@ function getAverageLiquidity(ticks, tickSpacing, tickLower, tickUpper) {
802
803
  let currentTick = TickList.nextInitializedTick(ticks, tickLower, false);
803
804
  let currentL = lowerOutOfBound ? ZERO$1 : FeeCalculator.getLiquidityFromTick(ticks, currentTick.index);
804
805
  let weightedL = ZERO$1;
805
- const getWeightedLFromLastTickTo = (toTick) => JSBI$1.multiply(currentL, JSBI$1.BigInt(toTick - Math.max(lastTick.index, tickLower)));
806
+ const getWeightedLFromLastTickTo = (toTick) => currentL * BigInt(toTick - Math.max(lastTick.index, tickLower));
806
807
  while (currentTick.index < tickUpper) {
807
- weightedL = JSBI$1.add(weightedL, getWeightedLFromLastTickTo(currentTick.index));
808
- currentL = JSBI$1.add(currentL, currentTick.liquidityNet);
808
+ weightedL += getWeightedLFromLastTickTo(currentTick.index);
809
+ currentL += currentTick.liquidityNet;
809
810
  lastTick = currentTick;
810
811
  if (currentTick.index === ticks[ticks.length - 1].index) {
811
812
  break;
812
813
  }
813
814
  currentTick = TickList.nextInitializedTick(ticks, currentTick.index, false);
814
815
  }
815
- weightedL = JSBI$1.add(weightedL, getWeightedLFromLastTickTo(tickUpper));
816
- return JSBI$1.divide(weightedL, JSBI$1.BigInt(tickUpper - tickLower));
816
+ weightedL += getWeightedLFromLastTickTo(tickUpper);
817
+ return weightedL / BigInt(tickUpper - tickLower);
817
818
  }
818
819
  function getLiquidityFromSqrtRatioX96(ticks, sqrtRatioX96) {
819
820
  const tick = TickMath.getTickAtSqrtRatio(sqrtRatioX96);
820
821
  return FeeCalculator.getLiquidityFromTick(ticks, tick);
821
822
  }
822
823
  function getLiquidityFromTick(ticks, tick) {
823
- var _a;
824
824
  let liquidity = ZERO$1;
825
- if (!(ticks == null ? void 0 : ticks.length))
825
+ if (!ticks?.length)
826
826
  return liquidity;
827
827
  if (tick < ticks[0].index || tick > ticks[ticks.length - 1].index) {
828
828
  return liquidity;
829
829
  }
830
830
  for (let i = 0; i < ticks.length - 1; ++i) {
831
- liquidity = JSBI$1.add(liquidity, ticks[i].liquidityNet);
831
+ liquidity += ticks[i].liquidityNet;
832
832
  const lowerTick = ticks[i].index;
833
- const upperTick = (_a = ticks[i + 1]) == null ? void 0 : _a.index;
833
+ const upperTick = ticks[i + 1]?.index;
834
834
  if (lowerTick <= tick && tick <= upperTick) {
835
835
  break;
836
836
  }
837
837
  }
838
838
  return liquidity;
839
839
  }
840
- var FEE_BASE = JSBI$1.exponentiate(JSBI$1.BigInt(10), JSBI$1.BigInt(4));
840
+ var FEE_BASE = 10n ** 4n;
841
841
  function parseProtocolFees(feeProtocol) {
842
842
  const packed = Number(feeProtocol);
843
843
  if (Number.isNaN(packed)) {
@@ -847,14 +847,18 @@ function parseProtocolFees(feeProtocol) {
847
847
  const token1ProtocolFee = packed >> 16;
848
848
  return [new Percent$1(token0ProtocolFee, FEE_BASE), new Percent$1(token1ProtocolFee, FEE_BASE)];
849
849
  }
850
+ function sqrtRatioX96ToPrice(sqrtRatioX96, currencyA, currencyB) {
851
+ const ratioX192 = sqrtRatioX96 * sqrtRatioX96;
852
+ return currencyA.wrapped.sortsBefore(currencyB.wrapped) ? new Price$1(currencyA.wrapped, currencyB.wrapped, Q192, ratioX192) : new Price$1(currencyA.wrapped, currencyB.wrapped, ratioX192, Q192);
853
+ }
850
854
 
851
855
  // src/entities/tick.ts
852
856
  var Tick = class {
853
857
  constructor({ index, liquidityGross, liquidityNet }) {
854
858
  invariant11(index >= TickMath.MIN_TICK && index <= TickMath.MAX_TICK, "TICK");
855
859
  this.index = index;
856
- this.liquidityGross = JSBI4.BigInt(liquidityGross);
857
- this.liquidityNet = JSBI4.BigInt(liquidityNet);
860
+ this.liquidityGross = BigInt(liquidityGross);
861
+ this.liquidityNet = BigInt(liquidityNet);
858
862
  }
859
863
  };
860
864
 
@@ -877,7 +881,7 @@ var NO_TICK_DATA_PROVIDER_DEFAULT = new NoTickDataProvider();
877
881
  var Pool = class {
878
882
  static getAddress(tokenA, tokenB, fee, initCodeHashManualOverride, deployerAddressOverride) {
879
883
  return computePoolAddress({
880
- deployerAddress: deployerAddressOverride != null ? deployerAddressOverride : DEPLOYER_ADDRESSES[tokenA.chainId],
884
+ deployerAddress: deployerAddressOverride ?? DEPLOYER_ADDRESSES[tokenA.chainId],
881
885
  fee,
882
886
  tokenA,
883
887
  tokenB,
@@ -898,8 +902,8 @@ var Pool = class {
898
902
  invariant11(Number.isInteger(fee) && fee < 1e6, "FEE");
899
903
  [this.token0, this.token1] = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA];
900
904
  this.fee = fee;
901
- this.sqrtRatioX96 = JSBI4.BigInt(sqrtRatioX96);
902
- this.liquidity = JSBI4.BigInt(liquidity);
905
+ this.sqrtRatioX96 = BigInt(sqrtRatioX96);
906
+ this.liquidity = BigInt(liquidity);
903
907
  this.tickCurrent = tickCurrent;
904
908
  this.tickDataProvider = Array.isArray(ticks) ? new TickListDataProvider(ticks) : ticks;
905
909
  }
@@ -915,25 +919,13 @@ var Pool = class {
915
919
  * Returns the current mid price of the pool in terms of token0, i.e. the ratio of token1 over token0
916
920
  */
917
921
  get token0Price() {
918
- var _a;
919
- return (_a = this._token0Price) != null ? _a : this._token0Price = new Price(
920
- this.token0,
921
- this.token1,
922
- Q192,
923
- JSBI4.multiply(this.sqrtRatioX96, this.sqrtRatioX96)
924
- );
922
+ return this._token0Price ?? (this._token0Price = new Price(this.token0, this.token1, Q192, this.sqrtRatioX96 * this.sqrtRatioX96));
925
923
  }
926
924
  /**
927
925
  * Returns the current mid price of the pool in terms of token1, i.e. the ratio of token0 over token1
928
926
  */
929
927
  get token1Price() {
930
- var _a;
931
- return (_a = this._token1Price) != null ? _a : this._token1Price = new Price(
932
- this.token1,
933
- this.token0,
934
- JSBI4.multiply(this.sqrtRatioX96, this.sqrtRatioX96),
935
- Q192
936
- );
928
+ return this._token1Price ?? (this._token1Price = new Price(this.token1, this.token0, this.sqrtRatioX96 * this.sqrtRatioX96, Q192));
937
929
  }
938
930
  /**
939
931
  * Return the price of the given token in terms of the other token in the pool.
@@ -967,7 +959,7 @@ var Pool = class {
967
959
  } = await this.swap(zeroForOne, inputAmount.quotient, sqrtPriceLimitX96);
968
960
  const outputToken = zeroForOne ? this.token1 : this.token0;
969
961
  return [
970
- CurrencyAmount.fromRawAmount(outputToken, JSBI4.multiply(outputAmount, NEGATIVE_ONE)),
962
+ CurrencyAmount.fromRawAmount(outputToken, outputAmount * NEGATIVE_ONE),
971
963
  new Pool(this.token0, this.token1, this.fee, sqrtRatioX96, liquidity, tickCurrent, this.tickDataProvider)
972
964
  ];
973
965
  }
@@ -986,8 +978,8 @@ var Pool = class {
986
978
  sqrtRatioX96,
987
979
  liquidity,
988
980
  tickCurrent
989
- } = await this.swap(zeroForOne, JSBI4.multiply(outputAmount.quotient, NEGATIVE_ONE), sqrtPriceLimitX96);
990
- invariant11(JSBI4.equal(amountSpecifiedRemaining, ZERO), "INSUFICIENT_LIQUIDITY");
981
+ } = await this.swap(zeroForOne, outputAmount.quotient * NEGATIVE_ONE, sqrtPriceLimitX96);
982
+ invariant11(amountSpecifiedRemaining === ZERO, "INSUFICIENT_LIQUIDITY");
991
983
  const inputToken = zeroForOne ? this.token0 : this.token1;
992
984
  return [
993
985
  CurrencyAmount.fromRawAmount(inputToken, inputAmount),
@@ -1006,15 +998,15 @@ var Pool = class {
1006
998
  */
1007
999
  async swap(zeroForOne, amountSpecified, sqrtPriceLimitX96) {
1008
1000
  if (!sqrtPriceLimitX96)
1009
- sqrtPriceLimitX96 = zeroForOne ? JSBI4.add(TickMath.MIN_SQRT_RATIO, ONE) : JSBI4.subtract(TickMath.MAX_SQRT_RATIO, ONE);
1001
+ sqrtPriceLimitX96 = zeroForOne ? TickMath.MIN_SQRT_RATIO + ONE : TickMath.MAX_SQRT_RATIO - ONE;
1010
1002
  if (zeroForOne) {
1011
- invariant11(JSBI4.greaterThan(sqrtPriceLimitX96, TickMath.MIN_SQRT_RATIO), "RATIO_MIN");
1012
- invariant11(JSBI4.lessThan(sqrtPriceLimitX96, this.sqrtRatioX96), "RATIO_CURRENT");
1003
+ invariant11(sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO, "RATIO_MIN");
1004
+ invariant11(sqrtPriceLimitX96 < this.sqrtRatioX96, "RATIO_CURRENT");
1013
1005
  } else {
1014
- invariant11(JSBI4.lessThan(sqrtPriceLimitX96, TickMath.MAX_SQRT_RATIO), "RATIO_MAX");
1015
- invariant11(JSBI4.greaterThan(sqrtPriceLimitX96, this.sqrtRatioX96), "RATIO_CURRENT");
1006
+ invariant11(sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO, "RATIO_MAX");
1007
+ invariant11(sqrtPriceLimitX96 > this.sqrtRatioX96, "RATIO_CURRENT");
1016
1008
  }
1017
- const exactInput = JSBI4.greaterThanOrEqual(amountSpecified, ZERO);
1009
+ const exactInput = amountSpecified >= ZERO;
1018
1010
  const state = {
1019
1011
  amountSpecifiedRemaining: amountSpecified,
1020
1012
  amountCalculated: ZERO,
@@ -1022,7 +1014,7 @@ var Pool = class {
1022
1014
  tick: this.tickCurrent,
1023
1015
  liquidity: this.liquidity
1024
1016
  };
1025
- while (JSBI4.notEqual(state.amountSpecifiedRemaining, ZERO) && state.sqrtPriceX96 != sqrtPriceLimitX96) {
1017
+ while (state.amountSpecifiedRemaining !== ZERO && state.sqrtPriceX96 != sqrtPriceLimitX96) {
1026
1018
  const step = {};
1027
1019
  step.sqrtPriceStartX96 = state.sqrtPriceX96;
1028
1020
  [step.tickNext, step.initialized] = await this.tickDataProvider.nextInitializedTickWithinOneWord(
@@ -1038,30 +1030,27 @@ var Pool = class {
1038
1030
  step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext);
1039
1031
  [state.sqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount] = SwapMath.computeSwapStep(
1040
1032
  state.sqrtPriceX96,
1041
- (zeroForOne ? JSBI4.lessThan(step.sqrtPriceNextX96, sqrtPriceLimitX96) : JSBI4.greaterThan(step.sqrtPriceNextX96, sqrtPriceLimitX96)) ? sqrtPriceLimitX96 : step.sqrtPriceNextX96,
1033
+ (zeroForOne ? step.sqrtPriceNextX96 < sqrtPriceLimitX96 : step.sqrtPriceNextX96 > sqrtPriceLimitX96) ? sqrtPriceLimitX96 : step.sqrtPriceNextX96,
1042
1034
  state.liquidity,
1043
1035
  state.amountSpecifiedRemaining,
1044
1036
  this.fee
1045
1037
  );
1046
1038
  if (exactInput) {
1047
- state.amountSpecifiedRemaining = JSBI4.subtract(
1048
- state.amountSpecifiedRemaining,
1049
- JSBI4.add(step.amountIn, step.feeAmount)
1050
- );
1051
- state.amountCalculated = JSBI4.subtract(state.amountCalculated, step.amountOut);
1039
+ state.amountSpecifiedRemaining = state.amountSpecifiedRemaining - (step.amountIn + step.feeAmount);
1040
+ state.amountCalculated = state.amountCalculated - step.amountOut;
1052
1041
  } else {
1053
- state.amountSpecifiedRemaining = JSBI4.add(state.amountSpecifiedRemaining, step.amountOut);
1054
- state.amountCalculated = JSBI4.add(state.amountCalculated, JSBI4.add(step.amountIn, step.feeAmount));
1042
+ state.amountSpecifiedRemaining = state.amountSpecifiedRemaining + step.amountOut;
1043
+ state.amountCalculated = state.amountCalculated + (step.amountIn + step.feeAmount);
1055
1044
  }
1056
- if (JSBI4.equal(state.sqrtPriceX96, step.sqrtPriceNextX96)) {
1045
+ if (state.sqrtPriceX96 === step.sqrtPriceNextX96) {
1057
1046
  if (step.initialized) {
1058
- let liquidityNet = JSBI4.BigInt((await this.tickDataProvider.getTick(step.tickNext)).liquidityNet);
1047
+ let liquidityNet = BigInt((await this.tickDataProvider.getTick(step.tickNext)).liquidityNet);
1059
1048
  if (zeroForOne)
1060
- liquidityNet = JSBI4.multiply(liquidityNet, NEGATIVE_ONE);
1049
+ liquidityNet = liquidityNet * NEGATIVE_ONE;
1061
1050
  state.liquidity = LiquidityMath.addDelta(state.liquidity, liquidityNet);
1062
1051
  }
1063
1052
  state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;
1064
- } else if (JSBI4.notEqual(state.sqrtPriceX96, step.sqrtPriceStartX96)) {
1053
+ } else if (state.sqrtPriceX96 !== step.sqrtPriceStartX96) {
1065
1054
  state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96);
1066
1055
  }
1067
1056
  }
@@ -1096,7 +1085,7 @@ var Position = class {
1096
1085
  this.pool = pool;
1097
1086
  this.tickLower = tickLower;
1098
1087
  this.tickUpper = tickUpper;
1099
- this.liquidity = JSBI4.BigInt(liquidity);
1088
+ this.liquidity = BigInt(liquidity);
1100
1089
  }
1101
1090
  /**
1102
1091
  * Returns the price of token0 at the lower tick
@@ -1155,12 +1144,12 @@ var Position = class {
1155
1144
  const priceLower = this.pool.token0Price.asFraction.multiply(new Percent$1(1).subtract(slippageTolerance));
1156
1145
  const priceUpper = this.pool.token0Price.asFraction.multiply(slippageTolerance.add(1));
1157
1146
  let sqrtRatioX96Lower = encodeSqrtRatioX96(priceLower.numerator, priceLower.denominator);
1158
- if (JSBI4.lessThanOrEqual(sqrtRatioX96Lower, TickMath.MIN_SQRT_RATIO)) {
1159
- sqrtRatioX96Lower = JSBI4.add(TickMath.MIN_SQRT_RATIO, JSBI4.BigInt(1));
1147
+ if (sqrtRatioX96Lower <= TickMath.MIN_SQRT_RATIO) {
1148
+ sqrtRatioX96Lower = TickMath.MIN_SQRT_RATIO + 1n;
1160
1149
  }
1161
1150
  let sqrtRatioX96Upper = encodeSqrtRatioX96(priceUpper.numerator, priceUpper.denominator);
1162
- if (JSBI4.greaterThanOrEqual(sqrtRatioX96Upper, TickMath.MAX_SQRT_RATIO)) {
1163
- sqrtRatioX96Upper = JSBI4.subtract(TickMath.MAX_SQRT_RATIO, JSBI4.BigInt(1));
1151
+ if (sqrtRatioX96Upper >= TickMath.MAX_SQRT_RATIO) {
1152
+ sqrtRatioX96Upper = TickMath.MAX_SQRT_RATIO - 1n;
1164
1153
  }
1165
1154
  return {
1166
1155
  sqrtRatioX96Lower,
@@ -1394,7 +1383,7 @@ var Route = class {
1394
1383
  this.pools = pools;
1395
1384
  this.tokenPath = tokenPath;
1396
1385
  this.input = input;
1397
- this.output = output != null ? output : tokenPath[tokenPath.length - 1];
1386
+ this.output = output ?? tokenPath[tokenPath.length - 1];
1398
1387
  }
1399
1388
  get chainId() {
1400
1389
  return this.pools[0].chainId;
@@ -1485,13 +1474,12 @@ var Trade = class {
1485
1474
  * The price expressed in terms of output amount/input amount.
1486
1475
  */
1487
1476
  get executionPrice() {
1488
- var _a;
1489
- return (_a = this._executionPrice) != null ? _a : this._executionPrice = new Price(
1477
+ return this._executionPrice ?? (this._executionPrice = new Price(
1490
1478
  this.inputAmount.currency,
1491
1479
  this.outputAmount.currency,
1492
1480
  this.inputAmount.quotient,
1493
1481
  this.outputAmount.quotient
1494
- );
1482
+ ));
1495
1483
  }
1496
1484
  /**
1497
1485
  * Returns the percent difference between the route's mid price and the price impact
@@ -2750,7 +2738,7 @@ var Payments = _Payments;
2750
2738
  Payments.INTERFACE = new Interface(IPeripheryPaymentsWithFee_default);
2751
2739
 
2752
2740
  // src/nonfungiblePositionManager.ts
2753
- var MaxUint128 = toHex(JSBI4.subtract(JSBI4.exponentiate(JSBI4.BigInt(2), JSBI4.BigInt(128)), JSBI4.BigInt(1)));
2741
+ var MaxUint128 = toHex(2n ** 128n - 1n);
2754
2742
  function isMint(options) {
2755
2743
  return Object.keys(options).some((k) => k === "recipient");
2756
2744
  }
@@ -2776,7 +2764,7 @@ var _NonfungiblePositionManager = class {
2776
2764
  };
2777
2765
  }
2778
2766
  static addCallParameters(position, options) {
2779
- invariant11(JSBI4.greaterThan(position.liquidity, ZERO), "ZERO_LIQUIDITY");
2767
+ invariant11(position.liquidity > ZERO, "ZERO_LIQUIDITY");
2780
2768
  const calldatas = [];
2781
2769
  const { amount0: amount0Desired, amount1: amount1Desired } = position.mintAmounts;
2782
2770
  const minimumAmounts = position.mintAmountsWithSlippage(options.slippageTolerance);
@@ -2830,7 +2818,7 @@ var _NonfungiblePositionManager = class {
2830
2818
  const { wrapped } = options.useNative;
2831
2819
  invariant11(position.pool.token0.equals(wrapped) || position.pool.token1.equals(wrapped), "NO_WETH");
2832
2820
  const wrappedValue = position.pool.token0.equals(wrapped) ? amount0Desired : amount1Desired;
2833
- if (JSBI4.greaterThan(wrappedValue, ZERO)) {
2821
+ if (wrappedValue > ZERO) {
2834
2822
  calldatas.push(Payments.encodeRefundETH());
2835
2823
  }
2836
2824
  value = toHex(wrappedValue);
@@ -2887,7 +2875,7 @@ var _NonfungiblePositionManager = class {
2887
2875
  tickLower: position.tickLower,
2888
2876
  tickUpper: position.tickUpper
2889
2877
  });
2890
- invariant11(JSBI4.greaterThan(partialPosition.liquidity, ZERO), "ZERO_LIQUIDITY");
2878
+ invariant11(partialPosition.liquidity > ZERO, "ZERO_LIQUIDITY");
2891
2879
  const { amount0: amount0Min, amount1: amount1Min } = partialPosition.burnAmountsWithSlippage(
2892
2880
  options.slippageTolerance
2893
2881
  );
@@ -3479,7 +3467,6 @@ var SwapQuoter = class {
3479
3467
  * @returns The formatted calldata
3480
3468
  */
3481
3469
  static quoteCallParameters(route, amount, tradeType, options = {}) {
3482
- var _a;
3483
3470
  const singleHop = route.pools.length === 1;
3484
3471
  const quoteAmount = toHex(amount.quotient);
3485
3472
  let calldata;
@@ -3489,7 +3476,7 @@ var SwapQuoter = class {
3489
3476
  tokenIn: route.tokenPath[0].address,
3490
3477
  tokenOut: route.tokenPath[1].address,
3491
3478
  fee: route.pools[0].fee,
3492
- sqrtPriceLimitX96: toHex((_a = options == null ? void 0 : options.sqrtPriceLimitX96) != null ? _a : 0)
3479
+ sqrtPriceLimitX96: toHex(options?.sqrtPriceLimitX96 ?? 0)
3493
3480
  };
3494
3481
  const v2QuoteParams = {
3495
3482
  ...baseQuoteParams,
@@ -3508,7 +3495,7 @@ var SwapQuoter = class {
3508
3495
  options.useQuoterV2 ? [v2QuoteParams] : v1QuoteParams
3509
3496
  );
3510
3497
  } else {
3511
- invariant11((options == null ? void 0 : options.sqrtPriceLimitX96) === void 0, "MULTIHOP_PRICE_LIMIT");
3498
+ invariant11(options?.sqrtPriceLimitX96 === void 0, "MULTIHOP_PRICE_LIMIT");
3512
3499
  const path = encodeRouteToPath(route, tradeType === TradeType.EXACT_OUTPUT);
3513
3500
  const tradeTypeFunctionName = tradeType === TradeType.EXACT_INPUT ? "quoteExactInput" : "quoteExactOutput";
3514
3501
  calldata = swapInterface.encodeFunctionData(tradeTypeFunctionName, [path, quoteAmount]);
@@ -4241,7 +4228,6 @@ var _Staker = class {
4241
4228
  * @returns The calldatas for 'unstakeToken' and 'claimReward'.
4242
4229
  */
4243
4230
  static encodeClaim(incentiveKey, options) {
4244
- var _a;
4245
4231
  const calldatas = [];
4246
4232
  calldatas.push(
4247
4233
  _Staker.INTERFACE.encodeFunctionData("unstakeToken", [
@@ -4250,7 +4236,7 @@ var _Staker = class {
4250
4236
  ])
4251
4237
  );
4252
4238
  const recipient = validateAndParseAddress(options.recipient);
4253
- const amount = (_a = options.amount) != null ? _a : 0;
4239
+ const amount = options.amount ?? 0;
4254
4240
  calldatas.push(
4255
4241
  _Staker.INTERFACE.encodeFunctionData("claimReward", [incentiveKey.rewardToken.address, recipient, toHex(amount)])
4256
4242
  );
@@ -4953,7 +4939,6 @@ var _SwapRouter = class {
4953
4939
  * @param options options for the call parameters
4954
4940
  */
4955
4941
  static swapCallParameters(trades, options) {
4956
- var _a, _b;
4957
4942
  if (!Array.isArray(trades)) {
4958
4943
  trades = [trades];
4959
4944
  }
@@ -5001,7 +4986,7 @@ var _SwapRouter = class {
5001
4986
  deadline,
5002
4987
  amountIn,
5003
4988
  amountOutMinimum: amountOut,
5004
- sqrtPriceLimitX96: toHex((_a = options.sqrtPriceLimitX96) != null ? _a : 0)
4989
+ sqrtPriceLimitX96: toHex(options.sqrtPriceLimitX96 ?? 0)
5005
4990
  };
5006
4991
  calldatas.push(_SwapRouter.INTERFACE.encodeFunctionData("exactInputSingle", [exactInputSingleParams]));
5007
4992
  } else {
@@ -5013,7 +4998,7 @@ var _SwapRouter = class {
5013
4998
  deadline,
5014
4999
  amountOut,
5015
5000
  amountInMaximum: amountIn,
5016
- sqrtPriceLimitX96: toHex((_b = options.sqrtPriceLimitX96) != null ? _b : 0)
5001
+ sqrtPriceLimitX96: toHex(options.sqrtPriceLimitX96 ?? 0)
5017
5002
  };
5018
5003
  calldatas.push(_SwapRouter.INTERFACE.encodeFunctionData("exactOutputSingle", [exactOutputSingleParams]));
5019
5004
  }
@@ -5761,7 +5746,7 @@ var _MasterChefV3 = class {
5761
5746
  // Copy from NonfungiblePositionManager
5762
5747
  // Only support increaseLiquidity
5763
5748
  static addCallParameters(position, options) {
5764
- invariant11(JSBI4.greaterThan(position.liquidity, ZERO$1), "ZERO_LIQUIDITY");
5749
+ invariant11(position.liquidity > ZERO$1, "ZERO_LIQUIDITY");
5765
5750
  const calldatas = [];
5766
5751
  const { amount0: amount0Desired, amount1: amount1Desired } = position.mintAmounts;
5767
5752
  const minimumAmounts = position.mintAmountsWithSlippage(options.slippageTolerance);
@@ -5841,7 +5826,7 @@ var _MasterChefV3 = class {
5841
5826
  tickLower: position.tickLower,
5842
5827
  tickUpper: position.tickUpper
5843
5828
  });
5844
- invariant11(JSBI4.greaterThan(partialPosition.liquidity, ZERO$1), "ZERO_LIQUIDITY");
5829
+ invariant11(partialPosition.liquidity > ZERO$1, "ZERO_LIQUIDITY");
5845
5830
  const { amount0: amount0Min, amount1: amount1Min } = partialPosition.burnAmountsWithSlippage(
5846
5831
  options.slippageTolerance
5847
5832
  );
@@ -5882,19 +5867,19 @@ var _MasterChefV3 = class {
5882
5867
  ...rest
5883
5868
  })
5884
5869
  );
5885
- if (rest == null ? void 0 : rest.recipient) {
5870
+ if (rest?.recipient) {
5886
5871
  if (options.liquidityPercentage.equalTo(ONE$1)) {
5887
5872
  calldatas.push(
5888
5873
  _MasterChefV3.INTERFACE.encodeFunctionData("withdraw", [
5889
5874
  tokenId.toString(),
5890
- validateAndParseAddress(rest == null ? void 0 : rest.recipient)
5875
+ validateAndParseAddress(rest?.recipient)
5891
5876
  ])
5892
5877
  );
5893
5878
  } else {
5894
5879
  calldatas.push(
5895
5880
  _MasterChefV3.INTERFACE.encodeFunctionData("harvest", [
5896
5881
  tokenId.toString(),
5897
- validateAndParseAddress(rest == null ? void 0 : rest.recipient)
5882
+ validateAndParseAddress(rest?.recipient)
5898
5883
  ])
5899
5884
  );
5900
5885
  }
@@ -5949,4 +5934,4 @@ var _MasterChefV3 = class {
5949
5934
  var MasterChefV3 = _MasterChefV3;
5950
5935
  MasterChefV3.INTERFACE = new Interface(MasterChefV3_default);
5951
5936
 
5952
- export { ADDRESS_ZERO, DEPLOYER_ADDRESS, DEPLOYER_ADDRESSES, FACTORY_ADDRESS, FeeAmount, FeeCalculator, FullMath, LiquidityMath, MasterChefV3, MaxUint128, Multicall, NoTickDataProvider, NonfungiblePositionManager, POOL_INIT_CODE_HASH, Payments, Pool, Position, PositionLibrary, PositionMath, Route, SelfPermit, SqrtPriceMath, Staker, SwapMath, SwapQuoter, SwapRouter, TICK_SPACINGS, Tick, TickLibrary, TickList, TickListDataProvider, TickMath, Trade, computePoolAddress, encodeRouteToPath, encodeSqrtRatioX96, getAmountsAtNewPrice, getAmountsByLiquidityAndPrice, getAverageLiquidity, getDependentAmount, getEstimatedLPFee, getEstimatedLPFeeWithProtocolFee, getLiquidityByAmountsAndPrice, getLiquidityBySingleAmount, getLiquidityFromSqrtRatioX96, getLiquidityFromTick, isMint, isSorted, maxLiquidityForAmounts, mostSignificantBit, nearestUsableTick, parseProtocolFees, priceToClosestTick, subIn256, tickToPrice, toHex, tradeComparator };
5937
+ export { ADDRESS_ZERO, DEPLOYER_ADDRESS, DEPLOYER_ADDRESSES, FACTORY_ADDRESS, FeeAmount, FeeCalculator, FullMath, LiquidityMath, MasterChefV3, MaxUint128, Multicall, NoTickDataProvider, NonfungiblePositionManager, POOL_INIT_CODE_HASH, Payments, Pool, Position, PositionLibrary, PositionMath, Route, SelfPermit, SqrtPriceMath, Staker, SwapMath, SwapQuoter, SwapRouter, TICK_SPACINGS, Tick, TickLibrary, TickList, TickListDataProvider, TickMath, Trade, computePoolAddress, encodeRouteToPath, encodeSqrtRatioX96, getAmountsAtNewPrice, getAmountsByLiquidityAndPrice, getAverageLiquidity, getDependentAmount, getEstimatedLPFee, getEstimatedLPFeeByAmounts, getEstimatedLPFeeByAmountsWithProtocolFee, getEstimatedLPFeeWithProtocolFee, getLiquidityByAmountsAndPrice, getLiquidityBySingleAmount, getLiquidityFromSqrtRatioX96, getLiquidityFromTick, isMint, isSorted, maxLiquidityForAmounts, mostSignificantBit, nearestUsableTick, parseProtocolFees, priceToClosestTick, sqrtRatioX96ToPrice, subIn256, tickToPrice, toHex, tradeComparator };