@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.
Files changed (33) hide show
  1. package/dist/agent/catalog.cjs +142 -13
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +282 -43
  4. package/dist/agent/catalog.js +138 -14
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/gmx/SKILL.md +30 -0
  7. package/dist/agent/skills/hyperliquid/SKILL.md +32 -0
  8. package/dist/agent/skills/uniswap-v4/SKILL.md +26 -1
  9. package/dist/core/index.d.ts +4 -36
  10. package/dist/eip712Multisign-xhXpUYp3.d.ts +36 -0
  11. package/dist/index.cjs +344 -12
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +2 -1
  14. package/dist/index.js +344 -12
  15. package/dist/index.js.map +1 -1
  16. package/dist/protocols/evm/gmx/index.cjs +39 -0
  17. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  18. package/dist/protocols/evm/gmx/index.d.ts +21 -1
  19. package/dist/protocols/evm/gmx/index.js +38 -1
  20. package/dist/protocols/evm/gmx/index.js.map +1 -1
  21. package/dist/protocols/evm/hyperliquid/index.cjs +478 -208
  22. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  23. package/dist/protocols/evm/hyperliquid/index.d.ts +166 -51
  24. package/dist/protocols/evm/hyperliquid/index.js +467 -210
  25. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  26. package/dist/protocols/evm/permit2/index.cjs.map +1 -1
  27. package/dist/protocols/evm/permit2/index.js.map +1 -1
  28. package/dist/protocols/evm/uniswap-v4/index.cjs +734 -15
  29. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  30. package/dist/protocols/evm/uniswap-v4/index.d.ts +189 -17
  31. package/dist/protocols/evm/uniswap-v4/index.js +698 -16
  32. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  33. 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