@continuumdao/ctm-mpc-defi 0.2.18 → 0.2.20

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 (77) hide show
  1. package/dist/agent/catalog.cjs +185 -56
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +696 -633
  4. package/dist/agent/catalog.js +183 -57
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/hyperliquid/SKILL.md +24 -20
  7. package/dist/chains/evm/index.cjs +1 -1
  8. package/dist/chains/evm/index.cjs.map +1 -1
  9. package/dist/chains/evm/index.js +1 -1
  10. package/dist/chains/evm/index.js.map +1 -1
  11. package/dist/core/index.cjs +70 -1
  12. package/dist/core/index.cjs.map +1 -1
  13. package/dist/core/index.d.ts +35 -2
  14. package/dist/core/index.js +69 -2
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/index.cjs +69 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +69 -3
  20. package/dist/index.js.map +1 -1
  21. package/dist/protocols/evm/aave-v4/index.cjs +1 -1
  22. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  23. package/dist/protocols/evm/aave-v4/index.js +1 -1
  24. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  25. package/dist/protocols/evm/circle-cctp/index.cjs +1 -1
  26. package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
  27. package/dist/protocols/evm/circle-cctp/index.js +1 -1
  28. package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
  29. package/dist/protocols/evm/curve-dao/index.cjs +1 -1
  30. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  31. package/dist/protocols/evm/curve-dao/index.d.ts +1 -1
  32. package/dist/protocols/evm/curve-dao/index.js +1 -1
  33. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  34. package/dist/protocols/evm/ethena/index.cjs +1 -1
  35. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  36. package/dist/protocols/evm/ethena/index.js +1 -1
  37. package/dist/protocols/evm/ethena/index.js.map +1 -1
  38. package/dist/protocols/evm/euler-v2/index.cjs +1 -1
  39. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  40. package/dist/protocols/evm/euler-v2/index.js +1 -1
  41. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  42. package/dist/protocols/evm/gmx/index.cjs +50 -22
  43. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  44. package/dist/protocols/evm/gmx/index.d.ts +20 -6
  45. package/dist/protocols/evm/gmx/index.js +49 -23
  46. package/dist/protocols/evm/gmx/index.js.map +1 -1
  47. package/dist/protocols/evm/hyperliquid/index.cjs +462 -2
  48. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  49. package/dist/protocols/evm/hyperliquid/index.d.ts +189 -2
  50. package/dist/protocols/evm/hyperliquid/index.js +442 -4
  51. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  52. package/dist/protocols/evm/lido/index.cjs +1 -1
  53. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  54. package/dist/protocols/evm/lido/index.js +1 -1
  55. package/dist/protocols/evm/lido/index.js.map +1 -1
  56. package/dist/protocols/evm/maple/index.cjs +1 -1
  57. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  58. package/dist/protocols/evm/maple/index.js +1 -1
  59. package/dist/protocols/evm/maple/index.js.map +1 -1
  60. package/dist/protocols/evm/morpho/index.cjs +1 -1
  61. package/dist/protocols/evm/morpho/index.cjs.map +1 -1
  62. package/dist/protocols/evm/morpho/index.js +1 -1
  63. package/dist/protocols/evm/morpho/index.js.map +1 -1
  64. package/dist/protocols/evm/permit2/index.cjs +202 -0
  65. package/dist/protocols/evm/permit2/index.cjs.map +1 -0
  66. package/dist/protocols/evm/permit2/index.d.ts +43 -0
  67. package/dist/protocols/evm/permit2/index.js +199 -0
  68. package/dist/protocols/evm/permit2/index.js.map +1 -0
  69. package/dist/protocols/evm/sky/index.cjs +1 -1
  70. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  71. package/dist/protocols/evm/sky/index.js +1 -1
  72. package/dist/protocols/evm/sky/index.js.map +1 -1
  73. package/dist/protocols/evm/uniswap-v4/index.cjs +1 -1
  74. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  75. package/dist/protocols/evm/uniswap-v4/index.js +1 -1
  76. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  77. package/package.json +7 -1
@@ -559,6 +559,15 @@ var agentEvmChainIdSchema = zod.z.preprocess(
559
559
  (val) => parseAgentEvmChainId(val),
560
560
  zod.z.number().int().positive().describe("EVM chain id (decimal, e.g. 8453 for Base \u2014 not 0x8453).")
561
561
  );
562
+ var agentCoercedIntSchema = (schema) => zod.z.coerce.number().pipe(schema);
563
+ var agentCoercedOptionalIntSchema = (schema) => zod.z.preprocess(
564
+ (val) => val === void 0 || val === null || val === "" ? void 0 : val,
565
+ zod.z.coerce.number().pipe(schema).optional()
566
+ );
567
+ var agentCoercedOptionalNumberSchema = (schema) => zod.z.preprocess(
568
+ (val) => val === void 0 || val === null || val === "" ? void 0 : val,
569
+ zod.z.coerce.number().pipe(schema).optional()
570
+ );
562
571
 
563
572
  // src/agent/schemas/common.ts
564
573
  var evmAddressSchema = zod.z.string().min(1).describe("EVM address (0x-prefixed, 40 hex nibbles)");
