timelock-sdk 0.0.39 → 0.0.40
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 +6 -3
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +57 -57
- package/dist/client.d.ts +57 -57
- package/dist/client.js +6 -3
- package/dist/client.js.map +1 -1
- package/dist/{index-CRhFaRiq.d.ts → index-B20z73_3.d.ts} +92 -92
- package/dist/{index-CA5kB-yT.d.cts → index-B7b3c8cu.d.cts} +92 -92
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -395,8 +395,8 @@ const useOptionPnl = (optionData) => {
|
|
|
395
395
|
const { exact: currentTick } = useCurrentTick(pool);
|
|
396
396
|
return (0, react.useMemo)(() => {
|
|
397
397
|
if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals) return {};
|
|
398
|
-
const
|
|
399
|
-
const delta = (optionAssetIsToken0 ? require_numberUtils.token0ToToken1(positionSizeCurrent, currentTick) : require_numberUtils.token1ToToken0(positionSizeCurrent, currentTick)) -
|
|
398
|
+
const strikeSize = positionSizeCurrent * strikePrice / require_numberUtils.PRICE_PRECISION;
|
|
399
|
+
const delta = (optionAssetIsToken0 ? require_numberUtils.token0ToToken1(positionSizeCurrent, currentTick) : require_numberUtils.token1ToToken0(positionSizeCurrent, currentTick)) - strikeSize;
|
|
400
400
|
const displayPnl = require_numberUtils.wrapAmount(optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
401
401
|
return {
|
|
402
402
|
unrealizedPayout: require_numberUtils.wrapAmount(displayPnl.scaled < 0 ? 0n : displayPnl.scaled, payoutAssetDecimals),
|
|
@@ -562,7 +562,10 @@ const getPriceHistory = async (poolAddress, resolution, startTimestamp, endTimes
|
|
|
562
562
|
return (await res.json()).data.attributes.ohlcv_list.map(({ 0: timestamp, 4: price }) => ({
|
|
563
563
|
timestamp,
|
|
564
564
|
price
|
|
565
|
-
})).filter((point) => point.timestamp >= startSecs && point.timestamp <= endSecs).sort((a, b) => a.timestamp - b.timestamp)
|
|
565
|
+
})).filter((point) => point.timestamp >= startSecs && point.timestamp <= endSecs).sort((a, b) => a.timestamp - b.timestamp).map((a) => ({
|
|
566
|
+
timestamp: /* @__PURE__ */ new Date(a.timestamp * 1e3),
|
|
567
|
+
price: a.price
|
|
568
|
+
}));
|
|
566
569
|
};
|
|
567
570
|
|
|
568
571
|
//#endregion
|