timelock-sdk 0.0.115 → 0.0.117

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.
@@ -1,13 +1,13 @@
1
- import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-ChJFZ6hc.js";
1
+ import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-B_cHjOOB.cjs";
2
2
  import * as viem0 from "viem";
3
3
  import { Address, Client, GetContractReturnType, Hex, PublicClient } from "viem";
4
- import Big from "big.js";
5
4
  import React, { ReactNode } from "react";
5
+ import "graphql";
6
6
  import { GraphQLClient, RequestOptions } from "graphql-request";
7
7
  import * as _tanstack_react_query0 from "@tanstack/react-query";
8
8
  import { NonUndefinedGuard } from "@tanstack/react-query";
9
- import "graphql";
10
9
  import * as _tanstack_query_core0 from "@tanstack/query-core";
10
+ import Big from "big.js";
11
11
  import * as _wagmi_core0 from "@wagmi/core";
12
12
 
13
13
  //#region src/generated/graphql.d.ts
@@ -31862,11 +31862,11 @@ declare class PerpsOperator {
31862
31862
  closed: boolean;
31863
31863
  }[]>;
31864
31864
  mintPerp: (body: MintPerpBody) => Promise<{
31865
- txHash: string;
31865
+ txHash: `0x${string}`;
31866
31866
  optionId: bigint;
31867
31867
  }>;
31868
31868
  exercisePerp: (body: ExercisePerpBody) => Promise<{
31869
- txHash: string;
31869
+ txHash: `0x${string}`;
31870
31870
  optionId: bigint;
31871
31871
  }>;
31872
31872
  }
@@ -62862,4 +62862,4 @@ declare const useApproval: () => {
62862
62862
  };
62863
62863
  //#endregion
62864
62864
  export { EMPTY_ARRAY as $, token1ToToken0 as A, uniswapMathLenses as At, useClosedUserPerps as B, getTickAtPrice as C, TimelockMarketData as Ct, roundTickDown as D, getTimelockMarket as Dt, liquiditiesToAmounts as E, getTimelockLens as Et, getPriceHistory as F, OptionTimelineData as G, usePerpsOperator as H, useSetOperatorPerms as I, useOptionPremium as J, useOptionTimeline as K, useUserOperators as L, PriceDataPoint as M, PriceResolution as N, roundTickUp as O, getUniswapMathLens as Ot, getCurrentPrice as P, Amount as Q, useOperatorPerms as R, getPriceSqrtPriceX96 as S, TimelockMarket as St, liquiditiesToAmount1 as T, getErc20 as Tt, useClosePerp as U, useUserPerps as V, useMintPerp as W, useMintOption as X, useOptionPnl as Y, useMaxPositionSize as Z, getPayoutAtTick as _, useClosedUserOptions as _t, batchGetAmountsFromLiquidity as a, scalePrice as at, getNearestValidStrikeTick as b, useTimelockConfig as bt, useLiquidityBlocks as c, wrapAmount as ct, usePriceAtTick as d, wrapPriceUnscaled as dt, formatAmount as et, usePriceSqrtPriceX96 as f, zero as ft, useCurrentPrice as g, useActiveUserOptions as gt, useCurrentTick as h, OptionData as ht, useVaultData as i, scaleAmount as it, PriceData as j, token0ToToken1 as k, timelockLenses as kt, useBurnLiquidity as l, wrapAmountUnscaled as lt, usePoolData as m, useExerciseOption as mt, useLens as n, formatUSD as nt, useMintLiquidity as o, unscaleAmount as ot, UniswapPoolData as p, useMarketData as pt, useExtendOption as q, useVaultTVL as r, formatVagueAmount as rt, LiquidityBlockData as s, unscalePrice as st, useApproval as t, formatCondensed as tt, usePriceHistory as u, wrapPrice as ut, PRICE_PRECISION as v, TimelockProvider as vt, liquiditiesToAmount0 as w, UniswapMathLens as wt, getPriceAtTick as x, TimelockLens as xt, getAmountsFromLiquidity as y, useCurrentMarket as yt, useActiveUserPerps as z };
62865
- //# sourceMappingURL=client-BOmeI-gW.d.ts.map
62865
+ //# sourceMappingURL=client-Cgi8okgz.d.cts.map
package/dist/client.cjs CHANGED
@@ -1,25 +1,19 @@
1
1
  'use client';
2
2
 
3
3
 
4
- const require_optionUtils = require('./optionUtils-DQakRJ_U.cjs');
4
+ const require_optionUtils = require('./optionUtils-ZSFOJxaV.cjs');
5
5
  const require_optionsMarket = require('./optionsMarket-D6zrIXc3.cjs');
6
6
  const require_singleOwnerVault = require('./singleOwnerVault-gf2zNZVk.cjs');
7
7
  let viem = require("viem");
8
- viem = require_optionUtils.__toESM(viem);
9
8
  let react = require("react");
