UNPKG

@nktkas/hyperliquid

Version:

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

1,063 lines 90.5 kB
/** * Client for the Hyperliquid Info API endpoint. * @module */ /// <amd-module name="file:///home/runner/work/hyperliquid/hyperliquid/src/api/info/client.ts" /> import type { InfoConfig } from "./_methods/_base/mod.js"; import { type ActiveAssetDataParameters, type ActiveAssetDataResponse } from "./_methods/activeAssetData.js"; import { type AllBorrowLendReserveStatesResponse } from "./_methods/allBorrowLendReserveStates.js"; import { type AllMidsParameters, type AllMidsResponse } from "./_methods/allMids.js"; import { type AllPerpMetasResponse } from "./_methods/allPerpMetas.js"; import { type ApprovedBuildersParameters, type ApprovedBuildersResponse } from "./_methods/approvedBuilders.js"; import { type BorrowLendReserveStateParameters, type BorrowLendReserveStateResponse } from "./_methods/borrowLendReserveState.js"; import { type BorrowLendUserStateParameters, type BorrowLendUserStateResponse } from "./_methods/borrowLendUserState.js"; import { type CandleSnapshotParameters, type CandleSnapshotResponse } from "./_methods/candleSnapshot.js"; import { type ClearinghouseStateParameters, type ClearinghouseStateResponse } from "./_methods/clearinghouseState.js"; import { type DelegationsParameters, type DelegationsResponse } from "./_methods/delegations.js"; import { type DelegatorHistoryParameters, type DelegatorHistoryResponse } from "./_methods/delegatorHistory.js"; import { type DelegatorRewardsParameters, type DelegatorRewardsResponse } from "./_methods/delegatorRewards.js"; import { type DelegatorSummaryParameters, type DelegatorSummaryResponse } from "./_methods/delegatorSummary.js"; import { type ExchangeStatusResponse } from "./_methods/exchangeStatus.js"; import { type ExtraAgentsParameters, type ExtraAgentsResponse } from "./_methods/extraAgents.js"; import { type FrontendOpenOrdersParameters, type FrontendOpenOrdersResponse } from "./_methods/frontendOpenOrders.js"; import { type FundingHistoryParameters, type FundingHistoryResponse } from "./_methods/fundingHistory.js"; import { type GossipPriorityAuctionStatusResponse } from "./_methods/gossipPriorityAuctionStatus.js"; import { type GossipRootIpsResponse } from "./_methods/gossipRootIps.js"; import { type HistoricalOrdersParameters, type HistoricalOrdersResponse } from "./_methods/historicalOrders.js"; import { type IsVipParameters, type IsVipResponse } from "./_methods/isVip.js"; import { type L2BookParameters, type L2BookResponse } from "./_methods/l2Book.js"; import { type LeadingVaultsParameters, type LeadingVaultsResponse } from "./_methods/leadingVaults.js"; import { type LegalCheckParameters, type LegalCheckResponse } from "./_methods/legalCheck.js"; import { type LiquidatableResponse } from "./_methods/liquidatable.js"; import { type MarginTableParameters, type MarginTableResponse } from "./_methods/marginTable.js"; import { type MaxBuilderFeeParameters, type MaxBuilderFeeResponse } from "./_methods/maxBuilderFee.js"; import { type MaxMarketOrderNtlsResponse } from "./_methods/maxMarketOrderNtls.js"; import { type MetaParameters, type MetaResponse } from "./_methods/meta.js"; import { type MetaAndAssetCtxsParameters, type MetaAndAssetCtxsResponse } from "./_methods/metaAndAssetCtxs.js"; import { type OpenOrdersParameters, type OpenOrdersResponse } from "./_methods/openOrders.js"; import { type OrderStatusParameters, type OrderStatusResponse } from "./_methods/orderStatus.js"; import { type OutcomeMetaResponse } from "./_methods/outcomeMeta.js"; import { type PerpAnnotationParameters, type PerpAnnotationResponse } from "./_methods/perpAnnotation.js"; import { type PerpCategoriesResponse } from "./_methods/perpCategories.js"; import { type PerpConciseAnnotationsResponse } from "./_methods/perpConciseAnnotations.js"; import { type PerpDeployAuctionStatusResponse } from "./_methods/perpDeployAuctionStatus.js"; import { type PerpDexLimitsParameters, type PerpDexLimitsResponse } from "./_methods/perpDexLimits.js"; import { type PerpDexsResponse } from "./_methods/perpDexs.js"; import { type PerpDexStatusParameters, type PerpDexStatusResponse } from "./_methods/perpDexStatus.js"; import { type PerpsAtOpenInterestCapParameters, type PerpsAtOpenInterestCapResponse } from "./_methods/perpsAtOpenInterestCap.js"; import { type PortfolioParameters, type PortfolioResponse } from "./_methods/portfolio.js"; import { type PredictedFundingsResponse } from "./_methods/predictedFundings.js"; import { type PreTransferCheckParameters, type PreTransferCheckResponse } from "./_methods/preTransferCheck.js"; import { type RecentTradesParameters, type RecentTradesResponse } from "./_methods/recentTrades.js"; import { type ReferralParameters, type ReferralResponse } from "./_methods/referral.js"; import { type SettledOutcomeParameters, type SettledOutcomeResponse } from "./_methods/settledOutcome.js"; import { type SpotClearinghouseStateParameters, type SpotClearinghouseStateResponse } from "./_methods/spotClearinghouseState.js"; import { type SpotDeployStateParameters, type SpotDeployStateResponse } from "./_methods/spotDeployState.js"; import { type SpotMetaResponse } from "./_methods/spotMeta.js"; import { type SpotMetaAndAssetCtxsResponse } from "./_methods/spotMetaAndAssetCtxs.js"; import { type SpotPairDeployAuctionStatusResponse } from "./_methods/spotPairDeployAuctionStatus.js"; import { type SubAccountsParameters, type SubAccountsResponse } from "./_methods/subAccounts.js"; import { type SubAccounts2Parameters, type SubAccounts2Response } from "./_methods/subAccounts2.js"; import { type TokenDetailsParameters, type TokenDetailsResponse } from "./_methods/tokenDetails.js"; import { type TwapHistoryParameters, type TwapHistoryResponse } from "./_methods/twapHistory.js"; import { type UserAbstractionParameters, type UserAbstractionResponse } from "./_methods/userAbstraction.js"; import { type UserBorrowLendInterestParameters, type UserBorrowLendInterestResponse } from "./_methods/userBorrowLendInterest.js"; import { type UserDexAbstractionParameters, type UserDexAbstractionResponse } from "./_methods/userDexAbstraction.js"; import { type UserFeesParameters, type UserFeesResponse } from "./_methods/userFees.js"; import { type UserFillsParameters, type UserFillsResponse } from "./_methods/userFills.js"; import { type UserFillsByTimeParameters, type UserFillsByTimeResponse } from "./_methods/userFillsByTime.js"; import { type UserFundingParameters, type UserFundingResponse } from "./_methods/userFunding.js"; import { type UserNonFundingLedgerUpdatesParameters, type UserNonFundingLedgerUpdatesResponse } from "./_methods/userNonFundingLedgerUpdates.js"; import { type UserRateLimitParameters, type UserRateLimitResponse } from "./_methods/userRateLimit.js"; import { type UserRoleParameters, type UserRoleResponse } from "./_methods/userRole.js"; import { type UserToMultiSigSignersParameters, type UserToMultiSigSignersResponse } from "./_methods/userToMultiSigSigners.js"; import { type UserTwapSliceFillsParameters, type UserTwapSliceFillsResponse } from "./_methods/userTwapSliceFills.js"; import { type UserTwapSliceFillsByTimeParameters, type UserTwapSliceFillsByTimeResponse } from "./_methods/userTwapSliceFillsByTime.js"; import { type UserVaultEquitiesParameters, type UserVaultEquitiesResponse } from "./_methods/userVaultEquities.js"; import { type ValidatorL1VotesResponse } from "./_methods/validatorL1Votes.js"; import { type ValidatorSummariesResponse } from "./_methods/validatorSummaries.js"; import { type VaultDetailsParameters, type VaultDetailsResponse } from "./_methods/vaultDetails.js"; import { type VaultSummariesResponse } from "./_methods/vaultSummaries.js"; import { type WebData2Parameters, type WebData2Response } from "./_methods/webData2.js"; /** * Read-only access to market data, user state, and other public information. * * Corresponds to the {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint | Info endpoint}. */ export declare class InfoClient<C extends InfoConfig = InfoConfig> { config_: C; /** * Creates an instance of the InfoClient. * * @param config Configuration for Info API requests. See {@link InfoConfig}. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * * const infoClient = new hl.InfoClient({ transport }); * ``` */ constructor(config: C); /** * Request user active asset data. * * @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 User active asset data. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.activeAssetData({ user: "0x...", coin: "ETH" }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-active-asset-data */ activeAssetData(params: ActiveAssetDataParameters, signal?: AbortSignal): Promise<ActiveAssetDataResponse>; /** * Request all borrow/lend reserve states. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Array of tuples of reserve IDs and their borrow/lend reserve state. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.allBorrowLendReserveStates(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-all-borrow-lend-reserve-states */ allBorrowLendReserveStates(signal?: AbortSignal): Promise<AllBorrowLendReserveStatesResponse>; /** * Request mid coin prices. * * @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 Mapping of coin symbols to mid prices. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.allMids(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins */ allMids(params?: AllMidsParameters, signal?: AbortSignal): Promise<AllMidsResponse>; allMids(signal?: AbortSignal): Promise<AllMidsResponse>; /** * Request trading metadata for all DEXs. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Metadata for perpetual assets across all DEXs. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.allPerpMetas(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-all-perpetuals-metadata-universe-and-margin-tables */ allPerpMetas(signal?: AbortSignal): Promise<AllPerpMetasResponse>; /** * Request approved builders for a user. * * @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 approved builder addresses. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.approvedBuilders({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-approved-builders-for-user */ approvedBuilders(params: ApprovedBuildersParameters, signal?: AbortSignal): Promise<ApprovedBuildersResponse>; /** * Request borrow/lend reserve state. * * @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 Borrow/lend reserve state. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.borrowLendReserveState({ token: 0 }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-borrow-lend-reserve-state */ borrowLendReserveState(params: BorrowLendReserveStateParameters, signal?: AbortSignal): Promise<BorrowLendReserveStateResponse>; /** * Request borrow/lend user state. * * @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 User's borrow/lend state. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.borrowLendUserState({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-borrow-lend-user-state */ borrowLendUserState(params: BorrowLendUserStateParameters, signal?: AbortSignal): Promise<BorrowLendUserStateResponse>; /** * Request candlestick snapshots. * * @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 candlestick data points. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.candleSnapshot({ * coin: "ETH", * interval: "1h", * startTime: Date.now() - 1000 * 60 * 60 * 24, * }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot */ candleSnapshot(params: CandleSnapshotParameters, signal?: AbortSignal): Promise<CandleSnapshotResponse>; /** * Request clearinghouse state. * * @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 Account summary for perpetual trading. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.clearinghouseState({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary */ clearinghouseState(params: ClearinghouseStateParameters, signal?: AbortSignal): Promise<ClearinghouseStateResponse>; /** * Request user staking delegations. * * @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's delegations to validators. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.delegations({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-delegations */ delegations(params: DelegationsParameters, signal?: AbortSignal): Promise<DelegationsResponse>; /** * Request user staking history. * * @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 records of staking events by a delegator. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.delegatorHistory({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-history */ delegatorHistory(params: DelegatorHistoryParameters, signal?: AbortSignal): Promise<DelegatorHistoryResponse>; /** * Request user staking rewards. * * @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 rewards received from staking activities. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.delegatorRewards({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-rewards */ delegatorRewards(params: DelegatorRewardsParameters, signal?: AbortSignal): Promise<DelegatorRewardsResponse>; /** * Request user's staking summary. * * @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 User's staking summary. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.delegatorSummary({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary */ delegatorSummary(params: DelegatorSummaryParameters, signal?: AbortSignal): Promise<DelegatorSummaryResponse>; /** * Request exchange system status information. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Exchange system status information. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.exchangeStatus(); * ``` * * @see null */ exchangeStatus(signal?: AbortSignal): Promise<ExchangeStatusResponse>; /** * Request user extra agents. * * @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 extra agent details for a user. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.extraAgents({ user: "0x..." }); * ``` * * @see null */ extraAgents(params: ExtraAgentsParameters, signal?: AbortSignal): Promise<ExtraAgentsResponse>; /** * Request frontend open orders. * * @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 open orders with additional display information. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.frontendOpenOrders({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders-with-additional-frontend-info */ frontendOpenOrders(params: FrontendOpenOrdersParameters, signal?: AbortSignal): Promise<FrontendOpenOrdersResponse>; /** * Request funding history. * * @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 historical funding rate records for an asset. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.fundingHistory({ * coin: "ETH", * startTime: Date.now() - 1000 * 60 * 60 * 24, * }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates */ fundingHistory(params: FundingHistoryParameters, signal?: AbortSignal): Promise<FundingHistoryResponse>; /** * Request gossip priority auction status (previous winners and current auctions). * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Gossip priority auction status. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.gossipPriorityAuctionStatus(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/priority-fees */ gossipPriorityAuctionStatus(signal?: AbortSignal): Promise<GossipPriorityAuctionStatusResponse>; /** * Request gossip root IPs. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Array of gossip root IPs. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.gossipRootIps(); * ``` * * @see null */ gossipRootIps(signal?: AbortSignal): Promise<GossipRootIpsResponse>; /** * Request user historical orders. * * @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 frontend orders with current processing status. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.historicalOrders({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders */ historicalOrders(params: HistoricalOrdersParameters, signal?: AbortSignal): Promise<HistoricalOrdersResponse>; /** * Request to check if a user is a VIP. * * @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 Boolean indicating user's VIP status. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.isVip({ user: "0x..." }); * ``` * * @see null */ isVip(params: IsVipParameters, signal?: AbortSignal): Promise<IsVipResponse>; /** * Request L2 order book. * * @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 L2 order book snapshot. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.l2Book({ coin: "ETH", nSigFigs: 2 }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot */ l2Book(params: L2BookParameters, signal?: AbortSignal): Promise<L2BookResponse>; /** * Request leading vaults for a user. * * @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 leading vaults for a user. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.leadingVaults({ user: "0x..." }); * ``` * * @see null */ leadingVaults(params: LeadingVaultsParameters, signal?: AbortSignal): Promise<LeadingVaultsResponse>; /** * Request legal verification status of a user. * * @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 Legal verification status for a user. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.legalCheck({ user: "0x..." }); * ``` * * @see null */ legalCheck(params: LegalCheckParameters, signal?: AbortSignal): Promise<LegalCheckResponse>; /** * Request liquidatable. * * @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 * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.liquidatable(); * ``` * * @see null */ liquidatable(signal?: AbortSignal): Promise<LiquidatableResponse>; /** * Request margin table data. * * @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 Margin requirements table with multiple tiers. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.marginTable({ id: 1 }); * ``` * * @see null */ marginTable(params: MarginTableParameters, signal?: AbortSignal): Promise<MarginTableResponse>; /** * Request builder fee approval. * * @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 Maximum builder fee approval. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.maxBuilderFee({ user: "0x...", builder: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#check-builder-fee-approval */ maxBuilderFee(params: MaxBuilderFeeParameters, signal?: AbortSignal): Promise<MaxBuilderFeeResponse>; /** * Request maximum market order notionals. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Maximum market order notionals. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.maxMarketOrderNtls(); * ``` * * @see null */ maxMarketOrderNtls(signal?: AbortSignal): Promise<MaxMarketOrderNtlsResponse>; /** * Request trading metadata. * * @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 Metadata for perpetual assets. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.meta(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables */ meta(params?: MetaParameters, signal?: AbortSignal): Promise<MetaResponse>; meta(signal?: AbortSignal): Promise<MetaResponse>; /** * Request metadata and asset contexts. * * @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 Metadata and context for perpetual assets. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.metaAndAssetCtxs(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc */ metaAndAssetCtxs(params?: MetaAndAssetCtxsParameters, signal?: AbortSignal): Promise<MetaAndAssetCtxsResponse>; metaAndAssetCtxs(signal?: AbortSignal): Promise<MetaAndAssetCtxsResponse>; /** * Request open orders. * * @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 open orders. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.openOrders({ user: "0x..." }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders */ openOrders(params: OpenOrdersParameters, signal?: AbortSignal): Promise<OpenOrdersResponse>; /** * Request order status. * * @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 Order status response. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.orderStatus({ user: "0x...", oid: 12345 }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid */ orderStatus(params: OrderStatusParameters, signal?: AbortSignal): Promise<OrderStatusResponse>; /** * Request prediction market outcome metadata. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Prediction market outcome metadata including outcomes and questions. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.outcomeMeta(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-outcome-metadata */ outcomeMeta(signal?: AbortSignal): Promise<OutcomeMetaResponse>; /** * Request perp annotation. * * @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 Perp annotation for an asset. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpAnnotation({ coin: "BTC" }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perp-annotation */ perpAnnotation(params: PerpAnnotationParameters, signal?: AbortSignal): Promise<PerpAnnotationResponse>; /** * Request all perpetual asset categories. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Array of tuples mapping coin names to their categories. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpCategories(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perp-categories */ perpCategories(signal?: AbortSignal): Promise<PerpCategoriesResponse>; /** * Request concise annotations for all perpetual assets. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Array of tuples mapping coin names to their concise annotations. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpConciseAnnotations(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-concise-perp-annotations */ perpConciseAnnotations(signal?: AbortSignal): Promise<PerpConciseAnnotationsResponse>; /** * Request for the status of the perpetual deploy auction. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Status of the perpetual deploy auction. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpDeployAuctionStatus(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-information-about-the-perp-deploy-auction */ perpDeployAuctionStatus(signal?: AbortSignal): Promise<PerpDeployAuctionStatusResponse>; /** * Request builder deployed perpetual market limits. * * @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 Builder deployed perpetual market limits. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpDexLimits({ dex: "test" }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-builder-deployed-perp-market-limits */ perpDexLimits(params: PerpDexLimitsParameters, signal?: AbortSignal): Promise<PerpDexLimitsResponse>; /** * Request all perpetual dexs. * * @param signal {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal} to cancel the request. * @return Array of perpetual dexes (null is main dex). * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpDexs(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-all-perpetual-dexs */ perpDexs(signal?: AbortSignal): Promise<PerpDexsResponse>; /** * Request perp DEX status. * * @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 Status of a perp DEX. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpDexStatus({ dex: "test" }); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#get-perp-market-status */ perpDexStatus(params: PerpDexStatusParameters, signal?: AbortSignal): Promise<PerpDexStatusResponse>; /** * Request perpetuals at open interest cap. * * @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 perpetuals at open interest caps. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data = await client.perpsAtOpenInterestCap(); * ``` * * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#query-perps-at-open-interest-caps */ perpsAtOpenInterestCap(params?: PerpsAtOpenInterestCapParameters, signal?: AbortSignal): Promise<PerpsAtOpenInterestCapResponse>; perpsAtOpenInterestCap(signal?: AbortSignal): Promise<PerpsAtOpenInterestCapResponse>; /** * Request user portfolio. * * @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 Portfolio metrics grouped by time periods. * * @throws {ValidationError} When the request parameters fail validation (before sending). * @throws {TransportError} When the transport layer throws an error. * * @example * ```ts * import * as hl from "@nktkas/hyperliquid"; * * const transport = new hl.HttpTransport(); // or `WebSocketTransport` * const client = new hl.InfoClient({ transport }); * * const data =