timelock-sdk 0.0.265 → 0.0.267
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 +11 -10
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +228 -228
- package/dist/client.d.ts +1036 -1036
- package/dist/client.js +11 -10
- package/dist/client.js.map +1 -1
- package/dist/{graphql-BKnux7da.js → graphql-B2PXgobn.js} +2 -2
- package/dist/{graphql-BKnux7da.js.map → graphql-B2PXgobn.js.map} +1 -1
- package/dist/{graphql-kf13KPwy.cjs → graphql-BH0AK2SE.cjs} +2 -2
- package/dist/{graphql-kf13KPwy.cjs.map → graphql-BH0AK2SE.cjs.map} +1 -1
- package/dist/{index-DWZeq5uc.d.cts → index-BfwhO_Xn.d.ts} +208 -208
- package/dist/{index-CsAM1JRX.d.ts → index-C3oBmaP8.d.cts} +17 -17
- 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,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
const require_graphql = require('./graphql-
|
|
3
|
+
const require_graphql = require('./graphql-BH0AK2SE.cjs');
|
|
4
4
|
const require_stateView = require('./stateView-BXg8tiiy.cjs');
|
|
5
5
|
const require_factory = require('./factory-AGrigZB6.cjs');
|
|
6
6
|
let viem = require("viem");
|
|
@@ -398,7 +398,7 @@ const useCurrentTick = (poolManager, poolKey) => {
|
|
|
398
398
|
functionName: "getSlot0",
|
|
399
399
|
args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
|
|
400
400
|
query: {
|
|
401
|
-
enabled: !!poolManager && !!poolKey,
|
|
401
|
+
enabled: !!stateView && !!poolManager && !!poolKey,
|
|
402
402
|
refetchInterval: 3e3,
|
|
403
403
|
select: (raw) => {
|
|
404
404
|
const sqrtPriceX96 = raw[0];
|
|
@@ -479,7 +479,7 @@ const usePoolData = (poolManager, poolKey) => {
|
|
|
479
479
|
abi: require_stateView.lensAbi,
|
|
480
480
|
functionName: "getPoolData",
|
|
481
481
|
args: poolManager && poolKey ? [poolManager, poolKey] : void 0,
|
|
482
|
-
query: { enabled: !!poolManager && !!poolKey }
|
|
482
|
+
query: { enabled: !!timelockLens && !!poolManager && !!poolKey }
|
|
483
483
|
});
|
|
484
484
|
const _default = (0, react.useMemo)(() => ({
|
|
485
485
|
token0: poolKey === null || poolKey === void 0 ? void 0 : poolKey.currency0,
|
|
@@ -744,7 +744,7 @@ const useExerciseOption = (marketAddr) => {
|
|
|
744
744
|
const maxSqrtPrice = sqrtPriceX96 * 11n / 10n;
|
|
745
745
|
const deadline = BigInt(Math.floor(Date.now() / 1e3) + 600);
|
|
746
746
|
const refTick = await timelockLens.read.getRefTick([vault, option.startTick]);
|
|
747
|
-
const swapperData
|
|
747
|
+
const swapperData = (0, viem.encodeAbiParameters)([
|
|
748
748
|
{ type: "uint160" },
|
|
749
749
|
{ type: "uint160" },
|
|
750
750
|
{ type: "uint256" }
|
|
@@ -762,7 +762,7 @@ const useExerciseOption = (marketAddr) => {
|
|
|
762
762
|
liquidities,
|
|
763
763
|
0n,
|
|
764
764
|
swapper,
|
|
765
|
-
swapperData
|
|
765
|
+
swapperData,
|
|
766
766
|
refTick
|
|
767
767
|
]
|
|
768
768
|
});
|
|
@@ -783,7 +783,7 @@ const calculateDisplayPnl = (option, poolPrice, optionAssetIsToken0, payoutAsset
|
|
|
783
783
|
const delta = (optionAssetIsToken0 ? require_graphql.token0ToToken1(option.positionSizeCurrent, poolPrice) : require_graphql.token1ToToken0(option.positionSizeCurrent, poolPrice)) - strikeSize;
|
|
784
784
|
return require_graphql.wrapAmount(option.optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
785
785
|
};
|
|
786
|
-
const
|
|
786
|
+
const getSwapperData = () => (0, viem.encodeAbiParameters)([
|
|
787
787
|
{ type: "uint160" },
|
|
788
788
|
{ type: "uint160" },
|
|
789
789
|
{ type: "uint256" }
|
|
@@ -811,7 +811,8 @@ const useOptionPnl = (option) => {
|
|
|
811
811
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
812
812
|
abi: require_stateView.lensAbi,
|
|
813
813
|
functionName: "getRefTick",
|
|
814
|
-
args: vault && (option === null || option === void 0 ? void 0 : option.startTick) ? [vault, option.startTick] : void 0
|
|
814
|
+
args: vault && (option === null || option === void 0 ? void 0 : option.startTick) !== void 0 ? [vault, option.startTick] : void 0,
|
|
815
|
+
query: { enabled: !!timelockLens && !!vault && (option === null || option === void 0 ? void 0 : option.startTick) !== void 0 }
|
|
815
816
|
});
|
|
816
817
|
const swapper = require_graphql.swappers[chainId];
|
|
817
818
|
const { data: unrealizedPayout, ...rest } = (0, wagmi.useSimulateContract)({
|
|
@@ -819,16 +820,16 @@ const useOptionPnl = (option) => {
|
|
|
819
820
|
abi: require_stateView.optionsMarketAbi,
|
|
820
821
|
functionName: "exerciseOption",
|
|
821
822
|
account,
|
|
822
|
-
args: option && refTick ? [
|
|
823
|
+
args: option && refTick !== void 0 ? [
|
|
823
824
|
option.optionId,
|
|
824
825
|
option.liquiditiesCurrent,
|
|
825
826
|
0n,
|
|
826
827
|
swapper,
|
|
827
|
-
|
|
828
|
+
getSwapperData(),
|
|
828
829
|
refTick
|
|
829
830
|
] : void 0,
|
|
830
831
|
query: {
|
|
831
|
-
enabled: !!option && !!
|
|
832
|
+
enabled: !!option && !!swapper && refTick !== void 0 && !!account,
|
|
832
833
|
staleTime: 1e4,
|
|
833
834
|
select: (data) => {
|
|
834
835
|
if (!payoutAssetDecimals) return void 0;
|