timelock-sdk 0.0.12 → 0.0.14

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.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Amount, TimelockMarket, TimelockMarketData, TimelockVault, UniswapMathLens, UniswapPool } from "./index-DxdylqnF.js";
2
- import * as viem382 from "viem";
2
+ import * as viem265 from "viem";
3
3
  import { Address } from "viem";
4
4
  import React, { ReactNode } from "react";
5
5
  import { GraphQLClient } from "graphql-request";
@@ -2304,14 +2304,14 @@ 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_core0.RefetchOptions) => Promise<_tanstack_query_core0.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], viem265.ReadContractErrorType>>;
2308
2308
  };
2309
2309
  //#endregion
2310
2310
  //#region src/hooks/useLens.d.ts
2311
2311
  declare const useLens: () => {
2312
2312
  uniswapLens: {
2313
2313
  read: {
2314
- batchGetAmount0ForLiquidity: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
2314
+ batchGetAmount0ForLiquidity: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
2315
2315
  readonly type: "function";
2316
2316
  readonly name: "batchGetAmount0ForLiquidity";
2317
2317
  readonly inputs: readonly [{
@@ -2932,7 +2932,7 @@ declare const useLens: () => {
2932
2932
  }];
2933
2933
  readonly stateMutability: "pure";
2934
2934
  }], "batchGetAmount0ForLiquidity", readonly [readonly bigint[], readonly bigint[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
2935
- batchGetAmount0ForLiquidityTicks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
2935
+ batchGetAmount0ForLiquidityTicks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
2936
2936
  readonly type: "function";
2937
2937
  readonly name: "batchGetAmount0ForLiquidity";
2938
2938
  readonly inputs: readonly [{
@@ -3553,7 +3553,7 @@ declare const useLens: () => {
3553
3553
  }];
3554
3554
  readonly stateMutability: "pure";
3555
3555
  }], "batchGetAmount0ForLiquidityTicks", readonly [readonly number[], readonly number[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
3556
- batchGetAmount1ForLiquidity: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
3556
+ batchGetAmount1ForLiquidity: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
3557
3557
  readonly type: "function";
3558
3558
  readonly name: "batchGetAmount0ForLiquidity";
3559
3559
  readonly inputs: readonly [{
@@ -4174,7 +4174,7 @@ declare const useLens: () => {
4174
4174
  }];
4175
4175
  readonly stateMutability: "pure";
4176
4176
  }], "batchGetAmount1ForLiquidity", readonly [readonly bigint[], readonly bigint[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
4177
- batchGetAmount1ForLiquidityTicks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
4177
+ batchGetAmount1ForLiquidityTicks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
4178
4178
  readonly type: "function";
4179
4179
  readonly name: "batchGetAmount0ForLiquidity";
4180
4180
  readonly inputs: readonly [{
@@ -4795,7 +4795,7 @@ declare const useLens: () => {
4795
4795
  }];
4796
4796
  readonly stateMutability: "pure";
4797
4797
  }], "batchGetAmount1ForLiquidityTicks", readonly [readonly number[], readonly number[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
4798
- batchGetAmountsForLiquidity: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
4798
+ batchGetAmountsForLiquidity: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
4799
4799
  readonly type: "function";
4800
4800
  readonly name: "batchGetAmount0ForLiquidity";
4801
4801
  readonly inputs: readonly [{
@@ -5416,7 +5416,7 @@ declare const useLens: () => {
5416
5416
  }];
5417
5417
  readonly stateMutability: "pure";
5418
5418
  }], "batchGetAmountsForLiquidity", readonly [readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly [readonly bigint[], readonly bigint[]]>;
5419
- batchGetAmountsForLiquidityTicks: (args: readonly [readonly number[], readonly number[], readonly number[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
5419
+ batchGetAmountsForLiquidityTicks: (args: readonly [readonly number[], readonly number[], readonly number[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
5420
5420
  readonly type: "function";
5421
5421
  readonly name: "batchGetAmount0ForLiquidity";
5422
5422
  readonly inputs: readonly [{
@@ -6037,7 +6037,7 @@ declare const useLens: () => {
6037
6037
  }];
6038
6038
  readonly stateMutability: "pure";
6039
6039
  }], "batchGetAmountsForLiquidityTicks", readonly [readonly number[], readonly number[], readonly number[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly [readonly bigint[], readonly bigint[]]>;
6040
- batchGetLiquidityForAmount0: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
6040
+ batchGetLiquidityForAmount0: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
6041
6041
  readonly type: "function";
6042
6042
  readonly name: "batchGetAmount0ForLiquidity";
6043
6043
  readonly inputs: readonly [{
@@ -6658,7 +6658,7 @@ declare const useLens: () => {
6658
6658
  }];
6659
6659
  readonly stateMutability: "pure";
6660
6660
  }], "batchGetLiquidityForAmount0", readonly [readonly bigint[], readonly bigint[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
6661
- batchGetLiquidityForAmount0Ticks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
6661
+ batchGetLiquidityForAmount0Ticks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
6662
6662
  readonly type: "function";
6663
6663
  readonly name: "batchGetAmount0ForLiquidity";
6664
6664
  readonly inputs: readonly [{
@@ -7279,7 +7279,7 @@ declare const useLens: () => {
7279
7279
  }];
7280
7280
  readonly stateMutability: "pure";
7281
7281
  }], "batchGetLiquidityForAmount0Ticks", readonly [readonly number[], readonly number[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
7282
- batchGetLiquidityForAmount1: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
7282
+ batchGetLiquidityForAmount1: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
7283
7283
  readonly type: "function";
7284
7284
  readonly name: "batchGetAmount0ForLiquidity";
7285
7285
  readonly inputs: readonly [{
@@ -7900,7 +7900,7 @@ declare const useLens: () => {
7900
7900
  }];
7901
7901
  readonly stateMutability: "pure";
7902
7902
  }], "batchGetLiquidityForAmount1", readonly [readonly bigint[], readonly bigint[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
7903
- batchGetLiquidityForAmount1Ticks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
7903
+ batchGetLiquidityForAmount1Ticks: (args: readonly [readonly number[], readonly number[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
7904
7904
  readonly type: "function";
7905
7905
  readonly name: "batchGetAmount0ForLiquidity";
7906
7906
  readonly inputs: readonly [{
@@ -8521,7 +8521,7 @@ declare const useLens: () => {
8521
8521
  }];
8522
8522
  readonly stateMutability: "pure";
8523
8523
  }], "batchGetLiquidityForAmount1Ticks", readonly [readonly number[], readonly number[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
8524
- batchGetLiquidityForAmounts: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
8524
+ batchGetLiquidityForAmounts: (args: readonly [readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
8525
8525
  readonly type: "function";
8526
8526
  readonly name: "batchGetAmount0ForLiquidity";
8527
8527
  readonly inputs: readonly [{
@@ -9142,7 +9142,7 @@ declare const useLens: () => {
9142
9142
  }];
9143
9143
  readonly stateMutability: "pure";
9144
9144
  }], "batchGetLiquidityForAmounts", readonly [readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
9145
- batchGetLiquidityForAmountsTicks: (args: readonly [readonly number[], readonly number[], readonly number[], readonly bigint[], readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
9145
+ batchGetLiquidityForAmountsTicks: (args: readonly [readonly number[], readonly number[], readonly number[], readonly bigint[], readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
9146
9146
  readonly type: "function";
9147
9147
  readonly name: "batchGetAmount0ForLiquidity";
9148
9148
  readonly inputs: readonly [{
@@ -9763,7 +9763,7 @@ declare const useLens: () => {
9763
9763
  }];
9764
9764
  readonly stateMutability: "pure";
9765
9765
  }], "batchGetLiquidityForAmountsTicks", readonly [readonly number[], readonly number[], readonly number[], readonly bigint[], readonly bigint[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
9766
- batchGetPriceAtTick: (args: readonly [readonly number[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
9766
+ batchGetPriceAtTick: (args: readonly [readonly number[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
9767
9767
  readonly type: "function";
9768
9768
  readonly name: "batchGetAmount0ForLiquidity";
9769
9769
  readonly inputs: readonly [{
@@ -10384,7 +10384,7 @@ declare const useLens: () => {
10384
10384
  }];
10385
10385
  readonly stateMutability: "pure";
10386
10386
  }], "batchGetPriceAtTick", readonly [readonly number[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly bigint[]>;
10387
- getAmount0ForLiquidity: (args: readonly [bigint, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
10387
+ getAmount0ForLiquidity: (args: readonly [bigint, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
10388
10388
  readonly type: "function";
10389
10389
  readonly name: "batchGetAmount0ForLiquidity";
10390
10390
  readonly inputs: readonly [{
@@ -11005,7 +11005,7 @@ declare const useLens: () => {
11005
11005
  }];
11006
11006
  readonly stateMutability: "pure";
11007
11007
  }], "getAmount0ForLiquidity", readonly [bigint, bigint, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
11008
- getAmount0ForLiquidityTicks: (args: readonly [number, number, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
11008
+ getAmount0ForLiquidityTicks: (args: readonly [number, number, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
11009
11009
  readonly type: "function";
11010
11010
  readonly name: "batchGetAmount0ForLiquidity";
11011
11011
  readonly inputs: readonly [{
@@ -11626,7 +11626,7 @@ declare const useLens: () => {
11626
11626
  }];
11627
11627
  readonly stateMutability: "pure";
11628
11628
  }], "getAmount0ForLiquidityTicks", readonly [number, number, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
11629
- getAmount1ForLiquidity: (args: readonly [bigint, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
11629
+ getAmount1ForLiquidity: (args: readonly [bigint, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
11630
11630
  readonly type: "function";
11631
11631
  readonly name: "batchGetAmount0ForLiquidity";
11632
11632
  readonly inputs: readonly [{
@@ -12247,7 +12247,7 @@ declare const useLens: () => {
12247
12247
  }];
12248
12248
  readonly stateMutability: "pure";
12249
12249
  }], "getAmount1ForLiquidity", readonly [bigint, bigint, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
12250
- getAmount1ForLiquidityTicks: (args: readonly [number, number, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
12250
+ getAmount1ForLiquidityTicks: (args: readonly [number, number, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
12251
12251
  readonly type: "function";
12252
12252
  readonly name: "batchGetAmount0ForLiquidity";
12253
12253
  readonly inputs: readonly [{
@@ -12868,7 +12868,7 @@ declare const useLens: () => {
12868
12868
  }];
12869
12869
  readonly stateMutability: "pure";
12870
12870
  }], "getAmount1ForLiquidityTicks", readonly [number, number, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
12871
- getAmountsForLiquidity: (args: readonly [bigint, bigint, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
12871
+ getAmountsForLiquidity: (args: readonly [bigint, bigint, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
12872
12872
  readonly type: "function";
12873
12873
  readonly name: "batchGetAmount0ForLiquidity";
12874
12874
  readonly inputs: readonly [{
@@ -13489,7 +13489,7 @@ declare const useLens: () => {
13489
13489
  }];
13490
13490
  readonly stateMutability: "pure";
13491
13491
  }], "getAmountsForLiquidity", readonly [bigint, bigint, bigint, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly [bigint, bigint]>;
13492
- getAmountsForLiquidityTicks: (args: readonly [number, number, number, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
13492
+ getAmountsForLiquidityTicks: (args: readonly [number, number, number, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
13493
13493
  readonly type: "function";
13494
13494
  readonly name: "batchGetAmount0ForLiquidity";
13495
13495
  readonly inputs: readonly [{
@@ -14110,7 +14110,7 @@ declare const useLens: () => {
14110
14110
  }];
14111
14111
  readonly stateMutability: "pure";
14112
14112
  }], "getAmountsForLiquidityTicks", readonly [number, number, number, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly [bigint, bigint]>;
14113
- getLiquidityForAmount0: (args: readonly [bigint, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
14113
+ getLiquidityForAmount0: (args: readonly [bigint, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
14114
14114
  readonly type: "function";
14115
14115
  readonly name: "batchGetAmount0ForLiquidity";
14116
14116
  readonly inputs: readonly [{
@@ -14731,7 +14731,7 @@ declare const useLens: () => {
14731
14731
  }];
14732
14732
  readonly stateMutability: "pure";
14733
14733
  }], "getLiquidityForAmount0", readonly [bigint, bigint, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
14734
- getLiquidityForAmount0Ticks: (args: readonly [number, number, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
14734
+ getLiquidityForAmount0Ticks: (args: readonly [number, number, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
14735
14735
  readonly type: "function";
14736
14736
  readonly name: "batchGetAmount0ForLiquidity";
14737
14737
  readonly inputs: readonly [{
@@ -15352,7 +15352,7 @@ declare const useLens: () => {
15352
15352
  }];
15353
15353
  readonly stateMutability: "pure";
15354
15354
  }], "getLiquidityForAmount0Ticks", readonly [number, number, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
15355
- getLiquidityForAmount1: (args: readonly [bigint, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
15355
+ getLiquidityForAmount1: (args: readonly [bigint, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
15356
15356
  readonly type: "function";
15357
15357
  readonly name: "batchGetAmount0ForLiquidity";
15358
15358
  readonly inputs: readonly [{
@@ -15973,7 +15973,7 @@ declare const useLens: () => {
15973
15973
  }];
15974
15974
  readonly stateMutability: "pure";
15975
15975
  }], "getLiquidityForAmount1", readonly [bigint, bigint, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
15976
- getLiquidityForAmount1Ticks: (args: readonly [number, number, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
15976
+ getLiquidityForAmount1Ticks: (args: readonly [number, number, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
15977
15977
  readonly type: "function";
15978
15978
  readonly name: "batchGetAmount0ForLiquidity";
15979
15979
  readonly inputs: readonly [{
@@ -16594,7 +16594,7 @@ declare const useLens: () => {
16594
16594
  }];
16595
16595
  readonly stateMutability: "pure";
16596
16596
  }], "getLiquidityForAmount1Ticks", readonly [number, number, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
16597
- getLiquidityForAmounts: (args: readonly [bigint, bigint, bigint, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
16597
+ getLiquidityForAmounts: (args: readonly [bigint, bigint, bigint, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
16598
16598
  readonly type: "function";
16599
16599
  readonly name: "batchGetAmount0ForLiquidity";
16600
16600
  readonly inputs: readonly [{
@@ -17215,7 +17215,7 @@ declare const useLens: () => {
17215
17215
  }];
17216
17216
  readonly stateMutability: "pure";
17217
17217
  }], "getLiquidityForAmounts", readonly [bigint, bigint, bigint, bigint, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
17218
- getLiquidityForAmountsTicks: (args: readonly [number, number, number, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
17218
+ getLiquidityForAmountsTicks: (args: readonly [number, number, number, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
17219
17219
  readonly type: "function";
17220
17220
  readonly name: "batchGetAmount0ForLiquidity";
17221
17221
  readonly inputs: readonly [{
@@ -17836,7 +17836,7 @@ declare const useLens: () => {
17836
17836
  }];
17837
17837
  readonly stateMutability: "pure";
17838
17838
  }], "getLiquidityForAmountsTicks", readonly [number, number, number, bigint, bigint]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<bigint>;
17839
- getPriceAtTick: (args: readonly [number], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
17839
+ getPriceAtTick: (args: readonly [number], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
17840
17840
  readonly type: "function";
17841
17841
  readonly name: "batchGetAmount0ForLiquidity";
17842
17842
  readonly inputs: readonly [{
@@ -19083,7 +19083,7 @@ declare const useLens: () => {
19083
19083
  } | undefined;
19084
19084
  timelockLens: {
19085
19085
  read: {
19086
- batchGetRefTick: (args: readonly [`0x${string}`, readonly number[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
19086
+ batchGetRefTick: (args: readonly [`0x${string}`, readonly number[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
19087
19087
  readonly type: "function";
19088
19088
  readonly name: "batchGetRefTick";
19089
19089
  readonly inputs: readonly [{
@@ -19785,7 +19785,7 @@ declare const useLens: () => {
19785
19785
  }];
19786
19786
  readonly stateMutability: "view";
19787
19787
  }], "batchGetRefTick", readonly [`0x${string}`, readonly number[]]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly number[]>;
19788
- getAllBlocks: (args: readonly [`0x${string}`], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
19788
+ getAllBlocks: (args: readonly [`0x${string}`], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
19789
19789
  readonly type: "function";
19790
19790
  readonly name: "batchGetRefTick";
19791
19791
  readonly inputs: readonly [{
@@ -20497,7 +20497,7 @@ declare const useLens: () => {
20497
20497
  borrowedAmount0: bigint;
20498
20498
  borrowedAmount1: bigint;
20499
20499
  }[]>;
20500
- getExpiredOptions: (args: readonly [`0x${string}`, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
20500
+ getExpiredOptions: (args: readonly [`0x${string}`, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
20501
20501
  readonly type: "function";
20502
20502
  readonly name: "batchGetRefTick";
20503
20503
  readonly inputs: readonly [{
@@ -21218,7 +21218,7 @@ declare const useLens: () => {
21218
21218
  createdAt: bigint;
21219
21219
  liquidities: readonly bigint[];
21220
21220
  }[], bigint, boolean]>;
21221
- getLiquidityAtTick: (args: readonly [`0x${string}`, number], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
21221
+ getLiquidityAtTick: (args: readonly [`0x${string}`, number], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
21222
21222
  readonly type: "function";
21223
21223
  readonly name: "batchGetRefTick";
21224
21224
  readonly inputs: readonly [{
@@ -21920,7 +21920,7 @@ declare const useLens: () => {
21920
21920
  }];
21921
21921
  readonly stateMutability: "view";
21922
21922
  }], "getLiquidityAtTick", readonly [`0x${string}`, number]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly [bigint, bigint]>;
21923
- getMarketData: (args: readonly [`0x${string}`], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
21923
+ getMarketData: (args: readonly [`0x${string}`], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
21924
21924
  readonly type: "function";
21925
21925
  readonly name: "batchGetRefTick";
21926
21926
  readonly inputs: readonly [{
@@ -22635,7 +22635,7 @@ declare const useLens: () => {
22635
22635
  payoutAssetName: string;
22636
22636
  optionsCount: bigint;
22637
22637
  }>;
22638
- getMaxPositionSize: (args: readonly [`0x${string}`, number, number], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
22638
+ getMaxPositionSize: (args: readonly [`0x${string}`, number, number], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
22639
22639
  readonly type: "function";
22640
22640
  readonly name: "batchGetRefTick";
22641
22641
  readonly inputs: readonly [{
@@ -23337,7 +23337,7 @@ declare const useLens: () => {
23337
23337
  }];
23338
23338
  readonly stateMutability: "view";
23339
23339
  }], "getMaxPositionSize", readonly [`0x${string}`, number, number]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly [bigint, bigint]>;
23340
- getMaxPositionSizeAtCurrentTick: (args: readonly [`0x${string}`, number], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
23340
+ getMaxPositionSizeAtCurrentTick: (args: readonly [`0x${string}`, number], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
23341
23341
  readonly type: "function";
23342
23342
  readonly name: "batchGetRefTick";
23343
23343
  readonly inputs: readonly [{
@@ -24039,7 +24039,7 @@ declare const useLens: () => {
24039
24039
  }];
24040
24040
  readonly stateMutability: "view";
24041
24041
  }], "getMaxPositionSizeAtCurrentTick", readonly [`0x${string}`, number]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<readonly [bigint, bigint]>;
24042
- getOptionData: (args: readonly [`0x${string}`, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
24042
+ getOptionData: (args: readonly [`0x${string}`, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
24043
24043
  readonly type: "function";
24044
24044
  readonly name: "batchGetRefTick";
24045
24045
  readonly inputs: readonly [{
@@ -24760,7 +24760,7 @@ declare const useLens: () => {
24760
24760
  createdAt: bigint;
24761
24761
  liquidities: readonly bigint[];
24762
24762
  }>;
24763
- getOptionsData: (args: readonly [`0x${string}`, readonly bigint[]], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
24763
+ getOptionsData: (args: readonly [`0x${string}`, readonly bigint[]], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
24764
24764
  readonly type: "function";
24765
24765
  readonly name: "batchGetRefTick";
24766
24766
  readonly inputs: readonly [{
@@ -25481,7 +25481,7 @@ declare const useLens: () => {
25481
25481
  createdAt: bigint;
25482
25482
  liquidities: readonly bigint[];
25483
25483
  }[]>;
25484
- getPoolData: (args: readonly [`0x${string}`], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
25484
+ getPoolData: (args: readonly [`0x${string}`], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
25485
25485
  readonly type: "function";
25486
25486
  readonly name: "batchGetRefTick";
25487
25487
  readonly inputs: readonly [{
@@ -26194,7 +26194,7 @@ declare const useLens: () => {
26194
26194
  tickSpacing: number;
26195
26195
  fee: number;
26196
26196
  }>;
26197
- getRefTick: (args: readonly [`0x${string}`, number], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
26197
+ getRefTick: (args: readonly [`0x${string}`, number], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
26198
26198
  readonly type: "function";
26199
26199
  readonly name: "batchGetRefTick";
26200
26200
  readonly inputs: readonly [{
@@ -26896,7 +26896,7 @@ declare const useLens: () => {
26896
26896
  }];
26897
26897
  readonly stateMutability: "view";
26898
26898
  }], "getRefTick", readonly [`0x${string}`, number]>, "address" | "abi" | "args" | "functionName">> | undefined) => Promise<number>;
26899
- getUserOptions: (args: readonly [`0x${string}`, `0x${string}`, bigint, bigint], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
26899
+ getUserOptions: (args: readonly [`0x${string}`, `0x${string}`, bigint, bigint], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
26900
26900
  readonly type: "function";
26901
26901
  readonly name: "batchGetRefTick";
26902
26902
  readonly inputs: readonly [{
@@ -27617,7 +27617,7 @@ declare const useLens: () => {
27617
27617
  createdAt: bigint;
27618
27618
  liquidities: readonly bigint[];
27619
27619
  }[], bigint, boolean]>;
27620
- getVaultTVL: (args: readonly [`0x${string}`], options?: viem382.Prettify<viem382.UnionOmit<viem382.ReadContractParameters<readonly [{
27620
+ getVaultTVL: (args: readonly [`0x${string}`], options?: viem265.Prettify<viem265.UnionOmit<viem265.ReadContractParameters<readonly [{
27621
27621
  readonly type: "function";
27622
27622
  readonly name: "batchGetRefTick";
27623
27623
  readonly inputs: readonly [{
package/dist/client.js CHANGED
@@ -1,4 +1,4 @@
1
- "use client";import{getErc20 as e,getPriceAtTick as t,getTimelockLens as n,getTimelockMarket as r,getUniswapMathLens as i,getUniswapPool as a,lensAbi as o,optionsMarketAbi as s,roundTickDown as c,roundTickUp as l,singleOwnerVaultAbi as u,timelockLenses as d,token0ToToken1 as f,token1ToToken0 as p,uniswapMathLenses as m,wrapAmount as h,wrapPrice as g}from"./numberUtils-DB5N1e6G.js";import{encodeFunctionData as _,erc20Abi as v,maxUint256 as y}from"viem";import b,{createContext as x,useContext as S,useMemo as C}from"react";import{useAccount as w,useChainId as T,useClient as E,useReadContract as D,useWaitForTransactionReceipt as O,useWriteContract as k}from"wagmi";import{GraphQLClient as ee}from"graphql-request";import A from"graphql-tag";import{waitForTransactionReceipt as j}from"viem/actions";import{useQuery as M}from"@tanstack/react-query";const N=A`
1
+ "use client";import{getErc20 as e,getPriceAtTick as t,getTimelockLens as n,getTimelockMarket as r,getUniswapMathLens as i,getUniswapPool as a,lensAbi as o,optionsMarketAbi as s,roundTickDown as c,singleOwnerVaultAbi as l,timelockLenses as u,token0ToToken1 as d,token1ToToken0 as f,uniswapMathLenses as p,wrapAmount as m,wrapPrice as h}from"./numberUtils-DB5N1e6G.js";import{encodeFunctionData as g,erc20Abi as _,maxUint256 as v}from"viem";import y,{createContext as b,useContext as x,useMemo as S}from"react";import{useAccount as C,useChainId as w,useClient as T,useReadContract as E,useWaitForTransactionReceipt as D,useWriteContract as O}from"wagmi";import{GraphQLClient as k}from"graphql-request";import A from"graphql-tag";import{waitForTransactionReceipt as j}from"viem/actions";import{useQuery as M}from"@tanstack/react-query";const N=A`
2
2
  query GetActiveUserOptions($user: String!) {
3
3
  UserOption(
4
4
  where: {ownerAddr: {_eq: $user}, fullyExercised: {_eq: false}}
@@ -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=b(void 0),z=({children:e,marketData:t,envioGraphqlUrl:n})=>{let r=w(),i=u[r],a=p[r];return y.createElement(R.Provider,{value:{marketData:t||{},lensAddr:i,uniswapMathLensAddr:a,envioGraphqlUrl:n}},e)},B=()=>{let e=x(R);if(e===void 0)throw Error(`useCurrentMarket must be used within a TimelockMarketProvider`);return e.marketData},V=()=>{let e=x(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 k(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=T(),{data:r}=E({address:t,abi:l,functionName:`lowestTick`}),{writeContractAsync:i,data:a,isPending:o,error:c}=O(),{isLoading:u,isSuccess:d}=D({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:u,isSuccess:d,error:c,isLoading:o||u}},W=()=>{let e=T(),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}=E({address:r==null?void 0:r.address,abi:o,functionName:`getMaxPositionSizeAtCurrentTick`,args:[a,n],query:{enabled:!!a&&!!r},gas:100000000n}),{data:l,refetch:u}=E({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}=S(()=>d&&i?{maxCallSize:m(d[0],i),maxPutSize:m(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=T(),{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=T(),{data:i}=E({address:n==null?void 0:n.address,abi:o,functionName:`getPoolData`,args:t?[t]:void 0,query:{enabled:!!t&&!!r}});return i||{}},ee=t=>{let{timelockLens:n}=W(),{payoutAsset:i,vault:a,pool:o,optionAssetIsToken0:l}=H(t),{tickSpacing:u}=J(o),{exact:d}=q(o),f=T(),{address:p}=C(),{writeContractAsync:m,data:h,isPending:g,error:y}=O(),{isLoading:b,isSuccess:x}=D({hash:h}),S=typeof t==`string`?t:t==null?void 0:t.address,w=async t=>{if(!f||!p)throw Error(`Wallet not connected`);if(!i||!S)throw Error(`Tokens not available`);await e(i,f).read.allowance([p,S])<t&&await j(f,{hash:await m({address:i,abi:_,functionName:`approve`,args:[S,v]})})};return{mintOption:async(e,t,i,o)=>{if(!f)throw Error(`Wallet not connected`);if(!n||!a||!S||!d||!u)throw Error(`Lowest tick lower not available`);o=c(o??d,u),(e===`CALL`&&l||e===`PUT`&&!l)&&(o+=u),await w(await r(S,f).read.calculatePremium([e===`CALL`?0:1,t,o,BigInt(i)]));let p=await m({address:S,abi:s,functionName:`mintOption`,args:[e===`CALL`?0:1,t,o,BigInt(i),BigInt(1e69),await n.read.getRefTick([a,o])]});return await j(f,{hash:p}),p},hash:h,isPending:g,isConfirming:b,isSuccess:x,error:y,isLoading:g||b}},te=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}=S(()=>{if(o===void 0||c===void 0||!i||!s)return{};let e=o?d(i,c)-d(i,r):f(i,c)-f(i,r),t=m(n===`CALL`?e:-e,s);return{unrealizedPayout:m(t.scaled<0?0n:t.scaled,s),displayPnl:t}},[e,o,c,i]);return{displayPnl:l,unrealizedPayout:u}},ne=(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=S(()=>{if(!(c.rounded===void 0||o===void 0))return t===`CALL`?c.rounded+o:c.rounded},[c.rounded,o,t]),{data:d}=E({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 S(()=>{if(!(d===void 0||a===void 0))return m(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:S(()=>(r==null?void 0:r.sort((e,t)=>t.createdAt.getTime()-e.createdAt.getTime()))||[],[r]),...i}},re=e=>Y(e,!0),ie=e=>Y(e,!1),X=(e,n)=>{let{token0Decimals:r,token1Decimals:i}=J(n);return S(()=>e&&r&&i?h(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}=E({address:typeof e==`string`?e:e==null?void 0:e.address,abi:l,functionName:`pool`});return{pool:t}},ae=e=>{let t=T(),{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:u}=O(),{isLoading:d,isSuccess:f}=D({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:l,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:l,functionName:`multicall`,args:[e.map((e,t)=>g({abi:l,functionName:`burn`,args:[e.tickLower,e.tickUpper,e.liquidity,n[t]]}))]})})}},burn:p,hash:s,isPending:c,isConfirming:d,isSuccess:f,error:u,isLoading:c||d}},oe=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}=S(()=>({totalAmount0:r?m(s.reduce((e,t)=>e+t.totalAmount0,0n),r):void 0,totalAmount1:i?m(s.reduce((e,t)=>e+t.totalAmount1,0n),i):void 0,borrowedAmount0:r?m(s.reduce((e,t)=>e+t.borrowedAmount0,0n),r):void 0,borrowedAmount1:i?m(s.reduce((e,t)=>e+t.borrowedAmount1,0n),i):void 0}),[s,r,i]);return{tvl1:S(()=>{if(!l||!u||!a||!i)return;let e=l.scaled*a.scaled/10n**18n,t=u.scaled;return m(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}},se=t=>{let n=T(),{address:r}=C(),{pool:i}=Q(t),{timelockLens:a,uniswapLens:o}=W(),s=q(i),{token0:c,token1:u}=J(i),d=typeof t==`string`?t:t==null?void 0:t.address,{writeContractAsync:f,data:p,isPending:m,error:h}=O(),{isLoading:y,isSuccess:b}=D({hash:p}),x=async t=>{if(!r||!n)throw Error(`Wallet not connected`);if(s.exact===void 0||!c||!u||!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),[l,p]=await Promise.all([e(c,n).read.allowance([r,d]),e(u,n).read.allowance([r,d])]),m=[];if(l<=i){let e=await f({address:c,abi:_,functionName:`approve`,args:[d,v]});m.push(j(n,{hash:e}))}if(p<=a){let e=await f({address:u,abi:_,functionName:`approve`,args:[d,v]});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:l,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:l,functionName:`multicall`,args:[e.map((e,n)=>g({abi:l,functionName:`mint`,args:[e.tickLower,e.tickUpper,e.liquidity,t[n]]}))]})})}},mint:S,hash:p,isPending:m,isConfirming:y,isSuccess:b,error:h,isLoading:m||y}},ce=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}=E({address:t==null?void 0:t.address,abi:o,functionName:`getVaultTVL`,args:[a],query:{enabled:!!a&&!!t}}),l=s&&r?m(s[0],r):void 0,u=s&&i?m(s[1],i):void 0,d=s&&r?m(s[2],r):void 0,f=s&&i?m(s[3],i):void 0;return{tvl0:s&&r?m(s[4],r):void 0,tvl1:s&&i?m(s[5],i):void 0,totalAmount0:l,totalAmount1:u,borrowedAmount0:d,borrowedAmount1:f,refetch:c}};export{z as TimelockMarketProvider,$ as batchGetAmountsFromLiquidity,K as getCurrentTick,re as useActiveUserOptions,ae as useBurnLiquidity,ie as useClosedUserOptions,B as useCurrentMarket,Z as useCurrentPrice,q as useCurrentTick,U as useExerciseOption,W as useLens,oe as useLiquidityBlocks,H as useMarketData,G as useMaxPositionSize,se as useMintLiquidity,ee as useMintOption,te as useOptionPnl,ne as useOptionPremium,J as usePoolData,X as usePriceAtTick,V as useTimelockConfig,Q as useVaultData,ce as useVaultTVL};
84
84
  //# sourceMappingURL=client.js.map