UNPKG

@nktkas/hyperliquid

Version:

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

74 lines (73 loc) 3.22 kB
/// <amd-module name="file:///home/runner/work/hyperliquid/hyperliquid/src/api/info/_methods/settledOutcome.ts" /> import * as v from "valibot"; /** * Request information about a settled outcome. * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-a-settled-outcome */ export declare const SettledOutcomeRequest: v.ObjectSchema<{ /** Type of request. */ readonly type: v.LiteralSchema<"settledOutcome", undefined>; /** Outcome identifier. */ readonly outcome: v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.ToNumberAction<string | number, undefined>, v.NumberSchema<undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>; }, undefined>; export type SettledOutcomeRequest = v.InferOutput<typeof SettledOutcomeRequest>; /** * Information about a settled outcome (null if the outcome is not settled). * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-a-settled-outcome */ export type SettledOutcomeResponse = { /** Outcome specification. */ spec: { /** Outcome identifier. */ outcome: number; /** Name of the outcome. */ name: string; /** Description of the outcome. */ description: string; /** Array of side specifications for this outcome. */ sideSpecs: { /** Name of the side. */ name: string; /** Token identifier for this side. */ token?: number; }[]; /** Quote token for this outcome. */ quoteToken: string; }; /** * Settlement fraction. * @pattern ^[0-9]+(\.[0-9]+)?$ */ settleFraction: string; /** Settlement details. */ details: string; } | null; import type { InfoConfig } from "./_base/mod.js"; /** Request parameters for the {@linkcode settledOutcome} function. */ export type SettledOutcomeParameters = Omit<v.InferInput<typeof SettledOutcomeRequest>, "type">; /** * Request information about a settled outcome. * * @param config General configuration for Info API requests. * @param params Parameters specific to the API request. * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Information about a settled outcome. * * @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 { settledOutcome } from "@nktkas/hyperliquid/api/info"; * * const transport = new HttpTransport(); // or `WebSocketTransport` * * const data = await settledOutcome({ transport }, { * outcome: 0, * }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-a-settled-outcome */ export declare function settledOutcome(config: InfoConfig, params: SettledOutcomeParameters, signal?: AbortSignal): Promise<SettledOutcomeResponse>;