timelock-sdk 0.0.166 → 0.0.168
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-CgVlKoVW.d.ts → client-CWE_lgF4.d.ts} +267 -267
- package/dist/{client-C3Dv62sE.d.cts → client-DpfVNI7p.d.cts} +431 -431
- package/dist/client.cjs +24 -17
- 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 +24 -17
- package/dist/client.js.map +1 -1
- package/dist/{optionUtils-OyY8qOu0.js → optionUtils-Ctn8remy.js} +2 -2
- package/dist/{optionUtils-OyY8qOu0.js.map → optionUtils-Ctn8remy.js.map} +1 -1
- package/dist/{optionUtils-Cuuw6jXD.cjs → optionUtils-cd5h0wkz.cjs} +2 -2
- package/dist/{optionUtils-Cuuw6jXD.cjs.map → optionUtils-cd5h0wkz.cjs.map} +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/dist/package.js +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
const require_optionUtils = require('./optionUtils-
|
|
4
|
+
const require_optionUtils = require('./optionUtils-cd5h0wkz.cjs');
|
|
5
5
|
const require_statelessStateView = require('./statelessStateView-XdTJQxsY.cjs');
|
|
6
6
|
const require_factory = require('./factory-DitVXzjQ.cjs');
|
|
7
7
|
let viem = require("viem");
|
|
@@ -1622,11 +1622,12 @@ const useFeeRates = (feeStrategy) => {
|
|
|
1622
1622
|
//#region src/hooks/fees/useUpdateMarketFees.ts
|
|
1623
1623
|
const useUpdateMarketFees = (marketAddr) => {
|
|
1624
1624
|
const { writeContractAsync, ...rest } = (0, wagmi.useWriteContract)();
|
|
1625
|
+
const queryClient = (0, __tanstack_react_query.useQueryClient)();
|
|
1625
1626
|
const publicClient = (0, wagmi.usePublicClient)();
|
|
1626
1627
|
const chainId = (0, wagmi.useChainId)();
|
|
1627
1628
|
const { data: { feeStrategy, optionPricing } } = useMarketState(marketAddr);
|
|
1628
1629
|
const { openingFeeRate, baseFeeRate, minOpeningFee, minBaseFee, feeRecipient } = useFeeRates(feeStrategy);
|
|
1629
|
-
const
|
|
1630
|
+
const updateMarketFees = async (rates) => {
|
|
1630
1631
|
if (openingFeeRate === void 0 || baseFeeRate === void 0 || minOpeningFee === void 0 || minBaseFee === void 0 || feeRecipient === void 0) throw new Error("Missing current fee rates");
|
|
1631
1632
|
if (!optionPricing) throw new Error("Could not load market state");
|
|
1632
1633
|
if (!publicClient) throw new Error("Public client not available");
|
|
@@ -1652,19 +1653,21 @@ const useUpdateMarketFees = (marketAddr) => {
|
|
|
1652
1653
|
});
|
|
1653
1654
|
if (decodedEvent.eventName !== "DeployFeeStrategy") throw new Error("Unexpected event");
|
|
1654
1655
|
const newFeeStrategy = decodedEvent.args.feeStrategy;
|
|
1656
|
+
const hash2 = await writeContractAsync({
|
|
1657
|
+
address: marketAddr,
|
|
1658
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
1659
|
+
functionName: "updateAddresses",
|
|
1660
|
+
args: [optionPricing, newFeeStrategy]
|
|
1661
|
+
});
|
|
1662
|
+
queryClient.invalidateQueries({ queryKey: ["readContract"] });
|
|
1655
1663
|
return {
|
|
1656
1664
|
deployHash: hash,
|
|
1657
|
-
updateHash:
|
|
1658
|
-
address: marketAddr,
|
|
1659
|
-
abi: require_statelessStateView.optionsMarketAbi,
|
|
1660
|
-
functionName: "updateAddresses",
|
|
1661
|
-
args: [optionPricing, newFeeStrategy]
|
|
1662
|
-
}),
|
|
1665
|
+
updateHash: hash2,
|
|
1663
1666
|
newFeeStrategy
|
|
1664
1667
|
};
|
|
1665
1668
|
};
|
|
1666
1669
|
return {
|
|
1667
|
-
|
|
1670
|
+
updateMarketFees,
|
|
1668
1671
|
...rest
|
|
1669
1672
|
};
|
|
1670
1673
|
};
|
|
@@ -1703,7 +1706,7 @@ const usePricingParams = (pricingAddr) => {
|
|
|
1703
1706
|
}
|
|
1704
1707
|
], rawData);
|
|
1705
1708
|
return {
|
|
1706
|
-
model: "
|
|
1709
|
+
model: "bsm",
|
|
1707
1710
|
logicContract,
|
|
1708
1711
|
iv,
|
|
1709
1712
|
riskFreeRate,
|
|
@@ -1759,11 +1762,13 @@ const useStaticPricingParams = (pricingAddr) => {
|
|
|
1759
1762
|
//#region src/hooks/pricing/useUpdateMarketPricing.ts
|
|
1760
1763
|
const useUpdateMarketPricing = (marketAddr) => {
|
|
1761
1764
|
const { writeContractAsync, ...rest } = (0, wagmi.useWriteContract)();
|
|
1765
|
+
const queryClient = (0, __tanstack_react_query.useQueryClient)();
|
|
1762
1766
|
const publicClient = (0, wagmi.usePublicClient)();
|
|
1763
1767
|
const chainId = (0, wagmi.useChainId)();
|
|
1764
1768
|
const { data: { feeStrategy, optionPricing } } = useMarketState();
|
|
1765
1769
|
const { data: pricingData } = usePricingParams(optionPricing);
|
|
1766
1770
|
const updateMarketPricing = async (data) => {
|
|
1771
|
+
if (!marketAddr) throw new Error("Market address not found");
|
|
1767
1772
|
if (!pricingData) throw new Error("Market pricing data not available");
|
|
1768
1773
|
if (!publicClient) throw new Error("Public client not available");
|
|
1769
1774
|
if (!feeStrategy) throw new Error("Fee strategy not available");
|
|
@@ -1772,7 +1777,7 @@ const useUpdateMarketPricing = (marketAddr) => {
|
|
|
1772
1777
|
data.dailyFundingRate ?? (data.dailyFundingRate = pricingData.dailyFundingRate);
|
|
1773
1778
|
data.minFundingAmount ?? (data.minFundingAmount = pricingData.minFundingAmount);
|
|
1774
1779
|
}
|
|
1775
|
-
if (data.model === "
|
|
1780
|
+
if (data.model === "bsm" && pricingData.model === "bsm") {
|
|
1776
1781
|
data.logicContract ?? (data.logicContract = pricingData.logicContract);
|
|
1777
1782
|
data.iv ?? (data.iv = pricingData.iv);
|
|
1778
1783
|
data.riskFreeRate ?? (data.riskFreeRate = pricingData.riskFreeRate);
|
|
@@ -1815,14 +1820,16 @@ const useUpdateMarketPricing = (marketAddr) => {
|
|
|
1815
1820
|
});
|
|
1816
1821
|
if (decodedEvent.eventName !== "DeployStaticPerpsPricing" && decodedEvent.eventName !== "DeployOptionPricing") throw new Error("Unexpected event");
|
|
1817
1822
|
const pricingAddr = decodedEvent.args.pricing;
|
|
1823
|
+
const hash2 = await writeContractAsync({
|
|
1824
|
+
address: marketAddr,
|
|
1825
|
+
abi: require_statelessStateView.optionsMarketAbi,
|
|
1826
|
+
functionName: "updateAddresses",
|
|
1827
|
+
args: [pricingAddr, feeStrategy]
|
|
1828
|
+
});
|
|
1829
|
+
queryClient.invalidateQueries({ queryKey: ["readContract"] });
|
|
1818
1830
|
return {
|
|
1819
1831
|
deployHash: hash,
|
|
1820
|
-
updateHash:
|
|
1821
|
-
address: marketAddr,
|
|
1822
|
-
abi: require_statelessStateView.optionsMarketAbi,
|
|
1823
|
-
functionName: "updateAddresses",
|
|
1824
|
-
args: [pricingAddr, feeStrategy]
|
|
1825
|
-
}),
|
|
1832
|
+
updateHash: hash2,
|
|
1826
1833
|
newPricingAddr: pricingAddr
|
|
1827
1834
|
};
|
|
1828
1835
|
};
|