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