UNPKG

@nktkas/hyperliquid

Version:

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

67 lines 4.58 kB
import * as v from "valibot"; /** * Request user's staking summary. * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary */ export declare const DelegatorSummaryRequest: v.SchemaWithPipe<readonly [v.ObjectSchema<{ /** Type of request. */ readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"delegatorSummary", undefined>, v.DescriptionAction<"delegatorSummary", "Type of request.">]>; /** User address. */ readonly user: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, v.DescriptionAction<`0x${string}`, "User address.">]>; }, undefined>, v.DescriptionAction<{ type: "delegatorSummary"; user: `0x${string}`; }, "Request user's staking summary.">]>; export type DelegatorSummaryRequest = v.InferOutput<typeof DelegatorSummaryRequest>; /** * User's staking summary. * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary */ export declare const DelegatorSummaryResponse: v.SchemaWithPipe<readonly [v.ObjectSchema<{ /** Total amount of delegated tokens. */ readonly delegated: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.StringSchema<undefined>, v.TransformAction<string, string>, v.RegexAction<string, undefined>]>, v.DescriptionAction<string, "Total amount of delegated tokens.">]>; /** Total amount of undelegated tokens. */ readonly undelegated: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.StringSchema<undefined>, v.TransformAction<string, string>, v.RegexAction<string, undefined>]>, v.DescriptionAction<string, "Total amount of undelegated tokens.">]>; /** Total amount of tokens pending withdrawal. */ readonly totalPendingWithdrawal: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.StringSchema<undefined>, v.TransformAction<string, string>, v.RegexAction<string, undefined>]>, v.DescriptionAction<string, "Total amount of tokens pending withdrawal.">]>; /** Number of pending withdrawals. */ readonly nPendingWithdrawals: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Number of pending withdrawals.">]>; }, undefined>, v.DescriptionAction<{ delegated: string; undelegated: string; totalPendingWithdrawal: string; nPendingWithdrawals: number; }, "User's staking summary.">]>; export type DelegatorSummaryResponse = v.InferOutput<typeof DelegatorSummaryResponse>; import type { InfoConfig } from "./_types.js"; /** Request parameters for the {@linkcode delegatorSummary} function. */ export type DelegatorSummaryParameters = Omit<v.InferInput<typeof DelegatorSummaryRequest>, "type">; /** * Request user's staking summary. * * @param config - General configuration for Info API requests. * @param params - Parameters specific to the API request. * @param signal - [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to cancel the request. * * @returns User's staking summary. * * @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 { delegatorSummary } from "@nktkas/hyperliquid/api/info"; * * const transport = new HttpTransport(); // or `WebSocketTransport` * * const data = await delegatorSummary( * { transport }, * { user: "0x..." }, * ); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary */ export declare function delegatorSummary(config: InfoConfig, params: DelegatorSummaryParameters, signal?: AbortSignal): Promise<DelegatorSummaryResponse>; //# sourceMappingURL=delegatorSummary.d.ts.map