@continuumdao/ctm-mpc-defi 0.2.20 → 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 (96) hide show
  1. package/dist/agent/catalog.cjs +256 -46
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +606 -154
  4. package/dist/agent/catalog.js +250 -47
  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 +83 -0
  9. package/dist/chains/evm/index.cjs +5 -1
  10. package/dist/chains/evm/index.cjs.map +1 -1
  11. package/dist/chains/evm/index.d.ts +4 -4
  12. package/dist/chains/evm/index.js +5 -1
  13. package/dist/chains/evm/index.js.map +1 -1
  14. package/dist/chains/near/index.d.ts +1 -1
  15. package/dist/chains/solana/index.d.ts +1 -1
  16. package/dist/core/index.cjs +25 -0
  17. package/dist/core/index.cjs.map +1 -1
  18. package/dist/core/index.d.ts +11 -36
  19. package/dist/core/index.js +23 -1
  20. package/dist/core/index.js.map +1 -1
  21. package/dist/eip712Multisign-xhXpUYp3.d.ts +36 -0
  22. package/dist/{envelope-CpBUh9eP.d.ts → envelope-C_bfuKab.d.ts} +3 -1
  23. package/dist/index.cjs +371 -13
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.ts +6 -5
  26. package/dist/index.js +369 -14
  27. package/dist/index.js.map +1 -1
  28. package/dist/protocols/evm/aave-v4/index.cjs +5 -1
  29. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  30. package/dist/protocols/evm/aave-v4/index.d.ts +1 -1
  31. package/dist/protocols/evm/aave-v4/index.js +5 -1
  32. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  33. package/dist/protocols/evm/circle-cctp/index.cjs +5 -1
  34. package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
  35. package/dist/protocols/evm/circle-cctp/index.d.ts +2 -2
  36. package/dist/protocols/evm/circle-cctp/index.js +5 -1
  37. package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
  38. package/dist/protocols/evm/curve-dao/index.cjs +5 -1
  39. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  40. package/dist/protocols/evm/curve-dao/index.d.ts +2 -2
  41. package/dist/protocols/evm/curve-dao/index.js +5 -1
  42. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  43. package/dist/protocols/evm/ethena/index.cjs +5 -1
  44. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  45. package/dist/protocols/evm/ethena/index.d.ts +1 -1
  46. package/dist/protocols/evm/ethena/index.js +5 -1
  47. package/dist/protocols/evm/ethena/index.js.map +1 -1
  48. package/dist/protocols/evm/euler-v2/index.cjs +5 -1
  49. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  50. package/dist/protocols/evm/euler-v2/index.d.ts +1 -1
  51. package/dist/protocols/evm/euler-v2/index.js +5 -1
  52. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  53. package/dist/protocols/evm/gmx/index.cjs +44 -1
  54. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  55. package/dist/protocols/evm/gmx/index.d.ts +23 -3
  56. package/dist/protocols/evm/gmx/index.js +43 -2
  57. package/dist/protocols/evm/gmx/index.js.map +1 -1
  58. package/dist/protocols/evm/hyperliquid/index.cjs +483 -208
  59. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  60. package/dist/protocols/evm/hyperliquid/index.d.ts +168 -53
  61. package/dist/protocols/evm/hyperliquid/index.js +472 -210
  62. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  63. package/dist/protocols/evm/lido/index.cjs +5 -1
  64. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  65. package/dist/protocols/evm/lido/index.d.ts +1 -1
  66. package/dist/protocols/evm/lido/index.js +5 -1
  67. package/dist/protocols/evm/lido/index.js.map +1 -1
  68. package/dist/protocols/evm/maple/index.cjs +5 -1
  69. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  70. package/dist/protocols/evm/maple/index.d.ts +1 -1
  71. package/dist/protocols/evm/maple/index.js +5 -1
  72. package/dist/protocols/evm/maple/index.js.map +1 -1
  73. package/dist/protocols/evm/morpho/index.cjs +5 -1
  74. package/dist/protocols/evm/morpho/index.cjs.map +1 -1
  75. package/dist/protocols/evm/morpho/index.d.ts +1 -1
  76. package/dist/protocols/evm/morpho/index.js +5 -1
  77. package/dist/protocols/evm/morpho/index.js.map +1 -1
  78. package/dist/protocols/evm/permit2/index.cjs +4 -0
  79. package/dist/protocols/evm/permit2/index.cjs.map +1 -1
  80. package/dist/protocols/evm/permit2/index.d.ts +1 -1
  81. package/dist/protocols/evm/permit2/index.js +4 -0
  82. package/dist/protocols/evm/permit2/index.js.map +1 -1
  83. package/dist/protocols/evm/sky/index.cjs +5 -1
  84. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  85. package/dist/protocols/evm/sky/index.d.ts +1 -1
  86. package/dist/protocols/evm/sky/index.js +5 -1
  87. package/dist/protocols/evm/sky/index.js.map +1 -1
  88. package/dist/protocols/evm/uniswap-v4/index.cjs +1415 -13
  89. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  90. package/dist/protocols/evm/uniswap-v4/index.d.ts +353 -4
  91. package/dist/protocols/evm/uniswap-v4/index.js +1357 -15
  92. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  93. package/dist/{registry-Bv5o37_w.d.ts → registry-DxDSPQ-p.d.ts} +1 -1
  94. package/dist/{types-BfjWdw1j.d.ts → types-PZrvtjv8.d.ts} +2 -0
  95. package/dist/{types-DUeNJLr9.d.ts → types-RZWOTm8c.d.ts} +1 -1
  96. package/package.json +2 -2
