timelock-sdk 0.0.112 → 0.0.113
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-191_W3kB.d.cts → client-C3f1XPh8.d.cts} +135 -135
- package/dist/client.cjs +10 -9
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.js +10 -9
- package/dist/client.js.map +1 -1
- package/dist/package.d.cts +1 -1
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./uniswapMathLens-B_cHjOOB.cjs";
|
|
2
|
-
import { B as usePerpsOperator, F as useUserOperators, G as useExtendOption, H as useMintPerp, I as useOperatorPerms, J as useMintOption, K as useOptionPremium, L as useActiveUserPerps, P as useSetOperatorPerms, R as useClosedUserPerps, U as OptionTimelineData, V as useClosePerp, W as useOptionTimeline, Y as useMaxPositionSize, _t as useCurrentMarket, a as batchGetAmountsFromLiquidity, c as useLiquidityBlocks, d as usePriceAtTick, dt as useMarketData, f as UniswapPoolData, ft as useExerciseOption, gt as TimelockProvider, h as useCurrentPrice, ht as useClosedUserOptions, i as useVaultData, l as useBurnLiquidity, m as useCurrentTick, mt as useActiveUserOptions, n as useLens, o as useMintLiquidity, p as usePoolData, pt as OptionData, q as useOptionPnl, r as useVaultTVL, s as LiquidityBlockData, t as useApproval, u as usePriceHistory, vt as useTimelockConfig, z as useUserPerps } from "./client-
|
|
2
|
+
import { B as usePerpsOperator, F as useUserOperators, G as useExtendOption, H as useMintPerp, I as useOperatorPerms, J as useMintOption, K as useOptionPremium, L as useActiveUserPerps, P as useSetOperatorPerms, R as useClosedUserPerps, U as OptionTimelineData, V as useClosePerp, W as useOptionTimeline, Y as useMaxPositionSize, _t as useCurrentMarket, a as batchGetAmountsFromLiquidity, c as useLiquidityBlocks, d as usePriceAtTick, dt as useMarketData, f as UniswapPoolData, ft as useExerciseOption, gt as TimelockProvider, h as useCurrentPrice, ht as useClosedUserOptions, i as useVaultData, l as useBurnLiquidity, m as useCurrentTick, mt as useActiveUserOptions, n as useLens, o as useMintLiquidity, p as usePoolData, pt as OptionData, q as useOptionPnl, r as useVaultTVL, s as LiquidityBlockData, t as useApproval, u as usePriceHistory, vt as useTimelockConfig, z as useUserPerps } from "./client-C3f1XPh8.cjs";
|
|
3
3
|
export { LiquidityBlockData, OptionData, OptionTimelineData, TimelockProvider, UniswapPoolData, batchGetAmountsFromLiquidity, useActiveUserOptions, useActiveUserPerps, useApproval, useBurnLiquidity, useClosePerp, useClosedUserOptions, useClosedUserPerps, useCurrentMarket, useCurrentPrice, useCurrentTick, useExerciseOption, useExtendOption, useLens, useLiquidityBlocks, useMarketData, useMaxPositionSize, useMintLiquidity, useMintOption, useMintPerp, useOperatorPerms, useOptionPnl, useOptionPremium, useOptionTimeline, usePerpsOperator, usePoolData, usePriceAtTick, usePriceHistory, useSetOperatorPerms, useTimelockConfig, useUserOperators, useUserPerps, useVaultData, useVaultTVL };
|
package/dist/client.js
CHANGED
|
@@ -1072,14 +1072,6 @@ const useMintPerp = (marketAddr) => {
|
|
|
1072
1072
|
if (!tickSpacing || currentTick === void 0) throw new Error("Pool data not found");
|
|
1073
1073
|
if (optionAssetIsToken0 === void 0 || !payoutAsset) throw new Error("Market data not found");
|
|
1074
1074
|
if (!operator.auth) await signMessage();
|
|
1075
|
-
if (!hasEnoughPerms) await setOperatorPerms({
|
|
1076
|
-
operator: operatorAddr,
|
|
1077
|
-
canMint: true,
|
|
1078
|
-
canExtend: true,
|
|
1079
|
-
canExercise: true,
|
|
1080
|
-
canTransfer: (userPerms === null || userPerms === void 0 ? void 0 : userPerms.canTransfer) || false,
|
|
1081
|
-
spendingApproval: maxUint256
|
|
1082
|
-
});
|
|
1083
1075
|
const market = getTimelockMarket(marketAddr, client);
|
|
1084
1076
|
const validStrikeTick = getNearestValidStrikeTick(optionType, optionAssetIsToken0, tickSpacing, currentTick, strikeTick);
|
|
1085
1077
|
const [premium, protocolFee] = await market.read.calculatePremium([
|
|
@@ -1089,7 +1081,16 @@ const useMintPerp = (marketAddr) => {
|
|
|
1089
1081
|
duration,
|
|
1090
1082
|
0
|
|
1091
1083
|
]);
|
|
1092
|
-
|
|
1084
|
+
const maxPremium = (premium + protocolFee) * 11n / 10n;
|
|
1085
|
+
if (!hasEnoughPerms) await setOperatorPerms({
|
|
1086
|
+
operator: operatorAddr,
|
|
1087
|
+
canMint: true,
|
|
1088
|
+
canExtend: true,
|
|
1089
|
+
canExercise: true,
|
|
1090
|
+
canTransfer: (userPerms === null || userPerms === void 0 ? void 0 : userPerms.canTransfer) || false,
|
|
1091
|
+
spendingApproval: maxPremium
|
|
1092
|
+
});
|
|
1093
|
+
await askForApproval(payoutAsset, marketAddr, maxPremium);
|
|
1093
1094
|
await operator.mintPerp({
|
|
1094
1095
|
marketAddr,
|
|
1095
1096
|
amount,
|