timelock-sdk 0.0.11 → 0.0.13

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.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { Amount, TimelockMarket, TimelockMarketData, TimelockVault, UniswapMathLens, UniswapPool } from "./index-tyVRQhLR.cjs";
1
+ import { Amount, TimelockMarket, TimelockMarketData, TimelockVault, UniswapMathLens, UniswapPool } from "./index-CbOCkO22.cjs";
2
2
  import "graphql";
3
3
  import "graphql-request";
4
4
  import React, { ReactNode } from "react";
5
5
  import * as viem382 from "viem";
6
6
  import { Address } from "viem";
7
- import * as _wagmi_core2 from "@wagmi/core";
7
+ import * as _wagmi_core0 from "@wagmi/core";
8
8
  import { NonUndefinedGuard } from "@tanstack/react-query";
9
- import * as _tanstack_query_core3 from "@tanstack/query-core";
9
+ import * as _tanstack_query_core0 from "@tanstack/query-core";
10
10
 
11
11
  //#region src/generated/graphql.d.ts
12
12
  type Exact<T extends {
@@ -175,7 +175,7 @@ declare const useExerciseOption: (market?: Address | TimelockMarket) => {
175
175
  isPending: boolean;
176
176
  isConfirming: boolean;
177
177
  isSuccess: boolean;
178
- error: _wagmi_core2.WriteContractErrorType | null;
178
+ error: _wagmi_core0.WriteContractErrorType | null;
179
179
  isLoading: boolean;
180
180
  };
181
181
  //#endregion
@@ -213,7 +213,7 @@ declare const useMintOption: (market?: Address | TimelockMarket) => {
213
213
  isPending: boolean;
214
214
  isConfirming: boolean;
215
215
  isSuccess: boolean;
216
- error: _wagmi_core2.WriteContractErrorType | null;
216
+ error: _wagmi_core0.WriteContractErrorType | null;
217
217
  isLoading: boolean;
218
218
  };
219
219
  //#endregion
@@ -256,7 +256,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
256
256
  isRefetching: boolean;
257
257
  isStale: boolean;
258
258
  isEnabled: boolean;
259
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
259
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
260
260
  id: bigint;
261
261
  marketAddr: Address;
262
262
  optionType: "CALL" | "PUT";
@@ -284,7 +284,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
284
284
  transactionHash: string;
285
285
  } | null;
286
286
  }[] | undefined, Error>>;
287
- fetchStatus: _tanstack_query_core3.FetchStatus;
287
+ fetchStatus: _tanstack_query_core0.FetchStatus;
288
288
  promise: Promise<{
289
289
  id: bigint;
290
290
  marketAddr: Address;
@@ -364,7 +364,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
364
364
  isRefetching: boolean;
365
365
  isStale: boolean;
366
366
  isEnabled: boolean;
367
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
367
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
368
368
  id: bigint;
369
369
  marketAddr: Address;
370
370
  optionType: "CALL" | "PUT";
@@ -392,7 +392,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
392
392
  transactionHash: string;
393
393
  } | null;
394
394
  }[] | undefined, Error>>;
395
- fetchStatus: _tanstack_query_core3.FetchStatus;
395
+ fetchStatus: _tanstack_query_core0.FetchStatus;
396
396
  promise: Promise<{
397
397
  id: bigint;
398
398
  marketAddr: Address;
@@ -472,7 +472,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
472
472
  isRefetching: boolean;
473
473
  isStale: boolean;
474
474
  isEnabled: boolean;
475
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
475
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
476
476
  id: bigint;
477
477
  marketAddr: Address;
478
478
  optionType: "CALL" | "PUT";
@@ -500,7 +500,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
500
500
  transactionHash: string;
501
501
  } | null;
502
502
  }[] | undefined, Error>>;
503
- fetchStatus: _tanstack_query_core3.FetchStatus;
503
+ fetchStatus: _tanstack_query_core0.FetchStatus;
504
504
  promise: Promise<{
505
505
  id: bigint;
506
506
  marketAddr: Address;
@@ -580,7 +580,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
580
580
  isRefetching: boolean;
581
581
  isStale: boolean;
582
582
  isEnabled: boolean;
583
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
583
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
584
584
  id: bigint;
585
585
  marketAddr: Address;
586
586
  optionType: "CALL" | "PUT";
@@ -608,7 +608,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
608
608
  transactionHash: string;
609
609
  } | null;
610
610
  }[] | undefined, Error>>;
611
- fetchStatus: _tanstack_query_core3.FetchStatus;
611
+ fetchStatus: _tanstack_query_core0.FetchStatus;
612
612
  promise: Promise<{
613
613
  id: bigint;
614
614
  marketAddr: Address;
@@ -688,7 +688,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
688
688
  isRefetching: boolean;
689
689
  isStale: boolean;
690
690
  isEnabled: boolean;
691
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
691
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
692
692
  id: bigint;
693
693
  marketAddr: Address;
694
694
  optionType: "CALL" | "PUT";
@@ -716,7 +716,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
716
716
  transactionHash: string;
717
717
  } | null;
718
718
  }[] | undefined, Error>>;
719
- fetchStatus: _tanstack_query_core3.FetchStatus;
719
+ fetchStatus: _tanstack_query_core0.FetchStatus;
720
720
  promise: Promise<{
721
721
  id: bigint;
722
722
  marketAddr: Address;
@@ -796,7 +796,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
796
796
  isRefetching: boolean;
797
797
  isStale: boolean;
798
798
  isEnabled: boolean;
799
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
799
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
800
800
  id: bigint;
801
801
  marketAddr: Address;
802
802
  optionType: "CALL" | "PUT";
@@ -824,7 +824,7 @@ declare const useUserOptions: (user?: string, active?: boolean) => {
824
824
  transactionHash: string;
825
825
  } | null;
826
826
  }[] | undefined, Error>>;
