@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.
@@ -32678,7 +32678,8 @@ function valuePositionAccrual({ snapshots, quoteIsToken0, quoteDecimals }) {
32678
32678
  for (const snapshot of snapshots) {
32679
32679
  const amount0 = new Precision((snapshot.token0 - previous0).toString());
32680
32680
  const amount1 = new Precision((snapshot.token1 - previous1).toString());
32681
- const price = new Precision("1.0001").pow(snapshot.tick.toString());
32681
+ if (snapshot.sqrtPriceX96 !== void 0 && snapshot.sqrtPriceX96 <= 0n) throw new RangeError("Invalid sqrt price");
32682
+ const price = snapshot.sqrtPriceX96 === void 0 ? new Precision("1.0001").pow(snapshot.tick.toString()) : new Precision(snapshot.sqrtPriceX96.toString()).div(Q96.toString()).pow(2);
32682
32683
  total = total.plus(quoteIsToken0 ? amount0.plus(amount1.div(price)) : amount1.plus(amount0.mul(price)));
32683
32684
  previous0 = snapshot.token0;
32684
32685
  previous1 = snapshot.token1;