@nktkas/hyperliquid 0.13.2 → 0.15.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 +4 -7
- package/README.md +297 -103
- package/esm/mod.d.ts +3 -12
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -2
- package/esm/src/{transports/base.d.ts → base.d.ts} +11 -14
- package/esm/src/base.d.ts.map +1 -0
- package/esm/src/base.js +14 -0
- package/esm/src/clients/event.d.ts +4 -4
- package/esm/src/clients/event.d.ts.map +1 -1
- package/esm/src/clients/event.js +2 -2
- package/esm/src/clients/public.d.ts +109 -6
- package/esm/src/clients/public.d.ts.map +1 -1
- package/esm/src/clients/public.js +106 -3
- package/esm/src/clients/wallet.d.ts +232 -29
- package/esm/src/clients/wallet.d.ts.map +1 -1
- package/esm/src/clients/wallet.js +859 -243
- package/esm/src/signing.d.ts +135 -0
- package/esm/src/signing.d.ts.map +1 -0
- package/esm/src/signing.js +188 -0
- package/esm/src/transports/http/http_transport.d.ts +2 -4
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +8 -13
- package/{script/src/transports/websocket/hyperliquid_event_target.d.ts → esm/src/transports/websocket/_hyperliquid_event_target.d.ts} +7 -15
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -0
- package/esm/src/transports/websocket/{hyperliquid_event_target.js → _hyperliquid_event_target.js} +4 -22
- package/esm/src/transports/websocket/{reconnecting_websocket.d.ts → _reconnecting_websocket.d.ts} +26 -26
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -0
- package/esm/src/transports/websocket/{reconnecting_websocket.js → _reconnecting_websocket.js} +91 -76
- package/esm/src/transports/websocket/{websocket_request_dispatcher.d.ts → _websocket_request_dispatcher.d.ts} +3 -7
- package/esm/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +1 -0
- package/esm/src/transports/websocket/{websocket_request_dispatcher.js → _websocket_request_dispatcher.js} +3 -7
- package/esm/src/transports/websocket/websocket_transport.d.ts +13 -16
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +49 -49
- package/esm/src/types/exchange/requests.d.ts +172 -20
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/exchange/responses.d.ts +32 -32
- package/esm/src/types/exchange/responses.d.ts.map +1 -1
- package/esm/src/types/explorer/requests.d.ts +12 -12
- package/esm/src/types/explorer/requests.d.ts.map +1 -1
- package/esm/src/types/explorer/responses.d.ts +36 -1
- package/esm/src/types/explorer/responses.d.ts.map +1 -1
- package/esm/src/types/info/accounts.d.ts +130 -105
- package/esm/src/types/info/accounts.d.ts.map +1 -1
- package/esm/src/types/info/assets.d.ts +154 -152
- package/esm/src/types/info/assets.d.ts.map +1 -1
- package/esm/src/types/info/delegations.d.ts +20 -20
- package/esm/src/types/info/delegations.d.ts.map +1 -1
- package/esm/src/types/info/orders.d.ts +55 -55
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +73 -10
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/esm/src/types/info/vaults.d.ts +1 -1
- package/esm/src/types/info/vaults.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +14 -0
- package/esm/src/types/mod.d.ts.map +1 -0
- package/esm/src/types/subscriptions/requests.d.ts +1 -1
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
- package/{script/src/types/subscriptions/common.d.ts → esm/src/types/subscriptions/responses.d.ts} +16 -4
- package/esm/src/types/subscriptions/responses.d.ts.map +1 -0
- package/package.json +20 -4
- package/script/mod.d.ts +3 -12
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +3 -5
- package/script/src/{transports/base.d.ts → base.d.ts} +11 -14
- package/script/src/base.d.ts.map +1 -0
- package/script/src/{transports/base.js → base.js} +13 -12
- package/script/src/clients/event.d.ts +4 -4
- package/script/src/clients/event.d.ts.map +1 -1
- package/script/src/clients/event.js +2 -2
- package/script/src/clients/public.d.ts +109 -6
- package/script/src/clients/public.d.ts.map +1 -1
- package/script/src/clients/public.js +106 -3
- package/script/src/clients/wallet.d.ts +232 -29
- package/script/src/clients/wallet.d.ts.map +1 -1
- package/script/src/clients/wallet.js +860 -244
- package/script/src/signing.d.ts +135 -0
- package/script/src/signing.d.ts.map +1 -0
- package/script/src/signing.js +203 -0
- package/script/src/transports/http/http_transport.d.ts +2 -4
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +9 -14
- package/{esm/src/transports/websocket/hyperliquid_event_target.d.ts → script/src/transports/websocket/_hyperliquid_event_target.d.ts} +7 -15
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -0
- package/script/src/transports/websocket/{hyperliquid_event_target.js → _hyperliquid_event_target.js} +4 -22
- package/script/src/transports/websocket/{reconnecting_websocket.d.ts → _reconnecting_websocket.d.ts} +26 -26
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -0
- package/script/src/transports/websocket/{reconnecting_websocket.js → _reconnecting_websocket.js} +94 -78
- package/script/src/transports/websocket/{websocket_request_dispatcher.d.ts → _websocket_request_dispatcher.d.ts} +3 -7
- package/script/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +1 -0
- package/script/src/transports/websocket/{websocket_request_dispatcher.js → _websocket_request_dispatcher.js} +4 -8
- package/script/src/transports/websocket/websocket_transport.d.ts +13 -16
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +55 -55
- package/script/src/types/exchange/requests.d.ts +172 -20
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/exchange/responses.d.ts +32 -32
- package/script/src/types/exchange/responses.d.ts.map +1 -1
- package/script/src/types/explorer/requests.d.ts +12 -12
- package/script/src/types/explorer/requests.d.ts.map +1 -1
- package/script/src/types/explorer/responses.d.ts +36 -1
- package/script/src/types/explorer/responses.d.ts.map +1 -1
- package/script/src/types/info/accounts.d.ts +130 -105
- package/script/src/types/info/accounts.d.ts.map +1 -1
- package/script/src/types/info/assets.d.ts +154 -152
- package/script/src/types/info/assets.d.ts.map +1 -1
- package/script/src/types/info/delegations.d.ts +20 -20
- package/script/src/types/info/delegations.d.ts.map +1 -1
- package/script/src/types/info/orders.d.ts +55 -55
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +73 -10
- package/script/src/types/info/requests.d.ts.map +1 -1
- package/script/src/types/info/vaults.d.ts +1 -1
- package/script/src/types/info/vaults.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +14 -0
- package/script/src/types/mod.d.ts.map +1 -0
- package/script/src/types/subscriptions/requests.d.ts +1 -1
- package/script/src/types/subscriptions/requests.d.ts.map +1 -1
- package/{esm/src/types/subscriptions/common.d.ts → script/src/types/subscriptions/responses.d.ts} +16 -4
- package/script/src/types/subscriptions/responses.d.ts.map +1 -0
- package/esm/src/transports/base.d.ts.map +0 -1
- package/esm/src/transports/base.js +0 -14
- package/esm/src/transports/websocket/hyperliquid_event_target.d.ts.map +0 -1
- package/esm/src/transports/websocket/reconnecting_websocket.d.ts.map +0 -1
- package/esm/src/transports/websocket/websocket_request_dispatcher.d.ts.map +0 -1
- package/esm/src/types/common.d.ts +0 -3
- package/esm/src/types/common.d.ts.map +0 -1
- package/esm/src/types/exchange/common.d.ts +0 -36
- package/esm/src/types/exchange/common.d.ts.map +0 -1
- package/esm/src/types/explorer/common.d.ts +0 -37
- package/esm/src/types/explorer/common.d.ts.map +0 -1
- package/esm/src/types/explorer/common.js +0 -1
- package/esm/src/types/subscriptions/common.d.ts.map +0 -1
- package/esm/src/types/subscriptions/common.js +0 -1
- package/esm/src/utils/key_sort.d.ts +0 -21
- package/esm/src/utils/key_sort.d.ts.map +0 -1
- package/esm/src/utils/key_sort.js +0 -124
- package/esm/src/utils/signing.d.ts +0 -109
- package/esm/src/utils/signing.d.ts.map +0 -1
- package/esm/src/utils/signing.js +0 -164
- package/script/src/transports/base.d.ts.map +0 -1
- package/script/src/transports/websocket/hyperliquid_event_target.d.ts.map +0 -1
- package/script/src/transports/websocket/reconnecting_websocket.d.ts.map +0 -1
- package/script/src/transports/websocket/websocket_request_dispatcher.d.ts.map +0 -1
- package/script/src/types/common.d.ts +0 -3
- package/script/src/types/common.d.ts.map +0 -1
- package/script/src/types/exchange/common.d.ts +0 -36
- package/script/src/types/exchange/common.d.ts.map +0 -1
- package/script/src/types/explorer/common.d.ts +0 -37
- package/script/src/types/explorer/common.d.ts.map +0 -1
- package/script/src/types/explorer/common.js +0 -12
- package/script/src/types/subscriptions/common.d.ts.map +0 -1
- package/script/src/types/subscriptions/common.js +0 -12
- package/script/src/utils/key_sort.d.ts +0 -21
- package/script/src/utils/key_sort.d.ts.map +0 -1
- package/script/src/utils/key_sort.js +0 -137
- package/script/src/utils/signing.d.ts +0 -109
- package/script/src/utils/signing.d.ts.map +0 -1
- package/script/src/utils/signing.js +0 -182
- /package/esm/src/types/{common.js → mod.js} +0 -0
- /package/esm/src/types/{exchange/common.js → subscriptions/responses.js} +0 -0
- /package/script/src/types/{common.js → mod.js} +0 -0
- /package/script/src/types/{exchange/common.js → subscriptions/responses.js} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ReconnectingWebSocket } from "./
|
|
2
|
-
import { HyperliquidEventTarget } from "./
|
|
3
|
-
import { WebSocketRequestDispatcher } from "./
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
1
|
+
import { ReconnectingWebSocket } from "./_reconnecting_websocket.js";
|
|
2
|
+
import { HyperliquidEventTarget } from "./_hyperliquid_event_target.js";
|
|
3
|
+
import { WebSocketRequestDispatcher, WebSocketRequestError } from "./_websocket_request_dispatcher.js";
|
|
4
|
+
export { WebSocketRequestError };
|
|
5
|
+
/** WebSocket implementation of the REST and Subscription transport interfaces. */
|
|
7
6
|
export class WebSocketTransport {
|
|
8
7
|
/**
|
|
9
8
|
* Creates a new WebSocket transport instance.
|
|
@@ -15,7 +14,7 @@ export class WebSocketTransport {
|
|
|
15
14
|
enumerable: true,
|
|
16
15
|
configurable: true,
|
|
17
16
|
writable: true,
|
|
18
|
-
value:
|
|
17
|
+
value: null
|
|
19
18
|
});
|
|
20
19
|
/** The WebSocket request dispatcher instance. */
|
|
21
20
|
Object.defineProperty(this, "_wsRequester", {
|
|
@@ -77,7 +76,7 @@ export class WebSocketTransport {
|
|
|
77
76
|
// Initialize listeners
|
|
78
77
|
this.socket.addEventListener("open", () => {
|
|
79
78
|
// Start keep-alive timer
|
|
80
|
-
if (this.keepAlive.interval &&
|
|
79
|
+
if (this.keepAlive.interval && this._keepAliveTimer === null) {
|
|
81
80
|
this._keepAliveTimer = setInterval(() => {
|
|
82
81
|
this.socket.send(JSON.stringify({ method: "ping" }));
|
|
83
82
|
}, this.keepAlive.interval);
|
|
@@ -85,17 +84,16 @@ export class WebSocketTransport {
|
|
|
85
84
|
});
|
|
86
85
|
this.socket.addEventListener("close", () => {
|
|
87
86
|
// Clear keep-alive timer
|
|
88
|
-
if (this._keepAliveTimer) {
|
|
87
|
+
if (this._keepAliveTimer !== null) {
|
|
89
88
|
clearInterval(this._keepAliveTimer);
|
|
90
|
-
this._keepAliveTimer =
|
|
89
|
+
this._keepAliveTimer = null;
|
|
91
90
|
}
|
|
92
91
|
// Clear all subscriptions
|
|
93
92
|
for (const subscriptionInfo of this._subscriptions.values()) {
|
|
94
|
-
for (const [
|
|
95
|
-
|
|
93
|
+
for (const [_, unsubscribe] of subscriptionInfo.listeners) {
|
|
94
|
+
unsubscribe();
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
this._subscriptions.clear();
|
|
99
97
|
});
|
|
100
98
|
}
|
|
101
99
|
/**
|
|
@@ -110,14 +108,14 @@ export class WebSocketTransport {
|
|
|
110
108
|
request(type, payload, signal) {
|
|
111
109
|
// Reject explorer requests because they are not supported by the Hyperliquid WebSocket API
|
|
112
110
|
if (type === "explorer") {
|
|
113
|
-
|
|
111
|
+
return Promise.reject(new WebSocketRequestError("Explorer requests are not supported in the Hyperliquid WebSocket API."));
|
|
114
112
|
}
|
|
115
113
|
// Send the request and wait for a response
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
?
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
const combinedSignal = this._combineTimeoutWithSignal(this.timeout, signal);
|
|
115
|
+
return this._wsRequester.request("post", {
|
|
116
|
+
type: type === "exchange" ? "action" : type,
|
|
117
|
+
payload,
|
|
118
|
+
}, combinedSignal);
|
|
121
119
|
}
|
|
122
120
|
/**
|
|
123
121
|
* Subscribes to a Hyperliquid event channel.
|
|
@@ -131,60 +129,54 @@ export class WebSocketTransport {
|
|
|
131
129
|
// Create a unique identifier for the subscription
|
|
132
130
|
const id = WebSocketRequestDispatcher.requestToId(payload);
|
|
133
131
|
// Initialize new subscription, if it doesn't exist
|
|
134
|
-
let
|
|
135
|
-
if (!
|
|
132
|
+
let subscription = this._subscriptions.get(id);
|
|
133
|
+
if (!subscription) {
|
|
136
134
|
// Send subscription request
|
|
137
|
-
const
|
|
138
|
-
const combinedSignal = timeoutSignal && signal
|
|
139
|
-
? AbortSignal.any([timeoutSignal, signal])
|
|
140
|
-
: timeoutSignal ?? signal;
|
|
135
|
+
const combinedSignal = this._combineTimeoutWithSignal(this.timeout, signal);
|
|
141
136
|
const requestPromise = this._wsRequester.request("subscribe", payload, combinedSignal);
|
|
142
137
|
// Cache subscription info
|
|
143
|
-
|
|
144
|
-
this._subscriptions.set(id,
|
|
138
|
+
subscription = { listeners: new Map(), requestPromise };
|
|
139
|
+
this._subscriptions.set(id, subscription);
|
|
145
140
|
}
|
|
146
141
|
// Initialize new listener, if it doesn't exist
|
|
147
|
-
let
|
|
148
|
-
if (!
|
|
142
|
+
let unsubscribe = subscription.listeners.get(listener);
|
|
143
|
+
if (!unsubscribe) {
|
|
149
144
|
// Create new unsubscribe function
|
|
150
|
-
|
|
145
|
+
unsubscribe = async (signal) => {
|
|
151
146
|
// Remove listener and cleanup
|
|
152
147
|
this._hlEvents.removeEventListener(channel, listener);
|
|
153
|
-
const
|
|
148
|
+
const subscription = this._subscriptions.get(id);
|
|
149
|
+
subscription?.listeners.delete(listener);
|
|
154
150
|
// If no listeners remain, remove subscription entirely
|
|
155
|
-
|
|
156
|
-
if (subscriptionInfo.listeners.size === 0 && isDeleted) {
|
|
151
|
+
if (subscription?.listeners.size === 0) {
|
|
157
152
|
// Cleanup subscription
|
|
158
153
|
this._subscriptions.delete(id);
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
await this._wsRequester.request("unsubscribe", payload, combinedSignal);
|
|
154
|
+
// If the socket is open, send unsubscription request
|
|
155
|
+
if (this.socket.readyState === WebSocket.OPEN) {
|
|
156
|
+
const combinedSignal = this._combineTimeoutWithSignal(this.timeout, signal);
|
|
157
|
+
await this._wsRequester.request("unsubscribe", payload, combinedSignal);
|
|
158
|
+
}
|
|
165
159
|
}
|
|
166
160
|
};
|
|
167
|
-
//
|
|
168
|
-
listenerInfo = { channel, unsubscribe };
|
|
169
|
-
subscriptionInfo.listeners.set(listener, listenerInfo);
|
|
170
|
-
// Add event listener
|
|
161
|
+
// Add listener and cache unsubscribe function
|
|
171
162
|
this._hlEvents.addEventListener(channel, listener);
|
|
163
|
+
subscription.listeners.set(listener, unsubscribe);
|
|
172
164
|
}
|
|
173
165
|
// Wait for the initial subscription request to complete
|
|
174
|
-
await
|
|
166
|
+
await subscription.requestPromise.catch((error) => {
|
|
175
167
|
// Remove listener and cleanup
|
|
176
168
|
this._hlEvents.removeEventListener(channel, listener);
|
|
177
|
-
|
|
169
|
+
const subscription = this._subscriptions.get(id);
|
|
170
|
+
subscription?.listeners.delete(listener);
|
|
178
171
|
// If no listeners remain, remove subscription entirely
|
|
179
|
-
if (
|
|
172
|
+
if (subscription?.listeners.size === 0) {
|
|
180
173
|
this._subscriptions.delete(id);
|
|
174
|
+
}
|
|
181
175
|
// Rethrow the error
|
|
182
176
|
throw error;
|
|
183
177
|
});
|
|
184
178
|
// Return subscription control object
|
|
185
|
-
return {
|
|
186
|
-
unsubscribe: listenerInfo.unsubscribe,
|
|
187
|
-
};
|
|
179
|
+
return { unsubscribe };
|
|
188
180
|
}
|
|
189
181
|
/**
|
|
190
182
|
* Waits until the WebSocket connection is ready.
|
|
@@ -236,4 +228,12 @@ export class WebSocketTransport {
|
|
|
236
228
|
this.socket.close();
|
|
237
229
|
});
|
|
238
230
|
}
|
|
231
|
+
/** Combines a timeout with an optional abort signal. */
|
|
232
|
+
_combineTimeoutWithSignal(timeout, signal) {
|
|
233
|
+
if (typeof timeout !== "number")
|
|
234
|
+
return signal;
|
|
235
|
+
if (!(signal instanceof AbortSignal))
|
|
236
|
+
return AbortSignal.timeout(timeout);
|
|
237
|
+
return AbortSignal.any([AbortSignal.timeout(timeout), signal]);
|
|
238
|
+
}
|
|
239
239
|
}
|
|
@@ -1,5 +1,38 @@
|
|
|
1
|
-
import type { Hex } from "
|
|
2
|
-
import type {
|
|
1
|
+
import type { Hex } from "../../base.js";
|
|
2
|
+
import type { TIF } from "../info/orders.js";
|
|
3
|
+
/** Order parameters. */
|
|
4
|
+
export type OrderParams = {
|
|
5
|
+
/** Asset ID. */
|
|
6
|
+
a: number;
|
|
7
|
+
/** Position side (`true` for long, `false` for short). */
|
|
8
|
+
b: boolean;
|
|
9
|
+
/** Price. */
|
|
10
|
+
p: string;
|
|
11
|
+
/** Size (in base currency units). */
|
|
12
|
+
s: string;
|
|
13
|
+
/** Is reduce-only? */
|
|
14
|
+
r: boolean;
|
|
15
|
+
/** Order type. */
|
|
16
|
+
t: {
|
|
17
|
+
/** Limit order parameters. */
|
|
18
|
+
limit: {
|
|
19
|
+
/** Time-in-force. */
|
|
20
|
+
tif: TIF;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
/** Trigger order parameters. */
|
|
24
|
+
trigger: {
|
|
25
|
+
/** Is market order? */
|
|
26
|
+
isMarket: boolean;
|
|
27
|
+
/** Trigger price. */
|
|
28
|
+
triggerPx: string;
|
|
29
|
+
/** Indicates whether it is take profit or stop loss. */
|
|
30
|
+
tpsl: "tp" | "sl";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/** Client Order ID. */
|
|
34
|
+
c?: Hex | null;
|
|
35
|
+
};
|
|
3
36
|
/** Base structure for exchange requests. */
|
|
4
37
|
export interface BaseExchangeRequest {
|
|
5
38
|
/** Action to perform. */
|
|
@@ -84,42 +117,42 @@ export interface BatchModifyRequest extends BaseExchangeRequest {
|
|
|
84
117
|
vaultAddress?: Hex;
|
|
85
118
|
}
|
|
86
119
|
/**
|
|
87
|
-
* Cancel order(s).
|
|
120
|
+
* Cancel order(s) by cloid.
|
|
88
121
|
* @returns {CancelResponse}
|
|
89
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
122
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
90
123
|
*/
|
|
91
|
-
export interface
|
|
124
|
+
export interface CancelByCloidRequest extends BaseExchangeRequest {
|
|
92
125
|
/** Action to be performed. */
|
|
93
126
|
action: {
|
|
94
127
|
/** Type of action. */
|
|
95
|
-
type: "
|
|
128
|
+
type: "cancelByCloid";
|
|
96
129
|
/** Orders to cancel. */
|
|
97
130
|
cancels: {
|
|
98
131
|
/** Asset ID. */
|
|
99
|
-
|
|
100
|
-
/** Order ID. */
|
|
101
|
-
|
|
132
|
+
asset: number;
|
|
133
|
+
/** Client Order ID. */
|
|
134
|
+
cloid: Hex;
|
|
102
135
|
}[];
|
|
103
136
|
};
|
|
104
137
|
/** Vault address (for vault trading). */
|
|
105
138
|
vaultAddress?: Hex;
|
|
106
139
|
}
|
|
107
140
|
/**
|
|
108
|
-
* Cancel order(s)
|
|
141
|
+
* Cancel order(s).
|
|
109
142
|
* @returns {CancelResponse}
|
|
110
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
143
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
111
144
|
*/
|
|
112
|
-
export interface
|
|
145
|
+
export interface CancelRequest extends BaseExchangeRequest {
|
|
113
146
|
/** Action to be performed. */
|
|
114
147
|
action: {
|
|
115
148
|
/** Type of action. */
|
|
116
|
-
type: "
|
|
149
|
+
type: "cancel";
|
|
117
150
|
/** Orders to cancel. */
|
|
118
151
|
cancels: {
|
|
119
152
|
/** Asset ID. */
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
|
|
153
|
+
a: number;
|
|
154
|
+
/** Order ID. */
|
|
155
|
+
o: number;
|
|
123
156
|
}[];
|
|
124
157
|
};
|
|
125
158
|
/** Vault address (for vault trading). */
|
|
@@ -145,6 +178,18 @@ export interface CDepositRequest extends BaseExchangeRequest {
|
|
|
145
178
|
wei: number;
|
|
146
179
|
};
|
|
147
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Claim rewards from referral program.
|
|
183
|
+
* @returns {SuccessResponse}
|
|
184
|
+
* @see null - no documentation
|
|
185
|
+
*/
|
|
186
|
+
export interface ClaimRewardsRequest extends BaseExchangeRequest {
|
|
187
|
+
/** Action to be performed. */
|
|
188
|
+
action: {
|
|
189
|
+
/** Type of action. */
|
|
190
|
+
type: "claimRewards";
|
|
191
|
+
};
|
|
192
|
+
}
|
|
148
193
|
/**
|
|
149
194
|
* Create a sub-account.
|
|
150
195
|
* @returns {CreateSubAccountResponse}
|
|
@@ -179,6 +224,20 @@ export interface CWithdrawRequest extends BaseExchangeRequest {
|
|
|
179
224
|
wei: number;
|
|
180
225
|
};
|
|
181
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Configure block type for EVM transactions.
|
|
229
|
+
* @returns {SuccessResponse}
|
|
230
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/evm/dual-block-architecture
|
|
231
|
+
*/
|
|
232
|
+
export interface EvmUserModifyRequest extends BaseExchangeRequest {
|
|
233
|
+
/** Action to be performed. */
|
|
234
|
+
action: {
|
|
235
|
+
/** Type of action. */
|
|
236
|
+
type: "evmUserModify";
|
|
237
|
+
/** `true` for large blocks, `false` for small blocks. */
|
|
238
|
+
usingBigBlocks: boolean;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
182
241
|
/**
|
|
183
242
|
* Modify an order.
|
|
184
243
|
* @returns {SuccessResponse}
|
|
@@ -248,6 +307,24 @@ export interface ScheduleCancelRequest extends BaseExchangeRequest {
|
|
|
248
307
|
/** Vault address (for vault trading). */
|
|
249
308
|
vaultAddress?: Hex;
|
|
250
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Set the display name in the leaderboard.
|
|
312
|
+
* @returns {SuccessResponse}
|
|
313
|
+
* @see null - no documentation
|
|
314
|
+
*/
|
|
315
|
+
export interface SetDisplayNameRequest extends BaseExchangeRequest {
|
|
316
|
+
/** Action to be performed. */
|
|
317
|
+
action: {
|
|
318
|
+
/** Type of action. */
|
|
319
|
+
type: "setDisplayName";
|
|
320
|
+
/**
|
|
321
|
+
* Display name.
|
|
322
|
+
*
|
|
323
|
+
* Set to an empty string to remove the display name.
|
|
324
|
+
*/
|
|
325
|
+
displayName: string;
|
|
326
|
+
};
|
|
327
|
+
}
|
|
251
328
|
/**
|
|
252
329
|
* Set a referral code.
|
|
253
330
|
* @returns {SuccessResponse}
|
|
@@ -278,7 +355,7 @@ export interface SpotSendRequest extends BaseExchangeRequest {
|
|
|
278
355
|
signatureChainId: Hex;
|
|
279
356
|
/** Unique request identifier (recommended current timestamp in ms). */
|
|
280
357
|
time: number;
|
|
281
|
-
/**
|
|
358
|
+
/** Destination address. */
|
|
282
359
|
destination: Hex;
|
|
283
360
|
/** Token identifier. */
|
|
284
361
|
token: `${string}:${Hex}`;
|
|
@@ -287,7 +364,44 @@ export interface SpotSendRequest extends BaseExchangeRequest {
|
|
|
287
364
|
};
|
|
288
365
|
}
|
|
289
366
|
/**
|
|
290
|
-
*
|
|
367
|
+
* Opt Out of Spot Dusting.
|
|
368
|
+
* @returns {SuccessResponse}
|
|
369
|
+
* @see null - no documentation
|
|
370
|
+
*/
|
|
371
|
+
export interface SpotUserRequest extends BaseExchangeRequest {
|
|
372
|
+
/** Action to be performed. */
|
|
373
|
+
action: {
|
|
374
|
+
/** Type of action. */
|
|
375
|
+
type: "spotUser";
|
|
376
|
+
/** Spot dusting options. */
|
|
377
|
+
toggleSpotDusting: {
|
|
378
|
+
/** Opt out of spot dusting. */
|
|
379
|
+
optOut: boolean;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Transfer between sub-accounts (spot).
|
|
385
|
+
* @returns {SuccessResponse}
|
|
386
|
+
* @see null - no documentation
|
|
387
|
+
*/
|
|
388
|
+
export interface SubAccountSpotTransferRequest extends BaseExchangeRequest {
|
|
389
|
+
/** Action to be performed. */
|
|
390
|
+
action: {
|
|
391
|
+
/** Type of action. */
|
|
392
|
+
type: "subAccountSpotTransfer";
|
|
393
|
+
/** Sub-account address. */
|
|
394
|
+
subAccountUser: Hex;
|
|
395
|
+
/** `true` for deposit, `false` for withdrawal. */
|
|
396
|
+
isDeposit: boolean;
|
|
397
|
+
/** Token identifier. */
|
|
398
|
+
token: `${string}:${Hex}`;
|
|
399
|
+
/** Amount to send. */
|
|
400
|
+
amount: string;
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Transfer between sub-accounts (perpetual).
|
|
291
405
|
* @returns {SuccessResponse}
|
|
292
406
|
* @see null - no documentation
|
|
293
407
|
*/
|
|
@@ -453,12 +567,50 @@ export interface UsdSendRequest extends BaseExchangeRequest {
|
|
|
453
567
|
signatureChainId: Hex;
|
|
454
568
|
/** Unique request identifier (recommended current timestamp in ms). */
|
|
455
569
|
time: number;
|
|
456
|
-
/**
|
|
570
|
+
/** Destination address. */
|
|
457
571
|
destination: Hex;
|
|
458
572
|
/** Amount to send. */
|
|
459
573
|
amount: string;
|
|
460
574
|
};
|
|
461
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Distribute funds from a vault between followers.
|
|
578
|
+
* @returns {SuccessResponse}
|
|
579
|
+
* @see null - no documentation
|
|
580
|
+
*/
|
|
581
|
+
export interface VaultDistributeRequest extends BaseExchangeRequest {
|
|
582
|
+
/** Action to be performed. */
|
|
583
|
+
action: {
|
|
584
|
+
/** Type of action. */
|
|
585
|
+
type: "vaultDistribute";
|
|
586
|
+
/** Vault address. */
|
|
587
|
+
vaultAddress: Hex;
|
|
588
|
+
/**
|
|
589
|
+
* Raw amount to distribute (float * 1e6).
|
|
590
|
+
*
|
|
591
|
+
* Set to 0 to close the vault.
|
|
592
|
+
*/
|
|
593
|
+
usd: number;
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Modify a vault's configuration.
|
|
598
|
+
* @returns {SuccessResponse}
|
|
599
|
+
* @see null - no documentation
|
|
600
|
+
*/
|
|
601
|
+
export interface VaultModifyRequest extends BaseExchangeRequest {
|
|
602
|
+
/** Action to be performed. */
|
|
603
|
+
action: {
|
|
604
|
+
/** Type of action. */
|
|
605
|
+
type: "vaultModify";
|
|
606
|
+
/** Vault address. */
|
|
607
|
+
vaultAddress: Hex;
|
|
608
|
+
/** Allow deposits from followers. */
|
|
609
|
+
allowDeposits: boolean | null;
|
|
610
|
+
/** Always close positions on withdrawal. */
|
|
611
|
+
alwaysCloseOnWithdraw: boolean | null;
|
|
612
|
+
};
|
|
613
|
+
}
|
|
462
614
|
/**
|
|
463
615
|
* Add or remove funds from a vault.
|
|
464
616
|
* @returns {SuccessResponse}
|
|
@@ -495,7 +647,7 @@ export interface Withdraw3Request extends BaseExchangeRequest {
|
|
|
495
647
|
time: number;
|
|
496
648
|
/** Amount to withdraw. */
|
|
497
649
|
amount: string;
|
|
498
|
-
/**
|
|
650
|
+
/** Destination address. */
|
|
499
651
|
destination: Hex;
|
|
500
652
|
};
|
|
501
653
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/exchange/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/exchange/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C,wBAAwB;AACxB,MAAM,MAAM,WAAW,GAAG;IACtB,gBAAgB;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,0DAA0D;IAC1D,CAAC,EAAE,OAAO,CAAC;IACX,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,sBAAsB;IACtB,CAAC,EAAE,OAAO,CAAC;IACX,kBAAkB;IAClB,CAAC,EACK;QACE,8BAA8B;QAC9B,KAAK,EAAE;YACH,qBAAqB;YACrB,GAAG,EAAE,GAAG,CAAC;SACZ,CAAC;KACL,GACC;QACE,gCAAgC;QAChC,OAAO,EAAE;YACL,uBAAuB;YACvB,QAAQ,EAAE,OAAO,CAAC;YAClB,qBAAqB;YACrB,SAAS,EAAE,MAAM,CAAC;YAClB,wDAAwD;YACxD,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;SACrB,CAAC;KACL,CAAC;IACN,uBAAuB;IACvB,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAClB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAChC,yBAAyB;IACzB,MAAM,EAAE;QACJ,sBAAsB;QACtB,IAAI,EAAE,MAAM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AAC;QACb,0BAA0B;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,2BAA2B;QAC3B,WAAW,EAAE,GAAG,CAAC;KACpB,CAAC;CACL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hex } from "
|
|
1
|
+
import type { Hex } from "../../base.js";
|
|
2
2
|
/** Base structure for exchange responses. */
|
|
3
3
|
export interface BaseExchangeResponse {
|
|
4
4
|
/** Response status */
|
|
@@ -11,23 +11,6 @@ export interface BaseExchangeResponse {
|
|
|
11
11
|
data?: unknown;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
/** Successful response without specific data. */
|
|
15
|
-
export interface SuccessResponse extends BaseExchangeResponse {
|
|
16
|
-
/** Successful status. */
|
|
17
|
-
status: "ok";
|
|
18
|
-
/** Response details. */
|
|
19
|
-
response: {
|
|
20
|
-
/** Type of response. */
|
|
21
|
-
type: "default";
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/** Error response for failed operations. */
|
|
25
|
-
export interface ErrorResponse extends BaseExchangeResponse {
|
|
26
|
-
/** Error status. */
|
|
27
|
-
status: "err";
|
|
28
|
-
/** Error message. */
|
|
29
|
-
response: string;
|
|
30
|
-
}
|
|
31
14
|
/** Response for order cancellation. */
|
|
32
15
|
export interface CancelResponse extends BaseExchangeResponse {
|
|
33
16
|
/** Successful status. */
|
|
@@ -58,6 +41,13 @@ export interface CreateSubAccountResponse extends BaseExchangeResponse {
|
|
|
58
41
|
data: Hex;
|
|
59
42
|
};
|
|
60
43
|
}
|
|
44
|
+
/** Error response for failed operations. */
|
|
45
|
+
export interface ErrorResponse extends BaseExchangeResponse {
|
|
46
|
+
/** Error status. */
|
|
47
|
+
status: "err";
|
|
48
|
+
/** Error message. */
|
|
49
|
+
response: string;
|
|
50
|
+
}
|
|
61
51
|
/** Response for order placement and batch modifications. */
|
|
62
52
|
export interface OrderResponse extends BaseExchangeResponse {
|
|
63
53
|
/** Successful status. */
|
|
@@ -96,42 +86,52 @@ export interface OrderResponse extends BaseExchangeResponse {
|
|
|
96
86
|
};
|
|
97
87
|
};
|
|
98
88
|
}
|
|
99
|
-
/**
|
|
100
|
-
export interface
|
|
89
|
+
/** Successful response without specific data. */
|
|
90
|
+
export interface SuccessResponse extends BaseExchangeResponse {
|
|
101
91
|
/** Successful status. */
|
|
102
92
|
status: "ok";
|
|
103
93
|
/** Response details. */
|
|
104
94
|
response: {
|
|
105
95
|
/** Type of response. */
|
|
106
|
-
type: "
|
|
96
|
+
type: "default";
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Response for canceling a TWAP order. */
|
|
100
|
+
export interface TwapCancelResponse extends BaseExchangeResponse {
|
|
101
|
+
/** Successful status. */
|
|
102
|
+
status: "ok";
|
|
103
|
+
/** Response details. */
|
|
104
|
+
response: {
|
|
105
|
+
/** Type of response. */
|
|
106
|
+
type: "twapCancel";
|
|
107
107
|
/** Specific data. */
|
|
108
108
|
data: {
|
|
109
109
|
/** Status of the operation. */
|
|
110
|
-
status: {
|
|
111
|
-
/** Running order status. */
|
|
112
|
-
running: {
|
|
113
|
-
/** TWAP ID. */
|
|
114
|
-
twapId: number;
|
|
115
|
-
};
|
|
116
|
-
} | {
|
|
110
|
+
status: string | {
|
|
117
111
|
/** Error message. */
|
|
118
112
|
error: string;
|
|
119
113
|
};
|
|
120
114
|
};
|
|
121
115
|
};
|
|
122
116
|
}
|
|
123
|
-
/** Response for
|
|
124
|
-
export interface
|
|
117
|
+
/** Response for creating a TWAP order. */
|
|
118
|
+
export interface TwapOrderResponse extends BaseExchangeResponse {
|
|
125
119
|
/** Successful status. */
|
|
126
120
|
status: "ok";
|
|
127
121
|
/** Response details. */
|
|
128
122
|
response: {
|
|
129
123
|
/** Type of response. */
|
|
130
|
-
type: "
|
|
124
|
+
type: "twapOrder";
|
|
131
125
|
/** Specific data. */
|
|
132
126
|
data: {
|
|
133
127
|
/** Status of the operation. */
|
|
134
|
-
status:
|
|
128
|
+
status: {
|
|
129
|
+
/** Running order status. */
|
|
130
|
+
running: {
|
|
131
|
+
/** TWAP ID. */
|
|
132
|
+
twapId: number;
|
|
133
|
+
};
|
|
134
|
+
} | {
|
|
135
135
|
/** Error message. */
|
|
136
136
|
error: string;
|
|
137
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/src/types/exchange/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/src/types/exchange/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACjC,sBAAsB;IACtB,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC;IACrB,oCAAoC;IACpC,QAAQ,EACF,MAAM,GACN;QACE,wBAAwB;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,uCAAuC;QACvC,IAAI,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACT;AAED,uCAAuC;AACvC,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IACxD,yBAAyB;IACzB,MAAM,EAAE,IAAI,CAAC;IACb,wBAAwB;IACxB,QAAQ,EAAE;QACN,wBAAwB;QACxB,IAAI,EAAE,QAAQ,CAAC;QACf,qBAAqB;QACrB,IAAI,EAAE;YACF,2CAA2C;YAC3C,QAAQ,EAAE,CACJ,SAAS,GACT;gBACE,qBAAqB;gBACrB,KAAK,EAAE,MAAM,CAAC;aACjB,CACJ,EAAE,CAAC;SACP,CAAC;KACL,CAAC;CACL;AAED,2CAA2C;AAC3C,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IAClE,yBAAyB;IACzB,MAAM,EAAE,IAAI,CAAC;IACb,wBAAwB;IACxB,QAAQ,EAAE;QACN,wBAAwB;QACxB,IAAI,EAAE,kBAA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ACzB,MAAM,EAAE,IAAI,CAAC;IACb,wBAAwB;IACxB,QAAQ,EAAE;QACN,wBAAwB;QACxB,IAAI,EAAE,YAAY,CAAC;QACnB,qBAAqB;QACrB,IAAI,EAAE;YACF,+BAA+B;YAC/B,MAAM,EACA,MAAM,GACN;gBACE,qBAAqB;gBACrB,KAAK,EAAE,MAAM,CAAC;aACjB,CAAC;SACT,CAAC;KACL,CAAC;CACL;AAED,0CAA0C;AAC1C,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC3D,yBAAyB;IACzB,MAAM,EAAE,IAAI,CAAC;IACb,wBAAwB;IACxB,QAAQ,EAAE;QACN,wBAAwB;QACxB,IAAI,EAAE,WAAW,CAAC;QAClB,qBAAqB;QACrB,IAAI,EAAE;YACF,+BAA+B;YAC/B,MAAM,EACA;gBACE,4BAA4B;gBAC5B,OAAO,EAAE;oBACL,eAAe;oBACf,MAAM,EAAE,MAAM,CAAC;iBAClB,CAAC;aACL,GACC;gBACE,qBAAqB;gBACrB,KAAK,EAAE,MAAM,CAAC;aACjB,CAAC;SACT,CAAC;KACL,CAAC;CACL"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import type { Hex } from "
|
|
2
|
-
/**
|
|
3
|
-
* Request for transaction details by transaction hash.
|
|
4
|
-
* @returns {TxDetailsResponse} Transaction details response.
|
|
5
|
-
* @see null - no documentation
|
|
6
|
-
*/
|
|
7
|
-
export interface TxDetailsRequest {
|
|
8
|
-
/** Type of request. */
|
|
9
|
-
type: "txDetails";
|
|
10
|
-
/** Transaction hash. */
|
|
11
|
-
hash: Hex;
|
|
12
|
-
}
|
|
1
|
+
import type { Hex } from "../../base.js";
|
|
13
2
|
/**
|
|
14
3
|
* Request for block details by block height.
|
|
15
4
|
* @returns {BlockDetailsResponse} Block details response.
|
|
@@ -21,6 +10,17 @@ export interface BlockDetailsRequest {
|
|
|
21
10
|
/** Block height. */
|
|
22
11
|
height: number;
|
|
23
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Request for transaction details by transaction hash.
|
|
15
|
+
* @returns {TxDetailsResponse} Transaction details response.
|
|
16
|
+
* @see null - no documentation
|
|
17
|
+
*/
|
|
18
|
+
export interface TxDetailsRequest {
|
|
19
|
+
/** Type of request. */
|
|
20
|
+
type: "txDetails";
|
|
21
|
+
/** Transaction hash. */
|
|
22
|
+
hash: Hex;
|
|
23
|
+
}
|
|
24
24
|
/**
|
|
25
25
|
* Request for user details by user's address.
|
|
26
26
|
* @returns {UserDetailsResponse} User details response.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/explorer/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/explorer/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,uBAAuB;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,uBAAuB;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,wBAAwB;IACxB,IAAI,EAAE,GAAG,CAAC;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B,uBAAuB;IACvB,IAAI,EAAE,aAAa,CAAC;IACpB,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;CACb"}
|