@panoptic-eng/sdk 1.0.62 → 1.0.63

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.
@@ -31997,7 +31997,8 @@ function valuePositionAccrual({ snapshots, quoteIsToken0, quoteDecimals }) {
31997
31997
  for (const snapshot of snapshots) {
31998
31998
  const amount0 = new Precision((snapshot.token0 - previous0).toString());
31999
31999
  const amount1 = new Precision((snapshot.token1 - previous1).toString());
32000
- const price = new Precision("1.0001").pow(snapshot.tick.toString());
32000
+ if (snapshot.sqrtPriceX96 !== void 0 && snapshot.sqrtPriceX96 <= 0n) throw new RangeError("Invalid sqrt price");
32001
+ const price = snapshot.sqrtPriceX96 === void 0 ? new Precision("1.0001").pow(snapshot.tick.toString()) : new Precision(snapshot.sqrtPriceX96.toString()).div(Q96.toString()).pow(2);
32001
32002
  total = total.plus(quoteIsToken0 ? amount0.plus(amount1.div(price)) : amount1.plus(amount0.mul(price)));
32002
32003
  previous0 = snapshot.token0;
32003
32004
  previous1 = snapshot.token1;