@continuumdao/ctm-mpc-defi 0.2.19 → 0.2.22

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 (94) hide show
  1. package/dist/agent/catalog.cjs +303 -93
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +985 -709
  4. package/dist/agent/catalog.js +299 -94
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/hyperliquid/SKILL.md +24 -20
  7. package/dist/agent/skills/uniswap-v4/SKILL.md +58 -0
  8. package/dist/chains/evm/index.cjs +6 -2
  9. package/dist/chains/evm/index.cjs.map +1 -1
  10. package/dist/chains/evm/index.d.ts +4 -4
  11. package/dist/chains/evm/index.js +6 -2
  12. package/dist/chains/evm/index.js.map +1 -1
  13. package/dist/chains/near/index.d.ts +1 -1
  14. package/dist/chains/solana/index.d.ts +1 -1
  15. package/dist/core/index.cjs +95 -1
  16. package/dist/core/index.cjs.map +1 -1
  17. package/dist/core/index.d.ts +44 -4
  18. package/dist/core/index.js +91 -2
  19. package/dist/core/index.js.map +1 -1
  20. package/dist/{envelope-CpBUh9eP.d.ts → envelope-C_bfuKab.d.ts} +3 -1
  21. package/dist/index.cjs +96 -2
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +5 -5
  24. package/dist/index.js +93 -4
  25. package/dist/index.js.map +1 -1
  26. package/dist/protocols/evm/aave-v4/index.cjs +6 -2
  27. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  28. package/dist/protocols/evm/aave-v4/index.d.ts +1 -1
  29. package/dist/protocols/evm/aave-v4/index.js +6 -2
  30. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  31. package/dist/protocols/evm/circle-cctp/index.cjs +6 -2
  32. package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
  33. package/dist/protocols/evm/circle-cctp/index.d.ts +2 -2
  34. package/dist/protocols/evm/circle-cctp/index.js +6 -2
  35. package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
  36. package/dist/protocols/evm/curve-dao/index.cjs +6 -2
  37. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  38. package/dist/protocols/evm/curve-dao/index.d.ts +2 -2
  39. package/dist/protocols/evm/curve-dao/index.js +6 -2
  40. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  41. package/dist/protocols/evm/ethena/index.cjs +6 -2
  42. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  43. package/dist/protocols/evm/ethena/index.d.ts +1 -1
  44. package/dist/protocols/evm/ethena/index.js +6 -2
  45. package/dist/protocols/evm/ethena/index.js.map +1 -1
  46. package/dist/protocols/evm/euler-v2/index.cjs +6 -2
  47. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  48. package/dist/protocols/evm/euler-v2/index.d.ts +1 -1
  49. package/dist/protocols/evm/euler-v2/index.js +6 -2
  50. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  51. package/dist/protocols/evm/gmx/index.cjs +54 -22
  52. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  53. package/dist/protocols/evm/gmx/index.d.ts +22 -8
  54. package/dist/protocols/evm/gmx/index.js +53 -23
  55. package/dist/protocols/evm/gmx/index.js.map +1 -1
  56. package/dist/protocols/evm/hyperliquid/index.cjs +467 -2
  57. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  58. package/dist/protocols/evm/hyperliquid/index.d.ts +189 -3
  59. package/dist/protocols/evm/hyperliquid/index.js +447 -4
  60. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  61. package/dist/protocols/evm/lido/index.cjs +6 -2
  62. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  63. package/dist/protocols/evm/lido/index.d.ts +1 -1
  64. package/dist/protocols/evm/lido/index.js +6 -2
  65. package/dist/protocols/evm/lido/index.js.map +1 -1
  66. package/dist/protocols/evm/maple/index.cjs +6 -2
  67. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  68. package/dist/protocols/evm/maple/index.d.ts +1 -1
  69. package/dist/protocols/evm/maple/index.js +6 -2
  70. package/dist/protocols/evm/maple/index.js.map +1 -1
  71. package/dist/protocols/evm/morpho/index.cjs +6 -2
  72. package/dist/protocols/evm/morpho/index.cjs.map +1 -1
  73. package/dist/protocols/evm/morpho/index.d.ts +1 -1
  74. package/dist/protocols/evm/morpho/index.js +6 -2
  75. package/dist/protocols/evm/morpho/index.js.map +1 -1
  76. package/dist/protocols/evm/permit2/index.cjs +206 -0
  77. package/dist/protocols/evm/permit2/index.cjs.map +1 -0
  78. package/dist/protocols/evm/permit2/index.d.ts +43 -0
  79. package/dist/protocols/evm/permit2/index.js +203 -0
  80. package/dist/protocols/evm/permit2/index.js.map +1 -0
  81. package/dist/protocols/evm/sky/index.cjs +6 -2
  82. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  83. package/dist/protocols/evm/sky/index.d.ts +1 -1
  84. package/dist/protocols/evm/sky/index.js +6 -2
  85. package/dist/protocols/evm/sky/index.js.map +1 -1
  86. package/dist/protocols/evm/uniswap-v4/index.cjs +685 -2
  87. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  88. package/dist/protocols/evm/uniswap-v4/index.d.ts +180 -3
  89. package/dist/protocols/evm/uniswap-v4/index.js +663 -3
  90. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  91. package/dist/{registry-Bv5o37_w.d.ts → registry-DxDSPQ-p.d.ts} +1 -1
  92. package/dist/{types-BfjWdw1j.d.ts → types-PZrvtjv8.d.ts} +2 -0
  93. package/dist/{types-DUeNJLr9.d.ts → types-RZWOTm8c.d.ts} +1 -1
  94. package/package.json +8 -2
@@ -86,6 +86,41 @@ function isUniswapV4ChainSupported(chainId) {
86
86
  return typeof a === "string" && a.startsWith("0x");
87
87
  }
88
88
 
