timelock-sdk 0.0.22 → 0.0.23
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 +11 -3
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +57 -57
- package/dist/client.d.ts +111 -111
- package/dist/client.js +11 -3
- 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-CA5kB-yT.d.cts} +9 -9
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -380,18 +380,26 @@ const useOptionPnl = (optionData) => {
|
|
|
380
380
|
const { marketAddr, optionType, entryTick, positionSizeCurrent } = optionData;
|
|
381
381
|
const { pool, optionAssetIsToken0, payoutAssetDecimals } = useMarketData(marketAddr);
|
|
382
382
|
const { exact: currentTick } = useCurrentTick(pool);
|
|
383
|
+
const entrySize = useMemo(() => {
|
|
384
|
+
if (optionAssetIsToken0 === void 0) return;
|
|
385
|
+
return optionAssetIsToken0 ? token0ToToken1(positionSizeCurrent, entryTick) : token1ToToken0(positionSizeCurrent, entryTick);
|
|
386
|
+
}, [
|
|
387
|
+
optionAssetIsToken0,
|
|
388
|
+
positionSizeCurrent,
|
|
389
|
+
entryTick
|
|
390
|
+
]);
|
|
383
391
|
const { displayPnl, unrealizedPayout } = useMemo(() => {
|
|
384
|
-
if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals) return {};
|
|
385
|
-
const delta = optionAssetIsToken0 ? token0ToToken1(positionSizeCurrent, currentTick)
|
|
392
|
+
if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals || !entrySize) return {};
|
|
393
|
+
const delta = (optionAssetIsToken0 ? token0ToToken1(positionSizeCurrent, currentTick) : token1ToToken0(positionSizeCurrent, currentTick)) - entrySize;
|
|
386
394
|
const displayPnl$1 = wrapAmount(optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
387
395
|
return {
|
|
388
396
|
unrealizedPayout: wrapAmount(displayPnl$1.scaled < 0 ? 0n : displayPnl$1.scaled, payoutAssetDecimals),
|
|
389
397
|
displayPnl: displayPnl$1
|
|
390
398
|
};
|
|
391
399
|
}, [
|
|
400
|
+
entrySize,
|
|
392
401
|
optionType,
|
|
393
402
|
optionAssetIsToken0,
|
|
394
|
-
entryTick,
|
|
395
403
|
currentTick,
|
|
396
404
|
positionSizeCurrent,
|
|
397
405
|
payoutAssetDecimals
|