timelock-sdk 0.0.240 → 0.0.241
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 +50 -4
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +427 -416
- package/dist/client.d.ts +1224 -1213
- package/dist/client.js +49 -4
- package/dist/client.js.map +1 -1
- package/dist/{index-CNTlT0vf.d.ts → index-C4hRFzOj.d.ts} +614 -614
- package/dist/{index-BDJmXd7_.d.cts → index-DGNdIsVj.d.cts} +483 -483
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -1364,8 +1364,8 @@ const useOptionPnl = (option) => {
|
|
|
1364
1364
|
};
|
|
1365
1365
|
|
|
1366
1366
|
//#endregion
|
|
1367
|
-
//#region src/hooks/options/
|
|
1368
|
-
const
|
|
1367
|
+
//#region src/hooks/options/useMintFees.ts
|
|
1368
|
+
const useMintFees = (marketAddr, optionType, optionAmount, duration, strikeTick) => {
|
|
1369
1369
|
const { poolManager, poolKey, payoutAssetDecimals, optionAssetIsToken0 } = useMarketData(marketAddr);
|
|
1370
1370
|
const { tickSpacing } = usePoolData(poolManager, poolKey);
|
|
1371
1371
|
const { data: { currentTick } = {} } = useCurrentTick(poolManager, poolKey);
|
|
@@ -1385,11 +1385,56 @@ const useOptionPremium = (marketAddr, optionType, optionAmount, addedDuration, s
|
|
|
1385
1385
|
address: marketAddr,
|
|
1386
1386
|
abi: require_stateView.optionsMarketAbi,
|
|
1387
1387
|
functionName: "getMintFees",
|
|
1388
|
-
args: strikeTickRounded !== void 0 && optionAmount !== void 0 &&
|
|
1388
|
+
args: strikeTickRounded !== void 0 && optionAmount !== void 0 && duration !== void 0 ? [
|
|
1389
|
+
optionType === "CALL" ? 0 : 1,
|
|
1390
|
+
optionAmount,
|
|
1391
|
+
strikeTickRounded,
|
|
1392
|
+
duration,
|
|
1393
|
+
"0x"
|
|
1394
|
+
] : void 0
|
|
1395
|
+
});
|
|
1396
|
+
return (0, react.useMemo)(() => {
|
|
1397
|
+
if (premium === void 0 || protocolFee === void 0 || payoutAssetDecimals === void 0) return {};
|
|
1398
|
+
return {
|
|
1399
|
+
premium: require_numberUtils.wrapAmount(premium, payoutAssetDecimals),
|
|
1400
|
+
protocolFee: require_numberUtils.wrapAmount(protocolFee, payoutAssetDecimals),
|
|
1401
|
+
totalPremium: require_numberUtils.wrapAmount(premium + protocolFee, payoutAssetDecimals)
|
|
1402
|
+
};
|
|
1403
|
+
}, [
|
|
1404
|
+
premium,
|
|
1405
|
+
protocolFee,
|
|
1406
|
+
payoutAssetDecimals
|
|
1407
|
+
]);
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
//#endregion
|
|
1411
|
+
//#region src/hooks/options/useExtensionFees.ts
|
|
1412
|
+
const useExtensionFees = (marketAddr, optionType, optionAmount, addedDuration, remainingDuration, strikeTick) => {
|
|
1413
|
+
const { poolManager, poolKey, payoutAssetDecimals, optionAssetIsToken0 } = useMarketData(marketAddr);
|
|
1414
|
+
const { tickSpacing } = usePoolData(poolManager, poolKey);
|
|
1415
|
+
const { data: { currentTick } = {} } = useCurrentTick(poolManager, poolKey);
|
|
1416
|
+
const strikeTickRounded = (0, react.useMemo)(() => {
|
|
1417
|
+
if (!tickSpacing || currentTick === void 0) return;
|
|
1418
|
+
let strikeTickRounded$1 = require_numberUtils.roundTick(strikeTick ?? currentTick, tickSpacing);
|
|
1419
|
+
if (optionType === "CALL" && optionAssetIsToken0 || optionType === "PUT" && !optionAssetIsToken0) strikeTickRounded$1 += tickSpacing;
|
|
1420
|
+
return strikeTickRounded$1;
|
|
1421
|
+
}, [
|
|
1422
|
+
currentTick,
|
|
1423
|
+
tickSpacing,
|
|
1424
|
+
optionType,
|
|
1425
|
+
optionAssetIsToken0,
|
|
1426
|
+
strikeTick
|
|
1427
|
+
]);
|
|
1428
|
+
const { data: [premium, protocolFee] = [] } = (0, wagmi.useReadContract)({
|
|
1429
|
+
address: marketAddr,
|
|
1430
|
+
abi: require_stateView.optionsMarketAbi,
|
|
1431
|
+
functionName: "getExtendFees",
|
|
1432
|
+
args: strikeTickRounded !== void 0 && optionAmount !== void 0 && addedDuration !== void 0 && remainingDuration !== void 0 ? [
|
|
1389
1433
|
optionType === "CALL" ? 0 : 1,
|
|
1390
1434
|
optionAmount,
|
|
1391
1435
|
strikeTickRounded,
|
|
1392
1436
|
addedDuration,
|
|
1437
|
+
remainingDuration,
|
|
1393
1438
|
"0x"
|
|
1394
1439
|
] : void 0
|
|
1395
1440
|
});
|
|
@@ -2659,6 +2704,7 @@ exports.useCurrentTick = useCurrentTick;
|
|
|
2659
2704
|
exports.useCurrentTicks = useCurrentTicks;
|
|
2660
2705
|
exports.useExerciseOption = useExerciseOption;
|
|
2661
2706
|
exports.useExtendOption = useExtendOption;
|
|
2707
|
+
exports.useExtensionFees = useExtensionFees;
|
|
2662
2708
|
exports.useFeeRates = useFeeRates;
|
|
2663
2709
|
exports.useGlobalGuardianState = useGlobalGuardianState;
|
|
2664
2710
|
exports.useLens = useLens;
|
|
@@ -2672,12 +2718,12 @@ exports.useMarketUserVolume = useMarketUserVolume;
|
|
|
2672
2718
|
exports.useMarketVolume = useMarketVolume;
|
|
2673
2719
|
exports.useMarketsData = useMarketsData;
|
|
2674
2720
|
exports.useMaxPositionSize = useMaxPositionSize;
|
|
2721
|
+
exports.useMintFees = useMintFees;
|
|
2675
2722
|
exports.useMintLiquidity = useMintLiquidity;
|
|
2676
2723
|
exports.useMintOption = useMintOption;
|
|
2677
2724
|
exports.useMintPerp = useMintPerp;
|
|
2678
2725
|
exports.useOperatorPerms = useOperatorPerms;
|
|
2679
2726
|
exports.useOptionPnl = useOptionPnl;
|
|
2680
|
-
exports.useOptionPremium = useOptionPremium;
|
|
2681
2727
|
exports.useOptionPricingParams = useOptionPricingParams;
|
|
2682
2728
|
exports.useOptionTimeline = useOptionTimeline;
|
|
2683
2729
|
exports.usePauseAllMarkets = usePauseAllMarkets;
|