89
+ // src/core/defiProxy.ts
90
+ var aaveGraphqlProxyUrl;
91
+ var morphoGraphqlProxyUrl;
92
+ function getAaveGraphqlProxyUrl() {
93
+ return aaveGraphqlProxyUrl;
94
+ }
95
+ function getMorphoGraphqlProxyUrl() {
96
+ return morphoGraphqlProxyUrl;
97
+ }
98
+ async function postJsonViaOptionalProxy(args) {
99
+ const proxy = args.proxyUrl?.trim();
100
+ if (proxy) {
101
+ const r2 = await fetch(proxy, {
102
+ method: "POST",
103
+ headers: { "content-type": "application/json" },
104
+ body: JSON.stringify(args.proxyEnvelope ?? args.body)
105
+ });
106
+ if (!r2.ok) {
107
+ const t = await r2.text().catch(() => "");
108
+ throw new Error(t ? `Proxy HTTP ${r2.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r2.status}`);
109
+ }
110
+ return await r2.json();
111
+ }
112
+ const r = await fetch(args.directUrl, {
113
+ method: "POST",
114
+ headers: { "content-type": "application/json" },
115
+ body: JSON.stringify(args.body)
116
+ });
117
+ if (!r.ok) {
118
+ const t = await r.text().catch(() => "");
119
+ throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`);
120
+ }
121
+ return await r.json();
122
+ }
123
+
89
124
  // src/protocols/evm/uniswap-v4/index.ts
90
125
  var UNISWAP_V4_PROTOCOL_ID = "uniswap-v4";
91
126
  var uniswapV4ProtocolModule = {
@@ -556,6 +591,15 @@ var agentEvmChainIdSchema = z.preprocess(
556
591
  (val) => parseAgentEvmChainId(val),
557
592
  z.number().int().positive().describe("EVM chain id (decimal, e.g. 8453 for Base \u2014 not 0x8453).")
558
593
  );
594
+ var agentCoercedIntSchema = (schema) => z.coerce.number().pipe(schema);
595
+ var agentCoercedOptionalIntSchema = (schema) => z.preprocess(
596
+ (val) => val === void 0 || val === null || val === "" ? void 0 : val,
597
+ z.coerce.number().pipe(schema).optional()
598
+ );
599
+ var agentCoercedOptionalNumberSchema = (schema) => z.preprocess(
600
+ (val) => val === void 0 || val === null || val === "" ? void 0 : val,
601
+ z.coerce.number().pipe(schema).optional()
602
+ );
559
603
 
560
604
  // src/agent/schemas/common.ts
561
605
  var evmAddressSchema = z.string().min(1).describe("EVM address (0x-prefixed, 40 hex nibbles)");
@@ -568,12 +612,12 @@ var keyGenSchema = z.object({
568
612
  );
569
613
  var chainDetailSchema = z.object({
570
614
  legacy: z.boolean().optional(),
571
- gasLimit: z.number().optional(),
572
- gasMultiplier: z.number().optional(),
573
- gasPrice: z.number().optional(),
574
- baseFee: z.number().optional(),
575
- priorityFee: z.number().optional(),
576
- baseFeeMultiplier: z.number().optional()
615
+ gasLimit: agentCoercedOptionalNumberSchema(z.number()),
616
+ gasMultiplier: agentCoercedOptionalNumberSchema(z.number()),
617
+ gasPrice: agentCoercedOptionalNumberSchema(z.number()),
618
+ baseFee: agentCoercedOptionalNumberSchema(z.number()),
619
+ priorityFee: agentCoercedOptionalNumberSchema(z.number()),
620
+ baseFeeMultiplier: agentCoercedOptionalNumberSchema(z.number())
577
621
  }).passthrough().describe(
578
622
  "Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
579
623
  );
@@ -592,7 +636,10 @@ var evmMultisignCommonInputSchema = z.object({
592
636
  rpcUrl: z.string().min(1).optional().describe("Server-filled from chain registry when keyGenId is set. Agents must not pass rpcUrl."),
593
637
  executorAddress: evmAddressSchema.optional().describe("Server-filled MPC wallet from keyGenId. Agents must not pass executorAddress."),
594
638
  chainDetail: chainDetailSchema.optional().describe("Server-filled gas row from chain registry when keyGenId is set."),
595
- customGasChainDetails: z.record(z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.")
639
+ customGasChainDetails: z.record(z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true."),
640
+ expiryDate: z.number().int().positive().optional().describe(
641
+ "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)."
642
+ )
596
643
  });
597
644
  function withMultisignKeySourceRefine(schema) {
598
645
  return schema.refine(
@@ -913,7 +960,9 @@ var mcpUniswapV4QuoteOutputSchema = jsonObjectSchema.describe(
913
960
  var mcpUniswapV4CreateSwapInputSchema = z.object({
914
961
  uniswapApiKey: z.string().min(1).describe("Uniswap Trade API key"),
915
962
  fullQuoteFromPermit: jsonObjectSchema.describe("Full quote JSON from ctm_uniswap_v4_quote"),
916
- swapTransactionDeadlineUnix: z.number().int().positive().optional().describe("On-chain deadline unix seconds; default ~30 min from now"),
963
+ swapTransactionDeadlineUnix: agentCoercedOptionalIntSchema(
964
+ z.number().int().positive()
965
+ ).describe("On-chain deadline unix seconds; default ~30 min from now"),
917
966
  useServerProxy: z.boolean().optional().describe("Set false in Node/agents; true only in browser via Next API route"),
918
967
  baseUrl: z.string().optional(),
919
968
  universalRouterVersion: z.string().optional()
@@ -936,8 +985,8 @@ var mcpUniswapV4BuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
936
985
  gasFee: z.string().optional()
937
986
  }).passthrough().describe("Full create_swap response"),
938
987
  fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
939
- swapDeadlineUnix: z.number().describe("Same deadline passed to create_swap"),
940
- slippagePercent: z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
988
+ swapDeadlineUnix: agentCoercedIntSchema(z.number()).describe("Same deadline passed to create_swap"),
989
+ slippagePercent: agentCoercedOptionalNumberSchema(z.number()).describe("Extra approve headroom for EXACT_OUTPUT")
941
990
  })
942
991
  )
943
992
  );
@@ -949,8 +998,8 @@ var lpExistingPoolSchema = z.object({
949
998
  var lpNewPoolSchema = z.object({
950
999
  token0Address: evmAddressSchema,
951
1000
  token1Address: evmAddressSchema,
952
- fee: z.number().int().nonnegative(),
953
- tickSpacing: z.number().int().positive(),
1001
+ fee: agentCoercedIntSchema(z.number().int().nonnegative()),
1002
+ tickSpacing: agentCoercedIntSchema(z.number().int().positive()),
954
1003
  hooks: evmAddressSchema.optional(),
955
1004
  initialPrice: z.string().min(1).describe("sqrtRatioX96 string for new pool")
956
1005
  });
@@ -963,14 +1012,14 @@ var lpPriceBoundsSchema = z.object({
963
1012
  maxPrice: z.string().min(1)
964
1013
  });
965
1014
  var lpTickBoundsSchema = z.object({
966
- tickLower: z.number().int(),
967
- tickUpper: z.number().int()
1015
+ tickLower: agentCoercedIntSchema(z.number().int()),
1016
+ tickUpper: agentCoercedIntSchema(z.number().int())
968
1017
  });
969
1018
  var lpCommonApiInputSchema = z.object({
970
1019
  uniswapApiKey: z.string().min(1),
971
1020
  walletAddress: evmAddressSchema.optional(),
972
1021
  chainId: agentEvmChainIdSchema,
973
- slippageTolerance: z.number().optional(),
1022
+ slippageTolerance: agentCoercedOptionalNumberSchema(z.number()),
974
1023
  simulateTransaction: agentOptionalBooleanSchema(),
975
1024
  baseUrl: z.string().optional(),
976
1025
  keyGen: z.string().optional(),
@@ -1031,7 +1080,7 @@ var mcpUniswapV4LpDecreaseInputSchema = z.preprocess(
1031
1080
  token0Address: evmAddressSchema,
1032
1081
  token1Address: evmAddressSchema,
1033
1082
  nftTokenId: z.union([z.string(), z.number()]).describe("tokenId from lp_list_positions"),
1034
- liquidityPercentageToDecrease: z.number().int().min(1).max(100)
1083
+ liquidityPercentageToDecrease: agentCoercedIntSchema(z.number().int().min(1).max(100))
1035
1084
  })
1036
1085
  );
1037
1086
  var mcpUniswapV4LpDecreaseOutputSchema = jsonObjectSchema;
@@ -1123,6 +1172,66 @@ var mcpUniswapV4BuildCollectFeesMultisignInputSchema = withMultisignKeySourceRef
1123
1172
  })
1124
1173
  )
1125
1174
  );
1175
+ var uniswapV4OhlcvIntervalSchema = z.enum([
1176
+ "1m",
1177
+ "5m",
1178
+ "15m",
1179
+ "30m",
1180
+ "1h",
1181
+ "2h",
1182
+ "4h",
1183
+ "6h",
1184
+ "8h",
1185
+ "12h",
1186
+ "1d",
1187
+ "2d",
1188
+ "3d",
1189
+ "1w",
1190
+ "1M"
1191
+ ]);
1192
+ var uniswapV4OhlcvCandleSchema = z.object({
1193
+ timestampMs: z.number(),
1194
+ open: z.string(),
1195
+ high: z.string(),
1196
+ low: z.string(),
1197
+ close: z.string(),
1198
+ volume: z.string().optional()
1199
+ });
1200
+ var uniswapV4ExistingPoolOhlcvSchema = z.object({
1201
+ token0Address: evmAddressSchema,
1202
+ token1Address: evmAddressSchema,
1203
+ poolReference: z.string().min(1).optional(),
1204
+ fee: agentCoercedOptionalIntSchema(z.number().int().nonnegative()).optional(),
1205
+ tickSpacing: agentCoercedOptionalIntSchema(z.number().int().positive()).optional(),
1206
+ hooks: evmAddressSchema.optional()
1207
+ });
1208
+ var mcpUniswapV4FetchOhlcvInputSchema = z.object({
1209
+ chainId: agentEvmChainIdSchema,
1210
+ interval: uniswapV4OhlcvIntervalSchema.optional().describe("Default 1h. Sub-hour uses swaps; \u22651h uses subgraph."),
1211
+ poolPreset: z.string().optional().describe("presetId from ctm_uniswap_v4_list_lp_pools"),
1212
+ poolReference: z.string().optional().describe("bytes32 pool id"),
1213
+ existingPool: uniswapV4ExistingPoolOhlcvSchema.optional(),
1214
+ quoteToken: z.enum(["token0", "token1"]).optional().describe("Default token0 per token1 (subgraph native)"),
1215
+ lookbackDays: agentCoercedOptionalIntSchema(z.number().int().positive().max(365)),
1216
+ lookbackHours: agentCoercedOptionalIntSchema(z.number().int().positive().max(365 * 24)),
1217
+ startTimeMs: agentCoercedOptionalIntSchema(z.number().int().positive()),
1218
+ endTimeMs: agentCoercedOptionalIntSchema(z.number().int().positive())
1219
+ }).strict();
1220
+ var mcpUniswapV4FetchOhlcvOutputSchema = z.object({
1221
+ symbol: z.string(),
1222
+ timeframe: uniswapV4OhlcvIntervalSchema,
1223
+ chainId: agentEvmChainIdSchema,
1224
+ poolReference: z.string(),
1225
+ dataSource: z.enum(["subgraph_native", "subgraph_aggregate", "swaps"]),
1226
+ baseSubgraphEntity: z.enum(["hourly", "daily"]).optional(),
1227
+ priceQuote: z.enum(["token0PerToken1", "token1PerToken0"]),
1228
+ startTimeMs: z.number().int().positive().optional(),
1229
+ endTimeMs: z.number().int().positive().optional(),
1230
+ candleCount: z.number().int().nonnegative(),
1231
+ candles: z.array(uniswapV4OhlcvCandleSchema),
1232
+ fetchedAtMs: z.number(),
1233
+ warnings: z.array(z.string()).optional()
1234
+ }).strict();
1126
1235
  var mcpCurveDaoQuoteInputSchema = z.object({
1127
1236
  chainId: agentEvmChainIdSchema.describe("EVM chain id (rpcUrl resolved from get_chain_registry rpcGateway)"),
1128
1237
  rpcUrl: z.string().min(1).optional().describe("JSON-RPC URL; continuum-mcp-server injects from chain registry \u2014 do not pass a public RPC URL"),
@@ -1194,7 +1303,7 @@ var mcpMorphoFetchEarnVaultsInputSchema = z.object({
1194
1303
  chainId: agentEvmChainIdSchema,
1195
1304
  underlying: z.string().trim().min(1).optional().describe("Deposit asset symbol (e.g. USDC) or ERC-20 address. Omit to search all listed vaults on the chain."),
1196
1305
  query: z.string().trim().min(1).optional().describe("Case-insensitive filter on vault name, symbol, address, or underlying symbol (e.g. Steakhouse, bbqUSDC)."),
1197
- limit: z.number().int().min(1).max(200).optional().describe("Max rows (default 50).")
1306
+ limit: agentCoercedOptionalIntSchema(z.number().int().min(1).max(200)).describe("Max rows (default 50).")
1198
1307
  });
1199
1308
  var mcpMorphoFetchEarnVaultsOutputSchema = z.object({
1200
1309
  vaults: z.array(
@@ -1222,7 +1331,7 @@ var mcpMorphoFetchBlueMarketsInputSchema = z.object({
1222
1331
  collateral: z.string().trim().min(1).optional().describe("Collateral asset symbol or address (e.g. WETH, cbETH)."),
1223
1332
  loan: z.string().trim().min(1).optional().describe("Loan asset symbol or address (e.g. USDC)."),
1224
1333
  query: z.string().trim().min(1).optional().describe("Filter on market label, symbols, or marketId."),
1225
- limit: z.number().int().min(1).max(200).optional()
1334
+ limit: agentCoercedOptionalIntSchema(z.number().int().min(1).max(200))
1226
1335
  });
1227
1336
  var mcpMorphoFetchBlueMarketsOutputSchema = z.object({
1228
1337
  markets: z.array(
@@ -1319,17 +1428,17 @@ var mcpSkyLockstakeStakeInputSchema = mcpMultisignInput({
1319
1428
  });
1320
1429
  var mcpSkyLockstakeDrawInputSchema = mcpMultisignInput({
1321
1430
  usdsAmountHuman: z.string().min(1),
1322
- urnIndex: z.number().int().nonnegative()
1431
+ urnIndex: agentCoercedIntSchema(z.number().int().nonnegative())
1323
1432
  });
1324
1433
  var mcpSkyLockstakeWipeInputSchema = mcpMultisignInput({
1325
1434
  usdsAmountHuman: z.string().min(1),
1326
- urnIndex: z.number().int().nonnegative()
1435
+ urnIndex: agentCoercedIntSchema(z.number().int().nonnegative())
1327
1436
  });
1328
1437
  var mcpSkyLockstakeCloseInputSchema = mcpMultisignInput({
1329
- urnIndex: z.number().int().nonnegative()
1438
+ urnIndex: agentCoercedIntSchema(z.number().int().nonnegative())
1330
1439
  });
1331
1440
  var mcpSkyLockstakeGetRewardInputSchema = mcpMultisignInput({
1332
- urnIndex: z.number().int().nonnegative()
1441
+ urnIndex: agentCoercedIntSchema(z.number().int().nonnegative())
1333
1442
  });
1334
1443
  var mcpSkySusdsDepositInputSchema = mcpMultisignInput({
1335
1444
  usdsAmountHuman: z.string().min(1)
@@ -1501,7 +1610,7 @@ var mcpMorphoBlueRepayInputSchema = withMultisignKeySourceRefine(
1501
1610
  var mcpMorphoBlueCollateralWithdrawInputSchema = mcpMultisignInput({
1502
1611
  marketId: z.string().min(1),
1503
1612
  amountHuman: z.string().min(1),
1504
- collateralDecimals: z.number().int().min(0).max(36).optional()
1613
+ collateralDecimals: agentCoercedOptionalIntSchema(z.number().int().min(0).max(36))
1505
1614
  });
1506
1615
  var mcpMorphoMerklClaimInputSchema = mcpMultisignInput({
1507
1616
  claimData: z.string().min(1).describe("Hex calldata for Merkl Distributor.claim from Merkl API."),
@@ -1513,7 +1622,7 @@ var mcpEulerV2FetchLendVaultsInputSchema = z.object({
1513
1622
  underlyingAddress: evmAddressSchema.describe(
1514
1623
  "Underlying asset address from get_defi_protocol_supported_tokens."
1515
1624
  ),
1516
- limit: z.number().int().min(1).max(100).optional().describe("Max vault rows (default 30).")
1625
+ limit: agentCoercedOptionalIntSchema(z.number().int().min(1).max(100)).describe("Max vault rows (default 30).")
1517
1626
  });
1518
1627
  var mcpEulerV2FetchLendVaultsOutputSchema = z.object({
1519
1628
  vaults: z.array(
@@ -1596,8 +1705,9 @@ var mcpGmxIncreaseInputSchema = mcpGmxMultisignInput(
1596
1705
  collateralToken: z.string().min(1),
1597
1706
  collateralAmountHuman: z.string().min(1),
1598
1707
  triggerPriceUsdHuman: z.string().optional(),
1599
- slippageBps: z.number().int().nonnegative().optional(),
1600
- executionFeeBufferBps: z.number().int().nonnegative().optional()
1708
+ patternFailureUsdHuman: z.string().optional(),
1709
+ slippageBps: agentCoercedOptionalIntSchema(z.number().int().nonnegative()),
1710
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(z.number().int().nonnegative())
1601
1711
  },
1602
1712
  preprocessGmxIncreaseInput
1603
1713
  );
@@ -1611,8 +1721,8 @@ var mcpGmxDecreaseInputSchema = mcpGmxMultisignInput(
1611
1721
  receiveToken: z.string().optional(),
1612
1722
  triggerPriceUsdHuman: z.string().optional(),
1613
1723
  keepLeverage: agentOptionalBooleanSchema(),
1614
- slippageBps: z.number().int().nonnegative().optional(),
1615
- executionFeeBufferBps: z.number().int().nonnegative().optional()
1724
+ slippageBps: agentCoercedOptionalIntSchema(z.number().int().nonnegative()),
1725
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(z.number().int().nonnegative())
1616
1726
  },
1617
1727
  preprocessGmxDecreaseInput
1618
1728
  );
@@ -1624,7 +1734,7 @@ var mcpGmxGmDepositInputSchema = mcpGmxMultisignInput(
1624
1734
  marketSymbol: z.string().min(1).describe("symbol from ctm_gmx_fetch_gm_markets"),
1625
1735
  collateralToken: z.string().min(1).describe("longTokenSymbol or shortTokenSymbol from GM market row"),
1626
1736
  collateralAmountHuman: z.string().min(1),
1627
- executionFeeBufferBps: z.number().int().nonnegative().optional(),
1737
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(z.number().int().nonnegative()),
1628
1738
  isNativeIn: agentOptionalBooleanSchema(),
1629
1739
  nativeWrapped: evmAddressSchema.optional()
1630
1740
  },
@@ -1634,19 +1744,19 @@ var mcpGmxGmWithdrawInputSchema = mcpGmxMultisignInput(
1634
1744
  {
1635
1745
  marketSymbol: z.string().min(1).describe("symbol from ctm_gmx_fetch_gm_markets"),
1636
1746
  gmAmountHuman: z.string().min(1),
1637
- gmDecimals: z.number().int().nonnegative().optional(),
1638
- executionFeeBufferBps: z.number().int().nonnegative().optional(),
1747
+ gmDecimals: agentCoercedOptionalIntSchema(z.number().int().nonnegative()),
1748
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(z.number().int().nonnegative()),
1639
1749
  isNativeOut: agentOptionalBooleanSchema()
1640
1750
  },
1641
1751
  preprocessGmxGmBuildInput
1642
1752
  );
1643
1753
  var mcpGmxStakeGmxInputSchema = mcpGmxMultisignInput({
1644
1754
  amountHuman: z.string().min(1),
1645
- gmxDecimals: z.number().int().nonnegative().optional()
1755
+ gmxDecimals: agentCoercedOptionalIntSchema(z.number().int().nonnegative())
1646
1756
  });
1647
1757
  var mcpGmxUnstakeGmxInputSchema = mcpGmxMultisignInput({
1648
1758
  amountHuman: z.string().min(1),
1649
- gmxDecimals: z.number().int().nonnegative().optional()
1759
+ gmxDecimals: agentCoercedOptionalIntSchema(z.number().int().nonnegative())
1650
1760
  });
1651
1761
  var mcpGmxFetchGmMarketsInputSchema = gmxFetchChainInputSchema;
1652
1762
  var mcpGmxGmMarketApyRowSchema = z.object({
@@ -1711,12 +1821,16 @@ var mcpGmxFetchOhlcvInputSchema = z.object({
1711
1821
  chainId: agentEvmChainIdSchema,
1712
1822
  symbol: z.string().min(1),
1713
1823
  timeframe: gmxOhlcvTimeframeSchema.optional(),
1714
- limit: z.number().int().positive().max(500).optional(),
1824
+ limit: agentCoercedOptionalIntSchema(z.number().int().positive().max(500)),
1715
1825
  sort: z.enum(["asc", "desc"]).optional()
1716
1826
  });
1717
1827
  var mcpGmxFetchOhlcvOutputSchema = z.object({
1718
1828
  symbol: z.string(),
1719
1829
  timeframe: gmxOhlcvTimeframeSchema,
1830
+ chainId: agentEvmChainIdSchema,
1831
+ startTimeMs: z.number().int().positive().optional(),
1832
+ endTimeMs: z.number().int().positive().optional(),
1833
+ candleCount: z.number().int().nonnegative(),
1720
1834
  candles: z.array(gmxOhlcvCandleSchema)
1721
1835
  });
1722
1836
  function mcpHyperliquidMultisignInput(fields, preprocess) {
@@ -1742,7 +1856,7 @@ var hyperliquidOhlcvIntervalSchema = z.enum([
1742
1856
  "1M"
1743
1857
  ]);
1744
1858
  var hyperliquidFetchChainInputSchema = z.object({
1745
- chainId: agentEvmChainIdSchema
1859
+ chainId: z.coerce.number().int().positive().default(999).describe("Hyperliquid EVM chain id (999 mainnet, 998 testnet).")
1746
1860
  });
1747
1861
  var hyperliquidPositionRowSchema = z.object({
1748
1862
  key: z.string(),
@@ -1793,7 +1907,7 @@ var mcpHyperliquidFetchMarketsOutputSchema = z.object({
1793
1907
  var mcpHyperliquidSearchMarketsInputSchema = hyperliquidFetchChainInputSchema.extend({
1794
1908
  query: z.string().min(1),
1795
1909
  dex: z.string().optional(),
1796
- limit: z.number().int().positive().max(50).optional()
1910
+ limit: agentCoercedOptionalIntSchema(z.number().int().positive().max(50))
1797
1911
  });
1798
1912
  var mcpHyperliquidSearchMarketsOutputSchema = z.object({
1799
1913
  matches: z.array(
@@ -1852,7 +1966,7 @@ var mcpHyperliquidFetchMarketSnapshotInputSchema = hyperliquidFetchChainInputSch
1852
1966
  coin: z.string().min(1),
1853
1967
  interval: hyperliquidOhlcvIntervalSchema.optional(),
1854
1968
  dex: z.string().optional(),
1855
- candleLimit: z.number().int().positive().max(200).optional()
1969
+ candleLimit: agentCoercedOptionalIntSchema(z.number().int().positive().max(200))
1856
1970
  });
1857
1971
  var hyperliquidOhlcvCandleSchema = z.object({
1858
1972
  timestampMs: z.number(),
@@ -1889,10 +2003,10 @@ var mcpHyperliquidFetchOhlcvInputSchema = hyperliquidFetchChainInputSchema.exten
1889
2003
  coin: z.string().min(1),
1890
2004
  interval: hyperliquidOhlcvIntervalSchema.optional(),
1891
2005
  dex: z.string().optional(),
1892
- lookbackDays: z.number().positive().max(90).optional(),
1893
- lookbackHours: z.number().positive().max(90 * 24).optional(),
1894
- startTimeMs: z.number().int().positive().optional(),
1895
- endTimeMs: z.number().int().positive().optional()
2006
+ lookbackDays: agentCoercedOptionalIntSchema(z.number().int().positive().max(90)),
2007
+ lookbackHours: agentCoercedOptionalIntSchema(z.number().int().positive().max(90 * 24)),
2008
+ startTimeMs: agentCoercedOptionalIntSchema(z.number().int().positive()),
2009
+ endTimeMs: agentCoercedOptionalIntSchema(z.number().int().positive())
1896
2010
  });
1897
2011
  var mcpHyperliquidFetchOhlcvOutputSchema = z.object({
1898
2012
  ohlcv: z.object({
@@ -1989,7 +2103,7 @@ var mcpHyperliquidCloseInputSchema = mcpHyperliquidMultisignInput(
1989
2103
  var mcpHyperliquidCancelInputSchema = mcpHyperliquidMultisignInput(
1990
2104
  {
1991
2105
  coin: z.string().min(1),
1992
- oid: z.number().int().positive().describe("oid from fetch_open_orders"),
2106
+ oid: agentCoercedIntSchema(z.number().int().positive()).describe("oid from fetch_open_orders"),
1993
2107
  marketKind: z.enum(["perp", "spot"]).optional(),
1994
2108
  dex: z.string().optional()
1995
2109
  },
@@ -1999,6 +2113,13 @@ var mcpHyperliquidUsdTransferInputSchema = mcpHyperliquidMultisignInput({
1999
2113
  usdHuman: z.string().min(1),
2000
2114
  toPerp: agentBooleanSchema()
2001
2115
  });
2116
+ var mcpHyperliquidBridgeDepositInputSchema = mcpHyperliquidMultisignInput({
2117
+ usdHuman: z.string().min(1).describe("USDC amount (minimum 5)")
2118
+ });
2119
+ var mcpHyperliquidBridgeWithdrawInputSchema = mcpHyperliquidMultisignInput({
2120
+ usdHuman: z.string().min(1),
2121
+ destination: evmAddressSchema.optional().describe("Arbitrum recipient; defaults to executor")
2122
+ });
2002
2123
  var mcpHyperliquidVaultDepositInputSchema = mcpHyperliquidMultisignInput(
2003
2124
  {
2004
2125
  vaultAddress: evmAddressSchema.describe("vaultAddress from fetch_vaults"),
@@ -2031,6 +2152,16 @@ var mcpHyperliquidUndelegateInputSchema = mcpHyperliquidMultisignInput(
2031
2152
  },
2032
2153
  preprocessHyperliquidUndelegateInput
2033
2154
  );
2155
+ var mcpHyperliquidUpdateLeverageInputSchema = mcpHyperliquidMultisignInput(
2156
+ {
2157
+ coin: z.string().min(1).describe("coin from fetch_markets, search_markets, or open_context"),
2158
+ leverage: agentCoercedIntSchema(z.number().int().positive()).describe("Target leverage (1..maxLeverage from market row)"),
2159
+ isCross: agentBooleanSchema().optional().describe("true = cross margin (default); false = isolated margin for this market"),
2160
+ marketKind: z.enum(["perp", "spot"]).optional().describe("perp (default)"),
2161
+ dex: z.string().optional().describe("HIP-3 dex when applicable")
2162
+ },
2163
+ preprocessHyperliquidCoinInput
2164
+ );
2034
2165
  var mcpCctpFeeFieldsSchema = z.object({
2035
2166
  feeTierUsed: z.enum(["low", "med", "high"]),
2036
2167
  maxFee: z.string().describe("Selected tier max fee in USDC base units (6 decimals)"),
@@ -2081,7 +2212,7 @@ var mcpCctpFetchUsdcBalanceOutputSchema = jsonObjectSchema.describe(
2081
2212
  );
2082
2213
  var mcpCctpFetchTransferStatusInputSchema = z.object({
2083
2214
  sourceChainId: agentEvmChainIdSchema.describe("Source chain where burn was executed"),
2084
- sourceDomain: z.number().int().min(0).describe("CCTP domain id of source chain"),
2215
+ sourceDomain: agentCoercedIntSchema(z.number().int().min(0)).describe("CCTP domain id of source chain"),
2085
2216
  burnTxHash: z.string().min(1).describe("Burn transaction hash (0x-prefixed or raw)")
2086
2217
  });
2087
2218
  var mcpCctpFetchTransferStatusOutputSchema = jsonObjectSchema.describe(
@@ -2092,7 +2223,7 @@ var mcpCctpBuildBurnMultisignInputSchema = mcpMultisignInput({
2092
2223
  transferAmountHuman: z.string().min(1).describe("Human USDC amount recipient receives"),
2093
2224
  mintRecipient: evmAddressSchema.optional().describe("Recipient on destination chain; defaults to MPC executor address"),
2094
2225
  feeTier: z.enum(["low", "med", "high"]).optional(),
2095
- minFinalityThreshold: z.number().int().positive().optional(),
2226
+ minFinalityThreshold: agentCoercedOptionalIntSchema(z.number().int().positive()),
2096
2227
  feeSnapshot: jsonObjectSchema.optional().describe("Optional output from ctm_cctp_fetch_burn_fees")
2097
2228
  });
2098
2229
 
@@ -2590,6 +2721,32 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
2590
2721
  },
2591
2722
  inputZod: mcpHyperliquidUsdTransferInputSchema
2592
2723
  }),
2724
+ defineProtocolMcpTool({
2725
+ name: "ctm_hyperliquid_build_bridge_deposit_multisign",
2726
+ actionId: "hyperliquid.bridgeDeposit",
2727
+ protocolId: "hyperliquid",
2728
+ chainCategory: "evm",
2729
+ description: "Create and submit mpc-auth multiSignRequest to deposit USDC from Arbitrum to Hyperliquid via Bridge2 (ERC20 transfer). chainId must be Arbitrum One (42161) or Arbitrum Sepolia (421614). Minimum 5 USDC.",
2730
+ prerequisites: ["keyGen", "executorAddress", "Arbitrum USDC balance", "usdHuman (min 5)"],
2731
+ handler: {
2732
+ importPath: "protocols/evm/hyperliquid",
2733
+ exportName: "buildEvmMultisignBodyHyperliquidBridgeDepositBatch"
2734
+ },
2735
+ inputZod: mcpHyperliquidBridgeDepositInputSchema
2736
+ }),
2737
+ defineProtocolMcpTool({
2738
+ name: "ctm_hyperliquid_build_bridge_withdraw_multisign",
2739
+ actionId: "hyperliquid.bridgeWithdraw",
2740
+ protocolId: "hyperliquid",
2741
+ chainCategory: "evm",
2742
+ description: "Create and submit mpc-auth multiSignRequest to withdraw USDC from Hyperliquid to Arbitrum via withdraw3 (EIP-712, delivered to /exchange). chainId 999 or 998. ~1 USDC bridge fee on Hyperliquid.",
2743
+ prerequisites: ["keyGen", "executorAddress", "Hyperliquid withdrawable balance", "usdHuman"],
2744
+ handler: {
2745
+ importPath: "protocols/evm/hyperliquid",
2746
+ exportName: "buildHyperliquidBridgeWithdrawMultisign"
2747
+ },
2748
+ inputZod: mcpHyperliquidBridgeWithdrawInputSchema
2749
+ }),
2593
2750
  defineProtocolMcpTool({
2594
2751
  name: "ctm_hyperliquid_build_vault_deposit_multisign",
2595
2752
  actionId: "hyperliquid.vaultDeposit",
@@ -2650,6 +2807,27 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
2650
2807
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidUndelegateBatch" },
2651
2808
  inputZod: mcpHyperliquidUndelegateInputSchema
2652
2809
  }),
2810
+ defineProtocolMcpTool({
2811
+ name: "ctm_hyperliquid_build_update_leverage_multisign",
2812
+ actionId: "hyperliquid.updateLeverage",
2813
+ protocolId: "hyperliquid",
2814
+ chainCategory: "evm",
2815
+ description: "Set per-market leverage (cross or isolated) on Hyperliquid via L1 /exchange EIP-712 signing \u2014 not CoreWriter, no EVM gas at propose/trigger.",
2816
+ prerequisites: [
2817
+ "keyGenId",
2818
+ "chainId 999 or 998",
2819
+ "coin",
2820
+ "leverage <= maxLeverage from fetch_markets or open_context",
2821
+ "ctm_hyperliquid_fetch_open_context for current leverageLabel"
2822
+ ],
2823
+ followUp: [
2824
+ "sign_request_agree",
2825
+ "trigger_sign_result",
2826
+ "broadcast_sign_result"
2827
+ ],
2828
+ handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildHyperliquidUpdateLeverageMultisign" },
2829
+ inputZod: mcpHyperliquidUpdateLeverageInputSchema
2830
+ }),
2653
2831
  defineProtocolMcpTool({
2654
2832
  name: "ctm_cctp_build_burn_multisign",
2655
2833
  actionId: "circle-cctp.burn-forward",
@@ -2747,11 +2925,27 @@ var CORE_MCP_TOOL_DEFINITIONS = [
2747
2925
  chainCategory: "evm",
2748
2926
  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.",
2749
2927
  prerequisites: ["chainId"],
2750
- followUp: ["ctm_uniswap_v4_lp_create_position"],
2928
+ followUp: ["ctm_uniswap_v4_lp_create_position", "ctm_uniswap_v4_fetch_ohlcv"],
2751
2929
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapV4ListStandardLpPools" },
2752
2930
  inputZod: mcpUniswapV4LpListPoolsInputSchema,
2753
2931
  outputZod: mcpUniswapV4LpListPoolsOutputSchema
2754
2932
  }),
2933
+ defineMcpTool({
2934
+ name: "ctm_uniswap_v4_fetch_ohlcv",
2935
+ actionId: "uniswap-v4.fetch-ohlcv",
2936
+ protocolId: "uniswap-v4",
2937
+ chainCategory: "evm",
2938
+ description: "Pool OHLCV from Uniswap V4 subgraph: native 1h/1d, aggregated multiples (4h/1w/etc.), or swap bucketing for sub-hour (15m). Read-only; does not use Trade API key. Optional THE_GRAPH_API_KEY env for gateway rate limits.",
2939
+ prerequisites: [
2940
+ "chainId with pinned v4 subgraph",
2941
+ "poolPreset or poolReference or existingPool",
2942
+ "interval + lookbackDays or lookbackHours or startTimeMs"
2943
+ ],
2944
+ followUp: ["ctm_uniswap_v4_list_lp_pools", "continuum__prepare_chart_from_rows"],
2945
+ handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapV4FetchOhlcv" },
2946
+ inputZod: mcpUniswapV4FetchOhlcvInputSchema,
2947
+ outputZod: mcpUniswapV4FetchOhlcvOutputSchema
2948
+ }),
2755
2949
  defineMcpTool({
2756
2950
  name: "ctm_uniswap_v4_lp_create_position",
2757
2951
  actionId: "uniswap-v4.lp-create",
@@ -3038,7 +3232,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3038
3232
  chainCategory: "evm",
3039
3233
  description: "List Hyperliquid perp markets (native + all HIP-3 dexes when dex omitted). Each market has coin name, maxLeverage, szDecimals, and optional dex (e.g. xyz for xyz:AAPL). chainId 999 mainnet or 998 testnet.",
3040
3234
  prerequisites: ["chainId 999 or 998"],
3041
- followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
3235
+ followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3042
3236
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchMarketsSummary" },
3043
3237
  inputZod: mcpHyperliquidFetchMarketsInputSchema,
3044
3238
  outputZod: mcpHyperliquidFetchMarketsOutputSchema
@@ -3050,7 +3244,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3050
3244
  chainCategory: "evm",
3051
3245
  description: "Search Hyperliquid perp markets across all dexes by ticker (AAPL, BTC), display name, or keyword (Apple, tesla). Case-insensitive. Returns canonical coin names (e.g. xyz:AAPL).",
3052
3246
  prerequisites: ["chainId 999 or 998", "query"],
3053
- followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
3247
+ followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3054
3248
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidSearchMarketsSummary" },
3055
3249
  inputZod: mcpHyperliquidSearchMarketsInputSchema,
3056
3250
  outputZod: mcpHyperliquidSearchMarketsOutputSchema
@@ -3062,7 +3256,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3062
3256
  chainCategory: "evm",
3063
3257
  description: "Per-market trading context: account value, withdrawable, margin used, leverage setting, mark price, available buy/sell size. Resolves ticker/name (AAPL, Apple) across dexes.",
3064
3258
  prerequisites: ["chainId", "executorAddress", "coin from fetch_markets"],
3065
- followUp: ["ctm_hyperliquid_build_limit_order_multisign"],
3259
+ followUp: ["ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3066
3260
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchOpenContextSummary" },
3067
3261
  inputZod: mcpHyperliquidFetchOpenContextInputSchema,
3068
3262
  outputZod: mcpHyperliquidFetchOpenContextOutputSchema
@@ -3098,7 +3292,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3098
3292
  chainCategory: "evm",
3099
3293
  description: "Live mark/mid price plus recent OHLCV candles for a Hyperliquid perp. Uses metaAndAssetCtxs for live prices (not stale candle close). Default interval 15m, 48 bars. Throws if live price unavailable.",
3100
3294
  prerequisites: ["chainId", "coin"],
3101
- followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
3295
+ followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3102
3296
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchMarketSnapshotSummary" },
3103
3297
  inputZod: mcpHyperliquidFetchMarketSnapshotInputSchema,
3104
3298
  outputZod: mcpHyperliquidFetchMarketSnapshotOutputSchema
@@ -3108,7 +3302,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3108
3302
  actionId: "hyperliquid.fetch-ohlcv",
3109
3303
  protocolId: "hyperliquid",
3110
3304
  chainCategory: "evm",
3111
- description: "OHLCV candle history for a Hyperliquid perp over an explicit lookback or time range. Requests only the needed window from Hyperliquid (e.g. lookbackDays: 7, interval: 15m \u2192 ~672 bars). Max 2000 bars \u2014 use coarser interval for longer history. Resolves ticker/name across dexes.",
3305
+ description: 'OHLCV candle history for a Hyperliquid perp over an explicit lookback or time range. Set lookbackDays to match the operator request exactly (e.g. "last 7 days" \u2192 lookbackDays: 7, interval: 1h \u2192 ~169 bars). Max 2000 bars \u2014 use coarser interval for longer history. Resolves ticker/name across dexes.',
3112
3306
  prerequisites: ["chainId 999 or 998", "coin", "lookbackDays or lookbackHours or startTimeMs"],
3113
3307
  followUp: ["ctm_hyperliquid_fetch_market_snapshot", "continuum__prepare_chart_from_rows", "ctm_hyperliquid_build_limit_order_multisign"],
3114
3308
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchOhlcvSummary" },
@@ -3492,41 +3686,6 @@ function isMapleSyrupSupportedChain(chainId) {
3492
3686
  return chainId === 1 || chainId === 11155111;
3493
3687
  }
3494
3688
 
3495
- // src/core/defiProxy.ts
3496
- var aaveGraphqlProxyUrl;
3497
- var morphoGraphqlProxyUrl;
3498
- function getAaveGraphqlProxyUrl() {
3499
- return aaveGraphqlProxyUrl;
3500
- }
3501
- function getMorphoGraphqlProxyUrl() {
3502
- return morphoGraphqlProxyUrl;
3503
- }
3504
- async function postJsonViaOptionalProxy(args) {
3505
- const proxy = args.proxyUrl?.trim();
3506
- if (proxy) {
3507
- const r2 = await fetch(proxy, {
3508
- method: "POST",
3509
- headers: { "content-type": "application/json" },
3510
- body: JSON.stringify(args.proxyEnvelope ?? args.body)
3511
- });
3512
- if (!r2.ok) {
3513
- const t = await r2.text().catch(() => "");
3514
- throw new Error(t ? `Proxy HTTP ${r2.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r2.status}`);
3515
- }
3516
- return await r2.json();
3517
- }
3518
- const r = await fetch(args.directUrl, {
3519
- method: "POST",
3520
- headers: { "content-type": "application/json" },
3521
- body: JSON.stringify(args.body)
3522
- });
3523
- if (!r.ok) {
3524
- const t = await r.text().catch(() => "");
3525
- throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`);
3526
- }
3527
- return await r.json();
3528
- }
3529
-
3530
3689
  // src/protocols/evm/maple/index.ts
