timelock-sdk 0.0.176 → 0.0.177
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-DbQo5Dsk.d.cts → client-BFfw9ee6.d.cts} +195 -195
- package/dist/{client-Bs4nrL5u.d.ts → client-BiwrAgwX.d.ts} +604 -604
- package/dist/client.cjs +4 -3
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +4 -3
- package/dist/client.js.map +1 -1
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -616,7 +616,7 @@ const useMintOption = (marketAddr) => {
|
|
|
616
616
|
if (!timelockLens) throw new Error("Timelock lens not available");
|
|
617
617
|
if (!tickSpacing) throw new Error("Pool data not available");
|
|
618
618
|
if (!vault || !payoutAsset || optionAssetIsToken0 === void 0) throw new Error("Market data not available");
|
|
619
|
-
const { data: {
|
|
619
|
+
const { data: { currentTick } = {} } = await refetchCurrentTick();
|
|
620
620
|
if (currentTick === void 0) throw new Error("Could not fetch current tick");
|
|
621
621
|
strikeTick = require_optionUtils.getNearestValidStrikeTick(optionType, optionAssetIsToken0, tickSpacing, currentTick, strikeTick);
|
|
622
622
|
const [premium, protocolFee] = await require_optionUtils.getTimelockMarket(marketAddr, client).read.calculatePremium([
|
|
@@ -626,7 +626,8 @@ const useMintOption = (marketAddr) => {
|
|
|
626
626
|
duration,
|
|
627
627
|
0
|
|
628
628
|
]);
|
|
629
|
-
|
|
629
|
+
const maxPremium = (premium + protocolFee) * 11n / 10n;
|
|
630
|
+
await askForApproval(payoutAsset, marketAddr, maxPremium);
|
|
630
631
|
const hash = await writeContractAsync({
|
|
631
632
|
address: marketAddr,
|
|
632
633
|
abi: require_statelessStateView.optionsMarketAbi,
|
|
@@ -637,7 +638,7 @@ const useMintOption = (marketAddr) => {
|
|
|
637
638
|
amount,
|
|
638
639
|
strikeTick,
|
|
639
640
|
duration,
|
|
640
|
-
|
|
641
|
+
maxPremium,
|
|
641
642
|
maxSteps,
|
|
642
643
|
await timelockLens.read.getRefTick([vault, strikeTick])
|
|
643
644
|
]
|