timelock-sdk 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.cjs CHANGED
@@ -384,19 +384,12 @@ const useMintOption = (marketAddr) => {
384
384
  //#endregion
385
385
  //#region src/hooks/market/useOptionPnl.ts
386
386
  const useOptionPnl = (optionData) => {
387
- const { marketAddr, optionType, entryTick, positionSizeCurrent } = optionData;
387
+ const { marketAddr, optionType, entryPrice, positionSizeCurrent } = optionData;
388
388
  const { pool, optionAssetIsToken0, payoutAssetDecimals } = useMarketData(marketAddr);
389
389
  const { exact: currentTick } = useCurrentTick(pool);
390
- const entrySize = (0, react.useMemo)(() => {
391
- if (optionAssetIsToken0 === void 0) return;
392
- return optionAssetIsToken0 ? require_numberUtils.token0ToToken1(positionSizeCurrent, entryTick) : require_numberUtils.token1ToToken0(positionSizeCurrent, entryTick);
393
- }, [
394
- optionAssetIsToken0,
395
- positionSizeCurrent,
396
- entryTick
397
- ]);
398
390
  const { displayPnl, unrealizedPayout } = (0, react.useMemo)(() => {
399
- if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals || !entrySize) return {};
391
+ if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals) return {};
392
+ const entrySize = positionSizeCurrent * entryPrice / require_numberUtils.PRICE_PRECISION;
400
393
  const delta = (optionAssetIsToken0 ? require_numberUtils.token0ToToken1(positionSizeCurrent, currentTick) : require_numberUtils.token1ToToken0(positionSizeCurrent, currentTick)) - entrySize;
401
394
  const displayPnl$1 = require_numberUtils.wrapAmount(optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
402
395
  return {
@@ -404,7 +397,7 @@ const useOptionPnl = (optionData) => {
404
397
  displayPnl: displayPnl$1
405
398
  };
406
399
  }, [
407
- entrySize,
400
+ entryPrice,
408
401
  optionType,
409
402
  optionAssetIsToken0,
410
403
  currentTick,