@continuumdao/ctm-mpc-defi 0.2.22 → 0.2.24
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/agent/catalog.cjs +142 -13
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +282 -43
- package/dist/agent/catalog.js +138 -14
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/gmx/SKILL.md +30 -0
- package/dist/agent/skills/hyperliquid/SKILL.md +32 -0
- package/dist/agent/skills/uniswap-v4/SKILL.md +26 -1
- package/dist/core/index.d.ts +4 -36
- package/dist/eip712Multisign-xhXpUYp3.d.ts +36 -0
- package/dist/index.cjs +344 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +344 -12
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +39 -0
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.d.ts +21 -1
- package/dist/protocols/evm/gmx/index.js +38 -1
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.cjs +478 -208
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.d.ts +166 -51
- package/dist/protocols/evm/hyperliquid/index.js +467 -210
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/permit2/index.cjs.map +1 -1
- package/dist/protocols/evm/permit2/index.js.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs +734 -15
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.d.ts +189 -17
- package/dist/protocols/evm/uniswap-v4/index.js +698 -16
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1131,6 +1131,34 @@ function gmxIsCloseSizeWithinPosition(args) {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
|
+
// src/protocols/evm/gmx/tpsl.ts
|
|
1135
|
+
function buildGmxTpslEntries(args) {
|
|
1136
|
+
const entries = [];
|
|
1137
|
+
const tpHuman = args.takeProfitPriceUsdHuman?.trim();
|
|
1138
|
+
if (tpHuman) {
|
|
1139
|
+
entries.push({
|
|
1140
|
+
type: "take-profit",
|
|
1141
|
+
triggerPrice: parseGmxUsd30(tpHuman),
|
|
1142
|
+
size: args.positionSizeUsd
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
const slHuman = args.stopLossPriceUsdHuman?.trim() || args.patternFailureUsdHuman?.trim();
|
|
1146
|
+
if (slHuman) {
|
|
1147
|
+
entries.push({
|
|
1148
|
+
type: "stop-loss",
|
|
1149
|
+
triggerPrice: parseGmxUsd30(slHuman),
|
|
1150
|
+
size: args.positionSizeUsd
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
return entries.length > 0 ? entries : void 0;
|
|
1154
|
+
}
|
|
1155
|
+
function resolveGmxStopLossPriceUsdHuman(args) {
|
|
1156
|
+
const sl = args.stopLossPriceUsdHuman?.trim();
|
|
1157
|
+
if (sl) return sl;
|
|
1158
|
+
const pf = args.patternFailureUsdHuman?.trim();
|
|
1159
|
+
return pf || void 0;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1134
1162
|
// src/protocols/evm/gmx/multisign.ts
|
|
1135
1163
|
var GMX_ORDER_GAS_FALLBACK = 2500000n;
|
|
1136
1164
|
var GMX_WETH_DEPOSIT_FALLBACK = 120000n;
|
|
@@ -1292,6 +1320,13 @@ async function buildEvmMultisignBodyGmxIncreaseBatch(args) {
|
|
|
1292
1320
|
}
|
|
1293
1321
|
if (args.slippageBps != null) prepareArgs.slippage = args.slippageBps;
|
|
1294
1322
|
if (args.executionFeeBufferBps != null) prepareArgs.executionFeeBufferBps = args.executionFeeBufferBps;
|
|
1323
|
+
const tpsl = buildGmxTpslEntries({
|
|
1324
|
+
positionSizeUsd: size,
|
|
1325
|
+
takeProfitPriceUsdHuman: args.takeProfitPriceUsdHuman,
|
|
1326
|
+
stopLossPriceUsdHuman: args.stopLossPriceUsdHuman,
|
|
1327
|
+
patternFailureUsdHuman: args.patternFailureUsdHuman
|
|
1328
|
+
});
|
|
1329
|
+
if (tpsl) prepareArgs.tpsl = tpsl;
|
|
1295
1330
|
const prepared = await sdk.prepareOrder(prepareArgs);
|
|
1296
1331
|
if (prepared.payloadType !== "transaction") {
|
|
1297
1332
|
throw new Error("GMX prepareOrder returned typed-data; classic mode required for MPC multi-sign.");
|
|
@@ -1322,6 +1357,8 @@ async function buildEvmMultisignBodyGmxIncreaseBatch(args) {
|
|
|
1322
1357
|
collateralAmountHuman: args.collateralAmountHuman,
|
|
1323
1358
|
isNativeIn: Boolean(args.isNativeIn),
|
|
1324
1359
|
...args.orderType === "limit" && args.triggerPriceUsdHuman?.trim() ? { triggerPriceUsdHuman: args.triggerPriceUsdHuman.trim() } : {},
|
|
1360
|
+
...args.takeProfitPriceUsdHuman?.trim() ? { takeProfitPriceUsdHuman: args.takeProfitPriceUsdHuman.trim() } : {},
|
|
1361
|
+
...resolveGmxStopLossPriceUsdHuman(args) ? { stopLossPriceUsdHuman: resolveGmxStopLossPriceUsdHuman(args) } : {},
|
|
1325
1362
|
...args.patternFailureUsdHuman?.trim() ? { pfE: args.patternFailureUsdHuman.trim() } : {}
|
|
1326
1363
|
},
|
|
1327
1364
|
prepSteps
|
|
@@ -2257,6 +2294,7 @@ exports.buildEvmMultisignBodyGmxLimitDecreaseBatch = buildEvmMultisignBodyGmxLim
|
|
|
2257
2294
|
exports.buildEvmMultisignBodyGmxLimitIncreaseBatch = buildEvmMultisignBodyGmxLimitIncreaseBatch;
|
|
2258
2295
|
exports.buildEvmMultisignBodyGmxStakeGmxBatch = buildEvmMultisignBodyGmxStakeGmxBatch;
|
|
2259
2296
|
exports.buildEvmMultisignBodyGmxUnstakeGmxBatch = buildEvmMultisignBodyGmxUnstakeGmxBatch;
|
|
2297
|
+
exports.buildGmxTpslEntries = buildGmxTpslEntries;
|
|
2260
2298
|
exports.formatGmxLeverageBps = formatGmxLeverageBps;
|
|
2261
2299
|
exports.formatGmxTokenAmountHuman = formatGmxTokenAmountHuman;
|
|
2262
2300
|
exports.formatGmxUsd30 = formatGmxUsd30;
|
|
@@ -2313,5 +2351,6 @@ exports.gmxZeroAddress = gmxZeroAddress;
|
|
|
2313
2351
|
exports.isGmxChainSupported = isGmxChainSupported;
|
|
2314
2352
|
exports.parseGmxTokenAmount = parseGmxTokenAmount;
|
|
2315
2353
|
exports.parseGmxUsd30 = parseGmxUsd30;
|
|
2354
|
+
exports.resolveGmxStopLossPriceUsdHuman = resolveGmxStopLossPriceUsdHuman;
|
|
2316
2355
|
//# sourceMappingURL=index.cjs.map
|
|
2317
2356
|
//# sourceMappingURL=index.cjs.map
|