@continuumdao/ctm-mpc-defi 0.2.9 → 0.2.10

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 (36) hide show
  1. package/dist/agent/catalog.cjs +519 -19
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +618 -14
  4. package/dist/agent/catalog.js +507 -20
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/hyperliquid/SKILL.md +34 -6
  7. package/dist/agent/skills/morpho/SKILL.md +48 -0
  8. package/dist/core/index.cjs +9 -0
  9. package/dist/core/index.cjs.map +1 -1
  10. package/dist/core/index.d.ts +3 -1
  11. package/dist/core/index.js +8 -1
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/index.cjs +9 -0
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +8 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  19. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  20. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  21. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  22. package/dist/protocols/evm/hyperliquid/index.cjs +407 -34
  23. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  24. package/dist/protocols/evm/hyperliquid/index.d.ts +168 -15
  25. package/dist/protocols/evm/hyperliquid/index.js +390 -35
  26. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  27. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  28. package/dist/protocols/evm/maple/index.js.map +1 -1
  29. package/dist/protocols/evm/morpho/index.cjs +1971 -0
  30. package/dist/protocols/evm/morpho/index.cjs.map +1 -0
  31. package/dist/protocols/evm/morpho/index.d.ts +522 -0
  32. package/dist/protocols/evm/morpho/index.js +1918 -0
  33. package/dist/protocols/evm/morpho/index.js.map +1 -0
  34. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  35. package/dist/protocols/evm/sky/index.js.map +1 -1
  36. package/package.json +6 -1
@@ -26,6 +26,12 @@ function hyperliquidVaultStatsUrl(chainId) {
26
26
  return chainId === 998 ? null : "https://stats-data.hyperliquid.xyz/Mainnet/vaults";
27
27
  }
28
28
  var HYPERLIQUID_HLP_VAULT_ADDRESS = "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303";
29
+ function hyperliquidInferDexFromCoin(coin) {
30
+ const trimmed = coin.trim();
31
+ const sep = trimmed.indexOf(":");
32
+ if (sep <= 0) return void 0;
33
+ return trimmed.slice(0, sep);
34
+ }
29
35
 
30
36
  // src/protocols/evm/hyperliquid/constants.ts
31
37
  var HYPERLIQUID_CORE_WRITER_ADDRESS = "0x3333333333333333333333333333333333333333";
@@ -36,6 +42,28 @@ var HYPERLIQUID_TIF = {
36
42
  gtc: 2,
37
43
  ioc: 3
38
44
  };
45
+ var HYPERLIQUID_INTERVAL_MS = {
46
+ "1m": 6e4,
47
+ "3m": 18e4,
48
+ "5m": 3e5,
49
+ "15m": 9e5,
50
+ "30m": 18e5,
51
+ "1h": 36e5,
52
+ "2h": 72e5,
53
+ "4h": 144e5,
54
+ "8h": 288e5,
55
+ "12h": 432e5,
56
+ "1d": 864e5,
57
+ "3d": 2592e5,
58
+ "1w": 6048e5,
59
+ "1M": 2592e6
60
+ };
61
+ var HYPERLIQUID_DEFAULT_OHLCV_INTERVAL = "15m";
62
+ var HYPERLIQUID_DEFAULT_CANDLE_LIMIT = 48;
63
+ var HYPERLIQUID_MAX_CANDLE_LIMIT = 200;
64
+ var HYPERLIQUID_MAX_OHLCV_BARS = 2e3;
65
+ var HYPERLIQUID_DEFAULT_LOOKBACK_DAYS = 1;
66
+ var HYPERLIQUID_MAX_LOOKBACK_DAYS = 90;
39
67
 
40
68
  // src/protocols/evm/hyperliquid/api.ts
