@nktkas/hyperliquid 0.20.0 → 0.21.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 +40 -50
- package/esm/mod.d.ts +3 -4
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -4
- package/{script/src/clients/wallet.d.ts → esm/src/clients/exchange.d.ts} +100 -100
- package/esm/src/clients/exchange.d.ts.map +1 -0
- package/esm/src/clients/{wallet.js → exchange.js} +41 -41
- package/esm/src/clients/{public.d.ts → info.d.ts} +100 -100
- package/esm/src/clients/info.d.ts.map +1 -0
- package/esm/src/clients/{public.js → info.js} +51 -51
- package/{script/src/clients/event.d.ts → esm/src/clients/subscription.d.ts} +60 -78
- package/esm/src/clients/subscription.d.ts.map +1 -0
- package/esm/src/clients/{event.js → subscription.js} +57 -79
- package/esm/src/signing.d.ts +0 -1
- package/esm/src/signing.d.ts.map +1 -1
- package/esm/src/signing.js +0 -1
- package/esm/src/transports/base.d.ts +5 -7
- package/esm/src/transports/base.d.ts.map +1 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +3 -2
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.js +11 -5
- package/esm/src/transports/websocket/_websocket_async_request.d.ts +6 -4
- package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/esm/src/transports/websocket/_websocket_async_request.js +47 -28
- package/esm/src/transports/websocket/websocket_transport.d.ts +24 -21
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +60 -57
- package/esm/src/types/info/accounts.d.ts +1 -0
- package/esm/src/types/info/accounts.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +0 -1
- package/esm/src/types/mod.d.ts.map +1 -1
- package/esm/src/types/mod.js +1 -1
- package/package.json +1 -1
- package/script/mod.d.ts +3 -4
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +4 -5
- package/{esm/src/clients/wallet.d.ts → script/src/clients/exchange.d.ts} +100 -100
- package/script/src/clients/exchange.d.ts.map +1 -0
- package/script/src/clients/{wallet.js → exchange.js} +43 -43
- package/script/src/clients/{public.d.ts → info.d.ts} +100 -100
- package/script/src/clients/info.d.ts.map +1 -0
- package/script/src/clients/{public.js → info.js} +53 -53
- package/{esm/src/clients/event.d.ts → script/src/clients/subscription.d.ts} +60 -78
- package/script/src/clients/subscription.d.ts.map +1 -0
- package/script/src/clients/{event.js → subscription.js} +59 -81
- package/script/src/signing.d.ts +0 -1
- package/script/src/signing.d.ts.map +1 -1
- package/script/src/signing.js +52 -53
- package/script/src/transports/base.d.ts +5 -7
- package/script/src/transports/base.d.ts.map +1 -1
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts +3 -2
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/script/src/transports/websocket/_reconnecting_websocket.js +11 -5
- package/script/src/transports/websocket/_websocket_async_request.d.ts +6 -4
- package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
- package/script/src/transports/websocket/_websocket_async_request.js +47 -28
- package/script/src/transports/websocket/websocket_transport.d.ts +24 -21
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +60 -57
- package/script/src/types/info/accounts.d.ts +1 -0
- package/script/src/types/info/accounts.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +0 -1
- package/script/src/types/mod.d.ts.map +1 -1
- package/script/src/types/mod.js +24 -25
- package/esm/_dnt.polyfills.d.ts +0 -20
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -12
- package/esm/src/clients/event.d.ts.map +0 -1
- package/esm/src/clients/public.d.ts.map +0 -1
- package/esm/src/clients/wallet.d.ts.map +0 -1
- package/script/_dnt.polyfills.d.ts +0 -20
- package/script/_dnt.polyfills.d.ts.map +0 -1
- package/script/_dnt.polyfills.js +0 -23
- package/script/src/clients/event.d.ts.map +0 -1
- package/script/src/clients/public.d.ts.map +0 -1
- package/script/src/clients/wallet.d.ts.map +0 -1
package/script/mod.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import "./_dnt.polyfills.js";
|
|
2
1
|
export * from "./src/base.js";
|
|
3
2
|
export * from "./src/transports/base.js";
|
|
4
3
|
export type { AbstractEthersSigner, AbstractEthersV5Signer, AbstractExtendedViemWalletClient, AbstractViemWalletClient, AbstractWindowEthereum, } from "./src/signing.js";
|
|
5
|
-
export * from "./src/clients/
|
|
6
|
-
export * from "./src/clients/
|
|
7
|
-
export * from "./src/clients/
|
|
4
|
+
export * from "./src/clients/subscription.js";
|
|
5
|
+
export * from "./src/clients/info.js";
|
|
6
|
+
export * from "./src/clients/exchange.js";
|
|
8
7
|
export * from "./src/transports/http/http_transport.js";
|
|
9
8
|
export * from "./src/transports/websocket/websocket_transport.js";
|
|
10
9
|
export type * from "./src/types/exchange/responses.js";
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AAGzC,YAAY,EACR,oBAAoB,EACpB,sBAAsB,EACtB,gCAAgC,EAChC,wBAAwB,EACxB,sBAAsB,GACzB,MAAM,kBAAkB,CAAC;AAG1B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,mDAAmD,CAAC;AAGlE,mBAAmB,mCAAmC,CAAC;AACvD,mBAAmB,mCAAmC,CAAC;AACvD,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,6BAA6B,CAAC;AACjD,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,4BAA4B,CAAC;AAChD,mBAAmB,wCAAwC,CAAC"}
|
package/script/mod.js
CHANGED
|
@@ -18,19 +18,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
if (v !== undefined) module.exports = v;
|
|
19
19
|
}
|
|
20
20
|
else if (typeof define === "function" && define.amd) {
|
|
21
|
-
define(["require", "exports", "./
|
|
21
|
+
define(["require", "exports", "./src/base.js", "./src/transports/base.js", "./src/clients/subscription.js", "./src/clients/info.js", "./src/clients/exchange.js", "./src/transports/http/http_transport.js", "./src/transports/websocket/websocket_transport.js"], factory);
|
|
22
22
|
}
|
|
23
23
|
})(function (require, exports) {
|
|
24
24
|
"use strict";
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
// Base interfaces
|
|
27
|
-
require("./_dnt.polyfills.js");
|
|
28
27
|
__exportStar(require("./src/base.js"), exports);
|
|
29
28
|
__exportStar(require("./src/transports/base.js"), exports);
|
|
30
29
|
// Clients
|
|
31
|
-
__exportStar(require("./src/clients/
|
|
32
|
-
__exportStar(require("./src/clients/
|
|
33
|
-
__exportStar(require("./src/clients/
|
|
30
|
+
__exportStar(require("./src/clients/subscription.js"), exports);
|
|
31
|
+
__exportStar(require("./src/clients/info.js"), exports);
|
|
32
|
+
__exportStar(require("./src/clients/exchange.js"), exports);
|
|
34
33
|
// Transports
|
|
35
34
|
__exportStar(require("./src/transports/http/http_transport.js"), exports);
|
|
36
35
|
__exportStar(require("./src/transports/websocket/websocket_transport.js"), exports);
|
|
@@ -3,8 +3,8 @@ import type { IRequestTransport } from "../transports/base.js";
|
|
|
3
3
|
import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BaseExchangeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CDepositRequest, ConvertToMultiSigUserRequest_Signers, CreateSubAccountRequest, CreateVaultRequest, CSignerActionRequest_JailSelf, CSignerActionRequest_UnjailSelf, CValidatorActionRequest_ChangeProfile, CValidatorActionRequest_Register, CValidatorActionRequest_Unregister, CWithdrawRequest, EvmUserModifyRequest, ModifyRequest, MultiSigRequest, OrderRequest, PerpDeployRequest_RegisterAsset, PerpDeployRequest_SetOracle, PerpDexClassTransferRequest, RegisterReferrerRequest, ReserveRequestWeightRequest, ScheduleCancelRequest, SetDisplayNameRequest, SetReferrerRequest, SpotDeployRequest_Genesis, SpotDeployRequest_RegisterHyperliquidity, SpotDeployRequest_RegisterSpot, SpotDeployRequest_RegisterToken2, SpotDeployRequest_SetDeployerTradingFeeShare, SpotDeployRequest_UserGenesis, SpotSendRequest, SpotUserRequest, SubAccountSpotTransferRequest, SubAccountTransferRequest, TokenDelegateRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, UsdClassTransferRequest, UsdSendRequest, VaultDistributeRequest, VaultModifyRequest, VaultTransferRequest, Withdraw3Request } from "../types/exchange/requests.js";
|
|
4
4
|
import type { CancelResponse, CreateSubAccountResponse, CreateVaultResponse, ErrorResponse, OrderResponse, SuccessResponse, TwapCancelResponse, TwapOrderResponse } from "../types/exchange/responses.js";
|
|
5
5
|
import { type AbstractWallet } from "../signing.js";
|
|
6
|
-
/** Parameters for the {@linkcode
|
|
7
|
-
export interface
|
|
6
|
+
/** Parameters for the {@linkcode ExchangeClient} constructor. */
|
|
7
|
+
export interface ExchangeClientParameters<T extends IRequestTransport = IRequestTransport, W extends AbstractWallet = AbstractWallet> {
|
|
8
8
|
/** The transport used to connect to the Hyperliquid API. */
|
|
9
9
|
transport: T;
|
|
10
10
|
/** The `viem`, `ethers.js`, or `window.ethereum` wallet used for signing transactions. */
|
|
@@ -33,112 +33,112 @@ export interface WalletClientParameters<T extends IRequestTransport = IRequestTr
|
|
|
33
33
|
*/
|
|
34
34
|
nonceManager?: () => MaybePromise<number>;
|
|
35
35
|
}
|
|
36
|
-
/** Parameters for the {@linkcode
|
|
36
|
+
/** Parameters for the {@linkcode ExchangeClient.approveAgent} method. */
|
|
37
37
|
export type ApproveAgentParameters = Omit<ApproveAgentRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
|
|
38
|
-
/** Parameters for the {@linkcode
|
|
38
|
+
/** Parameters for the {@linkcode ExchangeClient.approveBuilderFee} method. */
|
|
39
39
|
export type ApproveBuilderFeeParameters = Omit<ApproveBuilderFeeRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
|
|
40
|
-
/** Parameters for the {@linkcode
|
|
40
|
+
/** Parameters for the {@linkcode ExchangeClient.batchModify} method. */
|
|
41
41
|
export type BatchModifyParameters = Omit<BatchModifyRequest["action"], "type"> & Partial<Pick<BatchModifyRequest, "vaultAddress">> & Partial<Pick<BatchModifyRequest, "expiresAfter">>;
|
|
42
|
-
/** Parameters for the {@linkcode
|
|
42
|
+
/** Parameters for the {@linkcode ExchangeClient.cancel} method. */
|
|
43
43
|
export type CancelParameters = Omit<CancelRequest["action"], "type"> & Partial<Pick<CancelRequest, "vaultAddress">> & Partial<Pick<CancelRequest, "expiresAfter">>;
|
|
44
|
-
/** Parameters for the {@linkcode
|
|
44
|
+
/** Parameters for the {@linkcode ExchangeClient.cancelByCloid} method. */
|
|
45
45
|
export type CancelByCloidParameters = Omit<CancelByCloidRequest["action"], "type"> & Partial<Pick<CancelByCloidRequest, "vaultAddress">> & Partial<Pick<CancelByCloidRequest, "expiresAfter">>;
|
|
46
|
-
/** Parameters for the {@linkcode
|
|
46
|
+
/** Parameters for the {@linkcode ExchangeClient.cDeposit} method. */
|
|
47
47
|
export type CDepositParameters = Omit<CDepositRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
|
|
48
|
-
/** Parameters for the {@linkcode
|
|
48
|
+
/** Parameters for the {@linkcode ExchangeClient.convertToMultiSigUser} method. */
|
|
49
49
|
export type ConvertToMultiSigUserParameters = NonNullable<ConvertToMultiSigUserRequest_Signers>;
|
|
50
|
-
/** Parameters for the {@linkcode
|
|
50
|
+
/** Parameters for the {@linkcode ExchangeClient.createSubAccount} method. */
|
|
51
51
|
export type CreateSubAccountParameters = Omit<CreateSubAccountRequest["action"], "type">;
|
|
52
|
-
/** Parameters for the {@linkcode
|
|
52
|
+
/** Parameters for the {@linkcode ExchangeClient.createVault} method. */
|
|
53
53
|
export type CreateVaultParameters = Omit<CreateVaultRequest["action"], "type" | "nonce">;
|
|
54
|
-
/** Parameters for the {@linkcode
|
|
54
|
+
/** Parameters for the {@linkcode ExchangeClient.cSignerAction} method. */
|
|
55
55
|
export type CSignerActionParameters = CSignerActionParameters_JailSelf | CSignerActionParameters_UnjailSelf;
|
|
56
|
-
/** One of the parameters for the {@linkcode
|
|
56
|
+
/** One of the parameters for the {@linkcode ExchangeClient.cSignerAction} method. */
|
|
57
57
|
export type CSignerActionParameters_JailSelf = Omit<CSignerActionRequest_JailSelf["action"], "type"> & Partial<Pick<CSignerActionRequest_JailSelf, "expiresAfter">>;
|
|
58
|
-
/** One of the parameters for the {@linkcode
|
|
58
|
+
/** One of the parameters for the {@linkcode ExchangeClient.cSignerAction} method. */
|
|
59
59
|
export type CSignerActionParameters_UnjailSelf = Omit<CSignerActionRequest_UnjailSelf["action"], "type"> & Partial<Pick<CSignerActionRequest_UnjailSelf, "expiresAfter">>;
|
|
60
|
-
/** Parameters for the {@linkcode
|
|
60
|
+
/** Parameters for the {@linkcode ExchangeClient.cValidatorAction} method. */
|
|
61
61
|
export type CValidatorActionParameters = CValidatorActionParameters_ChangeProfile | CValidatorActionParameters_Register | CValidatorActionParameters_Unregister;
|
|
62
|
-
/** One of the parameters for the {@linkcode
|
|
62
|
+
/** One of the parameters for the {@linkcode ExchangeClient.cValidatorAction} method. */
|
|
63
63
|
export type CValidatorActionParameters_ChangeProfile = Omit<CValidatorActionRequest_ChangeProfile["action"], "type"> & Partial<Pick<CValidatorActionRequest_ChangeProfile, "expiresAfter">>;
|
|
64
|
-
/** One of the parameters for the {@linkcode
|
|
64
|
+
/** One of the parameters for the {@linkcode ExchangeClient.cValidatorAction} method. */
|
|
65
65
|
export type CValidatorActionParameters_Register = Omit<CValidatorActionRequest_Register["action"], "type"> & Partial<Pick<CValidatorActionRequest_Register, "expiresAfter">>;
|
|
66
|
-
/** One of the parameters for the {@linkcode
|
|
66
|
+
/** One of the parameters for the {@linkcode ExchangeClient.cValidatorAction} method. */
|
|
67
67
|
export type CValidatorActionParameters_Unregister = Omit<CValidatorActionRequest_Unregister["action"], "type"> & Partial<Pick<CValidatorActionRequest_Unregister, "expiresAfter">>;
|
|
68
|
-
/** Parameters for the {@linkcode
|
|
68
|
+
/** Parameters for the {@linkcode ExchangeClient.cWithdraw} method. */
|
|
69
69
|
export type CWithdrawParameters = Omit<CWithdrawRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
|
|
70
|
-
/** Parameters for the {@linkcode
|
|
70
|
+
/** Parameters for the {@linkcode ExchangeClient.evmUserModify} method. */
|
|
71
71
|
export type EvmUserModifyParameters = Omit<EvmUserModifyRequest["action"], "type">;
|
|
72
|
-
/** Parameters for the {@linkcode
|
|
72
|
+
/** Parameters for the {@linkcode ExchangeClient.modify} method. */
|
|
73
73
|
export type ModifyParameters = Omit<ModifyRequest["action"], "type"> & Partial<Pick<ModifyRequest, "vaultAddress">> & Partial<Pick<ModifyRequest, "expiresAfter">>;
|
|
74
|
-
/** Parameters for the {@linkcode
|
|
74
|
+
/** Parameters for the {@linkcode ExchangeClient.multiSig} method. */
|
|
75
75
|
export type MultiSigParameters = Omit<MultiSigRequest["action"], "type" | "signatureChainId"> & Partial<Pick<MultiSigRequest, "vaultAddress">> & Partial<Pick<MultiSigRequest, "expiresAfter">> & {
|
|
76
76
|
/** Must be the same for all signers. */
|
|
77
77
|
nonce: number;
|
|
78
78
|
};
|
|
79
|
-
/** Parameters for the {@linkcode
|
|
79
|
+
/** Parameters for the {@linkcode ExchangeClient.order} method. */
|
|
80
80
|
export type OrderParameters = Omit<OrderRequest["action"], "type"> & Partial<Pick<OrderRequest, "vaultAddress">> & Partial<Pick<OrderRequest, "expiresAfter">>;
|
|
81
|
-
/** Parameters for the {@linkcode
|
|
81
|
+
/** Parameters for the {@linkcode ExchangeClient.perpDeploy} method. */
|
|
82
82
|
export type PerpDeployParameters = PerpDeployParameters_RegisterAsset | PerpDeployParameters_SetOracle;
|
|
83
|
-
/** One of the parameters for the {@linkcode
|
|
83
|
+
/** One of the parameters for the {@linkcode ExchangeClient.perpDeploy} method. */
|
|
84
84
|
export type PerpDeployParameters_RegisterAsset = Omit<PerpDeployRequest_RegisterAsset["action"], "type">;
|
|
85
|
-
/** One of the parameters for the {@linkcode
|
|
85
|
+
/** One of the parameters for the {@linkcode ExchangeClient.perpDeploy} method. */
|
|
86
86
|
export type PerpDeployParameters_SetOracle = Omit<PerpDeployRequest_SetOracle["action"], "type">;
|
|
87
|
-
/** Parameters for the {@linkcode
|
|
87
|
+
/** Parameters for the {@linkcode ExchangeClient.perpDexClassTransfer} method. */
|
|
88
88
|
export type PerpDexClassTransferParameters = Omit<PerpDexClassTransferRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
|
|
89
|
-
/** Parameters for the {@linkcode
|
|
89
|
+
/** Parameters for the {@linkcode ExchangeClient.registerReferrer} method. */
|
|
90
90
|
export type RegisterReferrerParameters = Omit<RegisterReferrerRequest["action"], "type">;
|
|
91
|
-
/** Parameters for the {@linkcode
|
|
91
|
+
/** Parameters for the {@linkcode ExchangeClient.reserveRequestWeight} method. */
|
|
92
92
|
export type ReserveRequestWeightParameters = Omit<ReserveRequestWeightRequest["action"], "type"> & Partial<Pick<ReserveRequestWeightRequest, "expiresAfter">>;
|
|
93
|
-
/** Parameters for the {@linkcode
|
|
93
|
+
/** Parameters for the {@linkcode ExchangeClient.scheduleCancel} method. */
|
|
94
94
|
export type ScheduleCancelParameters = Omit<ScheduleCancelRequest["action"], "type"> & Partial<Pick<ScheduleCancelRequest, "vaultAddress">> & Partial<Pick<ScheduleCancelRequest, "expiresAfter">>;
|
|
95
|
-
/** Parameters for the {@linkcode
|
|
95
|
+
/** Parameters for the {@linkcode ExchangeClient.setDisplayName} method. */
|
|
96
96
|
export type SetDisplayNameParameters = Omit<SetDisplayNameRequest["action"], "type">;
|
|
97
|
-
/** Parameters for the {@linkcode
|
|
97
|
+
/** Parameters for the {@linkcode ExchangeClient.setReferrer} method. */
|
|
98
98
|
export type SetReferrerParameters = Omit<SetReferrerRequest["action"], "type">;
|
|
99
|
-
/** Parameters for the {@linkcode
|
|
99
|
+
/** Parameters for the {@linkcode ExchangeClient.spotDeploy} method. */
|
|
100
100
|
export type SpotDeployParameters = SpotDeployParameters_Genesis | SpotDeployParameters_RegisterHyperliquidity | SpotDeployParameters_RegisterSpot | SpotDeployParameters_RegisterToken2 | SpotDeployParameters_SetDeployerTradingFeeShare | SpotDeployParameters_UserGenesis;
|
|
101
|
-
/** One of the parameters for the {@linkcode
|
|
101
|
+
/** One of the parameters for the {@linkcode ExchangeClient.spotDeploy} method. */
|
|
102
102
|
export type SpotDeployParameters_Genesis = Omit<SpotDeployRequest_Genesis["action"], "type">;
|
|
103
|
-
/** One of the parameters for the {@linkcode
|
|
103
|
+
/** One of the parameters for the {@linkcode ExchangeClient.spotDeploy} method. */
|
|
104
104
|
export type SpotDeployParameters_RegisterHyperliquidity = Omit<SpotDeployRequest_RegisterHyperliquidity["action"], "type">;
|
|
105
|
-
/** One of the parameters for the {@linkcode
|
|
105
|
+
/** One of the parameters for the {@linkcode ExchangeClient.spotDeploy} method. */
|
|
106
106
|
export type SpotDeployParameters_RegisterSpot = Omit<SpotDeployRequest_RegisterSpot["action"], "type">;
|
|
107
|
-
/** One of the parameters for the {@linkcode
|
|
107
|
+
/** One of the parameters for the {@linkcode ExchangeClient.spotDeploy} method. */
|
|
108
108
|
export type SpotDeployParameters_RegisterToken2 = Omit<SpotDeployRequest_RegisterToken2["action"], "type">;
|
|
109
|
-
/** One of the parameters for the {@linkcode
|
|
109
|
+
/** One of the parameters for the {@linkcode ExchangeClient.spotDeploy} method. */
|
|
110
110
|
export type SpotDeployParameters_SetDeployerTradingFeeShare = Omit<SpotDeployRequest_SetDeployerTradingFeeShare["action"], "type">;
|
|
111
|
-
/** One of the parameters for the {@linkcode
|
|
111
|
+
/** One of the parameters for the {@linkcode ExchangeClient.spotDeploy} method. */
|
|
112
112
|
export type SpotDeployParameters_UserGenesis = Omit<SpotDeployRequest_UserGenesis["action"], "type">;
|
|
113
|
-
/** Parameters for the {@linkcode
|
|
113
|
+
/** Parameters for the {@linkcode ExchangeClient.spotSend} method. */
|
|
114
114
|
export type SpotSendParameters = Omit<SpotSendRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time">;
|
|
115
|
-
/** Parameters for the {@linkcode
|
|
115
|
+
/** Parameters for the {@linkcode ExchangeClient.spotUser} method. */
|
|
116
116
|
export type SpotUserParameters = Omit<SpotUserRequest["action"], "type">;
|
|
117
|
-
/** Parameters for the {@linkcode
|
|
117
|
+
/** Parameters for the {@linkcode ExchangeClient.subAccountSpotTransfer} method. */
|
|
118
118
|
export type SubAccountSpotTransferParameters = Omit<SubAccountSpotTransferRequest["action"], "type">;
|
|
119
|
-
/** Parameters for the {@linkcode
|
|
119
|
+
/** Parameters for the {@linkcode ExchangeClient.subAccountTransfer} method. */
|
|
120
120
|
export type SubAccountTransferParameters = Omit<SubAccountTransferRequest["action"], "type">;
|
|
121
|
-
/** Parameters for the {@linkcode
|
|
121
|
+
/** Parameters for the {@linkcode ExchangeClient.tokenDelegate} method. */
|
|
122
122
|
export type TokenDelegateParameters = Omit<TokenDelegateRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
|
|
123
|
-
/** Parameters for the {@linkcode
|
|
123
|
+
/** Parameters for the {@linkcode ExchangeClient.twapCancel} method. */
|
|
124
124
|
export type TwapCancelParameters = Omit<TwapCancelRequest["action"], "type"> & Partial<Pick<TwapCancelRequest, "vaultAddress">> & Partial<Pick<TwapCancelRequest, "expiresAfter">>;
|
|
125
|
-
/** Parameters for the {@linkcode
|
|
125
|
+
/** Parameters for the {@linkcode ExchangeClient.twapOrder} method. */
|
|
126
126
|
export type TwapOrderParameters = TwapOrderRequest["action"]["twap"] & Partial<Pick<TwapOrderRequest, "vaultAddress">> & Partial<Pick<TwapOrderRequest, "expiresAfter">>;
|
|
127
|
-
/** Parameters for the {@linkcode
|
|
127
|
+
/** Parameters for the {@linkcode ExchangeClient.updateIsolatedMargin} method. */
|
|
128
128
|
export type UpdateIsolatedMarginParameters = Omit<UpdateIsolatedMarginRequest["action"], "type"> & Partial<Pick<UpdateIsolatedMarginRequest, "vaultAddress">> & Partial<Pick<UpdateIsolatedMarginRequest, "expiresAfter">>;
|
|
129
|
-
/** Parameters for the {@linkcode
|
|
129
|
+
/** Parameters for the {@linkcode ExchangeClient.updateLeverage} method. */
|
|
130
130
|
export type UpdateLeverageParameters = Omit<UpdateLeverageRequest["action"], "type"> & Partial<Pick<UpdateLeverageRequest, "vaultAddress">> & Partial<Pick<UpdateLeverageRequest, "expiresAfter">>;
|
|
131
|
-
/** Parameters for the {@linkcode
|
|
131
|
+
/** Parameters for the {@linkcode ExchangeClient.usdClassTransfer} method. */
|
|
132
132
|
export type UsdClassTransferParameters = Omit<UsdClassTransferRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
|
|
133
|
-
/** Parameters for the {@linkcode
|
|
133
|
+
/** Parameters for the {@linkcode ExchangeClient.usdSend} method. */
|
|
134
134
|
export type UsdSendParameters = Omit<UsdSendRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time">;
|
|
135
|
-
/** Parameters for the {@linkcode
|
|
135
|
+
/** Parameters for the {@linkcode ExchangeClient.vaultDistribute} method. */
|
|
136
136
|
export type VaultDistributeParameters = Omit<VaultDistributeRequest["action"], "type">;
|
|
137
|
-
/** Parameters for the {@linkcode
|
|
137
|
+
/** Parameters for the {@linkcode ExchangeClient.vaultModify} method. */
|
|
138
138
|
export type VaultModifyParameters = Omit<VaultModifyRequest["action"], "type">;
|
|
139
|
-
/** Parameters for the {@linkcode
|
|
139
|
+
/** Parameters for the {@linkcode ExchangeClient.vaultTransfer} method. */
|
|
140
140
|
export type VaultTransferParameters = Omit<VaultTransferRequest["action"], "type"> & Partial<Pick<VaultTransferRequest, "expiresAfter">>;
|
|
141
|
-
/** Parameters for the {@linkcode
|
|
141
|
+
/** Parameters for the {@linkcode ExchangeClient.withdraw3} method. */
|
|
142
142
|
export type Withdraw3Parameters = Omit<Withdraw3Request["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time">;
|
|
143
143
|
/** Successful variant of {@linkcode CancelResponse} without error statuses. */
|
|
144
144
|
export type CancelResponseSuccess = CancelResponse & {
|
|
@@ -186,11 +186,11 @@ export declare class ApiRequestError extends HyperliquidError {
|
|
|
186
186
|
constructor(response: ErrorResponse | OrderResponse | CancelResponse | TwapOrderResponse | TwapCancelResponse);
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
|
-
*
|
|
189
|
+
* Exchange client for interacting with the Hyperliquid API.
|
|
190
190
|
* @typeParam T The transport used to connect to the Hyperliquid API.
|
|
191
191
|
* @typeParam W The WalletClient/Account ([viem](https://viem.sh/docs/clients/wallet)) or Signer ([ethers.js](https://docs.ethers.io/v6/api/providers/#Signer)) used for signing transactions.
|
|
192
192
|
*/
|
|
193
|
-
export declare class
|
|
193
|
+
export declare class ExchangeClient<T extends IRequestTransport = IRequestTransport, W extends AbstractWallet = AbstractWallet> implements ExchangeClientParameters, AsyncDisposable {
|
|
194
194
|
transport: T;
|
|
195
195
|
wallet: W;
|
|
196
196
|
isTestnet: boolean;
|
|
@@ -210,7 +210,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
210
210
|
* const wallet = privateKeyToAccount("0x...");
|
|
211
211
|
*
|
|
212
212
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
213
|
-
* const
|
|
213
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
214
214
|
* ```
|
|
215
215
|
*
|
|
216
216
|
* @example Private key via [ethers.js](https://docs.ethers.org/v6/api/wallet/#Wallet) or [ethers.js v5](https://docs.ethers.org/v5/api/signer/#Wallet)
|
|
@@ -221,7 +221,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
221
221
|
* const wallet = new ethers.Wallet("0x...");
|
|
222
222
|
*
|
|
223
223
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
224
|
-
* const
|
|
224
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
225
225
|
* ```
|
|
226
226
|
*
|
|
227
227
|
* @example External wallet (e.g. MetaMask) via [viem](https://viem.sh/docs/clients/wallet#optional-hoist-the-account)
|
|
@@ -233,7 +233,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
233
233
|
* const wallet = createWalletClient({ account, transport: custom(window.ethereum) });
|
|
234
234
|
*
|
|
235
235
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
236
|
-
* const
|
|
236
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
237
237
|
* ```
|
|
238
238
|
*
|
|
239
239
|
* @example External wallet (e.g. MetaMask) via `window.ethereum` directly
|
|
@@ -241,10 +241,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
241
241
|
* import * as hl from "@nktkas/hyperliquid";
|
|
242
242
|
*
|
|
243
243
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
244
|
-
* const
|
|
244
|
+
* const exchClient = new hl.ExchangeClient({ wallet: window.ethereum, transport });
|
|
245
245
|
* ```
|
|
246
246
|
*/
|
|
247
|
-
constructor(args:
|
|
247
|
+
constructor(args: ExchangeClientParameters<T, W>);
|
|
248
248
|
/**
|
|
249
249
|
* Approve an agent to sign on behalf of the master account.
|
|
250
250
|
* @param args - The parameters for the request.
|
|
@@ -260,7 +260,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
260
260
|
*
|
|
261
261
|
* const wallet = privateKeyToAccount("0x...");
|
|
262
262
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
263
|
-
* const
|
|
263
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
264
264
|
*
|
|
265
265
|
* const result = await client.approveAgent({ agentAddress: "0x...", agentName: "agentName" });
|
|
266
266
|
* ```
|
|
@@ -281,7 +281,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
281
281
|
*
|
|
282
282
|
* const wallet = privateKeyToAccount("0x...");
|
|
283
283
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
284
|
-
* const
|
|
284
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
285
285
|
*
|
|
286
286
|
* const result = await client.approveBuilderFee({ maxFeeRate: "0.01%", builder: "0x..." });
|
|
287
287
|
* ```
|
|
@@ -302,7 +302,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
302
302
|
*
|
|
303
303
|
* const wallet = privateKeyToAccount("0x...");
|
|
304
304
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
305
|
-
* const
|
|
305
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
306
306
|
*
|
|
307
307
|
* const result = await client.batchModify({
|
|
308
308
|
* modifies: [{
|
|
@@ -340,7 +340,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
340
340
|
*
|
|
341
341
|
* const wallet = privateKeyToAccount("0x...");
|
|
342
342
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
343
|
-
* const
|
|
343
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
344
344
|
*
|
|
345
345
|
* const result = await client.cancel({
|
|
346
346
|
* cancels: [{
|
|
@@ -366,7 +366,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
366
366
|
*
|
|
367
367
|
* const wallet = privateKeyToAccount("0x...");
|
|
368
368
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
369
|
-
* const
|
|
369
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
370
370
|
*
|
|
371
371
|
* const result = await client.cancelByCloid({
|
|
372
372
|
* cancels: [
|
|
@@ -391,7 +391,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
391
391
|
*
|
|
392
392
|
* const wallet = privateKeyToAccount("0x...");
|
|
393
393
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
394
|
-
* const
|
|
394
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
395
395
|
*
|
|
396
396
|
* const result = await client.cDeposit({ wei: 1 * 1e8 });
|
|
397
397
|
* ```
|
|
@@ -412,7 +412,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
412
412
|
*
|
|
413
413
|
* const wallet = privateKeyToAccount("0x...");
|
|
414
414
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
415
|
-
* const
|
|
415
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
416
416
|
*
|
|
417
417
|
* const result = await client.claimRewards();
|
|
418
418
|
* ```
|
|
@@ -433,7 +433,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
433
433
|
*
|
|
434
434
|
* const wallet = privateKeyToAccount("0x...");
|
|
435
435
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
436
|
-
* const
|
|
436
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
437
437
|
*
|
|
438
438
|
* const result = await client.convertToMultiSigUser({
|
|
439
439
|
* authorizedUsers: ["0x...", "0x..."],
|
|
@@ -457,7 +457,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
457
457
|
*
|
|
458
458
|
* const wallet = privateKeyToAccount("0x...");
|
|
459
459
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
460
|
-
* const
|
|
460
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
461
461
|
*
|
|
462
462
|
* const result = await client.createSubAccount({ name: "subAccountName" });
|
|
463
463
|
* ```
|
|
@@ -478,7 +478,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
478
478
|
*
|
|
479
479
|
* const wallet = privateKeyToAccount("0x...");
|
|
480
480
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
481
|
-
* const
|
|
481
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
482
482
|
*
|
|
483
483
|
* const result = await client.createVault({
|
|
484
484
|
* name: "VaultName",
|
|
@@ -503,7 +503,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
503
503
|
*
|
|
504
504
|
* const wallet = privateKeyToAccount("0x...");
|
|
505
505
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
506
|
-
* const
|
|
506
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
507
507
|
*
|
|
508
508
|
* // Jail self
|
|
509
509
|
* const result = await client.cSignerAction({ jailSelf: null });
|
|
@@ -528,7 +528,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
528
528
|
*
|
|
529
529
|
* const wallet = privateKeyToAccount("0x...");
|
|
530
530
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
531
|
-
* const
|
|
531
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
532
532
|
*
|
|
533
533
|
* // Change validator profile
|
|
534
534
|
* const result = await client.cValidatorAction({
|
|
@@ -558,7 +558,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
558
558
|
*
|
|
559
559
|
* const wallet = privateKeyToAccount("0x...");
|
|
560
560
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
561
|
-
* const
|
|
561
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
562
562
|
*
|
|
563
563
|
* const result = await client.cWithdraw({ wei: 1 * 1e8 });
|
|
564
564
|
* ```
|
|
@@ -579,7 +579,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
579
579
|
*
|
|
580
580
|
* const wallet = privateKeyToAccount("0x...");
|
|
581
581
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
582
|
-
* const
|
|
582
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
583
583
|
*
|
|
584
584
|
* const result = await client.evmUserModify({ usingBigBlocks: true });
|
|
585
585
|
* ```
|
|
@@ -600,7 +600,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
600
600
|
*
|
|
601
601
|
* const wallet = privateKeyToAccount("0x...");
|
|
602
602
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
603
|
-
* const
|
|
603
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
604
604
|
*
|
|
605
605
|
* const result = await client.modify({
|
|
606
606
|
* oid: 123,
|
|
@@ -636,7 +636,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
636
636
|
*
|
|
637
637
|
* const wallet = privateKeyToAccount("0x...");
|
|
638
638
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
639
|
-
* const
|
|
639
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
640
640
|
*
|
|
641
641
|
* const multiSigUser = "0x..."; // Multi-sig user address
|
|
642
642
|
*
|
|
@@ -678,7 +678,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
678
678
|
*
|
|
679
679
|
* const wallet = privateKeyToAccount("0x...");
|
|
680
680
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
681
|
-
* const
|
|
681
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
682
682
|
*
|
|
683
683
|
* const result = await client.order({
|
|
684
684
|
* orders: [{
|
|
@@ -725,7 +725,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
725
725
|
*
|
|
726
726
|
* const wallet = privateKeyToAccount("0x...");
|
|
727
727
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
728
|
-
* const
|
|
728
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
729
729
|
*
|
|
730
730
|
* const result = await client.perpDexClassTransfer({
|
|
731
731
|
* dex: "test",
|
|
@@ -751,7 +751,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
751
751
|
*
|
|
752
752
|
* const wallet = privateKeyToAccount("0x...");
|
|
753
753
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
754
|
-
* const
|
|
754
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
755
755
|
*
|
|
756
756
|
* const result = await client.registerReferrer({ code: "TEST" });
|
|
757
757
|
* ```
|
|
@@ -772,7 +772,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
772
772
|
*
|
|
773
773
|
* const wallet = privateKeyToAccount("0x...");
|
|
774
774
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
775
|
-
* const
|
|
775
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
776
776
|
*
|
|
777
777
|
* const result = await client.reserveRequestWeight({ weight: 10 });
|
|
778
778
|
* ```
|
|
@@ -793,7 +793,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
793
793
|
*
|
|
794
794
|
* const wallet = privateKeyToAccount("0x...");
|
|
795
795
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
796
|
-
* const
|
|
796
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
797
797
|
*
|
|
798
798
|
* const result = await client.scheduleCancel({ time: Date.now() + 3600000 });
|
|
799
799
|
* ```
|
|
@@ -815,7 +815,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
815
815
|
*
|
|
816
816
|
* const wallet = privateKeyToAccount("0x...");
|
|
817
817
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
818
|
-
* const
|
|
818
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
819
819
|
*
|
|
820
820
|
* const result = await client.setDisplayName({ displayName: "My Name" });
|
|
821
821
|
* ```
|
|
@@ -836,7 +836,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
836
836
|
*
|
|
837
837
|
* const wallet = privateKeyToAccount("0x...");
|
|
838
838
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
839
|
-
* const
|
|
839
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
840
840
|
*
|
|
841
841
|
* const result = await client.setReferrer({ code: "TEST" });
|
|
842
842
|
* ```
|
|
@@ -872,7 +872,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
872
872
|
*
|
|
873
873
|
* const wallet = privateKeyToAccount("0x...");
|
|
874
874
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
875
|
-
* const
|
|
875
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
876
876
|
*
|
|
877
877
|
* const result = await client.spotSend({
|
|
878
878
|
* destination: "0x...",
|
|
@@ -897,7 +897,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
897
897
|
*
|
|
898
898
|
* const wallet = privateKeyToAccount("0x...");
|
|
899
899
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
900
|
-
* const
|
|
900
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
901
901
|
*
|
|
902
902
|
* const result = await client.spotUser({ toggleSpotDusting: { optOut: false } });
|
|
903
903
|
* ```
|
|
@@ -918,7 +918,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
918
918
|
*
|
|
919
919
|
* const wallet = privateKeyToAccount("0x...");
|
|
920
920
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
921
|
-
* const
|
|
921
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
922
922
|
*
|
|
923
923
|
* const result = await client.subAccountSpotTransfer({
|
|
924
924
|
* subAccountUser: "0x...",
|
|
@@ -944,7 +944,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
944
944
|
*
|
|
945
945
|
* const wallet = privateKeyToAccount("0x...");
|
|
946
946
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
947
|
-
* const
|
|
947
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
948
948
|
*
|
|
949
949
|
* const result = await client.subAccountTransfer({
|
|
950
950
|
* subAccountUser: "0x...",
|
|
@@ -969,7 +969,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
969
969
|
*
|
|
970
970
|
* const wallet = privateKeyToAccount("0x...");
|
|
971
971
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
972
|
-
* const
|
|
972
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
973
973
|
*
|
|
974
974
|
* const result = await client.tokenDelegate({
|
|
975
975
|
* validator: "0x...",
|
|
@@ -994,7 +994,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
994
994
|
*
|
|
995
995
|
* const wallet = privateKeyToAccount("0x...");
|
|
996
996
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
997
|
-
* const
|
|
997
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
998
998
|
*
|
|
999
999
|
* const result = await client.twapCancel({
|
|
1000
1000
|
* a: 0, // Asset index
|
|
@@ -1018,7 +1018,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1018
1018
|
*
|
|
1019
1019
|
* const wallet = privateKeyToAccount("0x...");
|
|
1020
1020
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1021
|
-
* const
|
|
1021
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1022
1022
|
*
|
|
1023
1023
|
* const result = await client.twapOrder({
|
|
1024
1024
|
* a: 0, // Asset index
|
|
@@ -1046,7 +1046,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1046
1046
|
*
|
|
1047
1047
|
* const wallet = privateKeyToAccount("0x...");
|
|
1048
1048
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1049
|
-
* const
|
|
1049
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1050
1050
|
*
|
|
1051
1051
|
* const result = await client.updateIsolatedMargin({ asset: 0, isBuy: true, ntli: 1 * 1e6 });
|
|
1052
1052
|
* ```
|
|
@@ -1067,7 +1067,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1067
1067
|
*
|
|
1068
1068
|
* const wallet = privateKeyToAccount("0x...");
|
|
1069
1069
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1070
|
-
* const
|
|
1070
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1071
1071
|
*
|
|
1072
1072
|
* const result = await client.updateLeverage({ asset: 0, isCross: true, leverage: 5 });
|
|
1073
1073
|
* ```
|
|
@@ -1088,7 +1088,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1088
1088
|
*
|
|
1089
1089
|
* const wallet = privateKeyToAccount("0x...");
|
|
1090
1090
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1091
|
-
* const
|
|
1091
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1092
1092
|
*
|
|
1093
1093
|
* const result = await client.usdClassTransfer({ amount: "1", toPerp: true });
|
|
1094
1094
|
* ```
|
|
@@ -1109,7 +1109,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1109
1109
|
*
|
|
1110
1110
|
* const wallet = privateKeyToAccount("0x...");
|
|
1111
1111
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1112
|
-
* const
|
|
1112
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1113
1113
|
*
|
|
1114
1114
|
* const result = await client.usdSend({ destination: "0x...", amount: "1" });
|
|
1115
1115
|
* ```
|
|
@@ -1130,7 +1130,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1130
1130
|
*
|
|
1131
1131
|
* const wallet = privateKeyToAccount("0x...");
|
|
1132
1132
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1133
|
-
* const
|
|
1133
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1134
1134
|
*
|
|
1135
1135
|
* const result = await client.vaultDistribute({ vaultAddress: "0x...", usd: 10 * 1e6 });
|
|
1136
1136
|
* ```
|
|
@@ -1151,7 +1151,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1151
1151
|
*
|
|
1152
1152
|
* const wallet = privateKeyToAccount("0x...");
|
|
1153
1153
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1154
|
-
* const
|
|
1154
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1155
1155
|
*
|
|
1156
1156
|
* const result = await client.vaultModify({
|
|
1157
1157
|
* vaultAddress: "0x...",
|
|
@@ -1176,7 +1176,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1176
1176
|
*
|
|
1177
1177
|
* const wallet = privateKeyToAccount("0x...");
|
|
1178
1178
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1179
|
-
* const
|
|
1179
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1180
1180
|
*
|
|
1181
1181
|
* const result = await client.vaultTransfer({
|
|
1182
1182
|
* vaultAddress: "0x...",
|
|
@@ -1201,7 +1201,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1201
1201
|
*
|
|
1202
1202
|
* const wallet = privateKeyToAccount("0x...");
|
|
1203
1203
|
* const transport = new hl.HttpTransport(); // or WebSocketTransport
|
|
1204
|
-
* const
|
|
1204
|
+
* const exchClient = new hl.ExchangeClient({ wallet, transport });
|
|
1205
1205
|
*
|
|
1206
1206
|
* const result = await client.withdraw3({ destination: "0x...", amount: "1" });
|
|
1207
1207
|
* ```
|
|
@@ -1229,4 +1229,4 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
|
|
|
1229
1229
|
protected _validateResponse(response: SuccessResponse | ErrorResponse | CancelResponse | CreateSubAccountResponse | CreateVaultResponse | OrderResponse | TwapOrderResponse | TwapCancelResponse): asserts response is SuccessResponse | CancelResponseSuccess | CreateSubAccountResponse | CreateVaultResponse | OrderResponseSuccess | TwapOrderResponseSuccess | TwapCancelResponseSuccess;
|
|
1230
1230
|
[Symbol.asyncDispose](): Promise<void>;
|
|
1231
1231
|
}
|
|
1232
|
-
//# sourceMappingURL=
|
|
1232
|
+
//# sourceMappingURL=exchange.d.ts.map
|