timelock-sdk 0.0.237 → 0.0.238

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.
Files changed (35) hide show
  1. package/dist/abis.cjs +2 -2
  2. package/dist/abis.d.cts +31 -1
  3. package/dist/abis.d.ts +31 -1
  4. package/dist/abis.js +2 -2
  5. package/dist/client.cjs +42 -23
  6. package/dist/client.cjs.map +1 -1
  7. package/dist/client.d.cts +80 -44
  8. package/dist/client.d.ts +101 -65
  9. package/dist/client.js +42 -23
  10. package/dist/client.js.map +1 -1
  11. package/dist/{factory-5hUk9F0p.cjs → factory-CUMBEyKw.cjs} +57 -15
  12. package/dist/factory-CUMBEyKw.cjs.map +1 -0
  13. package/dist/{factory-CXe8NCiA.js → factory-DB64NQVz.js} +57 -15
  14. package/dist/factory-DB64NQVz.js.map +1 -0
  15. package/dist/{index-Dq0uC5e8.d.ts → index-3KOVEC1_.d.cts} +251 -57
  16. package/dist/{index-BhM6ifKL.d.cts → index-C4hRFzOj.d.ts} +247 -53
  17. package/dist/{numberUtils-B-inHOvt.cjs → numberUtils-BZ_G2lrM.cjs} +3 -3
  18. package/dist/{numberUtils-B-inHOvt.cjs.map → numberUtils-BZ_G2lrM.cjs.map} +1 -1
  19. package/dist/{numberUtils-CjyQGUg6.js → numberUtils-C2B8mSnx.js} +3 -3
  20. package/dist/{numberUtils-CjyQGUg6.js.map → numberUtils-C2B8mSnx.js.map} +1 -1
  21. package/dist/{optionsMarket-D7BmgbPj.d.ts → optionsMarket-DrJWoxeN.d.ts} +91 -45
  22. package/dist/{optionsMarket-B1e5X8fo.d.cts → optionsMarket-fyNO91om.d.cts} +91 -45
  23. package/dist/package.cjs +1 -1
  24. package/dist/package.d.cts +1 -1
  25. package/dist/package.d.ts +1 -1
  26. package/dist/package.js +1 -1
  27. package/dist/{stateView-BMkpa0rT.cjs → stateView-CkfUE7Sg.cjs} +128 -66
  28. package/dist/stateView-CkfUE7Sg.cjs.map +1 -0
  29. package/dist/{stateView-DlySJr25.js → stateView-DMydGVhr.js} +128 -66
  30. package/dist/stateView-DMydGVhr.js.map +1 -0
  31. package/package.json +1 -1
  32. package/dist/factory-5hUk9F0p.cjs.map +0 -1
  33. package/dist/factory-CXe8NCiA.js.map +0 -1
  34. package/dist/stateView-BMkpa0rT.cjs.map +0 -1
  35. package/dist/stateView-DlySJr25.js.map +0 -1
package/dist/abis.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_stateView = require('./stateView-BMkpa0rT.cjs');
2
- const require_factory = require('./factory-5hUk9F0p.cjs');
1
+ const require_stateView = require('./stateView-CkfUE7Sg.cjs');
2
+ const require_factory = require('./factory-CUMBEyKw.cjs');
3
3
 
4
4
  //#region src/abis/poolManager.ts
5
5
  const poolManagerAbi = [
package/dist/abis.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as lensAbi, t as optionsMarketAbi } from "./optionsMarket-B1e5X8fo.cjs";
1
+ import { n as lensAbi, t as optionsMarketAbi } from "./optionsMarket-fyNO91om.cjs";
2
2
 
3
3
  //#region src/abis/erc20.d.ts
