timelock-sdk 0.0.156 → 0.0.159

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.
Files changed (31) hide show
  1. package/dist/abis.cjs +1 -1
  2. package/dist/abis.d.cts +1 -1
  3. package/dist/abis.d.ts +1 -1
  4. package/dist/abis.js +1 -1
  5. package/dist/{client-DfG9023x.d.ts → client-C5uUBjks.d.ts} +12373 -3243
  6. package/dist/{client-L8_H45kU.d.cts → client-COCvyyDy.d.cts} +12456 -3326
  7. package/dist/client.cjs +331 -7
  8. package/dist/client.cjs.map +1 -1
  9. package/dist/client.d.cts +3 -3
  10. package/dist/client.d.ts +3 -3
  11. package/dist/client.js +332 -9
  12. package/dist/client.js.map +1 -1
  13. package/dist/{optionUtils-Daz9iARj.cjs → optionUtils-B-TKN7Ni.cjs} +10 -3
  14. package/dist/optionUtils-B-TKN7Ni.cjs.map +1 -0
  15. package/dist/{optionUtils-B7EA45zY.js → optionUtils-CL-MSoFS.js} +5 -4
  16. package/dist/optionUtils-CL-MSoFS.js.map +1 -0
  17. package/dist/{optionsMarket-CT26uUTa.js → optionsMarket-BbXpQnpV.js} +193 -148
  18. package/dist/optionsMarket-BbXpQnpV.js.map +1 -0
  19. package/dist/{optionsMarket-T7r7iDKa.cjs → optionsMarket-DtjLm46g.cjs} +193 -148
  20. package/dist/optionsMarket-DtjLm46g.cjs.map +1 -0
  21. package/dist/package.cjs +3 -2
  22. package/dist/package.d.cts +3 -3
  23. package/dist/package.d.ts +3 -3
  24. package/dist/package.js +3 -3
  25. package/dist/{uniswapMathLens-DNbMIHSs.d.ts → uniswapMathLens-BoQxBJoY.d.cts} +95 -51
  26. package/dist/{uniswapMathLens-DT3TTcQa.d.cts → uniswapMathLens-Ds8UmCMU.d.ts} +95 -51
  27. package/package.json +1 -1
  28. package/dist/optionUtils-B7EA45zY.js.map +0 -1
  29. package/dist/optionUtils-Daz9iARj.cjs.map +0 -1
  30. package/dist/optionsMarket-CT26uUTa.js.map +0 -1
  31. package/dist/optionsMarket-T7r7iDKa.cjs.map +0 -1
