UNPKG

@nktkas/hyperliquid

Version:

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

56 lines (55 loc) 2.38 kB
/// <amd-module name="file:///home/runner/work/hyperliquid/hyperliquid/src/api/explorer/_methods/userDetails.ts" /> import * as v from "valibot"; import type { ExplorerTransaction } from "./_base/mod.js"; /** * Request array of user transaction details. * @see null */ export declare const UserDetailsRequest: v.ObjectSchema<{ /** Type of request. */ readonly type: v.LiteralSchema<"userDetails", undefined>; /** User address. */ readonly user: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>; }, undefined>; export type UserDetailsRequest = v.InferOutput<typeof UserDetailsRequest>; /** * Response array of user transaction details. * @see null */ export type UserDetailsResponse = { /** Type of response. */ type: "userDetails"; /** Array of user transaction details. */ txs: ExplorerTransaction[]; }; import type { IRequestTransport } from "../../../transport/mod.js"; import { type ExplorerConfig } from "./_base/mod.js"; /** Request parameters for the {@linkcode userDetails} function. */ export type UserDetailsParameters = Omit<v.InferInput<typeof UserDetailsRequest>, "type">; /** * Request array of user transaction details. * * @param config General configuration for Explorer 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 Array of user transaction details. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * @throws {ApiRequestError} When the API returns an unsuccessful response. * * @example * ```ts * import { HttpTransport } from "@nktkas/hyperliquid"; * import { userDetails } from "@nktkas/hyperliquid/api/explorer"; * * const transport = new HttpTransport(); // only `HttpTransport` supports this API * * const data = await userDetails({ transport }, { * user: "0x...", * }); * ``` * * @see null */ export declare function userDetails(config: ExplorerConfig<IRequestTransport<"explorer">>, params: UserDetailsParameters, signal?: AbortSignal): Promise<UserDetailsResponse>;