@@ -79,7 +79,9 @@ var UNIVERSAL_ROUTER_SPENDER = {
79
79
  143: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
80
80
  59144: "0x661e93cca42afacb172121ef892830ca3b70f08d",
81
81
  4217: "0x1febb76be10aaf3a1402f04e8e835f2c382f7914",
82
- 196: "0x5507749f2c558bb3e162c6e90c314c092e7372ff"
82
+ 196: "0x5507749f2c558bb3e162c6e90c314c092e7372ff",
83
+ /** Robinhood Chain mainnet — Universal Router v2.1.1 (Trade API / interface) */
84
+ 4663: "0x8876789976decbfcbbbe364623c63652db8c0904"
83
85
  };
84
86
  function isUniswapV4ChainSupported(chainId) {
85
87
  if (chainId == null) return false;
@@ -89,6 +91,41 @@ function isUniswapV4ChainSupported(chainId) {
89
91
  return typeof a === "string" && a.startsWith("0x");
90
92
  }
91
93
 
94
+ // src/core/defiProxy.ts
95
+ var aaveGraphqlProxyUrl;
96
+ var morphoGraphqlProxyUrl;
97
+ function getAaveGraphqlProxyUrl() {
98
+ return aaveGraphqlProxyUrl;
99
+ }
100
+ function getMorphoGraphqlProxyUrl() {
101
+ return morphoGraphqlProxyUrl;
102
+ }
103
+ async function postJsonViaOptionalProxy(args) {
104
+ const proxy = args.proxyUrl?.trim();
105
+ if (proxy) {
106
+ const r2 = await fetch(proxy, {
107
+ method: "POST",
108
+ headers: { "content-type": "application/json" },
109
+ body: JSON.stringify(args.proxyEnvelope ?? args.body)
110
+ });
111
+ if (!r2.ok) {
112
+ const t = await r2.text().catch(() => "");
113
+ throw new Error(t ? `Proxy HTTP ${r2.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r2.status}`);
114
+ }
115
+ return await r2.json();
116
+ }
117
+ const r = await fetch(args.directUrl, {
118
+ method: "POST",
119
+ headers: { "content-type": "application/json" },
120
+ body: JSON.stringify(args.body)
121
+ });
122
+ if (!r.ok) {
123
+ const t = await r.text().catch(() => "");
124
+ throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`);
125
+ }
126
+ return await r.json();
127
+ }
128
+
92
129
  // src/protocols/evm/uniswap-v4/index.ts
93
130
  var UNISWAP_V4_PROTOCOL_ID = "uniswap-v4";
94
131
  var uniswapV4ProtocolModule = {
@@ -135,6 +172,17 @@ var uniswapV4ProtocolModule = {
135
172
  type: { type: "EXACT_INPUT | EXACT_OUTPUT", required: true, description: "Trade type" }
136
173
  }
137
174
  },
175
+ {
176
+ id: "uniswap-v4.limit-order",
177
+ protocolId: UNISWAP_V4_PROTOCOL_ID,
178
+ chainCategory: "evm",
179
+ description: "Place UniswapX limit order via EIP-712 sign + POST /order (Ethereum mainnet only)",
180
+ commonParams: ["keyGen", "purposeText"],
181
+ params: {
182
+ fullLimitQuote: { type: "object", required: true, description: "Full limit order quote from Trade API" },
183
+ uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API key" }
184
+ }
185
+ },
138
186
  {
139
187
  id: "uniswap-v4.mint-liquidity",
140
188
  protocolId: UNISWAP_V4_PROTOCOL_ID,
@@ -604,7 +652,10 @@ var evmMultisignCommonInputSchema = zod.z.object({
604
652
  rpcUrl: zod.z.string().min(1).optional().describe("Server-filled from chain registry when keyGenId is set. Agents must not pass rpcUrl."),
605
653
  executorAddress: evmAddressSchema.optional().describe("Server-filled MPC wallet from keyGenId. Agents must not pass executorAddress."),
606
654
  chainDetail: chainDetailSchema.optional().describe("Server-filled gas row from chain registry when keyGenId is set."),
607
- customGasChainDetails: zod.z.record(zod.z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.")
655
+ customGasChainDetails: zod.z.record(zod.z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true."),
656
+ expiryDate: zod.z.number().int().positive().optional().describe(
657
+ "Optional Unix seconds (UTC) when the MPC sign request expires. Uniswap V4, GMX, Hyperliquid, and Curve DAO default to 30 minutes when omitted; other protocols use the node default (7 days)."
658
+ )
608
659
  });
609
660
  function withMultisignKeySourceRefine(schema) {
610
661
  return schema.refine(
@@ -720,10 +771,15 @@ function preprocessHyperliquidLimitOrderInput(raw) {
720
771
  if (!preprocessObject(o)) return raw;
721
772
  aliasField(o, "limitPxHuman", "limitPxHuman", "limitPx", "markPx");
722
773
  aliasField(o, "szHuman", "szHuman", "sz", "size");
774
+ aliasField(o, "takeProfitTriggerPxHuman", "takeProfitTriggerPxHuman", "takeProfitPxHuman", "tpTriggerPxHuman", "targetPxHuman");
775
+ aliasField(o, "stopLossTriggerPxHuman", "stopLossTriggerPxHuman", "stopLossPxHuman", "slTriggerPxHuman", "invalidationPxHuman");
723
776
  derivePurposeIfMissing(o, (x) => {
724
777
  const coin = String(x.coin ?? "").trim();
725
778
  const side = x.isBuy === true || x.isBuy === "true" ? "buy" : "sell";
726
779
  const sz = String(x.szHuman ?? "").trim();
780
+ const tp = String(x.takeProfitTriggerPxHuman ?? "").trim();
781
+ const sl = String(x.stopLossTriggerPxHuman ?? "").trim();
782
+ if (coin && sz && (tp || sl)) return `HL bracket ${side} ${coin} ${sz}`;
727
783
  if (coin && sz) return `HL limit ${side} ${coin} ${sz}`;
728
784
  return void 0;
729
785
  });
@@ -821,6 +877,13 @@ function preprocessUniswapBuildSwapInput(raw) {
821
877
  derivePurposeIfMissing(o, () => "Uniswap V4 swap");
822
878
  return o;
823
879
  }
880
+ function preprocessUniswapBuildLimitOrderInput(raw) {
881
+ const o = preprocessObject(raw);
882
+ if (!o) return raw;
883
+ aliasField(o, "fullLimitQuote", "fullLimitQuote", "fullLimitQuoteFromPermit", "limitQuote", "quote");
884
+ derivePurposeIfMissing(o, () => "Uniswap V4 limit order");
885
+ return o;
886
+ }
824
887
  function preprocessUniswapBuildLpInput(raw) {
825
888
  const o = preprocessUniswapLpNftInput(raw);
826
889
  if (!preprocessObject(o)) return raw;
@@ -955,6 +1018,45 @@ var mcpUniswapV4BuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
955
1018
  })
956
1019
  )
957
1020
  );
1021
+ var mcpUniswapV4LimitOrderQuoteInputSchema = zod.z.object({
1022
+ type: uniswapQuoteTradeTypeSchema.describe("EXACT_INPUT or EXACT_OUTPUT"),
1023
+ amount: zod.z.string().min(1).describe("Amount in token-in base units (wei string for ERC-20)"),
1024
+ limitPrice: zod.z.string().min(1).describe("Limit price string from Trade API (pair exchange rate)"),
1025
+ tokenIn: zod.z.string().min(1).describe("Input token; 0x0 for native ETH"),
1026
+ tokenOut: zod.z.string().min(1).describe("Output token address"),
1027
+ chainId: agentEvmChainIdSchema.describe("Must be 1 (Ethereum mainnet) for limit orders"),
1028
+ orderDeadline: agentCoercedIntSchema(zod.z.number().int().positive()).describe("Unix seconds when unfilled order expires"),
1029
+ uniswapApiKey: zod.z.string().min(1).describe("Uniswap Trade API x-api-key"),
1030
+ swapper: evmAddressSchema.optional().describe("MPC executor; omit if keyGen + managementNodeUrl provided"),
1031
+ keyGen: zod.z.string().optional(),
1032
+ managementNodeUrl: zod.z.string().min(1).optional(),
1033
+ tokenInChainId: zod.z.union([zod.z.number(), zod.z.string()]).optional(),
1034
+ tokenOutChainId: zod.z.union([zod.z.number(), zod.z.string()]).optional(),
1035
+ baseUrl: zod.z.string().optional()
1036
+ });
1037
+ var mcpUniswapV4LimitOrderQuoteOutputSchema = jsonObjectSchema.describe(
1038
+ "Full Uniswap POST /limit_order_quote JSON (includes quote, permitData, routing)."
1039
+ );
1040
+ var mcpUniswapV4BuildLimitOrderMultisignInputSchema = withMultisignKeySourceRefine(
1041
+ zod.z.preprocess(
1042
+ preprocessUniswapBuildLimitOrderInput,
1043
+ evmMultisignCommonInputSchema.extend({
1044
+ fullLimitQuote: jsonObjectSchema.describe("Full limit order quote JSON from ctm_uniswap_v4_limit_order_quote"),
1045
+ uniswapApiKey: zod.z.string().min(1).describe("Uniswap Trade API key"),
1046
+ tradeApiBaseUrl: zod.z.string().optional()
1047
+ })
1048
+ )
1049
+ );
1050
+ var mcpUniswapV4FetchLimitOrdersInputSchema = zod.z.object({
1051
+ chainId: agentEvmChainIdSchema.optional().describe("Default 1 (mainnet)"),
1052
+ swapper: evmAddressSchema.optional(),
1053
+ keyGen: zod.z.string().optional(),
1054
+ managementNodeUrl: zod.z.string().min(1).optional(),
1055
+ uniswapApiKey: zod.z.string().min(1).optional(),
1056
+ limit: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(100)).optional(),
1057
+ baseUrl: zod.z.string().optional()
1058
+ });
1059
+ var mcpUniswapV4FetchLimitOrdersOutputSchema = jsonObjectSchema;
958
1060
  var lpExistingPoolSchema = zod.z.object({
959
1061
  token0Address: evmAddressSchema,
960
1062
  token1Address: evmAddressSchema,
@@ -1137,6 +1239,68 @@ var mcpUniswapV4BuildCollectFeesMultisignInputSchema = withMultisignKeySourceRef
1137
1239
  })
1138
1240
  )
1139
1241
  );
1242
+ var uniswapV4OhlcvIntervalSchema = zod.z.enum([
1243
+ "1m",
1244
+ "5m",
1245
+ "15m",
1246
+ "30m",
1247
+ "1h",
1248
+ "2h",
1249
+ "4h",
1250
+ "6h",
1251
+ "8h",
1252
+ "12h",
1253
+ "1d",
1254
+ "2d",
1255
+ "3d",
1256
+ "1w",
1257
+ "1M"
1258
+ ]);
1259
+ var uniswapV4OhlcvCandleSchema = zod.z.object({
1260
+ timestampMs: zod.z.number(),
1261
+ open: zod.z.string(),
1262
+ high: zod.z.string(),
1263
+ low: zod.z.string(),
1264
+ close: zod.z.string(),
1265
+ volume: zod.z.string().optional()
1266
+ });
1267
+ var uniswapV4ExistingPoolOhlcvSchema = zod.z.object({
1268
+ token0Address: evmAddressSchema,
1269
+ token1Address: evmAddressSchema,
1270
+ poolReference: zod.z.string().min(1).optional(),
1271
+ fee: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative()).optional(),
1272
+ tickSpacing: agentCoercedOptionalIntSchema(zod.z.number().int().positive()).optional(),
1273
+ hooks: evmAddressSchema.optional()
1274
+ });
1275
+ var mcpUniswapV4FetchOhlcvInputSchema = zod.z.object({
1276
+ chainId: agentEvmChainIdSchema,
1277
+ interval: uniswapV4OhlcvIntervalSchema.optional().describe("Default 1h. Sub-hour uses swaps; \u22651h uses subgraph."),
1278
+ poolPreset: zod.z.string().optional().describe("presetId from ctm_uniswap_v4_list_lp_pools"),
1279
+ poolReference: zod.z.string().optional().describe("bytes32 pool id"),
1280
+ existingPool: uniswapV4ExistingPoolOhlcvSchema.optional(),
1281
+ currencyAddress: zod.z.string().optional().describe("Robinhood/Bitquery: token contract to chart (preferred over symbol)"),
1282
+ currencySymbol: zod.z.string().optional().describe("Robinhood/Bitquery: Stock Token symbol e.g. NVDA, AAPL"),
1283
+ quoteToken: zod.z.enum(["token0", "token1"]).optional().describe("Default token0 per token1 (subgraph native)"),
1284
+ lookbackDays: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(365)),
1285
+ lookbackHours: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(365 * 24)),
1286
+ startTimeMs: agentCoercedOptionalIntSchema(zod.z.number().int().positive()),
1287
+ endTimeMs: agentCoercedOptionalIntSchema(zod.z.number().int().positive())
1288
+ }).strict();
1289
+ var mcpUniswapV4FetchOhlcvOutputSchema = zod.z.object({
1290
+ symbol: zod.z.string(),
1291
+ timeframe: uniswapV4OhlcvIntervalSchema,
1292
+ chainId: agentEvmChainIdSchema,
1293
+ poolReference: zod.z.string(),
1294
+ dataSource: zod.z.enum(["subgraph_native", "subgraph_aggregate", "swaps", "bitquery"]),
1295
+ baseSubgraphEntity: zod.z.enum(["hourly", "daily"]).optional(),
1296
+ priceQuote: zod.z.enum(["token0PerToken1", "token1PerToken0"]),
1297
+ startTimeMs: zod.z.number().int().positive().optional(),
1298
+ endTimeMs: zod.z.number().int().positive().optional(),
1299
+ candleCount: zod.z.number().int().nonnegative(),
1300
+ candles: zod.z.array(uniswapV4OhlcvCandleSchema),
1301
+ fetchedAtMs: zod.z.number(),
1302
+ warnings: zod.z.array(zod.z.string()).optional()
1303
+ }).strict();
1140
1304
  var mcpCurveDaoQuoteInputSchema = zod.z.object({
1141
1305
  chainId: agentEvmChainIdSchema.describe("EVM chain id (rpcUrl resolved from get_chain_registry rpcGateway)"),
1142
1306
  rpcUrl: zod.z.string().min(1).optional().describe("JSON-RPC URL; continuum-mcp-server injects from chain registry \u2014 do not pass a public RPC URL"),
@@ -1276,7 +1440,9 @@ var mcpServerSubmitOutputSchema = zod.z.object({
1276
1440
  );
1277
1441
  var MCP_NON_SUBMIT_TOOL_NAMES = /* @__PURE__ */ new Set([
1278
1442
  "ctm_uniswap_v4_quote",
1279
- "ctm_uniswap_v4_create_swap"
1443
+ "ctm_uniswap_v4_create_swap",
1444
+ "ctm_uniswap_v4_limit_order_quote",
1445
+ "ctm_uniswap_v4_fetch_limit_orders"
1280
1446
  ]);
1281
1447
 
1282
1448
  // src/agent/schemas/protocols.ts
@@ -1610,7 +1776,9 @@ var mcpGmxIncreaseInputSchema = mcpGmxMultisignInput(
1610
1776
  collateralToken: zod.z.string().min(1),
1611
1777
  collateralAmountHuman: zod.z.string().min(1),
1612
1778
  triggerPriceUsdHuman: zod.z.string().optional(),
1613
- patternFailureUsdHuman: zod.z.string().optional(),
1779
+ takeProfitPriceUsdHuman: zod.z.string().optional().describe("Take-profit trigger (USD) \u2014 GMX native TP order on increase; defaults to full position size"),
1780
+ stopLossPriceUsdHuman: zod.z.string().optional().describe("Stop-loss trigger (USD) \u2014 GMX native SL order on increase; defaults to full position size"),
1781
+ patternFailureUsdHuman: zod.z.string().optional().describe("Audit alias for stop-loss when stopLossPriceUsdHuman is omitted (trade-idea invalidation)"),
1614
1782
  slippageBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative()),
1615
1783
  executionFeeBufferBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative())
1616
1784
  },
@@ -1982,6 +2150,7 @@ var mcpHyperliquidFetchDelegationsOutputSchema = zod.z.object({
1982
2150
  })
1983
2151
  )
1984
2152
  });
2153
+ var hyperliquidTpslExecModeSchema = zod.z.enum(["limit_at_trigger", "market"]);
1985
2154
  var mcpHyperliquidLimitOrderInputSchema = mcpHyperliquidMultisignInput(
1986
2155
  {
1987
2156
  coin: zod.z.string().min(1).describe("coin from fetch_markets (name) or search_markets"),
@@ -1990,7 +2159,10 @@ var mcpHyperliquidLimitOrderInputSchema = mcpHyperliquidMultisignInput(
1990
2159
  szHuman: zod.z.string().min(1),
1991
2160
  marketKind: zod.z.enum(["perp", "spot"]).optional(),
1992
2161
  tif: hyperliquidTifSchema.optional(),
1993
- dex: zod.z.string().optional()
2162
+ dex: zod.z.string().optional(),
2163
+ takeProfitTriggerPxHuman: zod.z.string().min(1).optional().describe("Take-profit trigger price \u2014 with SL enables L1 normalTpsl bracket (EIP-712, not CoreWriter)."),
2164
+ stopLossTriggerPxHuman: zod.z.string().min(1).optional().describe("Stop-loss trigger price \u2014 with TP enables L1 normalTpsl bracket (EIP-712, not CoreWriter)."),
2165
+ tpslExecMode: hyperliquidTpslExecModeSchema.optional().describe("Trigger execution: limit_at_trigger (default) or market.")
1994
2166
  },
1995
2167
  preprocessHyperliquidLimitOrderInput
1996
2168
  );
@@ -2518,7 +2690,7 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
2518
2690
  actionId: "gmx.increase",
2519
2691
  protocolId: "gmx",
2520
2692
  chainCategory: "evm",
2521
- description: "Create and submit mpc-auth multiSignRequest for GMX classic increase order (open/add perp). Keeper executes asynchronously after on-chain broadcast.",
2693
+ description: "Create and submit mpc-auth multiSignRequest for GMX classic increase order (open/add perp). Optional takeProfitPriceUsdHuman / stopLossPriceUsdHuman attach native TP/SL decrease orders (full size). Keeper executes asynchronously after on-chain broadcast.",
2522
2694
  prerequisites: ["keyGen", "executorAddress", "GMX market symbol", "classic mode only \u2014 no subaccounts"],
2523
2695
  handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxIncreaseBatch" },
2524
2696
  inputZod: mcpGmxIncreaseInputSchema
@@ -2588,7 +2760,7 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
2588
2760
  actionId: "hyperliquid.limitOrder",
2589
2761
  protocolId: "hyperliquid",
2590
2762
  chainCategory: "evm",
2591
- description: "Create and submit mpc-auth multiSignRequest for a Hyperliquid limit/IoC order via HyperEVM CoreWriter.",
2763
+ description: "Create and submit mpc-auth multiSignRequest for a Hyperliquid limit/IoC order. Plain limit uses CoreWriter; when takeProfitTriggerPxHuman and/or stopLossTriggerPxHuman are set, submits one L1 EIP-712 normalTpsl bracket (entry + TP/SL) to /exchange.",
2592
2764
  prerequisites: ["keyGen", "executorAddress", "chainId 999 or 998", "coin", "limitPxHuman", "szHuman"],
2593
2765
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidLimitOrderBatch" },
2594
2766
  inputZod: mcpHyperliquidLimitOrderInputSchema
@@ -2823,6 +2995,52 @@ var CORE_MCP_TOOL_DEFINITIONS = [
2823
2995
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "buildEvmMultisignBodyUniswapV4SkipPermit2Batch" },
2824
2996
  inputZod: mcpUniswapV4BuildSwapMultisignInputSchema
2825
2997
  }),
2998
+ defineMcpTool({
2999
+ name: "ctm_uniswap_v4_limit_order_quote",
3000
+ actionId: "uniswap-v4.limit-order-quote",
3001
+ protocolId: "uniswap-v4",
3002
+ chainCategory: "evm",
3003
+ description: "Fetch a UniswapX limit order quote (POST /v1/limit_order_quote). Ethereum mainnet (chainId 1) only. Returns quote + permitData for EIP-712 signing. Does NOT create a sign request \u2014 call ctm_uniswap_v4_build_limit_order_multisign next.",
3004
+ prerequisites: [
3005
+ "UNISWAP_API_KEY in node Variables",
3006
+ "chainId must be 1",
3007
+ "keyGenId or swapper",
3008
+ "limitPrice, orderDeadline, amount, tokenIn, tokenOut"
3009
+ ],
3010
+ followUp: ["ctm_uniswap_v4_build_limit_order_multisign", "ctm_uniswap_v4_fetch_limit_orders"],
3011
+ handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapLimitOrderQuote" },
3012
+ inputZod: mcpUniswapV4LimitOrderQuoteInputSchema,
3013
+ outputZod: mcpUniswapV4LimitOrderQuoteOutputSchema
3014
+ }),
3015
+ defineMultisignSubmitMcpTool({
3016
+ name: "ctm_uniswap_v4_build_limit_order_multisign",
3017
+ actionId: "uniswap-v4.limit-order",
3018
+ protocolId: "uniswap-v4",
3019
+ chainCategory: "evm",
3020
+ description: "Create and submit mpc-auth multiSignRequest for a UniswapX limit order (EIP-712 Permit2 witness). After sign + execute, delivery POSTs to Trade API /v1/order. Mainnet only.",
3021
+ prerequisites: [
3022
+ "ctm_uniswap_v4_limit_order_quote output (fullLimitQuote)",
3023
+ "keyGenId + chainId 1 + purposeText"
3024
+ ],
3025
+ followUp: ["ctm_uniswap_v4_fetch_limit_orders"],
3026
+ handler: {
3027
+ importPath: "protocols/evm/uniswap-v4",
3028
+ exportName: "buildEvmMultisignBodyUniswapV4LimitOrderBatchFromMcp"
3029
+ },
3030
+ inputZod: mcpUniswapV4BuildLimitOrderMultisignInputSchema
3031
+ }),
3032
+ defineMcpTool({
3033
+ name: "ctm_uniswap_v4_fetch_limit_orders",
3034
+ actionId: "uniswap-v4.fetch-limit-orders",
3035
+ protocolId: "uniswap-v4",
3036
+ chainCategory: "evm",
3037
+ description: "List open UniswapX limit orders for a swapper (GET /v2/limit-orders). Ethereum mainnet only. Optional UNISWAP_API_KEY.",
3038
+ prerequisites: ["swapper or keyGenId", "chainId 1"],
3039
+ followUp: [],
3040
+ handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapFetchLimitOrdersMcp" },
3041
+ inputZod: mcpUniswapV4FetchLimitOrdersInputSchema,
3042
+ outputZod: mcpUniswapV4FetchLimitOrdersOutputSchema
3043
+ }),
2826
3044
  defineMcpTool({
2827
3045
  name: "ctm_uniswap_v4_list_lp_pools",
2828
3046
  actionId: "uniswap-v4.lp-list-pools",
@@ -2830,11 +3048,27 @@ var CORE_MCP_TOOL_DEFINITIONS = [
2830
3048
  chainCategory: "evm",
2831
3049
  description: "List standard Uniswap V4 LP pools for a chain (ETH/USDC and other main pairs at common fee tiers). Returns presetId, token addresses, fee, tickSpacing, and computed poolReference (bytes32 pool id). Use presetId as poolPreset on lp_create_position.",
2832
3050
  prerequisites: ["chainId"],
2833
- followUp: ["ctm_uniswap_v4_lp_create_position"],
3051
+ followUp: ["ctm_uniswap_v4_lp_create_position", "ctm_uniswap_v4_fetch_ohlcv"],
2834
3052
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapV4ListStandardLpPools" },
2835
3053
  inputZod: mcpUniswapV4LpListPoolsInputSchema,
2836
3054
  outputZod: mcpUniswapV4LpListPoolsOutputSchema
2837
3055
  }),
3056
+ defineMcpTool({
3057
+ name: "ctm_uniswap_v4_fetch_ohlcv",
3058
+ actionId: "uniswap-v4.fetch-ohlcv",
3059
+ protocolId: "uniswap-v4",
3060
+ chainCategory: "evm",
3061
+ description: "Pool OHLCV: The Graph subgraph on pinned chains (1h/1d native, aggregated multiples, swap bucketing for sub-hour). Robinhood Chain (4663) uses Bitquery Uniswap v4 / Stock Token candles \u2014 set BITQUERY_API_KEY. Optional THE_GRAPH_API_KEY for subgraph gateway rate limits.",
3062
+ prerequisites: [
3063
+ "chainId with OHLCV support (subgraph or Robinhood/Bitquery)",
3064
+ "poolPreset or poolReference or existingPool (subgraph); currencyAddress or currencySymbol or existingPool (Robinhood)",
3065
+ "interval + lookbackDays or lookbackHours or startTimeMs"
3066
+ ],
3067
+ followUp: ["ctm_uniswap_v4_list_lp_pools", "continuum__prepare_chart_from_rows"],
3068
+ handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapV4FetchOhlcv" },
3069
+ inputZod: mcpUniswapV4FetchOhlcvInputSchema,
3070
+ outputZod: mcpUniswapV4FetchOhlcvOutputSchema
3071
+ }),
2838
3072
  defineMcpTool({
2839
3073
  name: "ctm_uniswap_v4_lp_create_position",
2840
3074
  actionId: "uniswap-v4.lp-create",
@@ -3575,41 +3809,6 @@ function isMapleSyrupSupportedChain(chainId) {
3575
3809
  return chainId === 1 || chainId === 11155111;
3576
3810
  }
3577
3811
 
3578
- // src/core/defiProxy.ts
3579
- var aaveGraphqlProxyUrl;
3580
- var morphoGraphqlProxyUrl;
3581
- function getAaveGraphqlProxyUrl() {
3582
- return aaveGraphqlProxyUrl;
3583
- }
3584
- function getMorphoGraphqlProxyUrl() {
3585
- return morphoGraphqlProxyUrl;
3586
- }
3587
- async function postJsonViaOptionalProxy(args) {
3588
- const proxy = args.proxyUrl?.trim();
3589
- if (proxy) {
3590
- const r2 = await fetch(proxy, {
3591
- method: "POST",
3592
- headers: { "content-type": "application/json" },
3593
- body: JSON.stringify(args.proxyEnvelope ?? args.body)
3594
- });
3595
- if (!r2.ok) {
3596
- const t = await r2.text().catch(() => "");
3597
- throw new Error(t ? `Proxy HTTP ${r2.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r2.status}`);
3598
- }
3599
- return await r2.json();
3600
- }
3601
- const r = await fetch(args.directUrl, {
3602
- method: "POST",
3603
- headers: { "content-type": "application/json" },
3604
- body: JSON.stringify(args.body)
3605
- });
3606
- if (!r.ok) {
3607
- const t = await r.text().catch(() => "");
3608
- throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`);
3609
- }
3610
- return await r.json();
3611
- }
3612
-
3613
3812
  // src/protocols/evm/maple/index.ts
