timelock-sdk 0.0.153 → 0.0.155

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
 
4
- const require_optionUtils = require('./optionUtils-D4d_u_d3.cjs');
5
- const require_optionsMarket = require('./optionsMarket-DmR1QeKW.cjs');
4
+ const require_optionUtils = require('./optionUtils-Daz9iARj.cjs');
5
+ const require_optionsMarket = require('./optionsMarket-T7r7iDKa.cjs');
6
6
  const require_singleOwnerVault = require('./singleOwnerVault-GCpQV7pN.cjs');
7
7
  let viem = require("viem");
8
8
  let react = require("react");
@@ -1518,6 +1518,687 @@ const useVaultTVL = (vaultAddr) => {
1518
1518
  ]);
1519
1519
  };
1520
1520
 
1521
+ //#endregion
1522
+ //#region src/hooks/guardian/useGuardianGlobalState.ts
1523
+ const useGuardianGlobalState = (guardianAddr) => {
1524
+ const { timelockLens } = useLens();
1525
+ const { data, ...rest } = (0, wagmi.useReadContract)({
1526
+ address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
1527
+ abi: require_optionsMarket.lensAbi,
1528
+ functionName: "getGlobalGuardianState",
1529
+ args: guardianAddr ? [guardianAddr] : void 0
1530
+ });
1531
+ return {
1532
+ data: data || {},
1533
+ ...rest
1534
+ };
1535
+ };
1536
+
1537
+ //#endregion
1538
+ //#region src/abis/guardian.ts
1539
+ const guardianAbi = [
1540
+ {
1541
+ type: "constructor",
1542
+ inputs: [],
1543
+ stateMutability: "nonpayable"
1544
+ },
1545
+ {
1546
+ type: "function",
1547
+ name: "DEFAULT_ADMIN_ROLE",
1548
+ inputs: [],
1549
+ outputs: [{
1550
+ name: "",
1551
+ type: "bytes32",
1552
+ internalType: "bytes32"
1553
+ }],
1554
+ stateMutability: "view"
1555
+ },
1556
+ {
1557
+ type: "function",
1558
+ name: "MIN_WITHDRAW_INTERVAL",
1559
+ inputs: [],
1560
+ outputs: [{
1561
+ name: "",
1562
+ type: "uint256",
1563
+ internalType: "uint256"
1564
+ }],
1565
+ stateMutability: "view"
1566
+ },
1567
+ {
1568
+ type: "function",
1569
+ name: "PAUSER_ROLE",
1570
+ inputs: [],
1571
+ outputs: [{
1572
+ name: "",
1573
+ type: "bytes32",
1574
+ internalType: "bytes32"
1575
+ }],
1576
+ stateMutability: "view"
1577
+ },
1578
+ {
1579
+ type: "function",
1580
+ name: "allowBurn",
1581
+ inputs: [{
1582
+ name: "vault",
1583
+ type: "address",
1584
+ internalType: "address"
1585
+ }],
1586
+ outputs: [{
1587
+ name: "",
1588
+ type: "bool",
1589
+ internalType: "bool"
1590
+ }],
1591
+ stateMutability: "view"
1592
+ },
1593
+ {
1594
+ type: "function",
1595
+ name: "allowEmergencyMarketWithdraw",
1596
+ inputs: [{
1597
+ name: "market",
1598
+ type: "address",
1599
+ internalType: "address"
1600
+ }],
1601
+ outputs: [{
1602
+ name: "",
1603
+ type: "bool",
1604
+ internalType: "bool"
1605
+ }],
1606
+ stateMutability: "view"
1607
+ },
1608
+ {
1609
+ type: "function",
1610
+ name: "allowEmergencyVaultWithdraw",
1611
+ inputs: [{
1612
+ name: "vault",
1613
+ type: "address",
1614
+ internalType: "address"
1615
+ }],
1616
+ outputs: [{
1617
+ name: "",
1618
+ type: "bool",
1619
+ internalType: "bool"
1620
+ }],
1621
+ stateMutability: "view"
1622
+ },
1623
+ {
1624
+ type: "function",
1625
+ name: "allowMint",
1626
+ inputs: [{
1627
+ name: "vault",
1628
+ type: "address",
1629
+ internalType: "address"
1630
+ }],
1631
+ outputs: [{
1632
+ name: "",
1633
+ type: "bool",
1634
+ internalType: "bool"
1635
+ }],
1636
+ stateMutability: "view"
1637
+ },
1638
+ {
1639
+ type: "function",
1640
+ name: "allowTrade",
1641
+ inputs: [
1642
+ {
1643
+ name: "market",
1644
+ type: "address",
1645
+ internalType: "address"
1646
+ },
1647
+ {
1648
+ name: "owner",
1649
+ type: "address",
1650
+ internalType: "address"
1651
+ },
1652
+ {
1653
+ name: "sender",
1654
+ type: "address",
1655
+ internalType: "address"
1656
+ }
1657
+ ],
1658
+ outputs: [{
1659
+ name: "",
1660
+ type: "bool",
1661
+ internalType: "bool"
1662
+ }],
1663
+ stateMutability: "view"
1664
+ },
1665
+ {
1666
+ type: "function",
1667
+ name: "getRoleAdmin",
1668
+ inputs: [{
1669
+ name: "role",
1670
+ type: "bytes32",
1671
+ internalType: "bytes32"
1672
+ }],
1673
+ outputs: [{
1674
+ name: "",
1675
+ type: "bytes32",
1676
+ internalType: "bytes32"
1677
+ }],
1678
+ stateMutability: "view"
1679
+ },
1680
+ {
1681
+ type: "function",
1682
+ name: "globalBurnPaused",
1683
+ inputs: [],
1684
+ outputs: [{
1685
+ name: "paused",
1686
+ type: "bool",
1687
+ internalType: "bool"
1688
+ }, {
1689
+ name: "updatedAt",
1690
+ type: "uint64",
1691
+ internalType: "uint64"
1692
+ }],
1693
+ stateMutability: "view"
1694
+ },
1695
+ {
1696
+ type: "function",
1697
+ name: "globalMintPaused",
1698
+ inputs: [],
1699
+ outputs: [{
1700
+ name: "paused",
1701
+ type: "bool",
1702
+ internalType: "bool"
1703
+ }, {
1704
+ name: "updatedAt",
1705
+ type: "uint64",
1706
+ internalType: "uint64"
1707
+ }],
1708
+ stateMutability: "view"
1709
+ },
1710
+ {
1711
+ type: "function",
1712
+ name: "globalTradingPaused",
1713
+ inputs: [],
1714
+ outputs: [{
1715
+ name: "paused",
1716
+ type: "bool",
1717
+ internalType: "bool"
1718
+ }, {
1719
+ name: "updatedAt",
1720
+ type: "uint64",
1721
+ internalType: "uint64"
1722
+ }],
1723
+ stateMutability: "view"
1724
+ },
1725
+ {
1726
+ type: "function",
1727
+ name: "grantRole",
1728
+ inputs: [{
1729
+ name: "role",
1730
+ type: "bytes32",
1731
+ internalType: "bytes32"
1732
+ }, {
1733
+ name: "account",
1734
+ type: "address",
1735
+ internalType: "address"
1736
+ }],
1737
+ outputs: [],
1738
+ stateMutability: "nonpayable"
1739
+ },
1740
+ {
1741
+ type: "function",
1742
+ name: "hasRole",
1743
+ inputs: [{
1744
+ name: "role",
1745
+ type: "bytes32",
1746
+ internalType: "bytes32"
1747
+ }, {
1748
+ name: "account",
1749
+ type: "address",
1750
+ internalType: "address"
1751
+ }],
1752
+ outputs: [{
1753
+ name: "",
1754
+ type: "bool",
1755
+ internalType: "bool"
1756
+ }],
1757
+ stateMutability: "view"
1758
+ },
1759
+ {
1760
+ type: "function",
1761
+ name: "marketTradingPaused",
1762
+ inputs: [{
1763
+ name: "",
1764
+ type: "address",
1765
+ internalType: "address"
1766
+ }],
1767
+ outputs: [{
1768
+ name: "paused",
1769
+ type: "bool",
1770
+ internalType: "bool"
1771
+ }, {
1772
+ name: "updatedAt",
1773
+ type: "uint64",
1774
+ internalType: "uint64"
1775
+ }],
1776
+ stateMutability: "view"
1777
+ },
1778
+ {
1779
+ type: "function",
1780
+ name: "operatorsPaused",
1781
+ inputs: [{
1782
+ name: "",
1783
+ type: "address",
1784
+ internalType: "address"
1785
+ }],
1786
+ outputs: [{
1787
+ name: "paused",
1788
+ type: "bool",
1789
+ internalType: "bool"
1790
+ }, {
1791
+ name: "updatedAt",
1792
+ type: "uint64",
1793
+ internalType: "uint64"
1794
+ }],
1795
+ stateMutability: "view"
1796
+ },
1797
+ {
1798
+ type: "function",
1799
+ name: "pauseGlobal",
1800
+ inputs: [
1801
+ {
1802
+ name: "mintPaused",
1803
+ type: "bool",
1804
+ internalType: "bool"
1805
+ },
1806
+ {
1807
+ name: "burnPaused",
1808
+ type: "bool",
1809
+ internalType: "bool"
1810
+ },
1811
+ {
1812
+ name: "TradingPaused",
1813
+ type: "bool",
1814
+ internalType: "bool"
1815
+ }
1816
+ ],
1817
+ outputs: [],
1818
+ stateMutability: "nonpayable"
1819
+ },
1820
+ {
1821
+ type: "function",
1822
+ name: "pauseMarket",
1823
+ inputs: [{
1824
+ name: "market",
1825
+ type: "address",
1826
+ internalType: "address"
1827
+ }, {
1828
+ name: "TradingPaused",
1829
+ type: "bool",
1830
+ internalType: "bool"
1831
+ }],
1832
+ outputs: [],
1833
+ stateMutability: "nonpayable"
1834
+ },
1835
+ {
1836
+ type: "function",
1837
+ name: "pauseOperator",
1838
+ inputs: [{
1839
+ name: "operator",
1840
+ type: "address",
1841
+ internalType: "address"
1842
+ }, {
1843
+ name: "paused",
1844
+ type: "bool",
1845
+ internalType: "bool"
1846
+ }],
1847
+ outputs: [],
1848
+ stateMutability: "nonpayable"
1849
+ },
1850
+ {
1851
+ type: "function",
1852
+ name: "pauseVault",
1853
+ inputs: [
1854
+ {
1855
+ name: "vault",
1856
+ type: "address",
1857
+ internalType: "address"
1858
+ },
1859
+ {
1860
+ name: "mintPaused",
1861
+ type: "bool",
1862
+ internalType: "bool"
1863
+ },
1864
+ {
1865
+ name: "burnPaused",
1866
+ type: "bool",
1867
+ internalType: "bool"
1868
+ }
1869
+ ],
1870
+ outputs: [],
1871
+ stateMutability: "nonpayable"
1872
+ },
1873
+ {
1874
+ type: "function",
1875
+ name: "renounceRole",
1876
+ inputs: [{
1877
+ name: "role",
1878
+ type: "bytes32",
1879
+ internalType: "bytes32"
1880
+ }, {
1881
+ name: "callerConfirmation",
1882
+ type: "address",
1883
+ internalType: "address"
1884
+ }],
1885
+ outputs: [],
1886
+ stateMutability: "nonpayable"
1887
+ },
1888
+ {
1889
+ type: "function",
1890
+ name: "revokeRole",
1891
+ inputs: [{
1892
+ name: "role",
1893
+ type: "bytes32",
1894
+ internalType: "bytes32"
1895
+ }, {
1896
+ name: "account",
1897
+ type: "address",
1898
+ internalType: "address"
1899
+ }],
1900
+ outputs: [],
1901
+ stateMutability: "nonpayable"
1902
+ },
1903
+ {
1904
+ type: "function",
1905
+ name: "supportsInterface",
1906
+ inputs: [{
1907
+ name: "interfaceId",
1908
+ type: "bytes4",
1909
+ internalType: "bytes4"
1910
+ }],
1911
+ outputs: [{
1912
+ name: "",
1913
+ type: "bool",
1914
+ internalType: "bool"
1915
+ }],
1916
+ stateMutability: "view"
1917
+ },
1918
+ {
1919
+ type: "function",
1920
+ name: "vaultBurnPaused",
1921
+ inputs: [{
1922
+ name: "",
1923
+ type: "address",
1924
+ internalType: "address"
1925
+ }],
1926
+ outputs: [{
1927
+ name: "paused",
1928
+ type: "bool",
1929
+ internalType: "bool"
1930
+ }, {
1931
+ name: "updatedAt",
1932
+ type: "uint64",
1933
+ internalType: "uint64"
1934
+ }],
1935
+ stateMutability: "view"
1936
+ },
1937
+ {
1938
+ type: "function",
1939
+ name: "vaultMintPaused",
1940
+ inputs: [{
1941
+ name: "",
1942
+ type: "address",
1943
+ internalType: "address"
1944
+ }],
1945
+ outputs: [{
1946
+ name: "paused",
1947
+ type: "bool",
1948
+ internalType: "bool"
1949
+ }, {
1950
+ name: "updatedAt",
1951
+ type: "uint64",
1952
+ internalType: "uint64"
1953
+ }],
1954
+ stateMutability: "view"
1955
+ },
1956
+ {
1957
+ type: "event",
1958
+ name: "PauseGlobal",
1959
+ inputs: [
1960
+ {
1961
+ name: "mintPaused",
1962
+ type: "bool",
1963
+ indexed: false,
1964
+ internalType: "bool"
1965
+ },
1966
+ {
1967
+ name: "burnPaused",
1968
+ type: "bool",
1969
+ indexed: false,
1970
+ internalType: "bool"
1971
+ },
1972
+ {
1973
+ name: "TradingPaused",
1974
+ type: "bool",
1975
+ indexed: false,
1976
+ internalType: "bool"
1977
+ }
1978
+ ],
1979
+ anonymous: false
1980
+ },
1981
+ {
1982
+ type: "event",
1983
+ name: "PauseMarket",
1984
+ inputs: [{
1985
+ name: "market",
1986
+ type: "address",
1987
+ indexed: true,
1988
+ internalType: "address"
1989
+ }, {
1990
+ name: "paused",
1991
+ type: "bool",
1992
+ indexed: false,
1993
+ internalType: "bool"
1994
+ }],
1995
+ anonymous: false
1996
+ },
1997
+ {
1998
+ type: "event",
1999
+ name: "PauseOperator",
2000
+ inputs: [{
2001
+ name: "operator",
2002
+ type: "address",
2003
+ indexed: true,
2004
+ internalType: "address"
2005
+ }, {
2006
+ name: "paused",
2007
+ type: "bool",
2008
+ indexed: false,
2009
+ internalType: "bool"
2010
+ }],
2011
+ anonymous: false
2012
+ },
2013
+ {
2014
+ type: "event",
2015
+ name: "PauseVault",
2016
+ inputs: [
2017
+ {
2018
+ name: "vault",
2019
+ type: "address",
2020
+ indexed: true,
2021
+ internalType: "address"
2022
+ },
2023
+ {
2024
+ name: "mintPaused",
2025
+ type: "bool",
2026
+ indexed: false,
2027
+ internalType: "bool"
2028
+ },
2029
+ {
2030
+ name: "burnPaused",
2031
+ type: "bool",
2032
+ indexed: false,
2033
+ internalType: "bool"
2034
+ }
2035
+ ],
2036
+ anonymous: false
2037
+ },
2038
+ {
2039
+ type: "event",
2040
+ name: "RoleAdminChanged",
2041
+ inputs: [
2042
+ {
2043
+ name: "role",
2044
+ type: "bytes32",
2045
+ indexed: true,
2046
+ internalType: "bytes32"
2047
+ },
2048
+ {
2049
+ name: "previousAdminRole",
2050
+ type: "bytes32",
2051
+ indexed: true,
2052
+ internalType: "bytes32"
2053
+ },
2054
+ {
2055
+ name: "newAdminRole",
2056
+ type: "bytes32",
2057
+ indexed: true,
2058
+ internalType: "bytes32"
2059
+ }
2060
+ ],
2061
+ anonymous: false
2062
+ },
2063
+ {
2064
+ type: "event",
2065
+ name: "RoleGranted",
2066
+ inputs: [
2067
+ {
2068
+ name: "role",
2069
+ type: "bytes32",
2070
+ indexed: true,
2071
+ internalType: "bytes32"
2072
+ },
2073
+ {
2074
+ name: "account",
2075
+ type: "address",
2076
+ indexed: true,
2077
+ internalType: "address"
2078
+ },
2079
+ {
2080
+ name: "sender",
2081
+ type: "address",
2082
+ indexed: true,
2083
+ internalType: "address"
2084
+ }
2085
+ ],
2086
+ anonymous: false
2087
+ },
2088
+ {
2089
+ type: "event",
2090
+ name: "RoleRevoked",
2091
+ inputs: [
2092
+ {
2093
+ name: "role",
2094
+ type: "bytes32",
2095
+ indexed: true,
2096
+ internalType: "bytes32"
2097
+ },
2098
+ {
2099
+ name: "account",
2100
+ type: "address",
2101
+ indexed: true,
2102
+ internalType: "address"
2103
+ },
2104
+ {
2105
+ name: "sender",
2106
+ type: "address",
2107
+ indexed: true,
2108
+ internalType: "address"
2109
+ }
2110
+ ],
2111
+ anonymous: false
2112
+ },
2113
+ {
2114
+ type: "error",
2115
+ name: "AccessControlBadConfirmation",
2116
+ inputs: []
2117
+ },
2118
+ {
2119
+ type: "error",
2120
+ name: "AccessControlUnauthorizedAccount",
2121
+ inputs: [{
2122
+ name: "account",
2123
+ type: "address",
2124
+ internalType: "address"
2125
+ }, {
2126
+ name: "neededRole",
2127
+ type: "bytes32",
2128
+ internalType: "bytes32"
2129
+ }]
2130
+ }
2131
+ ];
2132
+
2133
+ //#endregion
2134
+ //#region src/hooks/guardian/usePauseGlobalTrading.ts
2135
+ const usePauseGlobalTrading = ({ marketAddr }) => {
2136
+ const { guardian } = useMarketData(marketAddr);
2137
+ const { data: { globalBurnPaused, globalMintPaused }, refetch } = useGuardianGlobalState(guardian);
2138
+ const publicClient = (0, wagmi.usePublicClient)();
2139
+ const { writeContractAsync, ...rest } = (0, wagmi.useWriteContract)();
2140
+ const pauseGlobalTrading = async (paused) => {
2141
+ if (!marketAddr) throw new Error("Market address is required");
2142
+ if (!guardian) throw new Error("Could not load guardian address");
2143
+ if (!globalMintPaused || !globalBurnPaused) throw new Error("Could not load global mint or burn paused state");
2144
+ if (!publicClient) throw new Error("Could not load public client");
2145
+ const hash = await writeContractAsync({
2146
+ address: guardian,
2147
+ abi: guardianAbi,
2148
+ functionName: "pauseGlobal",
2149
+ args: [
2150
+ globalMintPaused.paused,
2151
+ globalBurnPaused.paused,
2152
+ paused
2153
+ ]
2154
+ });
2155
+ await publicClient.waitForTransactionReceipt({ hash });
2156
+ refetch();
2157
+ return hash;
2158
+ };
2159
+ return {
2160
+ pauseGlobalTrading,
2161
+ ...rest
2162
+ };
2163
+ };
2164
+
2165
+ //#endregion
2166
+ //#region src/hooks/guardian/usePauseMarketTrading.ts
2167
+ const usePauseMarketTrading = ({ marketAddr }) => {
2168
+ const { guardian } = useMarketData(marketAddr);
2169
+ const { writeContractAsync, ...rest } = (0, wagmi.useWriteContract)();
2170
+ const pauseMarketTrading = async (paused) => {
2171
+ if (!marketAddr) throw new Error("Market address is required");
2172
+ if (!guardian) throw new Error("Could not load guardian address");
2173
+ return await writeContractAsync({
2174
+ address: guardian,
2175
+ abi: guardianAbi,
2176
+ functionName: "pauseMarket",
2177
+ args: [marketAddr, paused]
2178
+ });
2179
+ };
2180
+ return {
2181
+ pauseMarketTrading,
2182
+ ...rest
2183
+ };
2184
+ };
2185
+
2186
+ //#endregion
2187
+ //#region src/hooks/fees/useFeeRates.ts
2188
+ const useFeeRates = (feeStrategy) => {
2189
+ const { timelockLens } = useLens();
2190
+ const { data, ...rest } = (0, wagmi.useReadContract)({
2191
+ address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
2192
+ abi: require_optionsMarket.lensAbi,
2193
+ args: feeStrategy ? [feeStrategy] : void 0,
2194
+ functionName: "getFeeRates"
2195
+ });
2196
+ return {
2197
+ data: data || {},
2198
+ ...rest
2199
+ };
2200
+ };
2201
+
1521
2202
  //#endregion
1522
2203
  exports.TimelockProvider = TimelockProvider;
1523
2204
  exports.batchGetAmountsFromLiquidity = batchGetAmountsFromLiquidity;
@@ -1533,6 +2214,8 @@ exports.useCurrentPrice = useCurrentPrice;
1533
2214
  exports.useCurrentTick = useCurrentTick;
1534
2215
  exports.useExerciseOption = useExerciseOption;
1535
2216
  exports.useExtendOption = useExtendOption;
2217
+ exports.useFeeRates = useFeeRates;
2218
+ exports.useGuardianGlobalState = useGuardianGlobalState;
1536
2219
  exports.useLens = useLens;
1537
2220
  exports.useLiquidityBlocks = useLiquidityBlocks;
1538
2221
  exports.useMarketData = useMarketData;
@@ -1546,6 +2229,8 @@ exports.useOperatorPerms = useOperatorPerms;
1546
2229
  exports.useOptionPnl = useOptionPnl;
1547
2230
  exports.useOptionPremium = useOptionPremium;
1548
2231
  exports.useOptionTimeline = useOptionTimeline;
2232
+ exports.usePauseGlobalTrading = usePauseGlobalTrading;
2233
+ exports.usePauseMarketTrading = usePauseMarketTrading;
1549
2234
  exports.usePerpsOperator = usePerpsOperator;
1550
2235
  exports.usePoolData = usePoolData;
1551
2236
  exports.usePriceAtSqrtPriceX96 = usePriceAtSqrtPriceX96;