@nktkas/hyperliquid
Version:
Hyperliquid API SDK for all major JS runtimes, written in TypeScript.
65 lines (64 loc) • 1.9 kB
TypeScript
/// <amd-module name="file:///home/runner/work/hyperliquid/hyperliquid/src/api/info/_methods/liquidatable.ts" />
import * as v from "valibot";
/**
* Request liquidatable.
* @see null
*/
export declare const LiquidatableRequest: v.ObjectSchema<{
/** Type of request. */
readonly type: v.LiteralSchema<"liquidatable", undefined>;
}, undefined>;
export type LiquidatableRequest = v.InferOutput<typeof LiquidatableRequest>;
/**
* Array of liquidatable positions.
* @see null
*/
export type LiquidatableResponse = {
/**
* User address.
* @pattern ^0x[a-fA-F0-9]{40}$
*/
user: `0x${string}`;
/**
* Position index.
*
* FIXME: a `cross` variant may exist (unconfirmed).
*/
positionIndex: {
/** Isolated position details. */
isolated: {
/** Asset index. */
asset: number;
};
};
/**
* Available margin.
*
* FIXME: meaning of the two values unconfirmed.
*/
marginAvailable: [number, number];
}[];
import type { InfoConfig } from "./_base/mod.js";
/**
* Request liquidatable.
*
* @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 Unknown array.
*
* @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 { liquidatable } from "@nktkas/hyperliquid/api/info";
*
* const transport = new HttpTransport(); // or `WebSocketTransport`
*
* const data = await liquidatable({ transport });
* ```
*
* @see null
*/
export declare function liquidatable(config: InfoConfig, signal?: AbortSignal): Promise<LiquidatableResponse>;