4
4
  declare const erc20Abi: readonly [{
@@ -246,9 +246,17 @@ declare const factoryAbi: readonly [{
246
246
  readonly type: "function";
247
247
  readonly name: "deployStaticPerpsPricing";
248
248
  readonly inputs: readonly [{
249
+ readonly name: "_openingRate";
250
+ readonly type: "uint32";
251
+ readonly internalType: "uint32";
252
+ }, {
249
253
  readonly name: "_dailyFundingRate";
250
254
  readonly type: "uint32";
251
255
  readonly internalType: "uint32";
256
+ }, {
257
+ readonly name: "_minOpeningAmount";
258
+ readonly type: "uint128";
259
+ readonly internalType: "uint128";
252
260
  }, {
253
261
  readonly name: "_minFundingAmount";
254
262
  readonly type: "uint128";
@@ -380,11 +388,21 @@ declare const factoryAbi: readonly [{
380
388
  readonly type: "address";
381
389
  readonly indexed: true;
382
390
  readonly internalType: "contract StaticPerpsPricing";
391
+ }, {
392
+ readonly name: "openingRate";
393
+ readonly type: "uint32";
394
+ readonly indexed: false;
395
+ readonly internalType: "uint32";
383
396
  }, {
384
397
  readonly name: "dailyFundingRate";
385
398
  readonly type: "uint32";
386
399
  readonly indexed: false;
387
400
  readonly internalType: "uint32";
401
+ }, {
402
+ readonly name: "minOpeningAmount";
403
+ readonly type: "uint128";
404
+ readonly indexed: false;
405
+ readonly internalType: "uint128";
388
406
  }, {
389
407
  readonly name: "minFundingAmount";
390
408
  readonly type: "uint128";
@@ -2527,6 +2545,14 @@ declare const singleOwnerVaultAbi: readonly [{
2527
2545
  readonly name: "tokens";
2528
2546
  readonly type: "address[]";
2529
2547
  readonly internalType: "contract IERC20[]";
2548
+ }, {
2549
+ readonly name: "amounts";
2550
+ readonly type: "uint256[]";
2551
+ readonly internalType: "uint256[]";
2552
+ }, {
2553
+ readonly name: "recipient";
2554
+ readonly type: "address";
2555
+ readonly internalType: "address";
2530
2556
  }];
2531
2557
  readonly outputs: readonly [];
2532
2558
  readonly stateMutability: "nonpayable";
@@ -2774,6 +2800,10 @@ declare const singleOwnerVaultAbi: readonly [{
2774
2800
  readonly type: "address";
2775
2801
  readonly internalType: "address";
2776
2802
  }];
2803
+ }, {
2804
+ readonly type: "error";
2805
+ readonly name: "ArrayLengthMismatch";
2806
+ readonly inputs: readonly [];
2777
2807
  }, {
2778
2808
  readonly type: "error";
2779
2809
  readonly name: "BorrowerNotWhitelisted";
package/dist/abis.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as lensAbi, t as optionsMarketAbi } from "./optionsMarket-D7BmgbPj.js";
1
+ import { n as lensAbi, t as optionsMarketAbi } from "./optionsMarket-DrJWoxeN.js";
2
2
 
3
3
  //#region src/abis/erc20.d.ts
4
4
  declare const erc20Abi: readonly [{
@@ -246,9 +246,17 @@ declare const factoryAbi: readonly [{
246
246
  readonly type: "function";
247
247
  readonly name: "deployStaticPerpsPricing";
248
248
  readonly inputs: readonly [{
249
+ readonly name: "_openingRate";
250
+ readonly type: "uint32";
251
+ readonly internalType: "uint32";
252
+ }, {
249
253
  readonly name: "_dailyFundingRate";
250
254
  readonly type: "uint32";
251
255
  readonly internalType: "uint32";
256
+ }, {
257
+ readonly name: "_minOpeningAmount";
258
+ readonly type: "uint128";
259
+ readonly internalType: "uint128";
252
260
  }, {
253
261
  readonly name: "_minFundingAmount";
254
262
  readonly type: "uint128";
@@ -380,11 +388,21 @@ declare const factoryAbi: readonly [{
380
388
  readonly type: "address";
381
389
  readonly indexed: true;
382
390
  readonly internalType: "contract StaticPerpsPricing";
391
+ }, {
392
+ readonly name: "openingRate";
393
+ readonly type: "uint32";
394
+ readonly indexed: false;
395
+ readonly internalType: "uint32";
383
396
  }, {
384
397
  readonly name: "dailyFundingRate";
385
398
  readonly type: "uint32";
386
399
  readonly indexed: false;
387
400
  readonly internalType: "uint32";
401
+ }, {
402
+ readonly name: "minOpeningAmount";
403
+ readonly type: "uint128";
404
+ readonly indexed: false;
405
+ readonly internalType: "uint128";
388
406
  }, {
389
407
  readonly name: "minFundingAmount";
390
408
  readonly type: "uint128";
@@ -2527,6 +2545,14 @@ declare const singleOwnerVaultAbi: readonly [{
2527
2545
  readonly name: "tokens";
2528
2546
  readonly type: "address[]";
2529
2547
  readonly internalType: "contract IERC20[]";
2548
+ }, {
2549
+ readonly name: "amounts";
2550
+ readonly type: "uint256[]";
2551
+ readonly internalType: "uint256[]";
2552
+ }, {
2553
+ readonly name: "recipient";
2554
+ readonly type: "address";
2555
+ readonly internalType: "address";
2530
2556
  }];
2531
2557
  readonly outputs: readonly [];
2532
2558
  readonly stateMutability: "nonpayable";
@@ -2774,6 +2800,10 @@ declare const singleOwnerVaultAbi: readonly [{
2774
2800
  readonly type: "address";
2775
2801
  readonly internalType: "address";
2776
2802
  }];
2803
+ }, {
2804
+ readonly type: "error";
2805
+ readonly name: "ArrayLengthMismatch";
2806
+ readonly inputs: readonly [];
2777
2807
  }, {
2778
2808
  readonly type: "error";
2779
2809
  readonly name: "BorrowerNotWhitelisted";
package/dist/abis.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as erc20Abi, i as lensAbi, n as quoterAbi, r as optionsMarketAbi, t as stateViewAbi } from "./stateView-DlySJr25.js";
2
- import { n as guardianAbi, r as singleOwnerVaultAbi, t as factoryAbi } from "./factory-CXe8NCiA.js";
1
+ import { a as erc20Abi, i as lensAbi, n as quoterAbi, r as optionsMarketAbi, t as stateViewAbi } from "./stateView-DMydGVhr.js";
2
+ import { n as guardianAbi, r as singleOwnerVaultAbi, t as factoryAbi } from "./factory-DB64NQVz.js";
3
3
 
4
4
  //#region src/abis/poolManager.ts
5
5
  const poolManagerAbi = [
package/dist/client.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
- const require_numberUtils = require('./numberUtils-B-inHOvt.cjs');
4
- const require_stateView = require('./stateView-BMkpa0rT.cjs');
5
- const require_factory = require('./factory-5hUk9F0p.cjs');
3
+ const require_numberUtils = require('./numberUtils-BZ_G2lrM.cjs');
4
+ const require_stateView = require('./stateView-CkfUE7Sg.cjs');
5
+ const require_factory = require('./factory-CUMBEyKw.cjs');
6
6
  let viem = require("viem");
7
7
  let react = require("react");
8
8
  react = require_numberUtils.__toESM(react);
@@ -1142,12 +1142,11 @@ const useMintOption = (marketAddr) => {
1142
1142
  const { data: { currentTick } = {} } = await refetchCurrentTick();
1143
1143
  if (currentTick === void 0) throw new Error("Could not fetch current tick");
1144
1144
  strikeTick = require_numberUtils.getNearestValidStrikeTick(optionType, optionAssetIsToken0, tickSpacing, currentTick, strikeTick);
1145
- const [premium, protocolFee] = await require_numberUtils.getTimelockMarket(marketAddr, client).read.calculatePremium([
1145
+ const [premium, protocolFee] = await require_numberUtils.getTimelockMarket(marketAddr, client).read.getMintFees([
1146
1146
  optionType === "CALL" ? 0 : 1,
1147
1147
  amount,
1148
1148
  strikeTick,
1149
1149
  duration,
1150
- 0,
1151
1150
  "0x"
1152
1151
  ]);
1153
1152
  const maxPremium = (premium + protocolFee) * 11n / 10n;
@@ -1366,7 +1365,7 @@ const useOptionPnl = (option) => {
1366
1365
 
1367
1366
  //#endregion
1368
1367
  //#region src/hooks/options/useOptionPremium.ts
1369
- const useOptionPremium = (marketAddr, optionType, optionAmount, addedDuration, remainingDuration = 0, strikeTick) => {
1368
+ const useOptionPremium = (marketAddr, optionType, optionAmount, addedDuration, strikeTick) => {
1370
1369
  const { poolManager, poolKey, payoutAssetDecimals, optionAssetIsToken0 } = useMarketData(marketAddr);
1371
1370
  const { tickSpacing } = usePoolData(poolManager, poolKey);
1372
1371
  const { data: { currentTick } = {} } = useCurrentTick(poolManager, poolKey);
@@ -1385,13 +1384,12 @@ const useOptionPremium = (marketAddr, optionType, optionAmount, addedDuration, r
1385
1384
  const { data: [premium, protocolFee] = [] } = (0, wagmi.useReadContract)({
1386
1385
  address: marketAddr,
1387
1386
  abi: require_stateView.optionsMarketAbi,
1388
- functionName: "calculatePremium",
1387
+ functionName: "getMintFees",
1389
1388
  args: strikeTickRounded !== void 0 && optionAmount !== void 0 && addedDuration !== void 0 ? [
1390
1389
  optionType === "CALL" ? 0 : 1,
1391
1390
  optionAmount,
1392
1391
  strikeTickRounded,
1393
1392
  addedDuration,
1394
- remainingDuration,
1395
1393
  "0x"
1396
1394
  ] : void 0
1397
1395
  });
@@ -1472,7 +1470,7 @@ const useExtendOption = (marketAddr) => {
1472
1470
  if (!marketAddr || !payoutAsset) throw new Error("Market address not available");
1473
1471
  const market = require_numberUtils.getTimelockMarket(marketAddr, client);
1474
1472
  const remainingDuration = Math.max(0, Math.floor((option.expiresAt.getTime() - Date.now()) / 1e3));
1475
- const [premium, protocolFee] = await market.read.calculatePremium([
1473
+ const [premium, protocolFee] = await market.read.getExtendFees([
1476
1474
  option.optionType === "CALL" ? 0 : 1,
1477
1475
  option.positionSizeCurrent,
1478
1476
  option.strikeTick,
@@ -1731,12 +1729,11 @@ const useMintPerp = (marketAddr) => {
1731
1729
  const { data: operators = [] } = await refetchOperators();
1732
1730
  const userPerms = operatorAddr ? operators.find((o) => o.operatorAddr.toLowerCase() === operatorAddr.toLowerCase()) : void 0;
1733
1731
  const validStrikeTick = require_numberUtils.getNearestValidStrikeTick(optionType, optionAssetIsToken0, tickSpacing, currentTick, strikeTick);
1734
- const [premium, protocolFee] = await market.read.calculatePremium([
1732
+ const [premium, protocolFee] = await market.read.getMintFees([
1735
1733
  optionType === "CALL" ? 0 : 1,
1736
1734
  amount,
1737
1735
  validStrikeTick,
1738
1736
  duration,
1739
- 0,
1740
1737
  "0x"
1741
1738
  ]);
1742
1739
  const maxPremium = (premium + protocolFee) * 11n / 10n;
@@ -2395,9 +2392,9 @@ const useUpdateMarketFees = (marketAddr) => {
2395
2392
  const publicClient = (0, wagmi.usePublicClient)();
2396
2393
  const chainId = (0, wagmi.useChainId)();
2397
2394
  const { data: { feeStrategy, optionPricing, priceFeed } = {}, error: stateError } = useMarketState(marketAddr);
2398
- const { data: { openingFeeRate, baseFeeRate, minOpeningFee, minBaseFee, feeRecipient } = {} } = useFeeRates(feeStrategy);
2395
+ const { data: { openingFeeRate, extensionFeeRate, minOpeningFee, minExtensionFee, feeRecipient } = {} } = useFeeRates(feeStrategy);
2399
2396
  const updateMarketFees = async (rates) => {
2400
- if (openingFeeRate === void 0 || baseFeeRate === void 0 || minOpeningFee === void 0 || minBaseFee === void 0 || feeRecipient === void 0) throw new Error("Missing current fee rates");
2397
+ if (openingFeeRate === void 0 || extensionFeeRate === void 0 || minOpeningFee === void 0 || minExtensionFee === void 0 || feeRecipient === void 0) throw new Error("Missing current fee rates");
2401
2398
  if (!optionPricing || !priceFeed) throw new Error("Market state not available: " + (stateError === null || stateError === void 0 ? void 0 : stateError.message));
2402
2399
  if (!publicClient) throw new Error("Public client not available");
2403
2400
  const factoryAddr = require_numberUtils.timelockFactories[chainId].toLowerCase();
@@ -2407,9 +2404,9 @@ const useUpdateMarketFees = (marketAddr) => {
2407
2404
  functionName: "deployFeeStrategy",
2408
2405
  args: [
2409
2406
  rates.openingFeeRate ?? openingFeeRate,
2410
- rates.baseFeeRate ?? baseFeeRate,
2407
+ rates.extensionFeeRate ?? extensionFeeRate,
2411
2408
  rates.minOpeningFee ?? minOpeningFee,
2412
- rates.minBaseFee ?? minBaseFee,
2409
+ rates.minExtensionFee ?? minExtensionFee,
2413
2410
  rates.feeRecipient ?? feeRecipient
2414
2411
  ]
2415
2412
  });
@@ -2487,16 +2484,29 @@ const usePricingParams = (pricingAddr) => {
2487
2484
  minPremiumAmount
2488
2485
  };
2489
2486
  } else if (pricingModel === 1) {
2490
- const [dailyFundingRate, minFundingAmount] = (0, viem.decodeAbiParameters)([{
2491
- name: "dailyFundingRate",
2492
- type: "uint32"
2493
- }, {
2494
- name: "minFundingAmount",
2495
- type: "uint128"
2496
- }], rawData);
2487
+ const [openingRate, dailyFundingRate, minOpeningAmount, minFundingAmount] = (0, viem.decodeAbiParameters)([
2488
+ {
2489
+ name: "openingRate",
2490
+ type: "uint32"
2491
+ },
2492
+ {
2493
+ name: "dailyFundingRate",
2494
+ type: "uint32"
2495
+ },
2496
+ {
2497
+ name: "minOpeningAmount",
2498
+ type: "uint128"
2499
+ },
2500
+ {
2501
+ name: "minFundingAmount",
2502
+ type: "uint128"
2503
+ }
2504
+ ], rawData);
2497
2505
  return {
2498
2506
  model: "static",
2507
+ openingRate,
2499
2508
  dailyFundingRate,
2509
+ minOpeningAmount,
2500
2510
  minFundingAmount
2501
2511
  };
2502
2512
  }
@@ -2547,7 +2557,9 @@ const useUpdateMarketPricing = (marketAddr) => {
2547
2557
  if (!feeStrategy || !priceFeed) throw new Error("Market state not available: " + (stateError === null || stateError === void 0 ? void 0 : stateError.message));
2548
2558
  const factoryAddr = require_numberUtils.timelockFactories[chainId].toLowerCase();
2549
2559
  if (data.model === "static" && pricingData.model === "static") {
2560
+ data.openingRate ?? (data.openingRate = pricingData.openingRate);
2550
2561
  data.dailyFundingRate ?? (data.dailyFundingRate = pricingData.dailyFundingRate);
2562
+ data.minOpeningAmount ?? (data.minOpeningAmount = pricingData.minOpeningAmount);
2551
2563
  data.minFundingAmount ?? (data.minFundingAmount = pricingData.minFundingAmount);
2552
2564
  }
2553
2565
  if (data.model === "bsm" && pricingData.model === "bsm") {
@@ -2558,7 +2570,9 @@ const useUpdateMarketPricing = (marketAddr) => {
2558
2570
  data.minPremiumAmount ?? (data.minPremiumAmount = pricingData.minPremiumAmount);
2559
2571
  }
2560
2572
  if (data.model !== pricingData.model) if (data.model === "static") {
2573
+ if (data.openingRate === void 0) throw new Error("openingRate is required when switching to static model");
2561
2574
  if (data.dailyFundingRate === void 0) throw new Error("dailyFundingRate is required when switching to static model");
2575
+ if (data.minOpeningAmount === void 0) throw new Error("minOpeningAmount is required when switching to static model");
2562
2576
  if (data.minFundingAmount === void 0) throw new Error("minFundingAmount is required when switching to static model");
2563
2577
  } else {
2564
2578
  if (data.logicContract === void 0) throw new Error("logicContract is required when switching to option model");
@@ -2571,7 +2585,12 @@ const useUpdateMarketPricing = (marketAddr) => {
2571
2585
  address: factoryAddr,
2572
2586
  abi: require_factory.factoryAbi,
2573
2587
  functionName: "deployStaticPerpsPricing",
2574
- args: [data.dailyFundingRate, data.minFundingAmount]
2588
+ args: [
2589
+ data.openingRate,
2590
+ data.dailyFundingRate,
2591
+ data.minOpeningAmount,
2592
+ data.minFundingAmount
2593
+ ]
2575
2594
  }) : await writeContractAsync({
2576
2595
  address: factoryAddr,
2577
2596
  abi: require_factory.factoryAbi,