timelock-sdk 0.0.37 → 0.0.38
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 +5 -5
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +5 -5
- package/dist/client.js.map +1 -1
- package/dist/{index-BwLIRtzJ.d.ts → index-B20z73_3.d.ts} +92 -92
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -2289,7 +2289,7 @@ declare const useOptionPnl: (optionData: {
|
|
|
2289
2289
|
marketAddr: Address;
|
|
2290
2290
|
optionType: "CALL" | "PUT";
|
|
2291
2291
|
positionSizeCurrent: bigint;
|
|
2292
|
-
|
|
2292
|
+
strikePrice: bigint;
|
|
2293
2293
|
}) => {
|
|
2294
2294
|
unrealizedPayout?: undefined;
|
|
2295
2295
|
displayPnl?: undefined;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./uniswapMathLens-MrB_VfJB.js";
|
|
2
|
-
import { Amount, TimelockMarketData, UniswapMathLens } from "./index-
|
|
2
|
+
import { Amount, TimelockMarketData, UniswapMathLens } from "./index-B20z73_3.js";
|
|
3
3
|
import * as viem0 from "viem";
|
|
4
4
|
import { Address } from "viem";
|
|
5
5
|
import React, { ReactNode } from "react";
|
|
@@ -2289,7 +2289,7 @@ declare const useOptionPnl: (optionData: {
|
|
|
2289
2289
|
marketAddr: Address;
|
|
2290
2290
|
optionType: "CALL" | "PUT";
|
|
2291
2291
|
positionSizeCurrent: bigint;
|
|
2292
|
-
|
|
2292
|
+
strikePrice: bigint;
|
|
2293
2293
|
}) => {
|
|
2294
2294
|
unrealizedPayout?: undefined;
|
|
2295
2295
|
displayPnl?: undefined;
|
package/dist/client.js
CHANGED
|
@@ -383,12 +383,12 @@ const useMintOption = (marketAddr) => {
|
|
|
383
383
|
//#endregion
|
|
384
384
|
//#region src/hooks/market/useOptionPnl.ts
|
|
385
385
|
const useOptionPnl = (optionData) => {
|
|
386
|
-
const { marketAddr, optionType,
|
|
386
|
+
const { marketAddr, optionType, strikePrice, positionSizeCurrent } = optionData;
|
|
387
387
|
const { pool, optionAssetIsToken0, payoutAssetDecimals } = useMarketData(marketAddr);
|
|
388
388
|
const { exact: currentTick } = useCurrentTick(pool);
|
|
389
389
|
return useMemo(() => {
|
|
390
390
|
if (optionAssetIsToken0 === void 0 || currentTick === void 0 || !positionSizeCurrent || !payoutAssetDecimals) return {};
|
|
391
|
-
const entrySize = positionSizeCurrent *
|
|
391
|
+
const entrySize = positionSizeCurrent * strikePrice / PRICE_PRECISION;
|
|
392
392
|
const delta = (optionAssetIsToken0 ? token0ToToken1(positionSizeCurrent, currentTick) : token1ToToken0(positionSizeCurrent, currentTick)) - entrySize;
|
|
393
393
|
const displayPnl = wrapAmount(optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
394
394
|
return {
|
|
@@ -396,7 +396,7 @@ const useOptionPnl = (optionData) => {
|
|
|
396
396
|
displayPnl
|
|
397
397
|
};
|
|
398
398
|
}, [
|
|
399
|
-
|
|
399
|
+
strikePrice,
|
|
400
400
|
optionType,
|
|
401
401
|
optionAssetIsToken0,
|
|
402
402
|
currentTick,
|
|
@@ -509,7 +509,7 @@ const useCurrentPrice = (poolAddr) => {
|
|
|
509
509
|
|
|
510
510
|
//#endregion
|
|
511
511
|
//#region src/lib/price.ts
|
|
512
|
-
const
|
|
512
|
+
const getResolutionConfig = (resolution) => {
|
|
513
513
|
return {
|
|
514
514
|
"1m": {
|
|
515
515
|
timeframe: "minute",
|
|
@@ -545,7 +545,7 @@ const resolutionToGeckoTerminal = (resolution) => {
|
|
|
545
545
|
};
|
|
546
546
|
const getPriceHistory = async (poolAddress, resolution, startTimestamp, endTimestamp) => {
|
|
547
547
|
const network = "monad-testnet";
|
|
548
|
-
const { timeframe, aggregate, seconds } =
|
|
548
|
+
const { timeframe, aggregate, seconds } = getResolutionConfig(resolution);
|
|
549
549
|
const startSecs = Math.floor(startTimestamp.getTime() / 1e3);
|
|
550
550
|
const endSecs = Math.floor(endTimestamp.getTime() / 1e3);
|
|
551
551
|
const diffSeconds = endSecs - startSecs;
|