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.cjs
CHANGED
|
@@ -390,12 +390,12 @@ const useMintOption = (marketAddr) => {
|
|
|
390
390
|
//#endregion
|
|
391
391
|
//#region src/hooks/market/useOptionPnl.ts
|
|
392
392
|
const useOptionPnl = (optionData) => {
|
|
393
|
-
const { marketAddr, optionType,
|
|
393
|
+
const { marketAddr, optionType, strikePrice, positionSizeCurrent } = optionData;
|
|
394
394
|
const { pool, optionAssetIsToken0, payoutAssetDecimals } = useMarketData(marketAddr);
|
|
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 entrySize = positionSizeCurrent *
|
|
398
|
+
const entrySize = positionSizeCurrent * strikePrice / require_numberUtils.PRICE_PRECISION;
|
|
399
399
|
const delta = (optionAssetIsToken0 ? require_numberUtils.token0ToToken1(positionSizeCurrent, currentTick) : require_numberUtils.token1ToToken0(positionSizeCurrent, currentTick)) - entrySize;
|
|
400
400
|
const displayPnl = require_numberUtils.wrapAmount(optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
401
401
|
return {
|
|
@@ -403,7 +403,7 @@ const useOptionPnl = (optionData) => {
|
|
|
403
403
|
displayPnl
|
|
404
404
|
};
|
|
405
405
|
}, [
|
|
406
|
-
|
|
406
|
+
strikePrice,
|
|
407
407
|
optionType,
|
|
408
408
|
optionAssetIsToken0,
|
|
409
409
|
currentTick,
|
|
@@ -516,7 +516,7 @@ const useCurrentPrice = (poolAddr) => {
|
|
|
516
516
|
|
|
517
517
|
//#endregion
|
|
518
518
|
//#region src/lib/price.ts
|
|
519
|
-
const
|
|
519
|
+
const getResolutionConfig = (resolution) => {
|
|
520
520
|
return {
|
|
521
521
|
"1m": {
|
|
522
522
|
timeframe: "minute",
|
|
@@ -552,7 +552,7 @@ const resolutionToGeckoTerminal = (resolution) => {
|
|
|
552
552
|
};
|
|
553
553
|
const getPriceHistory = async (poolAddress, resolution, startTimestamp, endTimestamp) => {
|
|
554
554
|
const network = "monad-testnet";
|
|
555
|
-
const { timeframe, aggregate, seconds } =
|
|
555
|
+
const { timeframe, aggregate, seconds } = getResolutionConfig(resolution);
|
|
556
556
|
const startSecs = Math.floor(startTimestamp.getTime() / 1e3);
|
|
557
557
|
const endSecs = Math.floor(endTimestamp.getTime() / 1e3);
|
|
558
558
|
const diffSeconds = endSecs - startSecs;
|