@nktkas/hyperliquid 0.23.1 → 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 +154 -170
- package/esm/mod.d.ts +1 -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 +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 +228 -203
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +236 -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 +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 +29 -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 +117 -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 +1 -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 +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 +228 -203
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +236 -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 +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 +29 -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 +117 -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: "BTC" });
|
|
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,13 @@ export class InfoClient {
|
|
|
854
786
|
* const data = await infoClient.spotDeployState({ user: "0x..." });
|
|
855
787
|
* ```
|
|
856
788
|
*/
|
|
857
|
-
spotDeployState(
|
|
858
|
-
const request = {
|
|
859
|
-
type: "spotDeployState",
|
|
860
|
-
...args,
|
|
861
|
-
};
|
|
789
|
+
spotDeployState(params, signal) {
|
|
790
|
+
const request = { type: "spotDeployState", ...params };
|
|
862
791
|
return this.transport.request("info", request, signal);
|
|
863
792
|
}
|
|
864
793
|
/**
|
|
865
794
|
* Request spot trading metadata.
|
|
866
|
-
* @param signal - An
|
|
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}.
|
|
867
796
|
* @returns Metadata for spot assets.
|
|
868
797
|
*
|
|
869
798
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -880,14 +809,12 @@ export class InfoClient {
|
|
|
880
809
|
* ```
|
|
881
810
|
*/
|
|
882
811
|
spotMeta(signal) {
|
|
883
|
-
const request = {
|
|
884
|
-
type: "spotMeta",
|
|
885
|
-
};
|
|
812
|
+
const request = { type: "spotMeta" };
|
|
886
813
|
return this.transport.request("info", request, signal);
|
|
887
814
|
}
|
|
888
815
|
/**
|
|
889
816
|
* Request spot metadata and asset contexts.
|
|
890
|
-
* @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}.
|
|
891
818
|
* @returns Metadata and context for spot assets.
|
|
892
819
|
*
|
|
893
820
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -904,15 +831,13 @@ export class InfoClient {
|
|
|
904
831
|
* ```
|
|
905
832
|
*/
|
|
906
833
|
spotMetaAndAssetCtxs(signal) {
|
|
907
|
-
const request = {
|
|
908
|
-
type: "spotMetaAndAssetCtxs",
|
|
909
|
-
};
|
|
834
|
+
const request = { type: "spotMetaAndAssetCtxs" };
|
|
910
835
|
return this.transport.request("info", request, signal);
|
|
911
836
|
}
|
|
912
837
|
/**
|
|
913
838
|
* Request user sub-accounts.
|
|
914
|
-
* @param
|
|
915
|
-
* @param signal - An
|
|
839
|
+
* @param params - Request-specific parameters.
|
|
840
|
+
* @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
841
|
* @returns Array of user sub-account or null if the user does not have any sub-accounts.
|
|
917
842
|
*
|
|
918
843
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -928,17 +853,14 @@ export class InfoClient {
|
|
|
928
853
|
* const data = await infoClient.subAccounts({ user: "0x..." });
|
|
929
854
|
* ```
|
|
930
855
|
*/
|
|
931
|
-
subAccounts(
|
|
932
|
-
const request = {
|
|
933
|
-
type: "subAccounts",
|
|
934
|
-
...args,
|
|
935
|
-
};
|
|
856
|
+
subAccounts(params, signal) {
|
|
857
|
+
const request = { type: "subAccounts", ...params };
|
|
936
858
|
return this.transport.request("info", request, signal);
|
|
937
859
|
}
|
|
938
860
|
/**
|
|
939
861
|
* Request token details.
|
|
940
|
-
* @param
|
|
941
|
-
* @param signal - An
|
|
862
|
+
* @param params - Request-specific parameters.
|
|
863
|
+
* @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
864
|
* @returns Details of a token.
|
|
943
865
|
*
|
|
944
866
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -954,17 +876,14 @@ export class InfoClient {
|
|
|
954
876
|
* const data = await infoClient.tokenDetails({ tokenId: "0x..." });
|
|
955
877
|
* ```
|
|
956
878
|
*/
|
|
957
|
-
tokenDetails(
|
|
958
|
-
const request = {
|
|
959
|
-
type: "tokenDetails",
|
|
960
|
-
...args,
|
|
961
|
-
};
|
|
879
|
+
tokenDetails(params, signal) {
|
|
880
|
+
const request = { type: "tokenDetails", ...params };
|
|
962
881
|
return this.transport.request("info", request, signal);
|
|
963
882
|
}
|
|
964
883
|
/**
|
|
965
884
|
* Request twap history of a user.
|
|
966
|
-
* @param
|
|
967
|
-
* @param signal - An
|
|
885
|
+
* @param params - Request-specific parameters.
|
|
886
|
+
* @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
887
|
* @returns Array of user's TWAP history.
|
|
969
888
|
*
|
|
970
889
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -980,17 +899,14 @@ export class InfoClient {
|
|
|
980
899
|
* const data = await infoClient.twapHistory({ user: "0x..." });
|
|
981
900
|
* ```
|
|
982
901
|
*/
|
|
983
|
-
twapHistory(
|
|
984
|
-
const request = {
|
|
985
|
-
type: "twapHistory",
|
|
986
|
-
...args,
|
|
987
|
-
};
|
|
902
|
+
twapHistory(params, signal) {
|
|
903
|
+
const request = { type: "twapHistory", ...params };
|
|
988
904
|
return this.transport.request("info", request, signal);
|
|
989
905
|
}
|
|
990
906
|
/**
|
|
991
907
|
* Request transaction details by transaction hash.
|
|
992
|
-
* @param
|
|
993
|
-
* @param signal - An
|
|
908
|
+
* @param params - Request-specific parameters.
|
|
909
|
+
* @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
910
|
* @returns Transaction details.
|
|
995
911
|
*
|
|
996
912
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1000,24 +916,21 @@ export class InfoClient {
|
|
|
1000
916
|
* ```ts
|
|
1001
917
|
* import * as hl from "@nktkas/hyperliquid";
|
|
1002
918
|
*
|
|
1003
|
-
* const transport = new hl.HttpTransport(); //
|
|
919
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1004
920
|
* const infoClient = new hl.InfoClient({ transport });
|
|
1005
921
|
*
|
|
1006
922
|
* const data = await infoClient.txDetails({ hash: "0x..." });
|
|
1007
923
|
* ```
|
|
1008
924
|
*/
|
|
1009
|
-
|
|
1010
|
-
const request = {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
};
|
|
1014
|
-
const { tx } = await this.transport.request("explorer", request, signal);
|
|
1015
|
-
return tx;
|
|
925
|
+
txDetails(params, signal) {
|
|
926
|
+
const request = { type: "txDetails", ...params };
|
|
927
|
+
return this.transport.request("explorer", request, signal)
|
|
928
|
+
.then(({ tx }) => tx);
|
|
1016
929
|
}
|
|
1017
930
|
/**
|
|
1018
931
|
* Request user details by user's address.
|
|
1019
|
-
* @param
|
|
1020
|
-
* @param signal - An
|
|
932
|
+
* @param params - Request-specific parameters.
|
|
933
|
+
* @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
934
|
* @returns User details.
|
|
1022
935
|
*
|
|
1023
936
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1027,24 +940,21 @@ export class InfoClient {
|
|
|
1027
940
|
* ```ts
|
|
1028
941
|
* import * as hl from "@nktkas/hyperliquid";
|
|
1029
942
|
*
|
|
1030
|
-
* const transport = new hl.HttpTransport(); //
|
|
943
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1031
944
|
* const infoClient = new hl.InfoClient({ transport });
|
|
1032
945
|
*
|
|
1033
946
|
* const data = await infoClient.userDetails({ user: "0x..." });
|
|
1034
947
|
* ```
|
|
1035
948
|
*/
|
|
1036
|
-
|
|
1037
|
-
const request = {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
};
|
|
1041
|
-
const { txs } = await this.transport.request("explorer", request, signal);
|
|
1042
|
-
return txs;
|
|
949
|
+
userDetails(params, signal) {
|
|
950
|
+
const request = { type: "userDetails", ...params };
|
|
951
|
+
return this.transport.request("explorer", request, signal)
|
|
952
|
+
.then(({ txs }) => txs);
|
|
1043
953
|
}
|
|
1044
954
|
/**
|
|
1045
955
|
* Request user fees.
|
|
1046
|
-
* @param
|
|
1047
|
-
* @param signal - An
|
|
956
|
+
* @param params - Request-specific parameters.
|
|
957
|
+
* @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
958
|
* @returns User fees.
|
|
1049
959
|
*
|
|
1050
960
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1060,17 +970,14 @@ export class InfoClient {
|
|
|
1060
970
|
* const data = await infoClient.userFees({ user: "0x..." });
|
|
1061
971
|
* ```
|
|
1062
972
|
*/
|
|
1063
|
-
userFees(
|
|
1064
|
-
const request = {
|
|
1065
|
-
type: "userFees",
|
|
1066
|
-
...args,
|
|
1067
|
-
};
|
|
973
|
+
userFees(params, signal) {
|
|
974
|
+
const request = { type: "userFees", ...params };
|
|
1068
975
|
return this.transport.request("info", request, signal);
|
|
1069
976
|
}
|
|
1070
977
|
/**
|
|
1071
978
|
* Request user fills.
|
|
1072
|
-
* @param
|
|
1073
|
-
* @param signal - An
|
|
979
|
+
* @param params - Request-specific parameters.
|
|
980
|
+
* @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
981
|
* @returns Array of user's trade fill.
|
|
1075
982
|
*
|
|
1076
983
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1086,17 +993,14 @@ export class InfoClient {
|
|
|
1086
993
|
* const data = await infoClient.userFills({ user: "0x..." });
|
|
1087
994
|
* ```
|
|
1088
995
|
*/
|
|
1089
|
-
userFills(
|
|
1090
|
-
const request = {
|
|
1091
|
-
type: "userFills",
|
|
1092
|
-
...args,
|
|
1093
|
-
};
|
|
996
|
+
userFills(params, signal) {
|
|
997
|
+
const request = { type: "userFills", ...params };
|
|
1094
998
|
return this.transport.request("info", request, signal);
|
|
1095
999
|
}
|
|
1096
1000
|
/**
|
|
1097
1001
|
* Request user fills by time.
|
|
1098
|
-
* @param
|
|
1099
|
-
* @param signal - An
|
|
1002
|
+
* @param params - Request-specific parameters.
|
|
1003
|
+
* @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
1004
|
* @returns Array of user's trade fill.
|
|
1101
1005
|
*
|
|
1102
1006
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1115,17 +1019,14 @@ export class InfoClient {
|
|
|
1115
1019
|
* });
|
|
1116
1020
|
* ```
|
|
1117
1021
|
*/
|
|
1118
|
-
userFillsByTime(
|
|
1119
|
-
const request = {
|
|
1120
|
-
type: "userFillsByTime",
|
|
1121
|
-
...args,
|
|
1122
|
-
};
|
|
1022
|
+
userFillsByTime(params, signal) {
|
|
1023
|
+
const request = { type: "userFillsByTime", ...params };
|
|
1123
1024
|
return this.transport.request("info", request, signal);
|
|
1124
1025
|
}
|
|
1125
1026
|
/**
|
|
1126
1027
|
* Request user funding.
|
|
1127
|
-
* @param
|
|
1128
|
-
* @param signal - An
|
|
1028
|
+
* @param params - Request-specific parameters.
|
|
1029
|
+
* @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
1030
|
* @returns Array of user's funding ledger update.
|
|
1130
1031
|
*
|
|
1131
1032
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1144,17 +1045,14 @@ export class InfoClient {
|
|
|
1144
1045
|
* });
|
|
1145
1046
|
* ```
|
|
1146
1047
|
*/
|
|
1147
|
-
userFunding(
|
|
1148
|
-
const request = {
|
|
1149
|
-
type: "userFunding",
|
|
1150
|
-
...args,
|
|
1151
|
-
};
|
|
1048
|
+
userFunding(params, signal) {
|
|
1049
|
+
const request = { type: "userFunding", ...params };
|
|
1152
1050
|
return this.transport.request("info", request, signal);
|
|
1153
1051
|
}
|
|
1154
1052
|
/**
|
|
1155
1053
|
* Request user non-funding ledger updates.
|
|
1156
|
-
* @param
|
|
1157
|
-
* @param signal - An
|
|
1054
|
+
* @param params - Request-specific parameters.
|
|
1055
|
+
* @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
1056
|
* @returns Array of user's non-funding ledger update.
|
|
1159
1057
|
*
|
|
1160
1058
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1173,17 +1071,14 @@ export class InfoClient {
|
|
|
1173
1071
|
* });
|
|
1174
1072
|
* ```
|
|
1175
1073
|
*/
|
|
1176
|
-
userNonFundingLedgerUpdates(
|
|
1177
|
-
const request = {
|
|
1178
|
-
type: "userNonFundingLedgerUpdates",
|
|
1179
|
-
...args,
|
|
1180
|
-
};
|
|
1074
|
+
userNonFundingLedgerUpdates(params, signal) {
|
|
1075
|
+
const request = { type: "userNonFundingLedgerUpdates", ...params };
|
|
1181
1076
|
return this.transport.request("info", request, signal);
|
|
1182
1077
|
}
|
|
1183
1078
|
/**
|
|
1184
1079
|
* Request user rate limits.
|
|
1185
|
-
* @param
|
|
1186
|
-
* @param signal - An
|
|
1080
|
+
* @param params - Request-specific parameters.
|
|
1081
|
+
* @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
1082
|
* @returns User's rate limits.
|
|
1188
1083
|
*
|
|
1189
1084
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1199,17 +1094,14 @@ export class InfoClient {
|
|
|
1199
1094
|
* const data = await infoClient.userRateLimit({ user: "0x..." });
|
|
1200
1095
|
* ```
|
|
1201
1096
|
*/
|
|
1202
|
-
userRateLimit(
|
|
1203
|
-
const request = {
|
|
1204
|
-
type: "userRateLimit",
|
|
1205
|
-
...args,
|
|
1206
|
-
};
|
|
1097
|
+
userRateLimit(params, signal) {
|
|
1098
|
+
const request = { type: "userRateLimit", ...params };
|
|
1207
1099
|
return this.transport.request("info", request, signal);
|
|
1208
1100
|
}
|
|
1209
1101
|
/**
|
|
1210
1102
|
* Request user role.
|
|
1211
|
-
* @param
|
|
1212
|
-
* @param signal - An
|
|
1103
|
+
* @param params - Request-specific parameters.
|
|
1104
|
+
* @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
1105
|
* @returns User's role.
|
|
1214
1106
|
*
|
|
1215
1107
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1225,17 +1117,14 @@ export class InfoClient {
|
|
|
1225
1117
|
* const data = await infoClient.userRole({ user: "0x..." });
|
|
1226
1118
|
* ```
|
|
1227
1119
|
*/
|
|
1228
|
-
userRole(
|
|
1229
|
-
const request = {
|
|
1230
|
-
type: "userRole",
|
|
1231
|
-
...args,
|
|
1232
|
-
};
|
|
1120
|
+
userRole(params, signal) {
|
|
1121
|
+
const request = { type: "userRole", ...params };
|
|
1233
1122
|
return this.transport.request("info", request, signal);
|
|
1234
1123
|
}
|
|
1235
1124
|
/**
|
|
1236
1125
|
* Request multi-sig signers for a user.
|
|
1237
|
-
* @param
|
|
1238
|
-
* @param signal - An
|
|
1126
|
+
* @param params - Request-specific parameters.
|
|
1127
|
+
* @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
1128
|
* @returns Multi-sig signers for a user or null if the user does not have any multi-sig signers.
|
|
1240
1129
|
*
|
|
1241
1130
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1251,17 +1140,14 @@ export class InfoClient {
|
|
|
1251
1140
|
* const data = await infoClient.userToMultiSigSigners({ user: "0x..." });
|
|
1252
1141
|
* ```
|
|
1253
1142
|
*/
|
|
1254
|
-
userToMultiSigSigners(
|
|
1255
|
-
const request = {
|
|
1256
|
-
type: "userToMultiSigSigners",
|
|
1257
|
-
...args,
|
|
1258
|
-
};
|
|
1143
|
+
userToMultiSigSigners(params, signal) {
|
|
1144
|
+
const request = { type: "userToMultiSigSigners", ...params };
|
|
1259
1145
|
return this.transport.request("info", request, signal);
|
|
1260
1146
|
}
|
|
1261
1147
|
/**
|
|
1262
1148
|
* Request user twap slice fills.
|
|
1263
|
-
* @param
|
|
1264
|
-
* @param signal - An
|
|
1149
|
+
* @param params - Request-specific parameters.
|
|
1150
|
+
* @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
1151
|
* @returns Array of user's twap slice fill.
|
|
1266
1152
|
*
|
|
1267
1153
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1277,17 +1163,14 @@ export class InfoClient {
|
|
|
1277
1163
|
* const data = await infoClient.userTwapSliceFills({ user: "0x..." });
|
|
1278
1164
|
* ```
|
|
1279
1165
|
*/
|
|
1280
|
-
userTwapSliceFills(
|
|
1281
|
-
const request = {
|
|
1282
|
-
type: "userTwapSliceFills",
|
|
1283
|
-
...args,
|
|
1284
|
-
};
|
|
1166
|
+
userTwapSliceFills(params, signal) {
|
|
1167
|
+
const request = { type: "userTwapSliceFills", ...params };
|
|
1285
1168
|
return this.transport.request("info", request, signal);
|
|
1286
1169
|
}
|
|
1287
1170
|
/**
|
|
1288
1171
|
* Request user twap slice fills by time.
|
|
1289
|
-
* @param
|
|
1290
|
-
* @param signal - An
|
|
1172
|
+
* @param params - Request-specific parameters.
|
|
1173
|
+
* @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
1174
|
* @returns Array of user's twap slice fill.
|
|
1292
1175
|
*
|
|
1293
1176
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1306,17 +1189,14 @@ export class InfoClient {
|
|
|
1306
1189
|
* });
|
|
1307
1190
|
* ```
|
|
1308
1191
|
*/
|
|
1309
|
-
userTwapSliceFillsByTime(
|
|
1310
|
-
const request = {
|
|
1311
|
-
type: "userTwapSliceFillsByTime",
|
|
1312
|
-
...args,
|
|
1313
|
-
};
|
|
1192
|
+
userTwapSliceFillsByTime(params, signal) {
|
|
1193
|
+
const request = { type: "userTwapSliceFillsByTime", ...params };
|
|
1314
1194
|
return this.transport.request("info", request, signal);
|
|
1315
1195
|
}
|
|
1316
1196
|
/**
|
|
1317
1197
|
* Request user vault deposits.
|
|
1318
|
-
* @param
|
|
1319
|
-
* @param signal - An
|
|
1198
|
+
* @param params - Request-specific parameters.
|
|
1199
|
+
* @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
1200
|
* @returns Array of user's vault deposits.
|
|
1321
1201
|
*
|
|
1322
1202
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1332,21 +1212,18 @@ export class InfoClient {
|
|
|
1332
1212
|
* const data = await infoClient.userVaultEquities({ user: "0x..." });
|
|
1333
1213
|
* ```
|
|
1334
1214
|
*/
|
|
1335
|
-
userVaultEquities(
|
|
1336
|
-
const request = {
|
|
1337
|
-
type: "userVaultEquities",
|
|
1338
|
-
...args,
|
|
1339
|
-
};
|
|
1215
|
+
userVaultEquities(params, signal) {
|
|
1216
|
+
const request = { type: "userVaultEquities", ...params };
|
|
1340
1217
|
return this.transport.request("info", request, signal);
|
|
1341
1218
|
}
|
|
1342
1219
|
/**
|
|
1343
1220
|
* Request validator L1 votes.
|
|
1344
|
-
* @param signal - An
|
|
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}.
|
|
1345
1222
|
* @returns
|
|
1346
1223
|
*
|
|
1347
1224
|
* @throws {TransportError} When the transport layer throws an error.
|
|
1348
1225
|
*
|
|
1349
|
-
* @see
|
|
1226
|
+
* @see null
|
|
1350
1227
|
* @example
|
|
1351
1228
|
* ```ts
|
|
1352
1229
|
* import * as hl from "@nktkas/hyperliquid";
|
|
@@ -1358,14 +1235,12 @@ export class InfoClient {
|
|
|
1358
1235
|
* ```
|
|
1359
1236
|
*/
|
|
1360
1237
|
validatorL1Votes(signal) {
|
|
1361
|
-
const request = {
|
|
1362
|
-
type: "validatorL1Votes",
|
|
1363
|
-
};
|
|
1238
|
+
const request = { type: "validatorL1Votes" };
|
|
1364
1239
|
return this.transport.request("info", request, signal);
|
|
1365
1240
|
}
|
|
1366
1241
|
/**
|
|
1367
1242
|
* Request validator summaries.
|
|
1368
|
-
* @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}.
|
|
1369
1244
|
* @returns Array of validator summaries.
|
|
1370
1245
|
*
|
|
1371
1246
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1382,15 +1257,13 @@ export class InfoClient {
|
|
|
1382
1257
|
* ```
|
|
1383
1258
|
*/
|
|
1384
1259
|
validatorSummaries(signal) {
|
|
1385
|
-
const request = {
|
|
1386
|
-
type: "validatorSummaries",
|
|
1387
|
-
};
|
|
1260
|
+
const request = { type: "validatorSummaries" };
|
|
1388
1261
|
return this.transport.request("info", request, signal);
|
|
1389
1262
|
}
|
|
1390
1263
|
/**
|
|
1391
1264
|
* Request details of a vault.
|
|
1392
|
-
* @param
|
|
1393
|
-
* @param signal - An
|
|
1265
|
+
* @param params - Request-specific parameters.
|
|
1266
|
+
* @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
1267
|
* @returns Details of a vault or null if the vault does not exist.
|
|
1395
1268
|
*
|
|
1396
1269
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1406,16 +1279,13 @@ export class InfoClient {
|
|
|
1406
1279
|
* const data = await infoClient.vaultDetails({ vaultAddress: "0x..." });
|
|
1407
1280
|
* ```
|
|
1408
1281
|
*/
|
|
1409
|
-
vaultDetails(
|
|
1410
|
-
const request = {
|
|
1411
|
-
type: "vaultDetails",
|
|
1412
|
-
...args,
|
|
1413
|
-
};
|
|
1282
|
+
vaultDetails(params, signal) {
|
|
1283
|
+
const request = { type: "vaultDetails", ...params };
|
|
1414
1284
|
return this.transport.request("info", request, signal);
|
|
1415
1285
|
}
|
|
1416
1286
|
/**
|
|
1417
1287
|
* Request a list of vaults less than 2 hours old.
|
|
1418
|
-
* @param signal - An
|
|
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}.
|
|
1419
1289
|
* @returns Array of vault summaries.
|
|
1420
1290
|
*
|
|
1421
1291
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1432,9 +1302,7 @@ export class InfoClient {
|
|
|
1432
1302
|
* ```
|
|
1433
1303
|
*/
|
|
1434
1304
|
vaultSummaries(signal) {
|
|
1435
|
-
const request = {
|
|
1436
|
-
type: "vaultSummaries",
|
|
1437
|
-
};
|
|
1305
|
+
const request = { type: "vaultSummaries" };
|
|
1438
1306
|
return this.transport.request("info", request, signal);
|
|
1439
1307
|
}
|
|
1440
1308
|
async [Symbol.asyncDispose]() {
|