timelock-sdk 0.0.265 → 0.0.267

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
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- const require_graphql = require('./graphql-kf13KPwy.cjs');
3
+ const require_graphql = require('./graphql-BH0AK2SE.cjs');
4
4
  const require_stateView = require('./stateView-BXg8tiiy.cjs');
5
5
  const require_factory = require('./factory-AGrigZB6.cjs');
6
6
  let viem = require("viem");
@@ -398,7 +398,7 @@ const useCurrentTick = (poolManager, poolKey) => {
398
398
  functionName: "getSlot0",
399
399
  args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
400
400
  query: {
401
- enabled: !!poolManager && !!poolKey,
401
+ enabled: !!stateView && !!poolManager && !!poolKey,
402
402
  refetchInterval: 3e3,
403
403
  select: (raw) => {
404
404
  const sqrtPriceX96 = raw[0];
@@ -479,7 +479,7 @@ const usePoolData = (poolManager, poolKey) => {
479
479
  abi: require_stateView.lensAbi,
480
480
  functionName: "getPoolData",
481
481
  args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
482
- query: { enabled: !!poolManager && !!poolKey }
482
+ query: { enabled: !!timelockLens && !!poolManager && !!poolKey }
483
483
  });
484
484
  const _default = (0, react.useMemo)(() => ({
485
485
  token0: poolKey === null || poolKey === void 0 ? void 0 : poolKey.currency0,
@@ -744,7 +744,7 @@ const useExerciseOption = (marketAddr) => {
744
744
  const maxSqrtPrice = sqrtPriceX96 * 11n / 10n;
745
745
  const deadline = BigInt(Math.floor(Date.now() / 1e3) + 600);
746
746
  const refTick = await timelockLens.read.getRefTick([vault, option.startTick]);
747
- const swapperData$1 = (0, viem.encodeAbiParameters)([
747
+ const swapperData = (0, viem.encodeAbiParameters)([
748
748
  { type: "uint160" },
749
749
  { type: "uint160" },
750
750
  { type: "uint256" }
@@ -762,7 +762,7 @@ const useExerciseOption = (marketAddr) => {
762
762
  liquidities,
763
763
  0n,
764
764
  swapper,
765
- swapperData$1,
765
+ swapperData,
766
766
  refTick
767
767
  ]
768
768
  });
@@ -783,7 +783,7 @@ const calculateDisplayPnl = (option, poolPrice, optionAssetIsToken0, payoutAsset
783
783
  const delta = (optionAssetIsToken0 ? require_graphql.token0ToToken1(option.positionSizeCurrent, poolPrice) : require_graphql.token1ToToken0(option.positionSizeCurrent, poolPrice)) - strikeSize;
784
784
  return require_graphql.wrapAmount(option.optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
785
785
  };
786
- const swapperData = (0, viem.encodeAbiParameters)([
786
+ const getSwapperData = () => (0, viem.encodeAbiParameters)([
787
787
  { type: "uint160" },
788
788
  { type: "uint160" },
789
789
  { type: "uint256" }
@@ -811,7 +811,8 @@ const useOptionPnl = (option) => {
811
811
  address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
812
812
  abi: require_stateView.lensAbi,
813
813
  functionName: "getRefTick",
814
- args: vault && (option === null || option === void 0 ? void 0 : option.startTick) ? [vault, option.startTick] : void 0
814
+ args: vault && (option === null || option === void 0 ? void 0 : option.startTick) !== void 0 ? [vault, option.startTick] : void 0,
815
+ query: { enabled: !!timelockLens && !!vault && (option === null || option === void 0 ? void 0 : option.startTick) !== void 0 }
815
816
  });
816
817
  const swapper = require_graphql.swappers[chainId];
817
818
  const { data: unrealizedPayout, ...rest } = (0, wagmi.useSimulateContract)({
@@ -819,16 +820,16 @@ const useOptionPnl = (option) => {
819
820
  abi: require_stateView.optionsMarketAbi,
820
821
  functionName: "exerciseOption",
821
822
  account,
822
- args: option && refTick ? [
823
+ args: option && refTick !== void 0 ? [
823
824
  option.optionId,
824
825
  option.liquiditiesCurrent,
825
826
  0n,
826
827
  swapper,
827
- swapperData,
828
+ getSwapperData(),
828
829
  refTick
829
830
  ] : void 0,
830
831
  query: {
831
- enabled: !!option && !!swapperData && !!swapper && refTick !== void 0 && !!account,
832
+ enabled: !!option && !!swapper && refTick !== void 0 && !!account,
832
833
  staleTime: 1e4,
833
834
  select: (data) => {
834
835
  if (!payoutAssetDecimals) return void 0;