timelock-sdk 0.0.22 → 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 +4 -3
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +112 -112
- package/dist/client.d.ts +112 -112
- package/dist/client.js +5 -4
- package/dist/client.js.map +1 -1
- package/dist/{index-v8akdN5J.d.ts → index-B20z73_3.d.ts} +96 -96
- package/dist/{index-Dej2kIqj.d.cts → index-B7b3c8cu.d.cts} +96 -96
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import { lensAbi, optionsMarketAbi } from "./optionsMarket-DyBxHplR.js";
|
|
5
|
-
import { getErc20, getPriceAtTick, getTimelockLens, getTimelockMarket, getUniswapMathLens, roundTickDown, timelockLenses, token0ToToken1, token1ToToken0, uniswapMathLenses, wrapAmount, wrapPrice } from "./numberUtils-CAMznXR5.js";
|
|
5
|
+
import { PRICE_PRECISION, getErc20, getPriceAtTick, getTimelockLens, getTimelockMarket, getUniswapMathLens, roundTickDown, timelockLenses, token0ToToken1, token1ToToken0, uniswapMathLenses, wrapAmount, wrapPrice } from "./numberUtils-CAMznXR5.js";
|
|
6
6
|
import { singleOwnerVaultAbi, uniswapV3PoolAbi } from "./uniswapV3Pool-Copswrde.js";
|
|
7
7
|
import { encodeFunctionData, erc20Abi, maxUint256 } from "viem";
|
|
8
8
|
import React, { createContext, useContext, useMemo } from "react";
|
|
@@ -377,21 +377,22 @@ const useMintOption = (marketAddr) => {
|
|
|
377
377
|
//#endregion
|
|
378
378
|
//#region src/hooks/market/useOptionPnl.ts
|
|
379
379
|
const useOptionPnl = (optionData) => {
|
|
380
|
-
const { marketAddr, optionType,
|
|
380
|
+
const { marketAddr, optionType, entryPrice, positionSizeCurrent } = optionData;
|
|
381
381
|
const { pool, optionAssetIsToken0, payoutAssetDecimals } = useMarketData(marketAddr);
|
|
382
382
|
const { exact: currentTick } = useCurrentTick(pool);
|
|
383
383
|
const { displayPnl, unrealizedPayout } = useMemo(() => {
|
|
384
384
|
if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals) return {};
|
|
385
|
-
const
|
|
385
|
+
const entrySize = positionSizeCurrent * entryPrice / PRICE_PRECISION;
|
|
386
|
+
const delta = (optionAssetIsToken0 ? token0ToToken1(positionSizeCurrent, currentTick) : token1ToToken0(positionSizeCurrent, currentTick)) - entrySize;
|
|
386
387
|
const displayPnl$1 = wrapAmount(optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
387
388
|
return {
|
|
388
389
|
unrealizedPayout: wrapAmount(displayPnl$1.scaled < 0 ? 0n : displayPnl$1.scaled, payoutAssetDecimals),
|
|
389
390
|
displayPnl: displayPnl$1
|
|
390
391
|
};
|
|
391
392
|
}, [
|
|
393
|
+
entryPrice,
|
|
392
394
|
optionType,
|
|
393
395
|
optionAssetIsToken0,
|
|
394
|
-
entryTick,
|
|
395
396
|
currentTick,
|
|
396
397
|
positionSizeCurrent,
|
|
397
398
|
payoutAssetDecimals
|