3614
3813
  var MAPLE_PROTOCOL_ID = "maple-syrup";
3615
3814
  var mapleProtocolModule = {
@@ -4023,7 +4222,7 @@ var hyperliquidProtocolModule = {
4023
4222
  id: "hyperliquid.limitOrder",
4024
4223
  protocolId: HYPERLIQUID_PROTOCOL_ID,
4025
4224
  chainCategory: "evm",
4026
- description: "Place a Hyperliquid limit/IoC order via HyperEVM CoreWriter",
4225
+ description: "Place a Hyperliquid limit/IoC order via CoreWriter, or L1 normalTpsl bracket when TP/SL triggers are set",
4027
4226
  commonParams: ["keyGen", "purposeText", "useCustomGas"],
4028
4227
  params: {
4029
4228
  coin: { type: "string", required: true, description: "Market coin e.g. BTC" },
@@ -4032,7 +4231,10 @@ var hyperliquidProtocolModule = {
4032
4231
  szHuman: { type: "string", required: true, description: "Order size in coin units" },
4033
4232
  marketKind: { type: "string", required: false, description: "perp (default) or spot" },
4034
4233
  tif: { type: "string", required: false, description: "gtc, ioc, or alo" },
4035
- dex: { type: "string", required: false, description: "HIP-3 dex name when applicable" }
4234
+ dex: { type: "string", required: false, description: "HIP-3 dex name when applicable" },
4235
+ takeProfitTriggerPxHuman: { type: "string", required: false, description: "TP trigger \u2014 enables L1 bracket with SL" },
4236
+ stopLossTriggerPxHuman: { type: "string", required: false, description: "SL trigger \u2014 enables L1 bracket with TP" },
4237
+ tpslExecMode: { type: "string", required: false, description: "limit_at_trigger (default) or market" }
4036
4238
  }
4037
4239
  },
4038
4240
  {
@@ -4667,7 +4869,8 @@ var PROTOCOL_SUPPORT_ADVISORS = {
4667
4869
  143,
4668
4870
  59144,
4669
4871
  4217,
4670
- 196
4872
+ 196,
4873
+ 4663
4671
4874
  ]) {
4672
4875
  if (isUniswapV4ChainSupported(id)) ids.push(id);
4673
4876
  }
@@ -5038,10 +5241,17 @@ exports.mcpSkySusdsRedeemInputSchema = mcpSkySusdsRedeemInputSchema;
5038
5241
  exports.mcpUniswapV4BuildCollectFeesMultisignInputSchema = mcpUniswapV4BuildCollectFeesMultisignInputSchema;
5039
5242
  exports.mcpUniswapV4BuildDecreaseLiquidityMultisignInputSchema = mcpUniswapV4BuildDecreaseLiquidityMultisignInputSchema;
5040
5243
  exports.mcpUniswapV4BuildIncreaseLiquidityMultisignInputSchema = mcpUniswapV4BuildIncreaseLiquidityMultisignInputSchema;
5244
+ exports.mcpUniswapV4BuildLimitOrderMultisignInputSchema = mcpUniswapV4BuildLimitOrderMultisignInputSchema;
5041
5245
  exports.mcpUniswapV4BuildMintLiquidityMultisignInputSchema = mcpUniswapV4BuildMintLiquidityMultisignInputSchema;
5042
5246
  exports.mcpUniswapV4BuildSwapMultisignInputSchema = mcpUniswapV4BuildSwapMultisignInputSchema;
5043
5247
  exports.mcpUniswapV4CreateSwapInputSchema = mcpUniswapV4CreateSwapInputSchema;
5044
5248
  exports.mcpUniswapV4CreateSwapOutputSchema = mcpUniswapV4CreateSwapOutputSchema;
5249
+ exports.mcpUniswapV4FetchLimitOrdersInputSchema = mcpUniswapV4FetchLimitOrdersInputSchema;
5250
+ exports.mcpUniswapV4FetchLimitOrdersOutputSchema = mcpUniswapV4FetchLimitOrdersOutputSchema;
5251
+ exports.mcpUniswapV4FetchOhlcvInputSchema = mcpUniswapV4FetchOhlcvInputSchema;
5252
+ exports.mcpUniswapV4FetchOhlcvOutputSchema = mcpUniswapV4FetchOhlcvOutputSchema;
5253
+ exports.mcpUniswapV4LimitOrderQuoteInputSchema = mcpUniswapV4LimitOrderQuoteInputSchema;
5254
+ exports.mcpUniswapV4LimitOrderQuoteOutputSchema = mcpUniswapV4LimitOrderQuoteOutputSchema;
5045
5255
  exports.mcpUniswapV4LpClaimInputSchema = mcpUniswapV4LpClaimInputSchema;
5046
5256
  exports.mcpUniswapV4LpClaimOutputSchema = mcpUniswapV4LpClaimOutputSchema;
5047
5257
  exports.mcpUniswapV4LpCreatePositionInputSchema = mcpUniswapV4LpCreatePositionInputSchema;