@nktkas/hyperliquid 0.23.1 → 0.24.1
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 +178 -194
- package/esm/mod.d.ts +2 -1
- 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 +485 -392
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +517 -912
- package/esm/src/clients/info.d.ts +249 -203
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +258 -368
- 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 +101 -99
- package/esm/src/clients/subscription.d.ts.map +1 -1
- package/esm/src/clients/subscription.js +107 -152
- 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 +18 -19
- package/esm/src/signing/_sorter.d.ts.map +1 -1
- package/esm/src/signing/_sorter.js +57 -59
- package/esm/src/signing/mod.d.ts +179 -129
- package/esm/src/signing/mod.d.ts.map +1 -1
- package/esm/src/signing/mod.js +184 -132
- 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 +547 -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 +405 -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 +29 -8
- package/esm/src/types/info/markets.d.ts.map +1 -1
- package/esm/src/types/info/orders.d.ts +64 -17
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +126 -51
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/esm/src/types/info/validators.d.ts +44 -14
- package/esm/src/types/info/validators.d.ts.map +1 -1
- package/esm/src/types/info/vaults.d.ts +25 -10
- package/esm/src/types/info/vaults.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +1 -1
- 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 -1
- 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 +485 -392
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +516 -911
- package/script/src/clients/info.d.ts +249 -203
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +258 -368
- 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 +101 -99
- package/script/src/clients/subscription.d.ts.map +1 -1
- package/script/src/clients/subscription.js +107 -152
- 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 +18 -19
- package/script/src/signing/_sorter.d.ts.map +1 -1
- package/script/src/signing/_sorter.js +57 -59
- package/script/src/signing/mod.d.ts +179 -129
- package/script/src/signing/mod.d.ts.map +1 -1
- package/script/src/signing/mod.js +187 -150
- 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 +547 -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 +405 -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 +29 -8
- package/script/src/types/info/markets.d.ts.map +1 -1
- package/script/src/types/info/orders.d.ts +64 -17
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +126 -51
- package/script/src/types/info/requests.d.ts.map +1 -1
- package/script/src/types/info/validators.d.ts +44 -14
- package/script/src/types/info/validators.d.ts.map +1 -1
- package/script/src/types/info/vaults.d.ts +25 -10
- package/script/src/types/info/vaults.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +1 -1
- 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/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/esm/src/clients/info.js
CHANGED
|
@@ -19,19 +19,39 @@ export class InfoClient {
|
|
|
19
19
|
constructor(args) {
|
|
20
20
|
this.transport = args.transport;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Request user active asset data.
|
|
24
|
+
* @param params - An optional request-specific parameters.
|
|
25
|
+
* @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}.
|
|
26
|
+
* @returns User active asset data.
|
|
27
|
+
*
|
|
28
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
29
|
+
*
|
|
30
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-active-asset-data
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
34
|
+
*
|
|
35
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
36
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
37
|
+
*
|
|
38
|
+
* const data = await infoClient.activeAssetData({ user: "0x...", coin: "ETH" });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
activeAssetData(params, signal) {
|
|
42
|
+
const request = { type: "activeAssetData", ...params };
|
|
43
|
+
return this.transport.request("info", request, signal);
|
|
44
|
+
}
|
|
45
|
+
allMids(params_or_signal, maybeSignal) {
|
|
46
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
47
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
48
|
+
const request = { type: "allMids", ...params };
|
|
29
49
|
return this.transport.request("info", request, signal);
|
|
30
50
|
}
|
|
31
51
|
/**
|
|
32
52
|
* Block details by block height.
|
|
33
|
-
* @param
|
|
34
|
-
* @param signal - An
|
|
53
|
+
* @param params - Request-specific parameters.
|
|
54
|
+
* @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}.
|
|
35
55
|
* @returns Block details.
|
|
36
56
|
*
|
|
37
57
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -41,24 +61,21 @@ export class InfoClient {
|
|
|
41
61
|
* ```ts
|
|
42
62
|
* import * as hl from "@nktkas/hyperliquid";
|
|
43
63
|
*
|
|
44
|
-
* const transport = new hl.HttpTransport(); //
|
|
64
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
45
65
|
* const infoClient = new hl.InfoClient({ transport });
|
|
46
66
|
*
|
|
47
67
|
* const data = await infoClient.blockDetails({ height: 123 });
|
|
48
68
|
* ```
|
|
49
69
|
*/
|
|
50
|
-
|
|
51
|
-
const request = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
const { blockDetails } = await this.transport.request("explorer", request, signal);
|
|
56
|
-
return blockDetails;
|
|
70
|
+
blockDetails(params, signal) {
|
|
71
|
+
const request = { type: "blockDetails", ...params };
|
|
72
|
+
return this.transport.request("explorer", request, signal)
|
|
73
|
+
.then(({ blockDetails }) => blockDetails);
|
|
57
74
|
}
|
|
58
75
|
/**
|
|
59
76
|
* Request candlestick snapshots.
|
|
60
|
-
* @param
|
|
61
|
-
* @param signal - An
|
|
77
|
+
* @param params - Request-specific parameters.
|
|
78
|
+
* @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}.
|
|
62
79
|
* @returns Array of candlestick data points.
|
|
63
80
|
*
|
|
64
81
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -78,17 +95,14 @@ export class InfoClient {
|
|
|
78
95
|
* });
|
|
79
96
|
* ```
|
|
80
97
|
*/
|
|
81
|
-
candleSnapshot(
|
|
82
|
-
const request = {
|
|
83
|
-
type: "candleSnapshot",
|
|
84
|
-
req: args,
|
|
85
|
-
};
|
|
98
|
+
candleSnapshot(params, signal) {
|
|
99
|
+
const request = { type: "candleSnapshot", req: params };
|
|
86
100
|
return this.transport.request("info", request, signal);
|
|
87
101
|
}
|
|
88
102
|
/**
|
|
89
103
|
* Request clearinghouse state.
|
|
90
|
-
* @param
|
|
91
|
-
* @param signal - An
|
|
104
|
+
* @param params - Request-specific parameters.
|
|
105
|
+
* @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}.
|
|
92
106
|
* @returns Account summary for perpetual trading.
|
|
93
107
|
*
|
|
94
108
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -104,17 +118,14 @@ export class InfoClient {
|
|
|
104
118
|
* const data = await infoClient.clearinghouseState({ user: "0x..." });
|
|
105
119
|
* ```
|
|
106
120
|
*/
|
|
107
|
-
clearinghouseState(
|
|
108
|
-
const request = {
|
|
109
|
-
type: "clearinghouseState",
|
|
110
|
-
...args,
|
|
111
|
-
};
|
|
121
|
+
clearinghouseState(params, signal) {
|
|
122
|
+
const request = { type: "clearinghouseState", ...params };
|
|
112
123
|
return this.transport.request("info", request, signal);
|
|
113
124
|
}
|
|
114
125
|
/**
|
|
115
126
|
* Request user staking delegations.
|
|
116
|
-
* @param
|
|
117
|
-
* @param signal - An
|
|
127
|
+
* @param params - Request-specific parameters.
|
|
128
|
+
* @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}.
|
|
118
129
|
* @returns Array of user's delegations to validators.
|
|
119
130
|
*
|
|
120
131
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -130,17 +141,14 @@ export class InfoClient {
|
|
|
130
141
|
* const data = await infoClient.delegations({ user: "0x..." });
|
|
131
142
|
* ```
|
|
132
143
|
*/
|
|
133
|
-
delegations(
|
|
134
|
-
const request = {
|
|
135
|
-
type: "delegations",
|
|
136
|
-
...args,
|
|
137
|
-
};
|
|
144
|
+
delegations(params, signal) {
|
|
145
|
+
const request = { type: "delegations", ...params };
|
|
138
146
|
return this.transport.request("info", request, signal);
|
|
139
147
|
}
|
|
140
148
|
/**
|
|
141
149
|
* Request user staking history.
|
|
142
|
-
* @param
|
|
143
|
-
* @param signal - An
|
|
150
|
+
* @param params - Request-specific parameters.
|
|
151
|
+
* @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}.
|
|
144
152
|
* @returns Array of user's staking updates.
|
|
145
153
|
*
|
|
146
154
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -156,17 +164,14 @@ export class InfoClient {
|
|
|
156
164
|
* const data = await infoClient.delegatorHistory({ user: "0x..." });
|
|
157
165
|
* ```
|
|
158
166
|
*/
|
|
159
|
-
delegatorHistory(
|
|
160
|
-
const request = {
|
|
161
|
-
type: "delegatorHistory",
|
|
162
|
-
...args,
|
|
163
|
-
};
|
|
167
|
+
delegatorHistory(params, signal) {
|
|
168
|
+
const request = { type: "delegatorHistory", ...params };
|
|
164
169
|
return this.transport.request("info", request, signal);
|
|
165
170
|
}
|
|
166
171
|
/**
|
|
167
172
|
* Request user staking rewards.
|
|
168
|
-
* @param
|
|
169
|
-
* @param signal - An
|
|
173
|
+
* @param params - Request-specific parameters.
|
|
174
|
+
* @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}.
|
|
170
175
|
* @returns Array of user's staking rewards.
|
|
171
176
|
*
|
|
172
177
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -182,17 +187,14 @@ export class InfoClient {
|
|
|
182
187
|
* const data = await infoClient.delegatorRewards({ user: "0x..." });
|
|
183
188
|
* ```
|
|
184
189
|
*/
|
|
185
|
-
delegatorRewards(
|
|
186
|
-
const request = {
|
|
187
|
-
type: "delegatorRewards",
|
|
188
|
-
...args,
|
|
189
|
-
};
|
|
190
|
+
delegatorRewards(params, signal) {
|
|
191
|
+
const request = { type: "delegatorRewards", ...params };
|
|
190
192
|
return this.transport.request("info", request, signal);
|
|
191
193
|
}
|
|
192
194
|
/**
|
|
193
195
|
* Request user staking summary.
|
|
194
|
-
* @param
|
|
195
|
-
* @param signal - An
|
|
196
|
+
* @param params - Request-specific parameters.
|
|
197
|
+
* @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}.
|
|
196
198
|
* @returns Summary of a user's staking delegations.
|
|
197
199
|
*
|
|
198
200
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -208,21 +210,18 @@ export class InfoClient {
|
|
|
208
210
|
* const data = await infoClient.delegatorSummary({ user: "0x..." });
|
|
209
211
|
* ```
|
|
210
212
|
*/
|
|
211
|
-
delegatorSummary(
|
|
212
|
-
const request = {
|
|
213
|
-
type: "delegatorSummary",
|
|
214
|
-
...args,
|
|
215
|
-
};
|
|
213
|
+
delegatorSummary(params, signal) {
|
|
214
|
+
const request = { type: "delegatorSummary", ...params };
|
|
216
215
|
return this.transport.request("info", request, signal);
|
|
217
216
|
}
|
|
218
217
|
/**
|
|
219
218
|
* Request exchange status information.
|
|
220
|
-
* @param signal - An
|
|
219
|
+
* @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}.
|
|
221
220
|
* @returns Exchange system status information.
|
|
222
221
|
*
|
|
223
222
|
* @throws {TransportError} When the transport layer throws an error.
|
|
224
223
|
*
|
|
225
|
-
* @see
|
|
224
|
+
* @see null
|
|
226
225
|
* @example
|
|
227
226
|
* ```ts
|
|
228
227
|
* import * as hl from "@nktkas/hyperliquid";
|
|
@@ -234,15 +233,13 @@ export class InfoClient {
|
|
|
234
233
|
* ```
|
|
235
234
|
*/
|
|
236
235
|
exchangeStatus(signal) {
|
|
237
|
-
const request = {
|
|
238
|
-
type: "exchangeStatus",
|
|
239
|
-
};
|
|
236
|
+
const request = { type: "exchangeStatus" };
|
|
240
237
|
return this.transport.request("info", request, signal);
|
|
241
238
|
}
|
|
242
239
|
/**
|
|
243
240
|
* Request user's extra agents.
|
|
244
|
-
* @param
|
|
245
|
-
* @param signal - An
|
|
241
|
+
* @param params - Request-specific parameters.
|
|
242
|
+
* @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}.
|
|
246
243
|
* @returns User's extra agents.
|
|
247
244
|
*
|
|
248
245
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -258,17 +255,14 @@ export class InfoClient {
|
|
|
258
255
|
* const data = await infoClient.extraAgents({ user: "0x..." });
|
|
259
256
|
* ```
|
|
260
257
|
*/
|
|
261
|
-
extraAgents(
|
|
262
|
-
const request = {
|
|
263
|
-
type: "extraAgents",
|
|
264
|
-
...args,
|
|
265
|
-
};
|
|
258
|
+
extraAgents(params, signal) {
|
|
259
|
+
const request = { type: "extraAgents", ...params };
|
|
266
260
|
return this.transport.request("info", request, signal);
|
|
267
261
|
}
|
|
268
262
|
/**
|
|
269
263
|
* Request frontend open orders.
|
|
270
|
-
* @param
|
|
271
|
-
* @param signal - An
|
|
264
|
+
* @param params - Request-specific parameters.
|
|
265
|
+
* @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}.
|
|
272
266
|
* @returns Array of open orders with additional frontend information.
|
|
273
267
|
*
|
|
274
268
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -284,17 +278,14 @@ export class InfoClient {
|
|
|
284
278
|
* const data = await infoClient.frontendOpenOrders({ user: "0x..." });
|
|
285
279
|
* ```
|
|
286
280
|
*/
|
|
287
|
-
frontendOpenOrders(
|
|
288
|
-
const request = {
|
|
289
|
-
type: "frontendOpenOrders",
|
|
290
|
-
...args,
|
|
291
|
-
};
|
|
281
|
+
frontendOpenOrders(params, signal) {
|
|
282
|
+
const request = { type: "frontendOpenOrders", ...params };
|
|
292
283
|
return this.transport.request("info", request, signal);
|
|
293
284
|
}
|
|
294
285
|
/**
|
|
295
286
|
* Request funding history.
|
|
296
|
-
* @param
|
|
297
|
-
* @param signal - An
|
|
287
|
+
* @param params - Request-specific parameters.
|
|
288
|
+
* @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}.
|
|
298
289
|
* @returns Array of historical funding rate data for an asset.
|
|
299
290
|
*
|
|
300
291
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -313,17 +304,14 @@ export class InfoClient {
|
|
|
313
304
|
* });
|
|
314
305
|
* ```
|
|
315
306
|
*/
|
|
316
|
-
fundingHistory(
|
|
317
|
-
const request = {
|
|
318
|
-
type: "fundingHistory",
|
|
319
|
-
...args,
|
|
320
|
-
};
|
|
307
|
+
fundingHistory(params, signal) {
|
|
308
|
+
const request = { type: "fundingHistory", ...params };
|
|
321
309
|
return this.transport.request("info", request, signal);
|
|
322
310
|
}
|
|
323
311
|
/**
|
|
324
312
|
* Request user's historical orders.
|
|
325
|
-
* @param
|
|
326
|
-
* @param signal - An
|
|
313
|
+
* @param params - Request-specific parameters.
|
|
314
|
+
* @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}.
|
|
327
315
|
* @returns Array of user's historical orders.
|
|
328
316
|
*
|
|
329
317
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -339,17 +327,14 @@ export class InfoClient {
|
|
|
339
327
|
* const data = await infoClient.historicalOrders({ user: "0x..." });
|
|
340
328
|
* ```
|
|
341
329
|
*/
|
|
342
|
-
historicalOrders(
|
|
343
|
-
const request = {
|
|
344
|
-
type: "historicalOrders",
|
|
345
|
-
...args,
|
|
346
|
-
};
|
|
330
|
+
historicalOrders(params, signal) {
|
|
331
|
+
const request = { type: "historicalOrders", ...params };
|
|
347
332
|
return this.transport.request("info", request, signal);
|
|
348
333
|
}
|
|
349
334
|
/**
|
|
350
335
|
* Request to check if a user is a VIP.
|
|
351
|
-
* @param
|
|
352
|
-
* @param signal - An
|
|
336
|
+
* @param params - Request-specific parameters.
|
|
337
|
+
* @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}.
|
|
353
338
|
* @returns Boolean indicating user's VIP status.
|
|
354
339
|
*
|
|
355
340
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -365,17 +350,14 @@ export class InfoClient {
|
|
|
365
350
|
* const data = await infoClient.isVip({ user: "0x..." });
|
|
366
351
|
* ```
|
|
367
352
|
*/
|
|
368
|
-
isVip(
|
|
369
|
-
const request = {
|
|
370
|
-
type: "isVip",
|
|
371
|
-
...args,
|
|
372
|
-
};
|
|
353
|
+
isVip(params, signal) {
|
|
354
|
+
const request = { type: "isVip", ...params };
|
|
373
355
|
return this.transport.request("info", request, signal);
|
|
374
356
|
}
|
|
375
357
|
/**
|
|
376
358
|
* Request L2 order book.
|
|
377
|
-
* @param
|
|
378
|
-
* @param signal - An
|
|
359
|
+
* @param params - Request-specific parameters.
|
|
360
|
+
* @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}.
|
|
379
361
|
* @returns L2 order book snapshot.
|
|
380
362
|
*
|
|
381
363
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -391,17 +373,14 @@ export class InfoClient {
|
|
|
391
373
|
* const data = await infoClient.l2Book({ coin: "ETH", nSigFigs: 2 });
|
|
392
374
|
* ```
|
|
393
375
|
*/
|
|
394
|
-
l2Book(
|
|
395
|
-
const request = {
|
|
396
|
-
type: "l2Book",
|
|
397
|
-
...args,
|
|
398
|
-
};
|
|
376
|
+
l2Book(params, signal) {
|
|
377
|
+
const request = { type: "l2Book", ...params };
|
|
399
378
|
return this.transport.request("info", request, signal);
|
|
400
379
|
}
|
|
401
380
|
/**
|
|
402
381
|
* Request leading vaults for a user.
|
|
403
|
-
* @param
|
|
404
|
-
* @param signal - An
|
|
382
|
+
* @param params - Request-specific parameters.
|
|
383
|
+
* @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}.
|
|
405
384
|
* @returns
|
|
406
385
|
*
|
|
407
386
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -417,17 +396,14 @@ export class InfoClient {
|
|
|
417
396
|
* const data = await infoClient.leadingVaults({ user: "0x..." });
|
|
418
397
|
* ```
|
|
419
398
|
*/
|
|
420
|
-
leadingVaults(
|
|
421
|
-
const request = {
|
|
422
|
-
type: "leadingVaults",
|
|
423
|
-
...args,
|
|
424
|
-
};
|
|
399
|
+
leadingVaults(params, signal) {
|
|
400
|
+
const request = { type: "leadingVaults", ...params };
|
|
425
401
|
return this.transport.request("info", request, signal);
|
|
426
402
|
}
|
|
427
403
|
/**
|
|
428
404
|
* Request legal verification status of a user.
|
|
429
|
-
* @param
|
|
430
|
-
* @param signal - An
|
|
405
|
+
* @param params - Request-specific parameters.
|
|
406
|
+
* @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}.
|
|
431
407
|
* @returns Legal verification status for a user.
|
|
432
408
|
*
|
|
433
409
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -443,21 +419,18 @@ export class InfoClient {
|
|
|
443
419
|
* const data = await infoClient.legalCheck({ user: "0x..." });
|
|
444
420
|
* ```
|
|
445
421
|
*/
|
|
446
|
-
legalCheck(
|
|
447
|
-
const request = {
|
|
448
|
-
type: "legalCheck",
|
|
449
|
-
...args,
|
|
450
|
-
};
|
|
422
|
+
legalCheck(params, signal) {
|
|
423
|
+
const request = { type: "legalCheck", ...params };
|
|
451
424
|
return this.transport.request("info", request, signal);
|
|
452
425
|
}
|
|
453
426
|
/**
|
|
454
|
-
* Request liquidatable
|
|
455
|
-
* @param signal - An
|
|
427
|
+
* Request liquidatable.
|
|
428
|
+
* @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}.
|
|
456
429
|
* @returns
|
|
457
430
|
*
|
|
458
431
|
* @throws {TransportError} When the transport layer throws an error.
|
|
459
432
|
*
|
|
460
|
-
* @see
|
|
433
|
+
* @see null
|
|
461
434
|
* @example
|
|
462
435
|
* ```ts
|
|
463
436
|
* import * as hl from "@nktkas/hyperliquid";
|
|
@@ -469,20 +442,18 @@ export class InfoClient {
|
|
|
469
442
|
* ```
|
|
470
443
|
*/
|
|
471
444
|
liquidatable(signal) {
|
|
472
|
-
const request = {
|
|
473
|
-
type: "liquidatable",
|
|
474
|
-
};
|
|
445
|
+
const request = { type: "liquidatable" };
|
|
475
446
|
return this.transport.request("info", request, signal);
|
|
476
447
|
}
|
|
477
448
|
/**
|
|
478
449
|
* Request margin table data.
|
|
479
|
-
* @param
|
|
480
|
-
* @param signal - An
|
|
450
|
+
* @param params - Request-specific parameters.
|
|
451
|
+
* @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}.
|
|
481
452
|
* @returns Margin requirements table with multiple tiers.
|
|
482
453
|
*
|
|
483
454
|
* @throws {TransportError} When the transport layer throws an error.
|
|
484
455
|
*
|
|
485
|
-
* @see
|
|
456
|
+
* @see null
|
|
486
457
|
* @example
|
|
487
458
|
* ```ts
|
|
488
459
|
* import * as hl from "@nktkas/hyperliquid";
|
|
@@ -493,17 +464,14 @@ export class InfoClient {
|
|
|
493
464
|
* const data = await infoClient.marginTable({ id: 1 });
|
|
494
465
|
* ```
|
|
495
466
|
*/
|
|
496
|
-
marginTable(
|
|
497
|
-
const request = {
|
|
498
|
-
type: "marginTable",
|
|
499
|
-
...args,
|
|
500
|
-
};
|
|
467
|
+
marginTable(params, signal) {
|
|
468
|
+
const request = { type: "marginTable", ...params };
|
|
501
469
|
return this.transport.request("info", request, signal);
|
|
502
470
|
}
|
|
503
471
|
/**
|
|
504
472
|
* Request builder fee approval.
|
|
505
|
-
* @param
|
|
506
|
-
* @param signal - An
|
|
473
|
+
* @param params - Request-specific parameters.
|
|
474
|
+
* @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}.
|
|
507
475
|
* @returns Maximum builder fee approval.
|
|
508
476
|
*
|
|
509
477
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -519,21 +487,18 @@ export class InfoClient {
|
|
|
519
487
|
* const data = await infoClient.maxBuilderFee({ user: "0x...", builder: "0x..." });
|
|
520
488
|
* ```
|
|
521
489
|
*/
|
|
522
|
-
maxBuilderFee(
|
|
523
|
-
const request = {
|
|
524
|
-
type: "maxBuilderFee",
|
|
525
|
-
...args,
|
|
526
|
-
};
|
|
490
|
+
maxBuilderFee(params, signal) {
|
|
491
|
+
const request = { type: "maxBuilderFee", ...params };
|
|
527
492
|
return this.transport.request("info", request, signal);
|
|
528
493
|
}
|
|
529
494
|
/**
|
|
530
495
|
* Request maximum market order notionals.
|
|
531
|
-
* @param signal - An
|
|
496
|
+
* @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}.
|
|
532
497
|
* @returns
|
|
533
498
|
*
|
|
534
499
|
* @throws {TransportError} When the transport layer throws an error.
|
|
535
500
|
*
|
|
536
|
-
* @see
|
|
501
|
+
* @see null
|
|
537
502
|
* @example
|
|
538
503
|
* ```ts
|
|
539
504
|
* import * as hl from "@nktkas/hyperliquid";
|
|
@@ -545,23 +510,18 @@ export class InfoClient {
|
|
|
545
510
|
* ```
|
|
546
511
|
*/
|
|
547
512
|
maxMarketOrderNtls(signal) {
|
|
548
|
-
const request = {
|
|
549
|
-
type: "maxMarketOrderNtls",
|
|
550
|
-
};
|
|
513
|
+
const request = { type: "maxMarketOrderNtls" };
|
|
551
514
|
return this.transport.request("info", request, signal);
|
|
552
515
|
}
|
|
553
|
-
meta(
|
|
554
|
-
const
|
|
555
|
-
const signal =
|
|
556
|
-
const request = {
|
|
557
|
-
type: "meta",
|
|
558
|
-
...args,
|
|
559
|
-
};
|
|
516
|
+
meta(params_or_signal, maybeSignal) {
|
|
517
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
518
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
519
|
+
const request = { type: "meta", ...params };
|
|
560
520
|
return this.transport.request("info", request, signal);
|
|
561
521
|
}
|
|
562
522
|
/**
|
|
563
523
|
* Request metadata and asset contexts.
|
|
564
|
-
* @param signal - An
|
|
524
|
+
* @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}.
|
|
565
525
|
* @returns Metadata and context for perpetual assets.
|
|
566
526
|
*
|
|
567
527
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -578,15 +538,13 @@ export class InfoClient {
|
|
|
578
538
|
* ```
|
|
579
539
|
*/
|
|
580
540
|
metaAndAssetCtxs(signal) {
|
|
581
|
-
const request = {
|
|
582
|
-
type: "metaAndAssetCtxs",
|
|
583
|
-
};
|
|
541
|
+
const request = { type: "metaAndAssetCtxs" };
|
|
584
542
|
return this.transport.request("info", request, signal);
|
|
585
543
|
}
|
|
586
544
|
/**
|
|
587
545
|
* Request open orders.
|
|
588
|
-
* @param
|
|
589
|
-
* @param signal - An
|
|
546
|
+
* @param params - Request-specific parameters.
|
|
547
|
+
* @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}.
|
|
590
548
|
* @returns Array of open order.
|
|
591
549
|
*
|
|
592
550
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -602,17 +560,14 @@ export class InfoClient {
|
|
|
602
560
|
* const data = await infoClient.openOrders({ user: "0x..." });
|
|
603
561
|
* ```
|
|
604
562
|
*/
|
|
605
|
-
openOrders(
|
|
606
|
-
const request = {
|
|
607
|
-
type: "openOrders",
|
|
608
|
-
...args,
|
|
609
|
-
};
|
|
563
|
+
openOrders(params, signal) {
|
|
564
|
+
const request = { type: "openOrders", ...params };
|
|
610
565
|
return this.transport.request("info", request, signal);
|
|
611
566
|
}
|
|
612
567
|
/**
|
|
613
568
|
* Request order status.
|
|
614
|
-
* @param
|
|
615
|
-
* @param signal - An
|
|
569
|
+
* @param params - Request-specific parameters.
|
|
570
|
+
* @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}.
|
|
616
571
|
* @returns Result of an order status lookup.
|
|
617
572
|
*
|
|
618
573
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -628,16 +583,13 @@ export class InfoClient {
|
|
|
628
583
|
* const data = await infoClient.orderStatus({ user: "0x...", oid: 12345 });
|
|
629
584
|
* ```
|
|
630
585
|
*/
|
|
631
|
-
orderStatus(
|
|
632
|
-
const request = {
|
|
633
|
-
type: "orderStatus",
|
|
634
|
-
...args,
|
|
635
|
-
};
|
|
586
|
+
orderStatus(params, signal) {
|
|
587
|
+
const request = { type: "orderStatus", ...params };
|
|
636
588
|
return this.transport.request("info", request, signal);
|
|
637
589
|
}
|
|
638
590
|
/**
|
|
639
591
|
* Request for the status of the perpetual deploy auction.
|
|
640
|
-
* @param signal - An
|
|
592
|
+
* @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}.
|
|
641
593
|
* @returns Status of the perpetual deploy auction.
|
|
642
594
|
*
|
|
643
595
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -654,14 +606,12 @@ export class InfoClient {
|
|
|
654
606
|
* ```
|
|
655
607
|
*/
|
|
656
608
|
perpDeployAuctionStatus(signal) {
|
|
657
|
-
const request = {
|
|
658
|
-
type: "perpDeployAuctionStatus",
|
|
659
|
-
};
|
|
609
|
+
const request = { type: "perpDeployAuctionStatus" };
|
|
660
610
|
return this.transport.request("info", request, signal);
|
|
661
611
|
}
|
|
662
612
|
/**
|
|
663
613
|
* Request all perpetual dexs.
|
|
664
|
-
* @param signal - An
|
|
614
|
+
* @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}.
|
|
665
615
|
* @returns Array of perpetual dexes (null is main dex).
|
|
666
616
|
*
|
|
667
617
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -678,14 +628,12 @@ export class InfoClient {
|
|
|
678
628
|
* ```
|
|
679
629
|
*/
|
|
680
630
|
perpDexs(signal) {
|
|
681
|
-
const request = {
|
|
682
|
-
type: "perpDexs",
|
|
683
|
-
};
|
|
631
|
+
const request = { type: "perpDexs" };
|
|
684
632
|
return this.transport.request("info", request, signal);
|
|
685
633
|
}
|
|
686
634
|
/**
|
|
687
635
|
* Request perpetuals at open interest cap.
|
|
688
|
-
* @param signal - An
|
|
636
|
+
* @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}.
|
|
689
637
|
* @returns Array of perpetuals at open interest caps.
|
|
690
638
|
*
|
|
691
639
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -702,15 +650,13 @@ export class InfoClient {
|
|
|
702
650
|
* ```
|
|
703
651
|
*/
|
|
704
652
|
perpsAtOpenInterestCap(signal) {
|
|
705
|
-
const request = {
|
|
706
|
-
type: "perpsAtOpenInterestCap",
|
|
707
|
-
};
|
|
653
|
+
const request = { type: "perpsAtOpenInterestCap" };
|
|
708
654
|
return this.transport.request("info", request, signal);
|
|
709
655
|
}
|
|
710
656
|
/**
|
|
711
657
|
* Request user portfolio.
|
|
712
|
-
* @param
|
|
713
|
-
* @param signal - An
|
|
658
|
+
* @param params - Request-specific parameters.
|
|
659
|
+
* @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}.
|
|
714
660
|
* @returns Portfolio metrics grouped by time periods.
|
|
715
661
|
*
|
|
716
662
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -726,16 +672,13 @@ export class InfoClient {
|
|
|
726
672
|
* const data = await infoClient.portfolio({ user: "0x..." });
|
|
727
673
|
* ```
|
|
728
674
|
*/
|
|
729
|
-
portfolio(
|
|
730
|
-
const request = {
|
|
731
|
-
type: "portfolio",
|
|
732
|
-
...args,
|
|
733
|
-
};
|
|
675
|
+
portfolio(params, signal) {
|
|
676
|
+
const request = { type: "portfolio", ...params };
|
|
734
677
|
return this.transport.request("info", request, signal);
|
|
735
678
|
}
|
|
736
679
|
/**
|
|
737
680
|
* Request predicted funding rates.
|
|
738
|
-
* @param signal - An
|
|
681
|
+
* @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}.
|
|
739
682
|
* @returns Array of predicted funding rates.
|
|
740
683
|
*
|
|
741
684
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -752,15 +695,13 @@ export class InfoClient {
|
|
|
752
695
|
* ```
|
|
753
696
|
*/
|
|
754
697
|
predictedFundings(signal) {
|
|
755
|
-
const request = {
|
|
756
|
-
type: "predictedFundings",
|
|
757
|
-
};
|
|
698
|
+
const request = { type: "predictedFundings" };
|
|
758
699
|
return this.transport.request("info", request, signal);
|
|
759
700
|
}
|
|
760
701
|
/**
|
|
761
702
|
* Request user's existence check before transfer.
|
|
762
|
-
* @param
|
|
763
|
-
* @param signal - An
|
|
703
|
+
* @param params - Request-specific parameters.
|
|
704
|
+
* @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}.
|
|
764
705
|
* @returns Pre-transfer user existence check result.
|
|
765
706
|
*
|
|
766
707
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -776,17 +717,14 @@ export class InfoClient {
|
|
|
776
717
|
* const data = await infoClient.preTransferCheck({ user: "0x...", source: "0x..." });
|
|
777
718
|
* ```
|
|
778
719
|
*/
|
|
779
|
-
preTransferCheck(
|
|
780
|
-
const request = {
|
|
781
|
-
type: "preTransferCheck",
|
|
782
|
-
...args,
|
|
783
|
-
};
|
|
720
|
+
preTransferCheck(params, signal) {
|
|
721
|
+
const request = { type: "preTransferCheck", ...params };
|
|
784
722
|
return this.transport.request("info", request, signal);
|
|
785
723
|
}
|
|
786
724
|
/**
|
|
787
725
|
* Request user referral.
|
|
788
|
-
* @param
|
|
789
|
-
* @param signal - An
|
|
726
|
+
* @param params - Request-specific parameters.
|
|
727
|
+
* @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}.
|
|
790
728
|
* @returns Referral information for a user.
|
|
791
729
|
*
|
|
792
730
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -802,17 +740,14 @@ export class InfoClient {
|
|
|
802
740
|
* const data = await infoClient.referral({ user: "0x..." });
|
|
803
741
|
* ```
|
|
804
742
|
*/
|
|
805
|
-
referral(
|
|
806
|
-
const request = {
|
|
807
|
-
type: "referral",
|
|
808
|
-
...args,
|
|
809
|
-
};
|
|
743
|
+
referral(params, signal) {
|
|
744
|
+
const request = { type: "referral", ...params };
|
|
810
745
|
return this.transport.request("info", request, signal);
|
|
811
746
|
}
|
|
812
747
|
/**
|
|
813
748
|
* Request spot clearinghouse state.
|
|
814
|
-
* @param
|
|
815
|
-
* @param signal - An
|
|
749
|
+
* @param params - Request-specific parameters.
|
|
750
|
+
* @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}.
|
|
816
751
|
* @returns Account summary for spot trading.
|
|
817
752
|
*
|
|
818
753
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -828,17 +763,14 @@ export class InfoClient {
|
|
|
828
763
|
* const data = await infoClient.spotClearinghouseState({ user: "0x..." });
|
|
829
764
|
* ```
|
|
830
765
|
*/
|
|
831
|
-
spotClearinghouseState(
|
|
832
|
-
const request = {
|
|
833
|
-
type: "spotClearinghouseState",
|
|
834
|
-
...args,
|
|
835
|
-
};
|
|
766
|
+
spotClearinghouseState(params, signal) {
|
|
767
|
+
const request = { type: "spotClearinghouseState", ...params };
|
|
836
768
|
return this.transport.request("info", request, signal);
|
|
837
769
|
}
|
|
838
770
|
/**
|
|
839
771
|
* Request spot deploy state.
|
|
840
|
-
* @param
|
|
841
|
-
* @param signal - An
|
|
772
|
+
* @param params - Request-specific parameters.
|
|
773
|
+
* @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}.
|
|
842
774
|
* @returns Deploy state for spot tokens.
|
|
843
775
|
*
|
|
844
776
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -854,16 +786,35 @@ export class InfoClient {
|
|
|
854
786
|
* const data = await infoClient.spotDeployState({ user: "0x..." });
|
|
855
787
|
* ```
|
|
856
788
|
*/
|
|
857
|
-
spotDeployState(
|
|
858
|
-
const request = {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
789
|
+
spotDeployState(params, signal) {
|
|
790
|
+
const request = { type: "spotDeployState", ...params };
|
|
791
|
+
return this.transport.request("info", request, signal);
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Request for the status of the spot deploy auction.
|
|
795
|
+
* @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
|
+
* @returns Status of the spot deploy auction.
|
|
797
|
+
*
|
|
798
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
799
|
+
*
|
|
800
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-pair-deploy-auction
|
|
801
|
+
* @example
|
|
802
|
+
* ```ts
|
|
803
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
804
|
+
*
|
|
805
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
806
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
807
|
+
*
|
|
808
|
+
* const data = await infoClient.spotPairDeployAuctionStatus();
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
spotPairDeployAuctionStatus(signal) {
|
|
812
|
+
const request = { type: "spotPairDeployAuctionStatus" };
|
|
862
813
|
return this.transport.request("info", request, signal);
|
|
863
814
|
}
|
|
864
815
|
/**
|
|
865
816
|
* Request spot trading metadata.
|
|
866
|
-
* @param signal - An
|
|
817
|
+
* @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}.
|
|
867
818
|
* @returns Metadata for spot assets.
|
|
868
819
|
*
|
|
869
820
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -880,14 +831,12 @@ export class InfoClient {
|
|
|
880
831
|
* ```
|
|
881
832
|
*/
|
|
882
833
|
spotMeta(signal) {
|
|
883
|
-
const request = {
|
|
884
|
-
type: "spotMeta",
|
|
885
|
-
};
|
|
834
|
+
const request = { type: "spotMeta" };
|
|
886
835
|
return this.transport.request("info", request, signal);
|
|
887
836
|
}
|
|
888
837
|
/**
|
|
889
838
|
* Request spot metadata and asset contexts.
|
|
890
|
-
* @param signal - An
|
|
839
|
+
* @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}.
|
|
891
840
|
* @returns Metadata and context for spot assets.
|
|
892
841
|
*
|
|
893
842
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -904,15 +853,13 @@ export class InfoClient {
|
|
|
904
853
|
* ```
|
|
905
854
|
*/
|
|
906
855
|
spotMetaAndAssetCtxs(signal) {
|
|
907
|
-
const request = {
|
|
908
|
-
type: "spotMetaAndAssetCtxs",
|
|
909
|
-
};
|
|
856
|
+
const request = { type: "spotMetaAndAssetCtxs" };
|
|
910
857
|
return this.transport.request("info", request, signal);
|
|
911
858
|
}
|
|
912
859
|
/**
|
|
913
860
|
* Request user sub-accounts.
|
|
914
|
-
* @param
|
|
915
|
-
* @param signal - An
|
|
861
|
+
* @param params - Request-specific parameters.
|
|
862
|
+
* @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}.
|
|
916
863
|
* @returns Array of user sub-account or null if the user does not have any sub-accounts.
|
|
917
864
|
*
|
|
918
865
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -928,17 +875,14 @@ export class InfoClient {
|
|
|
928
875
|
* const data = await infoClient.subAccounts({ user: "0x..." });
|
|
929
876
|
* ```
|
|
930
877
|
*/
|
|
931
|
-
subAccounts(
|
|
932
|
-
const request = {
|
|
933
|
-
type: "subAccounts",
|
|
934
|
-
...args,
|
|
935
|
-
};
|
|
878
|
+
subAccounts(params, signal) {
|
|
879
|
+
const request = { type: "subAccounts", ...params };
|
|
936
880
|
return this.transport.request("info", request, signal);
|
|
937
881
|
}
|
|
938
882
|
/**
|
|
939
883
|
* Request token details.
|
|
940
|
-
* @param
|
|
941
|
-
* @param signal - An
|
|
884
|
+
* @param params - Request-specific parameters.
|
|
885
|
+
* @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}.
|
|
942
886
|
* @returns Details of a token.
|
|
943
887
|
*
|
|
944
888
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -954,17 +898,14 @@ export class InfoClient {
|
|
|
954
898
|
* const data = await infoClient.tokenDetails({ tokenId: "0x..." });
|
|
955
899
|
* ```
|
|
956
900
|
*/
|
|
957
|
-
tokenDetails(
|
|
958
|
-
const request = {
|
|
959
|
-
type: "tokenDetails",
|
|
960
|
-
...args,
|
|
961
|
-
};
|
|
901
|
+
tokenDetails(params, signal) {
|
|
902
|
+
const request = { type: "tokenDetails", ...params };
|
|
962
903
|
return this.transport.request("info", request, signal);
|
|
963
904
|
}
|
|
964
905
|
/**
|
|
965
906
|
* Request twap history of a user.
|
|
966
|
-
* @param
|
|
967
|
-
* @param signal - An
|
|
907
|
+
* @param params - Request-specific parameters.
|
|
908
|
+
* @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}.
|
|
968
909
|
* @returns Array of user's TWAP history.
|
|
969
910
|
*
|
|
970
911
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -980,17 +921,14 @@ export class InfoClient {
|
|
|
980
921
|
* const data = await infoClient.twapHistory({ user: "0x..." });
|
|
981
922
|
* ```
|
|
982
923
|
*/
|
|
983
|
-
twapHistory(
|
|
984
|
-
const request = {
|
|
985
|
-
type: "twapHistory",
|
|
986
|
-
...args,
|
|
987
|
-
};
|
|
924
|
+
twapHistory(params, signal) {
|
|
925
|
+
const request = { type: "twapHistory", ...params };
|
|
988
926
|
return this.transport.request("info", request, signal);
|
|
989
927
|
}
|
|
990
928
|
/**
|
|
991
929
|
* Request transaction details by transaction hash.
|
|
992
|
-
* @param
|
|
993
|
-
* @param signal - An
|
|
930
|
+
* @param params - Request-specific parameters.
|
|
931
|
+
* @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}.
|
|
994
932
|
* @returns Transaction details.
|
|
995
933
|
*
|
|
996
934
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1000,24 +938,21 @@ export class InfoClient {
|
|
|
1000
938
|
* ```ts
|
|
1001
939
|
* import * as hl from "@nktkas/hyperliquid";
|
|
1002
940
|
*
|
|
1003
|
-
* const transport = new hl.HttpTransport(); //
|
|
941
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1004
942
|
* const infoClient = new hl.InfoClient({ transport });
|
|
1005
943
|
*
|
|
1006
944
|
* const data = await infoClient.txDetails({ hash: "0x..." });
|
|
1007
945
|
* ```
|
|
1008
946
|
*/
|
|
1009
|
-
|
|
1010
|
-
const request = {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
};
|
|
1014
|
-
const { tx } = await this.transport.request("explorer", request, signal);
|
|
1015
|
-
return tx;
|
|
947
|
+
txDetails(params, signal) {
|
|
948
|
+
const request = { type: "txDetails", ...params };
|
|
949
|
+
return this.transport.request("explorer", request, signal)
|
|
950
|
+
.then(({ tx }) => tx);
|
|
1016
951
|
}
|
|
1017
952
|
/**
|
|
1018
953
|
* Request user details by user's address.
|
|
1019
|
-
* @param
|
|
1020
|
-
* @param signal - An
|
|
954
|
+
* @param params - Request-specific parameters.
|
|
955
|
+
* @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}.
|
|
1021
956
|
* @returns User details.
|
|
1022
957
|
*
|
|
1023
958
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1027,24 +962,21 @@ export class InfoClient {
|
|
|
1027
962
|
* ```ts
|
|
1028
963
|
* import * as hl from "@nktkas/hyperliquid";
|
|
1029
964
|
*
|
|
1030
|
-
* const transport = new hl.HttpTransport(); //
|
|
965
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1031
966
|
* const infoClient = new hl.InfoClient({ transport });
|
|
1032
967
|
*
|
|
1033
968
|
* const data = await infoClient.userDetails({ user: "0x..." });
|
|
1034
969
|
* ```
|
|
1035
970
|
*/
|
|
1036
|
-
|
|
1037
|
-
const request = {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
};
|
|
1041
|
-
const { txs } = await this.transport.request("explorer", request, signal);
|
|
1042
|
-
return txs;
|
|
971
|
+
userDetails(params, signal) {
|
|
972
|
+
const request = { type: "userDetails", ...params };
|
|
973
|
+
return this.transport.request("explorer", request, signal)
|
|
974
|
+
.then(({ txs }) => txs);
|
|
1043
975
|
}
|
|
1044
976
|
/**
|
|
1045
977
|
* Request user fees.
|
|
1046
|
-
* @param
|
|
1047
|
-
* @param signal - An
|
|
978
|
+
* @param params - Request-specific parameters.
|
|
979
|
+
* @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}.
|
|
1048
980
|
* @returns User fees.
|
|
1049
981
|
*
|
|
1050
982
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1060,17 +992,14 @@ export class InfoClient {
|
|
|
1060
992
|
* const data = await infoClient.userFees({ user: "0x..." });
|
|
1061
993
|
* ```
|
|
1062
994
|
*/
|
|
1063
|
-
userFees(
|
|
1064
|
-
const request = {
|
|
1065
|
-
type: "userFees",
|
|
1066
|
-
...args,
|
|
1067
|
-
};
|
|
995
|
+
userFees(params, signal) {
|
|
996
|
+
const request = { type: "userFees", ...params };
|
|
1068
997
|
return this.transport.request("info", request, signal);
|
|
1069
998
|
}
|
|
1070
999
|
/**
|
|
1071
1000
|
* Request user fills.
|
|
1072
|
-
* @param
|
|
1073
|
-
* @param signal - An
|
|
1001
|
+
* @param params - Request-specific parameters.
|
|
1002
|
+
* @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}.
|
|
1074
1003
|
* @returns Array of user's trade fill.
|
|
1075
1004
|
*
|
|
1076
1005
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1086,17 +1015,14 @@ export class InfoClient {
|
|
|
1086
1015
|
* const data = await infoClient.userFills({ user: "0x..." });
|
|
1087
1016
|
* ```
|
|
1088
1017
|
*/
|
|
1089
|
-
userFills(
|
|
1090
|
-
const request = {
|
|
1091
|
-
type: "userFills",
|
|
1092
|
-
...args,
|
|
1093
|
-
};
|
|
1018
|
+
userFills(params, signal) {
|
|
1019
|
+
const request = { type: "userFills", ...params };
|
|
1094
1020
|
return this.transport.request("info", request, signal);
|
|
1095
1021
|
}
|
|
1096
1022
|
/**
|
|
1097
1023
|
* Request user fills by time.
|
|
1098
|
-
* @param
|
|
1099
|
-
* @param signal - An
|
|
1024
|
+
* @param params - Request-specific parameters.
|
|
1025
|
+
* @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}.
|
|
1100
1026
|
* @returns Array of user's trade fill.
|
|
1101
1027
|
*
|
|
1102
1028
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1115,17 +1041,14 @@ export class InfoClient {
|
|
|
1115
1041
|
* });
|
|
1116
1042
|
* ```
|
|
1117
1043
|
*/
|
|
1118
|
-
userFillsByTime(
|
|
1119
|
-
const request = {
|
|
1120
|
-
type: "userFillsByTime",
|
|
1121
|
-
...args,
|
|
1122
|
-
};
|
|
1044
|
+
userFillsByTime(params, signal) {
|
|
1045
|
+
const request = { type: "userFillsByTime", ...params };
|
|
1123
1046
|
return this.transport.request("info", request, signal);
|
|
1124
1047
|
}
|
|
1125
1048
|
/**
|
|
1126
1049
|
* Request user funding.
|
|
1127
|
-
* @param
|
|
1128
|
-
* @param signal - An
|
|
1050
|
+
* @param params - Request-specific parameters.
|
|
1051
|
+
* @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}.
|
|
1129
1052
|
* @returns Array of user's funding ledger update.
|
|
1130
1053
|
*
|
|
1131
1054
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1144,17 +1067,14 @@ export class InfoClient {
|
|
|
1144
1067
|
* });
|
|
1145
1068
|
* ```
|
|
1146
1069
|
*/
|
|
1147
|
-
userFunding(
|
|
1148
|
-
const request = {
|
|
1149
|
-
type: "userFunding",
|
|
1150
|
-
...args,
|
|
1151
|
-
};
|
|
1070
|
+
userFunding(params, signal) {
|
|
1071
|
+
const request = { type: "userFunding", ...params };
|
|
1152
1072
|
return this.transport.request("info", request, signal);
|
|
1153
1073
|
}
|
|
1154
1074
|
/**
|
|
1155
1075
|
* Request user non-funding ledger updates.
|
|
1156
|
-
* @param
|
|
1157
|
-
* @param signal - An
|
|
1076
|
+
* @param params - Request-specific parameters.
|
|
1077
|
+
* @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}.
|
|
1158
1078
|
* @returns Array of user's non-funding ledger update.
|
|
1159
1079
|
*
|
|
1160
1080
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1173,17 +1093,14 @@ export class InfoClient {
|
|
|
1173
1093
|
* });
|
|
1174
1094
|
* ```
|
|
1175
1095
|
*/
|
|
1176
|
-
userNonFundingLedgerUpdates(
|
|
1177
|
-
const request = {
|
|
1178
|
-
type: "userNonFundingLedgerUpdates",
|
|
1179
|
-
...args,
|
|
1180
|
-
};
|
|
1096
|
+
userNonFundingLedgerUpdates(params, signal) {
|
|
1097
|
+
const request = { type: "userNonFundingLedgerUpdates", ...params };
|
|
1181
1098
|
return this.transport.request("info", request, signal);
|
|
1182
1099
|
}
|
|
1183
1100
|
/**
|
|
1184
1101
|
* Request user rate limits.
|
|
1185
|
-
* @param
|
|
1186
|
-
* @param signal - An
|
|
1102
|
+
* @param params - Request-specific parameters.
|
|
1103
|
+
* @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}.
|
|
1187
1104
|
* @returns User's rate limits.
|
|
1188
1105
|
*
|
|
1189
1106
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1199,17 +1116,14 @@ export class InfoClient {
|
|
|
1199
1116
|
* const data = await infoClient.userRateLimit({ user: "0x..." });
|
|
1200
1117
|
* ```
|
|
1201
1118
|
*/
|
|
1202
|
-
userRateLimit(
|
|
1203
|
-
const request = {
|
|
1204
|
-
type: "userRateLimit",
|
|
1205
|
-
...args,
|
|
1206
|
-
};
|
|
1119
|
+
userRateLimit(params, signal) {
|
|
1120
|
+
const request = { type: "userRateLimit", ...params };
|
|
1207
1121
|
return this.transport.request("info", request, signal);
|
|
1208
1122
|
}
|
|
1209
1123
|
/**
|
|
1210
1124
|
* Request user role.
|
|
1211
|
-
* @param
|
|
1212
|
-
* @param signal - An
|
|
1125
|
+
* @param params - Request-specific parameters.
|
|
1126
|
+
* @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}.
|
|
1213
1127
|
* @returns User's role.
|
|
1214
1128
|
*
|
|
1215
1129
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1225,17 +1139,14 @@ export class InfoClient {
|
|
|
1225
1139
|
* const data = await infoClient.userRole({ user: "0x..." });
|
|
1226
1140
|
* ```
|
|
1227
1141
|
*/
|
|
1228
|
-
userRole(
|
|
1229
|
-
const request = {
|
|
1230
|
-
type: "userRole",
|
|
1231
|
-
...args,
|
|
1232
|
-
};
|
|
1142
|
+
userRole(params, signal) {
|
|
1143
|
+
const request = { type: "userRole", ...params };
|
|
1233
1144
|
return this.transport.request("info", request, signal);
|
|
1234
1145
|
}
|
|
1235
1146
|
/**
|
|
1236
1147
|
* Request multi-sig signers for a user.
|
|
1237
|
-
* @param
|
|
1238
|
-
* @param signal - An
|
|
1148
|
+
* @param params - Request-specific parameters.
|
|
1149
|
+
* @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}.
|
|
1239
1150
|
* @returns Multi-sig signers for a user or null if the user does not have any multi-sig signers.
|
|
1240
1151
|
*
|
|
1241
1152
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1251,17 +1162,14 @@ export class InfoClient {
|
|
|
1251
1162
|
* const data = await infoClient.userToMultiSigSigners({ user: "0x..." });
|
|
1252
1163
|
* ```
|
|
1253
1164
|
*/
|
|
1254
|
-
userToMultiSigSigners(
|
|
1255
|
-
const request = {
|
|
1256
|
-
type: "userToMultiSigSigners",
|
|
1257
|
-
...args,
|
|
1258
|
-
};
|
|
1165
|
+
userToMultiSigSigners(params, signal) {
|
|
1166
|
+
const request = { type: "userToMultiSigSigners", ...params };
|
|
1259
1167
|
return this.transport.request("info", request, signal);
|
|
1260
1168
|
}
|
|
1261
1169
|
/**
|
|
1262
1170
|
* Request user twap slice fills.
|
|
1263
|
-
* @param
|
|
1264
|
-
* @param signal - An
|
|
1171
|
+
* @param params - Request-specific parameters.
|
|
1172
|
+
* @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}.
|
|
1265
1173
|
* @returns Array of user's twap slice fill.
|
|
1266
1174
|
*
|
|
1267
1175
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1277,17 +1185,14 @@ export class InfoClient {
|
|
|
1277
1185
|
* const data = await infoClient.userTwapSliceFills({ user: "0x..." });
|
|
1278
1186
|
* ```
|
|
1279
1187
|
*/
|
|
1280
|
-
userTwapSliceFills(
|
|
1281
|
-
const request = {
|
|
1282
|
-
type: "userTwapSliceFills",
|
|
1283
|
-
...args,
|
|
1284
|
-
};
|
|
1188
|
+
userTwapSliceFills(params, signal) {
|
|
1189
|
+
const request = { type: "userTwapSliceFills", ...params };
|
|
1285
1190
|
return this.transport.request("info", request, signal);
|
|
1286
1191
|
}
|
|
1287
1192
|
/**
|
|
1288
1193
|
* Request user twap slice fills by time.
|
|
1289
|
-
* @param
|
|
1290
|
-
* @param signal - An
|
|
1194
|
+
* @param params - Request-specific parameters.
|
|
1195
|
+
* @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}.
|
|
1291
1196
|
* @returns Array of user's twap slice fill.
|
|
1292
1197
|
*
|
|
1293
1198
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1306,17 +1211,14 @@ export class InfoClient {
|
|
|
1306
1211
|
* });
|
|
1307
1212
|
* ```
|
|
1308
1213
|
*/
|
|
1309
|
-
userTwapSliceFillsByTime(
|
|
1310
|
-
const request = {
|
|
1311
|
-
type: "userTwapSliceFillsByTime",
|
|
1312
|
-
...args,
|
|
1313
|
-
};
|
|
1214
|
+
userTwapSliceFillsByTime(params, signal) {
|
|
1215
|
+
const request = { type: "userTwapSliceFillsByTime", ...params };
|
|
1314
1216
|
return this.transport.request("info", request, signal);
|
|
1315
1217
|
}
|
|
1316
1218
|
/**
|
|
1317
1219
|
* Request user vault deposits.
|
|
1318
|
-
* @param
|
|
1319
|
-
* @param signal - An
|
|
1220
|
+
* @param params - Request-specific parameters.
|
|
1221
|
+
* @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}.
|
|
1320
1222
|
* @returns Array of user's vault deposits.
|
|
1321
1223
|
*
|
|
1322
1224
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1332,21 +1234,18 @@ export class InfoClient {
|
|
|
1332
1234
|
* const data = await infoClient.userVaultEquities({ user: "0x..." });
|
|
1333
1235
|
* ```
|
|
1334
1236
|
*/
|
|
1335
|
-
userVaultEquities(
|
|
1336
|
-
const request = {
|
|
1337
|
-
type: "userVaultEquities",
|
|
1338
|
-
...args,
|
|
1339
|
-
};
|
|
1237
|
+
userVaultEquities(params, signal) {
|
|
1238
|
+
const request = { type: "userVaultEquities", ...params };
|
|
1340
1239
|
return this.transport.request("info", request, signal);
|
|
1341
1240
|
}
|
|
1342
1241
|
/**
|
|
1343
1242
|
* Request validator L1 votes.
|
|
1344
|
-
* @param signal - An
|
|
1243
|
+
* @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}.
|
|
1345
1244
|
* @returns
|
|
1346
1245
|
*
|
|
1347
1246
|
* @throws {TransportError} When the transport layer throws an error.
|
|
1348
1247
|
*
|
|
1349
|
-
* @see
|
|
1248
|
+
* @see null
|
|
1350
1249
|
* @example
|
|
1351
1250
|
* ```ts
|
|
1352
1251
|
* import * as hl from "@nktkas/hyperliquid";
|
|
@@ -1358,14 +1257,12 @@ export class InfoClient {
|
|
|
1358
1257
|
* ```
|
|
1359
1258
|
*/
|
|
1360
1259
|
validatorL1Votes(signal) {
|
|
1361
|
-
const request = {
|
|
1362
|
-
type: "validatorL1Votes",
|
|
1363
|
-
};
|
|
1260
|
+
const request = { type: "validatorL1Votes" };
|
|
1364
1261
|
return this.transport.request("info", request, signal);
|
|
1365
1262
|
}
|
|
1366
1263
|
/**
|
|
1367
1264
|
* Request validator summaries.
|
|
1368
|
-
* @param signal - An
|
|
1265
|
+
* @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}.
|
|
1369
1266
|
* @returns Array of validator summaries.
|
|
1370
1267
|
*
|
|
1371
1268
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1382,15 +1279,13 @@ export class InfoClient {
|
|
|
1382
1279
|
* ```
|
|
1383
1280
|
*/
|
|
1384
1281
|
validatorSummaries(signal) {
|
|
1385
|
-
const request = {
|
|
1386
|
-
type: "validatorSummaries",
|
|
1387
|
-
};
|
|
1282
|
+
const request = { type: "validatorSummaries" };
|
|
1388
1283
|
return this.transport.request("info", request, signal);
|
|
1389
1284
|
}
|
|
1390
1285
|
/**
|
|
1391
1286
|
* Request details of a vault.
|
|
1392
|
-
* @param
|
|
1393
|
-
* @param signal - An
|
|
1287
|
+
* @param params - Request-specific parameters.
|
|
1288
|
+
* @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}.
|
|
1394
1289
|
* @returns Details of a vault or null if the vault does not exist.
|
|
1395
1290
|
*
|
|
1396
1291
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1406,16 +1301,13 @@ export class InfoClient {
|
|
|
1406
1301
|
* const data = await infoClient.vaultDetails({ vaultAddress: "0x..." });
|
|
1407
1302
|
* ```
|
|
1408
1303
|
*/
|
|
1409
|
-
vaultDetails(
|
|
1410
|
-
const request = {
|
|
1411
|
-
type: "vaultDetails",
|
|
1412
|
-
...args,
|
|
1413
|
-
};
|
|
1304
|
+
vaultDetails(params, signal) {
|
|
1305
|
+
const request = { type: "vaultDetails", ...params };
|
|
1414
1306
|
return this.transport.request("info", request, signal);
|
|
1415
1307
|
}
|
|
1416
1308
|
/**
|
|
1417
1309
|
* Request a list of vaults less than 2 hours old.
|
|
1418
|
-
* @param signal - An
|
|
1310
|
+
* @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}.
|
|
1419
1311
|
* @returns Array of vault summaries.
|
|
1420
1312
|
*
|
|
1421
1313
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1432,9 +1324,7 @@ export class InfoClient {
|
|
|
1432
1324
|
* ```
|
|
1433
1325
|
*/
|
|
1434
1326
|
vaultSummaries(signal) {
|
|
1435
|
-
const request = {
|
|
1436
|
-
type: "vaultSummaries",
|
|
1437
|
-
};
|
|
1327
|
+
const request = { type: "vaultSummaries" };
|
|
1438
1328
|
return this.transport.request("info", request, signal);
|
|
1439
1329
|
}
|
|
1440
1330
|
async [Symbol.asyncDispose]() {
|