10
9
  react = require_optionUtils.__toESM(react);
11
10
  let wagmi = require("wagmi");
12
- wagmi = require_optionUtils.__toESM(wagmi);
13
11
  let graphql_request = require("graphql-request");
14
- graphql_request = require_optionUtils.__toESM(graphql_request);
15
12
  let graphql_tag = require("graphql-tag");
16
13
  graphql_tag = require_optionUtils.__toESM(graphql_tag);
17
14
  let viem_actions = require("viem/actions");
18
- viem_actions = require_optionUtils.__toESM(viem_actions);
19
15
  let __tanstack_react_query = require("@tanstack/react-query");
20
- __tanstack_react_query = require_optionUtils.__toESM(__tanstack_react_query);
21
16
  let zod = require("zod");
22
- zod = require_optionUtils.__toESM(zod);
23
17
 
24
18
  //#region src/generated/graphql.ts
25
19
  const UserOptionFieldsFragmentDoc = graphql_tag.default`
@@ -523,7 +517,7 @@ const useExerciseOption = (marketAddr) => {
523
517
  ]
524
518
  });
525
519
  await (0, viem_actions.waitForTransactionReceipt)(client, { hash });
526
- await sleep(400);
520
+ await sleep(200);
527
521
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
528
522
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
529
523
  queryClient.invalidateQueries({ queryKey: ["readContract"] });
@@ -660,7 +654,7 @@ const useMintOption = (marketAddr) => {
660
654
  ]
661
655
  });
662
656
  await (0, viem_actions.waitForTransactionReceipt)(client, { hash });
663
- await sleep(400);
657
+ await sleep(200);
664
658
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
665
659
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
666
660
  queryClient.invalidateQueries({ queryKey: ["readContract"] });
@@ -834,7 +828,7 @@ const useExtendOption = (marketAddr) => {
834
828
  ]
835
829
  });
836
830
  await (0, viem_actions.waitForTransactionReceipt)(client, { hash });
837
- await sleep(400);
831
+ await sleep(200);
838
832
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
839
833
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
840
834
  queryClient.invalidateQueries({ queryKey: ["readContract"] });
@@ -1056,7 +1050,7 @@ const useSetOperatorPerms = (marketAddr) => {
1056
1050
  //#region src/hooks/perps/useMintPerp.ts
1057
1051
  const useMintPerp = (marketAddr) => {
1058
1052
  const queryClient = (0, __tanstack_react_query.useQueryClient)();
1059
- const client = (0, wagmi.useClient)();
1053
+ const client = (0, wagmi.usePublicClient)();
1060
1054
  const { address } = (0, wagmi.useAccount)();
1061
1055
  const { operator, address: operatorAddr, signMessage: { mutateAsync: signMessage } } = usePerpsOperator();
1062
1056
  const { askForApproval } = useApproval();
@@ -1094,14 +1088,15 @@ const useMintPerp = (marketAddr) => {
1094
1088
  spendingApproval: maxPremium
1095
1089
  });
1096
1090
  await askForApproval(payoutAsset, marketAddr, maxPremium);
1097
- await operator.mintPerp({
1091
+ const { txHash } = await operator.mintPerp({
1098
1092
  marketAddr,
1099
1093
  amount,
1100
1094
  optionType,
1101
1095
  duration,
1102
1096
  strikeTick: validStrikeTick
1103
1097
  });
1104
- await sleep(400);
1098
+ await (0, viem_actions.waitForTransactionReceipt)(client, { hash: txHash });
1099
+ await sleep(200);
1105
1100
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
1106
1101
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
1107
1102
  queryClient.invalidateQueries({ queryKey: ["readContract"] });
@@ -1113,12 +1108,15 @@ const useMintPerp = (marketAddr) => {
1113
1108
  //#region src/hooks/perps/useClosePerp.ts
1114
1109
  const useClosePerp = () => {
1115
1110
  const queryClient = (0, __tanstack_react_query.useQueryClient)();
1111
+ const client = (0, wagmi.useClient)();
1116
1112
  const { operator, signMessage: { mutateAsync: signMessage } } = usePerpsOperator();
1117
1113
  return (0, __tanstack_react_query.useMutation)({ mutationFn: async (body) => {
1118
1114
  if (!operator) throw new Error("Operator not connected");
1115
+ if (!client) throw new Error("No RPC client");
1119
1116
  if (!operator.auth) await signMessage();
1120
- await operator.exercisePerp(body);
1121
- await sleep(400);
1117
+ const { txHash } = await operator.exercisePerp(body);
1118
+ await (0, viem_actions.waitForTransactionReceipt)(client, { hash: txHash });
1119
+ await sleep(200);
1122
1120
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
1123
1121
  queryClient.invalidateQueries({ queryKey: ["userOptions"] });
1124
1122
  queryClient.invalidateQueries({ queryKey: ["readContract"] });