package/dist/client.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import "./uniswapMathLens-DT3TTcQa.cjs";
2
- import { $ as useUserPerps, At as useExerciseOption, C as PoolKey, Ft as useCurrentMarket, It as useTimelockConfig, J as useSetOperatorPerms, Mt as useActiveUserOptions, Nt as useClosedUserOptions, Ot as useMarketVolume, Pt as TimelockProvider, Q as useClosedUserPerps, S as useCurrentPrice, T as usePoolData, X as useOperatorPerms, Y as useUserOperators, Z as useActiveUserPerps, _ as useMarketPriceHistory, a as useGuardianGlobalState, at as MintOptionEvent, b as usePriceAtTick, c as TokenData, ct as useExtendOption, d as useVaultData, dt as useMintOption, et as usePerpsOperator, f as batchGetAmountsFromLiquidity, ft as useMaxPositionSize, g as useBurnLiquidity, h as useLiquidityBlocks, i as usePauseGlobalTrading, it as ExtendEvent, jt as OptionData, kt as useMarketData, l as useTokenData, lt as useOptionPremium, m as LiquidityBlockData, n as useFeeRates, nt as useMintPerp, o as useApproval, ot as OptionEvent, p as useMintLiquidity, r as usePauseMarketTrading, rt as ExerciseOptionEvent, s as useTokenBalance, st as useOptionTimeline, t as useLens, tt as useClosePerp, u as useVaultTVL, ut as useOptionPnl, v as usePriceHistory, w as UniswapPoolData, x as useCurrentTick, y as usePriceAtSqrtPriceX96 } from "./client-L8_H45kU.cjs";
3
- export { ExerciseOptionEvent, ExtendEvent, LiquidityBlockData, MintOptionEvent, OptionData, OptionEvent, PoolKey, TimelockProvider, TokenData, UniswapPoolData, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useFeeRates, useGuardianGlobalState, useLens, useLiquidityBlocks, useMarketData, useMarketPriceHistory, useMarketVolume, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePauseGlobalTrading, usePauseMarketTrading, usePerpsOperator, usePoolData, usePriceAtSqrtPriceX96, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useTokenBalance, useTokenData, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
1
+ import "./uniswapMathLens-BoQxBJoY.cjs";
2
+ import { $ as useClosedUserPerps, At as useMarketData, C as useCurrentPrice, E as usePoolData, Ft as TimelockProvider, It as useCurrentMarket, Lt as useTimelockConfig, Mt as OptionData, Nt as useActiveUserOptions, Pt as useClosedUserOptions, Q as useActiveUserPerps, S as useCurrentTick, T as UniswapPoolData, X as useUserOperators, Y as useSetOperatorPerms, Z as useOperatorPerms, _ as useBurnLiquidity, a as usePauseGlobalTrading, at as ExtendEvent, b as usePriceAtSqrtPriceX96, c as useTokenBalance, ct as useOptionTimeline, d as useVaultTVL, dt as useOptionPnl, et as useUserPerps, f as useVaultData, ft as useMintOption, g as useLiquidityBlocks, h as LiquidityBlockData, i as usePauseMarketTrading, it as ExerciseOptionEvent, jt as useExerciseOption, kt as useMarketVolume, l as TokenData, lt as useExtendOption, m as useMintLiquidity, n as useUpdateMarketFees, nt as useClosePerp, o as useGuardianGlobalState, ot as MintOptionEvent, p as batchGetAmountsFromLiquidity, pt as useMaxPositionSize, r as useFeeRates, rt as useMintPerp, s as useApproval, st as OptionEvent, t as useLens, tt as usePerpsOperator, u as useTokenData, ut as useOptionPremium, v as useMarketPriceHistory, w as PoolKey, x as usePriceAtTick, y as usePriceHistory } from "./client-COCvyyDy.cjs";
3
+ export { ExerciseOptionEvent, ExtendEvent, LiquidityBlockData, MintOptionEvent, OptionData, OptionEvent, PoolKey, TimelockProvider, TokenData, UniswapPoolData, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useFeeRates, useGuardianGlobalState, useLens, useLiquidityBlocks, useMarketData, useMarketPriceHistory, useMarketVolume, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePauseGlobalTrading, usePauseMarketTrading, usePerpsOperator, usePoolData, usePriceAtSqrtPriceX96, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useTokenBalance, useTokenData, useUpdateMarketFees, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
package/dist/client.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import "./uniswapMathLens-DNbMIHSs.js";
2
- import { $ as useUserPerps, At as useExerciseOption, C as PoolKey, Ft as useCurrentMarket, It as useTimelockConfig, J as useSetOperatorPerms, Mt as useActiveUserOptions, Nt as useClosedUserOptions, Ot as useMarketVolume, Pt as TimelockProvider, Q as useClosedUserPerps, S as useCurrentPrice, T as usePoolData, X as useOperatorPerms, Y as useUserOperators, Z as useActiveUserPerps, _ as useMarketPriceHistory, a as useGuardianGlobalState, at as MintOptionEvent, b as usePriceAtTick, c as TokenData, ct as useExtendOption, d as useVaultData, dt as useMintOption, et as usePerpsOperator, f as batchGetAmountsFromLiquidity, ft as useMaxPositionSize, g as useBurnLiquidity, h as useLiquidityBlocks, i as usePauseGlobalTrading, it as ExtendEvent, jt as OptionData, kt as useMarketData, l as useTokenData, lt as useOptionPremium, m as LiquidityBlockData, n as useFeeRates, nt as useMintPerp, o as useApproval, ot as OptionEvent, p as useMintLiquidity, r as usePauseMarketTrading, rt as ExerciseOptionEvent, s as useTokenBalance, st as useOptionTimeline, t as useLens, tt as useClosePerp, u as useVaultTVL, ut as useOptionPnl, v as usePriceHistory, w as UniswapPoolData, x as useCurrentTick, y as usePriceAtSqrtPriceX96 } from "./client-DfG9023x.js";
3
- export { ExerciseOptionEvent, ExtendEvent, LiquidityBlockData, MintOptionEvent, OptionData, OptionEvent, PoolKey, TimelockProvider, TokenData, UniswapPoolData, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useFeeRates, useGuardianGlobalState, useLens, useLiquidityBlocks, useMarketData, useMarketPriceHistory, useMarketVolume, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePauseGlobalTrading, usePauseMarketTrading, usePerpsOperator, usePoolData, usePriceAtSqrtPriceX96, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useTokenBalance, useTokenData, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
1
+ import "./uniswapMathLens-Ds8UmCMU.js";
2
+ import { $ as useClosedUserPerps, At as useMarketData, C as useCurrentPrice, E as usePoolData, Ft as TimelockProvider, It as useCurrentMarket, Lt as useTimelockConfig, Mt as OptionData, Nt as useActiveUserOptions, Pt as useClosedUserOptions, Q as useActiveUserPerps, S as useCurrentTick, T as UniswapPoolData, X as useUserOperators, Y as useSetOperatorPerms, Z as useOperatorPerms, _ as useBurnLiquidity, a as usePauseGlobalTrading, at as ExtendEvent, b as usePriceAtSqrtPriceX96, c as useTokenBalance, ct as useOptionTimeline, d as useVaultTVL, dt as useOptionPnl, et as useUserPerps, f as useVaultData, ft as useMintOption, g as useLiquidityBlocks, h as LiquidityBlockData, i as usePauseMarketTrading, it as ExerciseOptionEvent, jt as useExerciseOption, kt as useMarketVolume, l as TokenData, lt as useExtendOption, m as useMintLiquidity, n as useUpdateMarketFees, nt as useClosePerp, o as useGuardianGlobalState, ot as MintOptionEvent, p as batchGetAmountsFromLiquidity, pt as useMaxPositionSize, r as useFeeRates, rt as useMintPerp, s as useApproval, st as OptionEvent, t as useLens, tt as usePerpsOperator, u as useTokenData, ut as useOptionPremium, v as useMarketPriceHistory, w as PoolKey, x as usePriceAtTick, y as usePriceHistory } from "./client-C5uUBjks.js";
3
+ export { ExerciseOptionEvent, ExtendEvent, LiquidityBlockData, MintOptionEvent, OptionData, OptionEvent, PoolKey, TimelockProvider, TokenData, UniswapPoolData, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useFeeRates, useGuardianGlobalState, useLens, useLiquidityBlocks, useMarketData, useMarketPriceHistory, useMarketVolume, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePauseGlobalTrading, usePauseMarketTrading, usePerpsOperator, usePoolData, usePriceAtSqrtPriceX96, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useTokenBalance, useTokenData, useUpdateMarketFees, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
package/dist/client.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
 
3
3
 
4
- import { i as erc20Abi$1, r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-CT26uUTa.js";
5
- import { A as token1ToToken0, B as swappers, D as roundTick, F as getStateView, H as statelessStateViewAbi, I as getTimelockLens, L as getTimelockMarket, N as getPriceHistory, O as token0ToToken1, P as getErc20, b as getPriceAtSqrtPriceX96, f as wrapAmount, j as token1ToToken0AtTick, k as token0ToToken1AtTick, m as wrapPrice, r as EMPTY_ARRAY, t as getPayoutAtPrice, v as getAmountsFromLiquidity, x as getPriceAtTick, y as getNearestValidStrikeTick } from "./optionUtils-B7EA45zY.js";
4
+ import { i as erc20Abi$1, r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-BbXpQnpV.js";
5
+ import { A as token1ToToken0, B as swappers, D as roundTick, F as getStateView, I as getTimelockLens, L as getTimelockMarket, N as getPriceHistory, O as token0ToToken1, P as getErc20, U as statelessStateViewAbi, V as timelockFactories, b as getPriceAtSqrtPriceX96, f as wrapAmount, j as token1ToToken0AtTick, k as token0ToToken1AtTick, m as wrapPrice, r as EMPTY_ARRAY, t as getPayoutAtPrice, v as getAmountsFromLiquidity, x as getPriceAtTick, y as getNearestValidStrikeTick } from "./optionUtils-CL-MSoFS.js";
6
6
  import { t as singleOwnerVaultAbi } from "./singleOwnerVault-BJyEs_D_.js";
7
- import { encodeAbiParameters, encodeFunctionData, erc20Abi, maxUint256, zeroAddress } from "viem";
7
+ import { decodeEventLog, encodeAbiParameters, encodeFunctionData, erc20Abi, maxUint256, zeroAddress } from "viem";
8
8
  import React, { createContext, useContext, useEffect, useMemo } from "react";
9
9
  import { GraphQLClient, RequestOptions } from "graphql-request";
10
10
  import gql from "graphql-tag";
@@ -636,7 +636,7 @@ const useExerciseOption = (marketAddr) => {
636
636
  //#region src/hooks/options/useMarketVolume.ts
637
637
  const useMarketVolume = (marketAddr) => {
638
638
  const { graphqlClient } = useTimelockConfig();
639
- const { data } = useQuery({
639
+ const { data, ...rest } = useQuery({
640
640
  queryKey: ["marketVolume", (marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase()) || "--"],
641
641
  queryFn: async () => {
642
642
  const result = await graphqlClient.GetMarketVolume({ marketAddr: marketAddr.toLowerCase() });
@@ -650,7 +650,10 @@ const useMarketVolume = (marketAddr) => {
650
650
  },
651
651
  enabled: !!marketAddr && !!graphqlClient
652
652
  });
653
- return data || {};
653
+ return {
654
+ data: data || {},
655
+ ...rest
656
+ };
654
657
  };
655
658
 
656
659
  //#endregion
@@ -812,14 +815,13 @@ const useOptionPremium = (marketAddr, optionType, optionAmount, addedDuration, r
812
815
  address: marketAddr,
813
816
  abi: optionsMarketAbi,
814
817
  functionName: "calculatePremium",
815
- args: strikeTickRounded !== void 0 ? [
818
+ args: strikeTickRounded !== void 0 && optionAmount !== void 0 && addedDuration !== void 0 ? [
816
819
  optionType === "CALL" ? 0 : 1,
817
820
  optionAmount,
818
821
  strikeTickRounded,
819
822
  addedDuration,
820
823
  remainingDuration
821
- ] : void 0,
822
- query: { enabled: strikeTickRounded !== void 0 }
824
+ ] : void 0
823
825
  });
824
826
  return useMemo(() => {
825
827
  if (premium === void 0 || protocolFee === void 0 || payoutAssetDecimals === void 0) return {};
@@ -2195,5 +2197,326 @@ const useFeeRates = (feeStrategy) => {
2195
2197
  };
2196
2198
 
2197
2199
  //#endregion
2198
- export { TimelockProvider, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useFeeRates, useGuardianGlobalState, useLens, useLiquidityBlocks, useMarketData, useMarketPriceHistory, useMarketVolume, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePauseGlobalTrading, usePauseMarketTrading, usePerpsOperator, usePoolData, usePriceAtSqrtPriceX96, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useTokenBalance, useTokenData, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
2200
+ //#region src/hooks/options/useMarketState.ts
2201
+ const useMarketState = (marketAddr) => {
2202
+ const { timelockLens } = useLens();
2203
+ const { data, ...rest } = useReadContract({
2204
+ address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
2205
+ abi: lensAbi,
2206
+ functionName: "getMarketState",
2207
+ args: marketAddr ? [marketAddr] : void 0
2208
+ });
2209
+ return {
2210
+ data: data || {},
2211
+ ...rest
2212
+ };
2213
+ };
2214
+
2215
+ //#endregion
2216
+ //#region src/abis/factory.ts
2217
+ const factoryAbi = [
2218
+ {
2219
+ type: "function",
2220
+ name: "deployFeeStrategy",
2221
+ inputs: [
2222
+ {
2223
+ name: "_openingFeeRate",
2224
+ type: "uint32",
2225
+ internalType: "uint32"
2226
+ },
2227
+ {
2228
+ name: "_baseFeeRate",
2229
+ type: "uint32",
2230
+ internalType: "uint32"
2231
+ },
2232
+ {
2233
+ name: "_minOpeningFee",
2234
+ type: "uint128",
2235
+ internalType: "uint128"
2236
+ },
2237
+ {
2238
+ name: "_minBaseFee",
2239
+ type: "uint128",
2240
+ internalType: "uint128"
2241
+ },
2242
+ {
2243
+ name: "_feeRecipient",
2244
+ type: "address",
2245
+ internalType: "address"
2246
+ }
2247
+ ],
2248
+ outputs: [{
2249
+ name: "",
2250
+ type: "address",
2251
+ internalType: "contract FeeStrategy"
2252
+ }],
2253
+ stateMutability: "nonpayable"
2254
+ },
2255
+ {
2256
+ type: "function",
2257
+ name: "deployOptionPricing",
2258
+ inputs: [
2259
+ {
2260
+ name: "_logicContract",
2261
+ type: "address",
2262
+ internalType: "contract StatelessOptionPricing"
2263
+ },
2264
+ {
2265
+ name: "_iv",
2266
+ type: "uint32",
2267
+ internalType: "uint32"
2268
+ },
2269
+ {
2270
+ name: "_riskFreeRate",
2271
+ type: "uint32",
2272
+ internalType: "uint32"
2273
+ },
2274
+ {
2275
+ name: "_minPremiumDailyRate",
2276
+ type: "uint32",
2277
+ internalType: "uint32"
2278
+ },
2279
+ {
2280
+ name: "_minPremiumAmount",
2281
+ type: "uint256",
2282
+ internalType: "uint256"
2283
+ }
2284
+ ],
2285
+ outputs: [{
2286
+ name: "",
2287
+ type: "address",
2288
+ internalType: "contract OptionPricing"
2289
+ }],
2290
+ stateMutability: "nonpayable"
2291
+ },
2292
+ {
2293
+ type: "function",
2294
+ name: "deployStaticPerpsPricing",
2295
+ inputs: [{
2296
+ name: "_dailyFundingRate",
2297
+ type: "uint32",
2298
+ internalType: "uint32"
2299
+ }, {
2300
+ name: "_minFundingAmount",
2301
+ type: "uint128",
2302
+ internalType: "uint128"
2303
+ }],
2304
+ outputs: [{
2305
+ name: "",
2306
+ type: "address",
2307
+ internalType: "contract StaticPerpsPricing"
2308
+ }],
2309
+ stateMutability: "nonpayable"
2310
+ },
2311
+ {
2312
+ type: "function",
2313
+ name: "feeStrategies",
2314
+ inputs: [{
2315
+ name: "",
2316
+ type: "bytes32",
2317
+ internalType: "bytes32"
2318
+ }],
2319
+ outputs: [{
2320
+ name: "",
2321
+ type: "address",
2322
+ internalType: "contract FeeStrategy"
2323
+ }],
2324
+ stateMutability: "view"
2325
+ },
2326
+ {
2327
+ type: "function",
2328
+ name: "optionPricings",
2329
+ inputs: [{
2330
+ name: "",
2331
+ type: "bytes32",
2332
+ internalType: "bytes32"
2333
+ }],
2334
+ outputs: [{
2335
+ name: "",
2336
+ type: "address",
2337
+ internalType: "contract OptionPricing"
2338
+ }],
2339
+ stateMutability: "view"
2340
+ },
2341
+ {
2342
+ type: "function",
2343
+ name: "staticPerpsPricings",
2344
+ inputs: [{
2345
+ name: "",
2346
+ type: "bytes32",
2347
+ internalType: "bytes32"
2348
+ }],
2349
+ outputs: [{
2350
+ name: "",
2351
+ type: "address",
2352
+ internalType: "contract StaticPerpsPricing"
2353
+ }],
2354
+ stateMutability: "view"
2355
+ },
2356
+ {
2357
+ type: "event",
2358
+ name: "DeployFeeStrategy",
2359
+ inputs: [
2360
+ {
2361
+ name: "feeStrategy",
2362
+ type: "address",
2363
+ indexed: true,
2364
+ internalType: "contract FeeStrategy"
2365
+ },
2366
+ {
2367
+ name: "openingFeeRate",
2368
+ type: "uint32",
2369
+ indexed: false,
2370
+ internalType: "uint32"
2371
+ },
2372
+ {
2373
+ name: "baseFeeRate",
2374
+ type: "uint32",
2375
+ indexed: false,
2376
+ internalType: "uint32"
2377
+ },
2378
+ {
2379
+ name: "minOpeningFee",
2380
+ type: "uint128",
2381
+ indexed: false,
2382
+ internalType: "uint128"
2383
+ },
2384
+ {
2385
+ name: "minBaseFee",
2386
+ type: "uint128",
2387
+ indexed: false,
2388
+ internalType: "uint128"
2389
+ },
2390
+ {
2391
+ name: "feeRecipient",
2392
+ type: "address",
2393
+ indexed: false,
2394
+ internalType: "address"
2395
+ }
2396
+ ],
2397
+ anonymous: false
2398
+ },
2399
+ {
2400
+ type: "event",
2401
+ name: "DeployOptionPricing",
2402
+ inputs: [
2403
+ {
2404
+ name: "pricing",
2405
+ type: "address",
2406
+ indexed: true,
2407
+ internalType: "contract OptionPricing"
2408
+ },
2409
+ {
2410
+ name: "statelessPricing",
2411
+ type: "address",
2412
+ indexed: false,
2413
+ internalType: "contract StatelessOptionPricing"
2414
+ },
2415
+ {
2416
+ name: "iv",
2417
+ type: "uint32",
2418
+ indexed: false,
2419
+ internalType: "uint32"
2420
+ },
2421
+ {
2422
+ name: "riskFreeRate",
2423
+ type: "uint32",
2424
+ indexed: false,
2425
+ internalType: "uint32"
2426
+ },
2427
+ {
2428
+ name: "minPremiumDailyRate",
2429
+ type: "uint32",
2430
+ indexed: false,
2431
+ internalType: "uint32"
2432
+ },
2433
+ {
2434
+ name: "minPremiumAmount",
2435
+ type: "uint256",
2436
+ indexed: false,
2437
+ internalType: "uint256"
2438
+ }
2439
+ ],
2440
+ anonymous: false
2441
+ },
2442
+ {
2443
+ type: "event",
2444
+ name: "DeployStaticPerpsPricing",
2445
+ inputs: [
2446
+ {
2447
+ name: "pricing",
2448
+ type: "address",
2449
+ indexed: true,
2450
+ internalType: "contract StaticPerpsPricing"
2451
+ },
2452
+ {
2453
+ name: "dailyFundingRate",
2454
+ type: "uint32",
2455
+ indexed: false,
2456
+ internalType: "uint32"
2457
+ },
2458
+ {
2459
+ name: "minFundingAmount",
2460
+ type: "uint128",
2461
+ indexed: false,
2462
+ internalType: "uint128"
2463
+ }
2464
+ ],
2465
+ anonymous: false
2466
+ }
2467
+ ];
2468
+
2469
+ //#endregion
2470
+ //#region src/hooks/fees/useUpdateMarketFees.ts
2471
+ const useUpdateMarketFees = (marketAddr) => {
2472
+ const { writeContractAsync, ...rest } = useWriteContract();
2473
+ const publicClient = usePublicClient();
2474
+ const chainId = useChainId();
2475
+ const { data: { feeStrategy, optionPricing } } = useMarketState(marketAddr);
2476
+ const { openingFeeRate, baseFeeRate, minOpeningFee, minBaseFee, feeRecipient } = useFeeRates(feeStrategy);
2477
+ const updateMarketFeeRates = async (rates) => {
2478
+ if (openingFeeRate === void 0 || baseFeeRate === void 0 || minOpeningFee === void 0 || minBaseFee === void 0 || feeRecipient === void 0) throw new Error("Missing current fee rates");
2479
+ if (!optionPricing) throw new Error("Could not load market state");
2480
+ if (!publicClient) throw new Error("Public client not available");
2481
+ const factoryAddr = timelockFactories[chainId].toLowerCase();
2482
+ const hash = await writeContractAsync({
2483
+ address: factoryAddr,
2484
+ abi: factoryAbi,
2485
+ functionName: "deployFeeStrategy",
2486
+ args: [
2487
+ rates.openingFeeRate ?? openingFeeRate,
2488
+ rates.baseFeeRate ?? baseFeeRate,
2489
+ rates.minOpeningFee ?? minOpeningFee,
2490
+ rates.minBaseFee ?? minBaseFee,
2491
+ rates.feeRecipient ?? feeRecipient
2492
+ ]
2493
+ });
2494
+ const deployEvent = (await publicClient.waitForTransactionReceipt({ hash })).logs.find((log) => log.address.toLowerCase() === factoryAddr);
2495
+ if (!deployEvent) throw new Error("DeployFeeStrategy event not found");
2496
+ const decodedEvent = decodeEventLog({
2497
+ abi: factoryAbi,
2498
+ data: deployEvent.data,
2499
+ topics: deployEvent.topics
2500
+ });
2501
+ if (decodedEvent.eventName !== "DeployFeeStrategy") throw new Error("Unexpected event");
2502
+ const newFeeStrategy = decodedEvent.args.feeStrategy;
2503
+ return {
2504
+ deployHash: hash,
2505
+ updateHash: await writeContractAsync({
2506
+ address: marketAddr,
2507
+ abi: optionsMarketAbi,
2508
+ functionName: "updateAddresses",
2509
+ args: [optionPricing, newFeeStrategy]
2510
+ }),
2511
+ newFeeStrategy
2512
+ };
2513
+ };
2514
+ return {
2515
+ updateMarketFeeRates,
2516
+ ...rest
2517
+ };
2518
+ };
2519
+
2520
+ //#endregion
2521
+ export { TimelockProvider, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useFeeRates, useGuardianGlobalState, useLens, useLiquidityBlocks, useMarketData, useMarketPriceHistory, useMarketVolume, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePauseGlobalTrading, usePauseMarketTrading, usePerpsOperator, usePoolData, usePriceAtSqrtPriceX96, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useTokenBalance, useTokenData, useUpdateMarketFees, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
2199
2522
  //# sourceMappingURL=client.js.map