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