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 +1 -1
- package/dist/abis.d.cts +1 -1
- package/dist/abis.d.ts +1 -1
- package/dist/abis.js +1 -1
- package/dist/client.cjs +52 -8
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +84 -72
- package/dist/client.d.ts +201 -189
- package/dist/client.js +52 -9
- package/dist/client.js.map +1 -1
- package/dist/{index-BIkdgG3y.d.ts → index-DmUTOkWh.d.cts} +62 -62
- package/dist/{index-CDYUCwzA.d.cts → index-WjU9H0Tc.d.ts} +153 -153
- package/dist/{numberUtils-Dd7vdmeQ.js → numberUtils-BVUp0GfC.js} +3 -3
- package/dist/{numberUtils-Dd7vdmeQ.js.map → numberUtils-BVUp0GfC.js.map} +1 -1
- package/dist/{numberUtils-CmVB4kX7.cjs → numberUtils-BxQ4RnW9.cjs} +3 -3
- package/dist/{numberUtils-CmVB4kX7.cjs.map → numberUtils-BxQ4RnW9.cjs.map} +1 -1
- package/dist/{optionsMarket-D192aXEZ.cjs → optionsMarket-BpL6x4be.cjs} +5 -5
- package/dist/optionsMarket-BpL6x4be.cjs.map +1 -0
- package/dist/{optionsMarket-DD4CWMqv.js → optionsMarket-GbBWALCn.js} +5 -5
- package/dist/optionsMarket-GbBWALCn.js.map +1 -0
- package/dist/package.cjs +2 -2
- package/dist/package.d.cts +2 -2
- package/dist/package.d.ts +2 -2
- package/dist/package.js +2 -2
- package/dist/{uniswapMathLens-Ddy91uWa.d.ts → uniswapMathLens-BF5k8KFu.d.cts} +5 -5
- package/dist/{uniswapMathLens-D3iSMTdz.d.cts → uniswapMathLens-i1P7D19j.d.ts} +5 -5
- package/package.json +1 -1
- package/dist/optionsMarket-D192aXEZ.cjs.map +0 -1
- package/dist/optionsMarket-DD4CWMqv.js.map +0 -1
package/dist/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-
|
|
5
|
-
import { C as token1ToToken0, D as getUniswapMathLens, E as getTimelockMarket, O as timelockLenses, S as token0ToToken1, T as getTimelockLens, b as roundTickDown, d as wrapPrice, h as getPriceAtTick, k as uniswapMathLenses, l as wrapAmount, m as PRICE_PRECISION, w as getErc20, y as liquiditiesToAmounts } from "./numberUtils-
|
|
4
|
+
import { r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-GbBWALCn.js";
|
|
5
|
+
import { C as token1ToToken0, D as getUniswapMathLens, E as getTimelockMarket, O as timelockLenses, S as token0ToToken1, T as getTimelockLens, b as roundTickDown, d as wrapPrice, h as getPriceAtTick, k as uniswapMathLenses, l as wrapAmount, m as PRICE_PRECISION, w as getErc20, y as liquiditiesToAmounts } from "./numberUtils-BVUp0GfC.js";
|
|
6
6
|
import { n as uniswapV3PoolAbi, t as singleOwnerVaultAbi } from "./singleOwnerVault-BeJChjfJ.js";
|
|
7
7
|
import { encodeAbiParameters, encodeFunctionData, erc20Abi, maxUint256, zeroAddress } from "viem";
|
|
8
8
|
import React, { createContext, useContext, useMemo } from "react";
|
|
@@ -236,7 +236,7 @@ const useMarketData = (marketAddr) => {
|
|
|
236
236
|
const { graphqlClient } = useTimelockConfig();
|
|
237
237
|
const { timelockLens } = useLens();
|
|
238
238
|
const { data } = useQuery({
|
|
239
|
-
queryKey: ["marketData", marketAddr || "--"],
|
|
239
|
+
queryKey: ["marketData", (marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase()) || "--"],
|
|
240
240
|
queryFn: async () => {
|
|
241
241
|
const result = await graphqlClient.GetMarketData({ marketAddr: marketAddr.toLowerCase() });
|
|
242
242
|
return {
|
|
@@ -439,7 +439,7 @@ const useMintOption = (marketAddr) => {
|
|
|
439
439
|
duration,
|
|
440
440
|
0
|
|
441
441
|
]);
|
|
442
|
-
await askForApproval(payoutAsset, marketAddr, (premium + protocolFee * 11n
|
|
442
|
+
await askForApproval(payoutAsset, marketAddr, (premium + protocolFee) * 11n / 10n);
|
|
443
443
|
const hash$1 = await writeContractAsync({
|
|
444
444
|
address: marketAddr,
|
|
445
445
|
abi: optionsMarketAbi,
|
|
@@ -560,7 +560,7 @@ const useUserOptions = (user, active = false) => {
|
|
|
560
560
|
const { data,...rest } = useQuery({
|
|
561
561
|
queryKey: [
|
|
562
562
|
"userOptions",
|
|
563
|
-
user || "--",
|
|
563
|
+
(user === null || user === void 0 ? void 0 : user.toLowerCase()) || "--",
|
|
564
564
|
active
|
|
565
565
|
],
|
|
566
566
|
queryFn: async () => {
|
|
@@ -620,7 +620,7 @@ const useExtendOption = (marketAddr) => {
|
|
|
620
620
|
duration,
|
|
621
621
|
remainingDuration
|
|
622
622
|
]);
|
|
623
|
-
await askForApproval(payoutAsset, marketAddr, (premium + protocolFee * 11n
|
|
623
|
+
await askForApproval(payoutAsset, marketAddr, (premium + protocolFee) * 11n / 10n);
|
|
624
624
|
const hash$1 = await writeContractAsync({
|
|
625
625
|
address: marketAddr,
|
|
626
626
|
abi: optionsMarketAbi,
|
|
@@ -656,8 +656,8 @@ const useUserOperators = (userAddr, marketAddr) => {
|
|
|
656
656
|
const { data,...rest } = useQuery({
|
|
657
657
|
queryKey: [
|
|
658
658
|
"userOperators",
|
|
659
|
-
userAddr || "--",
|
|
660
|
-
marketAddr || "--"
|
|
659
|
+
(userAddr === null || userAddr === void 0 ? void 0 : userAddr.toLowerCase()) || "--",
|
|
660
|
+
(marketAddr === null || marketAddr === void 0 ? void 0 : marketAddr.toLowerCase()) || "--"
|
|
661
661
|
],
|
|
662
662
|
queryFn: async () => {
|
|
663
663
|
if (!userAddr || !marketAddr) return void 0;
|
|
@@ -678,6 +678,49 @@ const useUserOperators = (userAddr, marketAddr) => {
|
|
|
678
678
|
};
|
|
679
679
|
};
|
|
680
680
|
|
|
681
|
+
//#endregion
|
|
682
|
+
//#region src/hooks/market/useSetOperatorPerms.ts
|
|
683
|
+
const useSetOperatorPerms = (marketAddr) => {
|
|
684
|
+
const queryClient = useQueryClient();
|
|
685
|
+
const client = useClient();
|
|
686
|
+
const { address } = useAccount();
|
|
687
|
+
const { writeContractAsync, data: hash, isPending, error } = useWriteContract();
|
|
688
|
+
const { isLoading: isConfirming, isSuccess } = useWaitForTransactionReceipt({ hash });
|
|
689
|
+
const setOperatorPerms = async (operator, canExtend, canExercise, canTransfer, canMint, spendingApproval) => {
|
|
690
|
+
if (!client || !address) throw new Error("Wallet not connected");
|
|
691
|
+
if (!marketAddr) throw new Error("Market address not available");
|
|
692
|
+
const hash$1 = await writeContractAsync({
|
|
693
|
+
address: marketAddr,
|
|
694
|
+
abi: optionsMarketAbi,
|
|
695
|
+
functionName: "setOperatorPerms",
|
|
696
|
+
args: [
|
|
697
|
+
operator,
|
|
698
|
+
canExtend,
|
|
699
|
+
canExercise,
|
|
700
|
+
canTransfer,
|
|
701
|
+
canMint,
|
|
702
|
+
spendingApproval
|
|
703
|
+
]
|
|
704
|
+
});
|
|
705
|
+
await waitForTransactionReceipt(client, { hash: hash$1 });
|
|
706
|
+
await queryClient.invalidateQueries({ queryKey: [
|
|
707
|
+
"userOperators",
|
|
708
|
+
address.toLowerCase(),
|
|
709
|
+
marketAddr.toLowerCase()
|
|
710
|
+
] });
|
|
711
|
+
return hash$1;
|
|
712
|
+
};
|
|
713
|
+
return {
|
|
714
|
+
setOperatorPerms,
|
|
715
|
+
hash,
|
|
716
|
+
isPending,
|
|
717
|
+
isConfirming,
|
|
718
|
+
isSuccess,
|
|
719
|
+
error,
|
|
720
|
+
isLoading: isPending || isConfirming
|
|
721
|
+
};
|
|
722
|
+
};
|
|
723
|
+
|
|
681
724
|
//#endregion
|
|
682
725
|
//#region src/hooks/pool/usePriceAtTick.ts
|
|
683
726
|
const usePriceAtTick = (tick, poolAddr) => {
|
|
@@ -1049,5 +1092,5 @@ const useVaultTVL = (vaultAddr) => {
|
|
|
1049
1092
|
};
|
|
1050
1093
|
|
|
1051
1094
|
//#endregion
|
|
1052
|
-
export { TimelockMarketProvider, batchGetAmountsFromLiquidity, useActiveUserOptions, useBurnLiquidity, useClosedUserOptions, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useLens, useLiquidityBlocks, useMarketData, useMaxPositionSize, useMintLiquidity, useMintOption, useOptionPnl, useOptionPremium, usePoolData, usePriceAtTick, usePriceHistory, useTimelockConfig, useUserOperators, useVaultData, useVaultTVL };
|
|
1095
|
+
export { TimelockMarketProvider, batchGetAmountsFromLiquidity, useActiveUserOptions, useBurnLiquidity, useClosedUserOptions, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useLens, useLiquidityBlocks, useMarketData, useMaxPositionSize, useMintLiquidity, useMintOption, useOptionPnl, useOptionPremium, usePoolData, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useUserOperators, useVaultData, useVaultTVL };
|
|
1053
1096
|
//# sourceMappingURL=client.js.map
|