timelock-sdk 0.0.259 → 0.0.260
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 +4 -11
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +804 -802
- package/dist/client.d.ts +3 -1
- package/dist/client.js +4 -11
- package/dist/client.js.map +1 -1
- package/dist/{index-CNYDmu55.d.ts → index-B2XbcYuU.d.ts} +13 -13
- package/dist/{index-BqzCmvHw.d.cts → index-BbFksbQm.d.cts} +202 -202
- package/dist/package.d.cts +1 -1
- package/dist/package.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -1249,25 +1249,16 @@ const useMintPerp = (marketAddr) => {
|
|
|
1249
1249
|
if (permsToUpdate.length > 0) await setOperatorPerms(permsToUpdate);
|
|
1250
1250
|
};
|
|
1251
1251
|
const mintPerp = async (data) => {
|
|
1252
|
-
const { optionType, amount, duration, strikeTick } = data;
|
|
1252
|
+
const { optionType, amount, duration, strikeTick, maxPremium, maxSteps } = data;
|
|
1253
1253
|
if (!client || !address) throw new Error("Wallet not connected");
|
|
1254
1254
|
if (!marketAddr) throw new Error("Market address not found");
|
|
1255
1255
|
if (!tickSpacing) throw new Error("Pool data not found");
|
|
1256
1256
|
if (!operator || !operatorAddresses) throw new Error("Operator address not found");
|
|
1257
1257
|
if (optionAssetIsToken0 === void 0 || !payoutAsset) throw new Error("Market data not found");
|
|
1258
1258
|
if (!operator.auth) await signMessage();
|
|
1259
|
-
const market = require_graphql.getTimelockMarket(marketAddr, client);
|
|
1260
1259
|
const { data: { currentTick } = {} } = await refetchCurrentTick();
|
|
1261
1260
|
if (currentTick === void 0) throw new Error("Could not fetch current tick");
|
|
1262
1261
|
const validStrikeTick = require_graphql.getNearestValidStrikeTick(optionType, optionAssetIsToken0, tickSpacing, currentTick, strikeTick);
|
|
1263
|
-
const [premium, protocolFee] = await market.read.getMintFees([
|
|
1264
|
-
optionType === "CALL" ? 0 : 1,
|
|
1265
|
-
amount,
|
|
1266
|
-
validStrikeTick,
|
|
1267
|
-
duration,
|
|
1268
|
-
"0x"
|
|
1269
|
-
]);
|
|
1270
|
-
const maxPremium = (premium + protocolFee) * 11n / 10n;
|
|
1271
1262
|
await updateOperatorPermsIfNeeded(maxPremium);
|
|
1272
1263
|
await askForApproval(payoutAsset, marketAddr, maxPremium);
|
|
1273
1264
|
await operator.mintPerp({
|
|
@@ -1275,7 +1266,9 @@ const useMintPerp = (marketAddr) => {
|
|
|
1275
1266
|
amount,
|
|
1276
1267
|
optionType,
|
|
1277
1268
|
duration,
|
|
1278
|
-
strikeTick: validStrikeTick
|
|
1269
|
+
strikeTick: validStrikeTick,
|
|
1270
|
+
maxPremium,
|
|
1271
|
+
maxSteps
|
|
1279
1272
|
});
|
|
1280
1273
|
await sleep(200);
|
|
1281
1274
|
refetchOperators();
|