UNPKG

@nktkas/hyperliquid

Version:

Hyperliquid API SDK for all major JS runtimes, written in TypeScript.

52 lines 1.95 kB
import * as v from "valibot"; // ============================================================ // API Schemas // ============================================================ import { UnsignedInteger } from "../../_schemas.js"; /** * Request exchange system status information. */ export const ExchangeStatusRequest = /* @__PURE__ */ (() => { return v.pipe(v.object({ /** Type of request. */ type: v.pipe(v.literal("exchangeStatus"), v.description("Type of request.")), }), v.description("Request exchange system status information.")); })(); /** * Exchange system status information. */ export const ExchangeStatusResponse = /* @__PURE__ */ (() => { return v.pipe(v.object({ /** Server time (in ms since epoch). */ time: v.pipe(UnsignedInteger, v.description("Server time (in ms since epoch).")), specialStatuses: v.pipe(v.nullable(v.unknown())), }), v.description("Exchange system status information.")); })(); /** * Request exchange system status information. * * @param config - General configuration for Info API requests. * @param signal - [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to cancel the request. * * @returns Exchange system status information. * * @throws {ValiError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import { HttpTransport } from "@nktkas/hyperliquid"; * import { exchangeStatus } from "@nktkas/hyperliquid/api/info"; * * const transport = new HttpTransport(); // or `WebSocketTransport` * * const data = await exchangeStatus({ transport }); * ``` */ export function exchangeStatus(config, signal) { const request = v.parse(ExchangeStatusRequest, { type: "exchangeStatus", }); return config.transport.request("info", request, signal); } //# sourceMappingURL=exchangeStatus.js.map