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