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

nktkas / hyperliquid / 20260168111

16 Dec 2025 07:33AM UTC coverage: 95.34% (-1.3%) from 96.688%
20260168111

push

github

nktkas
docs: improve code documentation

661 of 881 branches covered (75.03%)

Branch coverage included in aggregate %.

5 of 5 new or added lines in 2 files covered. (100.0%)

151 existing lines in 17 files now uncovered.

12843 of 13283 relevant lines covered (96.69%)

1103.6 hits per line

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

94.87
/src/api/info/_methods/meta.ts
1
import * as v from "@valibot/valibot";
365✔
2

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

7
import { ISO8601WithoutTimezone, UnsignedInteger } from "../../_schemas.ts";
365✔
8
import { MarginTableResponse } from "./marginTable.ts";
365✔
9

10
/**
11
 * Request trading metadata.
12
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables
13
 */
14
export const MetaRequest = /* @__PURE__ */ (() => {
365✔
15
  return v.pipe(
620✔
16
    v.object({
620✔
17
      /** Type of request. */
18
      type: v.pipe(
620✔
19
        v.literal("meta"),
620✔
20
        v.description("Type of request."),
620✔
21
      ),
22
      /** DEX name (empty string for main dex). */
23
      dex: v.pipe(
620✔
24
        v.optional(v.string()),
620✔
25
        v.description("DEX name (empty string for main dex)."),
620✔
26
      ),
27
    }),
620✔
28
    v.description("Request trading metadata."),
620✔
29
  );
30
})();
365✔
31
export type MetaRequest = v.InferOutput<typeof MetaRequest>;
32

33
/**
34
 * Metadata for perpetual assets.
35
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables
36
 */
37
export const MetaResponse = /* @__PURE__ */ (() => {
365✔
38
  return v.pipe(
620✔
39
    v.object({
620✔
40
      /** Trading universes available for perpetual trading. */
41
      universe: v.pipe(
620✔
42
        v.array(
620✔
43
          v.object({
620✔
44
            /** Minimum decimal places for order sizes. */
45
            szDecimals: v.pipe(
620✔
46
              UnsignedInteger,
620✔
47
              v.description("Minimum decimal places for order sizes."),
620✔
48
            ),
49
            /** Name of the universe. */
50
            name: v.pipe(
620✔
51
              v.string(),
620✔
52
              v.description("Name of the universe."),
620✔
53
            ),
54
            /** Maximum allowed leverage. */
55
            maxLeverage: v.pipe(
620✔
56
              UnsignedInteger,
620✔
57
              v.minValue(1),
620✔
58
              v.description("Maximum allowed leverage."),
620✔
59
            ),
60
            /** Unique identifier for the margin requirements table. */
61
            marginTableId: v.pipe(
620✔
62
              UnsignedInteger,
620✔
63
              v.description("Unique identifier for the margin requirements table."),
620✔
64
            ),
65
            /** Indicates if only isolated margin trading is allowed. */
66
            onlyIsolated: v.pipe(
620✔
67
              v.optional(v.literal(true)),
620✔
68
              v.description("Indicates if only isolated margin trading is allowed."),
620✔
69
            ),
70
            /** Indicates if the universe is delisted. */
71
            isDelisted: v.pipe(
620✔
72
              v.optional(v.literal(true)),
620✔
73
              v.description("Indicates if the universe is delisted."),
620✔
74
            ),
75
            /** Trading margin mode constraint. */
76
            marginMode: v.pipe(
620✔
77
              v.optional(v.picklist(["strictIsolated", "noCross"])),
2,480✔
78
              v.description("Trading margin mode constraint."),
620✔
79
            ),
80
            /** Indicates if growth mode is enabled. */
81
            growthMode: v.pipe(
620✔
82
              v.optional(v.literal("enabled")),
620✔
83
              v.description("Indicates if growth mode is enabled."),
620✔
84
            ),
85
            /** Timestamp of the last growth mode change. */
86
            lastGrowthModeChangeTime: v.pipe(
620✔
87
              v.optional(ISO8601WithoutTimezone),
620✔
88
              v.description("Timestamp of the last growth mode change."),
620✔
89
            ),
90
          }),
620✔
91
        ),
92
        v.description("Trading universes available for perpetual trading."),
620✔
93
      ),
94
      /** Margin requirement tables for different leverage tiers. */
95
      marginTables: v.pipe(
620✔
96
        v.array(
620✔
97
          v.tuple([
620✔
98
            UnsignedInteger,
620✔
99
            MarginTableResponse,
620✔
100
          ]),
620✔
101
        ),
102
        v.description("Margin requirement tables for different leverage tiers."),
620✔
103
      ),
104
      /** Collateral token index. */
105
      collateralToken: v.pipe(
620✔
106
        UnsignedInteger,
620✔
107
        v.description("Collateral token index."),
620✔
108
      ),
109
    }),
620✔
110
    v.description("Metadata for perpetual assets."),
620✔
111
  );
112
})();
365✔
113
export type MetaResponse = v.InferOutput<typeof MetaResponse>;
114

115
// ============================================================
116
// Execution Logic
117
// ============================================================
118

119
import type { InfoConfig } from "./_base/types.ts";
120

121
/** Request parameters for the {@linkcode meta} function. */
122
export type MetaParameters = Omit<v.InferInput<typeof MetaRequest>, "type">;
123

124
/**
125
 * Request trading metadata.
126
 *
127
 * @param config - General configuration for Info API requests.
128
 * @param params - Parameters specific to the API request.
129
 * @param signal - {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request.
130
 *
131
 * @returns Metadata for perpetual assets.
132
 *
133
 * @throws {ValiError} When the request parameters fail validation (before sending).
134
 * @throws {TransportError} When the transport layer throws an error.
135
 *
136
 * @example
137
 * ```ts
138
 * import { HttpTransport } from "@nktkas/hyperliquid";
139
 * import { meta } from "@nktkas/hyperliquid/api/info";
140
 *
141
 * const transport = new HttpTransport(); // or `WebSocketTransport`
142
 *
143
 * const data = await meta({ transport });
144
 * ```
145
 *
146
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables
147
 */
148
export function meta(
149
  config: InfoConfig,
150
  params?: MetaParameters,
151
  signal?: AbortSignal,
152
): Promise<MetaResponse>;
153
export function meta(
154
  config: InfoConfig,
155
  signal?: AbortSignal,
156
): Promise<MetaResponse>;
157
export function meta(
365✔
158
  config: InfoConfig,
365✔
159
  paramsOrSignal?: MetaParameters | AbortSignal,
365✔
160
  maybeSignal?: AbortSignal,
365✔
161
): Promise<MetaResponse> {
UNCOV
162
  const params = paramsOrSignal instanceof AbortSignal ? {} : paramsOrSignal;
×
UNCOV
163
  const signal = paramsOrSignal instanceof AbortSignal ? paramsOrSignal : maybeSignal;
×
164

165
  const request = v.parse(MetaRequest, {
586✔
166
    type: "meta",
586✔
167
    ...params,
586✔
168
  });
586✔
169
  return config.transport.request("info", request, signal);
586✔
170
}
586✔
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