@nktkas/hyperliquid 0.21.1 → 0.22.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 +19 -34
- package/README.md +212 -87
- package/esm/mod.d.ts +4 -3
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -2
- package/esm/src/clients/exchange.d.ts +102 -59
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +233 -516
- package/esm/src/clients/info.d.ts +55 -55
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +57 -54
- package/esm/src/clients/multiSign.d.ts +1293 -0
- package/esm/src/clients/multiSign.d.ts.map +1 -0
- package/esm/src/clients/multiSign.js +2156 -0
- package/esm/src/clients/subscription.d.ts +19 -19
- package/esm/src/clients/subscription.d.ts.map +1 -1
- package/esm/src/clients/subscription.js +17 -17
- package/esm/src/signing.d.ts +164 -40
- package/esm/src/signing.d.ts.map +1 -1
- package/esm/src/signing.js +710 -9
- package/esm/src/types/exchange/requests.d.ts +240 -245
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/package.json +2 -1
- package/script/mod.d.ts +4 -3
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +4 -3
- package/script/src/clients/exchange.d.ts +102 -59
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +232 -515
- package/script/src/clients/info.d.ts +55 -55
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +57 -54
- package/script/src/clients/multiSign.d.ts +1293 -0
- package/script/src/clients/multiSign.d.ts.map +1 -0
- package/script/src/clients/multiSign.js +2170 -0
- package/script/src/clients/subscription.d.ts +19 -19
- package/script/src/clients/subscription.d.ts.map +1 -1
- package/script/src/clients/subscription.js +17 -17
- package/script/src/signing.d.ts +164 -40
- package/script/src/signing.d.ts.map +1 -1
- package/script/src/signing.js +711 -10
- package/script/src/types/exchange/requests.d.ts +240 -245
- package/script/src/types/exchange/requests.d.ts.map +1 -1
|
@@ -0,0 +1,1293 @@
|
|
|
1
|
+
import type { Hex } from "../base.js";
|
|
2
|
+
import type { IRequestTransport } from "../transports/base.js";
|
|
3
|
+
import type { BaseExchangeRequest } from "../types/exchange/requests.js";
|
|
4
|
+
import type { CreateSubAccountResponse, CreateVaultResponse, SuccessResponse } from "../types/exchange/responses.js";
|
|
5
|
+
import { type AbstractEthersSigner, type AbstractEthersV5Signer, type AbstractViemWalletClient, type AbstractWallet, type AbstractWindowEthereum, type Signature, userSignedActionEip712Types } from "../signing.js";
|
|
6
|
+
import { type CancelResponseSuccess, type CSignerActionParameters_JailSelf, type CSignerActionParameters_UnjailSelf, type CValidatorActionParameters_ChangeProfile, type CValidatorActionParameters_Register, type CValidatorActionParameters_Unregister, ExchangeClient, type ExchangeClientParameters, type OrderResponseSuccess, type PerpDeployParameters_RegisterAsset, type PerpDeployParameters_SetOracle, type ScheduleCancelParameters, type SpotDeployParameters_Genesis, type SpotDeployParameters_RegisterHyperliquidity, type SpotDeployParameters_RegisterSpot, type SpotDeployParameters_RegisterToken2, type SpotDeployParameters_SetDeployerTradingFeeShare, type SpotDeployParameters_UserGenesis, type TwapCancelResponseSuccess, type TwapOrderResponseSuccess } from "./exchange.js";
|
|
7
|
+
/** Parameters for the {@linkcode MultiSignClient} constructor. */
|
|
8
|
+
export interface MultiSignClientParameters<T extends IRequestTransport = IRequestTransport, S extends [AbstractWalletWithAddress, ...AbstractWallet[]] = [AbstractWalletWithAddress, ...AbstractWallet[]]> extends Omit<ExchangeClientParameters<T, S[0]>, "wallet"> {
|
|
9
|
+
/** The multi-signature account address. */
|
|
10
|
+
multiSignAddress: Hex;
|
|
11
|
+
/** Array of wallets used for multi-signature operations. The first wallet acts as the leader. */
|
|
12
|
+
signers: S;
|
|
13
|
+
}
|
|
14
|
+
/** Abstract interface for a wallet that can sign typed data and has wallet address. */
|
|
15
|
+
export type AbstractWalletWithAddress = AbstractViemWalletClientWithAddress | AbstractEthersSignerWithAddress | AbstractEthersV5SignerWithAddress | AbstractWindowEthereum;
|
|
16
|
+
/** Abstract interface for a [viem wallet](https://viem.sh/docs/clients/wallet) with wallet address. */
|
|
17
|
+
export interface AbstractViemWalletClientWithAddress extends AbstractViemWalletClient {
|
|
18
|
+
address: Hex;
|
|
19
|
+
}
|
|
20
|
+
/** Abstract interface for an [ethers.js signer](https://docs.ethers.org/v6/api/providers/#Signer) with wallet address. */
|
|
21
|
+
export interface AbstractEthersSignerWithAddress extends AbstractEthersSigner {
|
|
22
|
+
getAddress(): Promise<string>;
|
|
23
|
+
}
|
|
24
|
+
/** Abstract interface for an [ethers.js v5 signer](https://docs.ethers.org/v5/api/signer/) with wallet address. */
|
|
25
|
+
export interface AbstractEthersV5SignerWithAddress extends AbstractEthersV5Signer {
|
|
26
|
+
getAddress(): Promise<string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Multi-signature exchange client for interacting with the Hyperliquid API.
|
|
30
|
+
* @typeParam T The transport used to connect to the Hyperliquid API.
|
|
31
|
+
* @typeParam S Array of wallets where the first wallet acts as the leader.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MultiSignClient<T extends IRequestTransport = IRequestTransport, S extends [AbstractWalletWithAddress, ...AbstractWallet[]] = [AbstractWalletWithAddress, ...AbstractWallet[]]> extends ExchangeClient<T, S[0]> implements MultiSignClientParameters<T, S> {
|
|
34
|
+
multiSignAddress: Hex;
|
|
35
|
+
signers: S;
|
|
36
|
+
/**
|
|
37
|
+
* @multisign Is the first wallet from {@linkcode signers}.
|
|
38
|
+
*/
|
|
39
|
+
wallet: S[0];
|
|
40
|
+
/**
|
|
41
|
+
* Initialises a new multi-signature client instance.
|
|
42
|
+
* @param args - The parameters for the multi-signature client.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
47
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
48
|
+
*
|
|
49
|
+
* const multiSignAddress = "0x...";
|
|
50
|
+
* const signers = [
|
|
51
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
52
|
+
* privateKeyToAccount("0x..."),
|
|
53
|
+
* privateKeyToAccount("0x..."),
|
|
54
|
+
* ];
|
|
55
|
+
*
|
|
56
|
+
* const transport = new hl.HttpTransport();
|
|
57
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
constructor(args: MultiSignClientParameters<T, S>);
|
|
61
|
+
/**
|
|
62
|
+
* @param args - The parameters for the request.
|
|
63
|
+
* @param signal - An optional abort signal
|
|
64
|
+
* @returns Successful response without specific data.
|
|
65
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
66
|
+
*
|
|
67
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
71
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
72
|
+
*
|
|
73
|
+
* const multiSignAddress = "0x...";
|
|
74
|
+
* const signers = [
|
|
75
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
76
|
+
* privateKeyToAccount("0x..."),
|
|
77
|
+
* // ...
|
|
78
|
+
* privateKeyToAccount("0x..."),
|
|
79
|
+
* ];
|
|
80
|
+
*
|
|
81
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
82
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
83
|
+
*
|
|
84
|
+
* const data = await multiSignClient.approveAgent({ agentAddress: "0x...", agentName: "agentName" });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
approveAgent(...[args, signal]: Parameters<ExchangeClient["approveAgent"]>): ReturnType<ExchangeClient["approveAgent"]>;
|
|
88
|
+
/**
|
|
89
|
+
* @param args - The parameters for the request.
|
|
90
|
+
* @param signal - An optional abort signal.
|
|
91
|
+
* @returns Successful response without specific data.
|
|
92
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
93
|
+
*
|
|
94
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
98
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
99
|
+
*
|
|
100
|
+
* const multiSignAddress = "0x...";
|
|
101
|
+
* const signers = [
|
|
102
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
103
|
+
* privateKeyToAccount("0x..."),
|
|
104
|
+
* // ...
|
|
105
|
+
* privateKeyToAccount("0x..."),
|
|
106
|
+
* ];
|
|
107
|
+
*
|
|
108
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
109
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
110
|
+
*
|
|
111
|
+
* const data = await multiSignClient.approveBuilderFee({ maxFeeRate: "0.01%", builder: "0x..." });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
approveBuilderFee(...[args, signal]: Parameters<ExchangeClient["approveBuilderFee"]>): ReturnType<ExchangeClient["approveBuilderFee"]>;
|
|
115
|
+
/**
|
|
116
|
+
* @param args - The parameters for the request.
|
|
117
|
+
* @param signal - An optional abort signal.
|
|
118
|
+
* @returns Successful variant of {@link OrderResponse} without error statuses.
|
|
119
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
120
|
+
*
|
|
121
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
125
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
126
|
+
*
|
|
127
|
+
* const multiSignAddress = "0x...";
|
|
128
|
+
* const signers = [
|
|
129
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
130
|
+
* privateKeyToAccount("0x..."),
|
|
131
|
+
* // ...
|
|
132
|
+
* privateKeyToAccount("0x..."),
|
|
133
|
+
* ];
|
|
134
|
+
*
|
|
135
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
136
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
137
|
+
*
|
|
138
|
+
* const data = await multiSignClient.batchModify({
|
|
139
|
+
* modifies: [{
|
|
140
|
+
* oid: 123,
|
|
141
|
+
* order: {
|
|
142
|
+
* a: 0, // Asset index
|
|
143
|
+
* b: true, // Buy order
|
|
144
|
+
* p: "31000", // New price
|
|
145
|
+
* s: "0.2", // New size
|
|
146
|
+
* r: false, // Not reduce-only
|
|
147
|
+
* t: {
|
|
148
|
+
* limit: {
|
|
149
|
+
* tif: "Gtc", // Good-til-cancelled
|
|
150
|
+
* },
|
|
151
|
+
* },
|
|
152
|
+
* c: "0x...", // Client Order ID (optional)
|
|
153
|
+
* },
|
|
154
|
+
* }],
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
batchModify(...[args, signal]: Parameters<ExchangeClient["batchModify"]>): ReturnType<ExchangeClient["batchModify"]>;
|
|
159
|
+
/**
|
|
160
|
+
* @param args - The parameters for the request.
|
|
161
|
+
* @param signal - An optional abort signal.
|
|
162
|
+
* @returns Successful variant of {@link CancelResponse} without error statuses.
|
|
163
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
164
|
+
*
|
|
165
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
169
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
170
|
+
*
|
|
171
|
+
* const multiSignAddress = "0x...";
|
|
172
|
+
* const signers = [
|
|
173
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
174
|
+
* privateKeyToAccount("0x..."),
|
|
175
|
+
* // ...
|
|
176
|
+
* privateKeyToAccount("0x..."),
|
|
177
|
+
* ];
|
|
178
|
+
*
|
|
179
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
180
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
181
|
+
*
|
|
182
|
+
* const data = await multiSignClient.cancel({
|
|
183
|
+
* cancels: [{
|
|
184
|
+
* a: 0, // Asset index
|
|
185
|
+
* o: 123, // Order ID
|
|
186
|
+
* }],
|
|
187
|
+
* });
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
cancel(...[args, signal]: Parameters<ExchangeClient["cancel"]>): ReturnType<ExchangeClient["cancel"]>;
|
|
191
|
+
/**
|
|
192
|
+
* @param args - The parameters for the request.
|
|
193
|
+
* @param signal - An optional abort signal.
|
|
194
|
+
* @returns Successful variant of {@link CancelResponse} without error statuses.
|
|
195
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
196
|
+
*
|
|
197
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
201
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
202
|
+
*
|
|
203
|
+
* const multiSignAddress = "0x...";
|
|
204
|
+
* const signers = [
|
|
205
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
206
|
+
* privateKeyToAccount("0x..."),
|
|
207
|
+
* // ...
|
|
208
|
+
* privateKeyToAccount("0x..."),
|
|
209
|
+
* ];
|
|
210
|
+
*
|
|
211
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
212
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
213
|
+
*
|
|
214
|
+
* const data = await multiSignClient.cancelByCloid({
|
|
215
|
+
* cancels: [
|
|
216
|
+
* { asset: 0, cloid: "0x..." },
|
|
217
|
+
* ],
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
cancelByCloid(...[args, signal]: Parameters<ExchangeClient["cancelByCloid"]>): ReturnType<ExchangeClient["cancelByCloid"]>;
|
|
222
|
+
/**
|
|
223
|
+
* @param args - The parameters for the request.
|
|
224
|
+
* @param signal - An optional abort signal.
|
|
225
|
+
* @returns Successful response without specific data.
|
|
226
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
227
|
+
*
|
|
228
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
232
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
233
|
+
*
|
|
234
|
+
* const multiSignAddress = "0x...";
|
|
235
|
+
* const signers = [
|
|
236
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
237
|
+
* privateKeyToAccount("0x..."),
|
|
238
|
+
* // ...
|
|
239
|
+
* privateKeyToAccount("0x..."),
|
|
240
|
+
* ];
|
|
241
|
+
*
|
|
242
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
243
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
244
|
+
*
|
|
245
|
+
* const data = await multiSignClient.cDeposit({ wei: 1 * 1e8 });
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
cDeposit(...[args, signal]: Parameters<ExchangeClient["cDeposit"]>): ReturnType<ExchangeClient["cDeposit"]>;
|
|
249
|
+
/**
|
|
250
|
+
* @param args - The parameters for the request.
|
|
251
|
+
* @param signal - An optional abort signal.
|
|
252
|
+
* @returns Successful response without specific data.
|
|
253
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
254
|
+
*
|
|
255
|
+
* @see null - no documentation
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
259
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
260
|
+
*
|
|
261
|
+
* const multiSignAddress = "0x...";
|
|
262
|
+
* const signers = [
|
|
263
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
264
|
+
* privateKeyToAccount("0x..."),
|
|
265
|
+
* // ...
|
|
266
|
+
* privateKeyToAccount("0x..."),
|
|
267
|
+
* ];
|
|
268
|
+
*
|
|
269
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
270
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
271
|
+
*
|
|
272
|
+
* const data = await multiSignClient.claimRewards();
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
claimRewards(...[signal]: Parameters<ExchangeClient["claimRewards"]>): ReturnType<ExchangeClient["claimRewards"]>;
|
|
276
|
+
/**
|
|
277
|
+
* @param args - The parameters for the request.
|
|
278
|
+
* @param signal - An optional abort signal.
|
|
279
|
+
* @returns Successful response without specific data.
|
|
280
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
281
|
+
*
|
|
282
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
286
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
287
|
+
*
|
|
288
|
+
* const multiSignAddress = "0x...";
|
|
289
|
+
* const signers = [
|
|
290
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
291
|
+
* privateKeyToAccount("0x..."),
|
|
292
|
+
* // ...
|
|
293
|
+
* privateKeyToAccount("0x..."),
|
|
294
|
+
* ];
|
|
295
|
+
*
|
|
296
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
297
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
298
|
+
*
|
|
299
|
+
* const data = await multiSignClient.convertToMultiSigUser({ // convert to normal user
|
|
300
|
+
* authorizedUsers: [],
|
|
301
|
+
* threshold: 0,
|
|
302
|
+
* });
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
convertToMultiSigUser(...[args, signal]: Parameters<ExchangeClient["convertToMultiSigUser"]>): ReturnType<ExchangeClient["convertToMultiSigUser"]>;
|
|
306
|
+
/**
|
|
307
|
+
* @param args - The parameters for the request.
|
|
308
|
+
* @param signal - An optional abort signal.
|
|
309
|
+
* @returns Response for creating a sub-account.
|
|
310
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
311
|
+
*
|
|
312
|
+
* @see null - no documentation
|
|
313
|
+
* @example
|
|
314
|
+
* ```ts
|
|
315
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
316
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
317
|
+
*
|
|
318
|
+
* const multiSignAddress = "0x...";
|
|
319
|
+
* const signers = [
|
|
320
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
321
|
+
* privateKeyToAccount("0x..."),
|
|
322
|
+
* // ...
|
|
323
|
+
* privateKeyToAccount("0x..."),
|
|
324
|
+
* ];
|
|
325
|
+
*
|
|
326
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
327
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
328
|
+
*
|
|
329
|
+
* const data = await multiSignClient.createSubAccount({ name: "subAccountName" });
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
createSubAccount(...[args, signal]: Parameters<ExchangeClient["createSubAccount"]>): ReturnType<ExchangeClient["createSubAccount"]>;
|
|
333
|
+
/**
|
|
334
|
+
* @param args - The parameters for the request.
|
|
335
|
+
* @param signal - An optional abort signal.
|
|
336
|
+
* @returns Response for creating a vault.
|
|
337
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
338
|
+
*
|
|
339
|
+
* @see null - no documentation
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
343
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
344
|
+
*
|
|
345
|
+
* const multiSignAddress = "0x...";
|
|
346
|
+
* const signers = [
|
|
347
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
348
|
+
* privateKeyToAccount("0x..."),
|
|
349
|
+
* // ...
|
|
350
|
+
* privateKeyToAccount("0x..."),
|
|
351
|
+
* ];
|
|
352
|
+
*
|
|
353
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
354
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
355
|
+
*
|
|
356
|
+
* const data = await multiSignClient.createVault({
|
|
357
|
+
* name: "VaultName",
|
|
358
|
+
* description: "Vault description",
|
|
359
|
+
* initialUsd: 100 * 1e6,
|
|
360
|
+
* });
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
createVault(...[args, signal]: Parameters<ExchangeClient["createVault"]>): ReturnType<ExchangeClient["createVault"]>;
|
|
364
|
+
/**
|
|
365
|
+
* @param args - The parameters for the request.
|
|
366
|
+
* @param signal - An optional abort signal.
|
|
367
|
+
* @returns Successful response without specific data.
|
|
368
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
369
|
+
*
|
|
370
|
+
* @see null - no documentation
|
|
371
|
+
* @example
|
|
372
|
+
* ```ts
|
|
373
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
374
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
375
|
+
*
|
|
376
|
+
* const multiSignAddress = "0x...";
|
|
377
|
+
* const signers = [
|
|
378
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
379
|
+
* privateKeyToAccount("0x..."),
|
|
380
|
+
* // ...
|
|
381
|
+
* privateKeyToAccount("0x..."),
|
|
382
|
+
* ];
|
|
383
|
+
*
|
|
384
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
385
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
386
|
+
*
|
|
387
|
+
* // Jail self
|
|
388
|
+
* const data = await multiSignClient.cSignerAction({ jailSelf: null });
|
|
389
|
+
*
|
|
390
|
+
* // Unjail self
|
|
391
|
+
* const data = await multiSignClient.cSignerAction({ unjailSelf: null });
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
cSignerAction(args: CSignerActionParameters_JailSelf, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
|
|
395
|
+
cSignerAction(args: CSignerActionParameters_UnjailSelf, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
|
|
396
|
+
/**
|
|
397
|
+
* @param args - The parameters for the request.
|
|
398
|
+
* @param signal - An optional abort signal.
|
|
399
|
+
* @returns Successful response without specific data.
|
|
400
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```ts
|
|
404
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
405
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
406
|
+
*
|
|
407
|
+
* const multiSignAddress = "0x...";
|
|
408
|
+
* const signers = [
|
|
409
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
410
|
+
* privateKeyToAccount("0x..."),
|
|
411
|
+
* // ...
|
|
412
|
+
* privateKeyToAccount("0x..."),
|
|
413
|
+
* ];
|
|
414
|
+
*
|
|
415
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
416
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
417
|
+
*
|
|
418
|
+
* // Change validator profile
|
|
419
|
+
* const data = await multiSignClient.cValidatorAction({
|
|
420
|
+
* changeProfile: {
|
|
421
|
+
* name: "My Validator",
|
|
422
|
+
* description: "Validator description",
|
|
423
|
+
* unjailed: true,
|
|
424
|
+
* }
|
|
425
|
+
* });
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
cValidatorAction(args: CValidatorActionParameters_ChangeProfile, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
|
|
429
|
+
cValidatorAction(args: CValidatorActionParameters_Register, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
|
|
430
|
+
cValidatorAction(args: CValidatorActionParameters_Unregister, signal?: AbortSignal): ReturnType<ExchangeClient["cSignerAction"]>;
|
|
431
|
+
/**
|
|
432
|
+
* @param args - The parameters for the request.
|
|
433
|
+
* @param signal - An optional abort signal.
|
|
434
|
+
* @returns Successful response without specific data.
|
|
435
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
436
|
+
*
|
|
437
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
441
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
442
|
+
*
|
|
443
|
+
* const multiSignAddress = "0x...";
|
|
444
|
+
* const signers = [
|
|
445
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
446
|
+
* privateKeyToAccount("0x..."),
|
|
447
|
+
* // ...
|
|
448
|
+
* privateKeyToAccount("0x..."),
|
|
449
|
+
* ];
|
|
450
|
+
*
|
|
451
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
452
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
453
|
+
*
|
|
454
|
+
* const data = await multiSignClient.cWithdraw({ wei: 1 * 1e8 });
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
cWithdraw(...[args, signal]: Parameters<ExchangeClient["cWithdraw"]>): ReturnType<ExchangeClient["cWithdraw"]>;
|
|
458
|
+
/**
|
|
459
|
+
* @param args - The parameters for the request.
|
|
460
|
+
* @param signal - An optional abort signal.
|
|
461
|
+
* @returns Response for creating a sub-account.
|
|
462
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
463
|
+
*
|
|
464
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/evm/dual-block-architecture
|
|
465
|
+
* @example
|
|
466
|
+
* ```ts
|
|
467
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
468
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
469
|
+
*
|
|
470
|
+
* const multiSignAddress = "0x...";
|
|
471
|
+
* const signers = [
|
|
472
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
473
|
+
* privateKeyToAccount("0x..."),
|
|
474
|
+
* // ...
|
|
475
|
+
* privateKeyToAccount("0x..."),
|
|
476
|
+
* ];
|
|
477
|
+
*
|
|
478
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
479
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
480
|
+
*
|
|
481
|
+
* const data = await multiSignClient.evmUserModify({ usingBigBlocks: true });
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
evmUserModify(...[args, signal]: Parameters<ExchangeClient["evmUserModify"]>): ReturnType<ExchangeClient["evmUserModify"]>;
|
|
485
|
+
/**
|
|
486
|
+
* @param args - The parameters for the request.
|
|
487
|
+
* @param signal - An optional abort signal.
|
|
488
|
+
* @returns Successful response without specific data.
|
|
489
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
490
|
+
*
|
|
491
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
492
|
+
* @example
|
|
493
|
+
* ```ts
|
|
494
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
495
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
496
|
+
*
|
|
497
|
+
* const multiSignAddress = "0x...";
|
|
498
|
+
* const signers = [
|
|
499
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
500
|
+
* privateKeyToAccount("0x..."),
|
|
501
|
+
* // ...
|
|
502
|
+
* privateKeyToAccount("0x..."),
|
|
503
|
+
* ];
|
|
504
|
+
*
|
|
505
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
506
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
507
|
+
*
|
|
508
|
+
* const data = await multiSignClient.modify({
|
|
509
|
+
* oid: 123,
|
|
510
|
+
* order: {
|
|
511
|
+
* a: 0, // Asset index
|
|
512
|
+
* b: true, // Buy order
|
|
513
|
+
* p: "31000", // New price
|
|
514
|
+
* s: "0.2", // New size
|
|
515
|
+
* r: false, // Not reduce-only
|
|
516
|
+
* t: {
|
|
517
|
+
* limit: {
|
|
518
|
+
* tif: "Gtc", // Good-til-cancelled
|
|
519
|
+
* },
|
|
520
|
+
* },
|
|
521
|
+
* c: "0x...", // Client Order ID (optional)
|
|
522
|
+
* },
|
|
523
|
+
* });
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
modify(...[args, signal]: Parameters<ExchangeClient["modify"]>): ReturnType<ExchangeClient["modify"]>;
|
|
527
|
+
/**
|
|
528
|
+
* @multisign Not implemented
|
|
529
|
+
*/
|
|
530
|
+
multiSig<T extends SuccessResponse | CancelResponseSuccess | CreateSubAccountResponse | CreateVaultResponse | OrderResponseSuccess | TwapOrderResponseSuccess | TwapCancelResponseSuccess>(...[_args, _signal]: Parameters<ExchangeClient["multiSig"]>): Promise<T>;
|
|
531
|
+
/**
|
|
532
|
+
* @param args - The parameters for the request.
|
|
533
|
+
* @param signal - An optional abort signal.
|
|
534
|
+
* @returns Successful variant of {@link OrderResponse} without error statuses.
|
|
535
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
536
|
+
*
|
|
537
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
|
538
|
+
* @example
|
|
539
|
+
* ```ts
|
|
540
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
541
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
542
|
+
*
|
|
543
|
+
* const multiSignAddress = "0x...";
|
|
544
|
+
* const signers = [
|
|
545
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
546
|
+
* privateKeyToAccount("0x..."),
|
|
547
|
+
* // ...
|
|
548
|
+
* privateKeyToAccount("0x..."),
|
|
549
|
+
* ];
|
|
550
|
+
*
|
|
551
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
552
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
553
|
+
*
|
|
554
|
+
* const data = await multiSignClient.order({
|
|
555
|
+
* orders: [{
|
|
556
|
+
* a: 0, // Asset index
|
|
557
|
+
* b: true, // Buy order
|
|
558
|
+
* p: "30000", // Price
|
|
559
|
+
* s: "0.1", // Size
|
|
560
|
+
* r: false, // Not reduce-only
|
|
561
|
+
* t: {
|
|
562
|
+
* limit: {
|
|
563
|
+
* tif: "Gtc", // Good-til-cancelled
|
|
564
|
+
* },
|
|
565
|
+
* },
|
|
566
|
+
* c: "0x...", // Client Order ID (optional)
|
|
567
|
+
* }],
|
|
568
|
+
* grouping: "na", // No grouping
|
|
569
|
+
* });
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
order(...[args, signal]: Parameters<ExchangeClient["order"]>): ReturnType<ExchangeClient["order"]>;
|
|
573
|
+
/**
|
|
574
|
+
* @param args - The parameters for the request.
|
|
575
|
+
* @param signal - An optional abort signal.
|
|
576
|
+
* @returns Successful response without specific data.
|
|
577
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
578
|
+
*
|
|
579
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-3-assets
|
|
580
|
+
* @example
|
|
581
|
+
* ```ts
|
|
582
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
583
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
584
|
+
*
|
|
585
|
+
* const multiSignAddress = "0x...";
|
|
586
|
+
* const signers = [
|
|
587
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
588
|
+
* privateKeyToAccount("0x..."),
|
|
589
|
+
* // ...
|
|
590
|
+
* privateKeyToAccount("0x..."),
|
|
591
|
+
* ];
|
|
592
|
+
*
|
|
593
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
594
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
595
|
+
*
|
|
596
|
+
* const data = await multiSignClient.perpDeploy({
|
|
597
|
+
* registerAsset: {
|
|
598
|
+
* maxGas: 1000000,
|
|
599
|
+
* assetRequest: {
|
|
600
|
+
* coin: "USDC",
|
|
601
|
+
* szDecimals: 8,
|
|
602
|
+
* oraclePx: "1",
|
|
603
|
+
* marginTableId: 1,
|
|
604
|
+
* onlyIsolated: false,
|
|
605
|
+
* },
|
|
606
|
+
* dex: "test",
|
|
607
|
+
* },
|
|
608
|
+
* });
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
perpDeploy(args: PerpDeployParameters_RegisterAsset, signal?: AbortSignal): ReturnType<ExchangeClient["perpDeploy"]>;
|
|
612
|
+
perpDeploy(args: PerpDeployParameters_SetOracle, signal?: AbortSignal): ReturnType<ExchangeClient["perpDeploy"]>;
|
|
613
|
+
/**
|
|
614
|
+
* @param args - The parameters for the request.
|
|
615
|
+
* @param signal - An optional abort signal.
|
|
616
|
+
* @returns Successful response without specific data.
|
|
617
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
618
|
+
*
|
|
619
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
|
|
620
|
+
* @example
|
|
621
|
+
* ```ts
|
|
622
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
623
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
624
|
+
*
|
|
625
|
+
* const multiSignAddress = "0x...";
|
|
626
|
+
* const signers = [
|
|
627
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
628
|
+
* privateKeyToAccount("0x..."),
|
|
629
|
+
* // ...
|
|
630
|
+
* privateKeyToAccount("0x..."),
|
|
631
|
+
* ];
|
|
632
|
+
*
|
|
633
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
634
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
635
|
+
*
|
|
636
|
+
* const data = await multiSignClient.perpDexClassTransfer({
|
|
637
|
+
* dex: "test",
|
|
638
|
+
* token: "USDC",
|
|
639
|
+
* amount: "1",
|
|
640
|
+
* toPerp: true,
|
|
641
|
+
* });
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
644
|
+
perpDexClassTransfer(...[args, signal]: Parameters<ExchangeClient["perpDexClassTransfer"]>): ReturnType<ExchangeClient["perpDexClassTransfer"]>;
|
|
645
|
+
/**
|
|
646
|
+
* @param args - The parameters for the request.
|
|
647
|
+
* @param signal - An optional abort signal.
|
|
648
|
+
* @returns Successful response without specific data.
|
|
649
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
650
|
+
*
|
|
651
|
+
* @see null - no documentation
|
|
652
|
+
* @example
|
|
653
|
+
* ```ts
|
|
654
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
655
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
656
|
+
*
|
|
657
|
+
* const multiSignAddress = "0x...";
|
|
658
|
+
* const signers = [
|
|
659
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
660
|
+
* privateKeyToAccount("0x..."),
|
|
661
|
+
* // ...
|
|
662
|
+
* privateKeyToAccount("0x..."),
|
|
663
|
+
* ];
|
|
664
|
+
*
|
|
665
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
666
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
667
|
+
*
|
|
668
|
+
* const data = await multiSignClient.registerReferrer({ code: "TEST" });
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
registerReferrer(...[args, signal]: Parameters<ExchangeClient["registerReferrer"]>): ReturnType<ExchangeClient["registerReferrer"]>;
|
|
672
|
+
/**
|
|
673
|
+
* @param args - The parameters for the request.
|
|
674
|
+
* @param signal - An optional abort signal.
|
|
675
|
+
* @returns Successful response without specific data.
|
|
676
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
677
|
+
*
|
|
678
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#reserve-additional-actions
|
|
679
|
+
* @example
|
|
680
|
+
* ```ts
|
|
681
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
682
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
683
|
+
*
|
|
684
|
+
* const multiSignAddress = "0x...";
|
|
685
|
+
* const signers = [
|
|
686
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
687
|
+
* privateKeyToAccount("0x..."),
|
|
688
|
+
* // ...
|
|
689
|
+
* privateKeyToAccount("0x..."),
|
|
690
|
+
* ];
|
|
691
|
+
*
|
|
692
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
693
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
694
|
+
*
|
|
695
|
+
* const data = await multiSignClient.reserveRequestWeight({ weight: 10 });
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
reserveRequestWeight(...[args, signal]: Parameters<ExchangeClient["reserveRequestWeight"]>): ReturnType<ExchangeClient["reserveRequestWeight"]>;
|
|
699
|
+
/**
|
|
700
|
+
* @param args - The parameters for the request.
|
|
701
|
+
* @param signal - An optional abort signal.
|
|
702
|
+
* @returns Successful response without specific data.
|
|
703
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
704
|
+
*
|
|
705
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
|
|
706
|
+
* @example
|
|
707
|
+
* ```ts
|
|
708
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
709
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
710
|
+
*
|
|
711
|
+
* const multiSignAddress = "0x...";
|
|
712
|
+
* const signers = [
|
|
713
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
714
|
+
* privateKeyToAccount("0x..."),
|
|
715
|
+
* // ...
|
|
716
|
+
* privateKeyToAccount("0x..."),
|
|
717
|
+
* ];
|
|
718
|
+
*
|
|
719
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
720
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
721
|
+
*
|
|
722
|
+
* const data = await multiSignClient.scheduleCancel({ time: Date.now() + 3600000 });
|
|
723
|
+
* ```
|
|
724
|
+
*/
|
|
725
|
+
scheduleCancel(args?: ScheduleCancelParameters, signal?: AbortSignal): ReturnType<ExchangeClient["scheduleCancel"]>;
|
|
726
|
+
scheduleCancel(signal?: AbortSignal): ReturnType<ExchangeClient["scheduleCancel"]>;
|
|
727
|
+
/**
|
|
728
|
+
* @param args - The parameters for the request.
|
|
729
|
+
* @param signal - An optional abort signal.
|
|
730
|
+
* @returns Successful response without specific data.
|
|
731
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
732
|
+
*
|
|
733
|
+
* @see null - no documentation
|
|
734
|
+
* @example
|
|
735
|
+
* ```ts
|
|
736
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
737
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
738
|
+
*
|
|
739
|
+
* const multiSignAddress = "0x...";
|
|
740
|
+
* const signers = [
|
|
741
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
742
|
+
* privateKeyToAccount("0x..."),
|
|
743
|
+
* // ...
|
|
744
|
+
* privateKeyToAccount("0x..."),
|
|
745
|
+
* ];
|
|
746
|
+
*
|
|
747
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
748
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
749
|
+
*
|
|
750
|
+
* const data = await multiSignClient.setDisplayName({ displayName: "My Name" });
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
setDisplayName(...[args, signal]: Parameters<ExchangeClient["setDisplayName"]>): ReturnType<ExchangeClient["setDisplayName"]>;
|
|
754
|
+
/**
|
|
755
|
+
* @param args - The parameters for the request.
|
|
756
|
+
* @param signal - An optional abort signal.
|
|
757
|
+
* @returns Successful response without specific data.
|
|
758
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
759
|
+
*
|
|
760
|
+
* @see null - no documentation
|
|
761
|
+
* @example
|
|
762
|
+
* ```ts
|
|
763
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
764
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
765
|
+
*
|
|
766
|
+
* const multiSignAddress = "0x...";
|
|
767
|
+
* const signers = [
|
|
768
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
769
|
+
* privateKeyToAccount("0x..."),
|
|
770
|
+
* // ...
|
|
771
|
+
* privateKeyToAccount("0x..."),
|
|
772
|
+
* ];
|
|
773
|
+
*
|
|
774
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
775
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
776
|
+
*
|
|
777
|
+
* const data = await multiSignClient.setReferrer({ code: "TEST" });
|
|
778
|
+
* ```
|
|
779
|
+
*/
|
|
780
|
+
setReferrer(...[args, signal]: Parameters<ExchangeClient["setReferrer"]>): ReturnType<ExchangeClient["setReferrer"]>;
|
|
781
|
+
/**
|
|
782
|
+
* @param args - The parameters for the request.
|
|
783
|
+
* @param signal - An optional abort signal.
|
|
784
|
+
* @returns Successful response without specific data.
|
|
785
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
786
|
+
*
|
|
787
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets
|
|
788
|
+
* @example
|
|
789
|
+
* ```ts
|
|
790
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
791
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
792
|
+
*
|
|
793
|
+
* const multiSignAddress = "0x...";
|
|
794
|
+
* const signers = [
|
|
795
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
796
|
+
* privateKeyToAccount("0x..."),
|
|
797
|
+
* // ...
|
|
798
|
+
* privateKeyToAccount("0x..."),
|
|
799
|
+
* ];
|
|
800
|
+
*
|
|
801
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
802
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
803
|
+
*
|
|
804
|
+
* const data = await multiSignClient.spotDeploy({
|
|
805
|
+
* registerToken2: {
|
|
806
|
+
* spec: {
|
|
807
|
+
* name: "USDC",
|
|
808
|
+
* szDecimals: 8,
|
|
809
|
+
* weiDecimals: 8,
|
|
810
|
+
* },
|
|
811
|
+
* maxGas: 1000000,
|
|
812
|
+
* fullName: "USD Coin",
|
|
813
|
+
* },
|
|
814
|
+
* });
|
|
815
|
+
* ```
|
|
816
|
+
*/
|
|
817
|
+
spotDeploy(args: SpotDeployParameters_Genesis, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
|
|
818
|
+
spotDeploy(args: SpotDeployParameters_RegisterHyperliquidity, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
|
|
819
|
+
spotDeploy(args: SpotDeployParameters_RegisterSpot, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
|
|
820
|
+
spotDeploy(args: SpotDeployParameters_RegisterToken2, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
|
|
821
|
+
spotDeploy(args: SpotDeployParameters_SetDeployerTradingFeeShare, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
|
|
822
|
+
spotDeploy(args: SpotDeployParameters_UserGenesis, signal?: AbortSignal): ReturnType<ExchangeClient["spotDeploy"]>;
|
|
823
|
+
/**
|
|
824
|
+
* @param args - The parameters for the request.
|
|
825
|
+
* @param signal - An optional abort signal.
|
|
826
|
+
* @returns Successful response without specific data.
|
|
827
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
828
|
+
*
|
|
829
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-spot-transfer
|
|
830
|
+
* @example
|
|
831
|
+
* ```ts
|
|
832
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
833
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
834
|
+
*
|
|
835
|
+
* const multiSignAddress = "0x...";
|
|
836
|
+
* const signers = [
|
|
837
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
838
|
+
* privateKeyToAccount("0x..."),
|
|
839
|
+
* // ...
|
|
840
|
+
* privateKeyToAccount("0x..."),
|
|
841
|
+
* ];
|
|
842
|
+
*
|
|
843
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
844
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
845
|
+
*
|
|
846
|
+
* const data = await multiSignClient.spotSend({
|
|
847
|
+
* destination: "0x...",
|
|
848
|
+
* token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
|
|
849
|
+
* amount: "1",
|
|
850
|
+
* });
|
|
851
|
+
* ```
|
|
852
|
+
*/
|
|
853
|
+
spotSend(...[args, signal]: Parameters<ExchangeClient["spotSend"]>): ReturnType<ExchangeClient["spotSend"]>;
|
|
854
|
+
/**
|
|
855
|
+
* @param args - The parameters for the request.
|
|
856
|
+
* @param signal - An optional abort signal.
|
|
857
|
+
* @returns Successful response without specific data.
|
|
858
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
859
|
+
*
|
|
860
|
+
* @see null - no documentation
|
|
861
|
+
* @example
|
|
862
|
+
* ```ts
|
|
863
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
864
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
865
|
+
*
|
|
866
|
+
* const multiSignAddress = "0x...";
|
|
867
|
+
* const signers = [
|
|
868
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
869
|
+
* privateKeyToAccount("0x..."),
|
|
870
|
+
* // ...
|
|
871
|
+
* privateKeyToAccount("0x..."),
|
|
872
|
+
* ];
|
|
873
|
+
*
|
|
874
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
875
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
876
|
+
*
|
|
877
|
+
* const data = await multiSignClient.spotUser({ toggleSpotDusting: { optOut: false } });
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
spotUser(...[args, signal]: Parameters<ExchangeClient["spotUser"]>): ReturnType<ExchangeClient["spotUser"]>;
|
|
881
|
+
/**
|
|
882
|
+
* @param args - The parameters for the request.
|
|
883
|
+
* @param signal - An optional abort signal.
|
|
884
|
+
* @returns Successful response without specific data.
|
|
885
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
886
|
+
*
|
|
887
|
+
* @see null - no documentation
|
|
888
|
+
* @example
|
|
889
|
+
* ```ts
|
|
890
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
891
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
892
|
+
*
|
|
893
|
+
* const multiSignAddress = "0x...";
|
|
894
|
+
* const signers = [
|
|
895
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
896
|
+
* privateKeyToAccount("0x..."),
|
|
897
|
+
* // ...
|
|
898
|
+
* privateKeyToAccount("0x..."),
|
|
899
|
+
* ];
|
|
900
|
+
*
|
|
901
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
902
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
903
|
+
*
|
|
904
|
+
* const data = await multiSignClient.subAccountSpotTransfer({
|
|
905
|
+
* subAccountUser: "0x...",
|
|
906
|
+
* isDeposit: true,
|
|
907
|
+
* token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
|
|
908
|
+
* amount: "1",
|
|
909
|
+
* });
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
subAccountSpotTransfer(...[args, signal]: Parameters<ExchangeClient["subAccountSpotTransfer"]>): ReturnType<ExchangeClient["subAccountSpotTransfer"]>;
|
|
913
|
+
/**
|
|
914
|
+
* @param args - The parameters for the request.
|
|
915
|
+
* @param signal - An optional abort signal.
|
|
916
|
+
* @returns Successful response without specific data.
|
|
917
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
918
|
+
*
|
|
919
|
+
* @see null - no documentation
|
|
920
|
+
* @example
|
|
921
|
+
* ```ts
|
|
922
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
923
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
924
|
+
*
|
|
925
|
+
* const multiSignAddress = "0x...";
|
|
926
|
+
* const signers = [
|
|
927
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
928
|
+
* privateKeyToAccount("0x..."),
|
|
929
|
+
* // ...
|
|
930
|
+
* privateKeyToAccount("0x..."),
|
|
931
|
+
* ];
|
|
932
|
+
*
|
|
933
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
934
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
935
|
+
*
|
|
936
|
+
* const data = await multiSignClient.subAccountTransfer({
|
|
937
|
+
* subAccountUser: "0x...",
|
|
938
|
+
* isDeposit: true,
|
|
939
|
+
* usd: 1 * 1e6,
|
|
940
|
+
* });
|
|
941
|
+
* ```
|
|
942
|
+
*/
|
|
943
|
+
subAccountTransfer(...[args, signal]: Parameters<ExchangeClient["subAccountTransfer"]>): ReturnType<ExchangeClient["subAccountTransfer"]>;
|
|
944
|
+
/**
|
|
945
|
+
* @param args - The parameters for the request.
|
|
946
|
+
* @param signal - An optional abort signal.
|
|
947
|
+
* @returns Successful response without specific data.
|
|
948
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
949
|
+
*
|
|
950
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
|
|
951
|
+
* @example
|
|
952
|
+
* ```ts
|
|
953
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
954
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
955
|
+
*
|
|
956
|
+
* const multiSignAddress = "0x...";
|
|
957
|
+
* const signers = [
|
|
958
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
959
|
+
* privateKeyToAccount("0x..."),
|
|
960
|
+
* // ...
|
|
961
|
+
* privateKeyToAccount("0x..."),
|
|
962
|
+
* ];
|
|
963
|
+
*
|
|
964
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
965
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
966
|
+
*
|
|
967
|
+
* const data = await multiSignClient.tokenDelegate({
|
|
968
|
+
* validator: "0x...",
|
|
969
|
+
* isUndelegate: true,
|
|
970
|
+
* wei: 1 * 1e8,
|
|
971
|
+
* });
|
|
972
|
+
* ```
|
|
973
|
+
*/
|
|
974
|
+
tokenDelegate(...[args, signal]: Parameters<ExchangeClient["tokenDelegate"]>): ReturnType<ExchangeClient["tokenDelegate"]>;
|
|
975
|
+
/**
|
|
976
|
+
* @param args - The parameters for the request.
|
|
977
|
+
* @param signal - An optional abort signal.
|
|
978
|
+
* @returns Successful variant of {@link TwapCancelResponse} without error status.
|
|
979
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
980
|
+
*
|
|
981
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
|
|
982
|
+
* @example
|
|
983
|
+
* ```ts
|
|
984
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
985
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
986
|
+
*
|
|
987
|
+
* const multiSignAddress = "0x...";
|
|
988
|
+
* const signers = [
|
|
989
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
990
|
+
* privateKeyToAccount("0x..."),
|
|
991
|
+
* // ...
|
|
992
|
+
* privateKeyToAccount("0x..."),
|
|
993
|
+
* ];
|
|
994
|
+
*
|
|
995
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
996
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
997
|
+
*
|
|
998
|
+
* const data = await multiSignClient.twapCancel({
|
|
999
|
+
* a: 0, // Asset index
|
|
1000
|
+
* t: 1, // TWAP ID
|
|
1001
|
+
* });
|
|
1002
|
+
* ```
|
|
1003
|
+
*/
|
|
1004
|
+
twapCancel(...[args, signal]: Parameters<ExchangeClient["twapCancel"]>): ReturnType<ExchangeClient["twapCancel"]>;
|
|
1005
|
+
/**
|
|
1006
|
+
* @param args - The parameters for the request.
|
|
1007
|
+
* @param signal - An optional abort signal.
|
|
1008
|
+
* @returns Successful variant of {@link TwapOrderResponse} without error status.
|
|
1009
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1010
|
+
*
|
|
1011
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```ts
|
|
1014
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1015
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1016
|
+
*
|
|
1017
|
+
* const multiSignAddress = "0x...";
|
|
1018
|
+
* const signers = [
|
|
1019
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1020
|
+
* privateKeyToAccount("0x..."),
|
|
1021
|
+
* // ...
|
|
1022
|
+
* privateKeyToAccount("0x..."),
|
|
1023
|
+
* ];
|
|
1024
|
+
*
|
|
1025
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1026
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1027
|
+
*
|
|
1028
|
+
* const data = await multiSignClient.twapOrder({
|
|
1029
|
+
* a: 0, // Asset index
|
|
1030
|
+
* b: true, // Buy order
|
|
1031
|
+
* s: "1", // Size
|
|
1032
|
+
* r: false, // Not reduce-only
|
|
1033
|
+
* m: 10, // Duration in minutes
|
|
1034
|
+
* t: true, // Randomize order timing
|
|
1035
|
+
* });
|
|
1036
|
+
* ```
|
|
1037
|
+
*/
|
|
1038
|
+
twapOrder(...[args, signal]: Parameters<ExchangeClient["twapOrder"]>): ReturnType<ExchangeClient["twapOrder"]>;
|
|
1039
|
+
/**
|
|
1040
|
+
* @param args - The parameters for the request.
|
|
1041
|
+
* @param signal - An optional abort signal.
|
|
1042
|
+
* @returns Successful response without specific data.
|
|
1043
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1044
|
+
*
|
|
1045
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
|
1046
|
+
* @example
|
|
1047
|
+
* ```ts
|
|
1048
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1049
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1050
|
+
*
|
|
1051
|
+
* const multiSignAddress = "0x...";
|
|
1052
|
+
* const signers = [
|
|
1053
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1054
|
+
* privateKeyToAccount("0x..."),
|
|
1055
|
+
* // ...
|
|
1056
|
+
* privateKeyToAccount("0x..."),
|
|
1057
|
+
* ];
|
|
1058
|
+
*
|
|
1059
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1060
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1061
|
+
*
|
|
1062
|
+
* const data = await multiSignClient.updateIsolatedMargin({
|
|
1063
|
+
* asset: 0,
|
|
1064
|
+
* isBuy: true,
|
|
1065
|
+
* ntli: 1 * 1e6,
|
|
1066
|
+
* });
|
|
1067
|
+
* ```
|
|
1068
|
+
*/
|
|
1069
|
+
updateIsolatedMargin(...[args, signal]: Parameters<ExchangeClient["updateIsolatedMargin"]>): ReturnType<ExchangeClient["updateIsolatedMargin"]>;
|
|
1070
|
+
/**
|
|
1071
|
+
* @param args - The parameters for the request.
|
|
1072
|
+
* @param signal - An optional abort signal.
|
|
1073
|
+
* @returns Successful response without specific data.
|
|
1074
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1075
|
+
*
|
|
1076
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
|
|
1077
|
+
* @example
|
|
1078
|
+
* ```ts
|
|
1079
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1080
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1081
|
+
*
|
|
1082
|
+
* const multiSignAddress = "0x...";
|
|
1083
|
+
* const signers = [
|
|
1084
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1085
|
+
* privateKeyToAccount("0x..."),
|
|
1086
|
+
* // ...
|
|
1087
|
+
* privateKeyToAccount("0x..."),
|
|
1088
|
+
* ];
|
|
1089
|
+
*
|
|
1090
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1091
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1092
|
+
*
|
|
1093
|
+
* const data = await multiSignClient.updateLeverage({
|
|
1094
|
+
* asset: 0,
|
|
1095
|
+
* isCross: true,
|
|
1096
|
+
* leverage: 5,
|
|
1097
|
+
* });
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1100
|
+
updateLeverage(...[args, signal]: Parameters<ExchangeClient["updateLeverage"]>): ReturnType<ExchangeClient["updateLeverage"]>;
|
|
1101
|
+
/**
|
|
1102
|
+
* @param args - The parameters for the request.
|
|
1103
|
+
* @param signal - An optional abort signal.
|
|
1104
|
+
* @returns Successful response without specific data.
|
|
1105
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1106
|
+
*
|
|
1107
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
|
|
1108
|
+
* @example
|
|
1109
|
+
* ```ts
|
|
1110
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1111
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1112
|
+
*
|
|
1113
|
+
* const multiSignAddress = "0x...";
|
|
1114
|
+
* const signers = [
|
|
1115
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1116
|
+
* privateKeyToAccount("0x..."),
|
|
1117
|
+
* // ...
|
|
1118
|
+
* privateKeyToAccount("0x..."),
|
|
1119
|
+
* ];
|
|
1120
|
+
*
|
|
1121
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1122
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1123
|
+
*
|
|
1124
|
+
* const data = await multiSignClient.usdClassTransfer({ amount: "1", toPerp: true });
|
|
1125
|
+
* ```
|
|
1126
|
+
*/
|
|
1127
|
+
usdClassTransfer(...[args, signal]: Parameters<ExchangeClient["usdClassTransfer"]>): ReturnType<ExchangeClient["usdClassTransfer"]>;
|
|
1128
|
+
/**
|
|
1129
|
+
* @param args - The parameters for the request.
|
|
1130
|
+
* @param signal - An optional abort signal.
|
|
1131
|
+
* @returns Successful response without specific data.
|
|
1132
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1133
|
+
*
|
|
1134
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-usdc-transfer
|
|
1135
|
+
* @example
|
|
1136
|
+
* ```ts
|
|
1137
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1138
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1139
|
+
*
|
|
1140
|
+
* const multiSignAddress = "0x...";
|
|
1141
|
+
* const signers = [
|
|
1142
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1143
|
+
* privateKeyToAccount("0x..."),
|
|
1144
|
+
* // ...
|
|
1145
|
+
* privateKeyToAccount("0x..."),
|
|
1146
|
+
* ];
|
|
1147
|
+
*
|
|
1148
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1149
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1150
|
+
*
|
|
1151
|
+
* const data = await multiSignClient.usdSend({ destination: "0x...", amount: "1" });
|
|
1152
|
+
* ```
|
|
1153
|
+
*/
|
|
1154
|
+
usdSend(...[args, signal]: Parameters<ExchangeClient["usdSend"]>): ReturnType<ExchangeClient["usdSend"]>;
|
|
1155
|
+
/**
|
|
1156
|
+
* @param args - The parameters for the request.
|
|
1157
|
+
* @param signal - An optional abort signal.
|
|
1158
|
+
* @returns Successful response without specific data.
|
|
1159
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1160
|
+
*
|
|
1161
|
+
* @see null - no documentation
|
|
1162
|
+
* @example
|
|
1163
|
+
* ```ts
|
|
1164
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1165
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1166
|
+
*
|
|
1167
|
+
* const multiSignAddress = "0x...";
|
|
1168
|
+
* const signers = [
|
|
1169
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1170
|
+
* privateKeyToAccount("0x..."),
|
|
1171
|
+
* // ...
|
|
1172
|
+
* privateKeyToAccount("0x..."),
|
|
1173
|
+
* ];
|
|
1174
|
+
*
|
|
1175
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1176
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1177
|
+
*
|
|
1178
|
+
* const data = await multiSignClient.vaultDistribute({ vaultAddress: "0x...", usd: 10 * 1e6 });
|
|
1179
|
+
* ```
|
|
1180
|
+
*/
|
|
1181
|
+
vaultDistribute(...[args, signal]: Parameters<ExchangeClient["vaultDistribute"]>): ReturnType<ExchangeClient["vaultDistribute"]>;
|
|
1182
|
+
/**
|
|
1183
|
+
* @param args - The parameters for the request.
|
|
1184
|
+
* @param signal - An optional abort signal.
|
|
1185
|
+
* @returns Successful response without specific data.
|
|
1186
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1187
|
+
*
|
|
1188
|
+
* @see null - no documentation
|
|
1189
|
+
* @example
|
|
1190
|
+
* ```ts
|
|
1191
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1192
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1193
|
+
*
|
|
1194
|
+
* const multiSignAddress = "0x...";
|
|
1195
|
+
* const signers = [
|
|
1196
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1197
|
+
* privateKeyToAccount("0x..."),
|
|
1198
|
+
* // ...
|
|
1199
|
+
* privateKeyToAccount("0x..."),
|
|
1200
|
+
* ];
|
|
1201
|
+
*
|
|
1202
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1203
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1204
|
+
*
|
|
1205
|
+
* const data = await multiSignClient.vaultModify({
|
|
1206
|
+
* vaultAddress: "0x...",
|
|
1207
|
+
* allowDeposits: true,
|
|
1208
|
+
* alwaysCloseOnWithdraw: false,
|
|
1209
|
+
* });
|
|
1210
|
+
* ```
|
|
1211
|
+
*/
|
|
1212
|
+
vaultModify(...[args, signal]: Parameters<ExchangeClient["vaultModify"]>): ReturnType<ExchangeClient["vaultModify"]>;
|
|
1213
|
+
/**
|
|
1214
|
+
* @param args - The parameters for the request.
|
|
1215
|
+
* @param signal - An optional abort signal.
|
|
1216
|
+
* @returns Successful response without specific data.
|
|
1217
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1218
|
+
*
|
|
1219
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
|
1220
|
+
* @example
|
|
1221
|
+
* ```ts
|
|
1222
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1223
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1224
|
+
*
|
|
1225
|
+
* const multiSignAddress = "0x...";
|
|
1226
|
+
* const signers = [
|
|
1227
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1228
|
+
* privateKeyToAccount("0x..."),
|
|
1229
|
+
* // ...
|
|
1230
|
+
* privateKeyToAccount("0x..."),
|
|
1231
|
+
* ];
|
|
1232
|
+
*
|
|
1233
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1234
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1235
|
+
*
|
|
1236
|
+
* const data = await multiSignClient.vaultTransfer({
|
|
1237
|
+
* vaultAddress: "0x...",
|
|
1238
|
+
* isDeposit: true,
|
|
1239
|
+
* usd: 10 * 1e6,
|
|
1240
|
+
* });
|
|
1241
|
+
* ```
|
|
1242
|
+
*/
|
|
1243
|
+
vaultTransfer(...[args, signal]: Parameters<ExchangeClient["vaultTransfer"]>): ReturnType<ExchangeClient["vaultTransfer"]>;
|
|
1244
|
+
/**
|
|
1245
|
+
* @param args - The parameters for the request.
|
|
1246
|
+
* @param signal - An optional abort signal.
|
|
1247
|
+
* @returns Successful response without specific data.
|
|
1248
|
+
* @throws {ApiRequestError} When the API returns an error response.
|
|
1249
|
+
*
|
|
1250
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
|
1251
|
+
* @example
|
|
1252
|
+
* ```ts
|
|
1253
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1254
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
1255
|
+
*
|
|
1256
|
+
* const multiSignAddress = "0x...";
|
|
1257
|
+
* const signers = [
|
|
1258
|
+
* privateKeyToAccount("0x..."), // first is leader
|
|
1259
|
+
* privateKeyToAccount("0x..."),
|
|
1260
|
+
* // ...
|
|
1261
|
+
* privateKeyToAccount("0x..."),
|
|
1262
|
+
* ];
|
|
1263
|
+
*
|
|
1264
|
+
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1265
|
+
* const multiSignClient = new hl.MultiSignClient({ transport, multiSignAddress, signers });
|
|
1266
|
+
*
|
|
1267
|
+
* const data = await multiSignClient.withdraw3({ destination: "0x...", amount: "1" });
|
|
1268
|
+
* ```
|
|
1269
|
+
*/
|
|
1270
|
+
withdraw3(...[args, signal]: Parameters<ExchangeClient["withdraw3"]>): ReturnType<ExchangeClient["withdraw3"]>;
|
|
1271
|
+
/** Extracts the wallet address from different wallet types. */
|
|
1272
|
+
protected _getWalletAddress(wallet: AbstractWalletWithAddress): Promise<`0x${string}`>;
|
|
1273
|
+
/** Signs L1 action with all signers for multi-signature operations. */
|
|
1274
|
+
protected _multiSignL1Action(args: {
|
|
1275
|
+
action: BaseExchangeRequest["action"];
|
|
1276
|
+
nonce: number;
|
|
1277
|
+
outerSigner: Hex;
|
|
1278
|
+
vaultAddress?: Hex;
|
|
1279
|
+
expiresAfter?: number;
|
|
1280
|
+
}): Promise<Signature[]>;
|
|
1281
|
+
/** Signs user-signed action with all signers for multi-signature operations. */
|
|
1282
|
+
protected _multiSignUserSignedAction(action: BaseExchangeRequest["action"] & {
|
|
1283
|
+
type: keyof typeof userSignedActionEip712Types;
|
|
1284
|
+
signatureChainId: string;
|
|
1285
|
+
} & ({
|
|
1286
|
+
nonce: number;
|
|
1287
|
+
time?: undefined;
|
|
1288
|
+
} | {
|
|
1289
|
+
time: number;
|
|
1290
|
+
nonce?: undefined;
|
|
1291
|
+
}), outerSigner: Hex): Promise<Signature[]>;
|
|
1292
|
+
}
|
|
1293
|
+
//# sourceMappingURL=multiSign.d.ts.map
|