@panoptic-eng/sdk 1.0.69 → 1.0.71

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.
@@ -94,7 +94,7 @@ const UTILIZATION_DENOMINATOR = 10000n;
94
94
 
95
95
  //#endregion
96
96
  //#region src/panoptic/v2/formatters/tick.ts
97
- const Q192$7 = 1n << 192n;
97
+ const Q192$8 = 1n << 192n;
98
98
  const RAW_PRICE_PRECISION = 40n;
99
99
  function pow10$2(exponent) {
100
100
  if (exponent < 0n) throw new RangeError("Exponent must be non-negative");
@@ -184,7 +184,7 @@ const MAX_SQRT_PRICE_X96 = tickToSqrtPriceX96(MAX_TICK);
184
184
  function getPriceRatioFromSqrtPriceX96(sqrtPriceX96) {
185
185
  return {
186
186
  numerator: sqrtPriceX96 * sqrtPriceX96,
187
- denominator: Q192$7
187
+ denominator: Q192$8
188
188
  };
189
189
  }
190
190
  function getRawPriceRatio(tick) {
@@ -10068,7 +10068,7 @@ function hasLoanOrCredit(tokenId) {
10068
10068
  const POOL_ID_MASK$4 = (1n << 64n) - 1n;
10069
10069
  const MAX_LEGS = TOKEN_ID_BITS.MAX_LEGS;
10070
10070
  const MAX_OPTION_RATIO = LEG_LIMITS.MAX_RATIO;
10071
- const Q192$6 = 1n << 192n;
10071
+ const Q192$7 = 1n << 192n;
10072
10072
  /**
10073
10073
  * Floor integer square root for bigints (Newton's method). Mirrors the isqrt
10074
10074
  * used in reads/collateralEstimate.ts (buildNeutralLeg).
@@ -10115,7 +10115,7 @@ function computeTinyCreditSignedStrike(positionSize, tickSpacing) {
10115
10115
  const maxSafe = MAX_TICK - tickSpacing - 1n;
10116
10116
  let signedStrike;
10117
10117
  try {
10118
- const sqrtKrawX96 = isqrt$1(TINY_CREDIT_TARGET_NOTIONAL_WEI * Q192$6 / positionSize);
10118
+ const sqrtKrawX96 = isqrt$1(TINY_CREDIT_TARGET_NOTIONAL_WEI * Q192$7 / positionSize);
10119
10119
  signedStrike = sqrtPriceX96ToTick(sqrtKrawX96);
10120
10120
  } catch {
10121
10121
  signedStrike = minSafe;
@@ -10987,7 +10987,7 @@ function formatGwei(wei, precision) {
10987
10987
  //#region src/panoptic/v2/tokenId/generateOverlapping.ts
10988
10988
  const MAX_UINT64$2 = (1n << 64n) - 1n;
10989
10989
  const MAX_UINT128$4 = (1n << 128n) - 1n;
10990
- const Q192$5 = 1n << 192n;
10990
+ const Q192$6 = 1n << 192n;
10991
10991
  const MAX_TOKEN_DECIMALS = 255n;
10992
10992
  const MAX_DECIMAL_EXPONENT = 512n;
10993
10993
  function invalid$1(message) {
@@ -11033,7 +11033,7 @@ function quotePriceAtTick(tick, asset, assetDecimals, quoteDecimals) {
11033
11033
  const orientedTick = asset === 0n ? tick : -tick;
11034
11034
  const sqrtPriceX96 = tickToSqrtPriceX96(orientedTick);
11035
11035
  let numerator = sqrtPriceX96 * sqrtPriceX96;
11036
- let denominator = Q192$5;
11036
+ let denominator = Q192$6;
11037
11037
  const decimalDifference = assetDecimals - quoteDecimals;
11038
11038
  if (decimalDifference > 0n) numerator *= pow10$1(decimalDifference);
11039
11039
  else if (decimalDifference < 0n) denominator *= pow10$1(-decimalDifference);
@@ -11053,7 +11053,7 @@ function isPriceGridStrike(strike, params, spacing, tickSpacing) {
11053
11053
  }
11054
11054
  return false;
11055
11055
  }
11056
- function ceilDiv$5(value, divisor) {
11056
+ function ceilDiv$6(value, divisor) {
11057
11057
  const quotient = value / divisor;
11058
11058
  const remainder = value % divisor;
11059
11059
  return remainder > 0n ? quotient + 1n : quotient;
@@ -11086,7 +11086,7 @@ function resolveLegs(legs) {
11086
11086
  function getCandidateStrikes(params, spacing, tickSpacing, halfWidth) {
11087
11087
  const lower = MIN_TICK + halfWidth > params.currentTick - halfWidth + 1n ? MIN_TICK + halfWidth : params.currentTick - halfWidth + 1n;
11088
11088
  const upper = MAX_TICK - halfWidth < params.currentTick + halfWidth - 1n ? MAX_TICK - halfWidth : params.currentTick + halfWidth - 1n;
11089
- const firstStrike = ceilDiv$5(lower, tickSpacing) * tickSpacing;
11089
+ const firstStrike = ceilDiv$6(lower, tickSpacing) * tickSpacing;
11090
11090
  const lastStrike = floorDiv$1(upper, tickSpacing) * tickSpacing;
11091
11091
  const strikes = [];
11092
11092
  for (let strike = firstStrike; strike <= lastStrike; strike += tickSpacing) if (isPriceGridStrike(strike, params, spacing, tickSpacing)) strikes.push(strike);
@@ -11308,10 +11308,41 @@ function splitTokenIdByTimescale(tokenId, positionSize, targetTimescale) {
11308
11308
  };
11309
11309
  }
11310
11310
 
11311
+ //#endregion
11312
+ //#region src/panoptic/v2/tokenId/validate.ts
11313
+ /**
11314
+ * Validate a TokenId's structure using the rules of TokenId.validate.
11315
+ * This does not check pool registration, available liquidity, or account collateral.
11316
+ */
11317
+ function getTokenIdValidationError(tokenId) {
11318
+ if (tokenId < 0n || tokenId >= 1n << 256n) return "Token ID must fit in uint256.";
11319
+ const legs = [];
11320
+ for (let index = 0n; index < TOKEN_ID_BITS.MAX_LEGS; index++) {
11321
+ const leg = decodeLeg(tokenId, index);
11322
+ if (leg.optionRatio === 0n) {
11323
+ const offset = TOKEN_ID_BITS.POOL_ID_SIZE + index * TOKEN_ID_BITS.LEG_SIZE;
11324
+ if (tokenId >> offset !== 0n) return "Position contains empty or non-contiguous legs.";
11325
+ break;
11326
+ }
11327
+ legs.push(leg);
11328
+ }
11329
+ if (legs.length === 0) return "Position must contain at least one leg.";
11330
+ const chunks = new Set();
11331
+ for (const leg of legs) {
11332
+ const chunk = `${leg.strike}:${leg.width}:${leg.tokenType}`;
11333
+ if (chunks.has(chunk)) return "Position contains duplicate legs sharing the same liquidity chunk.";
11334
+ chunks.add(chunk);
11335
+ if (leg.strike <= -887272n || leg.strike >= 887272n) return "Position strike must be inside the pool tick bounds.";
11336
+ const partner = legs[Number(leg.riskPartner)];
11337
+ if (!partner || partner.riskPartner !== leg.index) return "Position risk partners must reference existing legs and be mutual.";
11338
+ }
11339
+ return null;
11340
+ }
11341
+
11311
11342
  //#endregion
11312
11343
  //#region src/uniswap/lpDeposit.ts
11313
- const Q96$5 = 1n << 96n;
11314
- const ceilDiv$4 = (n, d) => (n + d - 1n) / d;
11344
+ const Q96$6 = 1n << 96n;
11345
+ const ceilDiv$5 = (n, d) => (n + d - 1n) / d;
11315
11346
  /** Principal and separately identified funding headroom, in native token units. */
11316
11347
  function getLpDepositBreakdown(ranges, sqrtPriceX96) {
11317
11348
  if (sqrtPriceX96 <= 0n) throw new Error("Invalid pool price");
@@ -11322,12 +11353,12 @@ function getLpDepositBreakdown(ranges, sqrtPriceX96) {
11322
11353
  const lower = tickToSqrtPriceX96(BigInt(tickLower));
11323
11354
  const upper = tickToSqrtPriceX96(BigInt(tickUpper));
11324
11355
  const price = sqrtPriceX96 < lower ? lower : sqrtPriceX96 > upper ? upper : sqrtPriceX96;
11325
- amount0 += ceilDiv$4(liquidity * Q96$5 * (upper - price), upper * price);
11326
- amount1 += ceilDiv$4(liquidity * (price - lower), Q96$5);
11356
+ amount0 += ceilDiv$5(liquidity * Q96$6 * (upper - price), upper * price);
11357
+ amount1 += ceilDiv$5(liquidity * (price - lower), Q96$6);
11327
11358
  }
11328
11359
  const buffer = {
11329
- amount0: ceilDiv$4(amount0 * 5n, 100n),
11330
- amount1: ceilDiv$4(amount1 * 5n, 100n)
11360
+ amount0: ceilDiv$5(amount0 * 5n, 100n),
11361
+ amount1: ceilDiv$5(amount1 * 5n, 100n)
11331
11362
  };
11332
11363
  return {
11333
11364
  principal: {
@@ -11351,7 +11382,7 @@ function getUnhedgedLpRanges({ tokenId, positionSize, tickSpacing }) {
11351
11382
  const lower = tickToSqrtPriceX96(tickLower);
11352
11383
  const upper = tickToSqrtPriceX96(tickUpper);
11353
11384
  const amount = positionSize * leg.optionRatio;
11354
- const liquidity = leg.asset === 0n ? amount * (lower * upper / Q96$5) / (upper - lower) : amount * Q96$5 / (upper - lower);
11385
+ const liquidity = leg.asset === 0n ? amount * (lower * upper / Q96$6) / (upper - lower) : amount * Q96$6 / (upper - lower);
11355
11386
  return liquidity <= 0n ? [] : [{
11356
11387
  tickLower: Number(tickLower),
11357
11388
  tickUpper: Number(tickUpper),
@@ -11372,7 +11403,7 @@ function getLpPositionFunding(params) {
11372
11403
  });
11373
11404
  const breakdown = getLpDepositBreakdown(ranges, sqrtPriceX96);
11374
11405
  const priceSquared = valuationSqrtPriceX96 * valuationSqrtPriceX96;
11375
- const value = ({ amount0, amount1 }) => quoteTokenIndex === 0 ? amount0 + ceilDiv$4(amount1 * Q96$5 * Q96$5, priceSquared) : amount1 + ceilDiv$4(amount0 * priceSquared, Q96$5 * Q96$5);
11406
+ const value = ({ amount0, amount1 }) => quoteTokenIndex === 0 ? amount0 + ceilDiv$5(amount1 * Q96$6 * Q96$6, priceSquared) : amount1 + ceilDiv$5(amount0 * priceSquared, Q96$6 * Q96$6);
11376
11407
  const principalInQuote = value(breakdown.principal);
11377
11408
  const totalInQuote = value(breakdown.total);
11378
11409
  return {
@@ -11394,7 +11425,7 @@ function getMaxLpPositionSize(params) {
11394
11425
  ...params,
11395
11426
  positionSize: mid
11396
11427
  });
11397
- const minimum = params.minimumRequirement ? ceilDiv$4(params.minimumRequirement.requiredInQuote * mid, params.minimumRequirement.referenceSize) : 0n;
11428
+ const minimum = params.minimumRequirement ? ceilDiv$5(params.minimumRequirement.requiredInQuote * mid, params.minimumRequirement.referenceSize) : 0n;
11398
11429
  if (funding.totalInQuote <= params.availableInQuote && minimum <= params.availableInQuote) low = mid;
11399
11430
  else high = mid - 1n;
11400
11431
  }
@@ -12854,7 +12885,7 @@ async function submitWriteRequest(params) {
12854
12885
  * Exported so callers can display the constant; prefer {@link applyMintBuffer}
12855
12886
  * over multiplying by it directly, which is how the rounding bug reappears.
12856
12887
  */
12857
- const MINT_BUFFER = 10666667n;
12888
+ const MINT_BUFFER = 10750000n;
12858
12889
  /** `RiskEngine.DECIMALS` — the denominator {@link MINT_BUFFER} is taken over. */
12859
12890
  const MINT_BUFFER_DENOMINATOR = 10000000n;
12860
12891
  /** The compiled-in default, matching the deployed RiskEngine. */
@@ -14585,8 +14616,8 @@ async function assertLpPositionFunded(params) {
14585
14616
 
14586
14617
  //#endregion
14587
14618
  //#region src/uniswap/lpGreeks.ts
14588
- const Q96$4 = 1n << 96n;
14589
- const Q192$4 = 1n << 192n;
14619
+ const Q96$5 = 1n << 96n;
14620
+ const Q192$5 = 1n << 192n;
14590
14621
  /**
14591
14622
  * Compute the token0/token1 amounts backing `liquidity` over `[sqrtA, sqrtB]`
14592
14623
  * at the current price `sqrtP`, mirroring Uniswap's `LiquidityAmounts`
@@ -14596,8 +14627,8 @@ const Q192$4 = 1n << 192n;
14596
14627
  function getAmountsForLiquidity(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, liquidity) {
14597
14628
  const [sqrtA, sqrtB] = sqrtRatioAX96 <= sqrtRatioBX96 ? [sqrtRatioAX96, sqrtRatioBX96] : [sqrtRatioBX96, sqrtRatioAX96];
14598
14629
  const sqrtC = sqrtPriceX96 < sqrtA ? sqrtA : sqrtPriceX96 > sqrtB ? sqrtB : sqrtPriceX96;
14599
- const amount0 = sqrtC < sqrtB ? liquidity * (sqrtB - sqrtC) * Q96$4 / (sqrtC * sqrtB) : 0n;
14600
- const amount1 = sqrtC > sqrtA ? liquidity * (sqrtC - sqrtA) / Q96$4 : 0n;
14630
+ const amount0 = sqrtC < sqrtB ? liquidity * (sqrtB - sqrtC) * Q96$5 / (sqrtC * sqrtB) : 0n;
14631
+ const amount1 = sqrtC > sqrtA ? liquidity * (sqrtC - sqrtA) / Q96$5 : 0n;
14601
14632
  return {
14602
14633
  amount0,
14603
14634
  amount1
@@ -14606,7 +14637,7 @@ function getAmountsForLiquidity(sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, liqu
14606
14637
 
14607
14638
  //#endregion
14608
14639
  //#region src/panoptic/v2/greeks/legLiquidity.ts
14609
- const Q96$3 = 1n << 96n;
14640
+ const Q96$4 = 1n << 96n;
14610
14641
  function divCeil(numerator, denominator) {
14611
14642
  return (numerator + denominator - 1n) / denominator;
14612
14643
  }
@@ -14619,7 +14650,7 @@ function getLegLiquidityRange(leg, positionSize, tickSpacing) {
14619
14650
  const sqrtLower = tickToSqrtPriceX96(lowerTick);
14620
14651
  const sqrtUpper = tickToSqrtPriceX96(upperTick);
14621
14652
  const amount = positionSize * leg.optionRatio;
14622
- const liquidity = leg.asset === 0n ? amount * (sqrtLower * sqrtUpper / Q96$3) / (sqrtUpper - sqrtLower) : amount * Q96$3 / (sqrtUpper - sqrtLower);
14653
+ const liquidity = leg.asset === 0n ? amount * (sqrtLower * sqrtUpper / Q96$4) / (sqrtUpper - sqrtLower) : amount * Q96$4 / (sqrtUpper - sqrtLower);
14623
14654
  return {
14624
14655
  lowerTick,
14625
14656
  upperTick,
@@ -14642,7 +14673,7 @@ function getLegTokenInventory(leg, currentTick, positionSize, tickSpacing, token
14642
14673
  if (tokenIndex === 0n) {
14643
14674
  const scaled = (liquidity << 96n) * span;
14644
14675
  movedAmount = leg.isLong ? scaled / sqrtUpper / sqrtLower : divCeil(divCeil(scaled, sqrtUpper), sqrtLower);
14645
- } else movedAmount = leg.isLong ? liquidity * span / Q96$3 : divCeil(liquidity * span, Q96$3);
14676
+ } else movedAmount = leg.isLong ? liquidity * span / Q96$4 : divCeil(liquidity * span, Q96$4);
14646
14677
  }
14647
14678
  const net = heldAmount - movedAmount;
14648
14679
  return leg.isLong ? -net : net;
@@ -14651,8 +14682,8 @@ function getLegTokenInventory(leg, currentTick, positionSize, tickSpacing, token
14651
14682
  //#endregion
14652
14683
  //#region src/panoptic/v2/greeks/index.ts
14653
14684
  /** Fixed-point scale constants for sqrtPriceX96 arithmetic */
14654
- const Q96$2 = 1n << 96n;
14655
- const Q192$3 = 1n << 192n;
14685
+ const Q96$3 = 1n << 96n;
14686
+ const Q192$4 = 1n << 192n;
14656
14687
  /**
14657
14688
  * Convert tick to quote-denominated tick based on asset direction.
14658
14689
  *
@@ -14706,7 +14737,7 @@ function computeWidth0Notional(leg, m) {
14706
14737
  const signedStrike = leg.asset === 0n ? leg.strike : -leg.strike;
14707
14738
  const sqrtKraw = tickToSqrtPriceX96(signedStrike);
14708
14739
  const KrawX192 = sqrtKraw * sqrtKraw;
14709
- return divTrunc(m * KrawX192, Q192$3);
14740
+ return divTrunc(m * KrawX192, Q192$4);
14710
14741
  }
14711
14742
  /**
14712
14743
  * Calculate value for a width=0 (loan/credit) leg.
@@ -14726,7 +14757,7 @@ function getLegValueWidth0(leg, m, qCurrentTick, qStrikeTick, qMintTick, isAsset
14726
14757
  const sqrtPm = tickToSqrtPriceX96(qMintTick);
14727
14758
  const PX192 = sqrtP * sqrtP;
14728
14759
  const PmX192 = sqrtPm * sqrtPm;
14729
- return divTrunc(-notional * (PX192 - PmX192), Q192$3);
14760
+ return divTrunc(-notional * (PX192 - PmX192), Q192$4);
14730
14761
  } else return 0n;
14731
14762
  }
14732
14763
  /**
@@ -14755,7 +14786,7 @@ function getLegNetValueWidth0(leg, m, qCurrentTick, qMintTick, isAssetToken0, sw
14755
14786
  const sqrtPm = tickToSqrtPriceX96(qMintTick);
14756
14787
  const PX192 = sqrtP * sqrtP;
14757
14788
  const PmX192 = sqrtPm * sqrtPm;
14758
- if (borrowsAsset) return divTrunc(-notional * (PX192 - PmX192), Q192$3);
14789
+ if (borrowsAsset) return divTrunc(-notional * (PX192 - PmX192), Q192$4);
14759
14790
  return divTrunc(notional * PX192, PmX192) - notional;
14760
14791
  }
14761
14792
  /**
@@ -14777,7 +14808,7 @@ function computeOptionItm(m, qStrikeTick, qMintTick, halfWidthTick, isPut) {
14777
14808
  const sqrtPm$2 = tickToSqrtPriceX96(qMintTick);
14778
14809
  const KX192 = sqrtK$1 * sqrtK$1;
14779
14810
  const PmX192 = sqrtPm$2 * sqrtPm$2;
14780
- return divTrunc(m * (KX192 - PmX192), Q192$3);
14811
+ return divTrunc(m * (KX192 - PmX192), Q192$4);
14781
14812
  } else if (qMintTick > qStrikeTick + halfWidthTick) return 0n;
14782
14813
  const sqrtKR = tickToSqrtPriceX96(qStrikeTick + halfWidthTick);
14783
14814
  const sqrtPm$1 = tickToSqrtPriceX96(qMintTick);
@@ -14785,7 +14816,7 @@ function computeOptionItm(m, qStrikeTick, qMintTick, halfWidthTick, isPut) {
14785
14816
  const rX192$1 = sqrtR$1 * sqrtR$1;
14786
14817
  const diff$1 = sqrtKR - sqrtPm$1;
14787
14818
  const diffSqX192$1 = diff$1 * diff$1;
14788
- return divTrunc(m * diffSqX192$1, rX192$1 - Q192$3);
14819
+ return divTrunc(m * diffSqX192$1, rX192$1 - Q192$4);
14789
14820
  }
14790
14821
  if (qMintTick < qStrikeTick - halfWidthTick) return 0n;
14791
14822
  else if (qMintTick > qStrikeTick + halfWidthTick) {
@@ -14799,10 +14830,10 @@ function computeOptionItm(m, qStrikeTick, qMintTick, halfWidthTick, isPut) {
14799
14830
  const sqrtK = tickToSqrtPriceX96(qStrikeTick);
14800
14831
  const sqrtPm = tickToSqrtPriceX96(qMintTick);
14801
14832
  const rX192 = sqrtR * sqrtR;
14802
- const sqrtKPmX96 = divTrunc(sqrtK * Q96$2, sqrtPm);
14833
+ const sqrtKPmX96 = divTrunc(sqrtK * Q96$3, sqrtPm);
14803
14834
  const diff = sqrtR - sqrtKPmX96;
14804
14835
  const diffSqX192 = diff * diff;
14805
- return divTrunc(m * diffSqX192, rX192 - Q192$3);
14836
+ return divTrunc(m * diffSqX192, rX192 - Q192$4);
14806
14837
  }
14807
14838
  /**
14808
14839
  * Check if leg is a call option (vs put).
@@ -14858,11 +14889,11 @@ function getLegValue(leg, currentTick, mintTick, positionSize, poolTickSpacing,
14858
14889
  if (qCurrentTick < qStrikeTick - halfWidthTick) {
14859
14890
  const sqrtP = tickToSqrtPriceX96(qCurrentTick);
14860
14891
  const PX192 = sqrtP * sqrtP;
14861
- v = divTrunc(m * PX192, Q192$3);
14892
+ v = divTrunc(m * PX192, Q192$4);
14862
14893
  } else if (qCurrentTick > qStrikeTick + halfWidthTick) {
14863
14894
  const sqrtK = tickToSqrtPriceX96(qStrikeTick);
14864
14895
  const KX192 = sqrtK * sqrtK;
14865
- v = divTrunc(m * KX192, Q192$3);
14896
+ v = divTrunc(m * KX192, Q192$4);
14866
14897
  } else {
14867
14898
  const sqrtP = tickToSqrtPriceX96(qCurrentTick);
14868
14899
  const sqrtK = tickToSqrtPriceX96(qStrikeTick);
@@ -14871,8 +14902,8 @@ function getLegValue(leg, currentTick, mintTick, positionSize, poolTickSpacing,
14871
14902
  const PX192 = sqrtP * sqrtP;
14872
14903
  const KX192 = sqrtK * sqrtK;
14873
14904
  const rX192 = sqrtR * sqrtR;
14874
- const numerator = m * (2n * sqrtPKR * Q96$2 - PX192 - KX192);
14875
- const denominator = rX192 - Q192$3;
14905
+ const numerator = m * (2n * sqrtPKR * Q96$3 - PX192 - KX192);
14906
+ const denominator = rX192 - Q192$4;
14876
14907
  v = divTrunc(numerator, denominator);
14877
14908
  }
14878
14909
  const debt = -m;
@@ -14881,19 +14912,19 @@ function getLegValue(leg, currentTick, mintTick, positionSize, poolTickSpacing,
14881
14912
  if (isPut) {
14882
14913
  const sqrtK = tickToSqrtPriceX96(qStrikeTick);
14883
14914
  const KX192 = sqrtK * sqrtK;
14884
- const debtK = divTrunc(debt * KX192, Q192$3);
14915
+ const debtK = divTrunc(debt * KX192, Q192$4);
14885
14916
  return debtK + v + itm;
14886
14917
  } else {
14887
14918
  const sqrtP = tickToSqrtPriceX96(qCurrentTick);
14888
14919
  const PX192 = sqrtP * sqrtP;
14889
- const debtP = divTrunc(debt * PX192, Q192$3);
14920
+ const debtP = divTrunc(debt * PX192, Q192$4);
14890
14921
  if (definedRisk) {
14891
14922
  const sqrtPm = tickToSqrtPriceX96(qMintTick);
14892
14923
  const PmX192 = sqrtPm * sqrtPm;
14893
- const itmPm = divTrunc(itm * PmX192, Q192$3);
14924
+ const itmPm = divTrunc(itm * PmX192, Q192$4);
14894
14925
  return debtP + v + itmPm;
14895
14926
  } else {
14896
- const itmP = divTrunc(itm * PX192, Q192$3);
14927
+ const itmP = divTrunc(itm * PX192, Q192$4);
14897
14928
  return debtP + v + itmP;
14898
14929
  }
14899
14930
  }
@@ -14929,7 +14960,7 @@ function getLegDelta(leg, currentTick, positionSize, poolTickSpacing, mintTick,
14929
14960
  const signedStrike = leg.asset === 0n ? leg.strike : -leg.strike;
14930
14961
  const sqrtKraw = tickToSqrtPriceX96(signedStrike);
14931
14962
  const KrawX192 = sqrtKraw * sqrtKraw;
14932
- const notional = divTrunc(m * KrawX192, Q192$3);
14963
+ const notional = divTrunc(m * KrawX192, Q192$4);
14933
14964
  return -notional;
14934
14965
  }
14935
14966
  if (halfWidthTick === 0n) {
@@ -14958,8 +14989,8 @@ function getLegDelta(leg, currentTick, positionSize, poolTickSpacing, mintTick,
14958
14989
  const sqrtKR = tickToSqrtPriceX96(qStrikeTick + halfWidthTick);
14959
14990
  const sqrtR = tickToSqrtPriceX96(halfWidthTick);
14960
14991
  const rX192 = sqrtR * sqrtR;
14961
- const numerator = m * (sqrtKR - sqrtP) * Q192$3;
14962
- const denominator = sqrtP * (rX192 - Q192$3);
14992
+ const numerator = m * (sqrtKR - sqrtP) * Q192$4;
14993
+ const denominator = sqrtP * (rX192 - Q192$4);
14963
14994
  vDelta = divTrunc(numerator, denominator);
14964
14995
  }
14965
14996
  const isPut = !isCall(leg.tokenType, isAssetToken0);
@@ -14979,10 +15010,10 @@ function getLegDelta(leg, currentTick, positionSize, poolTickSpacing, mintTick,
14979
15010
  const sqrtK = tickToSqrtPriceX96(qStrikeTick);
14980
15011
  const sqrtPm = tickToSqrtPriceX96(qMintTick);
14981
15012
  const rX192 = sqrtR * sqrtR;
14982
- const sqrtKPmX96 = sqrtK * Q96$2 / sqrtPm;
15013
+ const sqrtKPmX96 = sqrtK * Q96$3 / sqrtPm;
14983
15014
  const diff = sqrtR - sqrtKPmX96;
14984
15015
  const diffSqX192 = diff * diff;
14985
- return divTrunc(m * diffSqX192, rX192 - Q192$3);
15016
+ return divTrunc(m * diffSqX192, rX192 - Q192$4);
14986
15017
  }
14987
15018
  })();
14988
15019
  return definedRisk ? debtDelta + vDelta : debtDelta + vDelta + itmDelta;
@@ -14991,7 +15022,7 @@ function getLegDelta(leg, currentTick, positionSize, poolTickSpacing, mintTick,
14991
15022
  function toVaultFrameAtTick(delta, fromAsset, vaultAssetIndex, currentTick, flipSignOnAssetInversion = false) {
14992
15023
  if (fromAsset === vaultAssetIndex) return delta;
14993
15024
  const sqrtPriceX96 = tickToSqrtPriceX96(currentTick);
14994
- const converted = vaultAssetIndex === 0n ? delta * Q192$3 / (sqrtPriceX96 * sqrtPriceX96) : delta * sqrtPriceX96 * sqrtPriceX96 / Q192$3;
15025
+ const converted = vaultAssetIndex === 0n ? delta * Q192$4 / (sqrtPriceX96 * sqrtPriceX96) : delta * sqrtPriceX96 * sqrtPriceX96 / Q192$4;
14995
15026
  return flipSignOnAssetInversion ? -converted : converted;
14996
15027
  }
14997
15028
  /**
@@ -15040,8 +15071,8 @@ function getLegGamma(leg, currentTick, positionSize, poolTickSpacing, assetIndex
15040
15071
  const sqrtKPR = tickToSqrtPriceX96(qStrikeTick + qCurrentTick + halfWidthTick);
15041
15072
  const sqrtR = tickToSqrtPriceX96(halfWidthTick);
15042
15073
  const rX192 = sqrtR * sqrtR;
15043
- const numerator = m * sqrtKPR * Q96$2;
15044
- const denominator = 2n * (rX192 - Q192$3);
15074
+ const numerator = m * sqrtKPR * Q96$3;
15075
+ const denominator = 2n * (rX192 - Q192$4);
15045
15076
  return divTrunc(numerator, denominator);
15046
15077
  }
15047
15078
  /**
@@ -17672,7 +17703,7 @@ function maximumAmountIn(estimatedAmountIn, slippageBps) {
17672
17703
  if (slippageBps < 0n) throw new PanopticError("slippageBps must be non-negative");
17673
17704
  return (estimatedAmountIn * (BPS_DENOMINATOR$5 + slippageBps) + BPS_DENOMINATOR$5 - 1n) / BPS_DENOMINATOR$5;
17674
17705
  }
17675
- function ceilDiv$3(numerator, denominator) {
17706
+ function ceilDiv$4(numerator, denominator) {
17676
17707
  return (numerator + denominator - 1n) / denominator;
17677
17708
  }
17678
17709
  function getInputAmount(tokenFlow, tokenInIndex) {
@@ -17777,7 +17808,7 @@ async function quoteTokenShortfallRecovery(params) {
17777
17808
  const estimatedAmountIn = getInputAmount(swapSimulation.tokenFlow, tokenInIndex);
17778
17809
  const estimatedAmountOut = getOutputAmount(swapSimulation.tokenFlow, tokenOutIndex);
17779
17810
  if (estimatedAmountOut < requiredOutput) {
17780
- creditInput = estimatedAmountOut > 0n ? ceilDiv$3(creditInput * requiredOutput, estimatedAmountOut) + 1n : creditInput * 2n;
17811
+ creditInput = estimatedAmountOut > 0n ? ceilDiv$4(creditInput * requiredOutput, estimatedAmountOut) + 1n : creditInput * 2n;
17781
17812
  continue;
17782
17813
  }
17783
17814
  const recoveredDispatch = buildPrefixedExactInputRecoveryDispatch({
@@ -17832,7 +17863,7 @@ async function quoteTokenShortfallRecovery(params) {
17832
17863
  };
17833
17864
  const residual = remainingShortfall.assetsRequested - remainingShortfall.assetBalance;
17834
17865
  requiredOutput += residual > 0n ? residual : requiredOutput;
17835
- creditInput = ceilDiv$3(creditInput * requiredOutput, estimatedAmountOut) + 1n;
17866
+ creditInput = ceilDiv$4(creditInput * requiredOutput, estimatedAmountOut) + 1n;
17836
17867
  }
17837
17868
  return {
17838
17869
  available: false,
@@ -17887,7 +17918,7 @@ async function quoteTokenShortfallRecovery(params) {
17887
17918
  const maxAmountIn = maximumAmountIn(estimatedAmountIn, params.slippageBps);
17888
17919
  const swapOutput = getOutputAmount(swapSimulation.tokenFlow, tokenOutIndex);
17889
17920
  if (swapOutput < amountOut) {
17890
- creditOutSize = swapOutput > 0n ? ceilDiv$3(creditOutSize * amountOut, swapOutput) + 1n : creditOutSize * 2n;
17921
+ creditOutSize = swapOutput > 0n ? ceilDiv$4(creditOutSize * amountOut, swapOutput) + 1n : creditOutSize * 2n;
17891
17922
  continue;
17892
17923
  }
17893
17924
  const recoverySimulation = await simulateDispatch({
@@ -17942,7 +17973,7 @@ async function quoteTokenShortfallRecovery(params) {
17942
17973
  if (decodedShortfall >= shortfallError.assetsRequested - shortfallError.assetBalance) return quotePrefixedExactInput(amountOut);
17943
17974
  const additionalAmountOut = decodedShortfall > 0n ? decodedShortfall : amountOut;
17944
17975
  amountOut += additionalAmountOut;
17945
- creditOutSize = swapOutput > 0n ? ceilDiv$3(creditOutSize * amountOut, swapOutput) + 1n : creditOutSize * 2n;
17976
+ creditOutSize = swapOutput > 0n ? ceilDiv$4(creditOutSize * amountOut, swapOutput) + 1n : creditOutSize * 2n;
17946
17977
  }
17947
17978
  return quotePrefixedExactInput(shortfallError.assetsRequested - shortfallError.assetBalance);
17948
17979
  }
@@ -20864,7 +20895,7 @@ async function getItmAmounts(params) {
20864
20895
  * high-decimal amount can't masquerade as real flow.
20865
20896
  */
20866
20897
  const FLOW_NEUTRAL_DUST_THRESHOLD = 1000n;
20867
- const Q192$2 = 1n << 192n;
20898
+ const Q192$3 = 1n << 192n;
20868
20899
  const POOL_ID_MASK$2 = (1n << 64n) - 1n;
20869
20900
  /**
20870
20901
  * Floor integer square root for bigints (Newton's method). Exact for all
@@ -20900,7 +20931,7 @@ function buildNeutralLeg(tokenIndex, signedAmount, positionSize) {
20900
20931
  const absAmount = signedAmount < 0n ? -signedAmount : signedAmount;
20901
20932
  const legAsset = tokenIndex === 0n ? 1n : 0n;
20902
20933
  const legIsLong = signedAmount < 0n;
20903
- const sqrtKrawX96 = isqrt(absAmount * Q192$2 / positionSize);
20934
+ const sqrtKrawX96 = isqrt(absAmount * Q192$3 / positionSize);
20904
20935
  let signedTick;
20905
20936
  try {
20906
20937
  signedTick = sqrtPriceX96ToTick(sqrtKrawX96);
@@ -21158,7 +21189,7 @@ async function createFlowNeutralTokenId(params) {
21158
21189
  const sqrtPX96 = tickToSqrtPriceX96(tickBefore);
21159
21190
  const valueAbs = (index, amount) => {
21160
21191
  const abs$1 = amount < 0n ? -amount : amount;
21161
- return index === 0n ? abs$1 * sqrtPX96 * sqrtPX96 / Q192$2 : abs$1;
21192
+ return index === 0n ? abs$1 * sqrtPX96 * sqrtPX96 / Q192$3 : abs$1;
21162
21193
  };
21163
21194
  const flowFor = (index) => index === 0n ? credit.creditAmount0 : credit.creditAmount1;
21164
21195
  if (queryAddress !== void 0) {
@@ -22131,7 +22162,7 @@ async function getPoolLiquidities(params) {
22131
22162
 
22132
22163
  //#endregion
22133
22164
  //#region src/panoptic/v2/reads/accountGreeks.ts
22134
- const Q192$1 = 1n << 192n;
22165
+ const Q192$2 = 1n << 192n;
22135
22166
  /**
22136
22167
  * Calculate account-level greeks using stored position data.
22137
22168
  *
@@ -22252,8 +22283,8 @@ async function getAccountGreeks(params) {
22252
22283
  const assetBal = isAssetToken0 ? collateral.token0.assets : collateral.token1.assets;
22253
22284
  const otherBal = isAssetToken0 ? collateral.token1.assets : collateral.token0.assets;
22254
22285
  const sqrtPriceX96 = tickToSqrtPriceX96(BigInt(currentTick));
22255
- if (isAssetToken0) collateralValue = assetBal * sqrtPriceX96 * sqrtPriceX96 / Q192$1 + otherBal;
22256
- else collateralValue = assetBal * Q192$1 / (sqrtPriceX96 * sqrtPriceX96) + otherBal;
22286
+ if (isAssetToken0) collateralValue = assetBal * sqrtPriceX96 * sqrtPriceX96 / Q192$2 + otherBal;
22287
+ else collateralValue = assetBal * Q192$2 / (sqrtPriceX96 * sqrtPriceX96) + otherBal;
22257
22288
  collateralDelta = assetBal;
22258
22289
  }
22259
22290
  return {
@@ -22293,7 +22324,7 @@ function calculateAccountGreeksPure(params) {
22293
22324
  const totalDelta$1 = [];
22294
22325
  for (let i = 0; i < n; i++) {
22295
22326
  const sqrtPriceX96 = tickToSqrtPriceX96(atTicks[i]);
22296
- const assetValueInNumeraire = isAssetToken0 ? assetBal * sqrtPriceX96 * sqrtPriceX96 / Q192$1 : assetBal * Q192$1 / (sqrtPriceX96 * sqrtPriceX96);
22327
+ const assetValueInNumeraire = isAssetToken0 ? assetBal * sqrtPriceX96 * sqrtPriceX96 / Q192$2 : assetBal * Q192$2 / (sqrtPriceX96 * sqrtPriceX96);
22297
22328
  totalValue$1.push(assetValueInNumeraire + otherBal);
22298
22329
  totalDelta$1.push(assetBal);
22299
22330
  }
@@ -22343,7 +22374,7 @@ function calculateAccountGreeksPure(params) {
22343
22374
  }
22344
22375
  for (let i = 0; i < n; i++) {
22345
22376
  const sqrtPriceX96 = tickToSqrtPriceX96(atTicks[i]);
22346
- const assetValueInNumeraire = isAssetToken0 ? assetBal * sqrtPriceX96 * sqrtPriceX96 / Q192$1 : assetBal * Q192$1 / (sqrtPriceX96 * sqrtPriceX96);
22377
+ const assetValueInNumeraire = isAssetToken0 ? assetBal * sqrtPriceX96 * sqrtPriceX96 / Q192$2 : assetBal * Q192$2 / (sqrtPriceX96 * sqrtPriceX96);
22347
22378
  totalValue[i] += assetValueInNumeraire + otherBal;
22348
22379
  totalDelta[i] += assetBal;
22349
22380
  }
@@ -24758,10 +24789,10 @@ async function processClosedPositions(client, queryAddress, positions) {
24758
24789
  //#endregion
24759
24790
  //#region src/panoptic/v2/reads/hedgeCapacity.ts
24760
24791
  const SCALE$1 = 10000000n;
24761
- const FEE_SCALE = 10000n;
24762
- const Q192 = 1n << 192n;
24792
+ const FEE_SCALE$1 = 10000n;
24793
+ const Q192$1 = 1n << 192n;
24763
24794
  const MASK128$1 = (1n << 128n) - 1n;
24764
- const ceilDiv$2 = (value, divisor) => (value + divisor - 1n) / divisor;
24795
+ const ceilDiv$3 = (value, divisor) => (value + divisor - 1n) / divisor;
24765
24796
  function accountHedgeDelta({ positionIds, balances, collateralDelta, tick, tickSpacing, assetIndex }) {
24766
24797
  return positionIds.reduce((sum$1, id, index) => {
24767
24798
  const balance = balances[index];
@@ -24781,8 +24812,8 @@ function accountHedgeDelta({ positionIds, balances, collateralDelta, tick, tickS
24781
24812
  function buildCapacityHedge({ delta, assetIndex, tick, tickSpacing, poolId, notionalFee, swapFee }) {
24782
24813
  const borrowToken = delta >= 0n ? assetIndex : assetIndex === 0n ? 1n : 0n;
24783
24814
  const receiveToken = borrowToken === 0n ? 1n : 0n;
24784
- const amount = delta >= 0n ? delta : ceilDiv$2((toVaultFrameAtTick(-delta, assetIndex, borrowToken, tick) + 1n) * 1000000n * FEE_SCALE, (1000000n - swapFee) * (FEE_SCALE - notionalFee));
24785
- const commission = ceilDiv$2(amount * notionalFee, FEE_SCALE);
24815
+ const amount = delta >= 0n ? delta : ceilDiv$3((toVaultFrameAtTick(-delta, assetIndex, borrowToken, tick) + 1n) * 1000000n * FEE_SCALE$1, (1000000n - swapFee) * (FEE_SCALE$1 - notionalFee));
24816
+ const commission = ceilDiv$3(amount * notionalFee, FEE_SCALE$1);
24786
24817
  const proceeds = toVaultFrameAtTick((amount - commission) * (1000000n - swapFee) / 1000000n, borrowToken, receiveToken, tick);
24787
24818
  const tokenId = addLegToTokenId(poolId, {
24788
24819
  index: 0n,
@@ -24814,7 +24845,7 @@ function hedgeMargin({ tokenData, balanceChanges, crossRatios, tick, buffer }) {
24814
24845
  const surplus1 = balances[1] > required1 ? (balances[1] - required1) * crossRatios[1] / SCALE$1 : 0n;
24815
24846
  const sqrt = tickToSqrtPriceX96(tick);
24816
24847
  const price = sqrt * sqrt;
24817
- const pairs = sqrt < 1n << 96n ? [[balances[0] + surplus1 * Q192 / price, required0], [balances[1] * Q192 / price + surplus0, ceilDiv$2(required1 * Q192, price)]] : [[balances[0] * price / Q192 + surplus1, ceilDiv$2(required0 * price, Q192)], [balances[1] + surplus0 * price / Q192, required1]];
24848
+ const pairs = sqrt < 1n << 96n ? [[balances[0] + surplus1 * Q192$1 / price, required0], [balances[1] * Q192$1 / price + surplus0, ceilDiv$3(required1 * Q192$1, price)]] : [[balances[0] * price / Q192$1 + surplus1, ceilDiv$3(required0 * price, Q192$1)], [balances[1] + surplus0 * price / Q192$1, required1]];
24818
24849
  const headroom = pairs.map(([balance, required]) => balance - required);
24819
24850
  return {
24820
24851
  solvent: balances.every((balance) => balance >= 0n) && headroom.every((value) => value >= 0n),
@@ -25027,7 +25058,7 @@ async function getHedgeLimits({ client, poolAddress, account, positionIds, asset
25027
25058
  if (hedge.amount > 0n && BigInt(legCount) >= maxLegs) return unavailable("leg-limit");
25028
25059
  const totalAssets = hedge.borrowToken === 0n ? total0 : total1;
25029
25060
  if (hedge.amount > 0n && (hedge.amount > MAX_SIZE || hedge.amount > borrowCapacity[Number(hedge.borrowToken)] || totalAssets === 0n)) return unavailable("capacity");
25030
- const projectedUtilization = currentUtilizations.map((util, i) => hedge.amount > 0n && BigInt(i) === hedge.borrowToken ? ceilDiv$2(util * totalAssets + hedge.amount * 10000n, totalAssets) : util);
25061
+ const projectedUtilization = currentUtilizations.map((util, i) => hedge.amount > 0n && BigInt(i) === hedge.borrowToken ? ceilDiv$3(util * totalAssets + hedge.amount * 10000n, totalAssets) : util);
25031
25062
  if (hedge.amount > 0n && projectedUtilization.some((util) => util > 10000n)) return unavailable("capacity");
25032
25063
  const global = projectedUtilization.map((util, i) => util > globalUtilizations[i] ? util : globalUtilizations[i]);
25033
25064
  const syntheticBalance = hedge.amount | projectedUtilization[0] << 128n | projectedUtilization[1] << 144n;
@@ -25119,6 +25150,90 @@ async function getHedgeLimits({ client, poolAddress, account, positionIds, asset
25119
25150
  };
25120
25151
  }
25121
25152
 
25153
+ //#endregion
25154
+ //#region src/panoptic/v2/reads/positionMintFunding.ts
25155
+ const Q96$2 = 1n << 96n;
25156
+ const Q192 = 1n << 192n;
25157
+ const BPS = 10000n;
25158
+ const FEE_SCALE = 1000000n;
25159
+ const max = (a, b) => a > b ? a : b;
25160
+ const ceilDiv$2 = (n, d) => n > 0n ? (n + d - 1n) / d : n / d;
25161
+ /**
25162
+ * Estimate deposit-independent mint funding, including settlement and commission.
25163
+ * Swaps use spot conversion with fees and slippage allowance; execution still needs a live quote.
25164
+ * Received tokens cover post-mint margin but cannot fund the other tracker's upfront payment.
25165
+ * Each requiredValue is the starting balance when funding entirely in that token.
25166
+ */
25167
+ function getPositionMintFunding(params) {
25168
+ const { tokenId, positionSize, sqrtPriceX96, valuationSqrtPriceX96, swapAtMint, commissionRate, swapFee, slippageBps, required0, required1 } = params;
25169
+ if (positionSize < 0n || sqrtPriceX96 <= 0n || valuationSqrtPriceX96 <= 0n || commissionRate < 0n || swapFee < 0n || swapFee >= FEE_SCALE || slippageBps < 0n || slippageBps >= BPS || required0 < 0n || required1 < 0n) throw new RangeError("Invalid mint funding inputs");
25170
+ const { legs, tickSpacing } = decodeTokenId(tokenId);
25171
+ const firstLeg = legs[0];
25172
+ if (!firstLeg || tickSpacing <= 0n) throw new RangeError("Invalid position");
25173
+ let paid0 = 0n;
25174
+ let paid1 = 0n;
25175
+ let itm0 = 0n;
25176
+ let itm1 = 0n;
25177
+ let notional0 = 0n;
25178
+ let notional1 = 0n;
25179
+ for (const leg of legs) {
25180
+ const { sqrtLower, sqrtUpper, liquidity } = getLegLiquidityRange(leg.width === 0n ? {
25181
+ ...leg,
25182
+ width: 2n
25183
+ } : leg, positionSize, tickSpacing);
25184
+ const round = !leg.isLong || leg.width === 0n ? ceilDiv$2 : (n, d) => n / d;
25185
+ const moved0 = round((liquidity << 96n) * (sqrtUpper - sqrtLower), sqrtUpper * sqrtLower);
25186
+ const moved1 = round(liquidity * (sqrtUpper - sqrtLower), Q96$2);
25187
+ const sign = leg.isLong ? -1n : 1n;
25188
+ let amm0 = 0n;
25189
+ let amm1 = 0n;
25190
+ if (leg.width > 0n) {
25191
+ const price = max(sqrtLower, sqrtPriceX96 < sqrtUpper ? sqrtPriceX96 : sqrtUpper);
25192
+ amm0 = sign * round((liquidity << 96n) * (sqrtUpper - price), sqrtUpper * price);
25193
+ amm1 = sign * round(liquidity * (price - sqrtLower), Q96$2);
25194
+ itm0 += leg.tokenType === 1n ? amm0 : 0n;
25195
+ itm1 += leg.tokenType === 0n ? amm1 : 0n;
25196
+ } else {
25197
+ itm0 -= leg.tokenType === 0n ? sign * moved0 : 0n;
25198
+ itm1 -= leg.tokenType === 1n ? sign * moved1 : 0n;
25199
+ }
25200
+ paid0 += amm0 - (leg.tokenType === 0n ? sign * moved0 : 0n);
25201
+ paid1 += amm1 - (leg.tokenType === 1n ? sign * moved1 : 0n);
25202
+ notional0 += leg.tokenType === 0n ? moved0 : 0n;
25203
+ notional1 += leg.tokenType === 1n ? moved1 : 0n;
25204
+ }
25205
+ if (swapAtMint && (itm0 !== 0n || itm1 !== 0n)) {
25206
+ const swapToken0 = itm0 !== 0n && (itm1 === 0n || firstLeg.asset === 0n);
25207
+ const priceSquared$1 = sqrtPriceX96 * sqrtPriceX96;
25208
+ const itm = swapToken0 ? itm0 : itm1;
25209
+ const numerator = swapToken0 ? priceSquared$1 : Q192;
25210
+ const denominator = swapToken0 ? Q192 : priceSquared$1;
25211
+ const retained$1 = (FEE_SCALE - swapFee) * (BPS - slippageBps);
25212
+ const scale$1 = FEE_SCALE * BPS;
25213
+ const payment = itm > 0n ? ceilDiv$2(itm * numerator * scale$1, denominator * retained$1) : itm * numerator * retained$1 / (denominator * scale$1);
25214
+ paid0 += swapToken0 ? -itm : payment;
25215
+ paid1 += swapToken0 ? payment : -itm;
25216
+ }
25217
+ paid0 += ceilDiv$2(notional0 * commissionRate, BPS);
25218
+ paid1 += ceilDiv$2(notional1 * commissionRate, BPS);
25219
+ const priceSquared = valuationSqrtPriceX96 * valuationSqrtPriceX96;
25220
+ const inToken0 = (amount0, amount1) => amount0 + ceilDiv$2(amount1 * Q192, priceSquared);
25221
+ const inToken1 = (amount0, amount1) => amount1 + ceilDiv$2(amount0 * priceSquared, Q192);
25222
+ const retained = (FEE_SCALE - swapFee) * (BPS - slippageBps);
25223
+ const scale = FEE_SCALE * BPS;
25224
+ const spotSquared = sqrtPriceX96 * sqrtPriceX96;
25225
+ const upfront0 = max(paid0, 0n) + ceilDiv$2(max(paid1, 0n) * Q192 * scale, spotSquared * retained);
25226
+ const upfront1 = max(paid1, 0n) + ceilDiv$2(max(paid0, 0n) * spotSquared * scale, Q192 * retained);
25227
+ const requiredValue0 = upfront0 + max(0n, inToken0(required0 - max(-paid0, 0n), required1 - max(-paid1, 0n)));
25228
+ const requiredValue1 = upfront1 + max(0n, inToken1(required0 - max(-paid0, 0n), required1 - max(-paid1, 0n)));
25229
+ return {
25230
+ paid0,
25231
+ paid1,
25232
+ requiredValue0,
25233
+ requiredValue1
25234
+ };
25235
+ }
25236
+
25122
25237
  //#endregion
25123
25238
  //#region src/panoptic/v2/sync/getSyncStatus.ts
25124
25239
  /**
@@ -31040,7 +31155,7 @@ const DEFAULT_INTERVAL_MS = 12000n;
31040
31155
  /**
31041
31156
  * Default maximum block range per poll.
31042
31157
  */
31043
- const DEFAULT_MAX_BLOCK_RANGE = 1000n;
31158
+ const DEFAULT_MAX_BLOCK_RANGE$1 = 1000n;
31044
31159
  /**
31045
31160
  * Create an HTTP polling-based event fetcher.
31046
31161
  *
@@ -31077,7 +31192,7 @@ const DEFAULT_MAX_BLOCK_RANGE = 1000n;
31077
31192
  * ```
31078
31193
  */
31079
31194
  function createEventPoller(params) {
31080
- const { client, poolAddress, collateralTracker0, collateralTracker1, riskEngineAddress, sfpmAddress, poolManagerAddress, eventTypes, onLogs, onError, intervalMs = DEFAULT_INTERVAL_MS, maxBlockRange = DEFAULT_MAX_BLOCK_RANGE, fromBlock } = params;
31195
+ const { client, poolAddress, collateralTracker0, collateralTracker1, riskEngineAddress, sfpmAddress, poolManagerAddress, eventTypes, onLogs, onError, intervalMs = DEFAULT_INTERVAL_MS, maxBlockRange = DEFAULT_MAX_BLOCK_RANGE$1, fromBlock } = params;
31081
31196
  let isRunning = false;
31082
31197
  let lastPolledBlock = fromBlock ?? 0n;
31083
31198
  let pollTimeout = null;
@@ -31265,6 +31380,1355 @@ function createEventPoller(params) {
31265
31380
  };
31266
31381
  }
31267
31382
 
31383
+ //#endregion
31384
+ //#region src/abis/UniswapV3Pool.ts
31385
+ const UniswapV3PoolAbi = [
31386
+ {
31387
+ inputs: [],
31388
+ stateMutability: "payable",
31389
+ type: "constructor"
31390
+ },
31391
+ {
31392
+ anonymous: false,
31393
+ inputs: [
31394
+ {
31395
+ indexed: true,
31396
+ internalType: "address",
31397
+ name: "owner",
31398
+ type: "address"
31399
+ },
31400
+ {
31401
+ indexed: true,
31402
+ internalType: "int24",
31403
+ name: "tickLower",
31404
+ type: "int24"
31405
+ },
31406
+ {
31407
+ indexed: true,
31408
+ internalType: "int24",
31409
+ name: "tickUpper",
31410
+ type: "int24"
31411
+ },
31412
+ {
31413
+ indexed: false,
31414
+ internalType: "uint128",
31415
+ name: "amount",
31416
+ type: "uint128"
31417
+ },
31418
+ {
31419
+ indexed: false,
31420
+ internalType: "uint256",
31421
+ name: "amount0",
31422
+ type: "uint256"
31423
+ },
31424
+ {
31425
+ indexed: false,
31426
+ internalType: "uint256",
31427
+ name: "amount1",
31428
+ type: "uint256"
31429
+ }
31430
+ ],
31431
+ name: "Burn",
31432
+ type: "event"
31433
+ },
31434
+ {
31435
+ anonymous: false,
31436
+ inputs: [
31437
+ {
31438
+ indexed: true,
31439
+ internalType: "address",
31440
+ name: "owner",
31441
+ type: "address"
31442
+ },
31443
+ {
31444
+ indexed: false,
31445
+ internalType: "address",
31446
+ name: "recipient",
31447
+ type: "address"
31448
+ },
31449
+ {
31450
+ indexed: true,
31451
+ internalType: "int24",
31452
+ name: "tickLower",
31453
+ type: "int24"
31454
+ },
31455
+ {
31456
+ indexed: true,
31457
+ internalType: "int24",
31458
+ name: "tickUpper",
31459
+ type: "int24"
31460
+ },
31461
+ {
31462
+ indexed: false,
31463
+ internalType: "uint128",
31464
+ name: "amount0",
31465
+ type: "uint128"
31466
+ },
31467
+ {
31468
+ indexed: false,
31469
+ internalType: "uint128",
31470
+ name: "amount1",
31471
+ type: "uint128"
31472
+ }
31473
+ ],
31474
+ name: "Collect",
31475
+ type: "event"
31476
+ },
31477
+ {
31478
+ anonymous: false,
31479
+ inputs: [
31480
+ {
31481
+ indexed: true,
31482
+ internalType: "address",
31483
+ name: "sender",
31484
+ type: "address"
31485
+ },
31486
+ {
31487
+ indexed: true,
31488
+ internalType: "address",
31489
+ name: "recipient",
31490
+ type: "address"
31491
+ },
31492
+ {
31493
+ indexed: false,
31494
+ internalType: "uint128",
31495
+ name: "amount0",
31496
+ type: "uint128"
31497
+ },
31498
+ {
31499
+ indexed: false,
31500
+ internalType: "uint128",
31501
+ name: "amount1",
31502
+ type: "uint128"
31503
+ }
31504
+ ],
31505
+ name: "CollectProtocol",
31506
+ type: "event"
31507
+ },
31508
+ {
31509
+ anonymous: false,
31510
+ inputs: [
31511
+ {
31512
+ indexed: true,
31513
+ internalType: "address",
31514
+ name: "sender",
31515
+ type: "address"
31516
+ },
31517
+ {
31518
+ indexed: true,
31519
+ internalType: "address",
31520
+ name: "recipient",
31521
+ type: "address"
31522
+ },
31523
+ {
31524
+ indexed: false,
31525
+ internalType: "uint256",
31526
+ name: "amount0",
31527
+ type: "uint256"
31528
+ },
31529
+ {
31530
+ indexed: false,
31531
+ internalType: "uint256",
31532
+ name: "amount1",
31533
+ type: "uint256"
31534
+ },
31535
+ {
31536
+ indexed: false,
31537
+ internalType: "uint256",
31538
+ name: "paid0",
31539
+ type: "uint256"
31540
+ },
31541
+ {
31542
+ indexed: false,
31543
+ internalType: "uint256",
31544
+ name: "paid1",
31545
+ type: "uint256"
31546
+ }
31547
+ ],
31548
+ name: "Flash",
31549
+ type: "event"
31550
+ },
31551
+ {
31552
+ anonymous: false,
31553
+ inputs: [{
31554
+ indexed: false,
31555
+ internalType: "uint16",
31556
+ name: "observationCardinalityNextOld",
31557
+ type: "uint16"
31558
+ }, {
31559
+ indexed: false,
31560
+ internalType: "uint16",
31561
+ name: "observationCardinalityNextNew",
31562
+ type: "uint16"
31563
+ }],
31564
+ name: "IncreaseObservationCardinalityNext",
31565
+ type: "event"
31566
+ },
31567
+ {
31568
+ anonymous: false,
31569
+ inputs: [{
31570
+ indexed: false,
31571
+ internalType: "uint160",
31572
+ name: "sqrtPriceX96",
31573
+ type: "uint160"
31574
+ }, {
31575
+ indexed: false,
31576
+ internalType: "int24",
31577
+ name: "tick",
31578
+ type: "int24"
31579
+ }],
31580
+ name: "Initialize",
31581
+ type: "event"
31582
+ },
31583
+ {
31584
+ anonymous: false,
31585
+ inputs: [
31586
+ {
31587
+ indexed: false,
31588
+ internalType: "address",
31589
+ name: "sender",
31590
+ type: "address"
31591
+ },
31592
+ {
31593
+ indexed: true,
31594
+ internalType: "address",
31595
+ name: "owner",
31596
+ type: "address"
31597
+ },
31598
+ {
31599
+ indexed: true,
31600
+ internalType: "int24",
31601
+ name: "tickLower",
31602
+ type: "int24"
31603
+ },
31604
+ {
31605
+ indexed: true,
31606
+ internalType: "int24",
31607
+ name: "tickUpper",
31608
+ type: "int24"
31609
+ },
31610
+ {
31611
+ indexed: false,
31612
+ internalType: "uint128",
31613
+ name: "amount",
31614
+ type: "uint128"
31615
+ },
31616
+ {
31617
+ indexed: false,
31618
+ internalType: "uint256",
31619
+ name: "amount0",
31620
+ type: "uint256"
31621
+ },
31622
+ {
31623
+ indexed: false,
31624
+ internalType: "uint256",
31625
+ name: "amount1",
31626
+ type: "uint256"
31627
+ }
31628
+ ],
31629
+ name: "Mint",
31630
+ type: "event"
31631
+ },
31632
+ {
31633
+ anonymous: false,
31634
+ inputs: [
31635
+ {
31636
+ indexed: false,
31637
+ internalType: "uint8",
31638
+ name: "feeProtocol0Old",
31639
+ type: "uint8"
31640
+ },
31641
+ {
31642
+ indexed: false,
31643
+ internalType: "uint8",
31644
+ name: "feeProtocol1Old",
31645
+ type: "uint8"
31646
+ },
31647
+ {
31648
+ indexed: false,
31649
+ internalType: "uint8",
31650
+ name: "feeProtocol0New",
31651
+ type: "uint8"
31652
+ },
31653
+ {
31654
+ indexed: false,
31655
+ internalType: "uint8",
31656
+ name: "feeProtocol1New",
31657
+ type: "uint8"
31658
+ }
31659
+ ],
31660
+ name: "SetFeeProtocol",
31661
+ type: "event"
31662
+ },
31663
+ {
31664
+ anonymous: false,
31665
+ inputs: [
31666
+ {
31667
+ indexed: true,
31668
+ internalType: "address",
31669
+ name: "sender",
31670
+ type: "address"
31671
+ },
31672
+ {
31673
+ indexed: true,
31674
+ internalType: "address",
31675
+ name: "recipient",
31676
+ type: "address"
31677
+ },
31678
+ {
31679
+ indexed: false,
31680
+ internalType: "int256",
31681
+ name: "amount0",
31682
+ type: "int256"
31683
+ },
31684
+ {
31685
+ indexed: false,
31686
+ internalType: "int256",
31687
+ name: "amount1",
31688
+ type: "int256"
31689
+ },
31690
+ {
31691
+ indexed: false,
31692
+ internalType: "uint160",
31693
+ name: "sqrtPriceX96",
31694
+ type: "uint160"
31695
+ },
31696
+ {
31697
+ indexed: false,
31698
+ internalType: "uint128",
31699
+ name: "liquidity",
31700
+ type: "uint128"
31701
+ },
31702
+ {
31703
+ indexed: false,
31704
+ internalType: "int24",
31705
+ name: "tick",
31706
+ type: "int24"
31707
+ }
31708
+ ],
31709
+ name: "Swap",
31710
+ type: "event"
31711
+ },
31712
+ {
31713
+ inputs: [
31714
+ {
31715
+ internalType: "int24",
31716
+ name: "tickLower",
31717
+ type: "int24"
31718
+ },
31719
+ {
31720
+ internalType: "int24",
31721
+ name: "tickUpper",
31722
+ type: "int24"
31723
+ },
31724
+ {
31725
+ internalType: "uint128",
31726
+ name: "amount",
31727
+ type: "uint128"
31728
+ }
31729
+ ],
31730
+ name: "burn",
31731
+ outputs: [{
31732
+ internalType: "uint256",
31733
+ name: "amount0",
31734
+ type: "uint256"
31735
+ }, {
31736
+ internalType: "uint256",
31737
+ name: "amount1",
31738
+ type: "uint256"
31739
+ }],
31740
+ stateMutability: "payable",
31741
+ type: "function"
31742
+ },
31743
+ {
31744
+ inputs: [
31745
+ {
31746
+ internalType: "address",
31747
+ name: "recipient",
31748
+ type: "address"
31749
+ },
31750
+ {
31751
+ internalType: "int24",
31752
+ name: "tickLower",
31753
+ type: "int24"
31754
+ },
31755
+ {
31756
+ internalType: "int24",
31757
+ name: "tickUpper",
31758
+ type: "int24"
31759
+ },
31760
+ {
31761
+ internalType: "uint128",
31762
+ name: "amount0Requested",
31763
+ type: "uint128"
31764
+ },
31765
+ {
31766
+ internalType: "uint128",
31767
+ name: "amount1Requested",
31768
+ type: "uint128"
31769
+ }
31770
+ ],
31771
+ name: "collect",
31772
+ outputs: [{
31773
+ internalType: "uint128",
31774
+ name: "amount0",
31775
+ type: "uint128"
31776
+ }, {
31777
+ internalType: "uint128",
31778
+ name: "amount1",
31779
+ type: "uint128"
31780
+ }],
31781
+ stateMutability: "payable",
31782
+ type: "function"
31783
+ },
31784
+ {
31785
+ inputs: [
31786
+ {
31787
+ internalType: "address",
31788
+ name: "recipient",
31789
+ type: "address"
31790
+ },
31791
+ {
31792
+ internalType: "uint128",
31793
+ name: "amount0Requested",
31794
+ type: "uint128"
31795
+ },
31796
+ {
31797
+ internalType: "uint128",
31798
+ name: "amount1Requested",
31799
+ type: "uint128"
31800
+ }
31801
+ ],
31802
+ name: "collectProtocol",
31803
+ outputs: [{
31804
+ internalType: "uint128",
31805
+ name: "amount0",
31806
+ type: "uint128"
31807
+ }, {
31808
+ internalType: "uint128",
31809
+ name: "amount1",
31810
+ type: "uint128"
31811
+ }],
31812
+ stateMutability: "payable",
31813
+ type: "function"
31814
+ },
31815
+ {
31816
+ inputs: [],
31817
+ name: "factory",
31818
+ outputs: [{
31819
+ internalType: "address",
31820
+ name: "",
31821
+ type: "address"
31822
+ }],
31823
+ stateMutability: "view",
31824
+ type: "function"
31825
+ },
31826
+ {
31827
+ inputs: [],
31828
+ name: "fee",
31829
+ outputs: [{
31830
+ internalType: "uint24",
31831
+ name: "",
31832
+ type: "uint24"
31833
+ }],
31834
+ stateMutability: "view",
31835
+ type: "function"
31836
+ },
31837
+ {
31838
+ inputs: [],
31839
+ name: "feeGrowthGlobal0X128",
31840
+ outputs: [{
31841
+ internalType: "uint256",
31842
+ name: "",
31843
+ type: "uint256"
31844
+ }],
31845
+ stateMutability: "view",
31846
+ type: "function"
31847
+ },
31848
+ {
31849
+ inputs: [],
31850
+ name: "feeGrowthGlobal1X128",
31851
+ outputs: [{
31852
+ internalType: "uint256",
31853
+ name: "",
31854
+ type: "uint256"
31855
+ }],
31856
+ stateMutability: "view",
31857
+ type: "function"
31858
+ },
31859
+ {
31860
+ inputs: [
31861
+ {
31862
+ internalType: "address",
31863
+ name: "recipient",
31864
+ type: "address"
31865
+ },
31866
+ {
31867
+ internalType: "uint256",
31868
+ name: "amount0",
31869
+ type: "uint256"
31870
+ },
31871
+ {
31872
+ internalType: "uint256",
31873
+ name: "amount1",
31874
+ type: "uint256"
31875
+ },
31876
+ {
31877
+ internalType: "bytes",
31878
+ name: "data",
31879
+ type: "bytes"
31880
+ }
31881
+ ],
31882
+ name: "flash",
31883
+ outputs: [],
31884
+ stateMutability: "payable",
31885
+ type: "function"
31886
+ },
31887
+ {
31888
+ inputs: [{
31889
+ internalType: "uint16",
31890
+ name: "observationCardinalityNext",
31891
+ type: "uint16"
31892
+ }],
31893
+ name: "increaseObservationCardinalityNext",
31894
+ outputs: [],
31895
+ stateMutability: "payable",
31896
+ type: "function"
31897
+ },
31898
+ {
31899
+ inputs: [{
31900
+ internalType: "uint160",
31901
+ name: "sqrtPriceX96",
31902
+ type: "uint160"
31903
+ }],
31904
+ name: "initialize",
31905
+ outputs: [],
31906
+ stateMutability: "payable",
31907
+ type: "function"
31908
+ },
31909
+ {
31910
+ inputs: [],
31911
+ name: "liquidity",
31912
+ outputs: [{
31913
+ internalType: "uint128",
31914
+ name: "",
31915
+ type: "uint128"
31916
+ }],
31917
+ stateMutability: "view",
31918
+ type: "function"
31919
+ },
31920
+ {
31921
+ inputs: [],
31922
+ name: "maxLiquidityPerTick",
31923
+ outputs: [{
31924
+ internalType: "uint128",
31925
+ name: "",
31926
+ type: "uint128"
31927
+ }],
31928
+ stateMutability: "view",
31929
+ type: "function"
31930
+ },
31931
+ {
31932
+ inputs: [
31933
+ {
31934
+ internalType: "address",
31935
+ name: "recipient",
31936
+ type: "address"
31937
+ },
31938
+ {
31939
+ internalType: "int24",
31940
+ name: "tickLower",
31941
+ type: "int24"
31942
+ },
31943
+ {
31944
+ internalType: "int24",
31945
+ name: "tickUpper",
31946
+ type: "int24"
31947
+ },
31948
+ {
31949
+ internalType: "uint128",
31950
+ name: "amount",
31951
+ type: "uint128"
31952
+ },
31953
+ {
31954
+ internalType: "bytes",
31955
+ name: "data",
31956
+ type: "bytes"
31957
+ }
31958
+ ],
31959
+ name: "mint",
31960
+ outputs: [{
31961
+ internalType: "uint256",
31962
+ name: "amount0",
31963
+ type: "uint256"
31964
+ }, {
31965
+ internalType: "uint256",
31966
+ name: "amount1",
31967
+ type: "uint256"
31968
+ }],
31969
+ stateMutability: "payable",
31970
+ type: "function"
31971
+ },
31972
+ {
31973
+ inputs: [{
31974
+ internalType: "uint256",
31975
+ name: "",
31976
+ type: "uint256"
31977
+ }],
31978
+ name: "observations",
31979
+ outputs: [
31980
+ {
31981
+ internalType: "uint32",
31982
+ name: "blockTimestamp",
31983
+ type: "uint32"
31984
+ },
31985
+ {
31986
+ internalType: "int56",
31987
+ name: "tickCumulative",
31988
+ type: "int56"
31989
+ },
31990
+ {
31991
+ internalType: "uint160",
31992
+ name: "secondsPerLiquidityCumulativeX128",
31993
+ type: "uint160"
31994
+ },
31995
+ {
31996
+ internalType: "bool",
31997
+ name: "initialized",
31998
+ type: "bool"
31999
+ }
32000
+ ],
32001
+ stateMutability: "view",
32002
+ type: "function"
32003
+ },
32004
+ {
32005
+ inputs: [{
32006
+ internalType: "uint32[]",
32007
+ name: "secondsAgos",
32008
+ type: "uint32[]"
32009
+ }],
32010
+ name: "observe",
32011
+ outputs: [{
32012
+ internalType: "int56[]",
32013
+ name: "tickCumulatives",
32014
+ type: "int56[]"
32015
+ }, {
32016
+ internalType: "uint160[]",
32017
+ name: "secondsPerLiquidityCumulativeX128s",
32018
+ type: "uint160[]"
32019
+ }],
32020
+ stateMutability: "view",
32021
+ type: "function"
32022
+ },
32023
+ {
32024
+ inputs: [{
32025
+ internalType: "bytes32",
32026
+ name: "",
32027
+ type: "bytes32"
32028
+ }],
32029
+ name: "positions",
32030
+ outputs: [
32031
+ {
32032
+ internalType: "uint128",
32033
+ name: "liquidity",
32034
+ type: "uint128"
32035
+ },
32036
+ {
32037
+ internalType: "uint256",
32038
+ name: "feeGrowthInside0LastX128",
32039
+ type: "uint256"
32040
+ },
32041
+ {
32042
+ internalType: "uint256",
32043
+ name: "feeGrowthInside1LastX128",
32044
+ type: "uint256"
32045
+ },
32046
+ {
32047
+ internalType: "uint128",
32048
+ name: "tokensOwed0",
32049
+ type: "uint128"
32050
+ },
32051
+ {
32052
+ internalType: "uint128",
32053
+ name: "tokensOwed1",
32054
+ type: "uint128"
32055
+ }
32056
+ ],
32057
+ stateMutability: "view",
32058
+ type: "function"
32059
+ },
32060
+ {
32061
+ inputs: [],
32062
+ name: "protocolFees",
32063
+ outputs: [{
32064
+ internalType: "uint128",
32065
+ name: "token0",
32066
+ type: "uint128"
32067
+ }, {
32068
+ internalType: "uint128",
32069
+ name: "token1",
32070
+ type: "uint128"
32071
+ }],
32072
+ stateMutability: "view",
32073
+ type: "function"
32074
+ },
32075
+ {
32076
+ inputs: [{
32077
+ internalType: "uint8",
32078
+ name: "feeProtocol0",
32079
+ type: "uint8"
32080
+ }, {
32081
+ internalType: "uint8",
32082
+ name: "feeProtocol1",
32083
+ type: "uint8"
32084
+ }],
32085
+ name: "setFeeProtocol",
32086
+ outputs: [],
32087
+ stateMutability: "payable",
32088
+ type: "function"
32089
+ },
32090
+ {
32091
+ inputs: [],
32092
+ name: "slot0",
32093
+ outputs: [
32094
+ {
32095
+ internalType: "uint160",
32096
+ name: "sqrtPriceX96",
32097
+ type: "uint160"
32098
+ },
32099
+ {
32100
+ internalType: "int24",
32101
+ name: "tick",
32102
+ type: "int24"
32103
+ },
32104
+ {
32105
+ internalType: "uint16",
32106
+ name: "observationIndex",
32107
+ type: "uint16"
32108
+ },
32109
+ {
32110
+ internalType: "uint16",
32111
+ name: "observationCardinality",
32112
+ type: "uint16"
32113
+ },
32114
+ {
32115
+ internalType: "uint16",
32116
+ name: "observationCardinalityNext",
32117
+ type: "uint16"
32118
+ },
32119
+ {
32120
+ internalType: "uint8",
32121
+ name: "feeProtocol",
32122
+ type: "uint8"
32123
+ },
32124
+ {
32125
+ internalType: "bool",
32126
+ name: "unlocked",
32127
+ type: "bool"
32128
+ }
32129
+ ],
32130
+ stateMutability: "view",
32131
+ type: "function"
32132
+ },
32133
+ {
32134
+ inputs: [{
32135
+ internalType: "int24",
32136
+ name: "tickLower",
32137
+ type: "int24"
32138
+ }, {
32139
+ internalType: "int24",
32140
+ name: "tickUpper",
32141
+ type: "int24"
32142
+ }],
32143
+ name: "snapshotCumulativesInside",
32144
+ outputs: [
32145
+ {
32146
+ internalType: "int56",
32147
+ name: "tickCumulativeInside",
32148
+ type: "int56"
32149
+ },
32150
+ {
32151
+ internalType: "uint160",
32152
+ name: "secondsPerLiquidityInsideX128",
32153
+ type: "uint160"
32154
+ },
32155
+ {
32156
+ internalType: "uint32",
32157
+ name: "secondsInside",
32158
+ type: "uint32"
32159
+ }
32160
+ ],
32161
+ stateMutability: "view",
32162
+ type: "function"
32163
+ },
32164
+ {
32165
+ inputs: [
32166
+ {
32167
+ internalType: "address",
32168
+ name: "recipient",
32169
+ type: "address"
32170
+ },
32171
+ {
32172
+ internalType: "bool",
32173
+ name: "zeroForOne",
32174
+ type: "bool"
32175
+ },
32176
+ {
32177
+ internalType: "int256",
32178
+ name: "amountSpecified",
32179
+ type: "int256"
32180
+ },
32181
+ {
32182
+ internalType: "uint160",
32183
+ name: "sqrtPriceLimitX96",
32184
+ type: "uint160"
32185
+ },
32186
+ {
32187
+ internalType: "bytes",
32188
+ name: "data",
32189
+ type: "bytes"
32190
+ }
32191
+ ],
32192
+ name: "swap",
32193
+ outputs: [{
32194
+ internalType: "int256",
32195
+ name: "amount0",
32196
+ type: "int256"
32197
+ }, {
32198
+ internalType: "int256",
32199
+ name: "amount1",
32200
+ type: "int256"
32201
+ }],
32202
+ stateMutability: "payable",
32203
+ type: "function"
32204
+ },
32205
+ {
32206
+ inputs: [{
32207
+ internalType: "int16",
32208
+ name: "",
32209
+ type: "int16"
32210
+ }],
32211
+ name: "tickBitmap",
32212
+ outputs: [{
32213
+ internalType: "uint256",
32214
+ name: "",
32215
+ type: "uint256"
32216
+ }],
32217
+ stateMutability: "view",
32218
+ type: "function"
32219
+ },
32220
+ {
32221
+ inputs: [],
32222
+ name: "tickSpacing",
32223
+ outputs: [{
32224
+ internalType: "int24",
32225
+ name: "",
32226
+ type: "int24"
32227
+ }],
32228
+ stateMutability: "view",
32229
+ type: "function"
32230
+ },
32231
+ {
32232
+ inputs: [{
32233
+ internalType: "int24",
32234
+ name: "",
32235
+ type: "int24"
32236
+ }],
32237
+ name: "ticks",
32238
+ outputs: [
32239
+ {
32240
+ internalType: "uint128",
32241
+ name: "liquidityGross",
32242
+ type: "uint128"
32243
+ },
32244
+ {
32245
+ internalType: "int128",
32246
+ name: "liquidityNet",
32247
+ type: "int128"
32248
+ },
32249
+ {
32250
+ internalType: "uint256",
32251
+ name: "feeGrowthOutside0X128",
32252
+ type: "uint256"
32253
+ },
32254
+ {
32255
+ internalType: "uint256",
32256
+ name: "feeGrowthOutside1X128",
32257
+ type: "uint256"
32258
+ },
32259
+ {
32260
+ internalType: "int56",
32261
+ name: "tickCumulativeOutside",
32262
+ type: "int56"
32263
+ },
32264
+ {
32265
+ internalType: "uint160",
32266
+ name: "secondsPerLiquidityOutsideX128",
32267
+ type: "uint160"
32268
+ },
32269
+ {
32270
+ internalType: "uint32",
32271
+ name: "secondsOutside",
32272
+ type: "uint32"
32273
+ },
32274
+ {
32275
+ internalType: "bool",
32276
+ name: "initialized",
32277
+ type: "bool"
32278
+ }
32279
+ ],
32280
+ stateMutability: "view",
32281
+ type: "function"
32282
+ },
32283
+ {
32284
+ inputs: [],
32285
+ name: "token0",
32286
+ outputs: [{
32287
+ internalType: "address",
32288
+ name: "",
32289
+ type: "address"
32290
+ }],
32291
+ stateMutability: "view",
32292
+ type: "function"
32293
+ },
32294
+ {
32295
+ inputs: [],
32296
+ name: "token1",
32297
+ outputs: [{
32298
+ internalType: "address",
32299
+ name: "",
32300
+ type: "address"
32301
+ }],
32302
+ stateMutability: "view",
32303
+ type: "function"
32304
+ }
32305
+ ];
32306
+
32307
+ //#endregion
32308
+ //#region src/panoptic/v2/events/poolSwapStream.ts
32309
+ const DEFAULT_POLL_INTERVAL_MS$1 = 3e3;
32310
+ const FAILURE_WINDOW_MS = 3e4;
32311
+ const FAILURES_BEFORE_POLL = 3;
32312
+ const STREAM_RETRY_MIN_MS = 15e3;
32313
+ const STREAM_RETRY_MAX_MS = 3e5;
32314
+ const RESYNC_JITTER_MS = 2e3;
32315
+ const EVENT_SOURCE_CLOSED = 2;
32316
+ function parseRecord(data) {
32317
+ const value = JSON.parse(data);
32318
+ if (typeof value !== "object" || value === null) throw new Error("Malformed stream frame");
32319
+ return value;
32320
+ }
32321
+ function bigintField(record, field) {
32322
+ const value = record[field];
32323
+ if (typeof value !== "string") throw new Error(`Stream frame is missing ${field}`);
32324
+ return BigInt(value);
32325
+ }
32326
+ function numberField(record, field) {
32327
+ const value = record[field];
32328
+ if (typeof value !== "number") throw new Error(`Stream frame is missing ${field}`);
32329
+ return value;
32330
+ }
32331
+ function parseStreamedKey(data) {
32332
+ const record = parseRecord(data);
32333
+ return {
32334
+ blockNumber: bigintField(record, "blockNumber"),
32335
+ logIndex: numberField(record, "logIndex")
32336
+ };
32337
+ }
32338
+ function parseStreamedSwap(data) {
32339
+ const record = parseRecord(data);
32340
+ const transactionHash = record.transactionHash;
32341
+ if (typeof transactionHash !== "string") throw new Error("Stream frame is missing transactionHash");
32342
+ return {
32343
+ ...parseStreamedKey(data),
32344
+ timestamp: bigintField(record, "timestamp"),
32345
+ transactionHash,
32346
+ tick: numberField(record, "tick"),
32347
+ amount0: bigintField(record, "amount0"),
32348
+ amount1: bigintField(record, "amount1"),
32349
+ sqrtPriceX96: bigintField(record, "sqrtPriceX96"),
32350
+ liquidity: bigintField(record, "liquidity")
32351
+ };
32352
+ }
32353
+ function parseHead(data) {
32354
+ return bigintField(parseRecord(data ?? ""), "head");
32355
+ }
32356
+ function defaultEventSource() {
32357
+ const EventSourceCtor = globalThis.EventSource;
32358
+ return EventSourceCtor && ((url) => new EventSourceCtor(url));
32359
+ }
32360
+ function toError$1(error) {
32361
+ return error instanceof Error ? error : new Error(String(error));
32362
+ }
32363
+ /**
32364
+ * Stream a pool's swaps from the relay at `streamUrl`.
32365
+ *
32366
+ * Every `ready`/`resync` frame carries the relay's head; swaps from the cursor up
32367
+ * to that head are fetched over HTTP so nothing is lost across reconnects. A
32368
+ * stream that closes, or errors three times in 30 s, is replaced by HTTP polling
32369
+ * and retried with backoff; one that closes before ever opening is not retried.
32370
+ */
32371
+ function streamPoolSwaps(params) {
32372
+ const { client, pool, fromBlock, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS$1, maxBlockRange = DEFAULT_MAX_BLOCK_RANGE, streamUrl, onSwaps, onError, onRemoved, onTransport, eventSource = defaultEventSource() } = params;
32373
+ let running = true;
32374
+ let cursor = fromBlock === void 0 ? void 0 : fromBlock - 1n;
32375
+ let transport = "off";
32376
+ let failures = [];
32377
+ let source;
32378
+ let poller;
32379
+ let retryTimer;
32380
+ let retryDelayMs = STREAM_RETRY_MIN_MS;
32381
+ let catchUpTimer;
32382
+ let catchUpTarget;
32383
+ let catchingUp = false;
32384
+ let everOpened = false;
32385
+ const setTransport = (next) => {
32386
+ if (next === transport) return;
32387
+ transport = next;
32388
+ onTransport?.(next);
32389
+ };
32390
+ const advance = (block) => {
32391
+ if (block !== void 0 && (cursor === void 0 || block > cursor)) cursor = block;
32392
+ };
32393
+ const report = (error) => {
32394
+ if (running) onError?.(toError$1(error));
32395
+ };
32396
+ const catchUpPending = () => catchingUp || catchUpTarget !== void 0;
32397
+ const runCatchUp = async () => {
32398
+ catchingUp = true;
32399
+ while (running && catchUpTarget !== void 0) {
32400
+ const head = catchUpTarget;
32401
+ catchUpTarget = void 0;
32402
+ if (cursor === void 0) {
32403
+ cursor = head;
32404
+ continue;
32405
+ }
32406
+ try {
32407
+ const { swaps } = await fetchPoolSwaps(client, pool, cursor + 1n, head, maxBlockRange);
32408
+ if (!running) break;
32409
+ const first = swaps[0];
32410
+ const last = swaps[swaps.length - 1];
32411
+ if (first && last) onSwaps(swaps, {
32412
+ fromBlock: first.blockNumber,
32413
+ toBlock: last.blockNumber
32414
+ });
32415
+ advance(head);
32416
+ } catch (error) {
32417
+ report(error);
32418
+ if (catchUpTarget === void 0 || catchUpTarget < head) catchUpTarget = head;
32419
+ catchingUp = false;
32420
+ catchUpTimer = setTimeout(() => void runCatchUp(), pollIntervalMs);
32421
+ return;
32422
+ }
32423
+ }
32424
+ catchingUp = false;
32425
+ };
32426
+ const catchUp = (head, delayMs = 0) => {
32427
+ if (catchUpTarget === void 0 || head > catchUpTarget) catchUpTarget = head;
32428
+ if (catchingUp) return;
32429
+ if (catchUpTimer !== void 0) clearTimeout(catchUpTimer);
32430
+ catchUpTimer = setTimeout(() => {
32431
+ catchUpTimer = void 0;
32432
+ runCatchUp();
32433
+ }, delayMs);
32434
+ };
32435
+ const startPolling = () => {
32436
+ if (poller) return;
32437
+ poller = watchPoolSwaps({
32438
+ client,
32439
+ pool,
32440
+ fromBlock: cursor === void 0 ? void 0 : cursor + 1n,
32441
+ pollIntervalMs,
32442
+ maxBlockRange,
32443
+ onSwaps,
32444
+ onError
32445
+ });
32446
+ setTransport("poll");
32447
+ };
32448
+ const stopPolling = () => {
32449
+ if (!poller) return;
32450
+ advance(poller.lastScannedBlock());
32451
+ poller.stop();
32452
+ poller = void 0;
32453
+ };
32454
+ const closeStream = () => {
32455
+ source?.close();
32456
+ source = void 0;
32457
+ };
32458
+ const scheduleStreamRetry = () => {
32459
+ retryTimer = setTimeout(() => {
32460
+ retryTimer = void 0;
32461
+ if (running) openStream();
32462
+ }, retryDelayMs);
32463
+ retryDelayMs = Math.min(retryDelayMs * 2, STREAM_RETRY_MAX_MS);
32464
+ };
32465
+ const openStream = () => {
32466
+ if (!eventSource) {
32467
+ startPolling();
32468
+ return;
32469
+ }
32470
+ const es = eventSource(streamUrl);
32471
+ source = es;
32472
+ failures = [];
32473
+ let opened = false;
32474
+ const listen = (type, handle) => es.addEventListener(type, (event) => {
32475
+ if (!running || source !== es) return;
32476
+ try {
32477
+ handle(event.data);
32478
+ } catch (error) {
32479
+ report(error);
32480
+ }
32481
+ });
32482
+ listen("open", () => {
32483
+ opened = true;
32484
+ everOpened = true;
32485
+ failures = [];
32486
+ retryDelayMs = STREAM_RETRY_MIN_MS;
32487
+ });
32488
+ listen("ready", (data) => {
32489
+ const head = parseHead(data);
32490
+ stopPolling();
32491
+ setTransport("stream");
32492
+ catchUp(head);
32493
+ });
32494
+ listen("resync", (data) => {
32495
+ catchUp(parseHead(data), Math.random() * RESYNC_JITTER_MS);
32496
+ });
32497
+ listen("swap", (data) => {
32498
+ const swap = parseStreamedSwap(data ?? "");
32499
+ onSwaps([swap], {
32500
+ fromBlock: swap.blockNumber,
32501
+ toBlock: swap.blockNumber
32502
+ });
32503
+ if (!catchUpPending()) advance(swap.blockNumber);
32504
+ });
32505
+ listen("removed", (data) => {
32506
+ onRemoved?.(parseStreamedKey(data ?? ""));
32507
+ });
32508
+ listen("error", () => {
32509
+ const now = Date.now();
32510
+ failures = failures.filter((at) => now - at < FAILURE_WINDOW_MS);
32511
+ failures.push(now);
32512
+ const closed = es.readyState === EVENT_SOURCE_CLOSED;
32513
+ if (!closed && failures.length < FAILURES_BEFORE_POLL) return;
32514
+ closeStream();
32515
+ startPolling();
32516
+ if (closed && !opened && !everOpened) return;
32517
+ scheduleStreamRetry();
32518
+ });
32519
+ };
32520
+ openStream();
32521
+ return {
32522
+ stop() {
32523
+ running = false;
32524
+ closeStream();
32525
+ stopPolling();
32526
+ if (retryTimer !== void 0) clearTimeout(retryTimer);
32527
+ if (catchUpTimer !== void 0) clearTimeout(catchUpTimer);
32528
+ setTransport("off");
32529
+ },
32530
+ lastScannedBlock: () => cursor,
32531
+ transport: () => transport
32532
+ };
32533
+ }
32534
+
32535
+ //#endregion
32536
+ //#region src/panoptic/v2/events/poolSwaps.ts
32537
+ const DEFAULT_POLL_INTERVAL_MS = 3e3;
32538
+ const DEFAULT_MAX_BLOCK_RANGE = 2000n;
32539
+ const SHARED_BUFFER_LIMIT = 4096;
32540
+ /**
32541
+ * Parse a decoded v3 `UniswapV3Pool.Swap` or v4 `PoolManager.Swap` log.
32542
+ */
32543
+ function parseSwapLog(log, timestamp) {
32544
+ if (log.blockNumber === null || log.logIndex === null || log.transactionHash === null) throw new Error("Cannot parse a pending Swap log");
32545
+ const args = log.args;
32546
+ return {
32547
+ blockNumber: log.blockNumber,
32548
+ logIndex: log.logIndex,
32549
+ timestamp,
32550
+ transactionHash: log.transactionHash,
32551
+ tick: Number(args.tick),
32552
+ amount0: args.amount0,
32553
+ amount1: args.amount1,
32554
+ sqrtPriceX96: args.sqrtPriceX96,
32555
+ liquidity: args.liquidity
32556
+ };
32557
+ }
32558
+ function toError(error) {
32559
+ return error instanceof Error ? error : new Error(String(error));
32560
+ }
32561
+ async function fetchSwapLogs(client, pool, fromBlock, toBlock) {
32562
+ if (pool.version === "v3") return client.getContractEvents({
32563
+ address: pool.poolAddress,
32564
+ abi: UniswapV3PoolAbi,
32565
+ eventName: "Swap",
32566
+ fromBlock,
32567
+ toBlock
32568
+ });
32569
+ return client.getContractEvents({
32570
+ address: pool.poolManager,
32571
+ abi: poolManagerAbi,
32572
+ eventName: "Swap",
32573
+ args: { id: pool.poolId },
32574
+ fromBlock,
32575
+ toBlock
32576
+ });
32577
+ }
32578
+ async function fetchSwaps(client, pool, fromBlock, toBlock) {
32579
+ const logs = await fetchSwapLogs(client, pool, fromBlock, toBlock);
32580
+ if (logs.length === 0) return [];
32581
+ const blockNumbers = [...new Set(logs.flatMap((log) => log.blockNumber === null ? [] : [log.blockNumber]))];
32582
+ const blocks = await Promise.all(blockNumbers.map((blockNumber) => client.getBlock({ blockNumber })));
32583
+ const timestamps = new Map(blocks.map((block, i) => [blockNumbers[i], block.timestamp]));
32584
+ return logs.map((log) => parseSwapLog(log, timestamps.get(log.blockNumber ?? -1n) ?? 0n)).sort((a, b) => a.blockNumber === b.blockNumber ? a.logIndex - b.logIndex : a.blockNumber < b.blockNumber ? -1 : 1);
32585
+ }
32586
+ /**
32587
+ * Fetch a pool's swaps in `[fromBlock, toBlock]` (default: the current head), in
32588
+ * chain order. Returns no swaps when `fromBlock > toBlock`.
32589
+ */
32590
+ async function fetchPoolSwaps(client, pool, fromBlock, toBlock, maxBlockRange = DEFAULT_MAX_BLOCK_RANGE) {
32591
+ const end = toBlock ?? await client.getBlockNumber();
32592
+ const swaps = [];
32593
+ for (let from = fromBlock; from <= end; from += maxBlockRange) {
32594
+ const to = from + maxBlockRange - 1n < end ? from + maxBlockRange - 1n : end;
32595
+ swaps.push(...await fetchSwaps(client, pool, from, to));
32596
+ }
32597
+ return {
32598
+ swaps,
32599
+ toBlock: end
32600
+ };
32601
+ }
32602
+ /**
32603
+ * Poll a single pool's `Swap` logs with `eth_getLogs`, timestamped by block.
32604
+ *
32605
+ * Works over plain HTTP (no filters or websockets). A chunk that fails is retried on
32606
+ * the next tick; errors never stop the loop.
32607
+ */
32608
+ function watchPoolSwaps(params) {
32609
+ const { client, pool, fromBlock, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS, maxBlockRange = DEFAULT_MAX_BLOCK_RANGE, onSwaps, onError } = params;
32610
+ let running = true;
32611
+ let lastScanned;
32612
+ let timer;
32613
+ const poll = async () => {
32614
+ try {
32615
+ const head = await client.getBlockNumber();
32616
+ let from = lastScanned !== void 0 ? lastScanned + 1n : fromBlock ?? head;
32617
+ while (running && from <= head) {
32618
+ const to = from + maxBlockRange - 1n < head ? from + maxBlockRange - 1n : head;
32619
+ const swaps = await fetchSwaps(client, pool, from, to);
32620
+ if (!running) return;
32621
+ if (swaps.length > 0) onSwaps(swaps, {
32622
+ fromBlock: from,
32623
+ toBlock: to
32624
+ });
32625
+ lastScanned = to;
32626
+ from = to + 1n;
32627
+ }
32628
+ } catch (error) {
32629
+ if (running) onError?.(toError(error));
32630
+ }
32631
+ if (running) timer = setTimeout(() => void poll(), pollIntervalMs);
32632
+ };
32633
+ poll();
32634
+ return {
32635
+ stop() {
32636
+ running = false;
32637
+ if (timer !== void 0) clearTimeout(timer);
32638
+ },
32639
+ lastScannedBlock: () => lastScanned
32640
+ };
32641
+ }
32642
+ const sharedWatchers = new Map();
32643
+ function swapKey(key) {
32644
+ return `${key.blockNumber}:${key.logIndex}`;
32645
+ }
32646
+ /**
32647
+ * Ref-counted pool swap feed: subscribers with the same `key` share one watcher
32648
+ * (relay stream when `streamUrl` is set, else HTTP polling), duplicates are
32649
+ * dropped, late subscribers first receive the swaps already seen, and the watcher
32650
+ * stops when the last subscriber unsubscribes.
32651
+ */
32652
+ function subscribePoolSwaps(params) {
32653
+ const { key, streamUrl, onSwaps, onError, onRemoved, onTransport,...watchParams } = params;
32654
+ const listener = {
32655
+ onSwaps,
32656
+ onError,
32657
+ onRemoved,
32658
+ onTransport
32659
+ };
32660
+ const existing = sharedWatchers.get(key);
32661
+ if (existing) {
32662
+ existing.listeners.add(listener);
32663
+ const buffered = [...existing.buffer.values()];
32664
+ const first = buffered[0];
32665
+ const last = buffered[buffered.length - 1];
32666
+ if (first && last) onSwaps(buffered, {
32667
+ fromBlock: first.blockNumber,
32668
+ toBlock: last.blockNumber
32669
+ });
32670
+ onTransport?.(existing.transport);
32671
+ } else {
32672
+ const listeners = new Set([listener]);
32673
+ const buffer = new Map();
32674
+ const entry = {
32675
+ watcher: {
32676
+ stop: () => void 0,
32677
+ lastScannedBlock: () => void 0
32678
+ },
32679
+ listeners,
32680
+ buffer,
32681
+ transport: "off"
32682
+ };
32683
+ const setTransport = (transport) => {
32684
+ entry.transport = transport;
32685
+ for (const l of listeners) l.onTransport?.(transport);
32686
+ };
32687
+ const callbacks = {
32688
+ onSwaps: (swaps, range) => {
32689
+ const fresh = swaps.filter((swap) => !buffer.has(swapKey(swap)));
32690
+ if (fresh.length === 0) return;
32691
+ for (const swap of fresh) buffer.set(swapKey(swap), swap);
32692
+ for (const k of buffer.keys()) {
32693
+ if (buffer.size <= SHARED_BUFFER_LIMIT) break;
32694
+ buffer.delete(k);
32695
+ }
32696
+ for (const l of listeners) l.onSwaps(fresh, range);
32697
+ },
32698
+ onError: (error) => {
32699
+ for (const l of listeners) l.onError?.(error);
32700
+ }
32701
+ };
32702
+ sharedWatchers.set(key, entry);
32703
+ if (streamUrl !== void 0) entry.watcher = streamPoolSwaps({
32704
+ ...watchParams,
32705
+ ...callbacks,
32706
+ streamUrl,
32707
+ onRemoved: (removed) => {
32708
+ buffer.delete(swapKey(removed));
32709
+ for (const l of listeners) l.onRemoved?.(removed);
32710
+ },
32711
+ onTransport: setTransport
32712
+ });
32713
+ else {
32714
+ entry.watcher = watchPoolSwaps({
32715
+ ...watchParams,
32716
+ ...callbacks
32717
+ });
32718
+ setTransport("poll");
32719
+ }
32720
+ }
32721
+ return () => {
32722
+ const entry = sharedWatchers.get(key);
32723
+ if (!entry) return;
32724
+ entry.listeners.delete(listener);
32725
+ if (entry.listeners.size === 0) {
32726
+ entry.watcher.stop();
32727
+ sharedWatchers.delete(key);
32728
+ }
32729
+ };
32730
+ }
32731
+
31268
32732
  //#endregion
31269
32733
  //#region src/panoptic/v2/strike/ladder.ts
31270
32734
  /** Target number of rungs across a leg's full range (lower tick → upper tick). */
@@ -32742,7 +34206,7 @@ function calculatePositionVolatilityMetrics({ observations, netPremium, baseFees
32742
34206
  for (const point of points) if (!point.price.isFinite() || point.price.lte(0) || !point.gamma.isFinite() || point.rangeGammas.some((gamma) => !gamma.isFinite())) throw new RangeError("Invalid price or gamma observation");
32743
34207
  const quantum = new Precision(10).pow(-quoteDecimals);
32744
34208
  const gammas = points.flatMap((point) => [point.gamma, ...point.rangeGammas]);
32745
- const peak = gammas.reduce((max, gamma) => Precision.max(max, gamma.abs()), new Precision(0));
34209
+ const peak = gammas.reduce((max$1, gamma) => Precision.max(max$1, gamma.abs()), new Precision(0));
32746
34210
  const tolerance = Precision.max(quantum, peak.mul("1e-12"));
32747
34211
  const positive = gammas.some((gamma) => gamma.gt(tolerance));
32748
34212
  const negative = gammas.some((gamma) => gamma.lt(tolerance.neg()));
@@ -33213,5 +34677,5 @@ async function getPositionVolatilityHistory({ client, poolAddress, account, toke
33213
34677
  }
33214
34678
 
33215
34679
  //#endregion
33216
- export { AccountInsolventError, AlreadyInitializedError, BORROW_INDEX_BITS, BPS_DENOMINATOR, BPS_SCALE, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, MARKET_INDICATOR_PERIODS, MAX_TICK, MAX_TRACKED_CHUNKS, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, ORACLE_EPOCH_SECONDS, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, RATE_AT_TARGET_BITS, REORG_DEPTH, REQUIRED_BASE_ERROR_SENTINEL, ReentrancyError, RpcError, RpcResponseError, SCHEMA_VERSION, SECONDS_PER_YEAR, STANDARD_TICK_WIDTHS, STORAGE_PREFIX, STRIKE_LADDER_TARGET_STRIKES, SafeModeError, StaleDataError, StaleOracleError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UNREALIZED_INTEREST_BITS, UTILIZATION_DENOMINATOR, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, VARIANCE_RATIO_LAG, WAD, WrongPoolIdError, WrongUniswapPoolError, ZERO_COLLATERAL, ZERO_VALUATION, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, addPendingPosition, addTrackedChunks, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, apportion, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildCreditWrappedDispatch, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateAccountGreeksPure, calculateMarketIndicator, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, calculatePositionValues, calculatePositionVolatilityMetrics, calculateResyncBlock, calculateSpreadWad, calculateVarianceProfile, cancelTransaction, checkApproval, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearCheckpoint, clearPendingPositions, clearTrackedChunks, clearTrackedPositions, clearTradeHistory, closePosition, closePositionAndWait, collateralCurveTicks, collateralRuleKindFor, collateralTrackerV2Abi, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, countLegs, createEventPoller, createEventSubscription, createFileStorage, createFlowNeutralTokenId, createMemoryStorage, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePanopticTokenURI, decodePoolId, decodeTickSpacing, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveSupplyRatePerSecWad, deriveUniqueTokenId, detectReorg, diagnoseOracleSafeMode, dispatch, dispatchAndWait, emptyLiquidateParams, encodeLeg, encodePoolId, encodePoolKeyBytes, encodeV3PoolKeyBytes, encodeV4PoolId, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCloseZapSwap, estimateCollateralBreakdown, estimateCollateralRequired, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, failPendingPosition, feeGrowthInsideX128, feesFromFeeGrowthDelta, fetchPoolId, fetchSfpmV3PoolId, fetchUniswapFeeData, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatPoolIdHex, formatPriceRange, formatRateWad, formatRatioPercent, formatTick, formatTickRange, formatTimestamp, formatTimestampLocale, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWad, formatWadPercent, formatWadSigned, formatWei, generateOverlappingTokenIds, getAccountBuyingPower, getAccountCollateral, getAccountGreeks, getAccountHistory, getAccountPremia, getAccountSummaryBasic, getAccountSummaryRisk, getAssetIndex, getBlockMeta, getChainDeployment, getChunkLiquidities, getChunkSpreads, getClosePositionTransferEstimate, getClosedPositions, getClosedPositionsKey, getCollateralAddresses, getCollateralCurve, getCollateralCurveInputs, getCollateralData, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getCurrentRates, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getForfeitablePremium, getGuardianUnlockState, getHedgeLimits, getInterestState, getIrmCurrent, getIrmCurve, getItmAmounts, getLegDelta, getLegDeltaInVaultFrame, getLegGamma, getLegNetValueWidth0, getLegValue, getLiquidationPrices, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNetLiquidationValue, getNetLiquidationValues, getNotEnoughTokensError, getOpenPositionIds, getOpenPositionPreview, getOracleRiskParameters, getOracleState, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolDeploymentBlock, getPoolDisplayId, getPoolLiquidities, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPortfolioValue, getPosition, getPositionChunkData, getPositionDeltaMetrics, getPositionEnrichmentData, getPositionGreeks, getPositionMetaKey, getPositionValueCurve, getPositionVolatilityHistory, getPositions, getPositionsKey, getPositionsWithPremia, getPriceHistory, getPricesAtTick, getRealizedPnL, getRequiredCreditForITM, getRiskParameters, getSafeMode, getSchemaVersionKey, getSimpleLoanTokenIndex, getStreamiaHistory, getSyncCheckpointKey, getSyncStatus, getTickSpacing, getTokenListId, getTrackedChunks, getTrackedChunksKey, getTrackedPositionIds, getTradeHistory, getUniswapFeeHistory, getUniswapV3LpPositionState, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4LpPositionState, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, getUtilization, hasLoanOrCredit, hasLongLeg, interpolateBlocks, isCall, isCredit, isCreditLeg, isDefinedRisk, isGasError, isInputListFailError, isLiquidatable, isLoan, isLoanLeg, isNonceError, isPanopticErrorType, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, isSupportedChain, isolateGroupTokenId, jsonSerializer, ladderStrikeSequence, liquidate, liquidateAndWait, loadCheckpoint, logReturns, marketPnlInQuote, marketRiskFromValues, marketScenario, minePoolAddress, mint, mintAndWait, mintableAfterBuffer, multicallRead, netLiquidationValueInQuote, openPosition, openPositionAndWait, optimizeTokenIdRiskPartners, oracleEpochAt, orderListForSettle, packMarketState, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parseBps, parseCollateralLog, parsePanopticError, parsePoolLog, parseTokenAmount, parseTokenListId, parseWad, planDeriveStrategy, pokeOracle, pokeOracleAndWait, positionValueKey, positionValueTicks, prepareIndicatorCandles, prepareLiquidityGamma, preparePositionGamma, preparePositionValue, preparePositionValueCurve, previewBorrow, previewDeposit, previewMint, previewRedeem, previewRepay, previewUnwrap, previewWithdraw, previewWrap, priceToTick, publicBroadcaster, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, quoteTokenShortfallSwap, quoteV3ExactIn, ratePerSecWadToAprPct, realizedBeta, reconstructFromEvents, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, removeTrackedChunks, repay, repayAndWait, requireChainDeployment, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveTokenIndex, resolveUniswapV4PoolKey, riskEngineAbi, rollPosition, rollPositionAndWait, roundToTickSpacing, saveCheckpoint, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateBatchDispatch, simulateClosePosition, simulateClosePremiumProtection, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateOpenPosition, simulateSFPMBurn, simulateSFPMMint, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateSwapExactIn, simulateSwapExactOut, simulateWithTokenFlow, simulateWithdraw, slippageBpsToTickDistance, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, sqrtPriceX96ToPriceDecimalScaled, sqrtPriceX96ToTick, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96, toVaultFrameAtTick, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, utilizationBpsToWad, utilizationPctToWad, validateBatch, validateBuilderCode, validatePoolId, valuePositionAccrual, verifyBlockContinuity, watchEvents, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
34680
+ export { AccountInsolventError, AlreadyInitializedError, BORROW_INDEX_BITS, BPS_DENOMINATOR, BPS_SCALE, BatchValidationError, BelowMinimumRedemptionError, CastingError, ChunkHasZeroLiquidityError, ChunkLimitError, CrossPoolError, DEFAULT_MAX_SPREAD, DEFAULT_MINT_BUFFER, DEFAULT_MIN_SWAP_RATIO_BPS, DEFAULT_RECONNECT_CONFIG, DEFAULT_VEGOID, DepositTooLargeError, DuplicateTokenIdError, EffectiveLiquidityAboveThresholdError, ExceedsMaximumRedemptionError, InputListFailError, InsufficientCreditLiquidityError, InvalidBuilderCodeError, InvalidHistoryRangeError, InvalidTickBoundError, InvalidTickError, InvalidTokenIdParameterError, InvalidUniswapCallbackError, LEG_BITS, LEG_LIMITS, LEG_MASKS, LengthMismatchError, LiquidityTooHighError, LoanSlotExhaustedError, MARKET_EPOCH_BITS, MARKET_EPOCH_SHIFT, MARKET_INDICATOR_PERIODS, MAX_TICK, MAX_TRACKED_CHUNKS, MINT_BUFFER, MINT_BUFFER_DENOMINATOR, MIN_TICK, MaxRetriesExceededError, MissingPositionIdsError, NO_LOWER_LIQUIDATION_TICK, NO_UPPER_LIQUIDATION_TICK, NetLiquidityZeroError, NetworkMismatchError, NoLegsExercisableError, NotALongLegError, NotBuilderError, NotEnoughLiquidityInChunkError, NotEnoughTokensError, NotGuardianError, NotMarginCalledError, NotPanopticPoolError, ORACLE_EPOCH_SECONDS, OracleRateLimitedError, PanopticError, PanopticHelperNotDeployedError, PanopticValidationError, PoolNotInitializedError, PositionCountNotZeroError, PositionNotOwnedError, PositionSnapshotNotFoundError, PositionTooLargeError, PriceBoundFailError, PriceImpactTooLargeError, ProviderLagError, RATE_AT_TARGET_BITS, REORG_DEPTH, REQUIRED_BASE_ERROR_SENTINEL, ReentrancyError, RpcError, RpcResponseError, SCHEMA_VERSION, SECONDS_PER_YEAR, STANDARD_TICK_WIDTHS, STORAGE_PREFIX, STRIKE_LADDER_TARGET_STRIKES, SafeModeError, StaleDataError, StaleOracleError, SwapTokenMismatchError, SyncTimeoutError, TOKEN_ID_BITS, TokenIdHasZeroLegsError, TooManyLegsOpenError, TransferFailedError, UNREALIZED_INTEREST_BITS, UTILIZATION_DENOMINATOR, UnauthorizedUniswapCallbackError, UnderOverFlowError, UnhealthyPoolError, UnsafePremiumSettlementError, VARIANCE_RATIO_LAG, WAD, WrongPoolIdError, WrongUniswapPoolError, ZERO_COLLATERAL, ZERO_VALUATION, ZeroAddressError, ZeroCollateralRequirementError, addLegToTokenId, addPendingPosition, addTrackedChunks, annualizePerSecondRateWad, applyMintBuffer, applyMintBufferPerToken, apportion, approve, approveAndWait, approvePool, assertCanBurn, assertCanForceExercise, assertCanLiquidate, assertCanMint, assertFresh, assertHealthy, assertLpPositionFunded, assertTradeable, borrow, borrowAndWait, buildBatchDispatchArgs, buildCreditSwapCall, buildCreditWrappedDispatch, buildOpenPositionCalldata, buildProtectedSettleDispatch, buildProtectedSettlePlan, buildSettleSequenceCalls, buildSfpmSwapCalldata, buildSfpmSwapPlan, buildTemporaryLoanRecoveryDispatch, buildTokenShortfallRecoveryDispatch, buildUniqueCredit, buildUniqueLoan, buildUniqueWidthZeroLeg, calculateAccountGreeksPure, calculateMarketIndicator, calculatePortfolioDelta, calculatePortfolioGamma, calculatePortfolioGreeks, calculatePortfolioValue, calculatePositionDelta, calculatePositionDeltaDebtOnly, calculatePositionDeltaWithSwap, calculatePositionGamma, calculatePositionGreeks, calculatePositionValue, calculatePositionValues, calculatePositionVolatilityMetrics, calculateResyncBlock, calculateSpreadWad, calculateVarianceProfile, cancelTransaction, checkApproval, checkCollateralAcrossTicks, classifyStrategyGroups, classifyStrike, cleanupStalePendingPositions, clearCheckpoint, clearPendingPositions, clearTrackedChunks, clearTrackedPositions, clearTradeHistory, closePosition, closePositionAndWait, collateralCurveTicks, collateralRuleKindFor, collateralTrackerV2Abi, computeV4PoolId, confirmPendingPosition, convertToAssets, convertToShares, countLegs, createEventPoller, createEventSubscription, createFileStorage, createFlowNeutralTokenId, createMemoryStorage, createNonceManager, createPoolFormatters, createTokenIdBuilder, decodeAllDispatchCalldata, decodeAllLegs, decodeDispatchCalldata, decodeLeftRightSigned, decodeLeftRightUnsigned, decodeLeg, decodeOraclePack, decodeOracleRiskParameters, decodeOracleTiming, decodePanopticTokenURI, decodePoolId, decodeTickSpacing, decodeTokenId, decodeVegoid, deployNewPool, deployNewPoolAndWait, deposit, depositAndWait, deriveSupplyRatePerSecWad, deriveUniqueTokenId, detectReorg, diagnoseOracleSafeMode, dispatch, dispatchAndWait, emptyLiquidateParams, encodeLeg, encodePoolId, encodePoolKeyBytes, encodeV3PoolKeyBytes, encodeV4PoolId, ensureSfpmV3PoolInitialized, estimateBlockNumbers, estimateCloseZapSwap, estimateCollateralBreakdown, estimateCollateralRequired, executeBatchDispatch, executeBatchDispatchAndWait, executeSettleSequence, executeSettleSequenceAndWait, failPendingPosition, feeGrowthInsideX128, feesFromFeeGrowthDelta, fetchPoolId, fetchPoolSwaps, fetchSfpmV3PoolId, fetchUniswapFeeData, forceExercise, forceExerciseAndWait, formatBlockNumber, formatBps, formatCompact, formatDatetime, formatDuration, formatDurationSeconds, formatFeeTier, formatGas, formatGwei, formatPerSecondRateWadAsAprPct, formatPerSecondRateWadAsApyPct, formatPoolIdHex, formatPriceRange, formatRateWad, formatRatioPercent, formatTick, formatTickRange, formatTimestamp, formatTimestampLocale, formatTokenAmount, formatTokenAmountSigned, formatTokenDelta, formatTokenFlow, formatTokenIdHex, formatTokenIdShort, formatTxHash, formatUtilization, formatWad, formatWadPercent, formatWadSigned, formatWei, generateOverlappingTokenIds, getAccountBuyingPower, getAccountCollateral, getAccountGreeks, getAccountHistory, getAccountPremia, getAccountSummaryBasic, getAccountSummaryRisk, getAssetIndex, getBlockMeta, getChainDeployment, getChunkLiquidities, getChunkSpreads, getClosePositionTransferEstimate, getClosedPositions, getClosedPositionsKey, getCollateralAddresses, getCollateralCurve, getCollateralCurveInputs, getCollateralData, getCollateralRequiredBase, getCollateralSharePrices, getCollateralTotalAssetsBatch, getCurrentRates, getDeltaHedgeParams, getEnforcedTickLimits, getExecutableLpMaxSize, getFactoryConstructMetadata, getFactoryOwnerOf, getFactoryTokenURI, getForfeitablePremium, getGuardianUnlockState, getHedgeLimits, getInterestState, getIrmCurrent, getIrmCurve, getItmAmounts, getLegDelta, getLegDeltaInVaultFrame, getLegGamma, getLegNetValueWidth0, getLegValue, getLiquidationPrices, getMarginBuffer, getMaxPositionSize, getMaxRedeem, getMaxWithdrawable, getNativeTokenPrice, getNetLiquidationValue, getNetLiquidationValues, getNotEnoughTokensError, getOpenPositionIds, getOpenPositionPreview, getOracleRiskParameters, getOracleState, getPanopticPoolAddress, getPanopticPoolFromPoolId, getPendingPositions, getPendingPositionsKey, getPool, getPoolCurrentTick, getPoolDeploymentBlock, getPoolDisplayId, getPoolLiquidities, getPoolMetaKey, getPoolMetadata, getPoolPrefix, getPortfolioValue, getPosition, getPositionChunkData, getPositionDeltaMetrics, getPositionEnrichmentData, getPositionGreeks, getPositionMetaKey, getPositionMintFunding, getPositionValueCurve, getPositionVolatilityHistory, getPositions, getPositionsKey, getPositionsWithPremia, getPriceHistory, getPricesAtTick, getRealizedPnL, getRequiredCreditForITM, getRiskParameters, getSafeMode, getSchemaVersionKey, getSimpleLoanTokenIndex, getStreamiaHistory, getSyncCheckpointKey, getSyncStatus, getTickSpacing, getTokenIdValidationError, getTokenListId, getTrackedChunks, getTrackedChunksKey, getTrackedPositionIds, getTradeHistory, getUniswapFeeHistory, getUniswapV3LpPositionState, getUniswapV3PoolFromId, getUniswapV3PoolInfo, getUniswapV3PoolLiquidities, getUniswapV4LpPositionState, getUniswapV4PoolBasicState, getUniswapV4PoolInfo, getUniswapV4PoolKeyFromId, getUniswapV4PoolLiquidities, getUtilization, hasLoanOrCredit, hasLongLeg, interpolateBlocks, isCall, isCredit, isCreditLeg, isDefinedRisk, isGasError, isInputListFailError, isLiquidatable, isLoan, isLoanLeg, isNonceError, isPanopticErrorType, isPositionTracked, isRetryableRpcError, isShortOnly, isSpread, isSupportedChain, isolateGroupTokenId, jsonSerializer, ladderStrikeSequence, liquidate, liquidateAndWait, loadCheckpoint, logReturns, marketPnlInQuote, marketRiskFromValues, marketScenario, minePoolAddress, mint, mintAndWait, mintableAfterBuffer, multicallRead, netLiquidationValueInQuote, openPosition, openPositionAndWait, optimizeTokenIdRiskPartners, oracleEpochAt, orderListForSettle, packMarketState, panopticLiquidatorAbi, panopticPoolV2Abi, panopticQueryAbi, parseBps, parseCollateralLog, parsePanopticError, parsePoolLog, parseStreamedKey, parseStreamedSwap, parseSwapLog, parseTokenAmount, parseTokenListId, parseWad, planDeriveStrategy, pokeOracle, pokeOracleAndWait, positionValueKey, positionValueTicks, prepareIndicatorCandles, prepareLiquidityGamma, preparePositionGamma, preparePositionValue, preparePositionValueCurve, previewBorrow, previewDeposit, previewMint, previewRedeem, previewRepay, previewUnwrap, previewWithdraw, previewWrap, priceToTick, publicBroadcaster, quoteLiquidation, quoteOneTokenFlow, quoteSfpmSwap, quoteTemporaryLoanRecovery, quoteTokenShortfallRecovery, quoteTokenShortfallSwap, quoteV3ExactIn, ratePerSecWadToAprPct, realizedBeta, reconstructFromEvents, recoverSnapshot, recoverSnapshotFromTx, redeem, redeemAndWait, removeTrackedChunks, repay, repayAndWait, requireChainDeployment, resolveBlockNumbers, resolveLadderStrike, resolvePanopticPoolFromPoolId, resolveTokenIndex, resolveUniswapV4PoolKey, riskEngineAbi, rollPosition, rollPositionAndWait, roundToTickSpacing, saveCheckpoint, saveClosedPosition, scaleCollateralRequired, scanChunks, screenAccountExact, selectDispatchForAccount, settleAccumulatedPremia, settleAccumulatedPremiaAndWait, settlePremiumFrom, settlePremiumFromAndWait, simulateBatchDispatch, simulateClosePosition, simulateClosePremiumProtection, simulateDeployNewPool, simulateDeposit, simulateDispatch, simulateForceExercise, simulateLiquidate, simulateOpenPosition, simulateSFPMBurn, simulateSFPMMint, simulateSettle, simulateSettlePremiumBatch, simulateSettlePremiumFrom, simulateSettleSequence, simulateSwapExactIn, simulateSwapExactOut, simulateWithTokenFlow, simulateWithdraw, slippageBpsToTickDistance, smartRepay, smartRepayAndWait, speedUpTransaction, splitTokenIdByTimescale, sqrtPriceX96ToPriceDecimalScaled, sqrtPriceX96ToTick, streamPoolSwaps, subscribePoolSwaps, supply, supplyAndWait, swapExactIn, swapExactInAndWait, swapExactOut, swapExactOutAndWait, syncPositions, tickLimits, tickToPrice, tickToPriceDecimalScaled, tickToSqrtPriceX96, toVaultFrameAtTick, truncateAddress, unsupply, unsupplyAndWait, unwrapWeth, unwrapWethAndWait, unwrapXstock, unwrapXstockAndWait, utilizationBpsToWad, utilizationPctToWad, validateBatch, validateBuilderCode, validatePoolId, valuePositionAccrual, verifyBlockContinuity, watchEvents, watchPoolSwaps, wethWrapAbi, withdraw, withdrawAndWait, withdrawWithPositions, withdrawWithPositionsAndWait, wrapEth, wrapEthAndWait, wrapXstock, wrapXstockAndWait, xstockWrapperAbi };
33217
34681
  //# sourceMappingURL=index.js.map