UNPKG

@nktkas/hyperliquid

Version:

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

56 lines (55 loc) 2.33 kB
/// <amd-module name="file:///home/runner/work/hyperliquid/hyperliquid/src/api/explorer/_methods/txDetails.ts" /> import * as v from "valibot"; import type { ExplorerTransaction } from "./_base/mod.js"; /** * Request transaction details by transaction hash. * @see null */ export declare const TxDetailsRequest: v.ObjectSchema<{ /** Type of request. */ readonly type: v.LiteralSchema<"txDetails", undefined>; /** Transaction hash. */ readonly hash: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 66, undefined>]>; }, undefined>; export type TxDetailsRequest = v.InferOutput<typeof TxDetailsRequest>; /** * Response with transaction details. * @see null */ export type TxDetailsResponse = { /** Response type. */ type: "txDetails"; /** Transaction details. */ tx: ExplorerTransaction; }; import type { IRequestTransport } from "../../../transport/mod.js"; import { type ExplorerConfig } from "./_base/mod.js"; /** Request parameters for the {@linkcode txDetails} function. */ export type TxDetailsParameters = Omit<v.InferInput<typeof TxDetailsRequest>, "type">; /** * Request transaction details by transaction hash. * * @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 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 { txDetails } from "@nktkas/hyperliquid/api/explorer"; * * const transport = new HttpTransport(); // only `HttpTransport` supports this API * * const data = await txDetails({ transport }, { * hash: "0x...", * }); * ``` * * @see null */ export declare function txDetails(config: ExplorerConfig<IRequestTransport<"explorer">>, params: TxDetailsParameters, signal?: AbortSignal): Promise<TxDetailsResponse>;