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