3531
3690
  var MAPLE_PROTOCOL_ID = "maple-syrup";
3532
3691
  var mapleProtocolModule = {
@@ -3696,11 +3855,15 @@ function isGmxChainSupported(chainId) {
3696
3855
  }
3697
3856
  var require2 = createRequire(fileURLToPath(import.meta.url));
3698
3857
  var { GmxApiSdk } = require2("@gmx-io/sdk/v2");
3858
+ var { getApiUrl, getApiFallbackUrls } = require2("@gmx-io/sdk/configs/api");
3699
3859
  var GMX_HTTP_TIMEOUT_MS = 3e4;
3700
- var GMX_API_BASE_URLS = {
3701
- 42161: ["https://arbitrum.gmxapi.io", "https://arbitrum.gmxapi.ai"],
3702
- 43114: ["https://avalanche.gmxapi.io", "https://avalanche.gmxapi.ai"]
3703
- };
3860
+ function gmxResolvedApiBaseUrls(chainId) {
3861
+ const primary = getApiUrl(chainId);
3862
+ if (!primary) {
3863
+ throw new Error(`GMX API URLs are not configured for chain ${chainId}.`);
3864
+ }
3865
+ return [primary, ...getApiFallbackUrls(chainId)];
3866
+ }
3704
3867
  function buildGmxUrl(baseUrl, path, query) {
3705
3868
  const base = baseUrl.replace(/\/$/, "");
3706
3869
  if (!query) return `${base}${path}`;
@@ -3765,10 +3928,7 @@ async function gmxHttpPostJson(baseUrl, path, body, opts) {
3765
3928
  }
3766
3929
  }
3767
3930
  function createIoFirstGmxHttpApi(chainId) {
3768
- const urls = GMX_API_BASE_URLS[chainId];
3769
- if (!urls) {
3770
- throw new Error(`GMX API URLs are not configured for chain ${chainId}.`);
3771
- }
3931
+ const urls = gmxResolvedApiBaseUrls(chainId);
3772
3932
  async function withIoFirstFallback(fn) {
3773
3933
  let lastError;
3774
3934
  for (const baseUrl of urls) {
@@ -4039,6 +4199,40 @@ var hyperliquidProtocolModule = {
4039
4199
  validator: { type: "string", required: true, description: "Validator address" }
4040
4200
  }
4041
4201
  },
4202
+ {
4203
+ id: "hyperliquid.bridgeDeposit",
4204
+ protocolId: HYPERLIQUID_PROTOCOL_ID,
4205
+ chainCategory: "evm",
4206
+ description: "Deposit USDC from Arbitrum to Hyperliquid via Bridge2 (ERC20 transfer)",
4207
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
4208
+ params: {
4209
+ usdHuman: { type: "string", required: true, description: "USDC amount (min 5)" }
4210
+ }
4211
+ },
4212
+ {
4213
+ id: "hyperliquid.bridgeWithdraw",
4214
+ protocolId: HYPERLIQUID_PROTOCOL_ID,
4215
+ chainCategory: "evm",
4216
+ description: "Withdraw USDC from Hyperliquid to Arbitrum via withdraw3 (EIP-712 /exchange)",
4217
+ commonParams: ["keyGen", "purposeText"],
4218
+ params: {
4219
+ usdHuman: { type: "string", required: true, description: "USDC amount" },
4220
+ destination: { type: "string", required: false, description: "Arbitrum recipient (defaults to executor)" }
4221
+ }
4222
+ },
4223
+ {
4224
+ id: "hyperliquid.updateLeverage",
4225
+ protocolId: HYPERLIQUID_PROTOCOL_ID,
4226
+ chainCategory: "evm",
4227
+ description: "Update per-market cross/isolated leverage via Hyperliquid L1 /exchange (EIP-712)",
4228
+ commonParams: ["keyGen", "purposeText"],
4229
+ params: {
4230
+ coin: { type: "string", required: true, description: "Market coin e.g. BTC" },
4231
+ leverage: { type: "number", required: true, description: "New leverage (1..market max)" },
4232
+ isCross: { type: "boolean", required: false, description: "true for cross (default), false for isolated" },
4233
+ marketKind: { type: "string", required: false, description: "perp (default) or spot" }
4234
+ }
4235
+ },
4042
4236
  {
4043
4237
  id: "hyperliquid.undelegate",
4044
4238
  protocolId: HYPERLIQUID_PROTOCOL_ID,
@@ -4720,6 +4914,17 @@ var PROTOCOL_SUPPORT_ADVISORS = {
4720
4914
  return false;
4721
4915
  }
4722
4916
  }
4917
+ }),
4918
+ hyperliquid: advisor("hyperliquid", "api_underlyings", {
4919
+ async supportedChainIds() {
4920
+ return [...HYPERLIQUID_SUPPORTED_CHAIN_IDS];
4921
+ },
4922
+ async supportedTokens() {
4923
+ return {
4924
+ tokens: [],
4925
+ notes: "Hyperliquid perp coins from fetch_markets; chainId 999 mainnet or 998 testnet for HyperEVM multisign."
4926
+ };
4927
+ }
4723
4928
  })
4724
4929
  };
