timelock-sdk 0.0.57 → 0.0.59

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-k4C_Yx7a.cjs');
1
+ const require_optionsMarket = require('./optionsMarket-DR-asJJa.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-CGKa7m43.cjs";
1
+ import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-CVpKNF0-.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-BCl11EO1.js";
1
+ import { n as optionsMarketAbi, r as lensAbi, t as uniswapMathLensAbi } from "./uniswapMathLens-nYgMLuOt.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-gAjmVL6j.js";
1
+ import { i as erc20Abi, n as uniswapMathLensAbi, r as lensAbi, t as optionsMarketAbi } from "./optionsMarket-DlorOgXd.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-DUFFdMYG.cjs');
5
- const require_optionsMarket = require('./optionsMarket-k4C_Yx7a.cjs');
4
+ const require_numberUtils = require('./numberUtils-kfuUM90a.cjs');
5
+ const require_optionsMarket = require('./optionsMarket-DR-asJJa.cjs');
6
6
  const require_singleOwnerVault = require('./singleOwnerVault-gf2zNZVk.cjs');
7
7
  let viem = require("viem");
8
8
  viem = require_numberUtils.__toESM(viem);
@@ -405,8 +405,7 @@ const useMintOption = (marketAddr) => {
405
405
  duration,
406
406
  0
407
407
  ]);
408
- const maxPremium = (premium + protocolFee * 11n) / 10n;
409
- await askForApproval(payoutAsset, marketAddr, maxPremium);
408
+ await askForApproval(payoutAsset, marketAddr, (premium + protocolFee * 11n) / 10n);
410
409
  const hash$1 = await writeContractAsync({
411
410
  address: marketAddr,
412
411
  abi: require_optionsMarket.optionsMarketAbi,
@@ -416,7 +415,7 @@ const useMintOption = (marketAddr) => {
416
415
  amount,
417
416
  strikeTick,
418
417
  duration,
419
- maxPremium,
418
+ viem.maxUint256,
420
419
  false,
421
420
  await timelockLens.read.getRefTick([vault, strikeTick])
422
421
  ]
@@ -577,15 +576,16 @@ const useExtendOption = (marketAddr) => {
577
576
  const extendOption = async (option, duration) => {
578
577
  if (!client || !address) throw new Error("Wallet not connected");
579
578
  if (!marketAddr || !payoutAsset) throw new Error("Market address not available");
580
- const [premium, protocolFee] = await require_numberUtils.getTimelockMarket(marketAddr, client).read.calculatePremium([
579
+ const market = require_numberUtils.getTimelockMarket(marketAddr, client);
580
+ const remainingDuration = Math.max(0, Math.floor((option.expiresAt.getTime() - Date.now()) / 1e3));
581
+ const [premium, protocolFee] = await market.read.calculatePremium([
581
582
  option.optionType === "CALL" ? 0 : 1,
582
583
  option.positionSizeCurrent,
583
584
  option.strikeTick,
584
585
  duration,
585
- Math.floor((option.expiresAt.getTime() - Date.now()) / 1e3)
586
+ remainingDuration
586
587
  ]);
587
- const maxPremium = (premium + protocolFee * 11n) / 10n;
588
- await askForApproval(payoutAsset, marketAddr, maxPremium);
588
+ await askForApproval(payoutAsset, marketAddr, (premium + protocolFee * 11n) / 10n);
589
589
  const hash$1 = await writeContractAsync({
590
590
  address: marketAddr,
591
591
  abi: require_optionsMarket.optionsMarketAbi,
@@ -593,7 +593,7 @@ const useExtendOption = (marketAddr) => {
593
593
  args: [
594
594
  option.optionId,
595
595
  duration,
596
- maxPremium
596
+ viem.maxUint256
597
597
  ]
598
598
  });
599
599
  await (0, viem_actions.waitForTransactionReceipt)(client, { hash: hash$1 });