@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
|
@@ -22,19 +22,39 @@ class InfoClient {
|
|
|
22
22
|
constructor(args) {
|
|
23
23
|
this.transport = args.transport;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Request user active asset data.
|
|
27
|
+
* @param params - An optional request-specific parameters.
|
|
28
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
29
|
+
* @returns User active asset data.
|
|
30
|
+
*
|
|
31
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
32
|
+
*
|
|
33
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-active-asset-data
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
37
|
+
*
|
|
38
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
39
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
40
|
+
*
|
|
41
|
+
* const data = await infoClient.activeAssetData({ user: "0x...", coin: "BTC" });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
activeAssetData(params, signal) {
|
|
45
|
+
const request = { type: "activeAssetData", ...params };
|
|
46
|
+
return this.transport.request("info", request, signal);
|
|
47
|
+
}
|
|
48
|
+
allMids(params_or_signal, maybeSignal) {
|
|
49
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
50
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
51
|
+
const request = { type: "allMids", ...params };
|
|
32
52
|
return this.transport.request("info", request, signal);
|
|
33
53
|
}
|
|
34
54
|
/**
|
|
35
55
|
* Block details by block height.
|
|
36
|
-
* @param
|
|
37
|
-
* @param signal - An
|
|
56
|
+
* @param params - Request-specific parameters.
|
|
57
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
38
58
|
* @returns Block details.
|
|
39
59
|
*
|
|
40
60
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -44,24 +64,21 @@ class InfoClient {
|
|
|
44
64
|
* ```ts
|
|
45
65
|
* import * as hl from "@nktkas/hyperliquid";
|
|
46
66
|
*
|
|
47
|
-
* const transport = new hl.HttpTransport(); //
|
|
67
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
48
68
|
* const infoClient = new hl.InfoClient({ transport });
|
|
49
69
|
*
|
|
50
70
|
* const data = await infoClient.blockDetails({ height: 123 });
|
|
51
71
|
* ```
|
|
52
72
|
*/
|
|
53
|
-
|
|
54
|
-
const request = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
const { blockDetails } = await this.transport.request("explorer", request, signal);
|
|
59
|
-
return blockDetails;
|
|
73
|
+
blockDetails(params, signal) {
|
|
74
|
+
const request = { type: "blockDetails", ...params };
|
|
75
|
+
return this.transport.request("explorer", request, signal)
|
|
76
|
+
.then(({ blockDetails }) => blockDetails);
|
|
60
77
|
}
|
|
61
78
|
/**
|
|
62
79
|
* Request candlestick snapshots.
|
|
63
|
-
* @param
|
|
64
|
-
* @param signal - An
|
|
80
|
+
* @param params - Request-specific parameters.
|
|
81
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
65
82
|
* @returns Array of candlestick data points.
|
|
66
83
|
*
|
|
67
84
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -81,17 +98,14 @@ class InfoClient {
|
|
|
81
98
|
* });
|
|
82
99
|
* ```
|
|
83
100
|
*/
|
|
84
|
-
candleSnapshot(
|
|
85
|
-
const request = {
|
|
86
|
-
type: "candleSnapshot",
|
|
87
|
-
req: args,
|
|
88
|
-
};
|
|
101
|
+
candleSnapshot(params, signal) {
|
|
102
|
+
const request = { type: "candleSnapshot", req: params };
|
|
89
103
|
return this.transport.request("info", request, signal);
|
|
90
104
|
}
|
|
91
105
|
/**
|
|
92
106
|
* Request clearinghouse state.
|
|
93
|
-
* @param
|
|
94
|
-
* @param signal - An
|
|
107
|
+
* @param params - Request-specific parameters.
|
|
108
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
95
109
|
* @returns Account summary for perpetual trading.
|
|
96
110
|
*
|
|
97
111
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -107,17 +121,14 @@ class InfoClient {
|
|
|
107
121
|
* const data = await infoClient.clearinghouseState({ user: "0x..." });
|
|
108
122
|
* ```
|
|
109
123
|
*/
|
|
110
|
-
clearinghouseState(
|
|
111
|
-
const request = {
|
|
112
|
-
type: "clearinghouseState",
|
|
113
|
-
...args,
|
|
114
|
-
};
|
|
124
|
+
clearinghouseState(params, signal) {
|
|
125
|
+
const request = { type: "clearinghouseState", ...params };
|
|
115
126
|
return this.transport.request("info", request, signal);
|
|
116
127
|
}
|
|
117
128
|
/**
|
|
118
129
|
* Request user staking delegations.
|
|
119
|
-
* @param
|
|
120
|
-
* @param signal - An
|
|
130
|
+
* @param params - Request-specific parameters.
|
|
131
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
121
132
|
* @returns Array of user's delegations to validators.
|
|
122
133
|
*
|
|
123
134
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -133,17 +144,14 @@ class InfoClient {
|
|
|
133
144
|
* const data = await infoClient.delegations({ user: "0x..." });
|
|
134
145
|
* ```
|
|
135
146
|
*/
|
|
136
|
-
delegations(
|
|
137
|
-
const request = {
|
|
138
|
-
type: "delegations",
|
|
139
|
-
...args,
|
|
140
|
-
};
|
|
147
|
+
delegations(params, signal) {
|
|
148
|
+
const request = { type: "delegations", ...params };
|
|
141
149
|
return this.transport.request("info", request, signal);
|
|
142
150
|
}
|
|
143
151
|
/**
|
|
144
152
|
* Request user staking history.
|
|
145
|
-
* @param
|
|
146
|
-
* @param signal - An
|
|
153
|
+
* @param params - Request-specific parameters.
|
|
154
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
147
155
|
* @returns Array of user's staking updates.
|
|
148
156
|
*
|
|
149
157
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -159,17 +167,14 @@ class InfoClient {
|
|
|
159
167
|
* const data = await infoClient.delegatorHistory({ user: "0x..." });
|
|
160
168
|
* ```
|
|
161
169
|
*/
|
|
162
|
-
delegatorHistory(
|
|
163
|
-
const request = {
|
|
164
|
-
type: "delegatorHistory",
|
|
165
|
-
...args,
|
|
166
|
-
};
|
|
170
|
+
delegatorHistory(params, signal) {
|
|
171
|
+
const request = { type: "delegatorHistory", ...params };
|
|
167
172
|
return this.transport.request("info", request, signal);
|
|
168
173
|
}
|
|
169
174
|
/**
|
|
170
175
|
* Request user staking rewards.
|
|
171
|
-
* @param
|
|
172
|
-
* @param signal - An
|
|
176
|
+
* @param params - Request-specific parameters.
|
|
177
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
173
178
|
* @returns Array of user's staking rewards.
|
|
174
179
|
*
|
|
175
180
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -185,17 +190,14 @@ class InfoClient {
|
|
|
185
190
|
* const data = await infoClient.delegatorRewards({ user: "0x..." });
|
|
186
191
|
* ```
|
|
187
192
|
*/
|
|
188
|
-
delegatorRewards(
|
|
189
|
-
const request = {
|
|
190
|
-
type: "delegatorRewards",
|
|
191
|
-
...args,
|
|
192
|
-
};
|
|
193
|
+
delegatorRewards(params, signal) {
|
|
194
|
+
const request = { type: "delegatorRewards", ...params };
|
|
193
195
|
return this.transport.request("info", request, signal);
|
|
194
196
|
}
|
|
195
197
|
/**
|
|
196
198
|
* Request user staking summary.
|
|
197
|
-
* @param
|
|
198
|
-
* @param signal - An
|
|
199
|
+
* @param params - Request-specific parameters.
|
|
200
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
199
201
|
* @returns Summary of a user's staking delegations.
|
|
200
202
|
*
|
|
201
203
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -211,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,13 @@ class InfoClient {
|
|
|
857
789
|
* const data = await infoClient.spotDeployState({ user: "0x..." });
|
|
858
790
|
* ```
|
|
859
791
|
*/
|
|
860
|
-
spotDeployState(
|
|
861
|
-
const request = {
|
|
862
|
-
type: "spotDeployState",
|
|
863
|
-
...args,
|
|
864
|
-
};
|
|
792
|
+
spotDeployState(params, signal) {
|
|
793
|
+
const request = { type: "spotDeployState", ...params };
|
|
865
794
|
return this.transport.request("info", request, signal);
|
|
866
795
|
}
|
|
867
796
|
/**
|
|
868
797
|
* Request spot trading metadata.
|
|
869
|
-
* @param signal - An
|
|
798
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
870
799
|
* @returns Metadata for spot assets.
|
|
871
800
|
*
|
|
872
801
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -883,14 +812,12 @@ class InfoClient {
|
|
|
883
812
|
* ```
|
|
884
813
|
*/
|
|
885
814
|
spotMeta(signal) {
|
|
886
|
-
const request = {
|
|
887
|
-
type: "spotMeta",
|
|
888
|
-
};
|
|
815
|
+
const request = { type: "spotMeta" };
|
|
889
816
|
return this.transport.request("info", request, signal);
|
|
890
817
|
}
|
|
891
818
|
/**
|
|
892
819
|
* Request spot metadata and asset contexts.
|
|
893
|
-
* @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}.
|
|
894
821
|
* @returns Metadata and context for spot assets.
|
|
895
822
|
*
|
|
896
823
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -907,15 +834,13 @@ class InfoClient {
|
|
|
907
834
|
* ```
|
|
908
835
|
*/
|
|
909
836
|
spotMetaAndAssetCtxs(signal) {
|
|
910
|
-
const request = {
|
|
911
|
-
type: "spotMetaAndAssetCtxs",
|
|
912
|
-
};
|
|
837
|
+
const request = { type: "spotMetaAndAssetCtxs" };
|
|
913
838
|
return this.transport.request("info", request, signal);
|
|
914
839
|
}
|
|
915
840
|
/**
|
|
916
841
|
* Request user sub-accounts.
|
|
917
|
-
* @param
|
|
918
|
-
* @param signal - An
|
|
842
|
+
* @param params - Request-specific parameters.
|
|
843
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
919
844
|
* @returns Array of user sub-account or null if the user does not have any sub-accounts.
|
|
920
845
|
*
|
|
921
846
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -931,17 +856,14 @@ class InfoClient {
|
|
|
931
856
|
* const data = await infoClient.subAccounts({ user: "0x..." });
|
|
932
857
|
* ```
|
|
933
858
|
*/
|
|
934
|
-
subAccounts(
|
|
935
|
-
const request = {
|
|
936
|
-
type: "subAccounts",
|
|
937
|
-
...args,
|
|
938
|
-
};
|
|
859
|
+
subAccounts(params, signal) {
|
|
860
|
+
const request = { type: "subAccounts", ...params };
|
|
939
861
|
return this.transport.request("info", request, signal);
|
|
940
862
|
}
|
|
941
863
|
/**
|
|
942
864
|
* Request token details.
|
|
943
|
-
* @param
|
|
944
|
-
* @param signal - An
|
|
865
|
+
* @param params - Request-specific parameters.
|
|
866
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
945
867
|
* @returns Details of a token.
|
|
946
868
|
*
|
|
947
869
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -957,17 +879,14 @@ class InfoClient {
|
|
|
957
879
|
* const data = await infoClient.tokenDetails({ tokenId: "0x..." });
|
|
958
880
|
* ```
|
|
959
881
|
*/
|
|
960
|
-
tokenDetails(
|
|
961
|
-
const request = {
|
|
962
|
-
type: "tokenDetails",
|
|
963
|
-
...args,
|
|
964
|
-
};
|
|
882
|
+
tokenDetails(params, signal) {
|
|
883
|
+
const request = { type: "tokenDetails", ...params };
|
|
965
884
|
return this.transport.request("info", request, signal);
|
|
966
885
|
}
|
|
967
886
|
/**
|
|
968
887
|
* Request twap history of a user.
|
|
969
|
-
* @param
|
|
970
|
-
* @param signal - An
|
|
888
|
+
* @param params - Request-specific parameters.
|
|
889
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
971
890
|
* @returns Array of user's TWAP history.
|
|
972
891
|
*
|
|
973
892
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -983,17 +902,14 @@ class InfoClient {
|
|
|
983
902
|
* const data = await infoClient.twapHistory({ user: "0x..." });
|
|
984
903
|
* ```
|
|
985
904
|
*/
|
|
986
|
-
twapHistory(
|
|
987
|
-
const request = {
|
|
988
|
-
type: "twapHistory",
|
|
989
|
-
...args,
|
|
990
|
-
};
|
|
905
|
+
twapHistory(params, signal) {
|
|
906
|
+
const request = { type: "twapHistory", ...params };
|
|
991
907
|
return this.transport.request("info", request, signal);
|
|
992
908
|
}
|
|
993
909
|
/**
|
|
994
910
|
* Request transaction details by transaction hash.
|
|
995
|
-
* @param
|
|
996
|
-
* @param signal - An
|
|
911
|
+
* @param params - Request-specific parameters.
|
|
912
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
997
913
|
* @returns Transaction details.
|
|
998
914
|
*
|
|
999
915
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1003,24 +919,21 @@ class InfoClient {
|
|
|
1003
919
|
* ```ts
|
|
1004
920
|
* import * as hl from "@nktkas/hyperliquid";
|
|
1005
921
|
*
|
|
1006
|
-
* const transport = new hl.HttpTransport(); //
|
|
922
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1007
923
|
* const infoClient = new hl.InfoClient({ transport });
|
|
1008
924
|
*
|
|
1009
925
|
* const data = await infoClient.txDetails({ hash: "0x..." });
|
|
1010
926
|
* ```
|
|
1011
927
|
*/
|
|
1012
|
-
|
|
1013
|
-
const request = {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
};
|
|
1017
|
-
const { tx } = await this.transport.request("explorer", request, signal);
|
|
1018
|
-
return tx;
|
|
928
|
+
txDetails(params, signal) {
|
|
929
|
+
const request = { type: "txDetails", ...params };
|
|
930
|
+
return this.transport.request("explorer", request, signal)
|
|
931
|
+
.then(({ tx }) => tx);
|
|
1019
932
|
}
|
|
1020
933
|
/**
|
|
1021
934
|
* Request user details by user's address.
|
|
1022
|
-
* @param
|
|
1023
|
-
* @param signal - An
|
|
935
|
+
* @param params - Request-specific parameters.
|
|
936
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1024
937
|
* @returns User details.
|
|
1025
938
|
*
|
|
1026
939
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1030,24 +943,21 @@ class InfoClient {
|
|
|
1030
943
|
* ```ts
|
|
1031
944
|
* import * as hl from "@nktkas/hyperliquid";
|
|
1032
945
|
*
|
|
1033
|
-
* const transport = new hl.HttpTransport(); //
|
|
946
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1034
947
|
* const infoClient = new hl.InfoClient({ transport });
|
|
1035
948
|
*
|
|
1036
949
|
* const data = await infoClient.userDetails({ user: "0x..." });
|
|
1037
950
|
* ```
|
|
1038
951
|
*/
|
|
1039
|
-
|
|
1040
|
-
const request = {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
};
|
|
1044
|
-
const { txs } = await this.transport.request("explorer", request, signal);
|
|
1045
|
-
return txs;
|
|
952
|
+
userDetails(params, signal) {
|
|
953
|
+
const request = { type: "userDetails", ...params };
|
|
954
|
+
return this.transport.request("explorer", request, signal)
|
|
955
|
+
.then(({ txs }) => txs);
|
|
1046
956
|
}
|
|
1047
957
|
/**
|
|
1048
958
|
* Request user fees.
|
|
1049
|
-
* @param
|
|
1050
|
-
* @param signal - An
|
|
959
|
+
* @param params - Request-specific parameters.
|
|
960
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1051
961
|
* @returns User fees.
|
|
1052
962
|
*
|
|
1053
963
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1063,17 +973,14 @@ class InfoClient {
|
|
|
1063
973
|
* const data = await infoClient.userFees({ user: "0x..." });
|
|
1064
974
|
* ```
|
|
1065
975
|
*/
|
|
1066
|
-
userFees(
|
|
1067
|
-
const request = {
|
|
1068
|
-
type: "userFees",
|
|
1069
|
-
...args,
|
|
1070
|
-
};
|
|
976
|
+
userFees(params, signal) {
|
|
977
|
+
const request = { type: "userFees", ...params };
|
|
1071
978
|
return this.transport.request("info", request, signal);
|
|
1072
979
|
}
|
|
1073
980
|
/**
|
|
1074
981
|
* Request user fills.
|
|
1075
|
-
* @param
|
|
1076
|
-
* @param signal - An
|
|
982
|
+
* @param params - Request-specific parameters.
|
|
983
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1077
984
|
* @returns Array of user's trade fill.
|
|
1078
985
|
*
|
|
1079
986
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1089,17 +996,14 @@ class InfoClient {
|
|
|
1089
996
|
* const data = await infoClient.userFills({ user: "0x..." });
|
|
1090
997
|
* ```
|
|
1091
998
|
*/
|
|
1092
|
-
userFills(
|
|
1093
|
-
const request = {
|
|
1094
|
-
type: "userFills",
|
|
1095
|
-
...args,
|
|
1096
|
-
};
|
|
999
|
+
userFills(params, signal) {
|
|
1000
|
+
const request = { type: "userFills", ...params };
|
|
1097
1001
|
return this.transport.request("info", request, signal);
|
|
1098
1002
|
}
|
|
1099
1003
|
/**
|
|
1100
1004
|
* Request user fills by time.
|
|
1101
|
-
* @param
|
|
1102
|
-
* @param signal - An
|
|
1005
|
+
* @param params - Request-specific parameters.
|
|
1006
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1103
1007
|
* @returns Array of user's trade fill.
|
|
1104
1008
|
*
|
|
1105
1009
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1118,17 +1022,14 @@ class InfoClient {
|
|
|
1118
1022
|
* });
|
|
1119
1023
|
* ```
|
|
1120
1024
|
*/
|
|
1121
|
-
userFillsByTime(
|
|
1122
|
-
const request = {
|
|
1123
|
-
type: "userFillsByTime",
|
|
1124
|
-
...args,
|
|
1125
|
-
};
|
|
1025
|
+
userFillsByTime(params, signal) {
|
|
1026
|
+
const request = { type: "userFillsByTime", ...params };
|
|
1126
1027
|
return this.transport.request("info", request, signal);
|
|
1127
1028
|
}
|
|
1128
1029
|
/**
|
|
1129
1030
|
* Request user funding.
|
|
1130
|
-
* @param
|
|
1131
|
-
* @param signal - An
|
|
1031
|
+
* @param params - Request-specific parameters.
|
|
1032
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1132
1033
|
* @returns Array of user's funding ledger update.
|
|
1133
1034
|
*
|
|
1134
1035
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1147,17 +1048,14 @@ class InfoClient {
|
|
|
1147
1048
|
* });
|
|
1148
1049
|
* ```
|
|
1149
1050
|
*/
|
|
1150
|
-
userFunding(
|
|
1151
|
-
const request = {
|
|
1152
|
-
type: "userFunding",
|
|
1153
|
-
...args,
|
|
1154
|
-
};
|
|
1051
|
+
userFunding(params, signal) {
|
|
1052
|
+
const request = { type: "userFunding", ...params };
|
|
1155
1053
|
return this.transport.request("info", request, signal);
|
|
1156
1054
|
}
|
|
1157
1055
|
/**
|
|
1158
1056
|
* Request user non-funding ledger updates.
|
|
1159
|
-
* @param
|
|
1160
|
-
* @param signal - An
|
|
1057
|
+
* @param params - Request-specific parameters.
|
|
1058
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1161
1059
|
* @returns Array of user's non-funding ledger update.
|
|
1162
1060
|
*
|
|
1163
1061
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1176,17 +1074,14 @@ class InfoClient {
|
|
|
1176
1074
|
* });
|
|
1177
1075
|
* ```
|
|
1178
1076
|
*/
|
|
1179
|
-
userNonFundingLedgerUpdates(
|
|
1180
|
-
const request = {
|
|
1181
|
-
type: "userNonFundingLedgerUpdates",
|
|
1182
|
-
...args,
|
|
1183
|
-
};
|
|
1077
|
+
userNonFundingLedgerUpdates(params, signal) {
|
|
1078
|
+
const request = { type: "userNonFundingLedgerUpdates", ...params };
|
|
1184
1079
|
return this.transport.request("info", request, signal);
|
|
1185
1080
|
}
|
|
1186
1081
|
/**
|
|
1187
1082
|
* Request user rate limits.
|
|
1188
|
-
* @param
|
|
1189
|
-
* @param signal - An
|
|
1083
|
+
* @param params - Request-specific parameters.
|
|
1084
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1190
1085
|
* @returns User's rate limits.
|
|
1191
1086
|
*
|
|
1192
1087
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1202,17 +1097,14 @@ class InfoClient {
|
|
|
1202
1097
|
* const data = await infoClient.userRateLimit({ user: "0x..." });
|
|
1203
1098
|
* ```
|
|
1204
1099
|
*/
|
|
1205
|
-
userRateLimit(
|
|
1206
|
-
const request = {
|
|
1207
|
-
type: "userRateLimit",
|
|
1208
|
-
...args,
|
|
1209
|
-
};
|
|
1100
|
+
userRateLimit(params, signal) {
|
|
1101
|
+
const request = { type: "userRateLimit", ...params };
|
|
1210
1102
|
return this.transport.request("info", request, signal);
|
|
1211
1103
|
}
|
|
1212
1104
|
/**
|
|
1213
1105
|
* Request user role.
|
|
1214
|
-
* @param
|
|
1215
|
-
* @param signal - An
|
|
1106
|
+
* @param params - Request-specific parameters.
|
|
1107
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1216
1108
|
* @returns User's role.
|
|
1217
1109
|
*
|
|
1218
1110
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1228,17 +1120,14 @@ class InfoClient {
|
|
|
1228
1120
|
* const data = await infoClient.userRole({ user: "0x..." });
|
|
1229
1121
|
* ```
|
|
1230
1122
|
*/
|
|
1231
|
-
userRole(
|
|
1232
|
-
const request = {
|
|
1233
|
-
type: "userRole",
|
|
1234
|
-
...args,
|
|
1235
|
-
};
|
|
1123
|
+
userRole(params, signal) {
|
|
1124
|
+
const request = { type: "userRole", ...params };
|
|
1236
1125
|
return this.transport.request("info", request, signal);
|
|
1237
1126
|
}
|
|
1238
1127
|
/**
|
|
1239
1128
|
* Request multi-sig signers for a user.
|
|
1240
|
-
* @param
|
|
1241
|
-
* @param signal - An
|
|
1129
|
+
* @param params - Request-specific parameters.
|
|
1130
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1242
1131
|
* @returns Multi-sig signers for a user or null if the user does not have any multi-sig signers.
|
|
1243
1132
|
*
|
|
1244
1133
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1254,17 +1143,14 @@ class InfoClient {
|
|
|
1254
1143
|
* const data = await infoClient.userToMultiSigSigners({ user: "0x..." });
|
|
1255
1144
|
* ```
|
|
1256
1145
|
*/
|
|
1257
|
-
userToMultiSigSigners(
|
|
1258
|
-
const request = {
|
|
1259
|
-
type: "userToMultiSigSigners",
|
|
1260
|
-
...args,
|
|
1261
|
-
};
|
|
1146
|
+
userToMultiSigSigners(params, signal) {
|
|
1147
|
+
const request = { type: "userToMultiSigSigners", ...params };
|
|
1262
1148
|
return this.transport.request("info", request, signal);
|
|
1263
1149
|
}
|
|
1264
1150
|
/**
|
|
1265
1151
|
* Request user twap slice fills.
|
|
1266
|
-
* @param
|
|
1267
|
-
* @param signal - An
|
|
1152
|
+
* @param params - Request-specific parameters.
|
|
1153
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1268
1154
|
* @returns Array of user's twap slice fill.
|
|
1269
1155
|
*
|
|
1270
1156
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1280,17 +1166,14 @@ class InfoClient {
|
|
|
1280
1166
|
* const data = await infoClient.userTwapSliceFills({ user: "0x..." });
|
|
1281
1167
|
* ```
|
|
1282
1168
|
*/
|
|
1283
|
-
userTwapSliceFills(
|
|
1284
|
-
const request = {
|
|
1285
|
-
type: "userTwapSliceFills",
|
|
1286
|
-
...args,
|
|
1287
|
-
};
|
|
1169
|
+
userTwapSliceFills(params, signal) {
|
|
1170
|
+
const request = { type: "userTwapSliceFills", ...params };
|
|
1288
1171
|
return this.transport.request("info", request, signal);
|
|
1289
1172
|
}
|
|
1290
1173
|
/**
|
|
1291
1174
|
* Request user twap slice fills by time.
|
|
1292
|
-
* @param
|
|
1293
|
-
* @param signal - An
|
|
1175
|
+
* @param params - Request-specific parameters.
|
|
1176
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1294
1177
|
* @returns Array of user's twap slice fill.
|
|
1295
1178
|
*
|
|
1296
1179
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1309,17 +1192,14 @@ class InfoClient {
|
|
|
1309
1192
|
* });
|
|
1310
1193
|
* ```
|
|
1311
1194
|
*/
|
|
1312
|
-
userTwapSliceFillsByTime(
|
|
1313
|
-
const request = {
|
|
1314
|
-
type: "userTwapSliceFillsByTime",
|
|
1315
|
-
...args,
|
|
1316
|
-
};
|
|
1195
|
+
userTwapSliceFillsByTime(params, signal) {
|
|
1196
|
+
const request = { type: "userTwapSliceFillsByTime", ...params };
|
|
1317
1197
|
return this.transport.request("info", request, signal);
|
|
1318
1198
|
}
|
|
1319
1199
|
/**
|
|
1320
1200
|
* Request user vault deposits.
|
|
1321
|
-
* @param
|
|
1322
|
-
* @param signal - An
|
|
1201
|
+
* @param params - Request-specific parameters.
|
|
1202
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1323
1203
|
* @returns Array of user's vault deposits.
|
|
1324
1204
|
*
|
|
1325
1205
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1335,21 +1215,18 @@ class InfoClient {
|
|
|
1335
1215
|
* const data = await infoClient.userVaultEquities({ user: "0x..." });
|
|
1336
1216
|
* ```
|
|
1337
1217
|
*/
|
|
1338
|
-
userVaultEquities(
|
|
1339
|
-
const request = {
|
|
1340
|
-
type: "userVaultEquities",
|
|
1341
|
-
...args,
|
|
1342
|
-
};
|
|
1218
|
+
userVaultEquities(params, signal) {
|
|
1219
|
+
const request = { type: "userVaultEquities", ...params };
|
|
1343
1220
|
return this.transport.request("info", request, signal);
|
|
1344
1221
|
}
|
|
1345
1222
|
/**
|
|
1346
1223
|
* Request validator L1 votes.
|
|
1347
|
-
* @param signal - An
|
|
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}.
|
|
1348
1225
|
* @returns
|
|
1349
1226
|
*
|
|
1350
1227
|
* @throws {TransportError} When the transport layer throws an error.
|
|
1351
1228
|
*
|
|
1352
|
-
* @see
|
|
1229
|
+
* @see null
|
|
1353
1230
|
* @example
|
|
1354
1231
|
* ```ts
|
|
1355
1232
|
* import * as hl from "@nktkas/hyperliquid";
|
|
@@ -1361,14 +1238,12 @@ class InfoClient {
|
|
|
1361
1238
|
* ```
|
|
1362
1239
|
*/
|
|
1363
1240
|
validatorL1Votes(signal) {
|
|
1364
|
-
const request = {
|
|
1365
|
-
type: "validatorL1Votes",
|
|
1366
|
-
};
|
|
1241
|
+
const request = { type: "validatorL1Votes" };
|
|
1367
1242
|
return this.transport.request("info", request, signal);
|
|
1368
1243
|
}
|
|
1369
1244
|
/**
|
|
1370
1245
|
* Request validator summaries.
|
|
1371
|
-
* @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}.
|
|
1372
1247
|
* @returns Array of validator summaries.
|
|
1373
1248
|
*
|
|
1374
1249
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1385,15 +1260,13 @@ class InfoClient {
|
|
|
1385
1260
|
* ```
|
|
1386
1261
|
*/
|
|
1387
1262
|
validatorSummaries(signal) {
|
|
1388
|
-
const request = {
|
|
1389
|
-
type: "validatorSummaries",
|
|
1390
|
-
};
|
|
1263
|
+
const request = { type: "validatorSummaries" };
|
|
1391
1264
|
return this.transport.request("info", request, signal);
|
|
1392
1265
|
}
|
|
1393
1266
|
/**
|
|
1394
1267
|
* Request details of a vault.
|
|
1395
|
-
* @param
|
|
1396
|
-
* @param signal - An
|
|
1268
|
+
* @param params - Request-specific parameters.
|
|
1269
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1397
1270
|
* @returns Details of a vault or null if the vault does not exist.
|
|
1398
1271
|
*
|
|
1399
1272
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1409,16 +1282,13 @@ class InfoClient {
|
|
|
1409
1282
|
* const data = await infoClient.vaultDetails({ vaultAddress: "0x..." });
|
|
1410
1283
|
* ```
|
|
1411
1284
|
*/
|
|
1412
|
-
vaultDetails(
|
|
1413
|
-
const request = {
|
|
1414
|
-
type: "vaultDetails",
|
|
1415
|
-
...args,
|
|
1416
|
-
};
|
|
1285
|
+
vaultDetails(params, signal) {
|
|
1286
|
+
const request = { type: "vaultDetails", ...params };
|
|
1417
1287
|
return this.transport.request("info", request, signal);
|
|
1418
1288
|
}
|
|
1419
1289
|
/**
|
|
1420
1290
|
* Request a list of vaults less than 2 hours old.
|
|
1421
|
-
* @param signal - An
|
|
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}.
|
|
1422
1292
|
* @returns Array of vault summaries.
|
|
1423
1293
|
*
|
|
1424
1294
|
* @throws {TransportError} When the transport layer throws an error.
|
|
@@ -1435,9 +1305,7 @@ class InfoClient {
|
|
|
1435
1305
|
* ```
|
|
1436
1306
|
*/
|
|
1437
1307
|
vaultSummaries(signal) {
|
|
1438
|
-
const request = {
|
|
1439
|
-
type: "vaultSummaries",
|
|
1440
|
-
};
|
|
1308
|
+
const request = { type: "vaultSummaries" };
|
|
1441
1309
|
return this.transport.request("info", request, signal);
|
|
1442
1310
|
}
|
|
1443
1311
|
async [Symbol.asyncDispose]() {
|