UNPKG

@nktkas/hyperliquid

Version:

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

42 lines (41 loc) 1.7 kB
import * as v from "valibot"; /** * Request spot metadata and asset contexts. * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts */ export const SpotMetaAndAssetCtxsRequest = /* @__PURE__ */ (()=>{ return v.object({ /** Type of request. */ type: v.literal("spotMetaAndAssetCtxs") }); })(); // ============================================================ // Execution Logic // ============================================================ import { parse } from "../../../_base.js"; /** * Request spot metadata and asset contexts. * * @param config General configuration for Info API requests. * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Metadata and context for spot assets. * * @throws {ValidationError} 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 { spotMetaAndAssetCtxs } from "@nktkas/hyperliquid/api/info"; * * const transport = new HttpTransport(); // or `WebSocketTransport` * * const data = await spotMetaAndAssetCtxs({ transport }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts */ export function spotMetaAndAssetCtxs(config, signal) { const request = parse(SpotMetaAndAssetCtxsRequest, { type: "spotMetaAndAssetCtxs" }); return config.transport.request("info", request, signal); } //# sourceMappingURL=spotMetaAndAssetCtxs.js.map