41
69
  async function hyperliquidInfoPost(chainId, body) {
@@ -86,19 +114,8 @@ async function hyperliquidFetchAllMids(args) {
86
114
  const mids = await hyperliquidInfoPost(args.chainId, req);
87
115
  return { mids };
88
116
  }
89
- async function hyperliquidFetchCandles(args) {
90
- const endTime = args.endTimeMs ?? Date.now();
91
- const startTime = args.startTimeMs ?? endTime - 7 * 24 * 60 * 60 * 1e3;
92
- const raw = await hyperliquidInfoPost(args.chainId, {
93
- type: "candleSnapshot",
94
- req: {
95
- coin: args.coin,
96
- interval: args.interval,
97
- startTime,
98
- endTime
99
- }
100
- });
101
- const candles = (raw ?? []).map((c) => ({
117
+ function hyperliquidMapCandles(raw) {
118
+ return (raw ?? []).map((c) => ({
102
119
  timestampMs: c.t,
103
120
  open: c.o,
104
121
  high: c.h,
@@ -106,20 +123,180 @@ async function hyperliquidFetchCandles(args) {
106
123
  close: c.c,
107
124
  volume: c.v
108
125
  }));
109
- return { candles };
126
+ }
127
+ async function hyperliquidFetchCandlesRaw(args) {
128
+ const raw = await hyperliquidInfoPost(args.chainId, {
129
+ type: "candleSnapshot",
130
+ req: {
131
+ coin: args.coin,
132
+ interval: args.interval,
133
+ startTime: args.startTimeMs,
134
+ endTime: args.endTimeMs
135
+ }
136
+ });
137
+ return hyperliquidMapCandles(raw);
138
+ }
139
+ function hyperliquidResolveOhlcvWindow(args) {
140
+ const endTimeMs = args.endTimeMs ?? Date.now();
141
+ const intervalMs = HYPERLIQUID_INTERVAL_MS[args.interval] ?? HYPERLIQUID_INTERVAL_MS["15m"];
142
+ let startTimeMs;
143
+ if (args.startTimeMs != null) {
144
+ startTimeMs = args.startTimeMs;
145
+ } else if (args.lookbackDays != null) {
146
+ if (args.lookbackDays <= 0 || args.lookbackDays > HYPERLIQUID_MAX_LOOKBACK_DAYS) {
147
+ throw new Error(`lookbackDays must be between 1 and ${HYPERLIQUID_MAX_LOOKBACK_DAYS}`);
148
+ }
149
+ startTimeMs = endTimeMs - args.lookbackDays * 864e5;
150
+ } else if (args.lookbackHours != null) {
151
+ if (args.lookbackHours <= 0 || args.lookbackHours > HYPERLIQUID_MAX_LOOKBACK_DAYS * 24) {
152
+ throw new Error(`lookbackHours must be between 1 and ${HYPERLIQUID_MAX_LOOKBACK_DAYS * 24}`);
153
+ }
154
+ startTimeMs = endTimeMs - args.lookbackHours * 36e5;
155
+ } else {
156
+ startTimeMs = endTimeMs - HYPERLIQUID_DEFAULT_LOOKBACK_DAYS * 864e5;
157
+ }
158
+ if (!Number.isFinite(startTimeMs) || !Number.isFinite(endTimeMs) || startTimeMs >= endTimeMs) {
159
+ throw new Error("Invalid OHLCV time range: startTimeMs must be before endTimeMs");
160
+ }
161
+ const expectedBars = Math.ceil((endTimeMs - startTimeMs) / intervalMs);
162
+ if (expectedBars > HYPERLIQUID_MAX_OHLCV_BARS) {
163
+ throw new Error(
164
+ `OHLCV range needs ~${expectedBars} bars at ${args.interval} (max ${HYPERLIQUID_MAX_OHLCV_BARS}). Use a coarser interval or shorter lookback.`
165
+ );
166
+ }
167
+ return { startTimeMs, endTimeMs, expectedBars };
168
+ }
169
+ async function hyperliquidFetchCandles(args) {
170
+ const endTime = args.endTimeMs ?? Date.now();
171
+ const intervalMs = HYPERLIQUID_INTERVAL_MS[args.interval] ?? HYPERLIQUID_INTERVAL_MS["15m"];
172
+ const limit = Math.min(Math.max(args.limit ?? HYPERLIQUID_DEFAULT_CANDLE_LIMIT, 1), HYPERLIQUID_MAX_CANDLE_LIMIT);
173
+ const startTime = args.startTimeMs ?? endTime - intervalMs * (limit + 4);
174
+ const candles = await hyperliquidFetchCandlesRaw({
175
+ chainId: args.chainId,
176
+ coin: args.coin,
177
+ interval: args.interval,
178
+ startTimeMs: startTime,
179
+ endTimeMs: endTime
180
+ });
181
+ return { candles: candles.slice(-limit) };
182
+ }
183
+ async function hyperliquidFetchOhlcvRange(args) {
184
+ const coin = args.coin.trim();
185
+ const interval = args.interval ?? HYPERLIQUID_DEFAULT_OHLCV_INTERVAL;
186
+ const dex = args.dex?.trim() || hyperliquidInferDexFromCoin(coin) || null;
187
+ const { startTimeMs, endTimeMs, expectedBars } = hyperliquidResolveOhlcvWindow({
188
+ interval,
189
+ lookbackDays: args.lookbackDays,
190
+ lookbackHours: args.lookbackHours,
191
+ startTimeMs: args.startTimeMs,
192
+ endTimeMs: args.endTimeMs
193
+ });
194
+ const candles = await hyperliquidFetchCandlesRaw({
195
+ chainId: args.chainId,
196
+ coin,
197
+ interval,
198
+ startTimeMs,
199
+ endTimeMs
200
+ });
201
+ if (candles.length === 0) {
202
+ throw new Error(
203
+ `No OHLCV data for ${coin} between ${startTimeMs} and ${endTimeMs} at ${interval}. Check coin/dex.`
204
+ );
205
+ }
206
+ const latestCandle = candles.length > 0 ? candles[candles.length - 1] : null;
207
+ return {
208
+ coin,
209
+ dex,
210
+ interval,
211
+ startTimeMs,
212
+ endTimeMs,
213
+ expectedBars,
214
+ candleCount: candles.length,
215
+ latestCandle,
216
+ candles,
217
+ fetchedAtMs: Date.now()
218
+ };
219
+ }
220
+ async function hyperliquidFetchPerpAssetContext(args) {
221
+ const coin = args.coin.trim();
222
+ const dex = args.dex?.trim() || hyperliquidInferDexFromCoin(coin) || "";
223
+ const req = { type: "metaAndAssetCtxs" };
224
+ if (dex) req.dex = dex;
225
+ const raw = await hyperliquidInfoPost(args.chainId, req);
226
+ const universe = raw?.[0]?.universe ?? [];
227
+ const contexts = raw?.[1] ?? [];
228
+ const idx = universe.findIndex((u) => u.name === coin);
229
+ if (idx < 0) {
230
+ throw new Error(`Hyperliquid asset context not found for ${coin}${dex ? ` on dex ${dex}` : ""}`);
231
+ }
232
+ const ctx = contexts[idx] ?? {};
233
+ const str = (v) => {
234
+ const s = String(v ?? "").trim();
235
+ return s || null;
236
+ };
237
+ return {
238
+ markPx: str(ctx.markPx),
239
+ midPx: str(ctx.midPx),
240
+ oraclePx: str(ctx.oraclePx),
241
+ prevDayPx: str(ctx.prevDayPx),
242
+ funding: str(ctx.funding),
243
+ openInterest: str(ctx.openInterest)
244
+ };
245
+ }
246
+ function hyperliquidPickLivePrice(args) {
247
+ const midUsd = args.midPx ?? args.markPx ?? args.midFromAllMids;
248
+ if (!midUsd) {
249
+ throw new Error("Could not fetch live Hyperliquid price (mark, mid, and allMids all empty)");
250
+ }
251
+ const source = args.midPx ? "midPx" : args.markPx ? "markPx" : "allMids";
252
+ return {
253
+ markPx: args.markPx,
254
+ midPx: args.midPx,
255
+ oraclePx: null,
256
+ prevDayPx: null,
257
+ midUsd,
258
+ source
259
+ };
110
260
  }
111
261
  async function hyperliquidFetchMarketSnapshot(args) {
112
- const interval = args.interval ?? "1h";
113
- const [{ mids }, { candles }] = await Promise.all([
114
- hyperliquidFetchAllMids({ chainId: args.chainId, dex: args.dex }),
115
- hyperliquidFetchCandles({ chainId: args.chainId, coin: args.coin, interval })
262
+ const coin = args.coin.trim();
263
+ const interval = args.interval ?? HYPERLIQUID_DEFAULT_OHLCV_INTERVAL;
264
+ const dex = args.dex?.trim() || hyperliquidInferDexFromCoin(coin) || null;
265
+ const candleLimit = Math.min(
266
+ Math.max(args.candleLimit ?? HYPERLIQUID_DEFAULT_CANDLE_LIMIT, 1),
267
+ HYPERLIQUID_MAX_CANDLE_LIMIT
268
+ );
269
+ const [{ mids }, assetCtx, { candles }] = await Promise.all([
270
+ hyperliquidFetchAllMids({ chainId: args.chainId, dex: dex ?? void 0 }),
271
+ hyperliquidFetchPerpAssetContext({ chainId: args.chainId, coin, dex: dex ?? void 0 }),
272
+ hyperliquidFetchCandles({
273
+ chainId: args.chainId,
274
+ coin,
275
+ interval,
276
+ limit: candleLimit
277
+ })
116
278
  ]);
279
+ const midFromAllMids = mids[coin] ?? null;
280
+ const livePrice = {
281
+ ...hyperliquidPickLivePrice({
282
+ markPx: assetCtx.markPx,
283
+ midPx: assetCtx.midPx,
284
+ midFromAllMids
285
+ }),
286
+ oraclePx: assetCtx.oraclePx,
287
+ prevDayPx: assetCtx.prevDayPx
288
+ };
289
+ const latestCandle = candles.length > 0 ? candles[candles.length - 1] : null;
117
290
  return {
118
- coin: args.coin,
119
- midUsd: mids[args.coin] ?? null,
291
+ coin,
292
+ dex,
293
+ livePrice,
294
+ midUsd: livePrice.midUsd,
120
295
  fetchedAtMs: Date.now(),
121
296
  interval,
122
- candles
297
+ latestCandle,
298
+ candles,
299
+ candleCount: candles.length
123
300
  };
124
301
  }
125
302
  async function hyperliquidFetchClearinghouseState(args) {
@@ -264,6 +441,21 @@ async function hyperliquidFetchDexList(args) {
264
441
  }
265
442
  return { dexes };
266
443
  }
444
+ async function hyperliquidFetchPerpConciseAnnotations(args) {
445
+ const raw = await hyperliquidInfoPost(args.chainId, {
446
+ type: "perpConciseAnnotations"
447
+ });
448
+ const map = /* @__PURE__ */ new Map();
449
+ if (!Array.isArray(raw)) return map;
450
+ for (const entry of raw) {
451
+ if (!Array.isArray(entry) || entry.length < 2) continue;
452
+ const coin = String(entry[0] ?? "").trim();
453
+ const meta = entry[1];
454
+ if (!coin || !meta || typeof meta !== "object") continue;
455
+ map.set(coin, meta);
456
+ }
457
+ return map;
458
+ }
267
459
  async function hyperliquidFetchDelegations(args) {
268
460
  const raw = await hyperliquidInfoPost(args.chainId, {
269
461
  type: "delegations",
@@ -279,13 +471,138 @@ async function hyperliquidFetchStakingSummary(args) {
279
471
  return { delegated: raw?.delegated ?? "0", undelegated: raw?.undelegated ?? "0" };
280
472
  }
281
473
 
474
+ // src/protocols/evm/hyperliquid/marketSearch.ts
475
+ function normalizeQuery(value) {
476
+ return value.trim().toLowerCase();
477
+ }
478
+ function compactCoin(value) {
479
+ return normalizeQuery(value).replace(/[^a-z0-9]/g, "");
480
+ }
481
+ function hyperliquidMarketSymbol(coin) {
482
+ const sep = coin.indexOf(":");
483
+ return sep >= 0 ? coin.slice(sep + 1) : coin;
484
+ }
485
+ function scoreMarketMatch(query, market, annotation) {
486
+ const q = normalizeQuery(query);
487
+ if (!q) return null;
488
+ const coin = market.name;
489
+ const symbol = hyperliquidMarketSymbol(coin);
490
+ const coinLower = normalizeQuery(coin);
491
+ const symbolLower = normalizeQuery(symbol);
492
+ if (coinLower === q) return { score: 100, reason: "exact coin name" };
493
+ if (symbolLower === q) return { score: 95, reason: "exact ticker symbol" };
494
+ if (compactCoin(coin) === compactCoin(q)) return { score: 92, reason: "coin name without separators" };
495
+ if (annotation?.displayName) {
496
+ const display = normalizeQuery(annotation.displayName);
497
+ if (display === q) return { score: 94, reason: "exact display name" };
498
+ if (display.includes(q) || q.includes(display)) return { score: 72, reason: "display name partial match" };
499
+ }
500
+ for (const keyword of annotation?.keywords ?? []) {
501
+ const kw = normalizeQuery(keyword);
502
+ if (!kw) continue;
503
+ if (kw === q) return { score: 88, reason: `keyword "${keyword}"` };
504
+ if (kw.includes(q) || q.includes(kw)) return { score: 68, reason: `keyword partial "${keyword}"` };
505
+ }
506
+ if (symbolLower.includes(q) || q.includes(symbolLower)) {
507
+ return { score: 78, reason: "ticker partial match" };
508
+ }
509
+ if (!coin.includes(":") && coinLower.includes(q)) {
510
+ return { score: 65, reason: "native coin partial match" };
511
+ }
512
+ if (market.dex && normalizeQuery(market.dex) === q) {
513
+ return { score: 40, reason: "dex name match" };
514
+ }
515
+ return null;
516
+ }
517
+ async function hyperliquidCollectAllPerpMarkets(args) {
518
+ const dexFilter = args.dex?.trim();
519
+ const { dexes } = await hyperliquidFetchDexList({ chainId: args.chainId });
520
+ if (dexFilter) {
521
+ const { markets: markets2 } = await hyperliquidFetchPerpMeta({ chainId: args.chainId, dex: dexFilter });
522
+ return { markets: markets2.map((m) => ({ ...m, dex: dexFilter })), dexes };
523
+ }
524
+ const { markets: nativeMarkets } = await hyperliquidFetchPerpMeta({ chainId: args.chainId });
525
+ const markets = [...nativeMarkets];
526
+ const hip3Batches = await Promise.all(
527
+ dexes.map(async (d) => {
528
+ const { markets: dexMarkets } = await hyperliquidFetchPerpMeta({ chainId: args.chainId, dex: d.name });
529
+ return dexMarkets.map((m) => ({ ...m, dex: d.name }));
530
+ })
531
+ );
532
+ for (const batch of hip3Batches) markets.push(...batch);
533
+ return { markets, dexes };
534
+ }
535
+ async function hyperliquidSearchMarkets(args) {
536
+ const query = args.query.trim();
537
+ if (!query) return { matches: [] };
538
+ const limit = Math.max(1, Math.min(args.limit ?? 20, 50));
539
+ const [{ markets }, annotationMap] = await Promise.all([
540
+ hyperliquidCollectAllPerpMarkets({ chainId: args.chainId, dex: args.dex?.trim() }),
541
+ hyperliquidFetchPerpConciseAnnotations({ chainId: args.chainId })
542
+ ]);
543
+ const hits = [];
544
+ for (const market of markets) {
545
+ const annotation = annotationMap.get(market.name);
546
+ const scored = scoreMarketMatch(query, market, annotation);
547
+ if (!scored || scored.score < 40) continue;
548
+ hits.push({
549
+ coin: market.name,
550
+ symbol: hyperliquidMarketSymbol(market.name),
551
+ dex: market.dex,
552
+ asset: market.asset,
553
+ szDecimals: market.szDecimals,
554
+ maxLeverage: market.maxLeverage,
555
+ onlyIsolated: market.onlyIsolated,
556
+ displayName: annotation?.displayName,
557
+ category: annotation?.category,
558
+ keywords: annotation?.keywords,
559
+ matchScore: scored.score,
560
+ matchReason: scored.reason
561
+ });
562
+ }
563
+ hits.sort((a, b) => b.matchScore - a.matchScore || a.coin.localeCompare(b.coin));
564
+ return { matches: hits.slice(0, limit) };
565
+ }
566
+ async function hyperliquidResolvePerpMarket(args) {
567
+ const coin = args.coin.trim();
568
+ if (!coin) throw new Error("coin is required");
569
+ const dex = args.dex?.trim() || hyperliquidInferDexFromCoin(coin);
570
+ if (dex || !coin.includes(":")) {
571
+ const { markets } = await hyperliquidFetchPerpMeta({ chainId: args.chainId, dex });
572
+ const direct = markets.find((m) => m.name.toLowerCase() === coin.toLowerCase());
573
+ if (direct) {
574
+ return {
575
+ ...direct,
576
+ dex: dex || direct.dex,
577
+ symbol: hyperliquidMarketSymbol(direct.name)
578
+ };
579
+ }
580
+ }
581
+ const { matches } = await hyperliquidSearchMarkets({ chainId: args.chainId, query: coin, dex: args.dex, limit: 10 });
582
+ const bestScore = matches[0]?.matchScore ?? 0;
583
+ if (bestScore < 60) throw new Error(`Unknown Hyperliquid perp market: ${coin}`);
584
+ const top = matches.filter((m) => m.matchScore === bestScore);
585
+ if (top.length === 1) {
586
+ const m = top[0];
587
+ return {
588
+ name: m.coin,
589
+ asset: m.asset,
590
+ szDecimals: m.szDecimals,
591
+ maxLeverage: m.maxLeverage,
592
+ onlyIsolated: m.onlyIsolated,
593
+ dex: m.dex,
594
+ symbol: m.symbol
595
+ };
596
+ }
597
+ throw new Error(
598
+ `Ambiguous Hyperliquid market for "${coin}": ${top.map((m) => m.coin).join(", ")}. Pass dex or full coin name (e.g. xyz:AAPL).`
599
+ );
600
+ }
601
+
282
602
  // src/protocols/evm/hyperliquid/assets.ts
283
603
  async function hyperliquidResolvePerpAsset(args) {
284
- const coin = args.coin.trim();
285
- const { markets } = await hyperliquidFetchPerpMeta({ chainId: args.chainId, dex: args.dex });
286
- const hit = markets.find((m) => m.name.toLowerCase() === coin.toLowerCase());
287
- if (!hit) throw new Error(`Unknown Hyperliquid perp market: ${coin}`);
288
- return { asset: hit.asset, szDecimals: hit.szDecimals, maxLeverage: hit.maxLeverage };
604
+ const resolved = await hyperliquidResolvePerpMarket(args);
605
+ return { asset: resolved.asset, szDecimals: resolved.szDecimals, maxLeverage: resolved.maxLeverage };
289
606
  }
290
607
  async function hyperliquidResolveSpotAsset(args) {
291
608
  const coin = args.coin.trim();
@@ -359,10 +676,16 @@ function mapPositionRow(p) {
359
676
  }
360
677
  async function hyperliquidFetchOpenMarketContext(args) {
361
678
  const user = args.executorAddress.trim().toLowerCase();
362
- const coin = args.coin.trim();
679
+ const resolved = await hyperliquidResolvePerpMarket({
680
+ chainId: args.chainId,
681
+ coin: args.coin,
682
+ dex: args.dex
683
+ });
684
+ const coin = resolved.name;
685
+ const dex = args.dex?.trim() || resolved.dex;
363
686
  const [{ activeAsset }, { state }] = await Promise.all([
364
687
  hyperliquidFetchActiveAssetData({ chainId: args.chainId, user, coin }),
365
- hyperliquidFetchClearinghouseState({ chainId: args.chainId, user, dex: args.dex })
688
+ hyperliquidFetchClearinghouseState({ chainId: args.chainId, user, dex })
366
689
  ]);
367
690
  return {
368
691
  context: {
@@ -397,12 +720,15 @@ async function hyperliquidFetchOrdersForExecutor(args) {
397
720
  });
398
721
  }
399
722
  async function hyperliquidFetchMarketsSummary(args) {
400
- const [{ markets }, { dexes }] = await Promise.all([
401
- hyperliquidFetchPerpMeta({ chainId: args.chainId, dex: args.dex }),
402
- hyperliquidFetchDexList({ chainId: args.chainId })
403
- ]);
723
+ const { markets, dexes } = await hyperliquidCollectAllPerpMarkets({
724
+ chainId: args.chainId,
725
+ dex: args.dex?.trim()
726
+ });
404
727
  return { markets, dexes };
405
728
  }
729
+ async function hyperliquidSearchMarketsSummary(args) {
730
+ return hyperliquidSearchMarkets(args);
731
+ }
406
732
  async function hyperliquidFetchPositionsForExecutor(args) {
407
733
  const { rows } = await hyperliquidFetchPositionDisplayRows(args);
408
734
  return { positions: rows };
@@ -448,8 +774,37 @@ async function hyperliquidFetchDelegationsForExecutor(args) {
448
774
  return { delegations };
449
775
  }
450
776
  async function hyperliquidFetchMarketSnapshotSummary(args) {
451
- const snapshot = await hyperliquidFetchMarketSnapshot(args);
452
- return { snapshot };
777
+ const resolved = await hyperliquidResolvePerpMarket({
778
+ chainId: args.chainId,
779
+ coin: args.coin,
780
+ dex: args.dex
781
+ });
782
+ const snapshot = await hyperliquidFetchMarketSnapshot({
783
+ chainId: args.chainId,
784
+ coin: resolved.name,
785
+ interval: args.interval,
786
+ dex: args.dex?.trim() || resolved.dex,
787
+ candleLimit: args.candleLimit
788
+ });
789
+ return { snapshot, resolvedCoin: resolved.name, dex: resolved.dex ?? null };
790
+ }
791
+ async function hyperliquidFetchOhlcvSummary(args) {
792
+ const resolved = await hyperliquidResolvePerpMarket({
793
+ chainId: args.chainId,
794
+ coin: args.coin,
795
+ dex: args.dex
796
+ });
797
+ const ohlcv = await hyperliquidFetchOhlcvRange({
798
+ chainId: args.chainId,
799
+ coin: resolved.name,
800
+ interval: args.interval,
801
+ dex: args.dex?.trim() || resolved.dex,
802
+ lookbackDays: args.lookbackDays,
803
+ lookbackHours: args.lookbackHours,
804
+ startTimeMs: args.startTimeMs,
805
+ endTimeMs: args.endTimeMs
806
+ });
807
+ return { ohlcv, resolvedCoin: resolved.name, dex: resolved.dex ?? null };
453
808
  }
454
809
  var coreWriterAbi = viem.parseAbi(["function sendRawAction(bytes data) external"]);
455
810
  var ACTION_LIMIT_ORDER = 1;
@@ -1108,7 +1463,14 @@ registerProtocolModule(hyperliquidProtocolModule);
1108
1463
 
1109
1464
  exports.HYPERLIQUID_CORE_WRITER_ADDRESS = HYPERLIQUID_CORE_WRITER_ADDRESS;
1110
1465
  exports.HYPERLIQUID_CORE_WRITER_GAS_FALLBACK = HYPERLIQUID_CORE_WRITER_GAS_FALLBACK;
1466
+ exports.HYPERLIQUID_DEFAULT_CANDLE_LIMIT = HYPERLIQUID_DEFAULT_CANDLE_LIMIT;
1467
+ exports.HYPERLIQUID_DEFAULT_LOOKBACK_DAYS = HYPERLIQUID_DEFAULT_LOOKBACK_DAYS;
1468
+ exports.HYPERLIQUID_DEFAULT_OHLCV_INTERVAL = HYPERLIQUID_DEFAULT_OHLCV_INTERVAL;
1111
1469
  exports.HYPERLIQUID_HLP_VAULT_ADDRESS = HYPERLIQUID_HLP_VAULT_ADDRESS;
1470
+ exports.HYPERLIQUID_INTERVAL_MS = HYPERLIQUID_INTERVAL_MS;
1471
+ exports.HYPERLIQUID_MAX_CANDLE_LIMIT = HYPERLIQUID_MAX_CANDLE_LIMIT;
1472
+ exports.HYPERLIQUID_MAX_LOOKBACK_DAYS = HYPERLIQUID_MAX_LOOKBACK_DAYS;
1473
+ exports.HYPERLIQUID_MAX_OHLCV_BARS = HYPERLIQUID_MAX_OHLCV_BARS;
1112
1474
  exports.HYPERLIQUID_PROTOCOL_ID = HYPERLIQUID_PROTOCOL_ID;
1113
1475
  exports.HYPERLIQUID_SPOT_ASSET_OFFSET = HYPERLIQUID_SPOT_ASSET_OFFSET;
1114
1476
  exports.HYPERLIQUID_SUPPORTED_CHAIN_IDS = HYPERLIQUID_SUPPORTED_CHAIN_IDS;
@@ -1134,6 +1496,7 @@ exports.buildEvmMultisignBodyHyperliquidVaultDepositBatch = buildEvmMultisignBod
1134
1496
  exports.buildEvmMultisignBodyHyperliquidVaultWithdrawBatch = buildEvmMultisignBodyHyperliquidVaultWithdrawBatch;
1135
1497
  exports.coreWriterStep = coreWriterStep;
1136
1498
  exports.hyperliquidApiBaseUrl = hyperliquidApiBaseUrl;
1499
+ exports.hyperliquidCollectAllPerpMarkets = hyperliquidCollectAllPerpMarkets;
1137
1500
  exports.hyperliquidEncodePx8 = hyperliquidEncodePx8;
1138
1501
  exports.hyperliquidEncodeUsd6 = hyperliquidEncodeUsd6;
1139
1502
  exports.hyperliquidEncodeWei8 = hyperliquidEncodeWei8;
@@ -1147,11 +1510,15 @@ exports.hyperliquidFetchDexList = hyperliquidFetchDexList;
1147
1510
  exports.hyperliquidFetchMarketSnapshot = hyperliquidFetchMarketSnapshot;
1148
1511
  exports.hyperliquidFetchMarketSnapshotSummary = hyperliquidFetchMarketSnapshotSummary;
1149
1512
  exports.hyperliquidFetchMarketsSummary = hyperliquidFetchMarketsSummary;
1513
+ exports.hyperliquidFetchOhlcvRange = hyperliquidFetchOhlcvRange;
1514
+ exports.hyperliquidFetchOhlcvSummary = hyperliquidFetchOhlcvSummary;
1150
1515
  exports.hyperliquidFetchOpenContextSummary = hyperliquidFetchOpenContextSummary;
1151
1516
  exports.hyperliquidFetchOpenMarketContext = hyperliquidFetchOpenMarketContext;
1152
1517
  exports.hyperliquidFetchOpenOrders = hyperliquidFetchOpenOrders;
1153
1518
  exports.hyperliquidFetchOpenOrdersSummary = hyperliquidFetchOpenOrdersSummary;
1154
1519
  exports.hyperliquidFetchOrdersForExecutor = hyperliquidFetchOrdersForExecutor;
1520
+ exports.hyperliquidFetchPerpAssetContext = hyperliquidFetchPerpAssetContext;
1521
+ exports.hyperliquidFetchPerpConciseAnnotations = hyperliquidFetchPerpConciseAnnotations;
1155
1522
  exports.hyperliquidFetchPerpMeta = hyperliquidFetchPerpMeta;
1156
1523
  exports.hyperliquidFetchPositionDisplayRows = hyperliquidFetchPositionDisplayRows;
1157
1524
  exports.hyperliquidFetchPositionsForExecutor = hyperliquidFetchPositionsForExecutor;
@@ -1165,12 +1532,18 @@ exports.hyperliquidFetchUserVaultEquities = hyperliquidFetchUserVaultEquities;
1165
1532
  exports.hyperliquidFetchUserVaultEquitiesSummary = hyperliquidFetchUserVaultEquitiesSummary;
1166
1533
  exports.hyperliquidFetchVaultCatalogSummary = hyperliquidFetchVaultCatalogSummary;
1167
1534
  exports.hyperliquidFetchVaultSummaries = hyperliquidFetchVaultSummaries;
1535
+ exports.hyperliquidInferDexFromCoin = hyperliquidInferDexFromCoin;
1168
1536
  exports.hyperliquidIsSpotAssetId = hyperliquidIsSpotAssetId;
1537
+ exports.hyperliquidMarketSymbol = hyperliquidMarketSymbol;
1169
1538
  exports.hyperliquidProtocolModule = hyperliquidProtocolModule;
1170
1539
  exports.hyperliquidResolveAsset = hyperliquidResolveAsset;
1540
+ exports.hyperliquidResolveOhlcvWindow = hyperliquidResolveOhlcvWindow;
1171
1541
  exports.hyperliquidResolvePerpAsset = hyperliquidResolvePerpAsset;
1542
+ exports.hyperliquidResolvePerpMarket = hyperliquidResolvePerpMarket;
1172
1543
  exports.hyperliquidResolveSpotAsset = hyperliquidResolveSpotAsset;
1173
1544
  exports.hyperliquidResolveTif = hyperliquidResolveTif;
1545
+ exports.hyperliquidSearchMarkets = hyperliquidSearchMarkets;
1546
+ exports.hyperliquidSearchMarketsSummary = hyperliquidSearchMarketsSummary;
1174
1547
  exports.hyperliquidVaultStatsUrl = hyperliquidVaultStatsUrl;
1175
1548
  exports.isHyperliquidChainSupported = isHyperliquidChainSupported;
1176
1549
  //# sourceMappingURL=index.cjs.map