timelock-sdk 0.0.64 → 0.0.66

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/abis.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_optionsMarket = require('./optionsMarket-D192aXEZ.cjs');
1
+ const require_optionsMarket = require('./optionsMarket-BpL6x4be.cjs');
2
2
  const require_singleOwnerVault = require('./singleOwnerVault-gf2zNZVk.cjs');
3
3
 
4
4
  exports.erc20Abi = require_optionsMarket.erc20Abi;
package/dist/abis.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-D3iSMTdz.cjs";
1
+ import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-BF5k8KFu.cjs";
2
2
 
3
3
  //#region src/abis/erc20.d.ts
4
4
  declare const erc20Abi: readonly [{
package/dist/abis.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-Ddy91uWa.js";
1
+ import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-i1P7D19j.js";
2
2
 
3
3
  //#region src/abis/erc20.d.ts
4
4
  declare const erc20Abi: readonly [{
package/dist/abis.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as erc20Abi, n as uniswapMathLensAbi, r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-DD4CWMqv.js";
1
+ import { i as erc20Abi, n as uniswapMathLensAbi, r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-GbBWALCn.js";
2
2
  import { n as uniswapV3PoolAbi, t as singleOwnerVaultAbi } from "./singleOwnerVault-BeJChjfJ.js";
3
3
 
4
4
  export { erc20Abi, lensAbi, optionsMarketAbi, singleOwnerVaultAbi, uniswapMathLensAbi, uniswapV3PoolAbi };
package/dist/client.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
 
4
- const require_numberUtils = require('./numberUtils-CmVB4kX7.cjs');
5
- const require_optionsMarket = require('./optionsMarket-D192aXEZ.cjs');
4
+ const require_numberUtils = require('./numberUtils-BxQ4RnW9.cjs');
5
+ const require_optionsMarket = require('./optionsMarket-BpL6x4be.cjs');
6
6
  const require_singleOwnerVault = require('./singleOwnerVault-gf2zNZVk.cjs');
7
7
  let viem = require("viem");
8
8
  viem = require_numberUtils.__toESM(viem);
@@ -243,7 +243,7 @@ const useMarketData = (marketAddr) => {
243
243
  const { graphqlClient } = useTimelockConfig();
244
244
  const { timelockLens } = useLens();
245
245
  const { data } = (0, __tanstack_react_query.useQuery)({
246
- queryKey: ["marketData", marketAddr || "--"],
246
+ queryKey: ["marketData", (marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase()) || "--"],
247
247
  queryFn: async () => {
248
248
  const result = await graphqlClient.GetMarketData({ marketAddr: marketAddr.toLowerCase() });
249
249
  return {
@@ -446,7 +446,7 @@ const useMintOption = (marketAddr) => {
446
446
  duration,
447
447
  0
448
448
  ]);
449
- await askForApproval(payoutAsset, marketAddr, (premium + protocolFee * 11n) / 10n);
449
+ await askForApproval(payoutAsset, marketAddr, (premium + protocolFee) * 11n / 10n);
450
450
  const hash$1 = await writeContractAsync({
451
451
  address: marketAddr,
452
452
  abi: require_optionsMarket.optionsMarketAbi,
@@ -567,7 +567,7 @@ const useUserOptions = (user, active = false) => {
567
567
  const { data,...rest } = (0, __tanstack_react_query.useQuery)({
568
568
  queryKey: [
569
569
  "userOptions",
570
- user || "--",
570
+ (user === null || user === void 0 ? void 0 : user.toLowerCase()) || "--",
571
571
  active
572
572
  ],
573
573
  queryFn: async () => {
@@ -627,7 +627,7 @@ const useExtendOption = (marketAddr) => {
627
627
  duration,
628
628
  remainingDuration
629
629
  ]);
630
- await askForApproval(payoutAsset, marketAddr, (premium + protocolFee * 11n) / 10n);
630
+ await askForApproval(payoutAsset, marketAddr, (premium + protocolFee) * 11n / 10n);
631
631
  const hash$1 = await writeContractAsync({
632
632
  address: marketAddr,
633
633
  abi: require_optionsMarket.optionsMarketAbi,
@@ -663,8 +663,8 @@ const useUserOperators = (userAddr, marketAddr) => {
663
663
  const { data,...rest } = (0, __tanstack_react_query.useQuery)({
664
664
  queryKey: [
665
665
  "userOperators",
666
- userAddr || "--",
667
- marketAddr || "--"
666
+ (userAddr === null || userAddr === void 0 ? void 0 : userAddr.toLowerCase()) || "--",
667
+ (marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase()) || "--"
668
668
  ],
669
669
  queryFn: async () => {
670
670
  if (!userAddr || !marketAddr) return void 0;
@@ -685,6 +685,49 @@ const useUserOperators = (userAddr, marketAddr) => {
685
685
  };
686
686
  };
687
687
 
688
+ //#endregion
689
+ //#region src/hooks/market/useSetOperatorPerms.ts
690
+ const useSetOperatorPerms = (marketAddr) => {
691
+ const queryClient = (0, __tanstack_react_query.useQueryClient)();
692
+ const client = (0, wagmi.useClient)();
693
+ const { address } = (0, wagmi.useAccount)();
694
+ const { writeContractAsync, data: hash, isPending, error } = (0, wagmi.useWriteContract)();
695
+ const { isLoading: isConfirming, isSuccess } = (0, wagmi.useWaitForTransactionReceipt)({ hash });
696
+ const setOperatorPerms = async (operator, canExtend, canExercise, canTransfer, canMint, spendingApproval) => {
697
+ if (!client || !address) throw new Error("Wallet not connected");
698
+ if (!marketAddr) throw new Error("Market address not available");
699
+ const hash$1 = await writeContractAsync({
700
+ address: marketAddr,
701
+ abi: require_optionsMarket.optionsMarketAbi,
702
+ functionName: "setOperatorPerms",
703
+ args: [
704
+ operator,
705
+ canExtend,
706
+ canExercise,
707
+ canTransfer,
708
+ canMint,
709
+ spendingApproval
710
+ ]
711
+ });
712
+ await (0, viem_actions.waitForTransactionReceipt)(client, { hash: hash$1 });
713
+ await queryClient.invalidateQueries({ queryKey: [
714
+ "userOperators",
715
+ address.toLowerCase(),
716
+ marketAddr.toLowerCase()
717
+ ] });
718
+ return hash$1;
719
+ };
720
+ return {
721
+ setOperatorPerms,
722
+ hash,
723
+ isPending,
724
+ isConfirming,
725
+ isSuccess,
726
+ error,
727
+ isLoading: isPending || isConfirming
728
+ };
729
+ };
730
+
688
731
  //#endregion
689
732
  //#region src/hooks/pool/usePriceAtTick.ts
690
733
  const usePriceAtTick = (tick, poolAddr) => {
@@ -1077,6 +1120,7 @@ exports.useOptionPremium = useOptionPremium;
1077
1120
  exports.usePoolData = usePoolData;
1078
1121
  exports.usePriceAtTick = usePriceAtTick;
1079
1122
  exports.usePriceHistory = usePriceHistory;
1123
+ exports.useSetOperatorPerms = useSetOperatorPerms;
1080
1124
  exports.useTimelockConfig = useTimelockConfig;
1081
1125
  exports.useUserOperators = useUserOperators;
1082
1126
  exports.useVaultData = useVaultData;