• 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

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

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

7
import { PerpAssetCtxSchema } from "./_base/commonSchemas.ts";
365✔
8
import { MetaResponse } from "./meta.ts";
365✔
9

10
/**
11
 * Request metadata and asset contexts.
12
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
13
 */
14
export const MetaAndAssetCtxsRequest = /* @__PURE__ */ (() => {
365✔
15
  return v.pipe(
620✔
16
    v.object({
620✔
17
      /** Type of request. */
18
      type: v.pipe(
620✔
19
        v.literal("metaAndAssetCtxs"),
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 metadata and asset contexts."),
620✔
29
  );
30
})();
365✔
31
export type MetaAndAssetCtxsRequest = v.InferOutput<typeof MetaAndAssetCtxsRequest>;
32

33
/**
34
 * Tuple containing metadata and array of asset contexts.
35
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
36
 */
37
export const MetaAndAssetCtxsResponse = /* @__PURE__ */ (() => {
365✔
38
  return v.pipe(
620✔
39
    v.tuple([
620✔
40
      MetaResponse,
620✔
41
      v.array(PerpAssetCtxSchema),
620✔
42
    ]),
620✔
43
    v.description("Tuple containing metadata and array of asset contexts."),
620✔
44
  );
45
})();
365✔
46
export type MetaAndAssetCtxsResponse = v.InferOutput<typeof MetaAndAssetCtxsResponse>;
47

48
// ============================================================
49
// Execution Logic
50
// ============================================================
51

52
import type { InfoConfig } from "./_base/types.ts";
53

54
/** Request parameters for the {@linkcode metaAndAssetCtxs} function. */
55
export type MetaAndAssetCtxsParameters = Omit<v.InferInput<typeof MetaAndAssetCtxsRequest>, "type">;
56

57
/**
58
 * Request metadata and asset contexts.
59
 *
60
 * @param config - General configuration for Info API requests.
61
 * @param signal - {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request.
62
 *
63
 * @returns Metadata and context for perpetual assets.
64
 *
65
 * @throws {ValiError} When the request parameters fail validation (before sending).
66
 * @throws {TransportError} When the transport layer throws an error.
67
 *
68
 * @example
69
 * ```ts
70
 * import { HttpTransport } from "@nktkas/hyperliquid";
71
 * import { metaAndAssetCtxs } from "@nktkas/hyperliquid/api/info";
72
 *
73
 * const transport = new HttpTransport(); // or `WebSocketTransport`
74
 *
75
 * const data = await metaAndAssetCtxs({ transport });
76
 * ```
77
 *
78
 * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
79
 */
80
export function metaAndAssetCtxs(
81
  config: InfoConfig,
82
  params?: MetaAndAssetCtxsParameters,
83
  signal?: AbortSignal,
84
): Promise<MetaAndAssetCtxsResponse>;
85
export function metaAndAssetCtxs(
86
  config: InfoConfig,
87
  signal?: AbortSignal,
88
): Promise<MetaAndAssetCtxsResponse>;
89
export function metaAndAssetCtxs(
365✔
90
  config: InfoConfig,
365✔
91
  paramsOrSignal?: MetaAndAssetCtxsParameters | AbortSignal,
365✔
92
  maybeSignal?: AbortSignal,
365✔
93
): Promise<MetaAndAssetCtxsResponse> {
UNCOV
94
  const params = paramsOrSignal instanceof AbortSignal ? {} : paramsOrSignal;
×
UNCOV
95
  const signal = paramsOrSignal instanceof AbortSignal ? paramsOrSignal : maybeSignal;
×
96

97
  const request = v.parse(MetaAndAssetCtxsRequest, {
369✔
98
    type: "metaAndAssetCtxs",
369✔
99
    ...params,
369✔
100
  });
369✔
101
  return config.transport.request("info", request, signal);
369✔
102
}
369✔
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