timelock-sdk 0.0.242 → 0.0.243
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 +16 -11
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +561 -378
- package/dist/client.d.ts +912 -729
- package/dist/client.js +16 -11
- package/dist/client.js.map +1 -1
- package/dist/{index-5nk6fHx2.d.cts → index-CqF6L32S.d.cts} +564 -564
- package/dist/{index-C4hRFzOj.d.ts → index-D7VVO1vb.d.ts} +662 -662
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -1303,6 +1303,7 @@ const calculateDisplayPnl = (option, poolPrice, optionAssetIsToken0, payoutAsset
|
|
|
1303
1303
|
return require_numberUtils.wrapAmount(option.optionType === "CALL" ? delta : -delta, payoutAssetDecimals);
|
|
1304
1304
|
};
|
|
1305
1305
|
const useOptionPnl = (option) => {
|
|
1306
|
+
var _refTickSimulation$da, _refTickSimulation$da2;
|
|
1306
1307
|
const chainId = (0, wagmi.useChainId)();
|
|
1307
1308
|
const { timelockLens } = useLens();
|
|
1308
1309
|
const { vault, poolManager, poolKey, optionAssetIsToken0, payoutAssetDecimals } = useMarketData(option === null || option === void 0 ? void 0 : option.marketAddr);
|
|
@@ -1328,36 +1329,40 @@ const useOptionPnl = (option) => {
|
|
|
1328
1329
|
BigInt(Math.floor(Date.now() / 1e3) + 600)
|
|
1329
1330
|
]);
|
|
1330
1331
|
}, [sqrtPriceX96]);
|
|
1331
|
-
const
|
|
1332
|
+
const refTickSimulation = (0, wagmi.useSimulateContract)({
|
|
1332
1333
|
address: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.address,
|
|
1333
1334
|
abi: timelockLens === null || timelockLens === void 0 ? void 0 : timelockLens.abi,
|
|
1334
1335
|
functionName: "getRefTick",
|
|
1335
1336
|
args: vault && (option === null || option === void 0 ? void 0 : option.startTick) ? [vault, option.startTick] : void 0,
|
|
1336
1337
|
query: { enabled: !!vault && !!(option === null || option === void 0 ? void 0 : option.startTick) && !!timelockLens }
|
|
1337
1338
|
});
|
|
1338
|
-
const
|
|
1339
|
+
const result = (0, wagmi.useSimulateContract)({
|
|
1339
1340
|
address: option === null || option === void 0 ? void 0 : option.marketAddr,
|
|
1340
1341
|
abi: require_stateView.optionsMarketAbi,
|
|
1341
1342
|
functionName: "exerciseOption",
|
|
1342
|
-
args: option && swapperData && (
|
|
1343
|
+
args: option && swapperData && ((_refTickSimulation$da = refTickSimulation.data) === null || _refTickSimulation$da === void 0 ? void 0 : _refTickSimulation$da.result) ? [
|
|
1343
1344
|
option.optionId,
|
|
1344
1345
|
option.liquiditiesCurrent,
|
|
1345
1346
|
0n,
|
|
1346
1347
|
require_numberUtils.swappers[chainId],
|
|
1347
1348
|
swapperData,
|
|
1348
|
-
|
|
1349
|
+
refTickSimulation.data.result
|
|
1349
1350
|
] : void 0,
|
|
1350
1351
|
query: {
|
|
1351
|
-
enabled: !!option && !!swapperData && !!(
|
|
1352
|
-
staleTime: 1e4
|
|
1352
|
+
enabled: !!option && !!swapperData && !!((_refTickSimulation$da2 = refTickSimulation.data) === null || _refTickSimulation$da2 === void 0 ? void 0 : _refTickSimulation$da2.result) && !!option.marketAddr,
|
|
1353
|
+
staleTime: 1e4,
|
|
1354
|
+
select: (data) => {
|
|
1355
|
+
if (!payoutAssetDecimals) return void 0;
|
|
1356
|
+
return require_numberUtils.wrapAmount(data.result, payoutAssetDecimals);
|
|
1357
|
+
}
|
|
1353
1358
|
}
|
|
1354
1359
|
});
|
|
1355
1360
|
return {
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
+
...result,
|
|
1362
|
+
data: {
|
|
1363
|
+
displayPnl,
|
|
1364
|
+
unrealizedPayout: result.data
|
|
1365
|
+
}
|
|
1361
1366
|
};
|
|
1362
1367
|
};
|
|
1363
1368
|
|