@nktkas/hyperliquid 0.23.1 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +3 -2
- package/README.md +178 -194
- package/esm/mod.d.ts +2 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/src/base.d.ts +0 -5
- package/esm/src/base.d.ts.map +1 -1
- package/esm/src/clients/exchange.d.ts +485 -392
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +517 -912
- package/esm/src/clients/info.d.ts +249 -203
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +258 -368
- package/esm/src/clients/multiSign.d.ts +14 -1184
- package/esm/src/clients/multiSign.d.ts.map +1 -1
- package/esm/src/clients/multiSign.js +37 -2004
- package/esm/src/clients/subscription.d.ts +101 -99
- package/esm/src/clients/subscription.d.ts.map +1 -1
- package/esm/src/clients/subscription.js +107 -152
- package/esm/src/signing/_signTypedData/ethers.d.ts +16 -4
- package/esm/src/signing/_signTypedData/ethers.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/ethers.js +1 -1
- package/esm/src/signing/_signTypedData/mod.d.ts +12 -12
- package/esm/src/signing/_signTypedData/mod.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/mod.js +52 -24
- package/esm/src/signing/_signTypedData/private_key.d.ts +6 -5
- package/esm/src/signing/_signTypedData/private_key.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/private_key.js +40 -19
- package/esm/src/signing/_signTypedData/viem.d.ts +27 -6
- package/esm/src/signing/_signTypedData/viem.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/viem.js +1 -1
- package/esm/src/signing/_sorter.d.ts +18 -19
- package/esm/src/signing/_sorter.d.ts.map +1 -1
- package/esm/src/signing/_sorter.js +57 -59
- package/esm/src/signing/mod.d.ts +179 -129
- package/esm/src/signing/mod.d.ts.map +1 -1
- package/esm/src/signing/mod.js +184 -132
- package/esm/src/transports/base.d.ts +2 -1
- package/esm/src/transports/base.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.d.ts +3 -2
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +4 -4
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -2
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/esm/src/transports/websocket/_websocket_async_request.js +17 -21
- package/esm/src/transports/websocket/websocket_transport.d.ts +4 -4
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +6 -6
- package/esm/src/types/exchange/requests.d.ts +547 -306
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/exchange/responses.d.ts +105 -25
- package/esm/src/types/exchange/responses.d.ts.map +1 -1
- package/esm/src/types/explorer/requests.d.ts +3 -3
- package/esm/src/types/explorer/requests.d.ts.map +1 -1
- package/esm/src/types/explorer/responses.d.ts +1 -1
- package/esm/src/types/explorer/responses.d.ts.map +1 -1
- package/esm/src/types/info/accounts.d.ts +405 -98
- package/esm/src/types/info/accounts.d.ts.map +1 -1
- package/esm/src/types/info/assets.d.ts +131 -35
- package/esm/src/types/info/assets.d.ts.map +1 -1
- package/esm/src/types/info/markets.d.ts +29 -8
- package/esm/src/types/info/markets.d.ts.map +1 -1
- package/esm/src/types/info/orders.d.ts +64 -17
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +126 -51
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/esm/src/types/info/validators.d.ts +44 -14
- package/esm/src/types/info/validators.d.ts.map +1 -1
- package/esm/src/types/info/vaults.d.ts +25 -10
- package/esm/src/types/info/vaults.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +1 -1
- package/esm/src/types/mod.d.ts.map +1 -1
- package/esm/src/types/subscriptions/requests.d.ts +21 -66
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
- package/esm/src/types/subscriptions/responses.d.ts +46 -55
- package/esm/src/types/subscriptions/responses.d.ts.map +1 -1
- package/package.json +2 -3
- package/script/mod.d.ts +2 -1
- package/script/mod.d.ts.map +1 -1
- package/script/src/base.d.ts +0 -5
- package/script/src/base.d.ts.map +1 -1
- package/script/src/clients/exchange.d.ts +485 -392
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +516 -911
- package/script/src/clients/info.d.ts +249 -203
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +258 -368
- package/script/src/clients/multiSign.d.ts +14 -1184
- package/script/src/clients/multiSign.d.ts.map +1 -1
- package/script/src/clients/multiSign.js +38 -2005
- package/script/src/clients/subscription.d.ts +101 -99
- package/script/src/clients/subscription.d.ts.map +1 -1
- package/script/src/clients/subscription.js +107 -152
- package/script/src/signing/_signTypedData/ethers.d.ts +16 -4
- package/script/src/signing/_signTypedData/ethers.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/ethers.js +2 -2
- package/script/src/signing/_signTypedData/mod.d.ts +12 -12
- package/script/src/signing/_signTypedData/mod.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/mod.js +51 -26
- package/script/src/signing/_signTypedData/private_key.d.ts +6 -5
- package/script/src/signing/_signTypedData/private_key.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/private_key.js +40 -18
- package/script/src/signing/_signTypedData/viem.d.ts +27 -6
- package/script/src/signing/_signTypedData/viem.d.ts.map +1 -1
- package/script/src/signing/_signTypedData/viem.js +2 -2
- package/script/src/signing/_sorter.d.ts +18 -19
- package/script/src/signing/_sorter.d.ts.map +1 -1
- package/script/src/signing/_sorter.js +57 -59
- package/script/src/signing/mod.d.ts +179 -129
- package/script/src/signing/mod.d.ts.map +1 -1
- package/script/src/signing/mod.js +187 -150
- package/script/src/transports/base.d.ts +2 -1
- package/script/src/transports/base.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.d.ts +3 -2
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +4 -4
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/script/src/transports/websocket/_hyperliquid_event_target.js +1 -2
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/script/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/script/src/transports/websocket/_websocket_async_request.js +17 -21
- package/script/src/transports/websocket/websocket_transport.d.ts +4 -4
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +6 -6
- package/script/src/types/exchange/requests.d.ts +547 -306
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/exchange/responses.d.ts +105 -25
- package/script/src/types/exchange/responses.d.ts.map +1 -1
- package/script/src/types/explorer/requests.d.ts +3 -3
- package/script/src/types/explorer/requests.d.ts.map +1 -1
- package/script/src/types/explorer/responses.d.ts +1 -1
- package/script/src/types/explorer/responses.d.ts.map +1 -1
- package/script/src/types/info/accounts.d.ts +405 -98
- package/script/src/types/info/accounts.d.ts.map +1 -1
- package/script/src/types/info/assets.d.ts +131 -35
- package/script/src/types/info/assets.d.ts.map +1 -1
- package/script/src/types/info/markets.d.ts +29 -8
- package/script/src/types/info/markets.d.ts.map +1 -1
- package/script/src/types/info/orders.d.ts +64 -17
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +126 -51
- package/script/src/types/info/requests.d.ts.map +1 -1
- package/script/src/types/info/validators.d.ts +44 -14
- package/script/src/types/info/validators.d.ts.map +1 -1
- package/script/src/types/info/vaults.d.ts +25 -10
- package/script/src/types/info/vaults.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +1 -1
- package/script/src/types/mod.d.ts.map +1 -1
- package/script/src/types/subscriptions/requests.d.ts +21 -66
- package/script/src/types/subscriptions/requests.d.ts.map +1 -1
- package/script/src/types/subscriptions/responses.d.ts +46 -55
- package/script/src/types/subscriptions/responses.d.ts.map +1 -1
- package/esm/src/signing/_signTypedData/window.d.ts +0 -29
- package/esm/src/signing/_signTypedData/window.d.ts.map +0 -1
- package/esm/src/signing/_signTypedData/window.js +0 -30
- package/script/src/signing/_signTypedData/window.d.ts +0 -29
- package/script/src/signing/_signTypedData/window.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/window.js +0 -34
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import type { Hex } from "
|
|
1
|
+
import type { Hex } from "../mod.js";
|
|
2
2
|
import type { TIF } from "../info/orders.js";
|
|
3
|
+
/** ECDSA signature components for Ethereum typed data. */
|
|
4
|
+
export interface Signature {
|
|
5
|
+
/** First 32-byte component of ECDSA signature. */
|
|
6
|
+
r: Hex;
|
|
7
|
+
/** Second 32-byte component of ECDSA signature. */
|
|
8
|
+
s: Hex;
|
|
9
|
+
/** Recovery identifier. */
|
|
10
|
+
v: 27 | 28;
|
|
11
|
+
}
|
|
3
12
|
/** Order parameters. */
|
|
4
13
|
export type OrderParams = {
|
|
5
14
|
/** Asset ID. */
|
|
6
15
|
a: number;
|
|
7
16
|
/** Position side (`true` for long, `false` for short). */
|
|
8
17
|
b: boolean;
|
|
9
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Price.
|
|
20
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
21
|
+
*/
|
|
10
22
|
p: string;
|
|
11
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Size (in base currency units).
|
|
25
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
26
|
+
*/
|
|
12
27
|
s: string;
|
|
13
28
|
/** Is reduce-only? */
|
|
14
29
|
r: boolean;
|
|
@@ -24,42 +39,25 @@ export type OrderParams = {
|
|
|
24
39
|
trigger: {
|
|
25
40
|
/** Is market order? */
|
|
26
41
|
isMarket: boolean;
|
|
27
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Trigger price.
|
|
44
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
45
|
+
*/
|
|
28
46
|
triggerPx: string;
|
|
29
47
|
/** Indicates whether it is take profit or stop loss. */
|
|
30
48
|
tpsl: "tp" | "sl";
|
|
31
49
|
};
|
|
32
50
|
};
|
|
33
51
|
/** Client Order ID. */
|
|
34
|
-
c?: Hex
|
|
52
|
+
c?: Hex;
|
|
35
53
|
};
|
|
36
|
-
/** Base structure for exchange requests. */
|
|
37
|
-
export interface BaseExchangeRequest {
|
|
38
|
-
/** Action to perform. */
|
|
39
|
-
action: {
|
|
40
|
-
/** Type of action. */
|
|
41
|
-
type: string;
|
|
42
|
-
/** Additional parameters. */
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
};
|
|
45
|
-
/** Unique request identifier (current timestamp in ms). */
|
|
46
|
-
nonce: number;
|
|
47
|
-
/** Cryptographic signature. */
|
|
48
|
-
signature: {
|
|
49
|
-
r: Hex;
|
|
50
|
-
s: Hex;
|
|
51
|
-
v: number;
|
|
52
|
-
};
|
|
53
|
-
/** Vault address (for vault trading). */
|
|
54
|
-
vaultAddress?: Hex;
|
|
55
|
-
/** Expiration time of the action. */
|
|
56
|
-
expiresAfter?: number;
|
|
57
|
-
}
|
|
58
54
|
/**
|
|
59
55
|
* Approve an agent to sign on behalf of the master account.
|
|
60
56
|
* @returns {SuccessResponse}
|
|
57
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
|
|
61
58
|
*/
|
|
62
|
-
export interface ApproveAgentRequest
|
|
59
|
+
export interface ApproveAgentRequest {
|
|
60
|
+
/** Action to perform. */
|
|
63
61
|
action: {
|
|
64
62
|
/** Type of action. */
|
|
65
63
|
type: "approveAgent";
|
|
@@ -69,19 +67,23 @@ export interface ApproveAgentRequest extends BaseExchangeRequest {
|
|
|
69
67
|
hyperliquidChain: "Mainnet" | "Testnet";
|
|
70
68
|
/** Agent address. */
|
|
71
69
|
agentAddress: Hex;
|
|
72
|
-
/** Agent name or
|
|
73
|
-
agentName
|
|
70
|
+
/** Agent name or null for unnamed agent. */
|
|
71
|
+
agentName: string | null;
|
|
74
72
|
/** Unique request identifier (current timestamp in ms). */
|
|
75
73
|
nonce: number;
|
|
76
74
|
};
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
76
|
+
nonce: number;
|
|
77
|
+
/** Cryptographic signature. */
|
|
78
|
+
signature: Signature;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Approve a maximum fee rate for a builder.
|
|
82
82
|
* @returns {SuccessResponse}
|
|
83
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
|
|
83
84
|
*/
|
|
84
|
-
export interface ApproveBuilderFeeRequest
|
|
85
|
+
export interface ApproveBuilderFeeRequest {
|
|
86
|
+
/** Action to perform. */
|
|
85
87
|
action: {
|
|
86
88
|
/** Type of action. */
|
|
87
89
|
type: "approveBuilderFee";
|
|
@@ -96,33 +98,45 @@ export interface ApproveBuilderFeeRequest extends BaseExchangeRequest {
|
|
|
96
98
|
/** Unique request identifier (current timestamp in ms). */
|
|
97
99
|
nonce: number;
|
|
98
100
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
102
|
+
nonce: number;
|
|
103
|
+
/** Cryptographic signature. */
|
|
104
|
+
signature: Signature;
|
|
101
105
|
}
|
|
102
106
|
/**
|
|
103
107
|
* Modify multiple orders.
|
|
104
108
|
* @returns {OrderResponse}
|
|
109
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
105
110
|
*/
|
|
106
|
-
export interface BatchModifyRequest
|
|
111
|
+
export interface BatchModifyRequest {
|
|
112
|
+
/** Action to perform. */
|
|
107
113
|
action: {
|
|
108
114
|
/** Type of action. */
|
|
109
115
|
type: "batchModify";
|
|
110
116
|
/** Order modifications. */
|
|
111
117
|
modifies: {
|
|
112
|
-
/** Order ID or
|
|
118
|
+
/** Order ID or Client Order ID. */
|
|
113
119
|
oid: number | Hex;
|
|
114
120
|
/** New order parameters. */
|
|
115
121
|
order: OrderParams;
|
|
116
122
|
}[];
|
|
117
123
|
};
|
|
124
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
125
|
+
nonce: number;
|
|
126
|
+
/** Cryptographic signature. */
|
|
127
|
+
signature: Signature;
|
|
128
|
+
/** Vault address (for vault trading). */
|
|
118
129
|
vaultAddress?: Hex;
|
|
130
|
+
/** Expiration time of the action. */
|
|
119
131
|
expiresAfter?: number;
|
|
120
132
|
}
|
|
121
133
|
/**
|
|
122
134
|
* Cancel order(s).
|
|
123
135
|
* @returns {CancelResponse}
|
|
136
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
124
137
|
*/
|
|
125
|
-
export interface CancelRequest
|
|
138
|
+
export interface CancelRequest {
|
|
139
|
+
/** Action to perform. */
|
|
126
140
|
action: {
|
|
127
141
|
/** Type of action. */
|
|
128
142
|
type: "cancel";
|
|
@@ -134,14 +148,22 @@ export interface CancelRequest extends BaseExchangeRequest {
|
|
|
134
148
|
o: number;
|
|
135
149
|
}[];
|
|
136
150
|
};
|
|
151
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
152
|
+
nonce: number;
|
|
153
|
+
/** Cryptographic signature. */
|
|
154
|
+
signature: Signature;
|
|
155
|
+
/** Vault address (for vault trading). */
|
|
137
156
|
vaultAddress?: Hex;
|
|
157
|
+
/** Expiration time of the action. */
|
|
138
158
|
expiresAfter?: number;
|
|
139
159
|
}
|
|
140
160
|
/**
|
|
141
161
|
* Cancel order(s) by cloid.
|
|
142
162
|
* @returns {CancelResponse}
|
|
163
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
143
164
|
*/
|
|
144
|
-
export interface CancelByCloidRequest
|
|
165
|
+
export interface CancelByCloidRequest {
|
|
166
|
+
/** Action to perform. */
|
|
145
167
|
action: {
|
|
146
168
|
/** Type of action. */
|
|
147
169
|
type: "cancelByCloid";
|
|
@@ -153,14 +175,22 @@ export interface CancelByCloidRequest extends BaseExchangeRequest {
|
|
|
153
175
|
cloid: Hex;
|
|
154
176
|
}[];
|
|
155
177
|
};
|
|
178
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
179
|
+
nonce: number;
|
|
180
|
+
/** Cryptographic signature. */
|
|
181
|
+
signature: Signature;
|
|
182
|
+
/** Vault address (for vault trading). */
|
|
156
183
|
vaultAddress?: Hex;
|
|
184
|
+
/** Expiration time of the action. */
|
|
157
185
|
expiresAfter?: number;
|
|
158
186
|
}
|
|
159
187
|
/**
|
|
160
|
-
* Transfer native token from the user
|
|
188
|
+
* Transfer native token from the user spot account into staking for delegating to validators.
|
|
161
189
|
* @returns {SuccessResponse}
|
|
190
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
|
|
162
191
|
*/
|
|
163
|
-
export interface CDepositRequest
|
|
192
|
+
export interface CDepositRequest {
|
|
193
|
+
/** Action to perform. */
|
|
164
194
|
action: {
|
|
165
195
|
/** Type of action. */
|
|
166
196
|
type: "cDeposit";
|
|
@@ -173,26 +203,36 @@ export interface CDepositRequest extends BaseExchangeRequest {
|
|
|
173
203
|
/** Unique request identifier (current timestamp in ms). */
|
|
174
204
|
nonce: number;
|
|
175
205
|
};
|
|
176
|
-
|
|
177
|
-
|
|
206
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
207
|
+
nonce: number;
|
|
208
|
+
/** Cryptographic signature. */
|
|
209
|
+
signature: Signature;
|
|
178
210
|
}
|
|
179
211
|
/**
|
|
180
212
|
* Claim rewards from referral program.
|
|
181
213
|
* @returns {SuccessResponse}
|
|
214
|
+
* @see null
|
|
182
215
|
*/
|
|
183
|
-
export interface ClaimRewardsRequest
|
|
216
|
+
export interface ClaimRewardsRequest {
|
|
217
|
+
/** Action to perform. */
|
|
184
218
|
action: {
|
|
185
219
|
/** Type of action. */
|
|
186
220
|
type: "claimRewards";
|
|
187
221
|
};
|
|
188
|
-
|
|
189
|
-
|
|
222
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
223
|
+
nonce: number;
|
|
224
|
+
/** Cryptographic signature. */
|
|
225
|
+
signature: Signature;
|
|
226
|
+
/** Expiration time of the action. */
|
|
227
|
+
expiresAfter?: number;
|
|
190
228
|
}
|
|
191
229
|
/**
|
|
192
230
|
* Convert a single-signature account to a multi-signature account.
|
|
193
231
|
* @returns {SuccessResponse}
|
|
232
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
194
233
|
*/
|
|
195
|
-
export interface ConvertToMultiSigUserRequest
|
|
234
|
+
export interface ConvertToMultiSigUserRequest {
|
|
235
|
+
/** Action to perform. */
|
|
196
236
|
action: {
|
|
197
237
|
/** Type of action. */
|
|
198
238
|
type: "convertToMultiSigUser";
|
|
@@ -203,17 +243,43 @@ export interface ConvertToMultiSigUserRequest extends BaseExchangeRequest {
|
|
|
203
243
|
/**
|
|
204
244
|
* Signers configuration.
|
|
205
245
|
*
|
|
206
|
-
* Must be {@linkcode
|
|
246
|
+
* Must be {@linkcode ConvertToMultiSigUserRequestSigners} converted to a string via `JSON.stringify(...)`.
|
|
207
247
|
*/
|
|
208
248
|
signers: string;
|
|
209
249
|
/** Unique request identifier (current timestamp in ms). */
|
|
210
250
|
nonce: number;
|
|
211
251
|
};
|
|
212
|
-
|
|
213
|
-
|
|
252
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
253
|
+
nonce: number;
|
|
254
|
+
/** Cryptographic signature. */
|
|
255
|
+
signature: Signature;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Convert a single-signature account to a multi-signature account (without JSON.stringify).
|
|
259
|
+
* @returns {SuccessResponse}
|
|
260
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
261
|
+
*/
|
|
262
|
+
export interface ConvertToMultiSigUserRequestWithoutStringify {
|
|
263
|
+
/** Action to perform. */
|
|
264
|
+
action: {
|
|
265
|
+
/** Type of action. */
|
|
266
|
+
type: "convertToMultiSigUser";
|
|
267
|
+
/** Chain ID used for signing. */
|
|
268
|
+
signatureChainId: Hex;
|
|
269
|
+
/** HyperLiquid network. */
|
|
270
|
+
hyperliquidChain: "Mainnet" | "Testnet";
|
|
271
|
+
/** Signers configuration. */
|
|
272
|
+
signers: ConvertToMultiSigUserRequestSigners;
|
|
273
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
274
|
+
nonce: number;
|
|
275
|
+
};
|
|
276
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
277
|
+
nonce: number;
|
|
278
|
+
/** Cryptographic signature. */
|
|
279
|
+
signature: Signature;
|
|
214
280
|
}
|
|
215
281
|
/** Signers configuration for {@linkcode ConvertToMultiSigUserRequest}. */
|
|
216
|
-
export type
|
|
282
|
+
export type ConvertToMultiSigUserRequestSigners = {
|
|
217
283
|
/** List of authorized user addresses. */
|
|
218
284
|
authorizedUsers: Hex[];
|
|
219
285
|
/** Minimum number of signatures required. */
|
|
@@ -224,22 +290,30 @@ export type ConvertToMultiSigUserRequest_Signers = {
|
|
|
224
290
|
/**
|
|
225
291
|
* Create a sub-account.
|
|
226
292
|
* @returns {CreateSubAccountResponse}
|
|
293
|
+
* @see null
|
|
227
294
|
*/
|
|
228
|
-
export interface CreateSubAccountRequest
|
|
295
|
+
export interface CreateSubAccountRequest {
|
|
296
|
+
/** Action to perform. */
|
|
229
297
|
action: {
|
|
230
298
|
/** Type of action. */
|
|
231
299
|
type: "createSubAccount";
|
|
232
300
|
/** Sub-account name. */
|
|
233
301
|
name: string;
|
|
234
302
|
};
|
|
235
|
-
|
|
236
|
-
|
|
303
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
304
|
+
nonce: number;
|
|
305
|
+
/** Cryptographic signature. */
|
|
306
|
+
signature: Signature;
|
|
307
|
+
/** Expiration time of the action. */
|
|
308
|
+
expiresAfter?: number;
|
|
237
309
|
}
|
|
238
310
|
/**
|
|
239
311
|
* Create a vault.
|
|
240
312
|
* @returns {CreateVaultResponse}
|
|
313
|
+
* @see null
|
|
241
314
|
*/
|
|
242
|
-
export interface CreateVaultRequest
|
|
315
|
+
export interface CreateVaultRequest {
|
|
316
|
+
/** Action to perform. */
|
|
243
317
|
action: {
|
|
244
318
|
/** Type of action. */
|
|
245
319
|
type: "createVault";
|
|
@@ -252,75 +326,74 @@ export interface CreateVaultRequest extends BaseExchangeRequest {
|
|
|
252
326
|
/** Unique request identifier (current timestamp in ms). */
|
|
253
327
|
nonce: number;
|
|
254
328
|
};
|
|
255
|
-
|
|
256
|
-
|
|
329
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
330
|
+
nonce: number;
|
|
331
|
+
/** Cryptographic signature. */
|
|
332
|
+
signature: Signature;
|
|
333
|
+
/** Expiration time of the action. */
|
|
334
|
+
expiresAfter?: number;
|
|
257
335
|
}
|
|
258
336
|
/**
|
|
259
|
-
*
|
|
337
|
+
* Perform an action on a signer:
|
|
338
|
+
* - Jail to prevent them from signing transactions.
|
|
339
|
+
* - Unjail to allow them to sign transactions again.
|
|
260
340
|
* @returns {SuccessResponse}
|
|
341
|
+
* @see null
|
|
261
342
|
*/
|
|
262
|
-
export interface
|
|
343
|
+
export interface CSignerActionRequest {
|
|
344
|
+
/** Action to perform. */
|
|
263
345
|
action: {
|
|
264
346
|
/** Type of action. */
|
|
265
347
|
type: "CSignerAction";
|
|
266
348
|
/** Jail the signer. */
|
|
267
349
|
jailSelf: null;
|
|
268
|
-
}
|
|
269
|
-
vaultAddress?: undefined;
|
|
270
|
-
expiresAfter?: number;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Unjail a signer to allow them to sign transactions again.
|
|
274
|
-
* @returns {SuccessResponse}
|
|
275
|
-
*/
|
|
276
|
-
export interface CSignerActionRequest_UnjailSelf extends BaseExchangeRequest {
|
|
277
|
-
action: {
|
|
350
|
+
} | {
|
|
278
351
|
/** Type of action. */
|
|
279
352
|
type: "CSignerAction";
|
|
280
353
|
/** Unjail the signer. */
|
|
281
354
|
unjailSelf: null;
|
|
282
355
|
};
|
|
283
|
-
|
|
356
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
357
|
+
nonce: number;
|
|
358
|
+
/** Cryptographic signature. */
|
|
359
|
+
signature: Signature;
|
|
360
|
+
/** Expiration time of the action. */
|
|
284
361
|
expiresAfter?: number;
|
|
285
362
|
}
|
|
286
363
|
/**
|
|
287
|
-
*
|
|
364
|
+
* Perform an action on a validator:
|
|
365
|
+
* - Change profile information.
|
|
366
|
+
* - Register a new validator.
|
|
367
|
+
* - Unregister an existing validator.
|
|
288
368
|
* @returns {SuccessResponse}
|
|
369
|
+
* @see null
|
|
289
370
|
*/
|
|
290
|
-
export interface
|
|
371
|
+
export interface CValidatorActionRequest {
|
|
372
|
+
/** Action to perform. */
|
|
291
373
|
action: {
|
|
292
374
|
/** Type of action. */
|
|
293
375
|
type: "CValidatorAction";
|
|
294
376
|
/** Profile changes to apply. */
|
|
295
377
|
changeProfile: {
|
|
296
378
|
/** Validator node IP address. */
|
|
297
|
-
node_ip
|
|
379
|
+
node_ip: {
|
|
298
380
|
/** IP address. */
|
|
299
381
|
Ip: string;
|
|
300
382
|
} | null;
|
|
301
383
|
/** Validator name. */
|
|
302
|
-
name
|
|
384
|
+
name: string | null;
|
|
303
385
|
/** Validator description. */
|
|
304
|
-
description
|
|
386
|
+
description: string | null;
|
|
305
387
|
/** Validator jail status. */
|
|
306
388
|
unjailed: boolean;
|
|
307
389
|
/** Enable or disable delegations. */
|
|
308
|
-
disable_delegations
|
|
390
|
+
disable_delegations: boolean | null;
|
|
309
391
|
/** Commission rate in basis points (1 = 0.0001%). */
|
|
310
|
-
commission_bps
|
|
392
|
+
commission_bps: number | null;
|
|
311
393
|
/** Signer address. */
|
|
312
|
-
signer
|
|
394
|
+
signer: Hex | null;
|
|
313
395
|
};
|
|
314
|
-
}
|
|
315
|
-
vaultAddress?: undefined;
|
|
316
|
-
expiresAfter?: number;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Register a new validator.
|
|
320
|
-
* @returns {SuccessResponse}
|
|
321
|
-
*/
|
|
322
|
-
export interface CValidatorActionRequest_Register extends BaseExchangeRequest {
|
|
323
|
-
action: {
|
|
396
|
+
} | {
|
|
324
397
|
/** Type of action. */
|
|
325
398
|
type: "CValidatorAction";
|
|
326
399
|
/** Registration parameters. */
|
|
@@ -348,29 +421,26 @@ export interface CValidatorActionRequest_Register extends BaseExchangeRequest {
|
|
|
348
421
|
/** Initial stake amount in wei. */
|
|
349
422
|
initial_wei: number;
|
|
350
423
|
};
|
|
351
|
-
}
|
|
352
|
-
vaultAddress?: undefined;
|
|
353
|
-
expiresAfter?: number;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Unregister an existing validator.
|
|
357
|
-
* @returns {SuccessResponse}
|
|
358
|
-
*/
|
|
359
|
-
export interface CValidatorActionRequest_Unregister extends BaseExchangeRequest {
|
|
360
|
-
action: {
|
|
424
|
+
} | {
|
|
361
425
|
/** Type of action. */
|
|
362
426
|
type: "CValidatorAction";
|
|
363
427
|
/** Unregister the validator. */
|
|
364
428
|
unregister: null;
|
|
365
429
|
};
|
|
366
|
-
|
|
430
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
431
|
+
nonce: number;
|
|
432
|
+
/** Cryptographic signature. */
|
|
433
|
+
signature: Signature;
|
|
434
|
+
/** Expiration time of the action. */
|
|
367
435
|
expiresAfter?: number;
|
|
368
436
|
}
|
|
369
437
|
/**
|
|
370
|
-
* Transfer native token from staking into the user
|
|
438
|
+
* Transfer native token from staking into the user spot account.
|
|
371
439
|
* @returns {SuccessResponse}
|
|
440
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
|
|
372
441
|
*/
|
|
373
|
-
export interface CWithdrawRequest
|
|
442
|
+
export interface CWithdrawRequest {
|
|
443
|
+
/** Action to perform. */
|
|
374
444
|
action: {
|
|
375
445
|
/** Type of action. */
|
|
376
446
|
type: "cWithdraw";
|
|
@@ -383,73 +453,113 @@ export interface CWithdrawRequest extends BaseExchangeRequest {
|
|
|
383
453
|
/** Unique request identifier (current timestamp in ms). */
|
|
384
454
|
nonce: number;
|
|
385
455
|
};
|
|
386
|
-
|
|
387
|
-
|
|
456
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
457
|
+
nonce: number;
|
|
458
|
+
/** Cryptographic signature. */
|
|
459
|
+
signature: Signature;
|
|
388
460
|
}
|
|
389
461
|
/**
|
|
390
462
|
* Configure block type for EVM transactions.
|
|
391
463
|
* @returns {SuccessResponse}
|
|
464
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/dual-block-architecture
|
|
392
465
|
*/
|
|
393
|
-
export interface EvmUserModifyRequest
|
|
466
|
+
export interface EvmUserModifyRequest {
|
|
467
|
+
/** Action to perform. */
|
|
394
468
|
action: {
|
|
395
469
|
/** Type of action. */
|
|
396
470
|
type: "evmUserModify";
|
|
397
471
|
/** `true` for large blocks, `false` for small blocks. */
|
|
398
472
|
usingBigBlocks: boolean;
|
|
399
473
|
};
|
|
400
|
-
|
|
401
|
-
|
|
474
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
475
|
+
nonce: number;
|
|
476
|
+
/** Cryptographic signature. */
|
|
477
|
+
signature: Signature;
|
|
478
|
+
/** Expiration time of the action. */
|
|
479
|
+
expiresAfter?: number;
|
|
402
480
|
}
|
|
403
481
|
/**
|
|
404
482
|
* Modify an order.
|
|
405
483
|
* @returns {SuccessResponse}
|
|
484
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
406
485
|
*/
|
|
407
|
-
export interface ModifyRequest
|
|
486
|
+
export interface ModifyRequest {
|
|
487
|
+
/** Action to perform. */
|
|
408
488
|
action: {
|
|
409
489
|
/** Type of action. */
|
|
410
490
|
type: "modify";
|
|
411
|
-
/** Order ID or
|
|
491
|
+
/** Order ID or Client Order ID. */
|
|
412
492
|
oid: number | Hex;
|
|
413
493
|
/** New order parameters. */
|
|
414
494
|
order: OrderParams;
|
|
415
495
|
};
|
|
496
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
497
|
+
nonce: number;
|
|
498
|
+
/** Cryptographic signature. */
|
|
499
|
+
signature: Signature;
|
|
500
|
+
/** Vault address (for vault trading). */
|
|
416
501
|
vaultAddress?: Hex;
|
|
502
|
+
/** Expiration time of the action. */
|
|
417
503
|
expiresAfter?: number;
|
|
418
504
|
}
|
|
419
505
|
/**
|
|
420
506
|
* A multi-signature request.
|
|
421
507
|
* @returns {SuccessResponse}
|
|
508
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
422
509
|
*/
|
|
423
|
-
export interface MultiSigRequest
|
|
510
|
+
export interface MultiSigRequest {
|
|
511
|
+
/** Action to perform. */
|
|
424
512
|
action: {
|
|
425
513
|
/** Type of action. */
|
|
426
514
|
type: "multiSig";
|
|
427
515
|
/** Chain ID used for signing. */
|
|
428
516
|
signatureChainId: Hex;
|
|
429
517
|
/** List of signatures from authorized signers. */
|
|
430
|
-
signatures:
|
|
431
|
-
r: Hex;
|
|
432
|
-
s: Hex;
|
|
433
|
-
v: number;
|
|
434
|
-
}[];
|
|
518
|
+
signatures: Signature[];
|
|
435
519
|
/** Multi-signature payload information. */
|
|
436
520
|
payload: {
|
|
437
521
|
/** Address of the multi-signature user account. */
|
|
438
522
|
multiSigUser: Hex;
|
|
439
|
-
/** Address of the authorized user initiating the request. */
|
|
523
|
+
/** Address of the authorized user initiating the request (any authorized user). */
|
|
440
524
|
outerSigner: Hex;
|
|
441
525
|
/** The underlying action to be executed through multi-sig. */
|
|
442
|
-
action:
|
|
526
|
+
action: ApproveAgentRequest["action"] | ApproveBuilderFeeRequest["action"] | BatchModifyRequest["action"] | CancelRequest["action"] | CancelByCloidRequest["action"] | CDepositRequest["action"] | ClaimRewardsRequest["action"] | (ConvertToMultiSigUserRequest["action"] | ConvertToMultiSigUserRequestWithoutStringify["action"]) | CreateSubAccountRequest["action"] | CreateVaultRequest["action"] | CSignerActionRequest["action"] | CValidatorActionRequest["action"] | CWithdrawRequest["action"] | EvmUserModifyRequest["action"] | ModifyRequest["action"] | NoopRequest["action"] | MultiSigRequest["action"] | OrderRequest["action"] | PerpDeployRequest["action"] | RegisterReferrerRequest["action"] | ReserveRequestWeightRequest["action"] | ScheduleCancelRequest["action"] | SendAssetRequest["action"] | SetDisplayNameRequest["action"] | SetReferrerRequest["action"] | SpotDeployRequest["action"] | SpotSendRequest["action"] | SpotUserRequest["action"] | SubAccountModifyRequest["action"] | SubAccountSpotTransferRequest["action"] | SubAccountTransferRequest["action"] | TokenDelegateRequest["action"] | TwapCancelRequest["action"] | TwapOrderRequest["action"] | UpdateIsolatedMarginRequest["action"] | UpdateLeverageRequest["action"] | UsdClassTransferRequest["action"] | UsdSendRequest["action"] | VaultDistributeRequest["action"] | VaultModifyRequest["action"] | VaultTransferRequest["action"] | Withdraw3Request["action"];
|
|
443
527
|
};
|
|
444
528
|
};
|
|
529
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
530
|
+
nonce: number;
|
|
531
|
+
/** Cryptographic signature. */
|
|
532
|
+
signature: Signature;
|
|
533
|
+
/** Vault address (for vault trading). */
|
|
445
534
|
vaultAddress?: Hex;
|
|
535
|
+
/** Expiration time of the action. */
|
|
536
|
+
expiresAfter?: number;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* This action does not do anything (no operation), but causes the nonce to be marked as used.
|
|
540
|
+
* @returns {SuccessResponse}
|
|
541
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#invalidate-pending-nonce-noop
|
|
542
|
+
*/
|
|
543
|
+
export interface NoopRequest {
|
|
544
|
+
/** Action to perform. */
|
|
545
|
+
action: {
|
|
546
|
+
/** Type of action. */
|
|
547
|
+
type: "noop";
|
|
548
|
+
};
|
|
549
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
550
|
+
nonce: number;
|
|
551
|
+
/** Cryptographic signature. */
|
|
552
|
+
signature: Signature;
|
|
553
|
+
/** Expiration time of the action. */
|
|
446
554
|
expiresAfter?: number;
|
|
447
555
|
}
|
|
448
556
|
/**
|
|
449
557
|
* Place an order(s).
|
|
450
558
|
* @returns {OrderResponse}
|
|
559
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
|
451
560
|
*/
|
|
452
|
-
export interface OrderRequest
|
|
561
|
+
export interface OrderRequest {
|
|
562
|
+
/** Action to perform. */
|
|
453
563
|
action: {
|
|
454
564
|
/** Type of action. */
|
|
455
565
|
type: "order";
|
|
@@ -470,154 +580,126 @@ export interface OrderRequest extends BaseExchangeRequest {
|
|
|
470
580
|
f: number;
|
|
471
581
|
};
|
|
472
582
|
};
|
|
583
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
584
|
+
nonce: number;
|
|
585
|
+
/** Cryptographic signature. */
|
|
586
|
+
signature: Signature;
|
|
587
|
+
/** Vault address (for vault trading). */
|
|
473
588
|
vaultAddress?: Hex;
|
|
589
|
+
/** Expiration time of the action. */
|
|
474
590
|
expiresAfter?: number;
|
|
475
591
|
}
|
|
476
592
|
/**
|
|
477
|
-
* Deploying HIP-3 assets
|
|
593
|
+
* Deploying HIP-3 assets:
|
|
594
|
+
* - Register Asset
|
|
595
|
+
* - Set Oracle
|
|
478
596
|
* @returns {SuccessResponse}
|
|
597
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-3-assets
|
|
479
598
|
*/
|
|
480
|
-
export interface
|
|
599
|
+
export interface PerpDeployRequest {
|
|
600
|
+
/** Action to perform. */
|
|
481
601
|
action: {
|
|
482
602
|
/** Type of action. */
|
|
483
603
|
type: "perpDeploy";
|
|
484
604
|
/** Parameters for registering a new perpetual asset. */
|
|
485
605
|
registerAsset: {
|
|
486
606
|
/** Max gas in native token wei. If not provided, then uses current deploy auction price. */
|
|
487
|
-
maxGas
|
|
607
|
+
maxGas: number | null;
|
|
488
608
|
/** Contains new asset listing parameters. */
|
|
489
609
|
assetRequest: {
|
|
490
610
|
/** Coin symbol for the new asset. */
|
|
491
611
|
coin: string;
|
|
492
612
|
/** Number of decimal places for size. */
|
|
493
613
|
szDecimals: number;
|
|
494
|
-
/**
|
|
614
|
+
/**
|
|
615
|
+
* Initial oracle price for the asset.
|
|
616
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
617
|
+
*/
|
|
495
618
|
oraclePx: string;
|
|
496
619
|
/** Margin table identifier for risk management. */
|
|
497
620
|
marginTableId: number;
|
|
498
621
|
/** Whether the asset can only be traded with isolated margin. */
|
|
499
622
|
onlyIsolated: boolean;
|
|
500
623
|
};
|
|
501
|
-
/** Name of the
|
|
624
|
+
/** Name of the dex. */
|
|
502
625
|
dex: string;
|
|
503
|
-
/** Contains new
|
|
504
|
-
schema
|
|
505
|
-
/** Full name of the
|
|
626
|
+
/** Contains new dex parameters. */
|
|
627
|
+
schema: {
|
|
628
|
+
/** Full name of the dex. */
|
|
506
629
|
fullName: string;
|
|
507
630
|
/** Collateral token index. */
|
|
508
631
|
collateralToken: number;
|
|
509
632
|
/** User to update oracles. If not provided, then deployer is assumed to be oracle updater. */
|
|
510
|
-
oracleUpdater
|
|
633
|
+
oracleUpdater: Hex | null;
|
|
511
634
|
} | null;
|
|
512
635
|
};
|
|
513
|
-
}
|
|
514
|
-
vaultAddress?: undefined;
|
|
515
|
-
expiresAfter?: undefined;
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Deploying HIP-3 assets (Set Oracle).
|
|
519
|
-
* @returns {SuccessResponse}
|
|
520
|
-
*/
|
|
521
|
-
export interface PerpDeployRequest_SetOracle extends BaseExchangeRequest {
|
|
522
|
-
action: {
|
|
636
|
+
} | {
|
|
523
637
|
/** Type of action. */
|
|
524
638
|
type: "perpDeploy";
|
|
525
639
|
/** Parameters for setting oracle and mark prices for assets. */
|
|
526
640
|
setOracle: {
|
|
527
|
-
/** Name of the
|
|
641
|
+
/** Name of the dex. */
|
|
528
642
|
dex: string;
|
|
529
643
|
/** A list (sorted by key) of asset and oracle prices. */
|
|
530
644
|
oraclePxs: [string, string][];
|
|
531
|
-
/**
|
|
532
|
-
markPxs: [string, string][];
|
|
645
|
+
/** An outer list of inner lists (inner list sorted by key) of asset and mark prices. */
|
|
646
|
+
markPxs: [string, string][][];
|
|
533
647
|
};
|
|
534
648
|
};
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
*/
|
|
542
|
-
export interface PerpDexClassTransferRequest extends BaseExchangeRequest {
|
|
543
|
-
action: {
|
|
544
|
-
/** Type of action. */
|
|
545
|
-
type: "PerpDexClassTransfer";
|
|
546
|
-
/** Chain ID used for signing. */
|
|
547
|
-
signatureChainId: Hex;
|
|
548
|
-
/** HyperLiquid network. */
|
|
549
|
-
hyperliquidChain: "Mainnet" | "Testnet";
|
|
550
|
-
/** Name of perp dex. */
|
|
551
|
-
dex: string;
|
|
552
|
-
/** Collateral token of the perp dex as a string. */
|
|
553
|
-
token: string;
|
|
554
|
-
/** Amount of collateral token to transfer (1 = 1$). */
|
|
555
|
-
amount: string;
|
|
556
|
-
/** `true` for transferring from perp dex to spot account, `false` for transferring from spot account to perp dex. */
|
|
557
|
-
toPerp: boolean;
|
|
558
|
-
/** Unique request identifier (current timestamp in ms). */
|
|
559
|
-
nonce: number;
|
|
560
|
-
};
|
|
561
|
-
vaultAddress?: undefined;
|
|
562
|
-
expiresAfter?: undefined;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Transfer collateral tokens between different perp dexes for the same user.
|
|
566
|
-
* @returns {SuccessResponse}
|
|
567
|
-
*/
|
|
568
|
-
export interface PerpDexTransferRequest extends BaseExchangeRequest {
|
|
569
|
-
action: {
|
|
570
|
-
/** Type of action. */
|
|
571
|
-
type: "PerpDexTransfer";
|
|
572
|
-
/** Chain ID used for signing. */
|
|
573
|
-
signatureChainId: Hex;
|
|
574
|
-
/** HyperLiquid network. */
|
|
575
|
-
hyperliquidChain: "Mainnet" | "Testnet";
|
|
576
|
-
/** Source perp dex name (empty string for main dex). */
|
|
577
|
-
sourceDex: string;
|
|
578
|
-
/** Destination perp dex name (empty string for main dex). */
|
|
579
|
-
destinationDex: string;
|
|
580
|
-
/** Amount to transfer (1 = 1$). */
|
|
581
|
-
amount: string;
|
|
582
|
-
/** Unique request identifier (current timestamp in ms). */
|
|
583
|
-
nonce: number;
|
|
584
|
-
};
|
|
585
|
-
vaultAddress?: undefined;
|
|
586
|
-
expiresAfter?: undefined;
|
|
649
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
650
|
+
nonce: number;
|
|
651
|
+
/** Cryptographic signature. */
|
|
652
|
+
signature: Signature;
|
|
653
|
+
/** Expiration time of the action. */
|
|
654
|
+
expiresAfter?: number;
|
|
587
655
|
}
|
|
588
656
|
/**
|
|
589
657
|
* Create a referral code.
|
|
590
658
|
* @returns {SuccessResponse}
|
|
659
|
+
* @see null
|
|
591
660
|
*/
|
|
592
|
-
export interface RegisterReferrerRequest
|
|
661
|
+
export interface RegisterReferrerRequest {
|
|
662
|
+
/** Action to perform. */
|
|
593
663
|
action: {
|
|
594
664
|
/** Type of action. */
|
|
595
665
|
type: "registerReferrer";
|
|
596
666
|
/** Referral code to create. */
|
|
597
667
|
code: string;
|
|
598
668
|
};
|
|
599
|
-
|
|
600
|
-
|
|
669
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
670
|
+
nonce: number;
|
|
671
|
+
/** Cryptographic signature. */
|
|
672
|
+
signature: Signature;
|
|
673
|
+
/** Expiration time of the action. */
|
|
674
|
+
expiresAfter?: number;
|
|
601
675
|
}
|
|
602
676
|
/**
|
|
603
677
|
* Reserve additional rate-limited actions for a fee.
|
|
604
678
|
* @returns {SuccessResponse}
|
|
679
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#reserve-additional-actions
|
|
605
680
|
*/
|
|
606
|
-
export interface ReserveRequestWeightRequest
|
|
681
|
+
export interface ReserveRequestWeightRequest {
|
|
682
|
+
/** Action to perform. */
|
|
607
683
|
action: {
|
|
608
684
|
/** Type of action. */
|
|
609
685
|
type: "reserveRequestWeight";
|
|
610
686
|
/** Amount of request weight to reserve. */
|
|
611
687
|
weight: number;
|
|
612
688
|
};
|
|
613
|
-
|
|
689
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
690
|
+
nonce: number;
|
|
691
|
+
/** Cryptographic signature. */
|
|
692
|
+
signature: Signature;
|
|
693
|
+
/** Expiration time of the action. */
|
|
614
694
|
expiresAfter?: number;
|
|
615
695
|
}
|
|
616
696
|
/**
|
|
617
697
|
* Schedule a cancel-all operation at a future time.
|
|
618
698
|
* @returns {SuccessResponse}
|
|
699
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
|
|
619
700
|
*/
|
|
620
|
-
export interface ScheduleCancelRequest
|
|
701
|
+
export interface ScheduleCancelRequest {
|
|
702
|
+
/** Action to perform. */
|
|
621
703
|
action: {
|
|
622
704
|
/** Type of action. */
|
|
623
705
|
type: "scheduleCancel";
|
|
@@ -629,14 +711,59 @@ export interface ScheduleCancelRequest extends BaseExchangeRequest {
|
|
|
629
711
|
*/
|
|
630
712
|
time?: number;
|
|
631
713
|
};
|
|
714
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
715
|
+
nonce: number;
|
|
716
|
+
/** Cryptographic signature. */
|
|
717
|
+
signature: Signature;
|
|
718
|
+
/** Vault address (for vault trading). */
|
|
632
719
|
vaultAddress?: Hex;
|
|
720
|
+
/** Expiration time of the action. */
|
|
633
721
|
expiresAfter?: number;
|
|
634
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
* Transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts.
|
|
725
|
+
* @returns {SuccessResponse}
|
|
726
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#send-asset-testnet-only
|
|
727
|
+
*/
|
|
728
|
+
export interface SendAssetRequest {
|
|
729
|
+
/** Action to perform. */
|
|
730
|
+
action: {
|
|
731
|
+
/** Type of action. */
|
|
732
|
+
type: "sendAsset";
|
|
733
|
+
/** Chain ID used for signing. */
|
|
734
|
+
signatureChainId: Hex;
|
|
735
|
+
/** HyperLiquid network. */
|
|
736
|
+
hyperliquidChain: "Mainnet" | "Testnet";
|
|
737
|
+
/** Destination address. */
|
|
738
|
+
destination: Hex;
|
|
739
|
+
/** Source DEX ("" for default USDC perp DEX, "spot" for spot). */
|
|
740
|
+
sourceDex: string | "";
|
|
741
|
+
/** Destination DEX ("" for default USDC perp DEX, "spot" for spot). */
|
|
742
|
+
destinationDex: string | "";
|
|
743
|
+
/** Token identifier. */
|
|
744
|
+
token: `${string}:${Hex}`;
|
|
745
|
+
/**
|
|
746
|
+
* Amount to send (not in wei).
|
|
747
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
748
|
+
*/
|
|
749
|
+
amount: string;
|
|
750
|
+
/** Source sub-account address ("" for main account). */
|
|
751
|
+
fromSubAccount: Hex | "";
|
|
752
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
753
|
+
nonce: number;
|
|
754
|
+
};
|
|
755
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
756
|
+
nonce: number;
|
|
757
|
+
/** Cryptographic signature. */
|
|
758
|
+
signature: Signature;
|
|
759
|
+
}
|
|
635
760
|
/**
|
|
636
761
|
* Set the display name in the leaderboard.
|
|
637
762
|
* @returns {SuccessResponse}
|
|
763
|
+
* @see null
|
|
638
764
|
*/
|
|
639
|
-
export interface SetDisplayNameRequest
|
|
765
|
+
export interface SetDisplayNameRequest {
|
|
766
|
+
/** Action to perform. */
|
|
640
767
|
action: {
|
|
641
768
|
/** Type of action. */
|
|
642
769
|
type: "setDisplayName";
|
|
@@ -647,28 +774,46 @@ export interface SetDisplayNameRequest extends BaseExchangeRequest {
|
|
|
647
774
|
*/
|
|
648
775
|
displayName: string;
|
|
649
776
|
};
|
|
650
|
-
|
|
651
|
-
|
|
777
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
778
|
+
nonce: number;
|
|
779
|
+
/** Cryptographic signature. */
|
|
780
|
+
signature: Signature;
|
|
781
|
+
/** Expiration time of the action. */
|
|
782
|
+
expiresAfter?: number;
|
|
652
783
|
}
|
|
653
784
|
/**
|
|
654
785
|
* Set a referral code.
|
|
655
786
|
* @returns {SuccessResponse}
|
|
787
|
+
* @see null
|
|
656
788
|
*/
|
|
657
|
-
export interface SetReferrerRequest
|
|
789
|
+
export interface SetReferrerRequest {
|
|
790
|
+
/** Action to perform. */
|
|
658
791
|
action: {
|
|
659
792
|
/** Type of action. */
|
|
660
793
|
type: "setReferrer";
|
|
661
794
|
/** Referral code. */
|
|
662
795
|
code: string;
|
|
663
796
|
};
|
|
664
|
-
|
|
665
|
-
|
|
797
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
798
|
+
nonce: number;
|
|
799
|
+
/** Cryptographic signature. */
|
|
800
|
+
signature: Signature;
|
|
801
|
+
/** Expiration time of the action. */
|
|
802
|
+
expiresAfter?: number;
|
|
666
803
|
}
|
|
667
804
|
/**
|
|
668
|
-
* Deploying HIP-1 and HIP-2 assets
|
|
805
|
+
* Deploying HIP-1 and HIP-2 assets:
|
|
806
|
+
* - Genesis
|
|
807
|
+
* - Register Hyperliquidity
|
|
808
|
+
* - Register Spot
|
|
809
|
+
* - Register Token2
|
|
810
|
+
* - Set Deployer Trading Fee Share
|
|
811
|
+
* - User Genesis
|
|
669
812
|
* @returns {SuccessResponse}
|
|
813
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets
|
|
670
814
|
*/
|
|
671
|
-
export interface
|
|
815
|
+
export interface SpotDeployRequest {
|
|
816
|
+
/** Action to perform. */
|
|
672
817
|
action: {
|
|
673
818
|
/** Type of action. */
|
|
674
819
|
type: "spotDeploy";
|
|
@@ -676,46 +821,37 @@ export interface SpotDeployRequest_Genesis extends BaseExchangeRequest {
|
|
|
676
821
|
genesis: {
|
|
677
822
|
/** Token identifier. */
|
|
678
823
|
token: number;
|
|
679
|
-
/**
|
|
824
|
+
/**
|
|
825
|
+
* Maximum token supply.
|
|
826
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
827
|
+
*/
|
|
680
828
|
maxSupply: string;
|
|
681
829
|
/** Set hyperliquidity balance to 0. */
|
|
682
830
|
noHyperliquidity?: true;
|
|
683
831
|
};
|
|
684
|
-
}
|
|
685
|
-
vaultAddress?: undefined;
|
|
686
|
-
expiresAfter?: undefined;
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* Deploying HIP-1 and HIP-2 assets (Register Hyperliquidity).
|
|
690
|
-
* @returns {SuccessResponse}
|
|
691
|
-
*/
|
|
692
|
-
export interface SpotDeployRequest_RegisterHyperliquidity extends BaseExchangeRequest {
|
|
693
|
-
action: {
|
|
832
|
+
} | {
|
|
694
833
|
/** Type of action. */
|
|
695
834
|
type: "spotDeploy";
|
|
696
835
|
/** Register hyperliquidity parameters. */
|
|
697
836
|
registerHyperliquidity: {
|
|
698
837
|
/** Spot index (distinct from base token index). */
|
|
699
838
|
spot: number;
|
|
700
|
-
/**
|
|
839
|
+
/**
|
|
840
|
+
* Starting price for liquidity seeding.
|
|
841
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
842
|
+
*/
|
|
701
843
|
startPx: string;
|
|
702
|
-
/**
|
|
844
|
+
/**
|
|
845
|
+
* Order size as a float (not in wei).
|
|
846
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
847
|
+
*/
|
|
703
848
|
orderSz: string;
|
|
704
849
|
/** Total number of orders to place. */
|
|
705
850
|
nOrders: number;
|
|
706
851
|
/** Number of levels to seed with USDC. */
|
|
707
852
|
nSeededLevels?: number;
|
|
708
853
|
};
|
|
709
|
-
}
|
|
710
|
-
vaultAddress?: undefined;
|
|
711
|
-
expiresAfter?: undefined;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Deploying HIP-1 and HIP-2 assets (Register Spot).
|
|
715
|
-
* @returns {SuccessResponse}
|
|
716
|
-
*/
|
|
717
|
-
export interface SpotDeployRequest_RegisterSpot extends BaseExchangeRequest {
|
|
718
|
-
action: {
|
|
854
|
+
} | {
|
|
719
855
|
/** Type of action. */
|
|
720
856
|
type: "spotDeploy";
|
|
721
857
|
/** Register spot parameters. */
|
|
@@ -723,16 +859,7 @@ export interface SpotDeployRequest_RegisterSpot extends BaseExchangeRequest {
|
|
|
723
859
|
/** Tuple containing base and quote token indices. */
|
|
724
860
|
tokens: [number, number];
|
|
725
861
|
};
|
|
726
|
-
}
|
|
727
|
-
vaultAddress?: undefined;
|
|
728
|
-
expiresAfter?: undefined;
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* Deploying HIP-1 and HIP-2 assets (Register Token).
|
|
732
|
-
* @returns {SuccessResponse}
|
|
733
|
-
*/
|
|
734
|
-
export interface SpotDeployRequest_RegisterToken2 extends BaseExchangeRequest {
|
|
735
|
-
action: {
|
|
862
|
+
} | {
|
|
736
863
|
/** Type of action. */
|
|
737
864
|
type: "spotDeploy";
|
|
738
865
|
/** Register token parameters. */
|
|
@@ -751,35 +878,17 @@ export interface SpotDeployRequest_RegisterToken2 extends BaseExchangeRequest {
|
|
|
751
878
|
/** Optional full token name. */
|
|
752
879
|
fullName?: string;
|
|
753
880
|
};
|
|
754
|
-
}
|
|
755
|
-
vaultAddress?: undefined;
|
|
756
|
-
expiresAfter?: undefined;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Deploying HIP-1 and HIP-2 assets (Set Deployer Trading Fee Share).
|
|
760
|
-
* @returns {SuccessResponse}
|
|
761
|
-
*/
|
|
762
|
-
export interface SpotDeployRequest_SetDeployerTradingFeeShare extends BaseExchangeRequest {
|
|
763
|
-
action: {
|
|
881
|
+
} | {
|
|
764
882
|
/** Type of action. */
|
|
765
883
|
type: "spotDeploy";
|
|
766
884
|
/** Set deployer trading fee share parameters. */
|
|
767
885
|
setDeployerTradingFeeShare: {
|
|
768
886
|
/** Token identifier. */
|
|
769
887
|
token: number;
|
|
770
|
-
/**
|
|
888
|
+
/** The deployer trading fee share. Range is 0% to 100%. */
|
|
771
889
|
share: `${string}%`;
|
|
772
890
|
};
|
|
773
|
-
}
|
|
774
|
-
vaultAddress?: undefined;
|
|
775
|
-
expiresAfter?: undefined;
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Deploying HIP-1 and HIP-2 assets (User Genesis).
|
|
779
|
-
* @returns {SuccessResponse}
|
|
780
|
-
*/
|
|
781
|
-
export interface SpotDeployRequest_UserGenesis extends BaseExchangeRequest {
|
|
782
|
-
action: {
|
|
891
|
+
} | {
|
|
783
892
|
/** Type of action. */
|
|
784
893
|
type: "spotDeploy";
|
|
785
894
|
/** User genesis parameters. */
|
|
@@ -787,21 +896,27 @@ export interface SpotDeployRequest_UserGenesis extends BaseExchangeRequest {
|
|
|
787
896
|
/** Token identifier. */
|
|
788
897
|
token: number;
|
|
789
898
|
/** Array of tuples: [user address, genesis amount in wei]. */
|
|
790
|
-
userAndWei: [
|
|
899
|
+
userAndWei: [Hex, string][];
|
|
791
900
|
/** Array of tuples: [existing token identifier, genesis amount in wei]. */
|
|
792
901
|
existingTokenAndWei: [number, string][];
|
|
793
902
|
/** Array of tuples: [user address, blacklist status] (`true` for blacklist, `false` to remove existing blacklisted user). */
|
|
794
|
-
blacklistUsers?: [
|
|
903
|
+
blacklistUsers?: [Hex, boolean][];
|
|
795
904
|
};
|
|
796
905
|
};
|
|
797
|
-
|
|
798
|
-
|
|
906
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
907
|
+
nonce: number;
|
|
908
|
+
/** Cryptographic signature. */
|
|
909
|
+
signature: Signature;
|
|
910
|
+
/** Expiration time of the action. */
|
|
911
|
+
expiresAfter?: number;
|
|
799
912
|
}
|
|
800
913
|
/**
|
|
801
914
|
* Send spot assets to another address.
|
|
802
915
|
* @returns {SuccessResponse}
|
|
916
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-spot-transfer
|
|
803
917
|
*/
|
|
804
|
-
export interface SpotSendRequest
|
|
918
|
+
export interface SpotSendRequest {
|
|
919
|
+
/** Action to perform. */
|
|
805
920
|
action: {
|
|
806
921
|
/** Type of action. */
|
|
807
922
|
type: "spotSend";
|
|
@@ -813,19 +928,26 @@ export interface SpotSendRequest extends BaseExchangeRequest {
|
|
|
813
928
|
destination: Hex;
|
|
814
929
|
/** Token identifier. */
|
|
815
930
|
token: `${string}:${Hex}`;
|
|
816
|
-
/**
|
|
931
|
+
/**
|
|
932
|
+
* Amount to send (not in wei).
|
|
933
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
934
|
+
*/
|
|
817
935
|
amount: string;
|
|
818
936
|
/** Unique request identifier (current timestamp in ms). */
|
|
819
937
|
time: number;
|
|
820
938
|
};
|
|
821
|
-
|
|
822
|
-
|
|
939
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
940
|
+
nonce: number;
|
|
941
|
+
/** Cryptographic signature. */
|
|
942
|
+
signature: Signature;
|
|
823
943
|
}
|
|
824
944
|
/**
|
|
825
945
|
* Opt Out of Spot Dusting.
|
|
826
946
|
* @returns {SuccessResponse}
|
|
947
|
+
* @see null
|
|
827
948
|
*/
|
|
828
|
-
export interface SpotUserRequest
|
|
949
|
+
export interface SpotUserRequest {
|
|
950
|
+
/** Action to perform. */
|
|
829
951
|
action: {
|
|
830
952
|
/** Type of action. */
|
|
831
953
|
type: "spotUser";
|
|
@@ -835,14 +957,42 @@ export interface SpotUserRequest extends BaseExchangeRequest {
|
|
|
835
957
|
optOut: boolean;
|
|
836
958
|
};
|
|
837
959
|
};
|
|
838
|
-
|
|
839
|
-
|
|
960
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
961
|
+
nonce: number;
|
|
962
|
+
/** Cryptographic signature. */
|
|
963
|
+
signature: Signature;
|
|
964
|
+
/** Expiration time of the action. */
|
|
965
|
+
expiresAfter?: number;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Modify a sub-account.
|
|
969
|
+
* @returns {SuccessResponse}
|
|
970
|
+
* @see null
|
|
971
|
+
*/
|
|
972
|
+
export interface SubAccountModifyRequest {
|
|
973
|
+
/** Action to perform. */
|
|
974
|
+
action: {
|
|
975
|
+
/** Type of action. */
|
|
976
|
+
type: "subAccountModify";
|
|
977
|
+
/** Sub-account address to modify. */
|
|
978
|
+
subAccountUser: Hex;
|
|
979
|
+
/** New sub-account name. */
|
|
980
|
+
name: string;
|
|
981
|
+
};
|
|
982
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
983
|
+
nonce: number;
|
|
984
|
+
/** Cryptographic signature. */
|
|
985
|
+
signature: Signature;
|
|
986
|
+
/** Expiration time of the action. */
|
|
987
|
+
expiresAfter?: number;
|
|
840
988
|
}
|
|
841
989
|
/**
|
|
842
990
|
* Transfer between sub-accounts (spot).
|
|
843
991
|
* @returns {SuccessResponse}
|
|
992
|
+
* @see null
|
|
844
993
|
*/
|
|
845
|
-
export interface SubAccountSpotTransferRequest
|
|
994
|
+
export interface SubAccountSpotTransferRequest {
|
|
995
|
+
/** Action to perform. */
|
|
846
996
|
action: {
|
|
847
997
|
/** Type of action. */
|
|
848
998
|
type: "subAccountSpotTransfer";
|
|
@@ -852,17 +1002,26 @@ export interface SubAccountSpotTransferRequest extends BaseExchangeRequest {
|
|
|
852
1002
|
isDeposit: boolean;
|
|
853
1003
|
/** Token identifier. */
|
|
854
1004
|
token: `${string}:${Hex}`;
|
|
855
|
-
/**
|
|
1005
|
+
/**
|
|
1006
|
+
* Amount to send (not in wei).
|
|
1007
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
1008
|
+
*/
|
|
856
1009
|
amount: string;
|
|
857
1010
|
};
|
|
858
|
-
|
|
859
|
-
|
|
1011
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1012
|
+
nonce: number;
|
|
1013
|
+
/** Cryptographic signature. */
|
|
1014
|
+
signature: Signature;
|
|
1015
|
+
/** Expiration time of the action. */
|
|
1016
|
+
expiresAfter?: number;
|
|
860
1017
|
}
|
|
861
1018
|
/**
|
|
862
1019
|
* Transfer between sub-accounts (perpetual).
|
|
863
1020
|
* @returns {SuccessResponse}
|
|
1021
|
+
* @see null
|
|
864
1022
|
*/
|
|
865
|
-
export interface SubAccountTransferRequest
|
|
1023
|
+
export interface SubAccountTransferRequest {
|
|
1024
|
+
/** Action to perform. */
|
|
866
1025
|
action: {
|
|
867
1026
|
/** Type of action. */
|
|
868
1027
|
type: "subAccountTransfer";
|
|
@@ -873,14 +1032,20 @@ export interface SubAccountTransferRequest extends BaseExchangeRequest {
|
|
|
873
1032
|
/** Amount to transfer (float * 1e6). */
|
|
874
1033
|
usd: number;
|
|
875
1034
|
};
|
|
876
|
-
|
|
877
|
-
|
|
1035
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1036
|
+
nonce: number;
|
|
1037
|
+
/** Cryptographic signature. */
|
|
1038
|
+
signature: Signature;
|
|
1039
|
+
/** Expiration time of the action. */
|
|
1040
|
+
expiresAfter?: number;
|
|
878
1041
|
}
|
|
879
1042
|
/**
|
|
880
1043
|
* Delegate or undelegate native tokens to or from a validator.
|
|
881
1044
|
* @returns {SuccessResponse}
|
|
1045
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
|
|
882
1046
|
*/
|
|
883
|
-
export interface TokenDelegateRequest
|
|
1047
|
+
export interface TokenDelegateRequest {
|
|
1048
|
+
/** Action to perform. */
|
|
884
1049
|
action: {
|
|
885
1050
|
/** Type of action. */
|
|
886
1051
|
type: "tokenDelegate";
|
|
@@ -897,14 +1062,18 @@ export interface TokenDelegateRequest extends BaseExchangeRequest {
|
|
|
897
1062
|
/** Unique request identifier (current timestamp in ms). */
|
|
898
1063
|
nonce: number;
|
|
899
1064
|
};
|
|
900
|
-
|
|
901
|
-
|
|
1065
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1066
|
+
nonce: number;
|
|
1067
|
+
/** Cryptographic signature. */
|
|
1068
|
+
signature: Signature;
|
|
902
1069
|
}
|
|
903
1070
|
/**
|
|
904
1071
|
* Cancel a TWAP order.
|
|
905
1072
|
* @returns {TwapCancelResponse}
|
|
1073
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
|
|
906
1074
|
*/
|
|
907
|
-
export interface TwapCancelRequest
|
|
1075
|
+
export interface TwapCancelRequest {
|
|
1076
|
+
/** Action to perform. */
|
|
908
1077
|
action: {
|
|
909
1078
|
/** Type of action. */
|
|
910
1079
|
type: "twapCancel";
|
|
@@ -913,14 +1082,22 @@ export interface TwapCancelRequest extends BaseExchangeRequest {
|
|
|
913
1082
|
/** Twap ID. */
|
|
914
1083
|
t: number;
|
|
915
1084
|
};
|
|
1085
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1086
|
+
nonce: number;
|
|
1087
|
+
/** Cryptographic signature. */
|
|
1088
|
+
signature: Signature;
|
|
1089
|
+
/** Vault address (for vault trading). */
|
|
916
1090
|
vaultAddress?: Hex;
|
|
1091
|
+
/** Expiration time of the action. */
|
|
917
1092
|
expiresAfter?: number;
|
|
918
1093
|
}
|
|
919
1094
|
/**
|
|
920
1095
|
* Place a TWAP order.
|
|
921
1096
|
* @returns {TwapOrderResponse}
|
|
1097
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
|
|
922
1098
|
*/
|
|
923
|
-
export interface TwapOrderRequest
|
|
1099
|
+
export interface TwapOrderRequest {
|
|
1100
|
+
/** Action to perform. */
|
|
924
1101
|
action: {
|
|
925
1102
|
/** Type of action. */
|
|
926
1103
|
type: "twapOrder";
|
|
@@ -930,7 +1107,10 @@ export interface TwapOrderRequest extends BaseExchangeRequest {
|
|
|
930
1107
|
a: number;
|
|
931
1108
|
/** Position side (`true` for long, `false` for short). */
|
|
932
1109
|
b: boolean;
|
|
933
|
-
/**
|
|
1110
|
+
/**
|
|
1111
|
+
* Size (in base currency units).
|
|
1112
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
1113
|
+
*/
|
|
934
1114
|
s: string;
|
|
935
1115
|
/** Is reduce-only? */
|
|
936
1116
|
r: boolean;
|
|
@@ -940,14 +1120,22 @@ export interface TwapOrderRequest extends BaseExchangeRequest {
|
|
|
940
1120
|
t: boolean;
|
|
941
1121
|
};
|
|
942
1122
|
};
|
|
1123
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1124
|
+
nonce: number;
|
|
1125
|
+
/** Cryptographic signature. */
|
|
1126
|
+
signature: Signature;
|
|
1127
|
+
/** Vault address (for vault trading). */
|
|
943
1128
|
vaultAddress?: Hex;
|
|
1129
|
+
/** Expiration time of the action. */
|
|
944
1130
|
expiresAfter?: number;
|
|
945
1131
|
}
|
|
946
1132
|
/**
|
|
947
1133
|
* Add or remove margin from isolated position.
|
|
948
1134
|
* @returns {SuccessResponse}
|
|
1135
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
|
949
1136
|
*/
|
|
950
|
-
export interface UpdateIsolatedMarginRequest
|
|
1137
|
+
export interface UpdateIsolatedMarginRequest {
|
|
1138
|
+
/** Action to perform. */
|
|
951
1139
|
action: {
|
|
952
1140
|
/** Type of action. */
|
|
953
1141
|
type: "updateIsolatedMargin";
|
|
@@ -958,14 +1146,22 @@ export interface UpdateIsolatedMarginRequest extends BaseExchangeRequest {
|
|
|
958
1146
|
/** Amount to adjust (float * 1e6). */
|
|
959
1147
|
ntli: number;
|
|
960
1148
|
};
|
|
1149
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1150
|
+
nonce: number;
|
|
1151
|
+
/** Cryptographic signature. */
|
|
1152
|
+
signature: Signature;
|
|
1153
|
+
/** Vault address (for vault trading). */
|
|
961
1154
|
vaultAddress?: Hex;
|
|
1155
|
+
/** Expiration time of the action. */
|
|
962
1156
|
expiresAfter?: number;
|
|
963
1157
|
}
|
|
964
1158
|
/**
|
|
965
1159
|
* Update cross or isolated leverage on a coin.
|
|
966
1160
|
* @returns {SuccessResponse}
|
|
1161
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
|
|
967
1162
|
*/
|
|
968
|
-
export interface UpdateLeverageRequest
|
|
1163
|
+
export interface UpdateLeverageRequest {
|
|
1164
|
+
/** Action to perform. */
|
|
969
1165
|
action: {
|
|
970
1166
|
/** Type of action. */
|
|
971
1167
|
type: "updateLeverage";
|
|
@@ -976,14 +1172,22 @@ export interface UpdateLeverageRequest extends BaseExchangeRequest {
|
|
|
976
1172
|
/** New leverage value. */
|
|
977
1173
|
leverage: number;
|
|
978
1174
|
};
|
|
1175
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1176
|
+
nonce: number;
|
|
1177
|
+
/** Cryptographic signature. */
|
|
1178
|
+
signature: Signature;
|
|
1179
|
+
/** Vault address (for vault trading). */
|
|
979
1180
|
vaultAddress?: Hex;
|
|
1181
|
+
/** Expiration time of the action. */
|
|
980
1182
|
expiresAfter?: number;
|
|
981
1183
|
}
|
|
982
1184
|
/**
|
|
983
1185
|
* Transfer funds between Spot account and Perp account.
|
|
984
1186
|
* @returns {SuccessResponse}
|
|
1187
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
|
|
985
1188
|
*/
|
|
986
|
-
export interface UsdClassTransferRequest
|
|
1189
|
+
export interface UsdClassTransferRequest {
|
|
1190
|
+
/** Action to perform. */
|
|
987
1191
|
action: {
|
|
988
1192
|
/** Type of action. */
|
|
989
1193
|
type: "usdClassTransfer";
|
|
@@ -991,21 +1195,28 @@ export interface UsdClassTransferRequest extends BaseExchangeRequest {
|
|
|
991
1195
|
signatureChainId: Hex;
|
|
992
1196
|
/** HyperLiquid network. */
|
|
993
1197
|
hyperliquidChain: "Mainnet" | "Testnet";
|
|
994
|
-
/**
|
|
1198
|
+
/**
|
|
1199
|
+
* Amount to transfer (1 = 1$).
|
|
1200
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
1201
|
+
*/
|
|
995
1202
|
amount: string;
|
|
996
1203
|
/** `true` for Spot to Perp, `false` for Perp to Spot. */
|
|
997
1204
|
toPerp: boolean;
|
|
998
1205
|
/** Unique request identifier (current timestamp in ms). */
|
|
999
1206
|
nonce: number;
|
|
1000
1207
|
};
|
|
1001
|
-
|
|
1002
|
-
|
|
1208
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1209
|
+
nonce: number;
|
|
1210
|
+
/** Cryptographic signature. */
|
|
1211
|
+
signature: Signature;
|
|
1003
1212
|
}
|
|
1004
1213
|
/**
|
|
1005
1214
|
* Send usd to another address.
|
|
1006
1215
|
* @returns {SuccessResponse}
|
|
1216
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-usdc-transfer
|
|
1007
1217
|
*/
|
|
1008
|
-
export interface UsdSendRequest
|
|
1218
|
+
export interface UsdSendRequest {
|
|
1219
|
+
/** Action to perform. */
|
|
1009
1220
|
action: {
|
|
1010
1221
|
/** Type of action. */
|
|
1011
1222
|
type: "usdSend";
|
|
@@ -1015,19 +1226,26 @@ export interface UsdSendRequest extends BaseExchangeRequest {
|
|
|
1015
1226
|
hyperliquidChain: "Mainnet" | "Testnet";
|
|
1016
1227
|
/** Destination address. */
|
|
1017
1228
|
destination: Hex;
|
|
1018
|
-
/**
|
|
1229
|
+
/**
|
|
1230
|
+
* Amount to send (1 = 1$).
|
|
1231
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
1232
|
+
*/
|
|
1019
1233
|
amount: string;
|
|
1020
1234
|
/** Unique request identifier (current timestamp in ms). */
|
|
1021
1235
|
time: number;
|
|
1022
1236
|
};
|
|
1023
|
-
|
|
1024
|
-
|
|
1237
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1238
|
+
nonce: number;
|
|
1239
|
+
/** Cryptographic signature. */
|
|
1240
|
+
signature: Signature;
|
|
1025
1241
|
}
|
|
1026
1242
|
/**
|
|
1027
1243
|
* Distribute funds from a vault between followers.
|
|
1028
1244
|
* @returns {SuccessResponse}
|
|
1245
|
+
* @see null
|
|
1029
1246
|
*/
|
|
1030
|
-
export interface VaultDistributeRequest
|
|
1247
|
+
export interface VaultDistributeRequest {
|
|
1248
|
+
/** Action to perform. */
|
|
1031
1249
|
action: {
|
|
1032
1250
|
/** Type of action. */
|
|
1033
1251
|
type: "vaultDistribute";
|
|
@@ -1040,14 +1258,20 @@ export interface VaultDistributeRequest extends BaseExchangeRequest {
|
|
|
1040
1258
|
*/
|
|
1041
1259
|
usd: number;
|
|
1042
1260
|
};
|
|
1043
|
-
|
|
1044
|
-
|
|
1261
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1262
|
+
nonce: number;
|
|
1263
|
+
/** Cryptographic signature. */
|
|
1264
|
+
signature: Signature;
|
|
1265
|
+
/** Vault address (for vault trading). */
|
|
1266
|
+
expiresAfter?: number;
|
|
1045
1267
|
}
|
|
1046
1268
|
/**
|
|
1047
|
-
* Modify a vault
|
|
1269
|
+
* Modify a vault configuration.
|
|
1048
1270
|
* @returns {SuccessResponse}
|
|
1271
|
+
* @see null
|
|
1049
1272
|
*/
|
|
1050
|
-
export interface VaultModifyRequest
|
|
1273
|
+
export interface VaultModifyRequest {
|
|
1274
|
+
/** Action to perform. */
|
|
1051
1275
|
action: {
|
|
1052
1276
|
/** Type of action. */
|
|
1053
1277
|
type: "vaultModify";
|
|
@@ -1058,14 +1282,20 @@ export interface VaultModifyRequest extends BaseExchangeRequest {
|
|
|
1058
1282
|
/** Always close positions on withdrawal. */
|
|
1059
1283
|
alwaysCloseOnWithdraw: boolean | null;
|
|
1060
1284
|
};
|
|
1061
|
-
|
|
1062
|
-
|
|
1285
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1286
|
+
nonce: number;
|
|
1287
|
+
/** Cryptographic signature. */
|
|
1288
|
+
signature: Signature;
|
|
1289
|
+
/** Expiration time of the action. */
|
|
1290
|
+
expiresAfter?: number;
|
|
1063
1291
|
}
|
|
1064
1292
|
/**
|
|
1065
1293
|
* Deposit or withdraw from a vault.
|
|
1066
1294
|
* @returns {SuccessResponse}
|
|
1295
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
|
1067
1296
|
*/
|
|
1068
|
-
export interface VaultTransferRequest
|
|
1297
|
+
export interface VaultTransferRequest {
|
|
1298
|
+
/** Action to perform. */
|
|
1069
1299
|
action: {
|
|
1070
1300
|
/** Type of action. */
|
|
1071
1301
|
type: "vaultTransfer";
|
|
@@ -1076,14 +1306,20 @@ export interface VaultTransferRequest extends BaseExchangeRequest {
|
|
|
1076
1306
|
/** Amount for deposit/withdrawal (float * 1e6). */
|
|
1077
1307
|
usd: number;
|
|
1078
1308
|
};
|
|
1079
|
-
|
|
1309
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1310
|
+
nonce: number;
|
|
1311
|
+
/** Cryptographic signature. */
|
|
1312
|
+
signature: Signature;
|
|
1313
|
+
/** Expiration time of the action. */
|
|
1080
1314
|
expiresAfter?: number;
|
|
1081
1315
|
}
|
|
1082
1316
|
/**
|
|
1083
1317
|
* Initiate a withdrawal request.
|
|
1084
1318
|
* @returns {SuccessResponse}
|
|
1319
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
|
1085
1320
|
*/
|
|
1086
|
-
export interface Withdraw3Request
|
|
1321
|
+
export interface Withdraw3Request {
|
|
1322
|
+
/** Action to perform. */
|
|
1087
1323
|
action: {
|
|
1088
1324
|
/** Type of action. */
|
|
1089
1325
|
type: "withdraw3";
|
|
@@ -1093,12 +1329,17 @@ export interface Withdraw3Request extends BaseExchangeRequest {
|
|
|
1093
1329
|
hyperliquidChain: "Mainnet" | "Testnet";
|
|
1094
1330
|
/** Destination address. */
|
|
1095
1331
|
destination: Hex;
|
|
1096
|
-
/**
|
|
1332
|
+
/**
|
|
1333
|
+
* Amount to withdraw (1 = 1$).
|
|
1334
|
+
* @pattern ^[0-9]+(\.[0-9]+)?$
|
|
1335
|
+
*/
|
|
1097
1336
|
amount: string;
|
|
1098
1337
|
/** Unique request identifier (current timestamp in ms). */
|
|
1099
1338
|
time: number;
|
|
1100
1339
|
};
|
|
1101
|
-
|
|
1102
|
-
|
|
1340
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1341
|
+
nonce: number;
|
|
1342
|
+
/** Cryptographic signature. */
|
|
1343
|
+
signature: Signature;
|
|
1103
1344
|
}
|
|
1104
1345
|
//# sourceMappingURL=requests.d.ts.map
|