@@ -571,12 +580,12 @@ var keyGenSchema = zod.z.object({
571
580
  );
572
581
  var chainDetailSchema = zod.z.object({
573
582
  legacy: zod.z.boolean().optional(),
574
- gasLimit: zod.z.number().optional(),
575
- gasMultiplier: zod.z.number().optional(),
576
- gasPrice: zod.z.number().optional(),
577
- baseFee: zod.z.number().optional(),
578
- priorityFee: zod.z.number().optional(),
579
- baseFeeMultiplier: zod.z.number().optional()
583
+ gasLimit: agentCoercedOptionalNumberSchema(zod.z.number()),
584
+ gasMultiplier: agentCoercedOptionalNumberSchema(zod.z.number()),
585
+ gasPrice: agentCoercedOptionalNumberSchema(zod.z.number()),
586
+ baseFee: agentCoercedOptionalNumberSchema(zod.z.number()),
587
+ priorityFee: agentCoercedOptionalNumberSchema(zod.z.number()),
588
+ baseFeeMultiplier: agentCoercedOptionalNumberSchema(zod.z.number())
580
589
  }).passthrough().describe(
581
590
  "Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
582
591
  );
@@ -916,7 +925,9 @@ var mcpUniswapV4QuoteOutputSchema = jsonObjectSchema.describe(
916
925
  var mcpUniswapV4CreateSwapInputSchema = zod.z.object({
917
926
  uniswapApiKey: zod.z.string().min(1).describe("Uniswap Trade API key"),
918
927
  fullQuoteFromPermit: jsonObjectSchema.describe("Full quote JSON from ctm_uniswap_v4_quote"),
919
- swapTransactionDeadlineUnix: zod.z.number().int().positive().optional().describe("On-chain deadline unix seconds; default ~30 min from now"),
928
+ swapTransactionDeadlineUnix: agentCoercedOptionalIntSchema(
929
+ zod.z.number().int().positive()
930
+ ).describe("On-chain deadline unix seconds; default ~30 min from now"),
920
931
  useServerProxy: zod.z.boolean().optional().describe("Set false in Node/agents; true only in browser via Next API route"),
921
932
  baseUrl: zod.z.string().optional(),
922
933
  universalRouterVersion: zod.z.string().optional()
@@ -939,8 +950,8 @@ var mcpUniswapV4BuildSwapMultisignInputSchema = withMultisignKeySourceRefine(
939
950
  gasFee: zod.z.string().optional()
940
951
  }).passthrough().describe("Full create_swap response"),
941
952
  fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
942
- swapDeadlineUnix: zod.z.number().describe("Same deadline passed to create_swap"),
943
- slippagePercent: zod.z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
953
+ swapDeadlineUnix: agentCoercedIntSchema(zod.z.number()).describe("Same deadline passed to create_swap"),
954
+ slippagePercent: agentCoercedOptionalNumberSchema(zod.z.number()).describe("Extra approve headroom for EXACT_OUTPUT")
944
955
  })
945
956
  )
946
957
  );
