@nktkas/hyperliquid 0.23.0 → 0.24.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 +3 -2
- package/README.md +184 -186
- package/esm/mod.d.ts +2 -2
- package/esm/mod.d.ts.map +1 -1
- package/esm/src/base.d.ts +0 -5
- package/esm/src/base.d.ts.map +1 -1
- package/esm/src/clients/exchange.d.ts +430 -393
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +467 -927
- package/esm/src/clients/info.d.ts +330 -185
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +348 -334
- package/esm/src/clients/multiSign.d.ts +14 -1184
- package/esm/src/clients/multiSign.d.ts.map +1 -1
- package/esm/src/clients/multiSign.js +37 -2004
- package/esm/src/clients/subscription.d.ts +95 -93
- package/esm/src/clients/subscription.d.ts.map +1 -1
- package/esm/src/clients/subscription.js +101 -146
- package/esm/src/signing/_signTypedData/ethers.d.ts +16 -4
- package/esm/src/signing/_signTypedData/ethers.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/ethers.js +1 -1
- package/esm/src/signing/_signTypedData/mod.d.ts +12 -12
- package/esm/src/signing/_signTypedData/mod.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/mod.js +52 -24
- package/esm/src/signing/_signTypedData/private_key.d.ts +6 -5
- package/esm/src/signing/_signTypedData/private_key.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/private_key.js +40 -19
- package/esm/src/signing/_signTypedData/viem.d.ts +27 -6
- package/esm/src/signing/_signTypedData/viem.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/viem.js +1 -1
- package/esm/src/signing/_sorter.d.ts +12 -21
- package/esm/src/signing/_sorter.d.ts.map +1 -1
- package/esm/src/signing/_sorter.js +30 -63
- package/esm/src/signing/mod.d.ts +177 -127
- package/esm/src/signing/mod.d.ts.map +1 -1
- package/esm/src/signing/mod.js +182 -130
- package/esm/src/transports/base.d.ts +2 -1
- package/esm/src/transports/base.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.d.ts +3 -2
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +4 -4
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -2
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/esm/src/transports/websocket/_websocket_async_request.js +17 -21
- package/esm/src/transports/websocket/websocket_transport.d.ts +4 -4
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +6 -6
- package/esm/src/types/exchange/requests.d.ts +492 -306
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/exchange/responses.d.ts +105 -25
- package/esm/src/types/exchange/responses.d.ts.map +1 -1
- package/esm/src/types/explorer/requests.d.ts +3 -3
- package/esm/src/types/explorer/requests.d.ts.map +1 -1
- package/esm/src/types/explorer/responses.d.ts +1 -1
- package/esm/src/types/explorer/responses.d.ts.map +1 -1
- package/esm/src/types/info/accounts.d.ts +403 -98
- package/esm/src/types/info/accounts.d.ts.map +1 -1
- package/esm/src/types/info/assets.d.ts +131 -35
- package/esm/src/types/info/assets.d.ts.map +1 -1
- package/esm/src/types/info/markets.d.ts +35 -8
- package/esm/src/types/info/markets.d.ts.map +1 -1
- package/esm/src/types/info/orders.d.ts +62 -17
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +194 -76
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/{script/src/types/info/delegations.d.ts → esm/src/types/info/validators.d.ts} +45 -15
- package/esm/src/types/info/validators.d.ts.map +1 -0
- package/esm/src/types/info/vaults.d.ts +32 -10
- package/esm/src/types/info/vaults.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +2 -2
- package/esm/src/types/mod.d.ts.map +1 -1
- package/esm/src/types/subscriptions/requests.d.ts +21 -66
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
- package/esm/src/types/subscriptions/responses.d.ts +46 -55
- package/esm/src/types/subscriptions/responses.d.ts.map +1 -1
- package/package.json +2 -3
- package/script/mod.d.ts +2 -2
- package/script/mod.d.ts.map +1 -1
- package/script/src/base.d.ts +0 -5
- package/script/src/base.d.ts.map +1 -1
- package/script/src/clients/exchange.d.ts +430 -393
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +466 -926
- package/script/src/clients/info.d.ts +330 -185
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +348 -334
- package/script/src/clients/multiSign.d.ts +14 -1184
- package/script/src/clients/multiSign.d.ts.map +1 -1
- package/script/src/clients/multiSign.js +38 -2005
- package/script/src/clients/subscription.d.ts +95 -93
- package/script/src/clients/subscription.d.ts.map +1 -1
- package/script/src/clients/subscription.js +101 -146
- package/script/src/signing/_signTypedData/ethers.d.ts +16 -4
- package/script/src/signing/_signTypedData/ethers.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/ethers.js +2 -2
- package/script/src/signing/_signTypedData/mod.d.ts +12 -12
- package/script/src/signing/_signTypedData/mod.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/mod.js +51 -26
- package/script/src/signing/_signTypedData/private_key.d.ts +6 -5
- package/script/src/signing/_signTypedData/private_key.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/private_key.js +40 -18
- package/script/src/signing/_signTypedData/viem.d.ts +27 -6
- package/script/src/signing/_signTypedData/viem.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/viem.js +2 -2
- package/script/src/signing/_sorter.d.ts +12 -21
- package/script/src/signing/_sorter.d.ts.map +1 -1
- package/script/src/signing/_sorter.js +30 -63
- package/script/src/signing/mod.d.ts +177 -127
- package/script/src/signing/mod.d.ts.map +1 -1
- package/script/src/signing/mod.js +185 -148
- package/script/src/transports/base.d.ts +2 -1
- package/script/src/transports/base.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.d.ts +3 -2
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +4 -4
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/script/src/transports/websocket/_hyperliquid_event_target.js +1 -2
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/script/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/script/src/transports/websocket/_websocket_async_request.js +17 -21
- package/script/src/transports/websocket/websocket_transport.d.ts +4 -4
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +6 -6
- package/script/src/types/exchange/requests.d.ts +492 -306
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/exchange/responses.d.ts +105 -25
- package/script/src/types/exchange/responses.d.ts.map +1 -1
- package/script/src/types/explorer/requests.d.ts +3 -3
- package/script/src/types/explorer/requests.d.ts.map +1 -1
- package/script/src/types/explorer/responses.d.ts +1 -1
- package/script/src/types/explorer/responses.d.ts.map +1 -1
- package/script/src/types/info/accounts.d.ts +403 -98
- package/script/src/types/info/accounts.d.ts.map +1 -1
- package/script/src/types/info/assets.d.ts +131 -35
- package/script/src/types/info/assets.d.ts.map +1 -1
- package/script/src/types/info/markets.d.ts +35 -8
- package/script/src/types/info/markets.d.ts.map +1 -1
- package/script/src/types/info/orders.d.ts +62 -17
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +194 -76
- package/script/src/types/info/requests.d.ts.map +1 -1
- package/{esm/src/types/info/delegations.d.ts → script/src/types/info/validators.d.ts} +45 -15
- package/script/src/types/info/validators.d.ts.map +1 -0
- package/script/src/types/info/vaults.d.ts +32 -10
- package/script/src/types/info/vaults.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +2 -2
- package/script/src/types/mod.d.ts.map +1 -1
- package/script/src/types/subscriptions/requests.d.ts +21 -66
- package/script/src/types/subscriptions/requests.d.ts.map +1 -1
- package/script/src/types/subscriptions/responses.d.ts +46 -55
- package/script/src/types/subscriptions/responses.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/window.d.ts +0 -29
- package/esm/src/signing/_signTypedData/window.d.ts.map +0 -1
- package/esm/src/signing/_signTypedData/window.js +0 -30
- package/esm/src/types/info/delegations.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/window.d.ts +0 -29
- package/script/src/signing/_signTypedData/window.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/window.js +0 -34
- package/script/src/types/info/delegations.d.ts.map +0 -1
- /package/esm/src/types/info/{delegations.js → validators.js} +0 -0
- /package/script/src/types/info/{delegations.js → validators.js} +0 -0
|
@@ -22,19 +22,39 @@ class InfoClient {
|
|
|
22
22
|
constructor(args) {
|
|
23
23
|
this.transport = args.transport;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Request user active asset data.
|
|
27
|
+
* @param params - An optional request-specific parameters.
|
|
28
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
29
|
+
* @returns User active asset data.
|
|
30
|
+
*
|
|
31
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
32
|
+
*
|
|
33
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-active-asset-data
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
37
|
+
*
|
|
38
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
39
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
40
|
+
*
|
|
41
|
+
* const data = await infoClient.activeAssetData({ user: "0x...", coin: "BTC" });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
activeAssetData(params, signal) {
|
|
45
|
+
const request = { type: "activeAssetData", ...params };
|
|
46
|
+
return this.transport.request("info", request, signal);
|
|
47
|
+
}
|
|
48
|
+
allMids(params_or_signal, maybeSignal) {
|
|
49
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
50
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
51
|
+
const request = { type: "allMids", ...params };
|
|
32
52
|
return this.transport.request("info", request, signal);
|
|
33
53
|
}
|
|
34
54
|
/**
|
|
35
55
|
* Block details by block height.
|
|
36
|
-
* @param
|
|
37
|
-
* @param signal - An
|
|
56
|
+
* @param params - Request-specific parameters.
|
|
57
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
38
58
|
* @returns Block details.
|
|
39
59
|
*
|
|
40
60
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -44,24 +64,21 @@ class InfoClient {
|
|
|
44
64
|
* ```ts
|
|
45
65
|
* import * as hl from "@nktkas/hyperliquid";
|
|
46
66
|
*
|
|
47
|
-
* const transport = new hl.HttpTransport(); //
|
|
67
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
48
68
|
* const infoClient = new hl.InfoClient({ transport });
|
|
49
69
|
*
|
|
50
70
|
* const data = await infoClient.blockDetails({ height: 123 });
|
|
51
71
|
* ```
|
|
52
72
|
*/
|
|
53
|
-
|
|
54
|
-
const request = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
const { blockDetails } = await this.transport.request("explorer", request, signal);
|
|
59
|
-
return blockDetails;
|
|
73
|
+
blockDetails(params, signal) {
|
|
74
|
+
const request = { type: "blockDetails", ...params };
|
|
75
|
+
return this.transport.request("explorer", request, signal)
|
|
76
|
+
.then(({ blockDetails }) => blockDetails);
|
|
60
77
|
}
|
|
61
78
|
/**
|
|
62
79
|
* Request candlestick snapshots.
|
|
63
|
-
* @param
|
|
64
|
-
* @param signal - An
|
|
80
|
+
* @param params - Request-specific parameters.
|
|
81
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
65
82
|
* @returns Array of candlestick data points.
|
|
66
83
|
*
|
|
67
84
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -81,17 +98,14 @@ class InfoClient {
|
|
|
81
98
|
* });
|
|
82
99
|
* ```
|
|
83
100
|
*/
|
|
84
|
-
candleSnapshot(
|
|
85
|
-
const request = {
|
|
86
|
-
type: "candleSnapshot",
|
|
87
|
-
req: args,
|
|
88
|
-
};
|
|
101
|
+
candleSnapshot(params, signal) {
|
|
102
|
+
const request = { type: "candleSnapshot", req: params };
|
|
89
103
|
return this.transport.request("info", request, signal);
|
|
90
104
|
}
|
|
91
105
|
/**
|
|
92
106
|
* Request clearinghouse state.
|
|
93
|
-
* @param
|
|
94
|
-
* @param signal - An
|
|
107
|
+
* @param params - Request-specific parameters.
|
|
108
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
95
109
|
* @returns Account summary for perpetual trading.
|
|
96
110
|
*
|
|
97
111
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -107,17 +121,14 @@ class InfoClient {
|
|
|
107
121
|
* const data = await infoClient.clearinghouseState({ user: "0x..." });
|
|
108
122
|
* ```
|
|
109
123
|
*/
|
|
110
|
-
clearinghouseState(
|
|
111
|
-
const request = {
|
|
112
|
-
type: "clearinghouseState",
|
|
113
|
-
...args,
|
|
114
|
-
};
|
|
124
|
+
clearinghouseState(params, signal) {
|
|
125
|
+
const request = { type: "clearinghouseState", ...params };
|
|
115
126
|
return this.transport.request("info", request, signal);
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
118
129
|
* Request user staking delegations.
|
|
119
|
-
* @param
|
|
120
|
-
* @param signal - An
|
|
130
|
+
* @param params - Request-specific parameters.
|
|
131
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
121
132
|
* @returns Array of user's delegations to validators.
|
|
122
133
|
*
|
|
123
134
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -133,17 +144,14 @@ class InfoClient {
|
|
|
133
144
|
* const data = await infoClient.delegations({ user: "0x..." });
|
|
134
145
|
* ```
|
|
135
146
|
*/
|
|
136
|
-
delegations(
|
|
137
|
-
const request = {
|
|
138
|
-
type: "delegations",
|
|
139
|
-
...args,
|
|
140
|
-
};
|
|
147
|
+
delegations(params, signal) {
|
|
148
|
+
const request = { type: "delegations", ...params };
|
|
141
149
|
return this.transport.request("info", request, signal);
|
|
142
150
|
}
|
|
143
151
|
/**
|
|
144
152
|
* Request user staking history.
|
|
145
|
-
* @param
|
|
146
|
-
* @param signal - An
|
|
153
|
+
* @param params - Request-specific parameters.
|
|
154
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
147
155
|
* @returns Array of user's staking updates.
|
|
148
156
|
*
|
|
149
157
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -159,17 +167,14 @@ class InfoClient {
|
|
|
159
167
|
* const data = await infoClient.delegatorHistory({ user: "0x..." });
|
|
160
168
|
* ```
|
|
161
169
|
*/
|
|
162
|
-
delegatorHistory(
|
|
163
|
-
const request = {
|
|
164
|
-
type: "delegatorHistory",
|
|
165
|
-
...args,
|
|
166
|
-
};
|
|
170
|
+
delegatorHistory(params, signal) {
|
|
171
|
+
const request = { type: "delegatorHistory", ...params };
|
|
167
172
|
return this.transport.request("info", request, signal);
|
|
168
173
|
}
|
|
169
174
|
/**
|
|
170
175
|
* Request user staking rewards.
|
|
171
|
-
* @param
|
|
172
|
-
* @param signal - An
|
|
176
|
+
* @param params - Request-specific parameters.
|
|
177
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
173
178
|
* @returns Array of user's staking rewards.
|
|
174
179
|
*
|
|
175
180
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -185,17 +190,14 @@ class InfoClient {
|
|
|
185
190
|
* const data = await infoClient.delegatorRewards({ user: "0x..." });
|
|
186
191
|
* ```
|
|
187
192
|
*/
|
|
188
|
-
delegatorRewards(
|
|
189
|
-
const request = {
|
|
190
|
-
type: "delegatorRewards",
|
|
191
|
-
...args,
|
|
192
|
-
};
|
|
193
|
+
delegatorRewards(params, signal) {
|
|
194
|
+
const request = { type: "delegatorRewards", ...params };
|
|
193
195
|
return this.transport.request("info", request, signal);
|
|
194
196
|
}
|
|
195
197
|
/**
|
|
196
198
|
* Request user staking summary.
|
|
197
|
-
* @param
|
|
198
|
-
* @param signal - An
|
|
199
|
+
* @param params - Request-specific parameters.
|
|
200
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
199
201
|
* @returns Summary of a user's staking delegations.
|
|
200
202
|
*
|
|
201
203
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -211,17 +213,36 @@ class InfoClient {
|
|
|
211
213
|
* const data = await infoClient.delegatorSummary({ user: "0x..." });
|
|
212
214
|
* ```
|
|
213
215
|
*/
|
|
214
|
-
delegatorSummary(
|
|
215
|
-
const request = {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
delegatorSummary(params, signal) {
|
|
217
|
+
const request = { type: "delegatorSummary", ...params };
|
|
218
|
+
return this.transport.request("info", request, signal);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Request exchange status information.
|
|
222
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
223
|
+
* @returns Exchange system status information.
|
|
224
|
+
*
|
|
225
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
226
|
+
*
|
|
227
|
+
* @see null
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
231
|
+
*
|
|
232
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
233
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
234
|
+
*
|
|
235
|
+
* const data = await infoClient.exchangeStatus();
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
exchangeStatus(signal) {
|
|
239
|
+
const request = { type: "exchangeStatus" };
|
|
219
240
|
return this.transport.request("info", request, signal);
|
|
220
241
|
}
|
|
221
242
|
/**
|
|
222
243
|
* Request user's extra agents.
|
|
223
|
-
* @param
|
|
224
|
-
* @param signal - An
|
|
244
|
+
* @param params - Request-specific parameters.
|
|
245
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
225
246
|
* @returns User's extra agents.
|
|
226
247
|
*
|
|
227
248
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -237,17 +258,14 @@ class InfoClient {
|
|
|
237
258
|
* const data = await infoClient.extraAgents({ user: "0x..." });
|
|
238
259
|
* ```
|
|
239
260
|
*/
|
|
240
|
-
extraAgents(
|
|
241
|
-
const request = {
|
|
242
|
-
type: "extraAgents",
|
|
243
|
-
...args,
|
|
244
|
-
};
|
|
261
|
+
extraAgents(params, signal) {
|
|
262
|
+
const request = { type: "extraAgents", ...params };
|
|
245
263
|
return this.transport.request("info", request, signal);
|
|
246
264
|
}
|
|
247
265
|
/**
|
|
248
266
|
* Request frontend open orders.
|
|
249
|
-
* @param
|
|
250
|
-
* @param signal - An
|
|
267
|
+
* @param params - Request-specific parameters.
|
|
268
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
251
269
|
* @returns Array of open orders with additional frontend information.
|
|
252
270
|
*
|
|
253
271
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -263,17 +281,14 @@ class InfoClient {
|
|
|
263
281
|
* const data = await infoClient.frontendOpenOrders({ user: "0x..." });
|
|
264
282
|
* ```
|
|
265
283
|
*/
|
|
266
|
-
frontendOpenOrders(
|
|
267
|
-
const request = {
|
|
268
|
-
type: "frontendOpenOrders",
|
|
269
|
-
...args,
|
|
270
|
-
};
|
|
284
|
+
frontendOpenOrders(params, signal) {
|
|
285
|
+
const request = { type: "frontendOpenOrders", ...params };
|
|
271
286
|
return this.transport.request("info", request, signal);
|
|
272
287
|
}
|
|
273
288
|
/**
|
|
274
289
|
* Request funding history.
|
|
275
|
-
* @param
|
|
276
|
-
* @param signal - An
|
|
290
|
+
* @param params - Request-specific parameters.
|
|
291
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
277
292
|
* @returns Array of historical funding rate data for an asset.
|
|
278
293
|
*
|
|
279
294
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -292,17 +307,14 @@ class InfoClient {
|
|
|
292
307
|
* });
|
|
293
308
|
* ```
|
|
294
309
|
*/
|
|
295
|
-
fundingHistory(
|
|
296
|
-
const request = {
|
|
297
|
-
type: "fundingHistory",
|
|
298
|
-
...args,
|
|
299
|
-
};
|
|
310
|
+
fundingHistory(params, signal) {
|
|
311
|
+
const request = { type: "fundingHistory", ...params };
|
|
300
312
|
return this.transport.request("info", request, signal);
|
|
301
313
|
}
|
|
302
314
|
/**
|
|
303
315
|
* Request user's historical orders.
|
|
304
|
-
* @param
|
|
305
|
-
* @param signal - An
|
|
316
|
+
* @param params - Request-specific parameters.
|
|
317
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
306
318
|
* @returns Array of user's historical orders.
|
|
307
319
|
*
|
|
308
320
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -318,17 +330,14 @@ class InfoClient {
|
|
|
318
330
|
* const data = await infoClient.historicalOrders({ user: "0x..." });
|
|
319
331
|
* ```
|
|
320
332
|
*/
|
|
321
|
-
historicalOrders(
|
|
322
|
-
const request = {
|
|
323
|
-
type: "historicalOrders",
|
|
324
|
-
...args,
|
|
325
|
-
};
|
|
333
|
+
historicalOrders(params, signal) {
|
|
334
|
+
const request = { type: "historicalOrders", ...params };
|
|
326
335
|
return this.transport.request("info", request, signal);
|
|
327
336
|
}
|
|
328
337
|
/**
|
|
329
338
|
* Request to check if a user is a VIP.
|
|
330
|
-
* @param
|
|
331
|
-
* @param signal - An
|
|
339
|
+
* @param params - Request-specific parameters.
|
|
340
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
332
341
|
* @returns Boolean indicating user's VIP status.
|
|
333
342
|
*
|
|
334
343
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -344,17 +353,14 @@ class InfoClient {
|
|
|
344
353
|
* const data = await infoClient.isVip({ user: "0x..." });
|
|
345
354
|
* ```
|
|
346
355
|
*/
|
|
347
|
-
isVip(
|
|
348
|
-
const request = {
|
|
349
|
-
type: "isVip",
|
|
350
|
-
...args,
|
|
351
|
-
};
|
|
356
|
+
isVip(params, signal) {
|
|
357
|
+
const request = { type: "isVip", ...params };
|
|
352
358
|
return this.transport.request("info", request, signal);
|
|
353
359
|
}
|
|
354
360
|
/**
|
|
355
361
|
* Request L2 order book.
|
|
356
|
-
* @param
|
|
357
|
-
* @param signal - An
|
|
362
|
+
* @param params - Request-specific parameters.
|
|
363
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
358
364
|
* @returns L2 order book snapshot.
|
|
359
365
|
*
|
|
360
366
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -370,17 +376,37 @@ class InfoClient {
|
|
|
370
376
|
* const data = await infoClient.l2Book({ coin: "ETH", nSigFigs: 2 });
|
|
371
377
|
* ```
|
|
372
378
|
*/
|
|
373
|
-
l2Book(
|
|
374
|
-
const request = {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
379
|
+
l2Book(params, signal) {
|
|
380
|
+
const request = { type: "l2Book", ...params };
|
|
381
|
+
return this.transport.request("info", request, signal);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Request leading vaults for a user.
|
|
385
|
+
* @param params - Request-specific parameters.
|
|
386
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
387
|
+
* @returns
|
|
388
|
+
*
|
|
389
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
390
|
+
*
|
|
391
|
+
* @see null
|
|
392
|
+
* @example
|
|
393
|
+
* ```ts
|
|
394
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
395
|
+
*
|
|
396
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
397
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
398
|
+
*
|
|
399
|
+
* const data = await infoClient.leadingVaults({ user: "0x..." });
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
leadingVaults(params, signal) {
|
|
403
|
+
const request = { type: "leadingVaults", ...params };
|
|
378
404
|
return this.transport.request("info", request, signal);
|
|
379
405
|
}
|
|
380
406
|
/**
|
|
381
407
|
* Request legal verification status of a user.
|
|
382
|
-
* @param
|
|
383
|
-
* @param signal - An
|
|
408
|
+
* @param params - Request-specific parameters.
|
|
409
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
384
410
|
* @returns Legal verification status for a user.
|
|
385
411
|
*
|
|
386
412
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -396,17 +422,59 @@ class InfoClient {
|
|
|
396
422
|
* const data = await infoClient.legalCheck({ user: "0x..." });
|
|
397
423
|
* ```
|
|
398
424
|
*/
|
|
399
|
-
legalCheck(
|
|
400
|
-
const request = {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
425
|
+
legalCheck(params, signal) {
|
|
426
|
+
const request = { type: "legalCheck", ...params };
|
|
427
|
+
return this.transport.request("info", request, signal);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Request liquidatable.
|
|
431
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
432
|
+
* @returns
|
|
433
|
+
*
|
|
434
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
435
|
+
*
|
|
436
|
+
* @see null
|
|
437
|
+
* @example
|
|
438
|
+
* ```ts
|
|
439
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
440
|
+
*
|
|
441
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
442
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
443
|
+
*
|
|
444
|
+
* const data = await infoClient.liquidatable();
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
liquidatable(signal) {
|
|
448
|
+
const request = { type: "liquidatable" };
|
|
449
|
+
return this.transport.request("info", request, signal);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Request margin table data.
|
|
453
|
+
* @param params - Request-specific parameters.
|
|
454
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
455
|
+
* @returns Margin requirements table with multiple tiers.
|
|
456
|
+
*
|
|
457
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
458
|
+
*
|
|
459
|
+
* @see null
|
|
460
|
+
* @example
|
|
461
|
+
* ```ts
|
|
462
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
463
|
+
*
|
|
464
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
465
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
466
|
+
*
|
|
467
|
+
* const data = await infoClient.marginTable({ id: 1 });
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
marginTable(params, signal) {
|
|
471
|
+
const request = { type: "marginTable", ...params };
|
|
404
472
|
return this.transport.request("info", request, signal);
|
|
405
473
|
}
|
|
406
474
|
/**
|
|
407
475
|
* Request builder fee approval.
|
|
408
|
-
* @param
|
|
409
|
-
* @param signal - An
|
|
476
|
+
* @param params - Request-specific parameters.
|
|
477
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
410
478
|
* @returns Maximum builder fee approval.
|
|
411
479
|
*
|
|
412
480
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -422,25 +490,41 @@ class InfoClient {
|
|
|
422
490
|
* const data = await infoClient.maxBuilderFee({ user: "0x...", builder: "0x..." });
|
|
423
491
|
* ```
|
|
424
492
|
*/
|
|
425
|
-
maxBuilderFee(
|
|
426
|
-
const request = {
|
|
427
|
-
type: "maxBuilderFee",
|
|
428
|
-
...args,
|
|
429
|
-
};
|
|
493
|
+
maxBuilderFee(params, signal) {
|
|
494
|
+
const request = { type: "maxBuilderFee", ...params };
|
|
430
495
|
return this.transport.request("info", request, signal);
|
|
431
496
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
497
|
+
/**
|
|
498
|
+
* Request maximum market order notionals.
|
|
499
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
500
|
+
* @returns
|
|
501
|
+
*
|
|
502
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
503
|
+
*
|
|
504
|
+
* @see null
|
|
505
|
+
* @example
|
|
506
|
+
* ```ts
|
|
507
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
508
|
+
*
|
|
509
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
510
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
511
|
+
*
|
|
512
|
+
* const data = await infoClient.maxMarketOrderNtls();
|
|
513
|
+
* ```
|
|
514
|
+
*/
|
|
515
|
+
maxMarketOrderNtls(signal) {
|
|
516
|
+
const request = { type: "maxMarketOrderNtls" };
|
|
517
|
+
return this.transport.request("info", request, signal);
|
|
518
|
+
}
|
|
519
|
+
meta(params_or_signal, maybeSignal) {
|
|
520
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
521
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
522
|
+
const request = { type: "meta", ...params };
|
|
439
523
|
return this.transport.request("info", request, signal);
|
|
440
524
|
}
|
|
441
525
|
/**
|
|
442
526
|
* Request metadata and asset contexts.
|
|
443
|
-
* @param signal - An
|
|
527
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
444
528
|
* @returns Metadata and context for perpetual assets.
|
|
445
529
|
*
|
|
446
530
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -457,15 +541,13 @@ class InfoClient {
|
|
|
457
541
|
* ```
|
|
458
542
|
*/
|
|
459
543
|
metaAndAssetCtxs(signal) {
|
|
460
|
-
const request = {
|
|
461
|
-
type: "metaAndAssetCtxs",
|
|
462
|
-
};
|
|
544
|
+
const request = { type: "metaAndAssetCtxs" };
|
|
463
545
|
return this.transport.request("info", request, signal);
|
|
464
546
|
}
|
|
465
547
|
/**
|
|
466
548
|
* Request open orders.
|
|
467
|
-
* @param
|
|
468
|
-
* @param signal - An
|
|
549
|
+
* @param params - Request-specific parameters.
|
|
550
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
469
551
|
* @returns Array of open order.
|
|
470
552
|
*
|
|
471
553
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -481,17 +563,14 @@ class InfoClient {
|
|
|
481
563
|
* const data = await infoClient.openOrders({ user: "0x..." });
|
|
482
564
|
* ```
|
|
483
565
|
*/
|
|
484
|
-
openOrders(
|
|
485
|
-
const request = {
|
|
486
|
-
type: "openOrders",
|
|
487
|
-
...args,
|
|
488
|
-
};
|
|
566
|
+
openOrders(params, signal) {
|
|
567
|
+
const request = { type: "openOrders", ...params };
|
|
489
568
|
return this.transport.request("info", request, signal);
|
|
490
569
|
}
|
|
491
570
|
/**
|
|
492
571
|
* Request order status.
|
|
493
|
-
* @param
|
|
494
|
-
* @param signal - An
|
|
572
|
+
* @param params - Request-specific parameters.
|
|
573
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
495
574
|
* @returns Result of an order status lookup.
|
|
496
575
|
*
|
|
497
576
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -507,16 +586,13 @@ class InfoClient {
|
|
|
507
586
|
* const data = await infoClient.orderStatus({ user: "0x...", oid: 12345 });
|
|
508
587
|
* ```
|
|
509
588
|
*/
|
|
510
|
-
orderStatus(
|
|
511
|
-
const request = {
|
|
512
|
-
type: "orderStatus",
|
|
513
|
-
...args,
|
|
514
|
-
};
|
|
589
|
+
orderStatus(params, signal) {
|
|
590
|
+
const request = { type: "orderStatus", ...params };
|
|
515
591
|
return this.transport.request("info", request, signal);
|
|
516
592
|
}
|
|
517
593
|
/**
|
|
518
594
|
* Request for the status of the perpetual deploy auction.
|
|
519
|
-
* @param signal - An
|
|
595
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
520
596
|
* @returns Status of the perpetual deploy auction.
|
|
521
597
|
*
|
|
522
598
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -533,14 +609,12 @@ class InfoClient {
|
|
|
533
609
|
* ```
|
|
534
610
|
*/
|
|
535
611
|
perpDeployAuctionStatus(signal) {
|
|
536
|
-
const request = {
|
|
537
|
-
type: "perpDeployAuctionStatus",
|
|
538
|
-
};
|
|
612
|
+
const request = { type: "perpDeployAuctionStatus" };
|
|
539
613
|
return this.transport.request("info", request, signal);
|
|
540
614
|
}
|
|
541
615
|
/**
|
|
542
616
|
* Request all perpetual dexs.
|
|
543
|
-
* @param signal - An
|
|
617
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
544
618
|
* @returns Array of perpetual dexes (null is main dex).
|
|
545
619
|
*
|
|
546
620
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -557,15 +631,12 @@ class InfoClient {
|
|
|
557
631
|
* ```
|
|
558
632
|
*/
|
|
559
633
|
perpDexs(signal) {
|
|
560
|
-
const request = {
|
|
561
|
-
type: "perpDexs",
|
|
562
|
-
};
|
|
634
|
+
const request = { type: "perpDexs" };
|
|
563
635
|
return this.transport.request("info", request, signal);
|
|
564
636
|
}
|
|
565
637
|
/**
|
|
566
638
|
* Request perpetuals at open interest cap.
|
|
567
|
-
* @param
|
|
568
|
-
* @param signal - An optional abort signal.
|
|
639
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
569
640
|
* @returns Array of perpetuals at open interest caps.
|
|
570
641
|
*
|
|
571
642
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -582,15 +653,13 @@ class InfoClient {
|
|
|
582
653
|
* ```
|
|
583
654
|
*/
|
|
584
655
|
perpsAtOpenInterestCap(signal) {
|
|
585
|
-
const request = {
|
|
586
|
-
type: "perpsAtOpenInterestCap",
|
|
587
|
-
};
|
|
656
|
+
const request = { type: "perpsAtOpenInterestCap" };
|
|
588
657
|
return this.transport.request("info", request, signal);
|
|
589
658
|
}
|
|
590
659
|
/**
|
|
591
660
|
* Request user portfolio.
|
|
592
|
-
* @param
|
|
593
|
-
* @param signal - An
|
|
661
|
+
* @param params - Request-specific parameters.
|
|
662
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
594
663
|
* @returns Portfolio metrics grouped by time periods.
|
|
595
664
|
*
|
|
596
665
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -606,16 +675,13 @@ class InfoClient {
|
|
|
606
675
|
* const data = await infoClient.portfolio({ user: "0x..." });
|
|
607
676
|
* ```
|
|
608
677
|
*/
|
|
609
|
-
portfolio(
|
|
610
|
-
const request = {
|
|
611
|
-
type: "portfolio",
|
|
612
|
-
...args,
|
|
613
|
-
};
|
|
678
|
+
portfolio(params, signal) {
|
|
679
|
+
const request = { type: "portfolio", ...params };
|
|
614
680
|
return this.transport.request("info", request, signal);
|
|
615
681
|
}
|
|
616
682
|
/**
|
|
617
683
|
* Request predicted funding rates.
|
|
618
|
-
* @param signal - An
|
|
684
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
619
685
|
* @returns Array of predicted funding rates.
|
|
620
686
|
*
|
|
621
687
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -632,15 +698,13 @@ class InfoClient {
|
|
|
632
698
|
* ```
|
|
633
699
|
*/
|
|
634
700
|
predictedFundings(signal) {
|
|
635
|
-
const request = {
|
|
636
|
-
type: "predictedFundings",
|
|
637
|
-
};
|
|
701
|
+
const request = { type: "predictedFundings" };
|
|
638
702
|
return this.transport.request("info", request, signal);
|
|
639
703
|
}
|
|
640
704
|
/**
|
|
641
705
|
* Request user's existence check before transfer.
|
|
642
|
-
* @param
|
|
643
|
-
* @param signal - An
|
|
706
|
+
* @param params - Request-specific parameters.
|
|
707
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
644
708
|
* @returns Pre-transfer user existence check result.
|
|
645
709
|
*
|
|
646
710
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -656,17 +720,14 @@ class InfoClient {
|
|
|
656
720
|
* const data = await infoClient.preTransferCheck({ user: "0x...", source: "0x..." });
|
|
657
721
|
* ```
|
|
658
722
|
*/
|
|
659
|
-
preTransferCheck(
|
|
660
|
-
const request = {
|
|
661
|
-
type: "preTransferCheck",
|
|
662
|
-
...args,
|
|
663
|
-
};
|
|
723
|
+
preTransferCheck(params, signal) {
|
|
724
|
+
const request = { type: "preTransferCheck", ...params };
|
|
664
725
|
return this.transport.request("info", request, signal);
|
|
665
726
|
}
|
|
666
727
|
/**
|
|
667
728
|
* Request user referral.
|
|
668
|
-
* @param
|
|
669
|
-
* @param signal - An
|
|
729
|
+
* @param params - Request-specific parameters.
|
|
730
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
670
731
|
* @returns Referral information for a user.
|
|
671
732
|
*
|
|
672
733
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -682,17 +743,14 @@ class InfoClient {
|
|
|
682
743
|
* const data = await infoClient.referral({ user: "0x..." });
|
|
683
744
|
* ```
|
|
684
745
|
*/
|
|
685
|
-
referral(
|
|
686
|
-
const request = {
|
|
687
|
-
type: "referral",
|
|
688
|
-
...args,
|
|
689
|
-
};
|
|
746
|
+
referral(params, signal) {
|
|
747
|
+
const request = { type: "referral", ...params };
|
|
690
748
|
return this.transport.request("info", request, signal);
|
|
691
749
|
}
|
|
692
750
|
/**
|
|
693
751
|
* Request spot clearinghouse state.
|
|
694
|
-
* @param
|
|
695
|
-
* @param signal - An
|
|
752
|
+
* @param params - Request-specific parameters.
|
|
753
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
696
754
|
* @returns Account summary for spot trading.
|
|
697
755
|
*
|
|
698
756
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -708,17 +766,14 @@ class InfoClient {
|
|
|
708
766
|
* const data = await infoClient.spotClearinghouseState({ user: "0x..." });
|
|
709
767
|
* ```
|
|
710
768
|
*/
|
|
711
|
-
spotClearinghouseState(
|
|
712
|
-
const request = {
|
|
713
|
-
type: "spotClearinghouseState",
|
|
714
|
-
...args,
|
|
715
|
-
};
|
|
769
|
+
spotClearinghouseState(params, signal) {
|
|
770
|
+
const request = { type: "spotClearinghouseState", ...params };
|
|
716
771
|
return this.transport.request("info", request, signal);
|
|
717
772
|
}
|
|
718
773
|
/**
|
|
719
774
|
* Request spot deploy state.
|
|
720
|
-
* @param
|
|
721
|
-
* @param signal - An
|
|
775
|
+
* @param params - Request-specific parameters.
|
|
776
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
722
777
|
* @returns Deploy state for spot tokens.
|
|
723
778
|
*
|
|
724
779
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -734,16 +789,13 @@ class InfoClient {
|
|
|
734
789
|
* const data = await infoClient.spotDeployState({ user: "0x..." });
|
|
735
790
|
* ```
|
|
736
791
|
*/
|
|
737
|
-
spotDeployState(
|
|
738
|
-
const request = {
|
|
739
|
-
type: "spotDeployState",
|
|
740
|
-
...args,
|
|
741
|
-
};
|
|
792
|
+
spotDeployState(params, signal) {
|
|
793
|
+
const request = { type: "spotDeployState", ...params };
|
|
742
794
|
return this.transport.request("info", request, signal);
|
|
743
795
|
}
|
|
744
796
|
/**
|
|
745
797
|
* Request spot trading metadata.
|
|
746
|
-
* @param signal - An
|
|
798
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
747
799
|
* @returns Metadata for spot assets.
|
|
748
800
|
*
|
|
749
801
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -760,14 +812,12 @@ class InfoClient {
|
|
|
760
812
|
* ```
|
|
761
813
|
*/
|
|
762
814
|
spotMeta(signal) {
|
|
763
|
-
const request = {
|
|
764
|
-
type: "spotMeta",
|
|
765
|
-
};
|
|
815
|
+
const request = { type: "spotMeta" };
|
|
766
816
|
return this.transport.request("info", request, signal);
|
|
767
817
|
}
|
|
768
818
|
/**
|
|
769
819
|
* Request spot metadata and asset contexts.
|
|
770
|
-
* @param signal - An
|
|
820
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
771
821
|
* @returns Metadata and context for spot assets.
|
|
772
822
|
*
|
|
773
823
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -784,15 +834,13 @@ class InfoClient {
|
|
|
784
834
|
* ```
|
|
785
835
|
*/
|
|
786
836
|
spotMetaAndAssetCtxs(signal) {
|
|
787
|
-
const request = {
|
|
788
|
-
type: "spotMetaAndAssetCtxs",
|
|
789
|
-
};
|
|
837
|
+
const request = { type: "spotMetaAndAssetCtxs" };
|
|
790
838
|
return this.transport.request("info", request, signal);
|
|
791
839
|
}
|
|
792
840
|
/**
|
|
793
841
|
* Request user sub-accounts.
|
|
794
|
-
* @param
|
|
795
|
-
* @param signal - An
|
|
842
|
+
* @param params - Request-specific parameters.
|
|
843
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
796
844
|
* @returns Array of user sub-account or null if the user does not have any sub-accounts.
|
|
797
845
|
*
|
|
798
846
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -808,17 +856,14 @@ class InfoClient {
|
|
|
808
856
|
* const data = await infoClient.subAccounts({ user: "0x..." });
|
|
809
857
|
* ```
|
|
810
858
|
*/
|
|
811
|
-
subAccounts(
|
|
812
|
-
const request = {
|
|
813
|
-
type: "subAccounts",
|
|
814
|
-
...args,
|
|
815
|
-
};
|
|
859
|
+
subAccounts(params, signal) {
|
|
860
|
+
const request = { type: "subAccounts", ...params };
|
|
816
861
|
return this.transport.request("info", request, signal);
|
|
817
862
|
}
|
|
818
863
|
/**
|
|
819
864
|
* Request token details.
|
|
820
|
-
* @param
|
|
821
|
-
* @param signal - An
|
|
865
|
+
* @param params - Request-specific parameters.
|
|
866
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
822
867
|
* @returns Details of a token.
|
|
823
868
|
*
|
|
824
869
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -834,17 +879,14 @@ class InfoClient {
|
|
|
834
879
|
* const data = await infoClient.tokenDetails({ tokenId: "0x..." });
|
|
835
880
|
* ```
|
|
836
881
|
*/
|
|
837
|
-
tokenDetails(
|
|
838
|
-
const request = {
|
|
839
|
-
type: "tokenDetails",
|
|
840
|
-
...args,
|
|
841
|
-
};
|
|
882
|
+
tokenDetails(params, signal) {
|
|
883
|
+
const request = { type: "tokenDetails", ...params };
|
|
842
884
|
return this.transport.request("info", request, signal);
|
|
843
885
|
}
|
|
844
886
|
/**
|
|
845
887
|
* Request twap history of a user.
|
|
846
|
-
* @param
|
|
847
|
-
* @param signal - An
|
|
888
|
+
* @param params - Request-specific parameters.
|
|
889
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
848
890
|
* @returns Array of user's TWAP history.
|
|
849
891
|
*
|
|
850
892
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -860,17 +902,14 @@ class InfoClient {
|
|
|
860
902
|
* const data = await infoClient.twapHistory({ user: "0x..." });
|
|
861
903
|
* ```
|
|
862
904
|
*/
|
|
863
|
-
twapHistory(
|
|
864
|
-
const request = {
|
|
865
|
-
type: "twapHistory",
|
|
866
|
-
...args,
|
|
867
|
-
};
|
|
905
|
+
twapHistory(params, signal) {
|
|
906
|
+
const request = { type: "twapHistory", ...params };
|
|
868
907
|
return this.transport.request("info", request, signal);
|
|
869
908
|
}
|
|
870
909
|
/**
|
|
871
910
|
* Request transaction details by transaction hash.
|
|
872
|
-
* @param
|
|
873
|
-
* @param signal - An
|
|
911
|
+
* @param params - Request-specific parameters.
|
|
912
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
874
913
|
* @returns Transaction details.
|
|
875
914
|
*
|
|
876
915
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -880,24 +919,21 @@ class InfoClient {
|
|
|
880
919
|
* ```ts
|
|
881
920
|
* import * as hl from "@nktkas/hyperliquid";
|
|
882
921
|
*
|
|
883
|
-
* const transport = new hl.HttpTransport(); //
|
|
922
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
884
923
|
* const infoClient = new hl.InfoClient({ transport });
|
|
885
924
|
*
|
|
886
925
|
* const data = await infoClient.txDetails({ hash: "0x..." });
|
|
887
926
|
* ```
|
|
888
927
|
*/
|
|
889
|
-
|
|
890
|
-
const request = {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
};
|
|
894
|
-
const { tx } = await this.transport.request("explorer", request, signal);
|
|
895
|
-
return tx;
|
|
928
|
+
txDetails(params, signal) {
|
|
929
|
+
const request = { type: "txDetails", ...params };
|
|
930
|
+
return this.transport.request("explorer", request, signal)
|
|
931
|
+
.then(({ tx }) => tx);
|
|
896
932
|
}
|
|
897
933
|
/**
|
|
898
934
|
* Request user details by user's address.
|
|
899
|
-
* @param
|
|
900
|
-
* @param signal - An
|
|
935
|
+
* @param params - Request-specific parameters.
|
|
936
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
901
937
|
* @returns User details.
|
|
902
938
|
*
|
|
903
939
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -907,24 +943,21 @@ class InfoClient {
|
|
|
907
943
|
* ```ts
|
|
908
944
|
* import * as hl from "@nktkas/hyperliquid";
|
|
909
945
|
*
|
|
910
|
-
* const transport = new hl.HttpTransport(); //
|
|
946
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
911
947
|
* const infoClient = new hl.InfoClient({ transport });
|
|
912
948
|
*
|
|
913
949
|
* const data = await infoClient.userDetails({ user: "0x..." });
|
|
914
950
|
* ```
|
|
915
951
|
*/
|
|
916
|
-
|
|
917
|
-
const request = {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
};
|
|
921
|
-
const { txs } = await this.transport.request("explorer", request, signal);
|
|
922
|
-
return txs;
|
|
952
|
+
userDetails(params, signal) {
|
|
953
|
+
const request = { type: "userDetails", ...params };
|
|
954
|
+
return this.transport.request("explorer", request, signal)
|
|
955
|
+
.then(({ txs }) => txs);
|
|
923
956
|
}
|
|
924
957
|
/**
|
|
925
958
|
* Request user fees.
|
|
926
|
-
* @param
|
|
927
|
-
* @param signal - An
|
|
959
|
+
* @param params - Request-specific parameters.
|
|
960
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
928
961
|
* @returns User fees.
|
|
929
962
|
*
|
|
930
963
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -940,17 +973,14 @@ class InfoClient {
|
|
|
940
973
|
* const data = await infoClient.userFees({ user: "0x..." });
|
|
941
974
|
* ```
|
|
942
975
|
*/
|
|
943
|
-
userFees(
|
|
944
|
-
const request = {
|
|
945
|
-
type: "userFees",
|
|
946
|
-
...args,
|
|
947
|
-
};
|
|
976
|
+
userFees(params, signal) {
|
|
977
|
+
const request = { type: "userFees", ...params };
|
|
948
978
|
return this.transport.request("info", request, signal);
|
|
949
979
|
}
|
|
950
980
|
/**
|
|
951
981
|
* Request user fills.
|
|
952
|
-
* @param
|
|
953
|
-
* @param signal - An
|
|
982
|
+
* @param params - Request-specific parameters.
|
|
983
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
954
984
|
* @returns Array of user's trade fill.
|
|
955
985
|
*
|
|
956
986
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -966,17 +996,14 @@ class InfoClient {
|
|
|
966
996
|
* const data = await infoClient.userFills({ user: "0x..." });
|
|
967
997
|
* ```
|
|
968
998
|
*/
|
|
969
|
-
userFills(
|
|
970
|
-
const request = {
|
|
971
|
-
type: "userFills",
|
|
972
|
-
...args,
|
|
973
|
-
};
|
|
999
|
+
userFills(params, signal) {
|
|
1000
|
+
const request = { type: "userFills", ...params };
|
|
974
1001
|
return this.transport.request("info", request, signal);
|
|
975
1002
|
}
|
|
976
1003
|
/**
|
|
977
1004
|
* Request user fills by time.
|
|
978
|
-
* @param
|
|
979
|
-
* @param signal - An
|
|
1005
|
+
* @param params - Request-specific parameters.
|
|
1006
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
980
1007
|
* @returns Array of user's trade fill.
|
|
981
1008
|
*
|
|
982
1009
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -995,17 +1022,14 @@ class InfoClient {
|
|
|
995
1022
|
* });
|
|
996
1023
|
* ```
|
|
997
1024
|
*/
|
|
998
|
-
userFillsByTime(
|
|
999
|
-
const request = {
|
|
1000
|
-
type: "userFillsByTime",
|
|
1001
|
-
...args,
|
|
1002
|
-
};
|
|
1025
|
+
userFillsByTime(params, signal) {
|
|
1026
|
+
const request = { type: "userFillsByTime", ...params };
|
|
1003
1027
|
return this.transport.request("info", request, signal);
|
|
1004
1028
|
}
|
|
1005
1029
|
/**
|
|
1006
1030
|
* Request user funding.
|
|
1007
|
-
* @param
|
|
1008
|
-
* @param signal - An
|
|
1031
|
+
* @param params - Request-specific parameters.
|
|
1032
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1009
1033
|
* @returns Array of user's funding ledger update.
|
|
1010
1034
|
*
|
|
1011
1035
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1024,17 +1048,14 @@ class InfoClient {
|
|
|
1024
1048
|
* });
|
|
1025
1049
|
* ```
|
|
1026
1050
|
*/
|
|
1027
|
-
userFunding(
|
|
1028
|
-
const request = {
|
|
1029
|
-
type: "userFunding",
|
|
1030
|
-
...args,
|
|
1031
|
-
};
|
|
1051
|
+
userFunding(params, signal) {
|
|
1052
|
+
const request = { type: "userFunding", ...params };
|
|
1032
1053
|
return this.transport.request("info", request, signal);
|
|
1033
1054
|
}
|
|
1034
1055
|
/**
|
|
1035
1056
|
* Request user non-funding ledger updates.
|
|
1036
|
-
* @param
|
|
1037
|
-
* @param signal - An
|
|
1057
|
+
* @param params - Request-specific parameters.
|
|
1058
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1038
1059
|
* @returns Array of user's non-funding ledger update.
|
|
1039
1060
|
*
|
|
1040
1061
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1053,17 +1074,14 @@ class InfoClient {
|
|
|
1053
1074
|
* });
|
|
1054
1075
|
* ```
|
|
1055
1076
|
*/
|
|
1056
|
-
userNonFundingLedgerUpdates(
|
|
1057
|
-
const request = {
|
|
1058
|
-
type: "userNonFundingLedgerUpdates",
|
|
1059
|
-
...args,
|
|
1060
|
-
};
|
|
1077
|
+
userNonFundingLedgerUpdates(params, signal) {
|
|
1078
|
+
const request = { type: "userNonFundingLedgerUpdates", ...params };
|
|
1061
1079
|
return this.transport.request("info", request, signal);
|
|
1062
1080
|
}
|
|
1063
1081
|
/**
|
|
1064
1082
|
* Request user rate limits.
|
|
1065
|
-
* @param
|
|
1066
|
-
* @param signal - An
|
|
1083
|
+
* @param params - Request-specific parameters.
|
|
1084
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1067
1085
|
* @returns User's rate limits.
|
|
1068
1086
|
*
|
|
1069
1087
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1079,17 +1097,14 @@ class InfoClient {
|
|
|
1079
1097
|
* const data = await infoClient.userRateLimit({ user: "0x..." });
|
|
1080
1098
|
* ```
|
|
1081
1099
|
*/
|
|
1082
|
-
userRateLimit(
|
|
1083
|
-
const request = {
|
|
1084
|
-
type: "userRateLimit",
|
|
1085
|
-
...args,
|
|
1086
|
-
};
|
|
1100
|
+
userRateLimit(params, signal) {
|
|
1101
|
+
const request = { type: "userRateLimit", ...params };
|
|
1087
1102
|
return this.transport.request("info", request, signal);
|
|
1088
1103
|
}
|
|
1089
1104
|
/**
|
|
1090
1105
|
* Request user role.
|
|
1091
|
-
* @param
|
|
1092
|
-
* @param signal - An
|
|
1106
|
+
* @param params - Request-specific parameters.
|
|
1107
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1093
1108
|
* @returns User's role.
|
|
1094
1109
|
*
|
|
1095
1110
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1105,17 +1120,14 @@ class InfoClient {
|
|
|
1105
1120
|
* const data = await infoClient.userRole({ user: "0x..." });
|
|
1106
1121
|
* ```
|
|
1107
1122
|
*/
|
|
1108
|
-
userRole(
|
|
1109
|
-
const request = {
|
|
1110
|
-
type: "userRole",
|
|
1111
|
-
...args,
|
|
1112
|
-
};
|
|
1123
|
+
userRole(params, signal) {
|
|
1124
|
+
const request = { type: "userRole", ...params };
|
|
1113
1125
|
return this.transport.request("info", request, signal);
|
|
1114
1126
|
}
|
|
1115
1127
|
/**
|
|
1116
1128
|
* Request multi-sig signers for a user.
|
|
1117
|
-
* @param
|
|
1118
|
-
* @param signal - An
|
|
1129
|
+
* @param params - Request-specific parameters.
|
|
1130
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1119
1131
|
* @returns Multi-sig signers for a user or null if the user does not have any multi-sig signers.
|
|
1120
1132
|
*
|
|
1121
1133
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1131,17 +1143,14 @@ class InfoClient {
|
|
|
1131
1143
|
* const data = await infoClient.userToMultiSigSigners({ user: "0x..." });
|
|
1132
1144
|
* ```
|
|
1133
1145
|
*/
|
|
1134
|
-
userToMultiSigSigners(
|
|
1135
|
-
const request = {
|
|
1136
|
-
type: "userToMultiSigSigners",
|
|
1137
|
-
...args,
|
|
1138
|
-
};
|
|
1146
|
+
userToMultiSigSigners(params, signal) {
|
|
1147
|
+
const request = { type: "userToMultiSigSigners", ...params };
|
|
1139
1148
|
return this.transport.request("info", request, signal);
|
|
1140
1149
|
}
|
|
1141
1150
|
/**
|
|
1142
1151
|
* Request user twap slice fills.
|
|
1143
|
-
* @param
|
|
1144
|
-
* @param signal - An
|
|
1152
|
+
* @param params - Request-specific parameters.
|
|
1153
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1145
1154
|
* @returns Array of user's twap slice fill.
|
|
1146
1155
|
*
|
|
1147
1156
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1157,17 +1166,14 @@ class InfoClient {
|
|
|
1157
1166
|
* const data = await infoClient.userTwapSliceFills({ user: "0x..." });
|
|
1158
1167
|
* ```
|
|
1159
1168
|
*/
|
|
1160
|
-
userTwapSliceFills(
|
|
1161
|
-
const request = {
|
|
1162
|
-
type: "userTwapSliceFills",
|
|
1163
|
-
...args,
|
|
1164
|
-
};
|
|
1169
|
+
userTwapSliceFills(params, signal) {
|
|
1170
|
+
const request = { type: "userTwapSliceFills", ...params };
|
|
1165
1171
|
return this.transport.request("info", request, signal);
|
|
1166
1172
|
}
|
|
1167
1173
|
/**
|
|
1168
1174
|
* Request user twap slice fills by time.
|
|
1169
|
-
* @param
|
|
1170
|
-
* @param signal - An
|
|
1175
|
+
* @param params - Request-specific parameters.
|
|
1176
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1171
1177
|
* @returns Array of user's twap slice fill.
|
|
1172
1178
|
*
|
|
1173
1179
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1186,17 +1192,14 @@ class InfoClient {
|
|
|
1186
1192
|
* });
|
|
1187
1193
|
* ```
|
|
1188
1194
|
*/
|
|
1189
|
-
userTwapSliceFillsByTime(
|
|
1190
|
-
const request = {
|
|
1191
|
-
type: "userTwapSliceFillsByTime",
|
|
1192
|
-
...args,
|
|
1193
|
-
};
|
|
1195
|
+
userTwapSliceFillsByTime(params, signal) {
|
|
1196
|
+
const request = { type: "userTwapSliceFillsByTime", ...params };
|
|
1194
1197
|
return this.transport.request("info", request, signal);
|
|
1195
1198
|
}
|
|
1196
1199
|
/**
|
|
1197
1200
|
* Request user vault deposits.
|
|
1198
|
-
* @param
|
|
1199
|
-
* @param signal - An
|
|
1201
|
+
* @param params - Request-specific parameters.
|
|
1202
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1200
1203
|
* @returns Array of user's vault deposits.
|
|
1201
1204
|
*
|
|
1202
1205
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1212,16 +1215,35 @@ class InfoClient {
|
|
|
1212
1215
|
* const data = await infoClient.userVaultEquities({ user: "0x..." });
|
|
1213
1216
|
* ```
|
|
1214
1217
|
*/
|
|
1215
|
-
userVaultEquities(
|
|
1216
|
-
const request = {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1218
|
+
userVaultEquities(params, signal) {
|
|
1219
|
+
const request = { type: "userVaultEquities", ...params };
|
|
1220
|
+
return this.transport.request("info", request, signal);
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Request validator L1 votes.
|
|
1224
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1225
|
+
* @returns
|
|
1226
|
+
*
|
|
1227
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1228
|
+
*
|
|
1229
|
+
* @see null
|
|
1230
|
+
* @example
|
|
1231
|
+
* ```ts
|
|
1232
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1233
|
+
*
|
|
1234
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1235
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1236
|
+
*
|
|
1237
|
+
* const data = await infoClient.validatorL1Votes();
|
|
1238
|
+
* ```
|
|
1239
|
+
*/
|
|
1240
|
+
validatorL1Votes(signal) {
|
|
1241
|
+
const request = { type: "validatorL1Votes" };
|
|
1220
1242
|
return this.transport.request("info", request, signal);
|
|
1221
1243
|
}
|
|
1222
1244
|
/**
|
|
1223
1245
|
* Request validator summaries.
|
|
1224
|
-
* @param
|
|
1246
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1225
1247
|
* @returns Array of validator summaries.
|
|
1226
1248
|
*
|
|
1227
1249
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1238,15 +1260,13 @@ class InfoClient {
|
|
|
1238
1260
|
* ```
|
|
1239
1261
|
*/
|
|
1240
1262
|
validatorSummaries(signal) {
|
|
1241
|
-
const request = {
|
|
1242
|
-
type: "validatorSummaries",
|
|
1243
|
-
};
|
|
1263
|
+
const request = { type: "validatorSummaries" };
|
|
1244
1264
|
return this.transport.request("info", request, signal);
|
|
1245
1265
|
}
|
|
1246
1266
|
/**
|
|
1247
1267
|
* Request details of a vault.
|
|
1248
|
-
* @param
|
|
1249
|
-
* @param signal - An
|
|
1268
|
+
* @param params - Request-specific parameters.
|
|
1269
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1250
1270
|
* @returns Details of a vault or null if the vault does not exist.
|
|
1251
1271
|
*
|
|
1252
1272
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1262,17 +1282,13 @@ class InfoClient {
|
|
|
1262
1282
|
* const data = await infoClient.vaultDetails({ vaultAddress: "0x..." });
|
|
1263
1283
|
* ```
|
|
1264
1284
|
*/
|
|
1265
|
-
vaultDetails(
|
|
1266
|
-
const request = {
|
|
1267
|
-
type: "vaultDetails",
|
|
1268
|
-
...args,
|
|
1269
|
-
};
|
|
1285
|
+
vaultDetails(params, signal) {
|
|
1286
|
+
const request = { type: "vaultDetails", ...params };
|
|
1270
1287
|
return this.transport.request("info", request, signal);
|
|
1271
1288
|
}
|
|
1272
1289
|
/**
|
|
1273
1290
|
* Request a list of vaults less than 2 hours old.
|
|
1274
|
-
* @param
|
|
1275
|
-
* @param signal - An optional abort signal.
|
|
1291
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1276
1292
|
* @returns Array of vault summaries.
|
|
1277
1293
|
*
|
|
1278
1294
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1289,9 +1305,7 @@ class InfoClient {
|
|
|
1289
1305
|
* ```
|
|
1290
1306
|
*/
|
|
1291
1307
|
vaultSummaries(signal) {
|
|
1292
|
-
const request = {
|
|
1293
|
-
type: "vaultSummaries",
|
|
1294
|
-
};
|
|
1308
|
+
const request = { type: "vaultSummaries" };
|
|
1295
1309
|
return this.transport.request("info", request, signal);
|
|
1296
1310
|
}
|
|
1297
1311
|
async [Symbol.asyncDispose]() {
|