timelock-sdk 0.0.117 → 0.0.119
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-C5OVhky5.d.ts → client-CxAAahmW.d.ts} +287 -287
- package/dist/client.cjs +4 -8
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +5 -9
- package/dist/client.js.map +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./uniswapMathLens-ChJFZ6hc.js";
|
|
2
|
-
import { B as useClosedUserPerps, G as OptionTimelineData, H as usePerpsOperator, I as useSetOperatorPerms, J as useOptionPremium, K as useOptionTimeline, L as useUserOperators, R as useOperatorPerms, U as useClosePerp, V as useUserPerps, W as useMintPerp, X as useMintOption, Y as useOptionPnl, Z as useMaxPositionSize, _t as useClosedUserOptions, a as batchGetAmountsFromLiquidity, bt as useTimelockConfig, c as useLiquidityBlocks, d as usePriceAtTick, f as usePriceSqrtPriceX96, g as useCurrentPrice, gt as useActiveUserOptions, h as useCurrentTick, ht as OptionData, i as useVaultData, l as useBurnLiquidity, m as usePoolData, mt as useExerciseOption, n as useLens, o as useMintLiquidity, p as UniswapPoolData, pt as useMarketData, q as useExtendOption, r as useVaultTVL, s as LiquidityBlockData, t as useApproval, u as usePriceHistory, vt as TimelockProvider, yt as useCurrentMarket, z as useActiveUserPerps } from "./client-
|
|
2
|
+
import { B as useClosedUserPerps, G as OptionTimelineData, H as usePerpsOperator, I as useSetOperatorPerms, J as useOptionPremium, K as useOptionTimeline, L as useUserOperators, R as useOperatorPerms, U as useClosePerp, V as useUserPerps, W as useMintPerp, X as useMintOption, Y as useOptionPnl, Z as useMaxPositionSize, _t as useClosedUserOptions, a as batchGetAmountsFromLiquidity, bt as useTimelockConfig, c as useLiquidityBlocks, d as usePriceAtTick, f as usePriceSqrtPriceX96, g as useCurrentPrice, gt as useActiveUserOptions, h as useCurrentTick, ht as OptionData, i as useVaultData, l as useBurnLiquidity, m as usePoolData, mt as useExerciseOption, n as useLens, o as useMintLiquidity, p as UniswapPoolData, pt as useMarketData, q as useExtendOption, r as useVaultTVL, s as LiquidityBlockData, t as useApproval, u as usePriceHistory, vt as TimelockProvider, yt as useCurrentMarket, z as useActiveUserPerps } from "./client-CxAAahmW.js";
|
|
3
3
|
export { LiquidityBlockData, OptionData, OptionTimelineData, TimelockProvider, UniswapPoolData, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useLens, useLiquidityBlocks, useMarketData, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePerpsOperator, usePoolData, usePriceAtTick, usePriceHistory, usePriceSqrtPriceX96, useSetOperatorPerms, useTimelockConfig, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
|
package/dist/client.js
CHANGED
|
@@ -6,7 +6,7 @@ import { A as getPriceHistory, D as token0ToToken1, F as timelockLenses, I as un
|
|
|
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, useEffect, useMemo } from "react";
|
|
9
|
-
import { useAccount, useBalance, useChainId, useClient,
|
|
9
|
+
import { useAccount, useBalance, useChainId, useClient, useReadContract, useSignMessage, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
|
|
10
10
|
import { GraphQLClient, RequestOptions } from "graphql-request";
|
|
11
11
|
import gql from "graphql-tag";
|
|
12
12
|
import { waitForTransactionReceipt } from "viem/actions";
|
|
@@ -485,7 +485,7 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
485
485
|
|
|
486
486
|
//#endregion
|
|
487
487
|
//#region src/hooks/options/useExerciseOption.ts
|
|
488
|
-
const swapper = "
|
|
488
|
+
const swapper = "0x877309663591ad974bE2c0C7fB453844c8D613D8";
|
|
489
489
|
const useExerciseOption = (marketAddr) => {
|
|
490
490
|
const { vault, pool } = useMarketData(marketAddr);
|
|
491
491
|
const { fee } = usePoolData(pool);
|
|
@@ -1048,7 +1048,7 @@ const useSetOperatorPerms = (marketAddr) => {
|
|
|
1048
1048
|
//#region src/hooks/perps/useMintPerp.ts
|
|
1049
1049
|
const useMintPerp = (marketAddr) => {
|
|
1050
1050
|
const queryClient = useQueryClient();
|
|
1051
|
-
const client =
|
|
1051
|
+
const client = useClient();
|
|
1052
1052
|
const { address } = useAccount();
|
|
1053
1053
|
const { operator, address: operatorAddr, signMessage: { mutateAsync: signMessage } } = usePerpsOperator();
|
|
1054
1054
|
const { askForApproval } = useApproval();
|
|
@@ -1086,14 +1086,13 @@ const useMintPerp = (marketAddr) => {
|
|
|
1086
1086
|
spendingApproval: maxPremium
|
|
1087
1087
|
});
|
|
1088
1088
|
await askForApproval(payoutAsset, marketAddr, maxPremium);
|
|
1089
|
-
|
|
1089
|
+
await operator.mintPerp({
|
|
1090
1090
|
marketAddr,
|
|
1091
1091
|
amount,
|
|
1092
1092
|
optionType,
|
|
1093
1093
|
duration,
|
|
1094
1094
|
strikeTick: validStrikeTick
|
|
1095
1095
|
});
|
|
1096
|
-
await waitForTransactionReceipt(client, { hash: txHash });
|
|
1097
1096
|
await sleep(200);
|
|
1098
1097
|
queryClient.invalidateQueries({ queryKey: ["userOptions"] });
|
|
1099
1098
|
queryClient.invalidateQueries({ queryKey: ["userOptions"] });
|
|
@@ -1106,14 +1105,11 @@ const useMintPerp = (marketAddr) => {
|
|
|
1106
1105
|
//#region src/hooks/perps/useClosePerp.ts
|
|
1107
1106
|
const useClosePerp = () => {
|
|
1108
1107
|
const queryClient = useQueryClient();
|
|
1109
|
-
const client = useClient();
|
|
1110
1108
|
const { operator, signMessage: { mutateAsync: signMessage } } = usePerpsOperator();
|
|
1111
1109
|
return useMutation({ mutationFn: async (body) => {
|
|
1112
1110
|
if (!operator) throw new Error("Operator not connected");
|
|
1113
|
-
if (!client) throw new Error("No RPC client");
|
|
1114
1111
|
if (!operator.auth) await signMessage();
|
|
1115
|
-
|
|
1116
|
-
await waitForTransactionReceipt(client, { hash: txHash });
|
|
1112
|
+
await operator.exercisePerp(body);
|
|
1117
1113
|
await sleep(200);
|
|
1118
1114
|
queryClient.invalidateQueries({ queryKey: ["userOptions"] });
|
|
1119
1115
|
queryClient.invalidateQueries({ queryKey: ["userOptions"] });
|