4725
4930
  function getProtocolSupportAdvisor(protocolId) {
@@ -4767,6 +4972,6 @@ function getAgentCatalog() {
4767
4972
  };
4768
4973
  }
4769
4974
 
4770
- export { EVM_COMMON_PARAM_DOCS, MANAGEMENT_SIG_DOC, MCP_NON_SUBMIT_TOOL_NAMES, MCP_TOOL_DEFINITIONS, MCP_TOOL_INPUT_SCHEMAS, MCP_TOOL_OUTPUT_SCHEMAS, MULTISIGN_OUTPUT_DOC, MULTISIGN_SUBMIT_OUTPUT_DOC, PROTOCOL_SUPPORT_ADVISORS, chainDetailSchema, evmAddressSchema, evmMultisignCommonInputSchema, getActionsByChainCategory, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions, getMcpToolInputSchema, getMcpToolOutputSchema, getProtocolDiscoverySummary, getProtocolModules, getProtocolSkill, getProtocolSupportAdvisor, getToolsForProtocol, jsonObjectSchema, keyGenSchema, listProtocolSupportAdvisorIds, listProtocolsWithSkills, mcpAaveV4BorrowInputSchema, mcpAaveV4DepositInputSchema, mcpAaveV4RepayInputSchema, mcpAaveV4WithdrawInputSchema, mcpCurveDaoBuildSwapMultisignInputSchema, mcpCurveDaoQuoteInputSchema, mcpCurveDaoQuoteOutputSchema, mcpEthenaClaimInputSchema, mcpEthenaCooldownInputSchema, mcpEthenaRedeemInputSchema, mcpEthenaStakeInputSchema, mcpEulerV2BorrowRepayInputSchema, mcpEulerV2CollateralDepositInputSchema, mcpEulerV2CollateralWithdrawInputSchema, mcpEulerV2FetchLendVaultsInputSchema, mcpEulerV2FetchLendVaultsOutputSchema, mcpEulerV2IsolatedBorrowInputSchema, mcpEulerV2IsolatedLendInputSchema, mcpEulerV2VaultWithdrawInputSchema, mcpGmxCancelInputSchema, mcpGmxDecreaseInputSchema, mcpGmxFetchGmApyInputSchema, mcpGmxFetchGmApyOutputSchema, mcpGmxFetchGmMarketsInputSchema, mcpGmxFetchGmMarketsOutputSchema, mcpGmxFetchMarketPricesInputSchema, mcpGmxFetchMarketPricesOutputSchema, mcpGmxFetchMarketsInputSchema, mcpGmxFetchMarketsOutputSchema, mcpGmxFetchOhlcvInputSchema, mcpGmxFetchOhlcvOutputSchema, mcpGmxFetchOrdersInputSchema, mcpGmxFetchOrdersOutputSchema, mcpGmxFetchPositionsInputSchema, mcpGmxFetchPositionsOutputSchema, mcpGmxFetchStakingPowerInputSchema, mcpGmxFetchStakingPowerOutputSchema, mcpGmxGmDepositInputSchema, mcpGmxGmWithdrawInputSchema, mcpGmxIncreaseInputSchema, mcpServerSubmitOutputSchema as mcpGmxMultisignOutputSchema, mcpGmxStakeGmxInputSchema, mcpGmxUnstakeGmxInputSchema, mcpHyperliquidCancelInputSchema, mcpHyperliquidCloseInputSchema, mcpHyperliquidDelegateInputSchema, mcpHyperliquidFetchDelegationsInputSchema, mcpHyperliquidFetchDelegationsOutputSchema, mcpHyperliquidFetchMarketSnapshotInputSchema, mcpHyperliquidFetchMarketSnapshotOutputSchema, mcpHyperliquidFetchMarketsInputSchema, mcpHyperliquidFetchMarketsOutputSchema, mcpHyperliquidFetchOhlcvInputSchema, mcpHyperliquidFetchOhlcvOutputSchema, mcpHyperliquidFetchOpenContextInputSchema, mcpHyperliquidFetchOpenContextOutputSchema, mcpHyperliquidFetchOpenOrdersInputSchema, mcpHyperliquidFetchOpenOrdersOutputSchema, mcpHyperliquidFetchPositionsInputSchema, mcpHyperliquidFetchPositionsOutputSchema, mcpHyperliquidFetchStakingSummaryInputSchema, mcpHyperliquidFetchStakingSummaryOutputSchema, mcpHyperliquidFetchUsdClassBalancesInputSchema, mcpHyperliquidFetchUsdClassBalancesOutputSchema, mcpHyperliquidFetchUserVaultEquitiesInputSchema, mcpHyperliquidFetchUserVaultEquitiesOutputSchema, mcpHyperliquidFetchVaultsInputSchema, mcpHyperliquidFetchVaultsOutputSchema, mcpHyperliquidLimitOrderInputSchema, mcpHyperliquidSearchMarketsInputSchema, mcpHyperliquidSearchMarketsOutputSchema, mcpHyperliquidStakeInputSchema, mcpHyperliquidUndelegateInputSchema, mcpHyperliquidUnstakeInputSchema, mcpHyperliquidUsdTransferInputSchema, mcpHyperliquidVaultDepositInputSchema, mcpHyperliquidVaultWithdrawInputSchema, mcpLidoClaimWithdrawalInputSchema, mcpLidoRequestWithdrawalsInputSchema, mcpLidoSubmitInputSchema, mcpLidoUnwrapWstEthInputSchema, mcpLidoWrapStEthInputSchema, mcpMapleDepositInputSchema, mcpMapleRequestRedeemInputSchema, mcpMorphoBlueBorrowInputSchema, mcpMorphoBlueCollateralDepositInputSchema, mcpMorphoBlueCollateralWithdrawInputSchema, mcpMorphoBlueRepayInputSchema, mcpMorphoFetchBlueMarketsInputSchema, mcpMorphoFetchBlueMarketsOutputSchema, mcpMorphoFetchEarnVaultsInputSchema, mcpMorphoFetchEarnVaultsOutputSchema, mcpMorphoMerklClaimInputSchema, mcpMorphoVaultDepositInputSchema, mcpMorphoVaultWithdrawInputSchema, mcpMultisignInput, multisignOutputSchema as mcpMultisignOutputSchema, mcpServerSubmitOutputSchema as mcpMultisignSubmitOutputSchema, mcpServerCommonInputSchema, mcpServerMultisignInput, mcpServerSubmitOutputSchema, mcpSkyLockstakeCloseInputSchema, mcpSkyLockstakeDrawInputSchema, mcpSkyLockstakeGetRewardInputSchema, mcpSkyLockstakeStakeInputSchema, mcpSkyLockstakeWipeInputSchema, mcpSkySusdsDepositInputSchema, mcpSkySusdsRedeemInputSchema, mcpUniswapV4BuildCollectFeesMultisignInputSchema, mcpUniswapV4BuildDecreaseLiquidityMultisignInputSchema, mcpUniswapV4BuildIncreaseLiquidityMultisignInputSchema, mcpUniswapV4BuildMintLiquidityMultisignInputSchema, mcpUniswapV4BuildSwapMultisignInputSchema, mcpUniswapV4CreateSwapInputSchema, mcpUniswapV4CreateSwapOutputSchema, mcpUniswapV4LpClaimInputSchema, mcpUniswapV4LpClaimOutputSchema, mcpUniswapV4LpCreatePositionInputSchema, mcpUniswapV4LpCreatePositionOutputSchema, mcpUniswapV4LpDecreaseInputSchema, mcpUniswapV4LpDecreaseOutputSchema, mcpUniswapV4LpIncreaseInputSchema, mcpUniswapV4LpIncreaseOutputSchema, mcpUniswapV4LpListPoolsInputSchema, mcpUniswapV4LpListPoolsOutputSchema, mcpUniswapV4LpListPositionsInputSchema, mcpUniswapV4LpListPositionsOutputSchema, mcpUniswapV4QuoteInputSchema, mcpUniswapV4QuoteOutputSchema, mcpUniswapV4RegisterPositionFromMintTxInputSchema, mcpUniswapV4RegisterPositionFromMintTxOutputSchema, mcpUniswapV4RegisterPositionNftInputSchema, mcpUniswapV4RegisterPositionNftOutputSchema, multisignOutputSchema, parseAgentBoolean, parseAgentEvmChainId, parseMcpToolInput, parseMcpToolOutput, parseMultisignBuilderOutput, uniswapQuoteTradeTypeSchema, zodSchemaToMcpJsonSchema };
4975
+ export { EVM_COMMON_PARAM_DOCS, MANAGEMENT_SIG_DOC, MCP_NON_SUBMIT_TOOL_NAMES, MCP_TOOL_DEFINITIONS, MCP_TOOL_INPUT_SCHEMAS, MCP_TOOL_OUTPUT_SCHEMAS, MULTISIGN_OUTPUT_DOC, MULTISIGN_SUBMIT_OUTPUT_DOC, PROTOCOL_SUPPORT_ADVISORS, chainDetailSchema, evmAddressSchema, evmMultisignCommonInputSchema, getActionsByChainCategory, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions, getMcpToolInputSchema, getMcpToolOutputSchema, getProtocolDiscoverySummary, getProtocolModules, getProtocolSkill, getProtocolSupportAdvisor, getToolsForProtocol, jsonObjectSchema, keyGenSchema, listProtocolSupportAdvisorIds, listProtocolsWithSkills, mcpAaveV4BorrowInputSchema, mcpAaveV4DepositInputSchema, mcpAaveV4RepayInputSchema, mcpAaveV4WithdrawInputSchema, mcpCurveDaoBuildSwapMultisignInputSchema, mcpCurveDaoQuoteInputSchema, mcpCurveDaoQuoteOutputSchema, mcpEthenaClaimInputSchema, mcpEthenaCooldownInputSchema, mcpEthenaRedeemInputSchema, mcpEthenaStakeInputSchema, mcpEulerV2BorrowRepayInputSchema, mcpEulerV2CollateralDepositInputSchema, mcpEulerV2CollateralWithdrawInputSchema, mcpEulerV2FetchLendVaultsInputSchema, mcpEulerV2FetchLendVaultsOutputSchema, mcpEulerV2IsolatedBorrowInputSchema, mcpEulerV2IsolatedLendInputSchema, mcpEulerV2VaultWithdrawInputSchema, mcpGmxCancelInputSchema, mcpGmxDecreaseInputSchema, mcpGmxFetchGmApyInputSchema, mcpGmxFetchGmApyOutputSchema, mcpGmxFetchGmMarketsInputSchema, mcpGmxFetchGmMarketsOutputSchema, mcpGmxFetchMarketPricesInputSchema, mcpGmxFetchMarketPricesOutputSchema, mcpGmxFetchMarketsInputSchema, mcpGmxFetchMarketsOutputSchema, mcpGmxFetchOhlcvInputSchema, mcpGmxFetchOhlcvOutputSchema, mcpGmxFetchOrdersInputSchema, mcpGmxFetchOrdersOutputSchema, mcpGmxFetchPositionsInputSchema, mcpGmxFetchPositionsOutputSchema, mcpGmxFetchStakingPowerInputSchema, mcpGmxFetchStakingPowerOutputSchema, mcpGmxGmDepositInputSchema, mcpGmxGmWithdrawInputSchema, mcpGmxIncreaseInputSchema, mcpServerSubmitOutputSchema as mcpGmxMultisignOutputSchema, mcpGmxStakeGmxInputSchema, mcpGmxUnstakeGmxInputSchema, mcpHyperliquidBridgeDepositInputSchema, mcpHyperliquidBridgeWithdrawInputSchema, mcpHyperliquidCancelInputSchema, mcpHyperliquidCloseInputSchema, mcpHyperliquidDelegateInputSchema, mcpHyperliquidFetchDelegationsInputSchema, mcpHyperliquidFetchDelegationsOutputSchema, mcpHyperliquidFetchMarketSnapshotInputSchema, mcpHyperliquidFetchMarketSnapshotOutputSchema, mcpHyperliquidFetchMarketsInputSchema, mcpHyperliquidFetchMarketsOutputSchema, mcpHyperliquidFetchOhlcvInputSchema, mcpHyperliquidFetchOhlcvOutputSchema, mcpHyperliquidFetchOpenContextInputSchema, mcpHyperliquidFetchOpenContextOutputSchema, mcpHyperliquidFetchOpenOrdersInputSchema, mcpHyperliquidFetchOpenOrdersOutputSchema, mcpHyperliquidFetchPositionsInputSchema, mcpHyperliquidFetchPositionsOutputSchema, mcpHyperliquidFetchStakingSummaryInputSchema, mcpHyperliquidFetchStakingSummaryOutputSchema, mcpHyperliquidFetchUsdClassBalancesInputSchema, mcpHyperliquidFetchUsdClassBalancesOutputSchema, mcpHyperliquidFetchUserVaultEquitiesInputSchema, mcpHyperliquidFetchUserVaultEquitiesOutputSchema, mcpHyperliquidFetchVaultsInputSchema, mcpHyperliquidFetchVaultsOutputSchema, mcpHyperliquidLimitOrderInputSchema, mcpHyperliquidSearchMarketsInputSchema, mcpHyperliquidSearchMarketsOutputSchema, mcpHyperliquidStakeInputSchema, mcpHyperliquidUndelegateInputSchema, mcpHyperliquidUnstakeInputSchema, mcpHyperliquidUpdateLeverageInputSchema, mcpHyperliquidUsdTransferInputSchema, mcpHyperliquidVaultDepositInputSchema, mcpHyperliquidVaultWithdrawInputSchema, mcpLidoClaimWithdrawalInputSchema, mcpLidoRequestWithdrawalsInputSchema, mcpLidoSubmitInputSchema, mcpLidoUnwrapWstEthInputSchema, mcpLidoWrapStEthInputSchema, mcpMapleDepositInputSchema, mcpMapleRequestRedeemInputSchema, mcpMorphoBlueBorrowInputSchema, mcpMorphoBlueCollateralDepositInputSchema, mcpMorphoBlueCollateralWithdrawInputSchema, mcpMorphoBlueRepayInputSchema, mcpMorphoFetchBlueMarketsInputSchema, mcpMorphoFetchBlueMarketsOutputSchema, mcpMorphoFetchEarnVaultsInputSchema, mcpMorphoFetchEarnVaultsOutputSchema, mcpMorphoMerklClaimInputSchema, mcpMorphoVaultDepositInputSchema, mcpMorphoVaultWithdrawInputSchema, mcpMultisignInput, multisignOutputSchema as mcpMultisignOutputSchema, mcpServerSubmitOutputSchema as mcpMultisignSubmitOutputSchema, mcpServerCommonInputSchema, mcpServerMultisignInput, mcpServerSubmitOutputSchema, mcpSkyLockstakeCloseInputSchema, mcpSkyLockstakeDrawInputSchema, mcpSkyLockstakeGetRewardInputSchema, mcpSkyLockstakeStakeInputSchema, mcpSkyLockstakeWipeInputSchema, mcpSkySusdsDepositInputSchema, mcpSkySusdsRedeemInputSchema, mcpUniswapV4BuildCollectFeesMultisignInputSchema, mcpUniswapV4BuildDecreaseLiquidityMultisignInputSchema, mcpUniswapV4BuildIncreaseLiquidityMultisignInputSchema, mcpUniswapV4BuildMintLiquidityMultisignInputSchema, mcpUniswapV4BuildSwapMultisignInputSchema, mcpUniswapV4CreateSwapInputSchema, mcpUniswapV4CreateSwapOutputSchema, mcpUniswapV4FetchOhlcvInputSchema, mcpUniswapV4FetchOhlcvOutputSchema, mcpUniswapV4LpClaimInputSchema, mcpUniswapV4LpClaimOutputSchema, mcpUniswapV4LpCreatePositionInputSchema, mcpUniswapV4LpCreatePositionOutputSchema, mcpUniswapV4LpDecreaseInputSchema, mcpUniswapV4LpDecreaseOutputSchema, mcpUniswapV4LpIncreaseInputSchema, mcpUniswapV4LpIncreaseOutputSchema, mcpUniswapV4LpListPoolsInputSchema, mcpUniswapV4LpListPoolsOutputSchema, mcpUniswapV4LpListPositionsInputSchema, mcpUniswapV4LpListPositionsOutputSchema, mcpUniswapV4QuoteInputSchema, mcpUniswapV4QuoteOutputSchema, mcpUniswapV4RegisterPositionFromMintTxInputSchema, mcpUniswapV4RegisterPositionFromMintTxOutputSchema, mcpUniswapV4RegisterPositionNftInputSchema, mcpUniswapV4RegisterPositionNftOutputSchema, multisignOutputSchema, parseAgentBoolean, parseAgentEvmChainId, parseMcpToolInput, parseMcpToolOutput, parseMultisignBuilderOutput, uniswapQuoteTradeTypeSchema, zodSchemaToMcpJsonSchema };
4771
4976
  //# sourceMappingURL=catalog.js.map
4772
4977
  //# sourceMappingURL=catalog.js.map