timelock-sdk 0.0.50 → 0.0.52
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/abis.cjs +1 -1
- package/dist/abis.d.cts +1 -1
- package/dist/abis.d.ts +1 -1
- package/dist/abis.js +1 -1
- package/dist/client.cjs +12 -6
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +173 -573
- package/dist/client.d.ts +173 -573
- package/dist/client.js +12 -6
- package/dist/client.js.map +1 -1
- package/dist/{index-Bg4UAy7Y.d.cts → index-D_lnxPOC.d.ts} +2 -458
- package/dist/{index-DFXuUhcW.d.ts → index-HQTA4ETi.d.cts} +2 -458
- package/dist/{numberUtils-BKQtAolx.cjs → numberUtils-CkwkoxOr.cjs} +3 -3
- package/dist/{numberUtils-BKQtAolx.cjs.map → numberUtils-CkwkoxOr.cjs.map} +1 -1
- package/dist/{numberUtils-Dk0TuHnT.js → numberUtils-Cznv1Tfa.js} +3 -3
- package/dist/{numberUtils-Dk0TuHnT.js.map → numberUtils-Cznv1Tfa.js.map} +1 -1
- package/dist/{optionsMarket-CvArD6d_.js → optionsMarket-BDBU1gUS.js} +1 -41
- package/dist/optionsMarket-BDBU1gUS.js.map +1 -0
- package/dist/{optionsMarket-PBduSBXF.cjs → optionsMarket-DEFMUI2G.cjs} +1 -41
- package/dist/optionsMarket-DEFMUI2G.cjs.map +1 -0
- package/dist/package.cjs +2 -2
- package/dist/package.d.cts +2 -2
- package/dist/package.d.ts +2 -2
- package/dist/package.js +2 -2
- package/dist/{uniswapMathLens-uDGUc-kg.d.ts → uniswapMathLens-BQ_ArpKd.d.cts} +1 -33
- package/dist/{uniswapMathLens-BiaRFVeY.d.cts → uniswapMathLens-DCuaXAGZ.d.ts} +1 -33
- package/package.json +1 -1
- package/dist/optionsMarket-CvArD6d_.js.map +0 -1
- package/dist/optionsMarket-PBduSBXF.cjs.map +0 -1
package/dist/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-
|
|
5
|
-
import { C as token1ToToken0, D as getUniswapMathLens, E as getTimelockMarket, O as timelockLenses, S as token0ToToken1, T as getTimelockLens, b as roundTickDown, d as wrapPrice, h as getPriceAtTick, k as uniswapMathLenses, l as wrapAmount, m as PRICE_PRECISION, w as getErc20, y as liquiditiesToAmounts } from "./numberUtils-
|
|
4
|
+
import { r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-BDBU1gUS.js";
|
|
5
|
+
import { C as token1ToToken0, D as getUniswapMathLens, E as getTimelockMarket, O as timelockLenses, S as token0ToToken1, T as getTimelockLens, b as roundTickDown, d as wrapPrice, h as getPriceAtTick, k as uniswapMathLenses, l as wrapAmount, m as PRICE_PRECISION, w as getErc20, y as liquiditiesToAmounts } from "./numberUtils-Cznv1Tfa.js";
|
|
6
6
|
import { n as uniswapV3PoolAbi, t as singleOwnerVaultAbi } from "./singleOwnerVault-BeJChjfJ.js";
|
|
7
7
|
import { encodeAbiParameters, encodeFunctionData, erc20Abi, maxUint256, zeroAddress } from "viem";
|
|
8
8
|
import React, { createContext, useContext, useMemo } from "react";
|
|
@@ -36,7 +36,8 @@ const GetActiveUserOptionsDocument = gql`
|
|
|
36
36
|
entryPrice
|
|
37
37
|
expiresAt
|
|
38
38
|
createdAt
|
|
39
|
-
|
|
39
|
+
premium
|
|
40
|
+
protocolFee
|
|
40
41
|
realizedPayout
|
|
41
42
|
marketAddr
|
|
42
43
|
liquiditiesAtOpen
|
|
@@ -70,7 +71,8 @@ const GetClosedUserOptionsDocument = gql`
|
|
|
70
71
|
entryPrice
|
|
71
72
|
expiresAt
|
|
72
73
|
createdAt
|
|
73
|
-
|
|
74
|
+
premium
|
|
75
|
+
protocolFee
|
|
74
76
|
realizedPayout
|
|
75
77
|
marketAddr
|
|
76
78
|
liquiditiesAtOpen
|
|
@@ -348,7 +350,10 @@ const useMintOption = (marketAddr) => {
|
|
|
348
350
|
};
|
|
349
351
|
const mintOption = async (optionType, amount, duration, strikeTick) => {
|
|
350
352
|
if (!client) throw new Error("Wallet not connected");
|
|
351
|
-
if (!
|
|
353
|
+
if (!marketAddr) throw new Error("Market address not available");
|
|
354
|
+
if (!timelockLens) throw new Error("Timelock lens not available");
|
|
355
|
+
if (!vault) throw new Error("Vault not available");
|
|
356
|
+
if (currentTick === void 0 || !tickSpacing) throw new Error("Pool data not available");
|
|
352
357
|
strikeTick = roundTickDown(strikeTick ?? currentTick, tickSpacing);
|
|
353
358
|
if (optionType === "CALL" && optionAssetIsToken0 || optionType === "PUT" && !optionAssetIsToken0) strikeTick += tickSpacing;
|
|
354
359
|
const [premium, protocolFee] = await getTimelockMarket(marketAddr, client).read.calculatePremium([
|
|
@@ -484,7 +489,8 @@ const useUserOptions = (user, active = false) => {
|
|
|
484
489
|
optionType: option.optionType,
|
|
485
490
|
createdAt: /* @__PURE__ */ new Date(Number(option.createdAt) * 1e3),
|
|
486
491
|
expiresAt: /* @__PURE__ */ new Date(Number(option.expiresAt) * 1e3),
|
|
487
|
-
|
|
492
|
+
premium: BigInt(option.premium),
|
|
493
|
+
protocolFee: BigInt(option.protocolFee),
|
|
488
494
|
realizedPayout: BigInt(option.realizedPayout),
|
|
489
495
|
liquiditiesAtOpen: option.liquiditiesAtOpen.map((l) => BigInt(l)),
|
|
490
496
|
liquiditiesCurrent: option.liquiditiesCurrent.map((l) => BigInt(l)),
|