• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nktkas / hyperliquid / 21729335997

05 Feb 2026 09:33PM UTC coverage: 92.652% (-2.8%) from 95.464%
21729335997

push

github

nktkas
test: weaken coverage testing of schemas

613 of 806 branches covered (76.05%)

Branch coverage included in aggregate %.

9210 of 9796 relevant lines covered (94.02%)

883.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.0
/src/api/info/_methods/allMids.ts
1
import * as v from "@valibot/valibot";
389✔
2

3
// ============================================================
4
// API Schemas
5
// ============================================================
6

7
import { UnsignedDecimal } from "../../_schemas.ts";
389✔
8

9
/**
10
 * Request mid coin prices.
11
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins
12
 */
13
export const AllMidsRequest = /* @__PURE__ */ (() => {
389✔
14
  return v.object({
660✔
15
    /** Type of request. */
16
    type: v.literal("allMids"),
660✔
17
    /** DEX name (empty string for main dex). */
18
    dex: v.optional(v.string()),
660✔
19
  });
660✔
20
})();
389✔
21
export type AllMidsRequest = v.InferOutput<typeof AllMidsRequest>;
22

23
/**
24
 * Mapping of coin symbols to mid prices.
25
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins
26
 */
27
export const AllMidsResponse = /* @__PURE__ */ (() => {
389✔
28
  return v.record(v.string(), UnsignedDecimal);
660✔
29
})();
389✔
30
export type AllMidsResponse = v.InferOutput<typeof AllMidsResponse>;
31

32
// ============================================================
33
// Execution Logic
34
// ============================================================
35

36
import type { InfoConfig } from "./_base/types.ts";
37

38
/** Request parameters for the {@linkcode allMids} function. */
39
export type AllMidsParameters = Omit<v.InferInput<typeof AllMidsRequest>, "type">;
40

41
/**
42
 * Request mid coin prices.
43
 *
44
 * @param config - General configuration for Info API requests.
45
 * @param params - Parameters specific to the API request.
46
 * @param signal - {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request.
47
 *
48
 * @returns Mapping of coin symbols to mid prices.
49
 *
50
 * @throws {ValiError} When the request parameters fail validation (before sending).
51
 * @throws {TransportError} When the transport layer throws an error.
52
 *
53
 * @example
54
 * ```ts
55
 * import { HttpTransport } from "@nktkas/hyperliquid";
56
 * import { allMids } from "@nktkas/hyperliquid/api/info";
57
 *
58
 * const transport = new HttpTransport(); // or `WebSocketTransport`
59
 *
60
 * const data = await allMids({ transport });
61
 * ```
62
 *
63
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins
64
 */
65
export function allMids(
66
  config: InfoConfig,
67
  params?: AllMidsParameters,
68
  signal?: AbortSignal,
69
): Promise<AllMidsResponse>;
70
export function allMids(
71
  config: InfoConfig,
72
  signal?: AbortSignal,
73
): Promise<AllMidsResponse>;
74
export function allMids(
389✔
75
  config: InfoConfig,
389✔
76
  paramsOrSignal?: AllMidsParameters | AbortSignal,
389✔
77
  maybeSignal?: AbortSignal,
389✔
78
): Promise<AllMidsResponse> {
79
  const params = paramsOrSignal instanceof AbortSignal ? {} : paramsOrSignal;
×
80
  const signal = paramsOrSignal instanceof AbortSignal ? paramsOrSignal : maybeSignal;
×
81

82
  const request = v.parse(AllMidsRequest, {
468✔
83
    type: "allMids",
468✔
84
    ...params,
468✔
85
  });
468✔
86
  return config.transport.request("info", request, signal);
468✔
87
}
468✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc