@nktkas/hyperliquid 0.25.3 → 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/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/~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/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/~client.d.ts +22 -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/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/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/~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/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/~client.d.ts +22 -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/src/bin/cli.ts +87 -87
- package/src/src/api/exchange/agentEnableDexAbstraction.ts +96 -0
- package/src/src/api/exchange/userDexAbstraction.ts +142 -0
- package/src/src/api/exchange/~client.ts +96 -40
- package/src/src/api/exchange/~mod.ts +2 -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
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type ExchangeRequestConfig, type ExtractRequestOptions, type MultiSignRequestConfig } from "./_base.js";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
/**
|
|
4
|
+
* Enable HIP-3 DEX abstraction.
|
|
5
|
+
* @see null
|
|
6
|
+
*/
|
|
7
|
+
export declare const AgentEnableDexAbstractionRequest: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
8
|
+
/** Action to perform. */
|
|
9
|
+
readonly action: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
10
|
+
/** Type of action. */
|
|
11
|
+
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"agentEnableDexAbstraction", undefined>, v.DescriptionAction<"agentEnableDexAbstraction", "Type of action.">]>;
|
|
12
|
+
}, undefined>, v.DescriptionAction<{
|
|
13
|
+
type: "agentEnableDexAbstraction";
|
|
14
|
+
}, "Action to perform.">]>;
|
|
15
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
16
|
+
readonly nonce: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Unique request identifier (current timestamp in ms).">]>;
|
|
17
|
+
/** Cryptographic signature. */
|
|
18
|
+
readonly signature: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
19
|
+
readonly r: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 66, undefined>, v.TransformAction<`0x${string}`, `0x${string}`>]>, v.DescriptionAction<`0x${string}`, "First 32-byte component of ECDSA signature.">]>;
|
|
20
|
+
readonly s: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 66, undefined>, v.TransformAction<`0x${string}`, `0x${string}`>]>, v.DescriptionAction<`0x${string}`, "Second 32-byte component of ECDSA signature.">]>;
|
|
21
|
+
readonly v: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>]>, v.UnionSchema<[v.LiteralSchema<27, undefined>, v.LiteralSchema<28, undefined>], undefined>]>, v.DescriptionAction<27 | 28, "Recovery identifier.">]>;
|
|
22
|
+
}, undefined>, v.DescriptionAction<{
|
|
23
|
+
r: `0x${string}`;
|
|
24
|
+
s: `0x${string}`;
|
|
25
|
+
v: 27 | 28;
|
|
26
|
+
}, "ECDSA signature components for Ethereum typed data.">]>, v.DescriptionAction<{
|
|
27
|
+
r: `0x${string}`;
|
|
28
|
+
s: `0x${string}`;
|
|
29
|
+
v: 27 | 28;
|
|
30
|
+
}, "Cryptographic signature.">]>;
|
|
31
|
+
/** Expiration time of the action. */
|
|
32
|
+
readonly expiresAfter: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, v.DescriptionAction<number | undefined, "Expiration time of the action.">]>;
|
|
33
|
+
}, undefined>, v.DescriptionAction<{
|
|
34
|
+
action: {
|
|
35
|
+
type: "agentEnableDexAbstraction";
|
|
36
|
+
};
|
|
37
|
+
nonce: number;
|
|
38
|
+
signature: {
|
|
39
|
+
r: `0x${string}`;
|
|
40
|
+
s: `0x${string}`;
|
|
41
|
+
v: 27 | 28;
|
|
42
|
+
};
|
|
43
|
+
expiresAfter?: number | undefined;
|
|
44
|
+
}, "Enable HIP-3 DEX abstraction request.">]>;
|
|
45
|
+
export type AgentEnableDexAbstractionRequest = v.InferOutput<typeof AgentEnableDexAbstractionRequest>;
|
|
46
|
+
import { SuccessResponse } from "./_base.js";
|
|
47
|
+
export { SuccessResponse };
|
|
48
|
+
/** Request options for the {@linkcode agentEnableDexAbstraction} function. */
|
|
49
|
+
export type AgentEnableDexAbstractionOptions = ExtractRequestOptions<v.InferInput<typeof AgentEnableDexAbstractionRequest>>;
|
|
50
|
+
/**
|
|
51
|
+
* Enable HIP-3 DEX abstraction.
|
|
52
|
+
* @param config - General configuration for Exchange API requests.
|
|
53
|
+
* @param params - Parameters specific to the API request.
|
|
54
|
+
* @param opts - Request execution options.
|
|
55
|
+
* @returns Successful response without specific data.
|
|
56
|
+
*
|
|
57
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
58
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
59
|
+
*
|
|
60
|
+
* @see null
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
64
|
+
* import { agentEnableDexAbstraction } from "@nktkas/hyperliquid/api/exchange";
|
|
65
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
66
|
+
*
|
|
67
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
68
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
69
|
+
*
|
|
70
|
+
* await agentEnableDexAbstraction({ transport, wallet });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function agentEnableDexAbstraction(config: ExchangeRequestConfig | MultiSignRequestConfig, opts?: AgentEnableDexAbstractionOptions): Promise<SuccessResponse>;
|
|
74
|
+
//# sourceMappingURL=agentEnableDexAbstraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEnableDexAbstraction.d.ts","sourceRoot":"","sources":["../../../../src/src/api/exchange/agentEnableDexAbstraction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAE5B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B;;;GAGG;AACH,eAAO,MAAM,gCAAgC;IAGvC,yBAAyB;;QAGrB,sBAAsB;;;;;IAQ1B,2DAA2D;;IAK3D,+BAA+B;;;;;;;;;;;;;;IAK/B,qCAAqC;;;;;;;;;;;;;6CAQvC,CAAC;AACL,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAEtG,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,CAAC;AAI3B,8EAA8E;AAC9E,MAAM,MAAM,gCAAgC,GAAG,qBAAqB,CAClE,CAAC,CAAC,UAAU,CAAC,OAAO,gCAAgC,CAAC,CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,qBAAqB,GAAG,sBAAsB,EACtD,IAAI,CAAC,EAAE,gCAAgC,GACtC,OAAO,CAAC,eAAe,CAAC,CAQ1B"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SuccessResponse = exports.AgentEnableDexAbstractionRequest = void 0;
|
|
37
|
+
exports.agentEnableDexAbstraction = agentEnableDexAbstraction;
|
|
38
|
+
const _base_js_1 = require("../_base.js");
|
|
39
|
+
const _base_js_2 = require("./_base.js");
|
|
40
|
+
const v = __importStar(require("valibot"));
|
|
41
|
+
// -------------------- Schemas --------------------
|
|
42
|
+
/**
|
|
43
|
+
* Enable HIP-3 DEX abstraction.
|
|
44
|
+
* @see null
|
|
45
|
+
*/
|
|
46
|
+
exports.AgentEnableDexAbstractionRequest = (() => {
|
|
47
|
+
return v.pipe(v.object({
|
|
48
|
+
/** Action to perform. */
|
|
49
|
+
action: v.pipe(v.object({
|
|
50
|
+
/** Type of action. */
|
|
51
|
+
type: v.pipe(v.literal("agentEnableDexAbstraction"), v.description("Type of action.")),
|
|
52
|
+
}), v.description("Action to perform.")),
|
|
53
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
54
|
+
nonce: v.pipe(_base_js_1.UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
55
|
+
/** Cryptographic signature. */
|
|
56
|
+
signature: v.pipe(_base_js_2.Signature, v.description("Cryptographic signature.")),
|
|
57
|
+
/** Expiration time of the action. */
|
|
58
|
+
expiresAfter: v.pipe(v.optional(_base_js_1.UnsignedInteger), v.description("Expiration time of the action.")),
|
|
59
|
+
}), v.description("Enable HIP-3 DEX abstraction request."));
|
|
60
|
+
})();
|
|
61
|
+
const _base_js_3 = require("./_base.js");
|
|
62
|
+
Object.defineProperty(exports, "SuccessResponse", { enumerable: true, get: function () { return _base_js_3.SuccessResponse; } });
|
|
63
|
+
/**
|
|
64
|
+
* Enable HIP-3 DEX abstraction.
|
|
65
|
+
* @param config - General configuration for Exchange API requests.
|
|
66
|
+
* @param params - Parameters specific to the API request.
|
|
67
|
+
* @param opts - Request execution options.
|
|
68
|
+
* @returns Successful response without specific data.
|
|
69
|
+
*
|
|
70
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
71
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
72
|
+
*
|
|
73
|
+
* @see null
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
77
|
+
* import { agentEnableDexAbstraction } from "@nktkas/hyperliquid/api/exchange";
|
|
78
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
79
|
+
*
|
|
80
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
81
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
82
|
+
*
|
|
83
|
+
* await agentEnableDexAbstraction({ transport, wallet });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
async function agentEnableDexAbstraction(config, opts) {
|
|
87
|
+
const action = (0, _base_js_1.parser)(exports.AgentEnableDexAbstractionRequest.entries.action)({
|
|
88
|
+
type: "agentEnableDexAbstraction",
|
|
89
|
+
});
|
|
90
|
+
const expiresAfter = typeof config.defaultExpiresAfter === "number"
|
|
91
|
+
? config.defaultExpiresAfter
|
|
92
|
+
: await config.defaultExpiresAfter?.();
|
|
93
|
+
return await (0, _base_js_2.executeL1Action)(config, { action, expiresAfter }, opts?.signal);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=agentEnableDexAbstraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEnableDexAbstraction.js","sourceRoot":"","sources":["../../../../src/src/api/exchange/agentEnableDexAbstraction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,8DAWC;AA/FD,0CAAsD;AACtD,yCAMoB;AACpB,2CAA6B;AAE7B,oDAAoD;AAEpD;;;GAGG;AACU,QAAA,gCAAgC,GAAmB,CAAC,GAAG,EAAE;IACpE,OAAO,CAAC,CAAC,IAAI,CACX,CAAC,CAAC,MAAM,CAAC;QACP,yBAAyB;QACzB,MAAM,EAAE,CAAC,CAAC,IAAI,CACZ,CAAC,CAAC,MAAM,CAAC;YACP,sBAAsB;YACtB,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,EACtC,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CACjC;SACF,CAAC,EACF,CAAC,CAAC,WAAW,CAAC,oBAAoB,CAAC,CACpC;QACD,2DAA2D;QAC3D,KAAK,EAAE,CAAC,CAAC,IAAI,CACX,0BAAe,EACf,CAAC,CAAC,WAAW,CAAC,sDAAsD,CAAC,CACtE;QACD,+BAA+B;QAC/B,SAAS,EAAE,CAAC,CAAC,IAAI,CACf,oBAAS,EACT,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAC1C;QACD,qCAAqC;QACrC,YAAY,EAAE,CAAC,CAAC,IAAI,CAClB,CAAC,CAAC,QAAQ,CAAC,0BAAe,CAAC,EAC3B,CAAC,CAAC,WAAW,CAAC,gCAAgC,CAAC,CAChD;KACF,CAAC,EACF,CAAC,CAAC,WAAW,CAAC,uCAAuC,CAAC,CACvD,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AAGL,yCAA6C;AACpC,gGADA,0BAAe,OACA;AASxB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,KAAK,UAAU,yBAAyB,CAC7C,MAAsD,EACtD,IAAuC;IAEvC,MAAM,MAAM,GAAG,IAAA,iBAAM,EAAC,wCAAgC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,IAAI,EAAE,2BAA2B;KAClC,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC,mBAAmB,KAAK,QAAQ;QACjE,CAAC,CAAC,MAAM,CAAC,mBAAmB;QAC5B,CAAC,CAAC,MAAM,MAAM,CAAC,mBAAmB,EAAE,EAAE,CAAC;IACzC,OAAO,MAAM,IAAA,0BAAe,EAAC,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type DeepImmutable } from "../_base.js";
|
|
2
|
+
import { type ExchangeRequestConfig, type ExtractRequestAction, type ExtractRequestOptions, type MultiSignRequestConfig } from "./_base.js";
|
|
3
|
+
import * as v from "valibot";
|
|
4
|
+
/**
|
|
5
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
6
|
+
* @see null
|
|
7
|
+
*/
|
|
8
|
+
export declare const UserDexAbstractionExchangeRequest: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
9
|
+
/** Action to perform. */
|
|
10
|
+
readonly action: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
11
|
+
/** Type of action. */
|
|
12
|
+
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"userDexAbstraction", undefined>, v.DescriptionAction<"userDexAbstraction", "Type of action.">]>;
|
|
13
|
+
/** Chain ID used for signing. */
|
|
14
|
+
readonly signatureChainId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.DescriptionAction<`0x${string}`, "Chain ID used for signing.">]>;
|
|
15
|
+
/** HyperLiquid network. */
|
|
16
|
+
readonly hyperliquidChain: v.SchemaWithPipe<readonly [v.UnionSchema<[v.LiteralSchema<"Mainnet", undefined>, v.LiteralSchema<"Testnet", undefined>], undefined>, v.DescriptionAction<"Testnet" | "Mainnet", "HyperLiquid network.">]>;
|
|
17
|
+
/** User address. */
|
|
18
|
+
readonly user: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 42, undefined>]>, v.DescriptionAction<`0x${string}`, "User address.">]>;
|
|
19
|
+
/** Whether to enable or disable HIP-3 DEX abstraction. */
|
|
20
|
+
readonly enabled: v.SchemaWithPipe<readonly [v.BooleanSchema<undefined>, v.DescriptionAction<boolean, "Whether to enable or disable HIP-3 DEX abstraction.">]>;
|
|
21
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
22
|
+
readonly nonce: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Unique request identifier (current timestamp in ms).">]>;
|
|
23
|
+
}, undefined>, v.DescriptionAction<{
|
|
24
|
+
type: "userDexAbstraction";
|
|
25
|
+
signatureChainId: `0x${string}`;
|
|
26
|
+
hyperliquidChain: "Testnet" | "Mainnet";
|
|
27
|
+
user: `0x${string}`;
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
nonce: number;
|
|
30
|
+
}, "Action to perform.">]>;
|
|
31
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
32
|
+
readonly nonce: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.DescriptionAction<number, "Unique request identifier (current timestamp in ms).">]>;
|
|
33
|
+
/** Cryptographic signature. */
|
|
34
|
+
readonly signature: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
35
|
+
readonly r: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 66, undefined>, v.TransformAction<`0x${string}`, `0x${string}`>]>, v.DescriptionAction<`0x${string}`, "First 32-byte component of ECDSA signature.">]>;
|
|
36
|
+
readonly s: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, `0x${string}`>]>, v.LengthAction<`0x${string}`, 66, undefined>, v.TransformAction<`0x${string}`, `0x${string}`>]>, v.DescriptionAction<`0x${string}`, "Second 32-byte component of ECDSA signature.">]>;
|
|
37
|
+
readonly v: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.SafeIntegerAction<number, undefined>]>, v.UnionSchema<[v.LiteralSchema<27, undefined>, v.LiteralSchema<28, undefined>], undefined>]>, v.DescriptionAction<27 | 28, "Recovery identifier.">]>;
|
|
38
|
+
}, undefined>, v.DescriptionAction<{
|
|
39
|
+
r: `0x${string}`;
|
|
40
|
+
s: `0x${string}`;
|
|
41
|
+
v: 27 | 28;
|
|
42
|
+
}, "ECDSA signature components for Ethereum typed data.">]>, v.DescriptionAction<{
|
|
43
|
+
r: `0x${string}`;
|
|
44
|
+
s: `0x${string}`;
|
|
45
|
+
v: 27 | 28;
|
|
46
|
+
}, "Cryptographic signature.">]>;
|
|
47
|
+
}, undefined>, v.DescriptionAction<{
|
|
48
|
+
action: {
|
|
49
|
+
type: "userDexAbstraction";
|
|
50
|
+
signatureChainId: `0x${string}`;
|
|
51
|
+
hyperliquidChain: "Testnet" | "Mainnet";
|
|
52
|
+
user: `0x${string}`;
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
nonce: number;
|
|
55
|
+
};
|
|
56
|
+
nonce: number;
|
|
57
|
+
signature: {
|
|
58
|
+
r: `0x${string}`;
|
|
59
|
+
s: `0x${string}`;
|
|
60
|
+
v: 27 | 28;
|
|
61
|
+
};
|
|
62
|
+
}, "Enable/disable HIP-3 DEX abstraction.">]>;
|
|
63
|
+
export type UserDexAbstractionExchangeRequest = v.InferOutput<typeof UserDexAbstractionExchangeRequest>;
|
|
64
|
+
import { SuccessResponse } from "./_base.js";
|
|
65
|
+
export { SuccessResponse };
|
|
66
|
+
/** Action parameters for the {@linkcode userDexAbstraction} function. */
|
|
67
|
+
export type UserDexAbstractionExchangeParameters = ExtractRequestAction<v.InferInput<typeof UserDexAbstractionExchangeRequest>>;
|
|
68
|
+
/** Request options for the {@linkcode userDexAbstraction} function. */
|
|
69
|
+
export type UserDexAbstractionExchangeOptions = ExtractRequestOptions<v.InferInput<typeof UserDexAbstractionExchangeRequest>>;
|
|
70
|
+
/** EIP-712 types for the {@linkcode userDexAbstraction} function. */
|
|
71
|
+
export declare const UserDexAbstractionTypes: {
|
|
72
|
+
"HyperliquidTransaction:UserDexAbstraction": {
|
|
73
|
+
name: string;
|
|
74
|
+
type: string;
|
|
75
|
+
}[];
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
79
|
+
* @param config - General configuration for Exchange API requests.
|
|
80
|
+
* @param params - Parameters specific to the API request.
|
|
81
|
+
* @param opts - Request execution options.
|
|
82
|
+
* @returns Successful response without specific data.
|
|
83
|
+
*
|
|
84
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
85
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
86
|
+
*
|
|
87
|
+
* @see null
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
91
|
+
* import { userDexAbstraction } from "@nktkas/hyperliquid/api/exchange";
|
|
92
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
93
|
+
*
|
|
94
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
95
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
96
|
+
*
|
|
97
|
+
* await userDexAbstraction(
|
|
98
|
+
* { transport, wallet },
|
|
99
|
+
* { user: "0x...", enabled: true },
|
|
100
|
+
* );
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function userDexAbstraction(config: ExchangeRequestConfig | MultiSignRequestConfig, params: DeepImmutable<UserDexAbstractionExchangeParameters>, opts?: UserDexAbstractionExchangeOptions): Promise<SuccessResponse>;
|
|
104
|
+
//# sourceMappingURL=userDexAbstraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userDexAbstraction.d.ts","sourceRoot":"","sources":["../../../../src/src/api/exchange/userDexAbstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,aAAa,EAAgC,MAAM,aAAa,CAAC;AACxF,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAG1B,KAAK,sBAAsB,EAE5B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B;;;GAGG;AACH,eAAO,MAAM,iCAAiC;IAGxC,yBAAyB;;QAGrB,sBAAsB;;QAKtB,iCAAiC;;QAKjC,2BAA2B;;QAK3B,oBAAoB;;QAKpB,0DAA0D;;QAK1D,2DAA2D;;;;;;;;;;IAQ/D,2DAA2D;;IAK3D,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAQjC,CAAC;AACL,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAExG,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,CAAC;AAI3B,yEAAyE;AACzE,MAAM,MAAM,oCAAoC,GAAG,oBAAoB,CACrE,CAAC,CAAC,UAAU,CAAC,OAAO,iCAAiC,CAAC,CACvD,CAAC;AACF,uEAAuE;AACvE,MAAM,MAAM,iCAAiC,GAAG,qBAAqB,CACnE,CAAC,CAAC,UAAU,CAAC,OAAO,iCAAiC,CAAC,CACvD,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,uBAAuB;;;;;CAOnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,qBAAqB,GAAG,sBAAsB,EACtD,MAAM,EAAE,aAAa,CAAC,oCAAoC,CAAC,EAC3D,IAAI,CAAC,EAAE,iCAAiC,GACvC,OAAO,CAAC,eAAe,CAAC,CAa1B"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.UserDexAbstractionTypes = exports.SuccessResponse = exports.UserDexAbstractionExchangeRequest = void 0;
|
|
37
|
+
exports.userDexAbstraction = userDexAbstraction;
|
|
38
|
+
const _base_js_1 = require("../_base.js");
|
|
39
|
+
const _base_js_2 = require("./_base.js");
|
|
40
|
+
const v = __importStar(require("valibot"));
|
|
41
|
+
// -------------------- Schemas --------------------
|
|
42
|
+
/**
|
|
43
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
44
|
+
* @see null
|
|
45
|
+
*/
|
|
46
|
+
exports.UserDexAbstractionExchangeRequest = (() => {
|
|
47
|
+
return v.pipe(v.object({
|
|
48
|
+
/** Action to perform. */
|
|
49
|
+
action: v.pipe(v.object({
|
|
50
|
+
/** Type of action. */
|
|
51
|
+
type: v.pipe(v.literal("userDexAbstraction"), v.description("Type of action.")),
|
|
52
|
+
/** Chain ID used for signing. */
|
|
53
|
+
signatureChainId: v.pipe(_base_js_1.Hex, v.description("Chain ID used for signing.")),
|
|
54
|
+
/** HyperLiquid network. */
|
|
55
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
56
|
+
/** User address. */
|
|
57
|
+
user: v.pipe(_base_js_1.Address, v.description("User address.")),
|
|
58
|
+
/** Whether to enable or disable HIP-3 DEX abstraction. */
|
|
59
|
+
enabled: v.pipe(v.boolean(), v.description("Whether to enable or disable HIP-3 DEX abstraction.")),
|
|
60
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
61
|
+
nonce: v.pipe(_base_js_1.UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
62
|
+
}), v.description("Action to perform.")),
|
|
63
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
64
|
+
nonce: v.pipe(_base_js_1.UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
65
|
+
/** Cryptographic signature. */
|
|
66
|
+
signature: v.pipe(_base_js_2.Signature, v.description("Cryptographic signature.")),
|
|
67
|
+
}), v.description("Enable/disable HIP-3 DEX abstraction."));
|
|
68
|
+
})();
|
|
69
|
+
const _base_js_3 = require("./_base.js");
|
|
70
|
+
Object.defineProperty(exports, "SuccessResponse", { enumerable: true, get: function () { return _base_js_3.SuccessResponse; } });
|
|
71
|
+
/** EIP-712 types for the {@linkcode userDexAbstraction} function. */
|
|
72
|
+
exports.UserDexAbstractionTypes = {
|
|
73
|
+
"HyperliquidTransaction:UserDexAbstraction": [
|
|
74
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
75
|
+
{ name: "user", type: "address" },
|
|
76
|
+
{ name: "enabled", type: "bool" },
|
|
77
|
+
{ name: "nonce", type: "uint64" },
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
82
|
+
* @param config - General configuration for Exchange API requests.
|
|
83
|
+
* @param params - Parameters specific to the API request.
|
|
84
|
+
* @param opts - Request execution options.
|
|
85
|
+
* @returns Successful response without specific data.
|
|
86
|
+
*
|
|
87
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
88
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
89
|
+
*
|
|
90
|
+
* @see null
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
94
|
+
* import { userDexAbstraction } from "@nktkas/hyperliquid/api/exchange";
|
|
95
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
96
|
+
*
|
|
97
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
98
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
99
|
+
*
|
|
100
|
+
* await userDexAbstraction(
|
|
101
|
+
* { transport, wallet },
|
|
102
|
+
* { user: "0x...", enabled: true },
|
|
103
|
+
* );
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
async function userDexAbstraction(config, params, opts) {
|
|
107
|
+
const action = (0, _base_js_1.parser)(exports.UserDexAbstractionExchangeRequest.entries.action)({
|
|
108
|
+
type: "userDexAbstraction",
|
|
109
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
110
|
+
signatureChainId: await (0, _base_js_2.getSignatureChainId)(config),
|
|
111
|
+
nonce: await (0, _base_js_2.getNonce)(config),
|
|
112
|
+
...params,
|
|
113
|
+
});
|
|
114
|
+
return await (0, _base_js_2.executeUserSignedAction)(config, { action, types: exports.UserDexAbstractionTypes }, opts?.signal);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=userDexAbstraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userDexAbstraction.js","sourceRoot":"","sources":["../../../../src/src/api/exchange/userDexAbstraction.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,6 +2,7 @@ import type { OmitFirst, OverloadedParameters } from "../_base.js";
|
|
|
2
2
|
import type { ExchangeRequestConfig, MaybePromise, MultiSignRequestConfig } from "./_base.js";
|
|
3
3
|
import type { IRequestTransport } from "../../transport/base.js";
|
|
4
4
|
import type { AbstractWallet } from "../../signing/mod.js";
|
|
5
|
+
import { agentEnableDexAbstraction } from "./agentEnableDexAbstraction.js";
|
|
5
6
|
import { approveAgent } from "./approveAgent.js";
|
|
6
7
|
import { approveBuilderFee } from "./approveBuilderFee.js";
|
|
7
8
|
import { batchModify } from "./batchModify.js";
|
|
@@ -40,50 +41,55 @@ import { updateIsolatedMargin } from "./updateIsolatedMargin.js";
|
|
|
40
41
|
import { updateLeverage } from "./updateLeverage.js";
|
|
41
42
|
import { usdClassTransfer } from "./usdClassTransfer.js";
|
|
42
43
|
import { usdSend } from "./usdSend.js";
|
|
44
|
+
import { userDexAbstraction } from "./userDexAbstraction.js";
|
|
43
45
|
import { vaultDistribute } from "./vaultDistribute.js";
|
|
44
46
|
import { vaultModify } from "./vaultModify.js";
|
|
45
47
|
import { vaultTransfer } from "./vaultTransfer.js";
|
|
46
48
|
import { withdraw3 } from "./withdraw3.js";
|
|
47
|
-
export type {
|
|
48
|
-
export type {
|
|
49
|
-
export type {
|
|
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 {
|
|
49
|
+
export type { AgentEnableDexAbstractionOptions } from "./agentEnableDexAbstraction.js";
|
|
50
|
+
export type { ApproveAgentOptions, ApproveAgentParameters } from "./approveAgent.js";
|
|
51
|
+
export type { ApproveBuilderFeeOptions, ApproveBuilderFeeParameters } from "./approveBuilderFee.js";
|
|
52
|
+
export type { BatchModifyOptions, BatchModifyParameters } from "./batchModify.js";
|
|
53
|
+
export type { CancelOptions, CancelParameters } from "./cancel.js";
|
|
54
|
+
export type { CancelByCloidOptions, CancelByCloidParameters } from "./cancelByCloid.js";
|
|
55
|
+
export type { CDepositOptions, CDepositParameters } from "./cDeposit.js";
|
|
56
|
+
export type { ClaimRewardsOptions } from "./claimRewards.js";
|
|
57
|
+
export type { ConvertToMultiSigUserOptions, ConvertToMultiSigUserParameters } from "./convertToMultiSigUser.js";
|
|
58
|
+
export type { CreateSubAccountOptions, CreateSubAccountParameters } from "./createSubAccount.js";
|
|
59
|
+
export type { CreateVaultOptions, CreateVaultParameters } from "./createVault.js";
|
|
60
|
+
export type { CSignerActionOptions, CSignerActionParameters } from "./cSignerAction.js";
|
|
61
|
+
export type { CValidatorActionOptions, CValidatorActionParameters } from "./cValidatorAction.js";
|
|
62
|
+
export type { CWithdrawOptions, CWithdrawParameters } from "./cWithdraw.js";
|
|
63
|
+
export type { EvmUserModifyOptions, EvmUserModifyParameters } from "./evmUserModify.js";
|
|
64
|
+
export type { ModifyOptions, ModifyParameters } from "./modify.js";
|
|
65
|
+
export type { MultiSigOptions, MultiSigParameters } from "./multiSig.js";
|
|
66
|
+
export type { OrderOptions, OrderParameters } from "./order.js";
|
|
67
|
+
export type { NoopOptions } from "./noop.js";
|
|
68
|
+
export type { PerpDeployOptions, PerpDeployParameters } from "./perpDeploy.js";
|
|
69
|
+
export type { RegisterReferrerOptions, RegisterReferrerParameters } from "./registerReferrer.js";
|
|
70
|
+
export type { ReserveRequestWeightOptions, ReserveRequestWeightParameters } from "./reserveRequestWeight.js";
|
|
71
|
+
export type { ScheduleCancelOptions, ScheduleCancelParameters } from "./scheduleCancel.js";
|
|
72
|
+
export type { SendAssetOptions, SendAssetParameters } from "./sendAsset.js";
|
|
73
|
+
export type { SetDisplayNameOptions, SetDisplayNameParameters } from "./setDisplayName.js";
|
|
74
|
+
export type { SetReferrerOptions, SetReferrerParameters } from "./setReferrer.js";
|
|
75
|
+
export type { SpotDeployOptions, SpotDeployParameters } from "./spotDeploy.js";
|
|
76
|
+
export type { SpotSendOptions, SpotSendParameters } from "./spotSend.js";
|
|
77
|
+
export type { SpotUserOptions, SpotUserParameters } from "./spotUser.js";
|
|
78
|
+
export type { SubAccountModifyOptions, SubAccountModifyParameters } from "./subAccountModify.js";
|
|
79
|
+
export type { SubAccountSpotTransferOptions, SubAccountSpotTransferParameters } from "./subAccountSpotTransfer.js";
|
|
80
|
+
export type { SubAccountTransferOptions, SubAccountTransferParameters } from "./subAccountTransfer.js";
|
|
81
|
+
export type { TokenDelegateOptions, TokenDelegateParameters } from "./tokenDelegate.js";
|
|
82
|
+
export type { TwapCancelOptions, TwapCancelParameters } from "./twapCancel.js";
|
|
83
|
+
export type { TwapOrderOptions, TwapOrderParameters } from "./twapOrder.js";
|
|
84
|
+
export type { UpdateIsolatedMarginOptions, UpdateIsolatedMarginParameters } from "./updateIsolatedMargin.js";
|
|
85
|
+
export type { UpdateLeverageOptions, UpdateLeverageParameters } from "./updateLeverage.js";
|
|
86
|
+
export type { UsdClassTransferOptions, UsdClassTransferParameters } from "./usdClassTransfer.js";
|
|
87
|
+
export type { UsdSendOptions, UsdSendParameters } from "./usdSend.js";
|
|
88
|
+
export type { UserDexAbstractionExchangeOptions, UserDexAbstractionExchangeParameters } from "./userDexAbstraction.js";
|
|
89
|
+
export type { VaultDistributeOptions, VaultDistributeParameters } from "./vaultDistribute.js";
|
|
90
|
+
export type { VaultModifyOptions, VaultModifyParameters } from "./vaultModify.js";
|
|
91
|
+
export type { VaultTransferOptions, VaultTransferParameters } from "./vaultTransfer.js";
|
|
92
|
+
export type { Withdraw3Options, Withdraw3Parameters } from "./withdraw3.js";
|
|
87
93
|
export type { CancelSuccessResponse } from "./cancel.js";
|
|
88
94
|
export type { CreateSubAccountResponse } from "./createSubAccount.js";
|
|
89
95
|
export type { CreateVaultResponse } from "./createVault.js";
|
|
@@ -155,6 +161,33 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
|
|
|
155
161
|
constructor(args: Omit<ExchangeRequestConfig<T, W>, "wallet"> & (Pick<ExchangeRequestConfig<T, W>, "wallet"> | {
|
|
156
162
|
wallet: string;
|
|
157
163
|
}));
|
|
164
|
+
/**
|
|
165
|
+
* Enable HIP-3 DEX abstraction.
|
|
166
|
+
* @param params - Parameters specific to the API request.
|
|
167
|
+
* @param opts - Request execution options.
|
|
168
|
+
* @returns Successful response without specific data.
|
|
169
|
+
*
|
|
170
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
171
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
172
|
+
*
|
|
173
|
+
* @see null
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
177
|
+
*
|
|
178
|
+
* const pk = "0x..."; // viem, ethers or private key
|
|
179
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
180
|
+
*
|
|
181
|
+
* const client = new hl.ExchangeClient({ transport, wallet: pk });
|
|
182
|
+
* await client.agentEnableDexAbstraction();
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
agentEnableDexAbstraction(...args: OmitFirst<OverloadedParameters<typeof agentEnableDexAbstraction>>): Promise<{
|
|
186
|
+
status: "ok";
|
|
187
|
+
response: {
|
|
188
|
+
type: "default";
|
|
189
|
+
};
|
|
190
|
+
}>;
|
|
158
191
|
/**
|
|
159
192
|
* Approve an agent to sign on behalf of the master account.
|
|
160
193
|
* @param params - Parameters specific to the API request.
|
|
@@ -1472,6 +1505,33 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
|
|
|
1472
1505
|
type: "default";
|
|
1473
1506
|
};
|
|
1474
1507
|
}>;
|
|
1508
|
+
/**
|
|
1509
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
1510
|
+
* @param params - Parameters specific to the API request.
|
|
1511
|
+
* @param opts - Request execution options.
|
|
1512
|
+
* @returns Successful response without specific data.
|
|
1513
|
+
*
|
|
1514
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
1515
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1516
|
+
*
|
|
1517
|
+
* @see null
|
|
1518
|
+
* @example
|
|
1519
|
+
* ```ts
|
|
1520
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1521
|
+
*
|
|
1522
|
+
* const pk = "0x..."; // viem, ethers or private key
|
|
1523
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1524
|
+
*
|
|
1525
|
+
* const client = new hl.ExchangeClient({ transport, wallet: pk });
|
|
1526
|
+
* await client.userDexAbstraction({ user: "0x...", enabled: true });
|
|
1527
|
+
* ```
|
|
1528
|
+
*/
|
|
1529
|
+
userDexAbstraction(...args: OmitFirst<OverloadedParameters<typeof userDexAbstraction>>): Promise<{
|
|
1530
|
+
status: "ok";
|
|
1531
|
+
response: {
|
|
1532
|
+
type: "default";
|
|
1533
|
+
};
|
|
1534
|
+
}>;
|
|
1475
1535
|
/**
|
|
1476
1536
|
* Distribute funds from a vault between followers.
|
|
1477
1537
|
* @param params - Parameters specific to the API request.
|