@@ -952,8 +963,8 @@ var lpExistingPoolSchema = zod.z.object({
952
963
  var lpNewPoolSchema = zod.z.object({
953
964
  token0Address: evmAddressSchema,
954
965
  token1Address: evmAddressSchema,
955
- fee: zod.z.number().int().nonnegative(),
956
- tickSpacing: zod.z.number().int().positive(),
966
+ fee: agentCoercedIntSchema(zod.z.number().int().nonnegative()),
967
+ tickSpacing: agentCoercedIntSchema(zod.z.number().int().positive()),
957
968
  hooks: evmAddressSchema.optional(),
958
969
  initialPrice: zod.z.string().min(1).describe("sqrtRatioX96 string for new pool")
959
970
  });
@@ -966,14 +977,14 @@ var lpPriceBoundsSchema = zod.z.object({
966
977
  maxPrice: zod.z.string().min(1)
967
978
  });
968
979
  var lpTickBoundsSchema = zod.z.object({
969
- tickLower: zod.z.number().int(),
970
- tickUpper: zod.z.number().int()
980
+ tickLower: agentCoercedIntSchema(zod.z.number().int()),
981
+ tickUpper: agentCoercedIntSchema(zod.z.number().int())
971
982
  });
972
983
  var lpCommonApiInputSchema = zod.z.object({
973
984
  uniswapApiKey: zod.z.string().min(1),
974
985
  walletAddress: evmAddressSchema.optional(),
975
986
  chainId: agentEvmChainIdSchema,
976
- slippageTolerance: zod.z.number().optional(),
987
+ slippageTolerance: agentCoercedOptionalNumberSchema(zod.z.number()),
977
988
  simulateTransaction: agentOptionalBooleanSchema(),
978
989
  baseUrl: zod.z.string().optional(),
979
990
  keyGen: zod.z.string().optional(),
@@ -1034,7 +1045,7 @@ var mcpUniswapV4LpDecreaseInputSchema = zod.z.preprocess(
1034
1045
  token0Address: evmAddressSchema,
1035
1046
  token1Address: evmAddressSchema,
1036
1047
  nftTokenId: zod.z.union([zod.z.string(), zod.z.number()]).describe("tokenId from lp_list_positions"),
1037
- liquidityPercentageToDecrease: zod.z.number().int().min(1).max(100)
1048
+ liquidityPercentageToDecrease: agentCoercedIntSchema(zod.z.number().int().min(1).max(100))
1038
1049
  })
1039
1050
  );
1040
1051
  var mcpUniswapV4LpDecreaseOutputSchema = jsonObjectSchema;
@@ -1197,7 +1208,7 @@ var mcpMorphoFetchEarnVaultsInputSchema = zod.z.object({
1197
1208
  chainId: agentEvmChainIdSchema,
1198
1209
  underlying: zod.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."),
1199
1210
  query: zod.z.string().trim().min(1).optional().describe("Case-insensitive filter on vault name, symbol, address, or underlying symbol (e.g. Steakhouse, bbqUSDC)."),
1200
- limit: zod.z.number().int().min(1).max(200).optional().describe("Max rows (default 50).")
1211
+ limit: agentCoercedOptionalIntSchema(zod.z.number().int().min(1).max(200)).describe("Max rows (default 50).")
1201
1212
  });
1202
1213
  var mcpMorphoFetchEarnVaultsOutputSchema = zod.z.object({
1203
1214
  vaults: zod.z.array(
@@ -1225,7 +1236,7 @@ var mcpMorphoFetchBlueMarketsInputSchema = zod.z.object({
1225
1236
  collateral: zod.z.string().trim().min(1).optional().describe("Collateral asset symbol or address (e.g. WETH, cbETH)."),
1226
1237
  loan: zod.z.string().trim().min(1).optional().describe("Loan asset symbol or address (e.g. USDC)."),
1227
1238
  query: zod.z.string().trim().min(1).optional().describe("Filter on market label, symbols, or marketId."),
1228
- limit: zod.z.number().int().min(1).max(200).optional()
1239
+ limit: agentCoercedOptionalIntSchema(zod.z.number().int().min(1).max(200))
1229
1240
  });
1230
1241
  var mcpMorphoFetchBlueMarketsOutputSchema = zod.z.object({
1231
1242
  markets: zod.z.array(
@@ -1322,17 +1333,17 @@ var mcpSkyLockstakeStakeInputSchema = mcpMultisignInput({
1322
1333
  });
1323
1334
  var mcpSkyLockstakeDrawInputSchema = mcpMultisignInput({
1324
1335
  usdsAmountHuman: zod.z.string().min(1),
1325
- urnIndex: zod.z.number().int().nonnegative()
1336
+ urnIndex: agentCoercedIntSchema(zod.z.number().int().nonnegative())
1326
1337
  });
1327
1338
  var mcpSkyLockstakeWipeInputSchema = mcpMultisignInput({
1328
1339
  usdsAmountHuman: zod.z.string().min(1),
1329
- urnIndex: zod.z.number().int().nonnegative()
1340
+ urnIndex: agentCoercedIntSchema(zod.z.number().int().nonnegative())
1330
1341
  });
1331
1342
  var mcpSkyLockstakeCloseInputSchema = mcpMultisignInput({
1332
- urnIndex: zod.z.number().int().nonnegative()
1343
+ urnIndex: agentCoercedIntSchema(zod.z.number().int().nonnegative())
1333
1344
  });
1334
1345
  var mcpSkyLockstakeGetRewardInputSchema = mcpMultisignInput({
1335
- urnIndex: zod.z.number().int().nonnegative()
1346
+ urnIndex: agentCoercedIntSchema(zod.z.number().int().nonnegative())
1336
1347
  });
1337
1348
  var mcpSkySusdsDepositInputSchema = mcpMultisignInput({
1338
1349
  usdsAmountHuman: zod.z.string().min(1)
@@ -1504,7 +1515,7 @@ var mcpMorphoBlueRepayInputSchema = withMultisignKeySourceRefine(
1504
1515
  var mcpMorphoBlueCollateralWithdrawInputSchema = mcpMultisignInput({
1505
1516
  marketId: zod.z.string().min(1),
1506
1517
  amountHuman: zod.z.string().min(1),
1507
- collateralDecimals: zod.z.number().int().min(0).max(36).optional()
1518
+ collateralDecimals: agentCoercedOptionalIntSchema(zod.z.number().int().min(0).max(36))
1508
1519
  });
1509
1520
  var mcpMorphoMerklClaimInputSchema = mcpMultisignInput({
1510
1521
  claimData: zod.z.string().min(1).describe("Hex calldata for Merkl Distributor.claim from Merkl API."),
@@ -1516,7 +1527,7 @@ var mcpEulerV2FetchLendVaultsInputSchema = zod.z.object({
1516
1527
  underlyingAddress: evmAddressSchema.describe(
1517
1528
  "Underlying asset address from get_defi_protocol_supported_tokens."
1518
1529
  ),
1519
- limit: zod.z.number().int().min(1).max(100).optional().describe("Max vault rows (default 30).")
1530
+ limit: agentCoercedOptionalIntSchema(zod.z.number().int().min(1).max(100)).describe("Max vault rows (default 30).")
1520
1531
  });
1521
1532
  var mcpEulerV2FetchLendVaultsOutputSchema = zod.z.object({
1522
1533
  vaults: zod.z.array(
@@ -1599,8 +1610,9 @@ var mcpGmxIncreaseInputSchema = mcpGmxMultisignInput(
1599
1610
  collateralToken: zod.z.string().min(1),
1600
1611
  collateralAmountHuman: zod.z.string().min(1),
1601
1612
  triggerPriceUsdHuman: zod.z.string().optional(),
1602
- slippageBps: zod.z.number().int().nonnegative().optional(),
1603
- executionFeeBufferBps: zod.z.number().int().nonnegative().optional()
1613
+ patternFailureUsdHuman: zod.z.string().optional(),
1614
+ slippageBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative()),
1615
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative())
1604
1616
  },
1605
1617
  preprocessGmxIncreaseInput
1606
1618
  );
@@ -1614,8 +1626,8 @@ var mcpGmxDecreaseInputSchema = mcpGmxMultisignInput(
1614
1626
  receiveToken: zod.z.string().optional(),
1615
1627
  triggerPriceUsdHuman: zod.z.string().optional(),
1616
1628
  keepLeverage: agentOptionalBooleanSchema(),
1617
- slippageBps: zod.z.number().int().nonnegative().optional(),
1618
- executionFeeBufferBps: zod.z.number().int().nonnegative().optional()
1629
+ slippageBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative()),
1630
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative())
1619
1631
  },
1620
1632
  preprocessGmxDecreaseInput
1621
1633
  );
@@ -1627,7 +1639,7 @@ var mcpGmxGmDepositInputSchema = mcpGmxMultisignInput(
1627
1639
  marketSymbol: zod.z.string().min(1).describe("symbol from ctm_gmx_fetch_gm_markets"),
1628
1640
  collateralToken: zod.z.string().min(1).describe("longTokenSymbol or shortTokenSymbol from GM market row"),
1629
1641
  collateralAmountHuman: zod.z.string().min(1),
1630
- executionFeeBufferBps: zod.z.number().int().nonnegative().optional(),
1642
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative()),
1631
1643
  isNativeIn: agentOptionalBooleanSchema(),
1632
1644
  nativeWrapped: evmAddressSchema.optional()
1633
1645
  },
@@ -1637,19 +1649,19 @@ var mcpGmxGmWithdrawInputSchema = mcpGmxMultisignInput(
1637
1649
  {
1638
1650
  marketSymbol: zod.z.string().min(1).describe("symbol from ctm_gmx_fetch_gm_markets"),
1639
1651
  gmAmountHuman: zod.z.string().min(1),
1640
- gmDecimals: zod.z.number().int().nonnegative().optional(),
1641
- executionFeeBufferBps: zod.z.number().int().nonnegative().optional(),
1652
+ gmDecimals: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative()),
1653
+ executionFeeBufferBps: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative()),
1642
1654
  isNativeOut: agentOptionalBooleanSchema()
1643
1655
  },
1644
1656
  preprocessGmxGmBuildInput
1645
1657
  );
1646
1658
  var mcpGmxStakeGmxInputSchema = mcpGmxMultisignInput({
1647
1659
  amountHuman: zod.z.string().min(1),
1648
- gmxDecimals: zod.z.number().int().nonnegative().optional()
1660
+ gmxDecimals: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative())
1649
1661
  });
1650
1662
  var mcpGmxUnstakeGmxInputSchema = mcpGmxMultisignInput({
1651
1663
  amountHuman: zod.z.string().min(1),
1652
- gmxDecimals: zod.z.number().int().nonnegative().optional()
1664
+ gmxDecimals: agentCoercedOptionalIntSchema(zod.z.number().int().nonnegative())
1653
1665
  });
1654
1666
  var mcpGmxFetchGmMarketsInputSchema = gmxFetchChainInputSchema;
1655
1667
  var mcpGmxGmMarketApyRowSchema = zod.z.object({
@@ -1714,12 +1726,16 @@ var mcpGmxFetchOhlcvInputSchema = zod.z.object({
1714
1726
  chainId: agentEvmChainIdSchema,
1715
1727
  symbol: zod.z.string().min(1),
1716
1728
  timeframe: gmxOhlcvTimeframeSchema.optional(),
1717
- limit: zod.z.number().int().positive().max(500).optional(),
1729
+ limit: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(500)),
1718
1730
  sort: zod.z.enum(["asc", "desc"]).optional()
1719
1731
  });
1720
1732
  var mcpGmxFetchOhlcvOutputSchema = zod.z.object({
1721
1733
  symbol: zod.z.string(),
1722
1734
  timeframe: gmxOhlcvTimeframeSchema,
1735
+ chainId: agentEvmChainIdSchema,
1736
+ startTimeMs: zod.z.number().int().positive().optional(),
1737
+ endTimeMs: zod.z.number().int().positive().optional(),
1738
+ candleCount: zod.z.number().int().nonnegative(),
1723
1739
  candles: zod.z.array(gmxOhlcvCandleSchema)
1724
1740
  });
1725
1741
  function mcpHyperliquidMultisignInput(fields, preprocess) {
@@ -1745,7 +1761,7 @@ var hyperliquidOhlcvIntervalSchema = zod.z.enum([
1745
1761
  "1M"
1746
1762
  ]);
1747
1763
  var hyperliquidFetchChainInputSchema = zod.z.object({
1748
- chainId: agentEvmChainIdSchema
1764
+ chainId: zod.z.coerce.number().int().positive().default(999).describe("Hyperliquid EVM chain id (999 mainnet, 998 testnet).")
1749
1765
  });
1750
1766
  var hyperliquidPositionRowSchema = zod.z.object({
1751
1767
  key: zod.z.string(),
@@ -1796,7 +1812,7 @@ var mcpHyperliquidFetchMarketsOutputSchema = zod.z.object({
1796
1812
  var mcpHyperliquidSearchMarketsInputSchema = hyperliquidFetchChainInputSchema.extend({
1797
1813
  query: zod.z.string().min(1),
1798
1814
  dex: zod.z.string().optional(),
1799
- limit: zod.z.number().int().positive().max(50).optional()
1815
+ limit: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(50))
1800
1816
  });
1801
1817
  var mcpHyperliquidSearchMarketsOutputSchema = zod.z.object({
1802
1818
  matches: zod.z.array(
@@ -1855,7 +1871,7 @@ var mcpHyperliquidFetchMarketSnapshotInputSchema = hyperliquidFetchChainInputSch
1855
1871
  coin: zod.z.string().min(1),
1856
1872
  interval: hyperliquidOhlcvIntervalSchema.optional(),
1857
1873
  dex: zod.z.string().optional(),
1858
- candleLimit: zod.z.number().int().positive().max(200).optional()
1874
+ candleLimit: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(200))
1859
1875
  });
1860
1876
  var hyperliquidOhlcvCandleSchema = zod.z.object({
1861
1877
  timestampMs: zod.z.number(),
@@ -1892,10 +1908,10 @@ var mcpHyperliquidFetchOhlcvInputSchema = hyperliquidFetchChainInputSchema.exten
1892
1908
  coin: zod.z.string().min(1),
1893
1909
  interval: hyperliquidOhlcvIntervalSchema.optional(),
1894
1910
  dex: zod.z.string().optional(),
1895
- lookbackDays: zod.z.number().positive().max(90).optional(),
1896
- lookbackHours: zod.z.number().positive().max(90 * 24).optional(),
1897
- startTimeMs: zod.z.number().int().positive().optional(),
1898
- endTimeMs: zod.z.number().int().positive().optional()
1911
+ lookbackDays: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(90)),
1912
+ lookbackHours: agentCoercedOptionalIntSchema(zod.z.number().int().positive().max(90 * 24)),
1913
+ startTimeMs: agentCoercedOptionalIntSchema(zod.z.number().int().positive()),
1914
+ endTimeMs: agentCoercedOptionalIntSchema(zod.z.number().int().positive())
1899
1915
  });
1900
1916
  var mcpHyperliquidFetchOhlcvOutputSchema = zod.z.object({
1901
1917
  ohlcv: zod.z.object({
@@ -1992,7 +2008,7 @@ var mcpHyperliquidCloseInputSchema = mcpHyperliquidMultisignInput(
1992
2008
  var mcpHyperliquidCancelInputSchema = mcpHyperliquidMultisignInput(
1993
2009
  {
1994
2010
  coin: zod.z.string().min(1),
1995
- oid: zod.z.number().int().positive().describe("oid from fetch_open_orders"),
2011
+ oid: agentCoercedIntSchema(zod.z.number().int().positive()).describe("oid from fetch_open_orders"),
1996
2012
  marketKind: zod.z.enum(["perp", "spot"]).optional(),
1997
2013
  dex: zod.z.string().optional()
1998
2014
  },
@@ -2002,6 +2018,13 @@ var mcpHyperliquidUsdTransferInputSchema = mcpHyperliquidMultisignInput({
2002
2018
  usdHuman: zod.z.string().min(1),
2003
2019
  toPerp: agentBooleanSchema()
2004
2020
  });
2021
+ var mcpHyperliquidBridgeDepositInputSchema = mcpHyperliquidMultisignInput({
2022
+ usdHuman: zod.z.string().min(1).describe("USDC amount (minimum 5)")
2023
+ });
2024
+ var mcpHyperliquidBridgeWithdrawInputSchema = mcpHyperliquidMultisignInput({
2025
+ usdHuman: zod.z.string().min(1),
2026
+ destination: evmAddressSchema.optional().describe("Arbitrum recipient; defaults to executor")
2027
+ });
2005
2028
  var mcpHyperliquidVaultDepositInputSchema = mcpHyperliquidMultisignInput(
2006
2029
  {
2007
2030
  vaultAddress: evmAddressSchema.describe("vaultAddress from fetch_vaults"),
@@ -2034,6 +2057,16 @@ var mcpHyperliquidUndelegateInputSchema = mcpHyperliquidMultisignInput(
2034
2057
  },
2035
2058
  preprocessHyperliquidUndelegateInput
2036
2059
  );
2060
+ var mcpHyperliquidUpdateLeverageInputSchema = mcpHyperliquidMultisignInput(
2061
+ {
2062
+ coin: zod.z.string().min(1).describe("coin from fetch_markets, search_markets, or open_context"),
2063
+ leverage: agentCoercedIntSchema(zod.z.number().int().positive()).describe("Target leverage (1..maxLeverage from market row)"),
2064
+ isCross: agentBooleanSchema().optional().describe("true = cross margin (default); false = isolated margin for this market"),
2065
+ marketKind: zod.z.enum(["perp", "spot"]).optional().describe("perp (default)"),
2066
+ dex: zod.z.string().optional().describe("HIP-3 dex when applicable")
2067
+ },
2068
+ preprocessHyperliquidCoinInput
2069
+ );
2037
2070
  var mcpCctpFeeFieldsSchema = zod.z.object({
2038
2071
  feeTierUsed: zod.z.enum(["low", "med", "high"]),
2039
2072
  maxFee: zod.z.string().describe("Selected tier max fee in USDC base units (6 decimals)"),
@@ -2084,7 +2117,7 @@ var mcpCctpFetchUsdcBalanceOutputSchema = jsonObjectSchema.describe(
2084
2117
  );
2085
2118
  var mcpCctpFetchTransferStatusInputSchema = zod.z.object({
2086
2119
  sourceChainId: agentEvmChainIdSchema.describe("Source chain where burn was executed"),
2087
- sourceDomain: zod.z.number().int().min(0).describe("CCTP domain id of source chain"),
2120
+ sourceDomain: agentCoercedIntSchema(zod.z.number().int().min(0)).describe("CCTP domain id of source chain"),
2088
2121
  burnTxHash: zod.z.string().min(1).describe("Burn transaction hash (0x-prefixed or raw)")
2089
2122
  });
2090
2123
  var mcpCctpFetchTransferStatusOutputSchema = jsonObjectSchema.describe(
@@ -2095,7 +2128,7 @@ var mcpCctpBuildBurnMultisignInputSchema = mcpMultisignInput({
2095
2128
  transferAmountHuman: zod.z.string().min(1).describe("Human USDC amount recipient receives"),
2096
2129
  mintRecipient: evmAddressSchema.optional().describe("Recipient on destination chain; defaults to MPC executor address"),
2097
2130
  feeTier: zod.z.enum(["low", "med", "high"]).optional(),
2098
- minFinalityThreshold: zod.z.number().int().positive().optional(),
2131
+ minFinalityThreshold: agentCoercedOptionalIntSchema(zod.z.number().int().positive()),
2099
2132
  feeSnapshot: jsonObjectSchema.optional().describe("Optional output from ctm_cctp_fetch_burn_fees")
2100
2133
  });
2101
2134
 
@@ -2593,6 +2626,32 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
2593
2626
  },
2594
2627
  inputZod: mcpHyperliquidUsdTransferInputSchema
2595
2628
  }),
2629
+ defineProtocolMcpTool({
2630
+ name: "ctm_hyperliquid_build_bridge_deposit_multisign",
2631
+ actionId: "hyperliquid.bridgeDeposit",
2632
+ protocolId: "hyperliquid",
2633
+ chainCategory: "evm",
2634
+ 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.",
2635
+ prerequisites: ["keyGen", "executorAddress", "Arbitrum USDC balance", "usdHuman (min 5)"],
2636
+ handler: {
2637
+ importPath: "protocols/evm/hyperliquid",
2638
+ exportName: "buildEvmMultisignBodyHyperliquidBridgeDepositBatch"
2639
+ },
2640
+ inputZod: mcpHyperliquidBridgeDepositInputSchema
2641
+ }),
2642
+ defineProtocolMcpTool({
2643
+ name: "ctm_hyperliquid_build_bridge_withdraw_multisign",
2644
+ actionId: "hyperliquid.bridgeWithdraw",
2645
+ protocolId: "hyperliquid",
2646
+ chainCategory: "evm",
2647
+ 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.",
2648
+ prerequisites: ["keyGen", "executorAddress", "Hyperliquid withdrawable balance", "usdHuman"],
2649
+ handler: {
2650
+ importPath: "protocols/evm/hyperliquid",
2651
+ exportName: "buildHyperliquidBridgeWithdrawMultisign"
2652
+ },
2653
+ inputZod: mcpHyperliquidBridgeWithdrawInputSchema
2654
+ }),
2596
2655
  defineProtocolMcpTool({
2597
2656
  name: "ctm_hyperliquid_build_vault_deposit_multisign",
2598
2657
  actionId: "hyperliquid.vaultDeposit",
@@ -2653,6 +2712,27 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
2653
2712
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidUndelegateBatch" },
2654
2713
  inputZod: mcpHyperliquidUndelegateInputSchema
2655
2714
  }),
2715
+ defineProtocolMcpTool({
2716
+ name: "ctm_hyperliquid_build_update_leverage_multisign",
2717
+ actionId: "hyperliquid.updateLeverage",
2718
+ protocolId: "hyperliquid",
2719
+ chainCategory: "evm",
2720
+ 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.",
2721
+ prerequisites: [
2722
+ "keyGenId",
2723
+ "chainId 999 or 998",
2724
+ "coin",
2725
+ "leverage <= maxLeverage from fetch_markets or open_context",
2726
+ "ctm_hyperliquid_fetch_open_context for current leverageLabel"
2727
+ ],
2728
+ followUp: [
2729
+ "sign_request_agree",
2730
+ "trigger_sign_result",
2731
+ "broadcast_sign_result"
2732
+ ],
2733
+ handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildHyperliquidUpdateLeverageMultisign" },
2734
+ inputZod: mcpHyperliquidUpdateLeverageInputSchema
2735
+ }),
2656
2736
  defineProtocolMcpTool({
2657
2737
  name: "ctm_cctp_build_burn_multisign",
2658
2738
  actionId: "circle-cctp.burn-forward",
@@ -3041,7 +3121,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3041
3121
  chainCategory: "evm",
3042
3122
  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.",
3043
3123
  prerequisites: ["chainId 999 or 998"],
3044
- followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
3124
+ followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3045
3125
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchMarketsSummary" },
3046
3126
  inputZod: mcpHyperliquidFetchMarketsInputSchema,
3047
3127
  outputZod: mcpHyperliquidFetchMarketsOutputSchema
@@ -3053,7 +3133,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3053
3133
  chainCategory: "evm",
3054
3134
  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).",
3055
3135
  prerequisites: ["chainId 999 or 998", "query"],
3056
- followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
3136
+ followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3057
3137
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidSearchMarketsSummary" },
3058
3138
  inputZod: mcpHyperliquidSearchMarketsInputSchema,
3059
3139
  outputZod: mcpHyperliquidSearchMarketsOutputSchema
@@ -3065,7 +3145,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3065
3145
  chainCategory: "evm",
3066
3146
  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.",
3067
3147
  prerequisites: ["chainId", "executorAddress", "coin from fetch_markets"],
3068
- followUp: ["ctm_hyperliquid_build_limit_order_multisign"],
3148
+ followUp: ["ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3069
3149
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchOpenContextSummary" },
3070
3150
  inputZod: mcpHyperliquidFetchOpenContextInputSchema,
3071
3151
  outputZod: mcpHyperliquidFetchOpenContextOutputSchema
@@ -3101,7 +3181,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3101
3181
  chainCategory: "evm",
3102
3182
  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.",
3103
3183
  prerequisites: ["chainId", "coin"],
3104
- followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
3184
+ followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign", "ctm_hyperliquid_build_update_leverage_multisign"],
3105
3185
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchMarketSnapshotSummary" },
3106
3186
  inputZod: mcpHyperliquidFetchMarketSnapshotInputSchema,
3107
3187
  outputZod: mcpHyperliquidFetchMarketSnapshotOutputSchema
@@ -3111,7 +3191,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
3111
3191
  actionId: "hyperliquid.fetch-ohlcv",
3112
3192
  protocolId: "hyperliquid",
3113
3193
  chainCategory: "evm",
3114
- 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.",
3194
+ 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.',
3115
3195
  prerequisites: ["chainId 999 or 998", "coin", "lookbackDays or lookbackHours or startTimeMs"],
3116
3196
  followUp: ["ctm_hyperliquid_fetch_market_snapshot", "continuum__prepare_chart_from_rows", "ctm_hyperliquid_build_limit_order_multisign"],
3117
3197
  handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchOhlcvSummary" },
@@ -3699,11 +3779,15 @@ function isGmxChainSupported(chainId) {
3699
3779
  }
3700
3780
  var require2 = module$1.createRequire(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('catalog.cjs', document.baseURI).href))));
3701
3781
  var { GmxApiSdk } = require2("@gmx-io/sdk/v2");
3782
+ var { getApiUrl, getApiFallbackUrls } = require2("@gmx-io/sdk/configs/api");
3702
3783
  var GMX_HTTP_TIMEOUT_MS = 3e4;
3703
- var GMX_API_BASE_URLS = {
3704
- 42161: ["https://arbitrum.gmxapi.io", "https://arbitrum.gmxapi.ai"],
3705
- 43114: ["https://avalanche.gmxapi.io", "https://avalanche.gmxapi.ai"]
3706
- };
3784
+ function gmxResolvedApiBaseUrls(chainId) {
3785
+ const primary = getApiUrl(chainId);
3786
+ if (!primary) {
3787
+ throw new Error(`GMX API URLs are not configured for chain ${chainId}.`);
3788
+ }
3789
+ return [primary, ...getApiFallbackUrls(chainId)];
3790
+ }
3707
3791
  function buildGmxUrl(baseUrl, path, query) {
3708
3792
  const base = baseUrl.replace(/\/$/, "");
3709
3793
  if (!query) return `${base}${path}`;
@@ -3768,10 +3852,7 @@ async function gmxHttpPostJson(baseUrl, path, body, opts) {
3768
3852
  }
3769
3853
  }
3770
3854
  function createIoFirstGmxHttpApi(chainId) {
3771
- const urls = GMX_API_BASE_URLS[chainId];
3772
- if (!urls) {
3773
- throw new Error(`GMX API URLs are not configured for chain ${chainId}.`);
3774
- }
3855
+ const urls = gmxResolvedApiBaseUrls(chainId);
3775
3856
  async function withIoFirstFallback(fn) {
3776
3857
  let lastError;
3777
3858
  for (const baseUrl of urls) {
@@ -4042,6 +4123,40 @@ var hyperliquidProtocolModule = {
4042
4123
  validator: { type: "string", required: true, description: "Validator address" }
4043
4124
  }
4044
4125
  },
4126
+ {
4127
+ id: "hyperliquid.bridgeDeposit",
4128
+ protocolId: HYPERLIQUID_PROTOCOL_ID,
4129
+ chainCategory: "evm",
4130
+ description: "Deposit USDC from Arbitrum to Hyperliquid via Bridge2 (ERC20 transfer)",
4131
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
4132
+ params: {
4133
+ usdHuman: { type: "string", required: true, description: "USDC amount (min 5)" }
4134
+ }
4135
+ },
4136
+ {
4137
+ id: "hyperliquid.bridgeWithdraw",
4138
+ protocolId: HYPERLIQUID_PROTOCOL_ID,
4139
+ chainCategory: "evm",
4140
+ description: "Withdraw USDC from Hyperliquid to Arbitrum via withdraw3 (EIP-712 /exchange)",
4141
+ commonParams: ["keyGen", "purposeText"],
4142
+ params: {
4143
+ usdHuman: { type: "string", required: true, description: "USDC amount" },
4144
+ destination: { type: "string", required: false, description: "Arbitrum recipient (defaults to executor)" }
4145
+ }
4146
+ },
4147
+ {
4148
+ id: "hyperliquid.updateLeverage",
4149
+ protocolId: HYPERLIQUID_PROTOCOL_ID,
4150
+ chainCategory: "evm",
4151
+ description: "Update per-market cross/isolated leverage via Hyperliquid L1 /exchange (EIP-712)",
4152
+ commonParams: ["keyGen", "purposeText"],
4153
+ params: {
4154
+ coin: { type: "string", required: true, description: "Market coin e.g. BTC" },
4155
+ leverage: { type: "number", required: true, description: "New leverage (1..market max)" },
4156
+ isCross: { type: "boolean", required: false, description: "true for cross (default), false for isolated" },
4157
+ marketKind: { type: "string", required: false, description: "perp (default) or spot" }
4158
+ }
4159
+ },
4045
4160
  {
4046
4161
  id: "hyperliquid.undelegate",
4047
4162
  protocolId: HYPERLIQUID_PROTOCOL_ID,
@@ -4723,6 +4838,17 @@ var PROTOCOL_SUPPORT_ADVISORS = {
4723
4838
  return false;
4724
4839
  }
4725
4840
  }
4841
+ }),
4842
+ hyperliquid: advisor("hyperliquid", "api_underlyings", {
4843
+ async supportedChainIds() {
4844
+ return [...HYPERLIQUID_SUPPORTED_CHAIN_IDS];
4845
+ },
4846
+ async supportedTokens() {
4847
+ return {
4848
+ tokens: [],
4849
+ notes: "Hyperliquid perp coins from fetch_markets; chainId 999 mainnet or 998 testnet for HyperEVM multisign."
4850
+ };
4851
+ }
4726
4852
  })
4727
4853
  };
4728
4854
  function getProtocolSupportAdvisor(protocolId) {
@@ -4841,6 +4967,8 @@ exports.mcpGmxIncreaseInputSchema = mcpGmxIncreaseInputSchema;
4841
4967
  exports.mcpGmxMultisignOutputSchema = mcpServerSubmitOutputSchema;
4842
4968
  exports.mcpGmxStakeGmxInputSchema = mcpGmxStakeGmxInputSchema;
4843
4969
  exports.mcpGmxUnstakeGmxInputSchema = mcpGmxUnstakeGmxInputSchema;
4970
+ exports.mcpHyperliquidBridgeDepositInputSchema = mcpHyperliquidBridgeDepositInputSchema;
4971
+ exports.mcpHyperliquidBridgeWithdrawInputSchema = mcpHyperliquidBridgeWithdrawInputSchema;
4844
4972
  exports.mcpHyperliquidCancelInputSchema = mcpHyperliquidCancelInputSchema;
4845
4973
  exports.mcpHyperliquidCloseInputSchema = mcpHyperliquidCloseInputSchema;
4846
4974
  exports.mcpHyperliquidDelegateInputSchema = mcpHyperliquidDelegateInputSchema;
@@ -4872,6 +5000,7 @@ exports.mcpHyperliquidSearchMarketsOutputSchema = mcpHyperliquidSearchMarketsOut
4872
5000
  exports.mcpHyperliquidStakeInputSchema = mcpHyperliquidStakeInputSchema;
4873
5001
  exports.mcpHyperliquidUndelegateInputSchema = mcpHyperliquidUndelegateInputSchema;
4874
5002
  exports.mcpHyperliquidUnstakeInputSchema = mcpHyperliquidUnstakeInputSchema;
5003
+ exports.mcpHyperliquidUpdateLeverageInputSchema = mcpHyperliquidUpdateLeverageInputSchema;
4875
5004
  exports.mcpHyperliquidUsdTransferInputSchema = mcpHyperliquidUsdTransferInputSchema;
4876
5005
  exports.mcpHyperliquidVaultDepositInputSchema = mcpHyperliquidVaultDepositInputSchema;
4877
5006
  exports.mcpHyperliquidVaultWithdrawInputSchema = mcpHyperliquidVaultWithdrawInputSchema;