@nktkas/hyperliquid 0.25.2 → 0.25.4
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 +36 -27
- package/esm/bin/cli.js +87 -87
- package/esm/src/api/exchange/agentEnableDexAbstraction.d.ts +74 -0
- package/esm/src/api/exchange/agentEnableDexAbstraction.d.ts.map +1 -0
- package/esm/src/api/exchange/agentEnableDexAbstraction.js +58 -0
- package/esm/src/api/exchange/agentEnableDexAbstraction.js.map +1 -0
- package/esm/src/api/exchange/multiSig.d.ts +3 -3
- package/esm/src/api/exchange/usdClassTransfer.d.ts +2 -2
- package/esm/src/api/exchange/usdClassTransfer.js +2 -2
- package/esm/src/api/exchange/usdSend.d.ts +2 -2
- package/esm/src/api/exchange/usdSend.js +2 -2
- package/esm/src/api/exchange/userDexAbstraction.d.ts +104 -0
- package/esm/src/api/exchange/userDexAbstraction.d.ts.map +1 -0
- package/esm/src/api/exchange/userDexAbstraction.js +79 -0
- package/esm/src/api/exchange/userDexAbstraction.js.map +1 -0
- package/esm/src/api/exchange/withdraw3.d.ts +2 -2
- package/esm/src/api/exchange/withdraw3.js +2 -2
- package/esm/src/api/exchange/~client.d.ts +100 -40
- package/esm/src/api/exchange/~client.d.ts.map +1 -1
- package/esm/src/api/exchange/~client.js +50 -0
- package/esm/src/api/exchange/~client.js.map +1 -1
- package/esm/src/api/exchange/~mod.d.ts +2 -0
- package/esm/src/api/exchange/~mod.d.ts.map +1 -1
- package/esm/src/api/exchange/~mod.js +2 -0
- package/esm/src/api/exchange/~mod.js.map +1 -1
- package/esm/src/api/info/activeAssetData.d.ts +2 -2
- package/esm/src/api/info/activeAssetData.js +2 -2
- package/esm/src/api/info/clearinghouseState.d.ts +2 -2
- package/esm/src/api/info/clearinghouseState.js +2 -2
- package/esm/src/api/info/subAccounts.d.ts +1 -1
- package/esm/src/api/info/twapHistory.d.ts +4 -0
- package/esm/src/api/info/twapHistory.d.ts.map +1 -1
- package/esm/src/api/info/twapHistory.js +2 -0
- package/esm/src/api/info/twapHistory.js.map +1 -1
- package/esm/src/api/info/userDexAbstraction.d.ts +49 -0
- package/esm/src/api/info/userDexAbstraction.d.ts.map +1 -0
- package/esm/src/api/info/userDexAbstraction.js +52 -0
- package/esm/src/api/info/userDexAbstraction.js.map +1 -0
- package/esm/src/api/info/webData2.d.ts +1 -1
- package/esm/src/api/info/~client.d.ts +23 -0
- package/esm/src/api/info/~client.d.ts.map +1 -1
- package/esm/src/api/info/~client.js +23 -0
- package/esm/src/api/info/~client.js.map +1 -1
- package/esm/src/api/info/~mod.d.ts +1 -0
- package/esm/src/api/info/~mod.d.ts.map +1 -1
- package/esm/src/api/info/~mod.js +1 -0
- package/esm/src/api/info/~mod.js.map +1 -1
- package/esm/src/api/subscription/activeAssetData.d.ts +1 -1
- package/esm/src/api/subscription/clearinghouseState.d.ts +1 -1
- package/esm/src/api/subscription/userTwapHistory.d.ts +5 -0
- package/esm/src/api/subscription/userTwapHistory.d.ts.map +1 -1
- package/esm/src/api/subscription/userTwapHistory.js +2 -0
- package/esm/src/api/subscription/userTwapHistory.js.map +1 -1
- package/esm/src/api/subscription/webData2.d.ts +1 -1
- package/package.json +1 -1
- package/script/bin/cli.js +87 -87
- package/script/src/api/exchange/agentEnableDexAbstraction.d.ts +74 -0
- package/script/src/api/exchange/agentEnableDexAbstraction.d.ts.map +1 -0
- package/script/src/api/exchange/agentEnableDexAbstraction.js +95 -0
- package/script/src/api/exchange/agentEnableDexAbstraction.js.map +1 -0
- package/script/src/api/exchange/multiSig.d.ts +3 -3
- package/script/src/api/exchange/usdClassTransfer.d.ts +2 -2
- package/script/src/api/exchange/usdClassTransfer.js +2 -2
- package/script/src/api/exchange/usdSend.d.ts +2 -2
- package/script/src/api/exchange/usdSend.js +2 -2
- package/script/src/api/exchange/userDexAbstraction.d.ts +104 -0
- package/script/src/api/exchange/userDexAbstraction.d.ts.map +1 -0
- package/script/src/api/exchange/userDexAbstraction.js +116 -0
- package/script/src/api/exchange/userDexAbstraction.js.map +1 -0
- package/script/src/api/exchange/withdraw3.d.ts +2 -2
- package/script/src/api/exchange/withdraw3.js +2 -2
- package/script/src/api/exchange/~client.d.ts +100 -40
- package/script/src/api/exchange/~client.d.ts.map +1 -1
- package/script/src/api/exchange/~client.js +50 -0
- package/script/src/api/exchange/~client.js.map +1 -1
- package/script/src/api/exchange/~mod.d.ts +2 -0
- package/script/src/api/exchange/~mod.d.ts.map +1 -1
- package/script/src/api/exchange/~mod.js +2 -0
- package/script/src/api/exchange/~mod.js.map +1 -1
- package/script/src/api/info/activeAssetData.d.ts +2 -2
- package/script/src/api/info/activeAssetData.js +2 -2
- package/script/src/api/info/clearinghouseState.d.ts +2 -2
- package/script/src/api/info/clearinghouseState.js +2 -2
- package/script/src/api/info/subAccounts.d.ts +1 -1
- package/script/src/api/info/twapHistory.d.ts +4 -0
- package/script/src/api/info/twapHistory.d.ts.map +1 -1
- package/script/src/api/info/twapHistory.js +2 -0
- package/script/src/api/info/twapHistory.js.map +1 -1
- package/script/src/api/info/userDexAbstraction.d.ts +49 -0
- package/script/src/api/info/userDexAbstraction.d.ts.map +1 -0
- package/script/src/api/info/userDexAbstraction.js +89 -0
- package/script/src/api/info/userDexAbstraction.js.map +1 -0
- package/script/src/api/info/webData2.d.ts +1 -1
- package/script/src/api/info/~client.d.ts +23 -0
- package/script/src/api/info/~client.d.ts.map +1 -1
- package/script/src/api/info/~client.js +23 -0
- package/script/src/api/info/~client.js.map +1 -1
- package/script/src/api/info/~mod.d.ts +1 -0
- package/script/src/api/info/~mod.d.ts.map +1 -1
- package/script/src/api/info/~mod.js +1 -0
- package/script/src/api/info/~mod.js.map +1 -1
- package/script/src/api/subscription/activeAssetData.d.ts +1 -1
- package/script/src/api/subscription/clearinghouseState.d.ts +1 -1
- package/script/src/api/subscription/userTwapHistory.d.ts +5 -0
- package/script/src/api/subscription/userTwapHistory.d.ts.map +1 -1
- package/script/src/api/subscription/userTwapHistory.js +2 -0
- package/script/src/api/subscription/userTwapHistory.js.map +1 -1
- package/script/src/api/subscription/webData2.d.ts +1 -1
- package/src/bin/cli.ts +87 -87
- package/src/src/api/exchange/agentEnableDexAbstraction.ts +96 -0
- package/src/src/api/exchange/usdClassTransfer.ts +2 -2
- package/src/src/api/exchange/usdSend.ts +2 -2
- package/src/src/api/exchange/userDexAbstraction.ts +142 -0
- package/src/src/api/exchange/withdraw3.ts +2 -2
- package/src/src/api/exchange/~client.ts +96 -40
- package/src/src/api/exchange/~mod.ts +2 -0
- package/src/src/api/info/activeAssetData.ts +2 -2
- package/src/src/api/info/clearinghouseState.ts +2 -2
- package/src/src/api/info/twapHistory.ts +5 -0
- package/src/src/api/info/userDexAbstraction.ts +79 -0
- package/src/src/api/info/~client.ts +25 -0
- package/src/src/api/info/~mod.ts +1 -0
- package/src/src/api/subscription/userTwapHistory.ts +5 -0
|
@@ -4,6 +4,7 @@ import type { IRequestTransport } from "../../transport/base.js";
|
|
|
4
4
|
import type { AbstractWallet } from "../../signing/mod.js";
|
|
5
5
|
import { PrivateKeyEIP712Signer } from "../../utils/minimalEIP712Signer.js";
|
|
6
6
|
|
|
7
|
+
import { agentEnableDexAbstraction } from "./agentEnableDexAbstraction.js";
|
|
7
8
|
import { approveAgent } from "./approveAgent.js";
|
|
8
9
|
import { approveBuilderFee } from "./approveBuilderFee.js";
|
|
9
10
|
import { batchModify } from "./batchModify.js";
|
|
@@ -42,51 +43,56 @@ import { updateIsolatedMargin } from "./updateIsolatedMargin.js";
|
|
|
42
43
|
import { updateLeverage } from "./updateLeverage.js";
|
|
43
44
|
import { usdClassTransfer } from "./usdClassTransfer.js";
|
|
44
45
|
import { usdSend } from "./usdSend.js";
|
|
46
|
+
import { userDexAbstraction } from "./userDexAbstraction.js";
|
|
45
47
|
import { vaultDistribute } from "./vaultDistribute.js";
|
|
46
48
|
import { vaultModify } from "./vaultModify.js";
|
|
47
49
|
import { vaultTransfer } from "./vaultTransfer.js";
|
|
48
50
|
import { withdraw3 } from "./withdraw3.js";
|
|
49
51
|
|
|
50
|
-
export type {
|
|
51
|
-
export type {
|
|
52
|
-
export type {
|
|
53
|
-
export type {
|
|
54
|
-
export type {
|
|
55
|
-
export type {
|
|
56
|
-
export type {
|
|
57
|
-
export type {
|
|
58
|
-
export type {
|
|
59
|
-
export type {
|
|
60
|
-
export type {
|
|
61
|
-
export type {
|
|
62
|
-
export type {
|
|
63
|
-
export type {
|
|
64
|
-
export type {
|
|
65
|
-
export type {
|
|
66
|
-
export type {
|
|
67
|
-
export type {
|
|
68
|
-
export type {
|
|
69
|
-
export type {
|
|
70
|
-
export type {
|
|
71
|
-
export type {
|
|
72
|
-
export type {
|
|
73
|
-
export type {
|
|
74
|
-
export type {
|
|
75
|
-
export type {
|
|
76
|
-
export type {
|
|
77
|
-
export type {
|
|
78
|
-
export type {
|
|
79
|
-
export type {
|
|
80
|
-
export type {
|
|
81
|
-
export type {
|
|
82
|
-
export type {
|
|
83
|
-
export type {
|
|
84
|
-
export type {
|
|
85
|
-
export type {
|
|
86
|
-
export type {
|
|
87
|
-
export type {
|
|
88
|
-
export type {
|
|
89
|
-
export type {
|
|
52
|
+
export type { AgentEnableDexAbstractionOptions } from "./agentEnableDexAbstraction.js";
|
|
53
|
+
export type { ApproveAgentOptions, ApproveAgentParameters } from "./approveAgent.js";
|
|
54
|
+
export type { ApproveBuilderFeeOptions, ApproveBuilderFeeParameters } from "./approveBuilderFee.js";
|
|
55
|
+
export type { BatchModifyOptions, BatchModifyParameters } from "./batchModify.js";
|
|
56
|
+
export type { CancelOptions, CancelParameters } from "./cancel.js";
|
|
57
|
+
export type { CancelByCloidOptions, CancelByCloidParameters } from "./cancelByCloid.js";
|
|
58
|
+
export type { CDepositOptions, CDepositParameters } from "./cDeposit.js";
|
|
59
|
+
export type { ClaimRewardsOptions } from "./claimRewards.js";
|
|
60
|
+
export type { ConvertToMultiSigUserOptions, ConvertToMultiSigUserParameters } from "./convertToMultiSigUser.js";
|
|
61
|
+
export type { CreateSubAccountOptions, CreateSubAccountParameters } from "./createSubAccount.js";
|
|
62
|
+
export type { CreateVaultOptions, CreateVaultParameters } from "./createVault.js";
|
|
63
|
+
export type { CSignerActionOptions, CSignerActionParameters } from "./cSignerAction.js";
|
|
64
|
+
export type { CValidatorActionOptions, CValidatorActionParameters } from "./cValidatorAction.js";
|
|
65
|
+
export type { CWithdrawOptions, CWithdrawParameters } from "./cWithdraw.js";
|
|
66
|
+
export type { EvmUserModifyOptions, EvmUserModifyParameters } from "./evmUserModify.js";
|
|
67
|
+
export type { ModifyOptions, ModifyParameters } from "./modify.js";
|
|
68
|
+
export type { MultiSigOptions, MultiSigParameters } from "./multiSig.js";
|
|
69
|
+
export type { OrderOptions, OrderParameters } from "./order.js";
|
|
70
|
+
export type { NoopOptions } from "./noop.js";
|
|
71
|
+
export type { PerpDeployOptions, PerpDeployParameters } from "./perpDeploy.js";
|
|
72
|
+
export type { RegisterReferrerOptions, RegisterReferrerParameters } from "./registerReferrer.js";
|
|
73
|
+
export type { ReserveRequestWeightOptions, ReserveRequestWeightParameters } from "./reserveRequestWeight.js";
|
|
74
|
+
export type { ScheduleCancelOptions, ScheduleCancelParameters } from "./scheduleCancel.js";
|
|
75
|
+
export type { SendAssetOptions, SendAssetParameters } from "./sendAsset.js";
|
|
76
|
+
export type { SetDisplayNameOptions, SetDisplayNameParameters } from "./setDisplayName.js";
|
|
77
|
+
export type { SetReferrerOptions, SetReferrerParameters } from "./setReferrer.js";
|
|
78
|
+
export type { SpotDeployOptions, SpotDeployParameters } from "./spotDeploy.js";
|
|
79
|
+
export type { SpotSendOptions, SpotSendParameters } from "./spotSend.js";
|
|
80
|
+
export type { SpotUserOptions, SpotUserParameters } from "./spotUser.js";
|
|
81
|
+
export type { SubAccountModifyOptions, SubAccountModifyParameters } from "./subAccountModify.js";
|
|
82
|
+
export type { SubAccountSpotTransferOptions, SubAccountSpotTransferParameters } from "./subAccountSpotTransfer.js";
|
|
83
|
+
export type { SubAccountTransferOptions, SubAccountTransferParameters } from "./subAccountTransfer.js";
|
|
84
|
+
export type { TokenDelegateOptions, TokenDelegateParameters } from "./tokenDelegate.js";
|
|
85
|
+
export type { TwapCancelOptions, TwapCancelParameters } from "./twapCancel.js";
|
|
86
|
+
export type { TwapOrderOptions, TwapOrderParameters } from "./twapOrder.js";
|
|
87
|
+
export type { UpdateIsolatedMarginOptions, UpdateIsolatedMarginParameters } from "./updateIsolatedMargin.js";
|
|
88
|
+
export type { UpdateLeverageOptions, UpdateLeverageParameters } from "./updateLeverage.js";
|
|
89
|
+
export type { UsdClassTransferOptions, UsdClassTransferParameters } from "./usdClassTransfer.js";
|
|
90
|
+
export type { UsdSendOptions, UsdSendParameters } from "./usdSend.js";
|
|
91
|
+
export type { UserDexAbstractionExchangeOptions, UserDexAbstractionExchangeParameters } from "./userDexAbstraction.js";
|
|
92
|
+
export type { VaultDistributeOptions, VaultDistributeParameters } from "./vaultDistribute.js";
|
|
93
|
+
export type { VaultModifyOptions, VaultModifyParameters } from "./vaultModify.js";
|
|
94
|
+
export type { VaultTransferOptions, VaultTransferParameters } from "./vaultTransfer.js";
|
|
95
|
+
export type { Withdraw3Options, Withdraw3Parameters } from "./withdraw3.js";
|
|
90
96
|
|
|
91
97
|
export type { CancelSuccessResponse } from "./cancel.js";
|
|
92
98
|
export type { CreateSubAccountResponse } from "./createSubAccount.js";
|
|
@@ -178,6 +184,31 @@ export class ExchangeClient<
|
|
|
178
184
|
this.nonceManager = args.nonceManager;
|
|
179
185
|
}
|
|
180
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Enable HIP-3 DEX abstraction.
|
|
189
|
+
* @param params - Parameters specific to the API request.
|
|
190
|
+
* @param opts - Request execution options.
|
|
191
|
+
* @returns Successful response without specific data.
|
|
192
|
+
*
|
|
193
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
194
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
195
|
+
*
|
|
196
|
+
* @see null
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
200
|
+
*
|
|
201
|
+
* const pk = "0x..."; // viem, ethers or private key
|
|
202
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
203
|
+
*
|
|
204
|
+
* const client = new hl.ExchangeClient({ transport, wallet: pk });
|
|
205
|
+
* await client.agentEnableDexAbstraction();
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
agentEnableDexAbstraction(...args: OmitFirst<OverloadedParameters<typeof agentEnableDexAbstraction>>) {
|
|
209
|
+
return agentEnableDexAbstraction(this, ...args);
|
|
210
|
+
}
|
|
211
|
+
|
|
181
212
|
/**
|
|
182
213
|
* Approve an agent to sign on behalf of the master account.
|
|
183
214
|
* @param params - Parameters specific to the API request.
|
|
@@ -1315,6 +1346,31 @@ export class ExchangeClient<
|
|
|
1315
1346
|
return usdSend(this, ...args);
|
|
1316
1347
|
}
|
|
1317
1348
|
|
|
1349
|
+
/**
|
|
1350
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
1351
|
+
* @param params - Parameters specific to the API request.
|
|
1352
|
+
* @param opts - Request execution options.
|
|
1353
|
+
* @returns Successful response without specific data.
|
|
1354
|
+
*
|
|
1355
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
1356
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1357
|
+
*
|
|
1358
|
+
* @see null
|
|
1359
|
+
* @example
|
|
1360
|
+
* ```ts
|
|
1361
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1362
|
+
*
|
|
1363
|
+
* const pk = "0x..."; // viem, ethers or private key
|
|
1364
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1365
|
+
*
|
|
1366
|
+
* const client = new hl.ExchangeClient({ transport, wallet: pk });
|
|
1367
|
+
* await client.userDexAbstraction({ user: "0x...", enabled: true });
|
|
1368
|
+
* ```
|
|
1369
|
+
*/
|
|
1370
|
+
userDexAbstraction(...args: OmitFirst<OverloadedParameters<typeof userDexAbstraction>>) {
|
|
1371
|
+
return userDexAbstraction(this, ...args);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1318
1374
|
/**
|
|
1319
1375
|
* Distribute funds from a vault between followers.
|
|
1320
1376
|
* @param params - Parameters specific to the API request.
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
export { parser, SchemaError } from "../_base.js";
|
|
41
41
|
export type { ExchangeRequestConfig } from "./_base.js";
|
|
42
42
|
|
|
43
|
+
export * from "./agentEnableDexAbstraction.js";
|
|
43
44
|
export * from "./approveAgent.js";
|
|
44
45
|
export * from "./approveBuilderFee.js";
|
|
45
46
|
export * from "./batchModify.js";
|
|
@@ -78,6 +79,7 @@ export * from "./updateIsolatedMargin.js";
|
|
|
78
79
|
export * from "./updateLeverage.js";
|
|
79
80
|
export * from "./usdClassTransfer.js";
|
|
80
81
|
export * from "./usdSend.js";
|
|
82
|
+
export * from "./userDexAbstraction.js";
|
|
81
83
|
export * from "./vaultDistribute.js";
|
|
82
84
|
export * from "./vaultModify.js";
|
|
83
85
|
export * from "./vaultTransfer.js";
|
|
@@ -64,10 +64,10 @@ export const ActiveAssetDataResponse = /* @__PURE__ */ (() => {
|
|
|
64
64
|
v.minValue(1),
|
|
65
65
|
v.description("Leverage value used."),
|
|
66
66
|
),
|
|
67
|
-
/** Amount of USD used (1 = 1
|
|
67
|
+
/** Amount of USD used (1 = $1). */
|
|
68
68
|
rawUsd: v.pipe(
|
|
69
69
|
UnsignedDecimal,
|
|
70
|
-
v.description("Amount of USD used (1 = 1
|
|
70
|
+
v.description("Amount of USD used (1 = $1)."),
|
|
71
71
|
),
|
|
72
72
|
}),
|
|
73
73
|
v.object({
|
|
@@ -140,10 +140,10 @@ export const ClearinghouseStateResponse = /* @__PURE__ */ (() => {
|
|
|
140
140
|
v.minValue(1),
|
|
141
141
|
v.description("Leverage value used."),
|
|
142
142
|
),
|
|
143
|
-
/** Amount of USD used (1 = 1
|
|
143
|
+
/** Amount of USD used (1 = $1). */
|
|
144
144
|
rawUsd: v.pipe(
|
|
145
145
|
UnsignedDecimal,
|
|
146
|
-
v.description("Amount of USD used (1 = 1
|
|
146
|
+
v.description("Amount of USD used (1 = $1)."),
|
|
147
147
|
),
|
|
148
148
|
}),
|
|
149
149
|
v.object({
|
|
@@ -48,6 +48,11 @@ export const TwapHistoryResponse = /* @__PURE__ */ (() => {
|
|
|
48
48
|
state: TwapStateSchema,
|
|
49
49
|
/** Current status of the TWAP order. */
|
|
50
50
|
status: TwapStatusSchema,
|
|
51
|
+
/** ID of the TWAP. */
|
|
52
|
+
twapId: v.pipe(
|
|
53
|
+
v.optional(UnsignedInteger),
|
|
54
|
+
v.description("ID of the TWAP."),
|
|
55
|
+
),
|
|
51
56
|
}),
|
|
52
57
|
v.description("TWAP history record."),
|
|
53
58
|
),
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { Address, type DeepImmutable, parser } from "../_base.js";
|
|
3
|
+
import type { InfoRequestConfig } from "./_base.js";
|
|
4
|
+
|
|
5
|
+
// -------------------- Schemas --------------------
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Request user HIP-3 DEX abstraction state.
|
|
9
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-hip-3-dex-abstraction-state
|
|
10
|
+
*/
|
|
11
|
+
export const UserDexAbstractionInfoRequest = /* @__PURE__ */ (() => {
|
|
12
|
+
return v.pipe(
|
|
13
|
+
v.object({
|
|
14
|
+
/** Type of request. */
|
|
15
|
+
type: v.pipe(
|
|
16
|
+
v.literal("userDexAbstraction"),
|
|
17
|
+
v.description("Type of request."),
|
|
18
|
+
),
|
|
19
|
+
/** User address. */
|
|
20
|
+
user: v.pipe(
|
|
21
|
+
Address,
|
|
22
|
+
v.description("User address."),
|
|
23
|
+
),
|
|
24
|
+
}),
|
|
25
|
+
v.description("Request user referral."),
|
|
26
|
+
);
|
|
27
|
+
})();
|
|
28
|
+
export type UserDexAbstractionInfoRequest = v.InferOutput<typeof UserDexAbstractionInfoRequest>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* User HIP-3 DEX abstraction state.
|
|
32
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-hip-3-dex-abstraction-state
|
|
33
|
+
*/
|
|
34
|
+
export const UserDexAbstractionInfoResponse = /* @__PURE__ */ (() => {
|
|
35
|
+
return v.pipe(
|
|
36
|
+
v.nullable(v.boolean()),
|
|
37
|
+
v.description("User HIP-3 DEX abstraction state."),
|
|
38
|
+
);
|
|
39
|
+
})();
|
|
40
|
+
export type UserDexAbstractionInfoResponse = v.InferOutput<typeof UserDexAbstractionInfoResponse>;
|
|
41
|
+
|
|
42
|
+
// -------------------- Function --------------------
|
|
43
|
+
|
|
44
|
+
/** Request parameters for the {@linkcode userDexAbstraction} function. */
|
|
45
|
+
export type UserDexAbstractionInfoParameters = Omit<v.InferInput<typeof UserDexAbstractionInfoRequest>, "type">;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Request user HIP-3 DEX abstraction state.
|
|
49
|
+
* @param config - General configuration for Info API requests.
|
|
50
|
+
* @param params - Parameters specific to the API request.
|
|
51
|
+
* @param signal - An [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) can be used to cancel the request by calling [`abort()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort) on the corresponding [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
52
|
+
* @returns User HIP-3 DEX abstraction state.
|
|
53
|
+
*
|
|
54
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
55
|
+
*
|
|
56
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-hip-3-dex-abstraction-state
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
60
|
+
* import { userDexAbstraction } from "@nktkas/hyperliquid/api/info";
|
|
61
|
+
*
|
|
62
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
63
|
+
* const data = await userDexAbstraction(
|
|
64
|
+
* { transport },
|
|
65
|
+
* { user: "0x..." },
|
|
66
|
+
* );
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export function userDexAbstraction(
|
|
70
|
+
config: InfoRequestConfig,
|
|
71
|
+
params: DeepImmutable<UserDexAbstractionInfoParameters>,
|
|
72
|
+
signal?: AbortSignal,
|
|
73
|
+
): Promise<UserDexAbstractionInfoResponse> {
|
|
74
|
+
const request = parser(UserDexAbstractionInfoRequest)({
|
|
75
|
+
type: "userDexAbstraction",
|
|
76
|
+
...params,
|
|
77
|
+
});
|
|
78
|
+
return config.transport.request("info", request, signal);
|
|
79
|
+
}
|
|
@@ -49,6 +49,7 @@ import { tokenDetails } from "./tokenDetails.js";
|
|
|
49
49
|
import { twapHistory } from "./twapHistory.js";
|
|
50
50
|
import { txDetails } from "./txDetails.js";
|
|
51
51
|
import { userDetails } from "./userDetails.js";
|
|
52
|
+
import { userDexAbstraction } from "./userDexAbstraction.js";
|
|
52
53
|
import { userFees } from "./userFees.js";
|
|
53
54
|
import { userFills } from "./userFills.js";
|
|
54
55
|
import { userFillsByTime } from "./userFillsByTime.js";
|
|
@@ -113,6 +114,7 @@ export type { TokenDetailsParameters, TokenDetailsResponse } from "./tokenDetail
|
|
|
113
114
|
export type { TwapHistoryParameters, TwapHistoryResponse } from "./twapHistory.js";
|
|
114
115
|
export type { TxDetailsParameters, TxDetailsResponse } from "./txDetails.js";
|
|
115
116
|
export type { UserDetailsParameters, UserDetailsResponse } from "./userDetails.js";
|
|
117
|
+
export type { UserDexAbstractionInfoParameters, UserDexAbstractionInfoResponse } from "./userDexAbstraction.js";
|
|
116
118
|
export type { UserFeesParameters, UserFeesResponse } from "./userFees.js";
|
|
117
119
|
export type { UserFillsParameters, UserFillsResponse } from "./userFills.js";
|
|
118
120
|
export type { UserFillsByTimeParameters, UserFillsByTimeResponse } from "./userFillsByTime.js";
|
|
@@ -1261,6 +1263,29 @@ export class InfoClient<T extends IRequestTransport = IRequestTransport> impleme
|
|
|
1261
1263
|
return userDetails(this, ...args);
|
|
1262
1264
|
}
|
|
1263
1265
|
|
|
1266
|
+
/**
|
|
1267
|
+
* Request user HIP-3 DEX abstraction state.
|
|
1268
|
+
* @param params - Parameters specific to the API request.
|
|
1269
|
+
* @param signal - An [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) can be used to cancel the request by calling [`abort()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort) on the corresponding [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
1270
|
+
* @returns User HIP-3 DEX abstraction state.
|
|
1271
|
+
*
|
|
1272
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1273
|
+
*
|
|
1274
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-hip-3-dex-abstraction-state
|
|
1275
|
+
* @example
|
|
1276
|
+
* ```ts
|
|
1277
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1278
|
+
*
|
|
1279
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this API
|
|
1280
|
+
*
|
|
1281
|
+
* const client = new hl.InfoClient({ transport });
|
|
1282
|
+
* const data = await client.userDexAbstraction({ user: "0x..." });
|
|
1283
|
+
* ```
|
|
1284
|
+
*/
|
|
1285
|
+
userDexAbstraction(...args: OmitFirst<OverloadedParameters<typeof userDexAbstraction>>) {
|
|
1286
|
+
return userDexAbstraction(this, ...args);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1264
1289
|
/**
|
|
1265
1290
|
* Request user fees.
|
|
1266
1291
|
* @param params - Parameters specific to the API request.
|
package/src/src/api/info/~mod.ts
CHANGED
|
@@ -71,6 +71,7 @@ export * from "./tokenDetails.js";
|
|
|
71
71
|
export * from "./twapHistory.js";
|
|
72
72
|
export * from "./txDetails.js";
|
|
73
73
|
export * from "./userDetails.js";
|
|
74
|
+
export * from "./userDexAbstraction.js";
|
|
74
75
|
export * from "./userFees.js";
|
|
75
76
|
export * from "./userFills.js";
|
|
76
77
|
export * from "./userFillsByTime.js";
|
|
@@ -51,6 +51,11 @@ export const UserTwapHistoryEvent = /* @__PURE__ */ (() => {
|
|
|
51
51
|
state: TwapStateSchema,
|
|
52
52
|
/** Current status of the TWAP order. */
|
|
53
53
|
status: TwapStatusSchema,
|
|
54
|
+
/** ID of the TWAP. */
|
|
55
|
+
twapId: v.pipe(
|
|
56
|
+
v.optional(UnsignedInteger),
|
|
57
|
+
v.description("ID of the TWAP."),
|
|
58
|
+
),
|
|
54
59
|
}),
|
|
55
60
|
v.description("TWAP history record."),
|
|
56
61
|
),
|