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.cjs
CHANGED
|
@@ -387,18 +387,26 @@ const useOptionPnl = (optionData) => {
|
|
|
387
387
|
const { marketAddr, optionType, entryTick, 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
|
+
]);
|
|
390
398
|
const { displayPnl, unrealizedPayout } = (0, react.useMemo)(() => {
|
|
391
|
-
if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals) return {};
|
|
392
|
-
const delta = optionAssetIsToken0 ? require_numberUtils.token0ToToken1(positionSizeCurrent, currentTick)
|
|
399
|
+
if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals || !entrySize) return {};
|
|
400
|
+
const delta = (optionAssetIsToken0 ? require_numberUtils.token0ToToken1(positionSizeCurrent, currentTick) : require_numberUtils.token1ToToken0(positionSizeCurrent, currentTick)) - entrySize;
|
|
393
401
|
const displayPnl$1 = require_numberUtils.wrapAmount(optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
394
402
|
return {
|
|
395
403
|
unrealizedPayout: require_numberUtils.wrapAmount(displayPnl$1.scaled < 0 ? 0n : displayPnl$1.scaled, payoutAssetDecimals),
|
|
396
404
|
displayPnl: displayPnl$1
|
|
397
405
|
};
|
|
398
406
|
}, [
|
|
407
|
+
entrySize,
|
|
399
408
|
optionType,
|
|
400
409
|
optionAssetIsToken0,
|
|
401
|
-
entryTick,
|
|
402
410
|
currentTick,
|
|
403
411
|
positionSizeCurrent,
|
|
404
412
|
payoutAssetDecimals
|