timelock-sdk 0.0.39 → 0.0.41
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 +7 -3
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +57 -57
- package/dist/client.d.ts +56 -56
- package/dist/client.js +7 -3
- package/dist/client.js.map +1 -1
- package/dist/{index-CA5kB-yT.d.cts → index-B7b3c8cu.d.cts} +92 -92
- package/dist/package.d.cts +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),
|
|
@@ -553,6 +553,7 @@ const getResolutionConfig = (resolution) => {
|
|
|
553
553
|
const getPriceHistory = async (poolAddress, resolution, startTimestamp, endTimestamp) => {
|
|
554
554
|
const network = "monad-testnet";
|
|
555
555
|
const { timeframe, aggregate, seconds } = getResolutionConfig(resolution);
|
|
556
|
+
if (endTimestamp.getTime() > Date.now()) endTimestamp = new Date(Date.now());
|
|
556
557
|
const startSecs = Math.floor(startTimestamp.getTime() / 1e3);
|
|
557
558
|
const endSecs = Math.floor(endTimestamp.getTime() / 1e3);
|
|
558
559
|
const diffSeconds = endSecs - startSecs;
|
|
@@ -562,7 +563,10 @@ const getPriceHistory = async (poolAddress, resolution, startTimestamp, endTimes
|
|
|
562
563
|
return (await res.json()).data.attributes.ohlcv_list.map(({ 0: timestamp, 4: price }) => ({
|
|
563
564
|
timestamp,
|
|
564
565
|
price
|
|
565
|
-
})).filter((point) => point.timestamp >= startSecs && point.timestamp <= endSecs).sort((a, b) => a.timestamp - b.timestamp)
|
|
566
|
+
})).filter((point) => point.timestamp >= startSecs && point.timestamp <= endSecs).sort((a, b) => a.timestamp - b.timestamp).map((a) => ({
|
|
567
|
+
timestamp: /* @__PURE__ */ new Date(a.timestamp * 1e3),
|
|
568
|
+
price: a.price
|
|
569
|
+
}));
|
|
566
570
|
};
|
|
567
571
|
|
|
568
572
|
//#endregion
|