827
- fetchStatus: _tanstack_query_core3.FetchStatus;
827
+ fetchStatus: _tanstack_query_core0.FetchStatus;
828
828
  promise: Promise<{
829
829
  id: bigint;
830
830
  marketAddr: Address;
@@ -905,7 +905,7 @@ declare const useActiveUserOptions: (user?: string) => {
905
905
  isRefetching: boolean;
906
906
  isStale: boolean;
907
907
  isEnabled: boolean;
908
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
908
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
909
909
  id: bigint;
910
910
  marketAddr: Address;
911
911
  optionType: "CALL" | "PUT";
@@ -933,7 +933,7 @@ declare const useActiveUserOptions: (user?: string) => {
933
933
  transactionHash: string;
934
934
  } | null;
935
935
  }[] | undefined, Error>>;
936
- fetchStatus: _tanstack_query_core3.FetchStatus;
936
+ fetchStatus: _tanstack_query_core0.FetchStatus;
937
937
  promise: Promise<{
938
938
  id: bigint;
939
939
  marketAddr: Address;
@@ -1013,7 +1013,7 @@ declare const useActiveUserOptions: (user?: string) => {
1013
1013
  isRefetching: boolean;
1014
1014
  isStale: boolean;
1015
1015
  isEnabled: boolean;
1016
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1016
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1017
1017
  id: bigint;
1018
1018
  marketAddr: Address;
1019
1019
  optionType: "CALL" | "PUT";
@@ -1041,7 +1041,7 @@ declare const useActiveUserOptions: (user?: string) => {
1041
1041
  transactionHash: string;
1042
1042
  } | null;
1043
1043
  }[] | undefined, Error>>;
1044
- fetchStatus: _tanstack_query_core3.FetchStatus;
1044
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1045
1045
  promise: Promise<{
1046
1046
  id: bigint;
1047
1047
  marketAddr: Address;
@@ -1121,7 +1121,7 @@ declare const useActiveUserOptions: (user?: string) => {
1121
1121
  isRefetching: boolean;
1122
1122
  isStale: boolean;
1123
1123
  isEnabled: boolean;
1124
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1124
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1125
1125
  id: bigint;
1126
1126
  marketAddr: Address;
1127
1127
  optionType: "CALL" | "PUT";
@@ -1149,7 +1149,7 @@ declare const useActiveUserOptions: (user?: string) => {
1149
1149
  transactionHash: string;
1150
1150
  } | null;
1151
1151
  }[] | undefined, Error>>;
1152
- fetchStatus: _tanstack_query_core3.FetchStatus;
1152
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1153
1153
  promise: Promise<{
1154
1154
  id: bigint;
1155
1155
  marketAddr: Address;
@@ -1229,7 +1229,7 @@ declare const useActiveUserOptions: (user?: string) => {
1229
1229
  isRefetching: boolean;
1230
1230
  isStale: boolean;
1231
1231
  isEnabled: boolean;
1232
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1232
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1233
1233
  id: bigint;
1234
1234
  marketAddr: Address;
1235
1235
  optionType: "CALL" | "PUT";
@@ -1257,7 +1257,7 @@ declare const useActiveUserOptions: (user?: string) => {
1257
1257
  transactionHash: string;
1258
1258
  } | null;
1259
1259
  }[] | undefined, Error>>;
1260
- fetchStatus: _tanstack_query_core3.FetchStatus;
1260
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1261
1261
  promise: Promise<{
1262
1262
  id: bigint;
1263
1263
  marketAddr: Address;
@@ -1337,7 +1337,7 @@ declare const useActiveUserOptions: (user?: string) => {
1337
1337
  isRefetching: boolean;
1338
1338
  isStale: boolean;
1339
1339
  isEnabled: boolean;
1340
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1340
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1341
1341
  id: bigint;
1342
1342
  marketAddr: Address;
1343
1343
  optionType: "CALL" | "PUT";
@@ -1365,7 +1365,7 @@ declare const useActiveUserOptions: (user?: string) => {
1365
1365
  transactionHash: string;
1366
1366
  } | null;
1367
1367
  }[] | undefined, Error>>;
1368
- fetchStatus: _tanstack_query_core3.FetchStatus;
1368
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1369
1369
  promise: Promise<{
1370
1370
  id: bigint;
1371
1371
  marketAddr: Address;
@@ -1445,7 +1445,7 @@ declare const useActiveUserOptions: (user?: string) => {
1445
1445
  isRefetching: boolean;
1446
1446
  isStale: boolean;
1447
1447
  isEnabled: boolean;
1448
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1448
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1449
1449
  id: bigint;
1450
1450
  marketAddr: Address;
1451
1451
  optionType: "CALL" | "PUT";
@@ -1473,7 +1473,7 @@ declare const useActiveUserOptions: (user?: string) => {
1473
1473
  transactionHash: string;
1474
1474
  } | null;
1475
1475
  }[] | undefined, Error>>;
1476
- fetchStatus: _tanstack_query_core3.FetchStatus;
1476
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1477
1477
  promise: Promise<{
1478
1478
  id: bigint;
1479
1479
  marketAddr: Address;
@@ -1554,7 +1554,7 @@ declare const useClosedUserOptions: (user?: string) => {
1554
1554
  isRefetching: boolean;
1555
1555
  isStale: boolean;
1556
1556
  isEnabled: boolean;
1557
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1557
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1558
1558
  id: bigint;
1559
1559
  marketAddr: Address;
1560
1560
  optionType: "CALL" | "PUT";
@@ -1582,7 +1582,7 @@ declare const useClosedUserOptions: (user?: string) => {
1582
1582
  transactionHash: string;
1583
1583
  } | null;
1584
1584
  }[] | undefined, Error>>;
1585
- fetchStatus: _tanstack_query_core3.FetchStatus;
1585
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1586
1586
  promise: Promise<{
1587
1587
  id: bigint;
1588
1588
  marketAddr: Address;
@@ -1662,7 +1662,7 @@ declare const useClosedUserOptions: (user?: string) => {
1662
1662
  isRefetching: boolean;
1663
1663
  isStale: boolean;
1664
1664
  isEnabled: boolean;
1665
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1665
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1666
1666
  id: bigint;
1667
1667
  marketAddr: Address;
1668
1668
  optionType: "CALL" | "PUT";
@@ -1690,7 +1690,7 @@ declare const useClosedUserOptions: (user?: string) => {
1690
1690
  transactionHash: string;
1691
1691
  } | null;
1692
1692
  }[] | undefined, Error>>;
1693
- fetchStatus: _tanstack_query_core3.FetchStatus;
1693
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1694
1694
  promise: Promise<{
1695
1695
  id: bigint;
1696
1696
  marketAddr: Address;
@@ -1770,7 +1770,7 @@ declare const useClosedUserOptions: (user?: string) => {
1770
1770
  isRefetching: boolean;
1771
1771
  isStale: boolean;
1772
1772
  isEnabled: boolean;
1773
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1773
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1774
1774
  id: bigint;
1775
1775
  marketAddr: Address;
1776
1776
  optionType: "CALL" | "PUT";
@@ -1798,7 +1798,7 @@ declare const useClosedUserOptions: (user?: string) => {
1798
1798
  transactionHash: string;
1799
1799
  } | null;
1800
1800
  }[] | undefined, Error>>;
1801
- fetchStatus: _tanstack_query_core3.FetchStatus;
1801
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1802
1802
  promise: Promise<{
1803
1803
  id: bigint;
1804
1804
  marketAddr: Address;
@@ -1878,7 +1878,7 @@ declare const useClosedUserOptions: (user?: string) => {
1878
1878
  isRefetching: boolean;
1879
1879
  isStale: boolean;
1880
1880
  isEnabled: boolean;
1881
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1881
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1882
1882
  id: bigint;
1883
1883
  marketAddr: Address;
1884
1884
  optionType: "CALL" | "PUT";
@@ -1906,7 +1906,7 @@ declare const useClosedUserOptions: (user?: string) => {
1906
1906
  transactionHash: string;
1907
1907
  } | null;
1908
1908
  }[] | undefined, Error>>;
1909
- fetchStatus: _tanstack_query_core3.FetchStatus;
1909
+ fetchStatus: _tanstack_query_core0.FetchStatus;
1910
1910
  promise: Promise<{
1911
1911
  id: bigint;
1912
1912
  marketAddr: Address;
@@ -1986,7 +1986,7 @@ declare const useClosedUserOptions: (user?: string) => {
1986
1986
  isRefetching: boolean;
1987
1987
  isStale: boolean;
1988
1988
  isEnabled: boolean;
1989
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
1989
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
1990
1990
  id: bigint;
1991
1991
  marketAddr: Address;
1992
1992
  optionType: "CALL" | "PUT";
@@ -2014,7 +2014,7 @@ declare const useClosedUserOptions: (user?: string) => {
2014
2014
  transactionHash: string;
2015
2015
  } | null;
2016
2016
  }[] | undefined, Error>>;
2017
- fetchStatus: _tanstack_query_core3.FetchStatus;
2017
+ fetchStatus: _tanstack_query_core0.FetchStatus;
2018
2018
  promise: Promise<{
2019
2019
  id: bigint;
2020
2020
  marketAddr: Address;
@@ -2094,7 +2094,7 @@ declare const useClosedUserOptions: (user?: string) => {
2094
2094
  isRefetching: boolean;
2095
2095
  isStale: boolean;
2096
2096
  isEnabled: boolean;
2097
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<{
2097
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<{
2098
2098
  id: bigint;
2099
2099
  marketAddr: Address;
2100
2100
  optionType: "CALL" | "PUT";
@@ -2122,7 +2122,7 @@ declare const useClosedUserOptions: (user?: string) => {
2122
2122
  transactionHash: string;
2123
2123
  } | null;
2124
2124
  }[] | undefined, Error>>;
2125
- fetchStatus: _tanstack_query_core3.FetchStatus;
2125
+ fetchStatus: _tanstack_query_core0.FetchStatus;
2126
2126
  promise: Promise<{
2127
2127
  id: bigint;
2128
2128
  marketAddr: Address;
@@ -2232,7 +2232,7 @@ declare const useBurnLiquidity: (vault?: Address | TimelockVault) => {
2232
2232
  isPending: boolean;
2233
2233
  isConfirming: boolean;
2234
2234
  isSuccess: boolean;
2235
- error: _wagmi_core2.WriteContractErrorType | null;
2235
+ error: _wagmi_core0.WriteContractErrorType | null;
2236
2236
  isLoading: boolean;
2237
2237
  };
2238
2238
  //#endregion
@@ -2255,7 +2255,7 @@ declare const useLiquidityBlocks: (vault?: Address | TimelockVault) => {
2255
2255
  totalAmount1: Amount | undefined;
2256
2256
  borrowedAmount0: Amount | undefined;
2257
2257
  borrowedAmount1: Amount | undefined;
2258
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<readonly {
2258
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<readonly {
2259
2259
  tickLower: number;
2260
2260
  tickUpper: number;
2261
2261
  prevTickLower: number;
@@ -2287,7 +2287,7 @@ declare const useMintLiquidity: (vault?: Address | TimelockVault) => {
2287
2287
  isPending: boolean;
2288
2288
  isConfirming: boolean;
2289
2289
  isSuccess: boolean;
2290
- error: _wagmi_core2.WriteContractErrorType | null;
2290
+ error: _wagmi_core0.WriteContractErrorType | null;
2291
2291
  isLoading: boolean;
2292
2292
  };
2293
2293
  //#endregion
@@ -2304,7 +2304,7 @@ declare const useVaultTVL: (vault?: Address | TimelockVault) => {
2304
2304
  totalAmount1: Amount | undefined;
2305
2305
  borrowedAmount0: Amount | undefined;
2306
2306
  borrowedAmount1: Amount | undefined;
2307
- refetch: (options?: _tanstack_query_core3.RefetchOptions) => Promise<_tanstack_query_core3.QueryObserverResult<readonly [bigint, bigint, bigint, bigint, bigint, bigint], viem382.ReadContractErrorType>>;
2307
+ refetch: (options?: _tanstack_query_core0.RefetchOptions) => Promise<_tanstack_query_core0.QueryObserverResult<readonly [bigint, bigint, bigint, bigint, bigint, bigint], viem382.ReadContractErrorType>>;
2308
2308
  };
2309
2309
  //#endregion
2310
2310
  //#region src/hooks/useLens.d.ts
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Amount, TimelockMarket, TimelockMarketData, TimelockVault, UniswapMathLens, UniswapPool } from "./index-CnVjbZPl.js";
1
+ import { Amount, TimelockMarket, TimelockMarketData, TimelockVault, UniswapMathLens, UniswapPool } from "./index-D65Sb-VK.js";
2
2
  import * as viem382 from "viem";
3
3
  import { Address } from "viem";
4
4
  import React, { ReactNode } from "react";
package/dist/client.js CHANGED
@@ -80,5 +80,5 @@
80
80
  payoutAssetName
81
81
  }
82
82
  }
83
- `,I=(e,t,n,r)=>e();function L(e,t=I){return{GetActiveUserOptions(n,r,i){return t(t=>e.request({document:N,variables:n,requestHeaders:{...r,...t},signal:i}),`GetActiveUserOptions`,`query`,n)},GetClosedUserOptions(n,r,i){return t(t=>e.request({document:P,variables:n,requestHeaders:{...r,...t},signal:i}),`GetClosedUserOptions`,`query`,n)},GetMarketData(n,r,i){return t(t=>e.request({document:F,variables:n,requestHeaders:{...r,...t},signal:i}),`GetMarketData`,`query`,n)}}}const R=x(void 0),z=({children:e,marketData:t,envioGraphqlUrl:n})=>{let r=T(),i=d[r],a=m[r];return b.createElement(R.Provider,{value:{marketData:t||{},lensAddr:i,uniswapMathLensAddr:a,envioGraphqlUrl:n}},e)},B=()=>{let e=S(R);if(e===void 0)throw Error(`useCurrentMarket must be used within a TimelockMarketProvider`);return e.marketData},V=()=>{let e=S(R);if(e===void 0)throw Error(`useConfig must be used within a TimelockMarketProvider`);return{lensAddr:e.lensAddr,uniswapMathLensAddr:e.uniswapMathLensAddr,envioGraphqlUrl:e.envioGraphqlUrl,graphqlClient:e.envioGraphqlUrl?L(new ee(e.envioGraphqlUrl)):void 0}},H=e=>{let{graphqlClient:t}=V(),n=typeof e==`string`?e:e==null?void 0:e.address,{data:r}=M({queryKey:[`marketData`,n||`--`],queryFn:()=>t.GetMarketData({marketAddr:n}),select:e=>({...e.TimelockMarket[0],pool:e.TimelockMarket[0].pool,vault:e.TimelockMarket[0].vault,optionAsset:e.TimelockMarket[0].optionAsset,payoutAsset:e.TimelockMarket[0].payoutAsset,optionsCount:BigInt(e.TimelockMarket[0].optionsCount),tradersCount:BigInt(e.TimelockMarket[0].tradersCount)}),enabled:!!n&&!!t});return r||{}},U=e=>{let{vault:t}=H(e),n=E(),{data:r}=D({address:t,abi:u,functionName:`lowestTick`}),{writeContractAsync:i,data:a,isPending:o,error:c}=k(),{isLoading:l,isSuccess:d}=O({hash:a}),f=typeof e==`string`?e:e==null?void 0:e.address;return{exerciseOption:async(e,t)=>{if(!n)throw Error(`Wallet not connected`);if(r===void 0||!f)throw Error(`Lowest tick lower not available`);let a=await i({address:f,abi:s,functionName:`exerciseOption`,args:[e,t,0n,r]});return await j(n,{hash:a}),a},hash:a,isPending:o,isConfirming:l,isSuccess:d,error:c,isLoading:o||l}},W=()=>{let e=E(),t=e?n(e):void 0;return{uniswapLens:e?i(e):void 0,timelockLens:t}},G=(e,t,n=100)=>{let{timelockLens:r}=W(),{optionAssetDecimals:i}=H(e),a=typeof e==`string`?e:e==null?void 0:e.address,{data:s,refetch:c}=D({address:r==null?void 0:r.address,abi:o,functionName:`getMaxPositionSizeAtCurrentTick`,args:[a,n],query:{enabled:!!a&&!!r},gas:100000000n}),{data:l,refetch:u}=D({address:r==null?void 0:r.address,abi:o,functionName:`getMaxPositionSize`,args:[a,t,n],query:{enabled:!!a&&!!r&&t!==void 0},gas:100000000n}),d=t===void 0?s:l,{maxCallSize:f,maxPutSize:p}=C(()=>d&&i?{maxCallSize:h(d[0],i),maxPutSize:h(d[1],i)}:{},[d,i]);return{maxCallSize:f,maxPutSize:p,refetch:()=>{c(),u()}}},K=async e=>{let[t,{1:n}]=await Promise.all([e.read.tickSpacing(),e.read.slot0()]);return{exact:n,rounded:Math.floor(n/t)*t}},q=e=>{let t=E(),{data:n}=M({queryKey:[`currentTick`,typeof e==`string`?e:(e==null?void 0:e.address)||`-`],queryFn:()=>K(typeof e==`string`?a(e,t):e),enabled:!!e&&!!t,refetchInterval:5e3});return n||{}},J=e=>{let t=typeof e==`string`?e:e==null?void 0:e.address,{timelockLens:n}=W(),r=E(),{data:i}=D({address:n==null?void 0:n.address,abi:o,functionName:`getPoolData`,args:t?[t]:void 0,query:{enabled:!!t&&!!r}});return i||{}},te=t=>{let{timelockLens:n}=W(),{payoutAsset:i,vault:a,pool:o,optionAssetIsToken0:u}=H(t),{tickSpacing:d}=J(o),{exact:f}=q(o),p=E(),{address:m}=w(),{writeContractAsync:h,data:g,isPending:_,error:b}=k(),{isLoading:x,isSuccess:S}=O({hash:g}),C=typeof t==`string`?t:t==null?void 0:t.address,T=async t=>{if(!p||!m)throw Error(`Wallet not connected`);if(!i||!C)throw Error(`Tokens not available`);await e(i,p).read.allowance([m,C])<t&&await j(p,{hash:await h({address:i,abi:v,functionName:`approve`,args:[C,y]})})};return{mintOption:async(e,t,i,o)=>{if(!p)throw Error(`Wallet not connected`);if(!n||!a||!C||!f||!d)throw Error(`Lowest tick lower not available`);o=o??f,o=e===`CALL`&&u||e===`PUT`&&!u?l(o,d):c(o,d),await T(await r(C,p).read.calculatePremium([e===`CALL`?0:1,t,o,BigInt(i)]));let m=await h({address:C,abi:s,functionName:`mintOption`,args:[e===`CALL`?0:1,t,o,BigInt(i),BigInt(1e69),await n.read.getRefTick([a,o])]});return await j(p,{hash:m}),m},hash:g,isPending:_,isConfirming:x,isSuccess:S,error:b,isLoading:_||x}},ne=e=>{let{marketAddr:t,optionType:n,entryTick:r,positionSizeCurrent:i}=e,{pool:a,optionAssetIsToken0:o,payoutAssetDecimals:s}=H(t),{exact:c}=q(a),{displayPnl:l,unrealizedPayout:u}=C(()=>{if(o===void 0||c===void 0||!i||!s)return{};let e=o?f(i,c)-f(i,r):p(i,c)-p(i,r),t=h(n===`CALL`?e:-e,s);return{unrealizedPayout:h(t.scaled<0?0n:t.scaled,s),displayPnl:t}},[e,o,c,i]);return{displayPnl:l,unrealizedPayout:u}},re=(e,t,n,r)=>{let{pool:i,payoutAssetDecimals:a}=H(e),{tickSpacing:o}=J(i),c=q(i),l=typeof e==`string`?e:e==null?void 0:e.address,u=C(()=>{if(!(c.rounded===void 0||o===void 0))return t===`CALL`?c.rounded+o:c.rounded},[c.rounded,o,t]),{data:d}=D({address:l,abi:s,functionName:`calculatePremium`,args:u===void 0?void 0:[t===`CALL`?0:1,n,u,BigInt(r)],query:{enabled:c.rounded!==void 0&&a!==void 0&&o!==void 0&&u!==void 0}});return C(()=>{if(!(d===void 0||a===void 0))return h(d,a)},[d,a])},Y=(e,t=!1)=>{let{graphqlClient:n}=V(),{data:r,...i}=M({queryKey:[`userTrades`,e||`--`,t],queryFn:()=>t?n==null?void 0:n.GetActiveUserOptions({user:e.toLowerCase()}):n==null?void 0:n.GetClosedUserOptions({user:e.toLowerCase()}),select:e=>{var t;return e==null||(t=e.UserOption)==null?void 0:t.map(e=>({...e,id:BigInt(e.id),marketAddr:e.marketAddr,optionType:e.optionType,createdAt:new Date(Number(e.createdAt)*1e3),expiresAt:new Date(Number(e.expiresAt)*1e3),premiumPaid:BigInt(e.premiumPaid),realizedPayout:BigInt(e.realizedPayout),liquiditiesAtOpen:e.liquiditiesAtOpen.map(e=>BigInt(e)),liquiditiesCurrent:e.liquiditiesCurrent.map(e=>BigInt(e)),positionSizeAtOpen:BigInt(e.positionSizeAtOpen),positionSizeCurrent:BigInt(e.positionSizeCurrent),strikePrice:BigInt(e.strikePrice),entryPrice:BigInt(e.entryPrice)}))},enabled:!!e&&!!n});return{data:C(()=>(r==null?void 0:r.sort((e,t)=>t.createdAt.getTime()-e.createdAt.getTime()))||[],[r]),...i}},ie=e=>Y(e,!0),ae=e=>Y(e,!1),X=(e,n)=>{let{token0Decimals:r,token1Decimals:i}=J(n);return C(()=>e&&r&&i?g(t(e),r,i):void 0,[e,r,i])},Z=e=>{let t=q(e);return{currentPrice:X(t.exact,e),currentTick:t}},Q=e=>{let{data:t}=D({address:typeof e==`string`?e:e==null?void 0:e.address,abi:u,functionName:`pool`});return{pool:t}},oe=e=>{let t=E(),{pool:n}=Q(e),r=q(n),{timelockLens:i}=W(),a=typeof e==`string`?e:e==null?void 0:e.address,{writeContractAsync:o,data:s,isPending:c,error:l}=k(),{isLoading:d,isSuccess:f}=O({hash:s}),p=async(e,n,r)=>{if(!t)throw Error(`Wallet not connected`);if(!a||!i)throw Error(`Vault/lens not available`);let s=await o({address:a,abi:u,functionName:`burn`,args:[e,n,r,await i.read.getRefTick([a,e])]});return await j(t,{hash:s}),s};return{burnMultiple:async e=>{if(!t)throw Error(`Wallet not connected`);if(!r.exact)throw Error(`Current tick not available`);if(e.length===0)throw Error(`No positions to burn`);if(!i||!a)throw Error(`Vault/lens not available`);if(e.length===1)await p(e[0].tickLower,e[0].tickUpper,e[0].liquidity);else{let n=await i.read.batchGetRefTick([a,e.map(e=>e.tickLower)]);await j(t,{hash:await o({address:a,abi:u,functionName:`multicall`,args:[e.map((e,t)=>_({abi:u,functionName:`burn`,args:[e.tickLower,e.tickUpper,e.liquidity,n[t]]}))]})})}},burn:p,hash:s,isPending:c,isConfirming:d,isSuccess:f,error:l,isLoading:c||d}},se=e=>{let{timelockLens:t}=W(),{pool:n}=Q(e),{token0Decimals:r,token1Decimals:i}=J(n),{currentPrice:a}=Z(n),o=typeof e==`string`?e:e==null?void 0:e.address,{data:s=[],refetch:c}=M({queryKey:[`liquidityBlocks`,o],queryFn:()=>t.read.getAllBlocks([o]),enabled:!!o&&!!t}),{totalAmount0:l,totalAmount1:u,borrowedAmount0:d,borrowedAmount1:f}=C(()=>({totalAmount0:r?h(s.reduce((e,t)=>e+t.totalAmount0,0n),r):void 0,totalAmount1:i?h(s.reduce((e,t)=>e+t.totalAmount1,0n),i):void 0,borrowedAmount0:r?h(s.reduce((e,t)=>e+t.borrowedAmount0,0n),r):void 0,borrowedAmount1:i?h(s.reduce((e,t)=>e+t.borrowedAmount1,0n),i):void 0}),[s,r,i]);return{tvl1:C(()=>{if(!l||!u||!a||!i)return;let e=l.scaled*a.scaled/10n**18n,t=u.scaled;return h(e+t,i)},[l,u,a,i]),blocks:s,totalAmount0:l,totalAmount1:u,borrowedAmount0:d,borrowedAmount1:f,refetch:c}},$=async(e,t,n,r,i)=>{let a=Array(t.length).fill(i),o=await e.read.batchGetAmountsForLiquidityTicks([a,t,n,r]),s=0n,c=0n,l=[],u=[];for(let e of o[0])s+=e,l.push(e);for(let e of o[1])c+=e,u.push(e);return{totalAmount0:s,totalAmount1:c,amounts0:l,amounts1:u}},ce=t=>{let n=E(),{address:r}=w(),{pool:i}=Q(t),{timelockLens:a,uniswapLens:o}=W(),s=q(i),{token0:c,token1:l}=J(i),d=typeof t==`string`?t:t==null?void 0:t.address,{writeContractAsync:f,data:p,isPending:m,error:h}=k(),{isLoading:g,isSuccess:b}=O({hash:p}),x=async t=>{if(!r||!n)throw Error(`Wallet not connected`);if(s.exact===void 0||!c||!l||!d||!o)throw Error(`Current tick not available`);let{totalAmount0:i,totalAmount1:a}=await $(o,t.map(e=>e.tickLower),t.map(e=>e.tickUpper),t.map(e=>e.liquidity),s.exact),[u,p]=await Promise.all([e(c,n).read.allowance([r,d]),e(l,n).read.allowance([r,d])]),m=[];if(u<=i){let e=await f({address:c,abi:v,functionName:`approve`,args:[d,y]});m.push(j(n,{hash:e}))}if(p<=a){let e=await f({address:l,abi:v,functionName:`approve`,args:[d,y]});m.push(j(n,{hash:e}))}m.length>0&&await Promise.all(m)},S=async(e,t,r)=>{if(!n)throw Error(`Wallet not connected`);if(!d||!a)throw Error(`Vault/lens not available`);await x([{tickLower:e,tickUpper:t,liquidity:r}]);let i=await f({address:d,abi:u,functionName:`mint`,args:[e,t,r,await a.read.getRefTick([d,e])]});return await j(n,{hash:i}),i};return{mintMultiple:async e=>{if(!n)throw Error(`Wallet not connected`);if(!s.exact)throw Error(`Current tick not available`);if(e.length===0)throw Error(`No positions to mint`);if(!a||!d)throw Error(`Vault/lens not available`);if(e.length===1)await S(e[0].tickLower,e[0].tickUpper,e[0].liquidity);else{await x(e);let t=await a.read.batchGetRefTick([d,e.map(e=>e.tickLower)]);await j(n,{hash:await f({address:d,abi:u,functionName:`multicall`,args:[e.map((e,n)=>_({abi:u,functionName:`mint`,args:[e.tickLower,e.tickUpper,e.liquidity,t[n]]}))]})})}},mint:S,hash:p,isPending:m,isConfirming:g,isSuccess:b,error:h,isLoading:m||g}},le=e=>{let{timelockLens:t}=W(),{pool:n}=Q(e),{token0Decimals:r,token1Decimals:i}=J(n),a=typeof e==`string`?e:e==null?void 0:e.address,{data:s,refetch:c}=D({address:t==null?void 0:t.address,abi:o,functionName:`getVaultTVL`,args:[a],query:{enabled:!!a&&!!t}}),l=s&&r?h(s[0],r):void 0,u=s&&i?h(s[1],i):void 0,d=s&&r?h(s[2],r):void 0,f=s&&i?h(s[3],i):void 0;return{tvl0:s&&r?h(s[4],r):void 0,tvl1:s&&i?h(s[5],i):void 0,totalAmount0:l,totalAmount1:u,borrowedAmount0:d,borrowedAmount1:f,refetch:c}};export{z as TimelockMarketProvider,$ as batchGetAmountsFromLiquidity,K as getCurrentTick,ie as useActiveUserOptions,oe as useBurnLiquidity,ae as useClosedUserOptions,B as useCurrentMarket,Z as useCurrentPrice,q as useCurrentTick,U as useExerciseOption,W as useLens,se as useLiquidityBlocks,H as useMarketData,G as useMaxPositionSize,ce as useMintLiquidity,te as useMintOption,ne as useOptionPnl,re as useOptionPremium,J as usePoolData,X as usePriceAtTick,V as useTimelockConfig,Q as useVaultData,le as useVaultTVL};
83
+ `,I=(e,t,n,r)=>e();function L(e,t=I){return{GetActiveUserOptions(n,r,i){return t(t=>e.request({document:N,variables:n,requestHeaders:{...r,...t},signal:i}),`GetActiveUserOptions`,`query`,n)},GetClosedUserOptions(n,r,i){return t(t=>e.request({document:P,variables:n,requestHeaders:{...r,...t},signal:i}),`GetClosedUserOptions`,`query`,n)},GetMarketData(n,r,i){return t(t=>e.request({document:F,variables:n,requestHeaders:{...r,...t},signal:i}),`GetMarketData`,`query`,n)}}}const R=x(void 0),z=({children:e,marketData:t,envioGraphqlUrl:n})=>{let r=T(),i=d[r],a=m[r];return b.createElement(R.Provider,{value:{marketData:t||{},lensAddr:i,uniswapMathLensAddr:a,envioGraphqlUrl:n}},e)},B=()=>{let e=S(R);if(e===void 0)throw Error(`useCurrentMarket must be used within a TimelockMarketProvider`);return e.marketData},V=()=>{let e=S(R);if(e===void 0)throw Error(`useConfig must be used within a TimelockMarketProvider`);return{lensAddr:e.lensAddr,uniswapMathLensAddr:e.uniswapMathLensAddr,envioGraphqlUrl:e.envioGraphqlUrl,graphqlClient:e.envioGraphqlUrl?L(new ee(e.envioGraphqlUrl)):void 0}},H=e=>{let{graphqlClient:t}=V(),n=typeof e==`string`?e:e==null?void 0:e.address,{data:r}=M({queryKey:[`marketData`,n||`--`],queryFn:()=>t.GetMarketData({marketAddr:n.toLowerCase()}),select:e=>({...e.TimelockMarket[0],pool:e.TimelockMarket[0].pool,vault:e.TimelockMarket[0].vault,optionAsset:e.TimelockMarket[0].optionAsset,payoutAsset:e.TimelockMarket[0].payoutAsset,optionsCount:BigInt(e.TimelockMarket[0].optionsCount),tradersCount:BigInt(e.TimelockMarket[0].tradersCount)}),enabled:!!n&&!!t});return r||{}},U=e=>{let{vault:t}=H(e),n=E(),{data:r}=D({address:t,abi:u,functionName:`lowestTick`}),{writeContractAsync:i,data:a,isPending:o,error:c}=k(),{isLoading:l,isSuccess:d}=O({hash:a}),f=typeof e==`string`?e:e==null?void 0:e.address;return{exerciseOption:async(e,t)=>{if(!n)throw Error(`Wallet not connected`);if(r===void 0||!f)throw Error(`Lowest tick lower not available`);let a=await i({address:f,abi:s,functionName:`exerciseOption`,args:[e,t,0n,r]});return await j(n,{hash:a}),a},hash:a,isPending:o,isConfirming:l,isSuccess:d,error:c,isLoading:o||l}},W=()=>{let e=E(),t=e?n(e):void 0;return{uniswapLens:e?i(e):void 0,timelockLens:t}},G=(e,t,n=100)=>{let{timelockLens:r}=W(),{optionAssetDecimals:i}=H(e),a=typeof e==`string`?e:e==null?void 0:e.address,{data:s,refetch:c}=D({address:r==null?void 0:r.address,abi:o,functionName:`getMaxPositionSizeAtCurrentTick`,args:[a,n],query:{enabled:!!a&&!!r},gas:100000000n}),{data:l,refetch:u}=D({address:r==null?void 0:r.address,abi:o,functionName:`getMaxPositionSize`,args:[a,t,n],query:{enabled:!!a&&!!r&&t!==void 0},gas:100000000n}),d=t===void 0?s:l,{maxCallSize:f,maxPutSize:p}=C(()=>d&&i?{maxCallSize:h(d[0],i),maxPutSize:h(d[1],i)}:{},[d,i]);return{maxCallSize:f,maxPutSize:p,refetch:()=>{c(),u()}}},K=async e=>{let[t,{1:n}]=await Promise.all([e.read.tickSpacing(),e.read.slot0()]);return{exact:n,rounded:Math.floor(n/t)*t}},q=e=>{let t=E(),{data:n}=M({queryKey:[`currentTick`,typeof e==`string`?e:(e==null?void 0:e.address)||`-`],queryFn:()=>K(typeof e==`string`?a(e,t):e),enabled:!!e&&!!t,refetchInterval:5e3});return n||{}},J=e=>{let t=typeof e==`string`?e:e==null?void 0:e.address,{timelockLens:n}=W(),r=E(),{data:i}=D({address:n==null?void 0:n.address,abi:o,functionName:`getPoolData`,args:t?[t]:void 0,query:{enabled:!!t&&!!r}});return i||{}},te=t=>{let{timelockLens:n}=W(),{payoutAsset:i,vault:a,pool:o,optionAssetIsToken0:u}=H(t),{tickSpacing:d}=J(o),{exact:f}=q(o),p=E(),{address:m}=w(),{writeContractAsync:h,data:g,isPending:_,error:b}=k(),{isLoading:x,isSuccess:S}=O({hash:g}),C=typeof t==`string`?t:t==null?void 0:t.address,T=async t=>{if(!p||!m)throw Error(`Wallet not connected`);if(!i||!C)throw Error(`Tokens not available`);await e(i,p).read.allowance([m,C])<t&&await j(p,{hash:await h({address:i,abi:v,functionName:`approve`,args:[C,y]})})};return{mintOption:async(e,t,i,o)=>{if(!p)throw Error(`Wallet not connected`);if(!n||!a||!C||!f||!d)throw Error(`Lowest tick lower not available`);o=o??f,o=e===`CALL`&&u||e===`PUT`&&!u?l(o,d):c(o,d),await T(await r(C,p).read.calculatePremium([e===`CALL`?0:1,t,o,BigInt(i)]));let m=await h({address:C,abi:s,functionName:`mintOption`,args:[e===`CALL`?0:1,t,o,BigInt(i),BigInt(1e69),await n.read.getRefTick([a,o])]});return await j(p,{hash:m}),m},hash:g,isPending:_,isConfirming:x,isSuccess:S,error:b,isLoading:_||x}},ne=e=>{let{marketAddr:t,optionType:n,entryTick:r,positionSizeCurrent:i}=e,{pool:a,optionAssetIsToken0:o,payoutAssetDecimals:s}=H(t),{exact:c}=q(a),{displayPnl:l,unrealizedPayout:u}=C(()=>{if(o===void 0||c===void 0||!i||!s)return{};let e=o?f(i,c)-f(i,r):p(i,c)-p(i,r),t=h(n===`CALL`?e:-e,s);return{unrealizedPayout:h(t.scaled<0?0n:t.scaled,s),displayPnl:t}},[e,o,c,i]);return{displayPnl:l,unrealizedPayout:u}},re=(e,t,n,r)=>{let{pool:i,payoutAssetDecimals:a}=H(e),{tickSpacing:o}=J(i),c=q(i),l=typeof e==`string`?e:e==null?void 0:e.address,u=C(()=>{if(!(c.rounded===void 0||o===void 0))return t===`CALL`?c.rounded+o:c.rounded},[c.rounded,o,t]),{data:d}=D({address:l,abi:s,functionName:`calculatePremium`,args:u===void 0?void 0:[t===`CALL`?0:1,n,u,BigInt(r)],query:{enabled:c.rounded!==void 0&&a!==void 0&&o!==void 0&&u!==void 0}});return C(()=>{if(!(d===void 0||a===void 0))return h(d,a)},[d,a])},Y=(e,t=!1)=>{let{graphqlClient:n}=V(),{data:r,...i}=M({queryKey:[`userTrades`,e||`--`,t],queryFn:()=>t?n==null?void 0:n.GetActiveUserOptions({user:e.toLowerCase()}):n==null?void 0:n.GetClosedUserOptions({user:e.toLowerCase()}),select:e=>{var t;return e==null||(t=e.UserOption)==null?void 0:t.map(e=>({...e,id:BigInt(e.id),marketAddr:e.marketAddr,optionType:e.optionType,createdAt:new Date(Number(e.createdAt)*1e3),expiresAt:new Date(Number(e.expiresAt)*1e3),premiumPaid:BigInt(e.premiumPaid),realizedPayout:BigInt(e.realizedPayout),liquiditiesAtOpen:e.liquiditiesAtOpen.map(e=>BigInt(e)),liquiditiesCurrent:e.liquiditiesCurrent.map(e=>BigInt(e)),positionSizeAtOpen:BigInt(e.positionSizeAtOpen),positionSizeCurrent:BigInt(e.positionSizeCurrent),strikePrice:BigInt(e.strikePrice),entryPrice:BigInt(e.entryPrice)}))},enabled:!!e&&!!n});return{data:C(()=>(r==null?void 0:r.sort((e,t)=>t.createdAt.getTime()-e.createdAt.getTime()))||[],[r]),...i}},ie=e=>Y(e,!0),ae=e=>Y(e,!1),X=(e,n)=>{let{token0Decimals:r,token1Decimals:i}=J(n);return C(()=>e&&r&&i?g(t(e),r,i):void 0,[e,r,i])},Z=e=>{let t=q(e);return{currentPrice:X(t.exact,e),currentTick:t}},Q=e=>{let{data:t}=D({address:typeof e==`string`?e:e==null?void 0:e.address,abi:u,functionName:`pool`});return{pool:t}},oe=e=>{let t=E(),{pool:n}=Q(e),r=q(n),{timelockLens:i}=W(),a=typeof e==`string`?e:e==null?void 0:e.address,{writeContractAsync:o,data:s,isPending:c,error:l}=k(),{isLoading:d,isSuccess:f}=O({hash:s}),p=async(e,n,r)=>{if(!t)throw Error(`Wallet not connected`);if(!a||!i)throw Error(`Vault/lens not available`);let s=await o({address:a,abi:u,functionName:`burn`,args:[e,n,r,await i.read.getRefTick([a,e])]});return await j(t,{hash:s}),s};return{burnMultiple:async e=>{if(!t)throw Error(`Wallet not connected`);if(!r.exact)throw Error(`Current tick not available`);if(e.length===0)throw Error(`No positions to burn`);if(!i||!a)throw Error(`Vault/lens not available`);if(e.length===1)await p(e[0].tickLower,e[0].tickUpper,e[0].liquidity);else{let n=await i.read.batchGetRefTick([a,e.map(e=>e.tickLower)]);await j(t,{hash:await o({address:a,abi:u,functionName:`multicall`,args:[e.map((e,t)=>_({abi:u,functionName:`burn`,args:[e.tickLower,e.tickUpper,e.liquidity,n[t]]}))]})})}},burn:p,hash:s,isPending:c,isConfirming:d,isSuccess:f,error:l,isLoading:c||d}},se=e=>{let{timelockLens:t}=W(),{pool:n}=Q(e),{token0Decimals:r,token1Decimals:i}=J(n),{currentPrice:a}=Z(n),o=typeof e==`string`?e:e==null?void 0:e.address,{data:s=[],refetch:c}=M({queryKey:[`liquidityBlocks`,o],queryFn:()=>t.read.getAllBlocks([o]),enabled:!!o&&!!t}),{totalAmount0:l,totalAmount1:u,borrowedAmount0:d,borrowedAmount1:f}=C(()=>({totalAmount0:r?h(s.reduce((e,t)=>e+t.totalAmount0,0n),r):void 0,totalAmount1:i?h(s.reduce((e,t)=>e+t.totalAmount1,0n),i):void 0,borrowedAmount0:r?h(s.reduce((e,t)=>e+t.borrowedAmount0,0n),r):void 0,borrowedAmount1:i?h(s.reduce((e,t)=>e+t.borrowedAmount1,0n),i):void 0}),[s,r,i]);return{tvl1:C(()=>{if(!l||!u||!a||!i)return;let e=l.scaled*a.scaled/10n**18n,t=u.scaled;return h(e+t,i)},[l,u,a,i]),blocks:s,totalAmount0:l,totalAmount1:u,borrowedAmount0:d,borrowedAmount1:f,refetch:c}},$=async(e,t,n,r,i)=>{let a=Array(t.length).fill(i),o=await e.read.batchGetAmountsForLiquidityTicks([a,t,n,r]),s=0n,c=0n,l=[],u=[];for(let e of o[0])s+=e,l.push(e);for(let e of o[1])c+=e,u.push(e);return{totalAmount0:s,totalAmount1:c,amounts0:l,amounts1:u}},ce=t=>{let n=E(),{address:r}=w(),{pool:i}=Q(t),{timelockLens:a,uniswapLens:o}=W(),s=q(i),{token0:c,token1:l}=J(i),d=typeof t==`string`?t:t==null?void 0:t.address,{writeContractAsync:f,data:p,isPending:m,error:h}=k(),{isLoading:g,isSuccess:b}=O({hash:p}),x=async t=>{if(!r||!n)throw Error(`Wallet not connected`);if(s.exact===void 0||!c||!l||!d||!o)throw Error(`Current tick not available`);let{totalAmount0:i,totalAmount1:a}=await $(o,t.map(e=>e.tickLower),t.map(e=>e.tickUpper),t.map(e=>e.liquidity),s.exact),[u,p]=await Promise.all([e(c,n).read.allowance([r,d]),e(l,n).read.allowance([r,d])]),m=[];if(u<=i){let e=await f({address:c,abi:v,functionName:`approve`,args:[d,y]});m.push(j(n,{hash:e}))}if(p<=a){let e=await f({address:l,abi:v,functionName:`approve`,args:[d,y]});m.push(j(n,{hash:e}))}m.length>0&&await Promise.all(m)},S=async(e,t,r)=>{if(!n)throw Error(`Wallet not connected`);if(!d||!a)throw Error(`Vault/lens not available`);await x([{tickLower:e,tickUpper:t,liquidity:r}]);let i=await f({address:d,abi:u,functionName:`mint`,args:[e,t,r,await a.read.getRefTick([d,e])]});return await j(n,{hash:i}),i};return{mintMultiple:async e=>{if(!n)throw Error(`Wallet not connected`);if(!s.exact)throw Error(`Current tick not available`);if(e.length===0)throw Error(`No positions to mint`);if(!a||!d)throw Error(`Vault/lens not available`);if(e.length===1)await S(e[0].tickLower,e[0].tickUpper,e[0].liquidity);else{await x(e);let t=await a.read.batchGetRefTick([d,e.map(e=>e.tickLower)]);await j(n,{hash:await f({address:d,abi:u,functionName:`multicall`,args:[e.map((e,n)=>_({abi:u,functionName:`mint`,args:[e.tickLower,e.tickUpper,e.liquidity,t[n]]}))]})})}},mint:S,hash:p,isPending:m,isConfirming:g,isSuccess:b,error:h,isLoading:m||g}},le=e=>{let{timelockLens:t}=W(),{pool:n}=Q(e),{token0Decimals:r,token1Decimals:i}=J(n),a=typeof e==`string`?e:e==null?void 0:e.address,{data:s,refetch:c}=D({address:t==null?void 0:t.address,abi:o,functionName:`getVaultTVL`,args:[a],query:{enabled:!!a&&!!t}}),l=s&&r?h(s[0],r):void 0,u=s&&i?h(s[1],i):void 0,d=s&&r?h(s[2],r):void 0,f=s&&i?h(s[3],i):void 0;return{tvl0:s&&r?h(s[4],r):void 0,tvl1:s&&i?h(s[5],i):void 0,totalAmount0:l,totalAmount1:u,borrowedAmount0:d,borrowedAmount1:f,refetch:c}};export{z as TimelockMarketProvider,$ as batchGetAmountsFromLiquidity,K as getCurrentTick,ie as useActiveUserOptions,oe as useBurnLiquidity,ae as useClosedUserOptions,B as useCurrentMarket,Z as useCurrentPrice,q as useCurrentTick,U as useExerciseOption,W as useLens,se as useLiquidityBlocks,H as useMarketData,G as useMaxPositionSize,ce as useMintLiquidity,te as useMintOption,ne as useOptionPnl,re as useOptionPremium,J as usePoolData,X as usePriceAtTick,V as useTimelockConfig,Q as useVaultData,le as useVaultTVL};
84
84
  //# sourceMappingURL=client.js.map