timelock-sdk 0.0.142 → 0.0.143

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.cjs CHANGED
@@ -489,26 +489,6 @@ const useMarketData = (marketAddr) => {
489
489
  return data || fallback || {};
490
490
  };
491
491
 
492
- //#endregion
493
- //#region src/hooks/pool/usePoolData.ts
494
- const usePoolData = (poolManager, poolKey) => {
495
- const { timelockLens } = useLens();
496
- const { data } = (0, wagmi.useReadContract)({
497
- address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
498
- abi: require_optionsMarket.lensAbi,
499
- functionName: "getPoolData",
500
- args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
501
- query: { enabled: !!poolManager && !!poolKey }
502
- });
503
- const _default = (0, react.useMemo)(() => ({
504
- token0: poolKey === null || poolKey === void 0 ? void 0 : poolKey.currency0,
505
- token1: poolKey === null || poolKey === void 0 ? void 0 : poolKey.currency1,
506
- tickSpacing: poolKey === null || poolKey === void 0 ? void 0 : poolKey.tickSpacing,
507
- fee: poolKey === null || poolKey === void 0 ? void 0 : poolKey.fee
508
- }), [poolKey]);
509
- return data || _default;
510
- };
511
-
512
492
  //#endregion
513
493
  //#region src/lib/utils.ts
514
494
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -516,8 +496,7 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
516
496
  //#endregion
517
497
  //#region src/hooks/options/useExerciseOption.ts
518
498
  const useExerciseOption = (marketAddr) => {
519
- const { vault, poolManager, poolKey } = useMarketData(marketAddr);
520
- const { fee } = usePoolData(poolManager, poolKey);
499
+ const { vault, poolKey } = useMarketData(marketAddr);
521
500
  const { timelockLens } = useLens();
522
501
  const queryClient = (0, __tanstack_react_query.useQueryClient)();
523
502
  const client = (0, wagmi.useClient)();
@@ -528,7 +507,7 @@ const useExerciseOption = (marketAddr) => {
528
507
  if (!marketAddr) throw new Error("Market address not available");
529
508
  if (!timelockLens) throw new Error("Timelock lens not available");
530
509
  if (!vault) throw new Error("Vault not available");
531
- if (!fee) throw new Error("Pool data not available");
510
+ if (!poolKey) throw new Error("Pool data not available");
532
511
  const swapper = require_optionUtils.swappers[client.chain.id];
533
512
  if (!swapper) throw new Error("Swapper not available");
534
513
  const refTick = await timelockLens.read.getRefTick([vault, option.startTick]);
@@ -541,7 +520,39 @@ const useExerciseOption = (marketAddr) => {
541
520
  liquidities,
542
521
  0n,
543
522
  swapper,
544
- (0, viem.encodeAbiParameters)([{ type: "uint24" }], [fee]),
523
+ (0, viem.encodeAbiParameters)([
524
+ {
525
+ type: "tuple",
526
+ components: [
527
+ {
528
+ type: "address",
529
+ name: "currency0"
530
+ },
531
+ {
532
+ type: "address",
533
+ name: "currency1"
534
+ },
535
+ {
536
+ type: "uint24",
537
+ name: "fee"
538
+ },
539
+ {
540
+ type: "int24",
541
+ name: "tickSpacing"
542
+ },
543
+ {
544
+ type: "address",
545
+ name: "hooks"
546
+ }
547
+ ]
548
+ },
549
+ { type: "uint160" },
550
+ { type: "uint160" }
551
+ ], [
552
+ poolKey,
553
+ 0n,
554
+ viem.maxUint160
555
+ ]),
545
556
  refTick
546
557
  ]
547
558
  });
@@ -600,6 +611,26 @@ const useMaxPositionSize = (marketAddr, maxBorrowableRange = 100) => {
600
611
  };
601
612
  };
602
613
 
614
+ //#endregion
615
+ //#region src/hooks/pool/usePoolData.ts
616
+ const usePoolData = (poolManager, poolKey) => {
617
+ const { timelockLens } = useLens();
618
+ const { data } = (0, wagmi.useReadContract)({
619
+ address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
620
+ abi: require_optionsMarket.lensAbi,
621
+ functionName: "getPoolData",
622
+ args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
623
+ query: { enabled: !!poolManager && !!poolKey }
624
+ });
625
+ const _default = (0, react.useMemo)(() => ({
626
+ token0: poolKey === null || poolKey === void 0 ? void 0 : poolKey.currency0,
627
+ token1: poolKey === null || poolKey === void 0 ? void 0 : poolKey.currency1,
628
+ tickSpacing: poolKey === null || poolKey === void 0 ? void 0 : poolKey.tickSpacing,
629
+ fee: poolKey === null || poolKey === void 0 ? void 0 : poolKey.fee
630
+ }), [poolKey]);
631
+ return data || _default;
632
+ };
633
+
603
634
  //#endregion
604
635
  //#region src/hooks/pool/useCurrentTick.ts
605
636
  const useCurrentTick = (poolManager, poolKey) => {