@nktkas/hyperliquid 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +59 -0
- package/LICENSE +21 -0
- package/README.md +363 -0
- package/SECURITY.md +7 -0
- package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts +2 -0
- package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +1 -0
- package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts +95 -0
- package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts.map +1 -0
- package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +10 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts +23 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +43 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.d.ts +55 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.js +65 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.d.ts +2 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.js +1 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.d.ts +52 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js +283 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/utils.d.ts +120 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@noble/hashes/1.7.1/src/utils.js +211 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts +19 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.4/concat.js +32 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts +2 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +26 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts +37 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.js +109 -0
- package/esm/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts +37 -0
- package/esm/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/msgpack/1.0.2/encode.js +237 -0
- package/esm/mod.d.ts +24 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +9 -0
- package/esm/package.json +3 -0
- package/esm/src/clients/event.d.ts +374 -0
- package/esm/src/clients/event.d.ts.map +1 -0
- package/esm/src/clients/event.js +490 -0
- package/esm/src/clients/public.d.ts +695 -0
- package/esm/src/clients/public.d.ts.map +1 -0
- package/esm/src/clients/public.js +704 -0
- package/esm/src/clients/wallet.d.ts +682 -0
- package/esm/src/clients/wallet.d.ts.map +1 -0
- package/esm/src/clients/wallet.js +984 -0
- package/esm/src/transports/base.d.ts +55 -0
- package/esm/src/transports/base.d.ts.map +1 -0
- package/esm/src/transports/base.js +14 -0
- package/esm/src/transports/http/http_transport.d.ts +78 -0
- package/esm/src/transports/http/http_transport.d.ts.map +1 -0
- package/esm/src/transports/http/http_transport.js +170 -0
- package/esm/src/transports/websocket/hyperliquid_event_target.d.ts +66 -0
- package/esm/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -0
- package/esm/src/transports/websocket/hyperliquid_event_target.js +33 -0
- package/esm/src/transports/websocket/reconnecting_websocket.d.ts +160 -0
- package/esm/src/transports/websocket/reconnecting_websocket.d.ts.map +1 -0
- package/esm/src/transports/websocket/reconnecting_websocket.js +370 -0
- package/esm/src/transports/websocket/websocket_request_dispatcher.d.ts +63 -0
- package/esm/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -0
- package/esm/src/transports/websocket/websocket_request_dispatcher.js +201 -0
- package/esm/src/transports/websocket/websocket_transport.d.ts +117 -0
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -0
- package/esm/src/transports/websocket/websocket_transport.js +233 -0
- package/esm/src/utils/key_sort.d.ts +21 -0
- package/esm/src/utils/key_sort.d.ts.map +1 -0
- package/esm/src/utils/key_sort.js +124 -0
- package/esm/src/utils/signing.d.ts +109 -0
- package/esm/src/utils/signing.d.ts.map +1 -0
- package/esm/src/utils/signing.js +164 -0
- package/package.json +34 -0
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts +2 -0
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +17 -0
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts +95 -0
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts.map +1 -0
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +14 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts +23 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +49 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.d.ts +55 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.js +88 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.d.ts +2 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.js +4 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.d.ts +52 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js +288 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.d.ts +120 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.d.ts.map +1 -0
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.js +235 -0
- package/script/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts +19 -0
- package/script/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/bytes/1.0.4/concat.js +35 -0
- package/script/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts +2 -0
- package/script/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +29 -0
- package/script/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts +37 -0
- package/script/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.6/hex.js +113 -0
- package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts +37 -0
- package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.js +240 -0
- package/script/mod.d.ts +24 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +27 -0
- package/script/package.json +3 -0
- package/script/src/clients/event.d.ts +374 -0
- package/script/src/clients/event.d.ts.map +1 -0
- package/script/src/clients/event.js +494 -0
- package/script/src/clients/public.d.ts +695 -0
- package/script/src/clients/public.d.ts.map +1 -0
- package/script/src/clients/public.js +708 -0
- package/script/src/clients/wallet.d.ts +682 -0
- package/script/src/clients/wallet.d.ts.map +1 -0
- package/script/src/clients/wallet.js +989 -0
- package/script/src/transports/base.d.ts +55 -0
- package/script/src/transports/base.d.ts.map +1 -0
- package/script/src/transports/base.js +18 -0
- package/script/src/transports/http/http_transport.d.ts +78 -0
- package/script/src/transports/http/http_transport.d.ts.map +1 -0
- package/script/src/transports/http/http_transport.js +175 -0
- package/script/src/transports/websocket/hyperliquid_event_target.d.ts +66 -0
- package/script/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -0
- package/script/src/transports/websocket/hyperliquid_event_target.js +37 -0
- package/script/src/transports/websocket/reconnecting_websocket.d.ts +160 -0
- package/script/src/transports/websocket/reconnecting_websocket.d.ts.map +1 -0
- package/script/src/transports/websocket/reconnecting_websocket.js +374 -0
- package/script/src/transports/websocket/websocket_request_dispatcher.d.ts +63 -0
- package/script/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -0
- package/script/src/transports/websocket/websocket_request_dispatcher.js +206 -0
- package/script/src/transports/websocket/websocket_transport.d.ts +117 -0
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -0
- package/script/src/transports/websocket/websocket_transport.js +237 -0
- package/script/src/utils/key_sort.d.ts +21 -0
- package/script/src/utils/key_sort.d.ts.map +1 -0
- package/script/src/utils/key_sort.js +127 -0
- package/script/src/utils/signing.d.ts +109 -0
- package/script/src/utils/signing.d.ts.map +1 -0
- package/script/src/utils/signing.js +172 -0
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
import type { IRequestTransport } from "../transports/base.js";
|
|
2
|
+
import type { BlockDetailsRequest, TxDetailsRequest } from "../types/explorer/requests";
|
|
3
|
+
import type { BlockDetailsResponse, TxDetailsResponse } from "../types/explorer/responses";
|
|
4
|
+
import type { ExtraAgent, PerpsClearinghouseState, Referral, SpotClearinghouseState, SubAccount, UserFees, UserFundingUpdate, UserNonFundingLedgerUpdate, UserRateLimit } from "../types/info/accounts";
|
|
5
|
+
import type { AllMids, Candle, FundingHistory, PerpsMeta, PerpsMetaAndAssetCtxs, PredictedFunding, SpotDeployState, SpotMeta, SpotMetaAndAssetCtxs, TokenDetails } from "../types/info/assets";
|
|
6
|
+
import type { Book, Fill, FrontendOrder, Order, OrderLookup, OrderStatus, TwapHistory, TwapSliceFill } from "../types/info/orders";
|
|
7
|
+
import type { CandleSnapshotRequest, ClearinghouseStateRequest, ExtraAgentsRequest, FrontendOpenOrdersRequest, FundingHistoryRequest, HistoricalOrdersRequest, L2BookRequest, MaxBuilderFeeRequest, OpenOrdersRequest, OrderStatusRequest, ReferralRequest, SpotClearinghouseStateRequest, SpotDeployStateRequest, SubAccountsRequest, TokenDetailsRequest, TwapHistoryRequest, UserFeesRequest, UserFillsByTimeRequest, UserFillsRequest, UserFundingRequest, UserNonFundingLedgerUpdatesRequest, UserRateLimitRequest, UserTwapSliceFillsRequest, UserVaultEquitiesRequest, VaultDetailsRequest } from "../types/info/requests";
|
|
8
|
+
import type { VaultDetails, VaultEquity, VaultSummary } from "../types/info/vaults";
|
|
9
|
+
/** Parameters for the {@linkcode PublicClient} constructor. */
|
|
10
|
+
export interface PublicClientParameters<T extends IRequestTransport = IRequestTransport> {
|
|
11
|
+
/** The transport used to connect to the Hyperliquid API. */
|
|
12
|
+
transport: T;
|
|
13
|
+
}
|
|
14
|
+
/** Parameters for the {@linkcode PublicClient.candleSnapshot} method. */
|
|
15
|
+
export type CandleSnapshotParameters = CandleSnapshotRequest["req"];
|
|
16
|
+
/** Parameters for the {@linkcode PublicClient.clearinghouseState} method. */
|
|
17
|
+
export type ClearinghouseStateParameters = Omit<ClearinghouseStateRequest, "type">;
|
|
18
|
+
/** Parameters for the {@linkcode PublicClient.extraAgents} method. */
|
|
19
|
+
export type ExtraAgentsParameters = Omit<ExtraAgentsRequest, "type">;
|
|
20
|
+
/** Parameters for the {@linkcode PublicClient.frontendOpenOrders} method. */
|
|
21
|
+
export type FrontendOpenOrdersParameters = Omit<FrontendOpenOrdersRequest, "type">;
|
|
22
|
+
/** Parameters for the {@linkcode PublicClient.fundingHistory} method. */
|
|
23
|
+
export type FundingHistoryParameters = Omit<FundingHistoryRequest, "type">;
|
|
24
|
+
/** Parameters for the {@linkcode PublicClient.historicalOrders} method. */
|
|
25
|
+
export type HistoricalOrdersParameters = Omit<HistoricalOrdersRequest, "type">;
|
|
26
|
+
/** Parameters for the {@linkcode PublicClient.l2Book} method. */
|
|
27
|
+
export type L2BookParameters = Omit<L2BookRequest, "type">;
|
|
28
|
+
/** Parameters for the {@linkcode PublicClient.maxBuilderFee} method. */
|
|
29
|
+
export type MaxBuilderFeeParameters = Omit<MaxBuilderFeeRequest, "type">;
|
|
30
|
+
/** Parameters for the {@linkcode PublicClient.openOrders} method. */
|
|
31
|
+
export type OpenOrdersParameters = Omit<OpenOrdersRequest, "type">;
|
|
32
|
+
/** Parameters for the {@linkcode PublicClient.orderStatus} method. */
|
|
33
|
+
export type OrderStatusParameters = Omit<OrderStatusRequest, "type">;
|
|
34
|
+
/** Parameters for the {@linkcode PublicClient.referral} method. */
|
|
35
|
+
export type ReferralParameters = Omit<ReferralRequest, "type">;
|
|
36
|
+
/** Parameters for the {@linkcode PublicClient.spotClearinghouseState} method. */
|
|
37
|
+
export type SpotClearinghouseStateParameters = Omit<SpotClearinghouseStateRequest, "type">;
|
|
38
|
+
/** Parameters for the {@linkcode PublicClient.spotDeployState} method. */
|
|
39
|
+
export type SpotDeployStateParameters = Omit<SpotDeployStateRequest, "type">;
|
|
40
|
+
/** Parameters for the {@linkcode PublicClient.subAccounts} method. */
|
|
41
|
+
export type SubAccountsParameters = Omit<SubAccountsRequest, "type">;
|
|
42
|
+
/** Parameters for the {@linkcode PublicClient.tokenDetails} method. */
|
|
43
|
+
export type TokenDetailsParameters = Omit<TokenDetailsRequest, "type">;
|
|
44
|
+
/** Parameters for the {@linkcode PublicClient.twapHistory} method. */
|
|
45
|
+
export type TwapHistoryParameters = Omit<TwapHistoryRequest, "type">;
|
|
46
|
+
/** Parameters for the {@linkcode PublicClient.userFees} method. */
|
|
47
|
+
export type UserFeesParameters = Omit<UserFeesRequest, "type">;
|
|
48
|
+
/** Parameters for the {@linkcode PublicClient.userFills} method. */
|
|
49
|
+
export type UserFillsParameters = Omit<UserFillsRequest, "type">;
|
|
50
|
+
/** Parameters for the {@linkcode PublicClient.userFillsByTime} method. */
|
|
51
|
+
export type UserFillsByTimeParameters = Omit<UserFillsByTimeRequest, "type">;
|
|
52
|
+
/** Parameters for the {@linkcode PublicClient.userFunding} method. */
|
|
53
|
+
export type UserFundingParameters = Omit<UserFundingRequest, "type">;
|
|
54
|
+
/** Parameters for the {@linkcode PublicClient.userNonFundingLedgerUpdates} method. */
|
|
55
|
+
export type UserNonFundingLedgerUpdatesParameters = Omit<UserNonFundingLedgerUpdatesRequest, "type">;
|
|
56
|
+
/** Parameters for the {@linkcode PublicClient.userRateLimit} method. */
|
|
57
|
+
export type UserRateLimitParameters = Omit<UserRateLimitRequest, "type">;
|
|
58
|
+
/** Parameters for the {@linkcode PublicClient.userTwapSliceFills} method. */
|
|
59
|
+
export type UserTwapSliceFillsParameters = Omit<UserTwapSliceFillsRequest, "type">;
|
|
60
|
+
/** Parameters for the {@linkcode PublicClient.userVaultEquities} method. */
|
|
61
|
+
export type UserVaultEquitiesParameters = Omit<UserVaultEquitiesRequest, "type">;
|
|
62
|
+
/** Parameters for the {@linkcode PublicClient.vaultDetails} method. */
|
|
63
|
+
export type VaultDetailsParameters = Omit<VaultDetailsRequest, "type">;
|
|
64
|
+
/** Parameters for the {@linkcode PublicClient.blockDetails} method. */
|
|
65
|
+
export type BlockDetailsParameters = Omit<BlockDetailsRequest, "type">;
|
|
66
|
+
/** Parameters for the {@linkcode PublicClient.txDetails} method. */
|
|
67
|
+
export type TxDetailsParameters = Omit<TxDetailsRequest, "type">;
|
|
68
|
+
/**
|
|
69
|
+
* Public client for interacting with the Hyperliquid API.
|
|
70
|
+
* @typeParam T - The type of transport used to connect to the Hyperliquid API.
|
|
71
|
+
*/
|
|
72
|
+
export declare class PublicClient<T extends IRequestTransport = IRequestTransport> {
|
|
73
|
+
/** The transport used to connect to the Hyperliquid API. */
|
|
74
|
+
transport: T;
|
|
75
|
+
/**
|
|
76
|
+
* Initialises a new instance.
|
|
77
|
+
* @param args - The arguments for initialisation.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
82
|
+
*
|
|
83
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
84
|
+
* const client = new hl.PublicClient({ transport });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
constructor(args: PublicClientParameters<T>);
|
|
88
|
+
/**
|
|
89
|
+
* Request mid coin prices.
|
|
90
|
+
* @param signal - An optional abort signal.
|
|
91
|
+
* @returns Mid coin prices.
|
|
92
|
+
*
|
|
93
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins | Hyperliquid GitBook}
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
97
|
+
*
|
|
98
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
99
|
+
* const client = new hl.PublicClient({ transport });
|
|
100
|
+
*
|
|
101
|
+
* const allMids = await client.allMids();
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
allMids(signal?: AbortSignal): Promise<AllMids>;
|
|
105
|
+
/**
|
|
106
|
+
* Request candlestick snapshots.
|
|
107
|
+
* @param args - The parameters for the request.
|
|
108
|
+
* @param signal - An optional abort signal.
|
|
109
|
+
* @returns Array of candlestick data points.
|
|
110
|
+
*
|
|
111
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot | Hyperliquid GitBook}
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
115
|
+
*
|
|
116
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
117
|
+
* const client = new hl.PublicClient({ transport });
|
|
118
|
+
*
|
|
119
|
+
* const candles = await client.candleSnapshot({
|
|
120
|
+
* coin: "ETH",
|
|
121
|
+
* interval: "1h",
|
|
122
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
candleSnapshot(args: CandleSnapshotParameters, signal?: AbortSignal): Promise<Candle[]>;
|
|
127
|
+
/**
|
|
128
|
+
* Request clearinghouse state.
|
|
129
|
+
* @param args - The parameters for the request.
|
|
130
|
+
* @param signal - An optional abort signal.
|
|
131
|
+
* @returns Account summary for perpetual trading.
|
|
132
|
+
*
|
|
133
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary | Hyperliquid GitBook}
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
137
|
+
*
|
|
138
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
139
|
+
* const client = new hl.PublicClient({ transport });
|
|
140
|
+
*
|
|
141
|
+
* const state = await client.clearinghouseState({ user: "0x..." });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
clearinghouseState(args: ClearinghouseStateParameters, signal?: AbortSignal): Promise<PerpsClearinghouseState>;
|
|
145
|
+
/**
|
|
146
|
+
* Request user's extra agents.
|
|
147
|
+
* @param args - The parameters for the request.
|
|
148
|
+
* @param signal - An optional abort signal.
|
|
149
|
+
* @returns User's extra agents.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
154
|
+
*
|
|
155
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
156
|
+
* const client = new hl.PublicClient({ transport });
|
|
157
|
+
*
|
|
158
|
+
* const extraAgents = await client.extraAgents({ user: "0x..." });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
extraAgents(args: ExtraAgentsParameters, signal?: AbortSignal): Promise<ExtraAgent[]>;
|
|
162
|
+
/**
|
|
163
|
+
* Request frontend open orders.
|
|
164
|
+
* @param args - The parameters for the request.
|
|
165
|
+
* @param signal - An optional abort signal.
|
|
166
|
+
* @returns Array of open orders with additional frontend information.
|
|
167
|
+
*
|
|
168
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders-with-additional-frontend-info | Hyperliquid GitBook}
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
172
|
+
*
|
|
173
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
174
|
+
* const client = new hl.PublicClient({ transport });
|
|
175
|
+
*
|
|
176
|
+
* const orders = await client.frontendOpenOrders({ user: "0x..." });
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
frontendOpenOrders(args: FrontendOpenOrdersParameters, signal?: AbortSignal): Promise<FrontendOrder[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Request funding history.
|
|
182
|
+
* @param args - The parameters for the request.
|
|
183
|
+
* @param signal - An optional abort signal.
|
|
184
|
+
* @returns Array of historical funding rate data for an asset.
|
|
185
|
+
*
|
|
186
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates | Hyperliquid GitBook}
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
190
|
+
*
|
|
191
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
192
|
+
* const client = new hl.PublicClient({ transport });
|
|
193
|
+
*
|
|
194
|
+
* const funding = await client.fundingHistory({
|
|
195
|
+
* coin: "ETH",
|
|
196
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
197
|
+
* });
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
fundingHistory(args: FundingHistoryParameters, signal?: AbortSignal): Promise<FundingHistory[]>;
|
|
201
|
+
/**
|
|
202
|
+
* Request user's historical orders.
|
|
203
|
+
* @param args - The parameters for the request.
|
|
204
|
+
* @param signal - An optional abort signal.
|
|
205
|
+
* @returns Array of user's historical orders.
|
|
206
|
+
*
|
|
207
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders | Hyperliquid GitBook}
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
211
|
+
*
|
|
212
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
213
|
+
* const client = new hl.PublicClient({ transport });
|
|
214
|
+
*
|
|
215
|
+
* const orders = await client.historicalOrders({ user: "0x..." });
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
historicalOrders(args: HistoricalOrdersParameters, signal?: AbortSignal): Promise<OrderStatus<FrontendOrder>[]>;
|
|
219
|
+
/**
|
|
220
|
+
* Request L2 order book.
|
|
221
|
+
* @param args - The parameters for the request.
|
|
222
|
+
* @param signal - An optional abort signal.
|
|
223
|
+
* @returns L2 order book snapshot.
|
|
224
|
+
*
|
|
225
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot | Hyperliquid GitBook}
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
229
|
+
*
|
|
230
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
231
|
+
* const client = new hl.PublicClient({ transport });
|
|
232
|
+
*
|
|
233
|
+
* const book = await client.l2Book({ coin: "ETH", nSigFigs: 2 });
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
l2Book(args: L2BookParameters, signal?: AbortSignal): Promise<Book>;
|
|
237
|
+
/**
|
|
238
|
+
* Request builder fee approval.
|
|
239
|
+
* @param args - The parameters for the request.
|
|
240
|
+
* @param signal - An optional abort signal.
|
|
241
|
+
* @returns Maximum builder fee approval.
|
|
242
|
+
*
|
|
243
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#check-builder-fee-approval | Hyperliquid GitBook}
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
247
|
+
*
|
|
248
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
249
|
+
* const client = new hl.PublicClient({ transport });
|
|
250
|
+
*
|
|
251
|
+
* const maxBuilderFee = await client.maxBuilderFee({ user: "0x...", builder: "0x..." });
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
maxBuilderFee(args: MaxBuilderFeeParameters, signal?: AbortSignal): Promise<number>;
|
|
255
|
+
/**
|
|
256
|
+
* Request trading metadata.
|
|
257
|
+
* @param signal - An optional abort signal.
|
|
258
|
+
* @returns Metadata for perpetual assets.
|
|
259
|
+
*
|
|
260
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata | Hyperliquid GitBook}
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
264
|
+
*
|
|
265
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
266
|
+
* const client = new hl.PublicClient({ transport });
|
|
267
|
+
*
|
|
268
|
+
* const meta = await client.meta();
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
meta(signal?: AbortSignal): Promise<PerpsMeta>;
|
|
272
|
+
/**
|
|
273
|
+
* Request metadata and asset contexts.
|
|
274
|
+
* @param signal - An optional abort signal.
|
|
275
|
+
* @returns Metadata and context information for each perpetual asset.
|
|
276
|
+
*
|
|
277
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc | Hyperliquid GitBook}
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
281
|
+
*
|
|
282
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
283
|
+
* const client = new hl.PublicClient({ transport });
|
|
284
|
+
*
|
|
285
|
+
* const [meta, assetCtxs] = await client.metaAndAssetCtxs();
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
metaAndAssetCtxs(signal?: AbortSignal): Promise<PerpsMetaAndAssetCtxs>;
|
|
289
|
+
/**
|
|
290
|
+
* Request open orders.
|
|
291
|
+
* @param args - The parameters for the request.
|
|
292
|
+
* @param signal - An optional abort signal.
|
|
293
|
+
* @returns Array of open order.
|
|
294
|
+
*
|
|
295
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders | Hyperliquid GitBook}
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
299
|
+
*
|
|
300
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
301
|
+
* const client = new hl.PublicClient({ transport });
|
|
302
|
+
*
|
|
303
|
+
* const orders = await client.openOrders({ user: "0x..." });
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
openOrders(args: OpenOrdersParameters, signal?: AbortSignal): Promise<Order[]>;
|
|
307
|
+
/**
|
|
308
|
+
* Request order status.
|
|
309
|
+
* @param args - The parameters for the request.
|
|
310
|
+
* @param signal - An optional abort signal.
|
|
311
|
+
* @returns Result of an order status lookup.
|
|
312
|
+
*
|
|
313
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid | Hyperliquid GitBook}
|
|
314
|
+
* @example
|
|
315
|
+
* ```ts
|
|
316
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
317
|
+
*
|
|
318
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
319
|
+
* const client = new hl.PublicClient({ transport });
|
|
320
|
+
*
|
|
321
|
+
* const status = await client.orderStatus({ user: "0x...", oid: 12345 });
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
orderStatus(args: OrderStatusParameters, signal?: AbortSignal): Promise<OrderLookup>;
|
|
325
|
+
/**
|
|
326
|
+
* Request predicted funding rates.
|
|
327
|
+
* @param signal - An optional abort signal.
|
|
328
|
+
* @returns Array of predicted funding rates.
|
|
329
|
+
*
|
|
330
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-predicted-funding-rates-for-different-venues | Hyperliquid GitBook}
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
334
|
+
*
|
|
335
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
336
|
+
* const client = new hl.PublicClient({ transport });
|
|
337
|
+
*
|
|
338
|
+
* const predictedFundings = await client.predictedFundings();
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
predictedFundings(signal?: AbortSignal): Promise<PredictedFunding[]>;
|
|
342
|
+
/**
|
|
343
|
+
* Request user referral.
|
|
344
|
+
* @param args - The parameters for the request.
|
|
345
|
+
* @param signal - An optional abort signal.
|
|
346
|
+
* @returns Referral information for a user.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```ts
|
|
350
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
351
|
+
*
|
|
352
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
353
|
+
* const client = new hl.PublicClient({ transport });
|
|
354
|
+
*
|
|
355
|
+
* const referral = await client.referral({ user: "0x..." });
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
referral(args: ReferralParameters, signal?: AbortSignal): Promise<Referral>;
|
|
359
|
+
/**
|
|
360
|
+
* Request spot clearinghouse state.
|
|
361
|
+
* @param args - The parameters for the request.
|
|
362
|
+
* @param signal - An optional abort signal.
|
|
363
|
+
* @returns Balances for spot tokens.
|
|
364
|
+
*
|
|
365
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances | Hyperliquid GitBook}
|
|
366
|
+
* @example
|
|
367
|
+
* ```ts
|
|
368
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
369
|
+
*
|
|
370
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
371
|
+
* const client = new hl.PublicClient({ transport });
|
|
372
|
+
*
|
|
373
|
+
* const state = await client.spotClearinghouseState({ user: "0x..." });
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
spotClearinghouseState(args: SpotClearinghouseStateParameters, signal?: AbortSignal): Promise<SpotClearinghouseState>;
|
|
377
|
+
/**
|
|
378
|
+
* Request spot deploy state.
|
|
379
|
+
* @param args - The parameters for the request.
|
|
380
|
+
* @param signal - An optional abort signal.
|
|
381
|
+
* @returns The deploy state of a user.
|
|
382
|
+
*
|
|
383
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-deploy-auction | Hyperliquid GitBook}
|
|
384
|
+
*/
|
|
385
|
+
spotDeployState(args: SpotDeployStateParameters, signal?: AbortSignal): Promise<SpotDeployState>;
|
|
386
|
+
/**
|
|
387
|
+
* Request spot trading metadata.
|
|
388
|
+
* @param signal - An optional abort signal.
|
|
389
|
+
* @returns Metadata for spot assets.
|
|
390
|
+
*
|
|
391
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-metadata | Hyperliquid GitBook}
|
|
392
|
+
* @example
|
|
393
|
+
* ```ts
|
|
394
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
395
|
+
*
|
|
396
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
397
|
+
* const client = new hl.PublicClient({ transport });
|
|
398
|
+
*
|
|
399
|
+
* const meta = await client.spotMeta();
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
spotMeta(signal?: AbortSignal): Promise<SpotMeta>;
|
|
403
|
+
/**
|
|
404
|
+
* Request spot metadata and asset contexts.
|
|
405
|
+
* @param signal - An optional abort signal.
|
|
406
|
+
* @returns Metadata and context information for each spot asset.
|
|
407
|
+
*
|
|
408
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts | Hyperliquid GitBook}
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
412
|
+
*
|
|
413
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
414
|
+
* const client = new hl.PublicClient({ transport });
|
|
415
|
+
*
|
|
416
|
+
* const [meta, assetCtxs] = await client.spotMetaAndAssetCtxs();
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
spotMetaAndAssetCtxs(signal?: AbortSignal): Promise<SpotMetaAndAssetCtxs>;
|
|
420
|
+
/**
|
|
421
|
+
* Request user sub-accounts.
|
|
422
|
+
* @param args - The parameters for the request.
|
|
423
|
+
* @param signal - An optional abort signal.
|
|
424
|
+
* @returns Array of user sub-account.
|
|
425
|
+
*
|
|
426
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-subaccounts | Hyperliquid GitBook}
|
|
427
|
+
* @example
|
|
428
|
+
* ```ts
|
|
429
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
430
|
+
*
|
|
431
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
432
|
+
* const client = new hl.PublicClient({ transport });
|
|
433
|
+
*
|
|
434
|
+
* const subAccounts = await client.subAccounts({ user: "0x..." });
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
subAccounts(args: SubAccountsParameters, signal?: AbortSignal): Promise<SubAccount[] | null>;
|
|
438
|
+
/**
|
|
439
|
+
* Request token details.
|
|
440
|
+
* @param args - The parameters for the request.
|
|
441
|
+
* @param signal - An optional abort signal.
|
|
442
|
+
* @returns The details of a token.
|
|
443
|
+
*
|
|
444
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-a-token | Hyperliquid GitBook}
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
448
|
+
*
|
|
449
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
450
|
+
* const client = new hl.PublicClient({ transport });
|
|
451
|
+
*
|
|
452
|
+
* const details = await client.tokenDetails({ tokenId: "0x..." });
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
tokenDetails(args: TokenDetailsParameters, signal?: AbortSignal): Promise<TokenDetails>;
|
|
456
|
+
/**
|
|
457
|
+
* Request twap history of a user.
|
|
458
|
+
* @param args - The parameters for the request.
|
|
459
|
+
* @param signal - An optional abort signal.
|
|
460
|
+
* @returns The twap history of a user.
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```ts
|
|
464
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
465
|
+
*
|
|
466
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
467
|
+
* const client = new hl.PublicClient({ transport });
|
|
468
|
+
*
|
|
469
|
+
* const twapHistory = await client.twapHistory({ user: "0x..." });
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
twapHistory(args: TwapHistoryParameters, signal?: AbortSignal): Promise<TwapHistory[]>;
|
|
473
|
+
/**
|
|
474
|
+
* Request user fees.
|
|
475
|
+
* @param args - The parameters for the request.
|
|
476
|
+
* @param signal - An optional abort signal.
|
|
477
|
+
* @returns User fees.
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* ```ts
|
|
481
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
482
|
+
*
|
|
483
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
484
|
+
* const client = new hl.PublicClient({ transport });
|
|
485
|
+
*
|
|
486
|
+
* const userFees = await client.userFees({ user: "0x..." });
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
userFees(args: UserFeesParameters, signal?: AbortSignal): Promise<UserFees>;
|
|
490
|
+
/**
|
|
491
|
+
* Request user fills.
|
|
492
|
+
* @param args - The parameters for the request.
|
|
493
|
+
* @param signal - An optional abort signal.
|
|
494
|
+
* @returns Array of user's trade fill.
|
|
495
|
+
*
|
|
496
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills | Hyperliquid GitBook}
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
500
|
+
*
|
|
501
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
502
|
+
* const client = new hl.PublicClient({ transport });
|
|
503
|
+
*
|
|
504
|
+
* const fills = await client.userFills({ user: "0x..." });
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
userFills(args: UserFillsParameters, signal?: AbortSignal): Promise<Fill[]>;
|
|
508
|
+
/**
|
|
509
|
+
* Request user fills by time.
|
|
510
|
+
* @param args - The parameters for the request.
|
|
511
|
+
* @param signal - An optional abort signal.
|
|
512
|
+
* @returns Array of user's trade fill.
|
|
513
|
+
*
|
|
514
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time | Hyperliquid GitBook}
|
|
515
|
+
* @example
|
|
516
|
+
* ```ts
|
|
517
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
518
|
+
*
|
|
519
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
520
|
+
* const client = new hl.PublicClient({ transport });
|
|
521
|
+
*
|
|
522
|
+
* const fills = await client.userFillsByTime({
|
|
523
|
+
* user: "0x...",
|
|
524
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
525
|
+
* });
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
userFillsByTime(args: UserFillsByTimeParameters, signal?: AbortSignal): Promise<Fill[]>;
|
|
529
|
+
/**
|
|
530
|
+
* Request user funding.
|
|
531
|
+
* @param args - The parameters for the request.
|
|
532
|
+
* @param signal - An optional abort signal.
|
|
533
|
+
* @returns Array of user's funding ledger update.
|
|
534
|
+
*
|
|
535
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates | Hyperliquid GitBook}
|
|
536
|
+
* @example
|
|
537
|
+
* ```ts
|
|
538
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
539
|
+
*
|
|
540
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
541
|
+
* const client = new hl.PublicClient({ transport });
|
|
542
|
+
*
|
|
543
|
+
* const funding = await client.userFunding({
|
|
544
|
+
* user: "0x...",
|
|
545
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
546
|
+
* });
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
userFunding(args: UserFundingParameters, signal?: AbortSignal): Promise<UserFundingUpdate[]>;
|
|
550
|
+
/**
|
|
551
|
+
* Request user non-funding ledger updates.
|
|
552
|
+
* @param args - The parameters for the request.
|
|
553
|
+
* @param signal - An optional abort signal.
|
|
554
|
+
* @returns Array of user's non-funding ledger update.
|
|
555
|
+
*
|
|
556
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates | Hyperliquid GitBook}
|
|
557
|
+
* @example
|
|
558
|
+
* ```ts
|
|
559
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
560
|
+
*
|
|
561
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
562
|
+
* const client = new hl.PublicClient({ transport });
|
|
563
|
+
*
|
|
564
|
+
* const funding = await client.userNonFundingLedgerUpdates({
|
|
565
|
+
* user: "0x...",
|
|
566
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
567
|
+
* });
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
userNonFundingLedgerUpdates(args: UserNonFundingLedgerUpdatesParameters, signal?: AbortSignal): Promise<UserNonFundingLedgerUpdate[]>;
|
|
571
|
+
/**
|
|
572
|
+
* Request user rate limits.
|
|
573
|
+
* @param args - The parameters for the request.
|
|
574
|
+
* @param signal - An optional abort signal.
|
|
575
|
+
* @returns User's rate limits.
|
|
576
|
+
*
|
|
577
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-user-rate-limits | Hyperliquid GitBook}
|
|
578
|
+
* @example
|
|
579
|
+
* ```ts
|
|
580
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
581
|
+
*
|
|
582
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
583
|
+
* const client = new hl.PublicClient({ transport });
|
|
584
|
+
*
|
|
585
|
+
* const rateLimit = await client.userRateLimit({ user: "0x..." });
|
|
586
|
+
* ```
|
|
587
|
+
*/
|
|
588
|
+
userRateLimit(args: UserRateLimitParameters, signal?: AbortSignal): Promise<UserRateLimit>;
|
|
589
|
+
/**
|
|
590
|
+
* Request user twap slice fills.
|
|
591
|
+
* @param args - The parameters for the request.
|
|
592
|
+
* @param signal - An optional abort signal.
|
|
593
|
+
* @returns Array of user's twap slice fill.
|
|
594
|
+
*
|
|
595
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-twap-slice-fills | Hyperliquid GitBook}
|
|
596
|
+
* @example
|
|
597
|
+
* ```ts
|
|
598
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
599
|
+
*
|
|
600
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
601
|
+
* const client = new hl.PublicClient({ transport });
|
|
602
|
+
*
|
|
603
|
+
* const fills = await client.userTwapSliceFills({ user: "0x..." });
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
userTwapSliceFills(args: UserTwapSliceFillsParameters, signal?: AbortSignal): Promise<TwapSliceFill[]>;
|
|
607
|
+
/**
|
|
608
|
+
* Request user vault deposits.
|
|
609
|
+
* @param args - The parameters for the request.
|
|
610
|
+
* @param signal - An optional abort signal.
|
|
611
|
+
* @returns Array of user's vault deposits.
|
|
612
|
+
*
|
|
613
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-vault-deposits | Hyperliquid GitBook}
|
|
614
|
+
* @example
|
|
615
|
+
* ```ts
|
|
616
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
617
|
+
*
|
|
618
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
619
|
+
* const client = new hl.PublicClient({ transport });
|
|
620
|
+
*
|
|
621
|
+
* const deposits = await client.userVaultDeposits({ user: "0x..." });
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
userVaultEquities(args: UserVaultEquitiesParameters, signal?: AbortSignal): Promise<VaultEquity[]>;
|
|
625
|
+
/**
|
|
626
|
+
* Request details of a vault.
|
|
627
|
+
* @param args - The parameters for the request.
|
|
628
|
+
* @param signal - An optional abort signal.
|
|
629
|
+
* @returns Details of a vault.
|
|
630
|
+
*
|
|
631
|
+
* @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-details-for-a-vault | Hyperliquid GitBook}
|
|
632
|
+
* @example
|
|
633
|
+
* ```ts
|
|
634
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
635
|
+
*
|
|
636
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
637
|
+
* const client = new hl.PublicClient({ transport });
|
|
638
|
+
*
|
|
639
|
+
* const vault = await client.vaultDetails({ vaultAddress: "0x..." });
|
|
640
|
+
* ```
|
|
641
|
+
*/
|
|
642
|
+
vaultDetails(args: VaultDetailsParameters, signal?: AbortSignal): Promise<VaultDetails | null>;
|
|
643
|
+
/**
|
|
644
|
+
* Request a list of vaults less than 2 hours old.
|
|
645
|
+
* @param args - The parameters for the request.
|
|
646
|
+
* @param signal - An optional abort signal.
|
|
647
|
+
* @returns Array of vault summaries.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```ts
|
|
651
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
652
|
+
*
|
|
653
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
654
|
+
* const client = new hl.PublicClient({ transport });
|
|
655
|
+
*
|
|
656
|
+
* const vaults = await client.vaultSummaries();
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
vaultSummaries(signal?: AbortSignal): Promise<VaultSummary[]>;
|
|
660
|
+
/**
|
|
661
|
+
* Gets the details of a block.
|
|
662
|
+
* @param args - The parameters for the request.
|
|
663
|
+
* @param signal - An optional abort signal.
|
|
664
|
+
* @returns A promise that resolves with the details of the block.
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```ts
|
|
668
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
669
|
+
*
|
|
670
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
671
|
+
* const client = new hl.PublicClient({ transport });
|
|
672
|
+
*
|
|
673
|
+
* const { blockDetails } = await client.blockDetails({ height: 123 });
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
blockDetails(args: BlockDetailsParameters, signal?: AbortSignal): Promise<BlockDetailsResponse>;
|
|
677
|
+
/**
|
|
678
|
+
* Gets the details of a transaction.
|
|
679
|
+
* @param args - The parameters for the request.
|
|
680
|
+
* @param signal - An optional abort signal.
|
|
681
|
+
* @returns A promise that resolves with the details of the transaction.
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* ```ts
|
|
685
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
686
|
+
*
|
|
687
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
688
|
+
* const client = new hl.PublicClient({ transport });
|
|
689
|
+
*
|
|
690
|
+
* const { tx } = await client.txDetails({ hash: "0x..." });
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
txDetails(args: TxDetailsParameters, signal?: AbortSignal): Promise<TxDetailsResponse>;
|
|
694
|
+
}
|
|
695
|
+
//# sourceMappingURL=public.d.ts.map
|