• 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.62
/src/api/info/_methods/metaAndAssetCtxs.ts
1
import * as v from "@valibot/valibot";
389✔
2

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

7
import { PerpAssetCtxSchema } from "./_base/commonSchemas.ts";
389✔
8
import { MetaResponse } from "./meta.ts";
389✔
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__ */ (() => {
389✔
15
  return v.object({
660✔
16
    /** Type of request. */
17
    type: v.literal("metaAndAssetCtxs"),
660✔
18
    /** DEX name (empty string for main dex). */
19
    dex: v.optional(v.string()),
660✔
20
  });
660✔
21
})();
389✔
22
export type MetaAndAssetCtxsRequest = v.InferOutput<typeof MetaAndAssetCtxsRequest>;
23

24
/**
25
 * Tuple containing metadata and array of asset contexts.
26
 * @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
27
 */
28
export const MetaAndAssetCtxsResponse = /* @__PURE__ */ (() => {
389✔
29
  return v.tuple([MetaResponse, v.array(PerpAssetCtxSchema)]);
2,640✔
30
})();
389✔
31
export type MetaAndAssetCtxsResponse = v.InferOutput<typeof MetaAndAssetCtxsResponse>;
32

33
// ============================================================
34
// Execution Logic
35
// ============================================================
36

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

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

42
/**
43
 * Request metadata and asset contexts.
44
 *
45
 * @param config - General configuration for Info API requests.
46
 * @param signal - {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request.
47
 *
48
 * @returns Metadata and context for perpetual assets.
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 { metaAndAssetCtxs } from "@nktkas/hyperliquid/api/info";
57
 *
58
 * const transport = new HttpTransport(); // or `WebSocketTransport`
59
 *
60
 * const data = await metaAndAssetCtxs({ transport });
61
 * ```
62
 *
63
 * @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
64
 */
65
export function metaAndAssetCtxs(
66
  config: InfoConfig,
67
  params?: MetaAndAssetCtxsParameters,
68
  signal?: AbortSignal,
69
): Promise<MetaAndAssetCtxsResponse>;
70
export function metaAndAssetCtxs(
71
  config: InfoConfig,
72
  signal?: AbortSignal,
73
): Promise<MetaAndAssetCtxsResponse>;
74
export function metaAndAssetCtxs(
389✔
75
  config: InfoConfig,
389✔
76
  paramsOrSignal?: MetaAndAssetCtxsParameters | AbortSignal,
389✔
77
  maybeSignal?: AbortSignal,
389✔
78
): Promise<MetaAndAssetCtxsResponse> {
79
  const params = paramsOrSignal instanceof AbortSignal ? {} : paramsOrSignal;
×
80
  const signal = paramsOrSignal instanceof AbortSignal ? paramsOrSignal : maybeSignal;
×
81

82
  const request = v.parse(MetaAndAssetCtxsRequest, {
393✔
83
    type: "metaAndAssetCtxs",
393✔
84
    ...params,
393✔
85
  });
393✔
86
  return config.transport.request("info", request, signal);
393✔
87
}
393✔
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