@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
|
@@ -57,6 +57,8 @@ export declare const UserTwapHistoryEvent: v.SchemaWithPipe<readonly [v.ObjectSc
|
|
|
57
57
|
status: "error";
|
|
58
58
|
description: string;
|
|
59
59
|
}, string>]>;
|
|
60
|
+
/** ID of the TWAP. */
|
|
61
|
+
readonly twapId: 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, "ID of the TWAP.">]>;
|
|
60
62
|
}, undefined>, v.DescriptionAction<{
|
|
61
63
|
time: number;
|
|
62
64
|
state: {
|
|
@@ -77,6 +79,7 @@ export declare const UserTwapHistoryEvent: v.SchemaWithPipe<readonly [v.ObjectSc
|
|
|
77
79
|
status: "error";
|
|
78
80
|
description: string;
|
|
79
81
|
};
|
|
82
|
+
twapId?: number | undefined;
|
|
80
83
|
}, "TWAP history record.">]>, undefined>, v.DescriptionAction<{
|
|
81
84
|
time: number;
|
|
82
85
|
state: {
|
|
@@ -97,6 +100,7 @@ export declare const UserTwapHistoryEvent: v.SchemaWithPipe<readonly [v.ObjectSc
|
|
|
97
100
|
status: "error";
|
|
98
101
|
description: string;
|
|
99
102
|
};
|
|
103
|
+
twapId?: number | undefined;
|
|
100
104
|
}[], "Array of user's TWAP history.">]>;
|
|
101
105
|
/** Whether this is an initial snapshot. */
|
|
102
106
|
readonly isSnapshot: v.SchemaWithPipe<readonly [v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>, v.DescriptionAction<true | undefined, "Whether this is an initial snapshot.">]>;
|
|
@@ -122,6 +126,7 @@ export declare const UserTwapHistoryEvent: v.SchemaWithPipe<readonly [v.ObjectSc
|
|
|
122
126
|
status: "error";
|
|
123
127
|
description: string;
|
|
124
128
|
};
|
|
129
|
+
twapId?: number | undefined;
|
|
125
130
|
}[];
|
|
126
131
|
isSnapshot?: true | undefined;
|
|
127
132
|
}, "Event of user TWAP history.">]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userTwapHistory.d.ts","sourceRoot":"","sources":["../../../../src/src/api/subscription/userTwapHistory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAW,KAAK,aAAa,EAA2B,MAAM,aAAa,CAAC;AACnF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAM5D,oEAAoE;AACpE,eAAO,MAAM,sBAAsB;IAG7B,4BAA4B;;IAK5B,oBAAoB;;;;;qEAQtB,CAAC;AACL,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAElF,kCAAkC;AAClC,eAAO,MAAM,oBAAoB;IAG3B,oBAAoB;;IAKpB,oCAAoC;;QAM5B,oEAAoE;;QAKpE,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;QAE/B,wCAAwC
|
|
1
|
+
{"version":3,"file":"userTwapHistory.d.ts","sourceRoot":"","sources":["../../../../src/src/api/subscription/userTwapHistory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAW,KAAK,aAAa,EAA2B,MAAM,aAAa,CAAC;AACnF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAM5D,oEAAoE;AACpE,eAAO,MAAM,sBAAsB;IAG7B,4BAA4B;;IAK5B,oBAAoB;;;;;qEAQtB,CAAC;AACL,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAElF,kCAAkC;AAClC,eAAO,MAAM,oBAAoB;IAG3B,oBAAoB;;IAKpB,oCAAoC;;QAM5B,oEAAoE;;QAKpE,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;QAE/B,wCAAwC;;;;;;;;;;;;QAExC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAW9B,2CAA2C;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAQ7C,CAAC;AACL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAI9E,uEAAuE;AACvE,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAAE,MAAM,CAAC,CAAC;AAElG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,yBAAyB,EACjC,MAAM,EAAE,aAAa,CAAC,yBAAyB,CAAC,EAChD,QAAQ,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,GAC7C,OAAO,CAAC,YAAY,CAAC,CAOvB"}
|
|
@@ -63,6 +63,8 @@ exports.UserTwapHistoryEvent = (() => {
|
|
|
63
63
|
state: _common_schemas_js_1.TwapStateSchema,
|
|
64
64
|
/** Current status of the TWAP order. */
|
|
65
65
|
status: _common_schemas_js_1.TwapStatusSchema,
|
|
66
|
+
/** ID of the TWAP. */
|
|
67
|
+
twapId: v.pipe(v.optional(_base_js_1.UnsignedInteger), v.description("ID of the TWAP.")),
|
|
66
68
|
}), v.description("TWAP history record."))), v.description("Array of user's TWAP history.")),
|
|
67
69
|
/** Whether this is an initial snapshot. */
|
|
68
70
|
isSnapshot: v.pipe(v.optional(v.literal(true)), v.description("Whether this is an initial snapshot.")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userTwapHistory.js","sourceRoot":"","sources":["../../../../src/src/api/subscription/userTwapHistory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"userTwapHistory.js","sourceRoot":"","sources":["../../../../src/src/api/subscription/userTwapHistory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA,0CAWC;AAnHD,2CAA6B;AAC7B,0CAAmF;AAInF,8DAA0E;AAE1E,oDAAoD;AAEpD,oEAAoE;AACvD,QAAA,sBAAsB,GAAmB,CAAC,GAAG,EAAE;IAC1D,OAAO,CAAC,CAAC,IAAI,CACX,CAAC,CAAC,MAAM,CAAC;QACP,4BAA4B;QAC5B,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAC5B,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAAC,CACvC;QACD,oBAAoB;QACpB,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,kBAAO,EACP,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAC/B;KACF,CAAC,EACF,CAAC,CAAC,WAAW,CAAC,+DAA+D,CAAC,CAC/E,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AAGL,kCAAkC;AACrB,QAAA,oBAAoB,GAAmB,CAAC,GAAG,EAAE;IACxD,OAAO,CAAC,CAAC,IAAI,CACX,CAAC,CAAC,MAAM,CAAC;QACP,oBAAoB;QACpB,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,kBAAO,EACP,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAC/B;QACD,oCAAoC;QACpC,OAAO,EAAE,CAAC,CAAC,IAAI,CACb,CAAC,CAAC,KAAK;QACL,2BAA2B;QAC3B,CAAC,CAAC,IAAI,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,oEAAoE;YACpE,IAAI,EAAE,CAAC,CAAC,IAAI,CACV,0BAAe,EACf,CAAC,CAAC,WAAW,CAAC,+DAA+D,CAAC,CAC/E;YACD,+BAA+B;YAC/B,KAAK,EAAE,oCAAe;YACtB,wCAAwC;YACxC,MAAM,EAAE,qCAAgB;YACxB,sBAAsB;YACtB,MAAM,EAAE,CAAC,CAAC,IAAI,CACZ,CAAC,CAAC,QAAQ,CAAC,0BAAe,CAAC,EAC3B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CACjC;SACF,CAAC,EACF,CAAC,CAAC,WAAW,CAAC,sBAAsB,CAAC,CACtC,CACF,EACD,CAAC,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAC/C;QACD,2CAA2C;QAC3C,UAAU,EAAE,CAAC,CAAC,IAAI,CAChB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAC3B,CAAC,CAAC,WAAW,CAAC,sCAAsC,CAAC,CACtD;KACF,CAAC,EACF,CAAC,CAAC,WAAW,CAAC,6BAA6B,CAAC,CAC7C,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AAQL;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,eAAe,CAC7B,MAAiC,EACjC,MAAgD,EAChD,QAA8C;IAE9C,MAAM,OAAO,GAAG,IAAA,iBAAM,EAAC,8BAAsB,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACvF,OAAO,MAAM,CAAC,SAAS,CAAC,SAAS,CAAuB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;QACnF,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;YACnC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -49,7 +49,7 @@ export declare const WebData2Event: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
49
49
|
readonly leverage: v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.ObjectSchema<{
|
|
50
50
|
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"isolated", undefined>, v.DescriptionAction<"isolated", "Leverage type.">]>;
|
|
51
51
|
readonly value: 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.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Leverage value used.">]>;
|
|
52
|
-
readonly rawUsd: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Amount of USD used (1 = 1
|
|
52
|
+
readonly rawUsd: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, string>, v.TrimAction, v.RegexAction<string, undefined>, v.TransformAction<string, string>]>, v.DescriptionAction<string, "Amount of USD used (1 = $1).">]>;
|
|
53
53
|
}, undefined>, v.ObjectSchema<{
|
|
54
54
|
readonly type: v.SchemaWithPipe<readonly [v.LiteralSchema<"cross", undefined>, v.DescriptionAction<"cross", "Leverage type.">]>;
|
|
55
55
|
readonly value: 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.MinValueAction<number, 1, undefined>, v.DescriptionAction<number, "Leverage value used.">]>;
|
package/src/bin/cli.ts
CHANGED
|
@@ -108,156 +108,156 @@ INFO ENDPOINT METHODS
|
|
|
108
108
|
Market Data:
|
|
109
109
|
alignedQuoteTokenInfo --token <number>
|
|
110
110
|
allMids [--dex <string>]
|
|
111
|
-
|
|
112
|
-
candleSnapshot --coin <string> --interval <1m|3m|5m|15m|30m|1h|2h|4h|8h|12h|1d|3d|1w|1M>
|
|
111
|
+
candleSnapshot --coin <string> --interval <1m|3m|5m|15m|30m|1h|2h|4h|8h|12h|1d|3d|1w|1M>
|
|
113
112
|
--startTime <number> [--endTime <number>]
|
|
114
113
|
fundingHistory --coin <string> --startTime <number> [--endTime <number>]
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
l2Book --coin <string> [--nSigFigs <2|3|4|5>] [--mantissa <2|5>]
|
|
115
|
+
liquidatable (no params)
|
|
116
|
+
marginTable --id <number>
|
|
117
|
+
maxMarketOrderNtls (no params)
|
|
119
118
|
meta [--dex <string>]
|
|
120
119
|
metaAndAssetCtxs [--dex <string>]
|
|
120
|
+
perpDexLimits --dex <string>
|
|
121
|
+
perpDexs (no params)
|
|
122
|
+
perpsAtOpenInterestCap [--dex <string>]
|
|
123
|
+
predictedFundings (no params)
|
|
124
|
+
recentTrades --coin <string>
|
|
121
125
|
spotMeta (no params)
|
|
122
126
|
spotMetaAndAssetCtxs (no params)
|
|
123
|
-
exchangeStatus (no params)
|
|
124
|
-
perpDexs (no params)
|
|
125
|
-
perpDexLimits --dex <string>
|
|
126
|
-
spotPairDeployAuctionStatus (no params)
|
|
127
|
-
perpDeployAuctionStatus (no params)
|
|
128
|
-
perpsAtOpenInterestCap [--dex <string>]
|
|
129
|
-
maxMarketOrderNtls (no params)
|
|
130
|
-
liquidatable (no params)
|
|
131
|
-
marginTable --id <number>
|
|
132
127
|
|
|
133
|
-
User Account
|
|
134
|
-
clearinghouseState --user <address> [--dex <string>]
|
|
135
|
-
spotClearinghouseState --user <address> [--dex <string>]
|
|
136
|
-
portfolio --user <address>
|
|
137
|
-
openOrders --user <address> [--dex <string>]
|
|
138
|
-
frontendOpenOrders --user <address> [--dex <string>]
|
|
139
|
-
historicalOrders --user <address>
|
|
140
|
-
orderStatus --user <address> --oid <number|hex>
|
|
141
|
-
userDetails --user <address>
|
|
142
|
-
userFees --user <address>
|
|
143
|
-
userRateLimit --user <address>
|
|
144
|
-
userRole --user <address>
|
|
128
|
+
User Account:
|
|
145
129
|
activeAssetData --user <address> --coin <string>
|
|
130
|
+
clearinghouseState --user <address> [--dex <string>]
|
|
131
|
+
extraAgents --user <address>
|
|
146
132
|
isVip --user <address>
|
|
147
133
|
legalCheck --user <address>
|
|
148
|
-
referral --user <address>
|
|
149
|
-
spotDeployState --user <address>
|
|
150
|
-
preTransferCheck --user <address> --source <address>
|
|
151
134
|
maxBuilderFee --user <address> --builder <address>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
135
|
+
portfolio --user <address>
|
|
136
|
+
preTransferCheck --user <address> --source <address>
|
|
137
|
+
referral --user <address>
|
|
138
|
+
spotClearinghouseState --user <address> [--dex <string>]
|
|
139
|
+
subAccounts --user <address>
|
|
140
|
+
userDexAbstraction --user <address>
|
|
141
|
+
userFees --user <address>
|
|
158
142
|
userFunding --user <address> --startTime <number> [--endTime <number>]
|
|
159
143
|
userNonFundingLedgerUpdates --user <address> --startTime <number> [--endTime <number>]
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
userTwapSliceFillsByTime --user <address> --startTime <number> [--endTime <number>]
|
|
163
|
-
[--aggregateByTime <bool>]
|
|
164
|
-
|
|
165
|
-
Sub-Account & Multi-Sig:
|
|
166
|
-
subAccounts --user <address>
|
|
167
|
-
extraAgents --user <address>
|
|
144
|
+
userRateLimit --user <address>
|
|
145
|
+
userRole --user <address>
|
|
168
146
|
userToMultiSigSigners --user <address>
|
|
147
|
+
webData2 --user <address>
|
|
169
148
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
149
|
+
Orders & TWAP & Position:
|
|
150
|
+
frontendOpenOrders --user <address> [--dex <string>]
|
|
151
|
+
historicalOrders --user <address>
|
|
152
|
+
openOrders --user <address> [--dex <string>]
|
|
153
|
+
orderStatus --user <address> --oid <number|hex>
|
|
154
|
+
twapHistory --user <address>
|
|
155
|
+
userFills --user <address> [--aggregateByTime <bool>]
|
|
156
|
+
userFillsByTime --user <address> --startTime <number>
|
|
157
|
+
[--endTime <number>] [--aggregateByTime <bool>]
|
|
158
|
+
userTwapSliceFills --user <address>
|
|
159
|
+
userTwapSliceFillsByTime --user <address> --startTime <number>
|
|
160
|
+
[--endTime <number>] [--aggregateByTime <bool>]
|
|
175
161
|
|
|
176
162
|
Delegation & Validators:
|
|
177
163
|
delegations --user <address>
|
|
178
164
|
delegatorHistory --user <address>
|
|
179
165
|
delegatorRewards --user <address>
|
|
180
166
|
delegatorSummary --user <address>
|
|
167
|
+
gossipRootIps (no params)
|
|
181
168
|
validatorL1Votes (no params)
|
|
182
169
|
validatorSummaries (no params)
|
|
183
|
-
|
|
170
|
+
|
|
171
|
+
Vault:
|
|
172
|
+
leadingVaults --user <address>
|
|
173
|
+
userVaultEquities --user <address>
|
|
174
|
+
vaultDetails --vaultAddress <address> [--user <address>]
|
|
175
|
+
vaultSummaries (no params)
|
|
176
|
+
|
|
177
|
+
Deploy Market:
|
|
178
|
+
perpDeployAuctionStatus (no params)
|
|
179
|
+
spotDeployState --user <address>
|
|
180
|
+
spotPairDeployAuctionStatus (no params)
|
|
181
|
+
|
|
182
|
+
Other:
|
|
183
|
+
exchangeStatus (no params)
|
|
184
184
|
|
|
185
185
|
Transaction & Block Details:
|
|
186
|
-
txDetails --hash <hex>
|
|
187
186
|
blockDetails --height <number>
|
|
188
187
|
tokenDetails --tokenId <hex>
|
|
188
|
+
txDetails --hash <hex>
|
|
189
|
+
userDetails --user <address>
|
|
189
190
|
|
|
190
191
|
=============================================================================
|
|
191
192
|
EXCHANGE ENDPOINT METHODS
|
|
192
193
|
=============================================================================
|
|
193
194
|
|
|
194
|
-
|
|
195
|
-
order --orders <json> [--grouping <na|normalTpsl|positionTpsl>]
|
|
196
|
-
[--builder <json>]
|
|
197
|
-
modify --oid <number|hex> --order <json>
|
|
195
|
+
Order & TWAP & Position:
|
|
198
196
|
batchModify --modifies <json>
|
|
199
197
|
cancel --cancels <json>
|
|
200
198
|
cancelByCloid --cancels <json>
|
|
199
|
+
modify --oid <number|hex> --order <json>
|
|
200
|
+
order --orders <json> [--grouping <na|normalTpsl|positionTpsl>] [--builder <json>]
|
|
201
201
|
scheduleCancel [--time <number>]
|
|
202
|
-
|
|
203
|
-
TWAP Operations:
|
|
204
|
-
twapOrder --a <number> --b <bool> --s <number> --r <bool> --m <number> --t <bool>
|
|
205
202
|
twapCancel --a <number> --t <number>
|
|
206
|
-
|
|
207
|
-
Position Management:
|
|
208
|
-
updateLeverage --asset <number> --isCross <bool> --leverage <number>
|
|
203
|
+
twapOrder --a <number> --b <bool> --s <number> --r <bool> --m <number> --t <bool>
|
|
209
204
|
updateIsolatedMargin --asset <number> --isBuy <bool> --ntli <number>
|
|
205
|
+
updateLeverage --asset <number> --isCross <bool> --leverage <number>
|
|
206
|
+
|
|
207
|
+
Account:
|
|
208
|
+
agentEnableDexAbstraction (no params)
|
|
209
|
+
approveAgent --agentAddress <address> [--agentName <string>]
|
|
210
|
+
approveBuilderFee --maxFeeRate <number> --builder <address>
|
|
211
|
+
evmUserModify --usingBigBlocks <bool>
|
|
212
|
+
noop (no params)
|
|
213
|
+
reserveRequestWeight --weight <number>
|
|
214
|
+
setDisplayName --displayName <string>
|
|
215
|
+
spotUser --optOut <bool>
|
|
216
|
+
userDexAbstraction --user <address> --enabled <bool>
|
|
210
217
|
|
|
211
218
|
Fund Transfers:
|
|
212
|
-
withdraw3 --destination <address> --amount <number>
|
|
213
|
-
usdSend --destination <address> --amount <number>
|
|
214
|
-
spotSend --destination <address> --token <name:address> --amount <number>
|
|
215
219
|
sendAsset --destination <address> --token <name:address> --amount <number>
|
|
216
220
|
--sourceDex <string> --destinationDex <string> [--fromSubAccount <address>]
|
|
221
|
+
spotSend --destination <address> --token <name:address> --amount <number>
|
|
217
222
|
usdClassTransfer --amount <number> --toPerp <bool>
|
|
223
|
+
usdSend --destination <address> --amount <number>
|
|
224
|
+
withdraw3 --destination <address> --amount <number>
|
|
218
225
|
|
|
219
|
-
Sub-Account
|
|
226
|
+
Sub-Account:
|
|
220
227
|
createSubAccount --name <string>
|
|
221
228
|
subAccountModify --subAccountUser <address> --name <string>
|
|
222
|
-
|
|
223
|
-
subAccountSpotTransfer --subAccountUser <address> --isDeposit <bool>
|
|
229
|
+
subAccountSpotTransfer --subAccountUser <address> --isDeposit <bool>
|
|
224
230
|
--token <name:address> --amount <number>
|
|
231
|
+
subAccountTransfer --subAccountUser <address> --isDeposit <bool> --usd <number>
|
|
225
232
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
vaultModify --vaultAddress <address> [--allowDeposits <bool>]
|
|
229
|
-
[--alwaysCloseOnWithdraw <bool>]
|
|
230
|
-
vaultTransfer --vaultAddress <address> --isDeposit <bool> --usd <number>
|
|
231
|
-
vaultDistribute --vaultAddress <address> --usd <number>
|
|
232
|
-
|
|
233
|
-
Agent & Referrer:
|
|
234
|
-
approveAgent --agentAddress <address> [--agentName <string>]
|
|
235
|
-
approveBuilderFee --maxFeeRate <number> --builder <address>
|
|
233
|
+
Referrer:
|
|
234
|
+
claimRewards (no params)
|
|
236
235
|
registerReferrer --code <string>
|
|
237
236
|
setReferrer --code <string>
|
|
238
|
-
setDisplayName --displayName <string>
|
|
239
237
|
|
|
240
238
|
Staking & Delegation:
|
|
241
|
-
tokenDelegate --validator <address> --wei <number> --isUndelegate <bool>
|
|
242
239
|
cDeposit --wei <number>
|
|
243
240
|
cWithdraw --wei <number>
|
|
244
|
-
|
|
241
|
+
tokenDelegate --validator <address> --wei <number> --isUndelegate <bool>
|
|
245
242
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
243
|
+
Vault:
|
|
244
|
+
createVault --name <string> --description <string> --initialUsd <number>
|
|
245
|
+
vaultDistribute --vaultAddress <address> --usd <number>
|
|
246
|
+
vaultModify --vaultAddress <address> [--allowDeposits <bool>]
|
|
247
|
+
[--alwaysCloseOnWithdraw <bool>]
|
|
248
|
+
vaultTransfer --vaultAddress <address> --isDeposit <bool> --usd <number>
|
|
250
249
|
|
|
251
250
|
Deploy Market:
|
|
252
251
|
perpDeploy --registerAsset <json> | --setOracle <json>
|
|
253
252
|
spotDeploy --genesis <json> | --registerHyperliquidity <json> | --registerSpot <json> |
|
|
254
253
|
--registerToken2 <json> | --setDeployerTradingFeeShare <json> | --userGenesis <json>
|
|
255
254
|
|
|
256
|
-
|
|
257
|
-
convertToMultiSigUser --authorizedUsers <json> --threshold <number>
|
|
255
|
+
Validator Actions:
|
|
258
256
|
cSignerAction --jailSelf null | --unjailSelf null
|
|
259
257
|
cValidatorAction --changeProfile <json> | --register <json> | --unregister null
|
|
260
|
-
|
|
258
|
+
|
|
259
|
+
Other:
|
|
260
|
+
convertToMultiSigUser --authorizedUsers <json> --threshold <number>
|
|
261
261
|
|
|
262
262
|
=============================================================================
|
|
263
263
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { parser, UnsignedInteger } from "../_base.js";
|
|
2
|
+
import {
|
|
3
|
+
type ExchangeRequestConfig,
|
|
4
|
+
executeL1Action,
|
|
5
|
+
type ExtractRequestOptions,
|
|
6
|
+
type MultiSignRequestConfig,
|
|
7
|
+
Signature,
|
|
8
|
+
} from "./_base.js";
|
|
9
|
+
import * as v from "valibot";
|
|
10
|
+
|
|
11
|
+
// -------------------- Schemas --------------------
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Enable HIP-3 DEX abstraction.
|
|
15
|
+
* @see null
|
|
16
|
+
*/
|
|
17
|
+
export const AgentEnableDexAbstractionRequest = /* @__PURE__ */ (() => {
|
|
18
|
+
return v.pipe(
|
|
19
|
+
v.object({
|
|
20
|
+
/** Action to perform. */
|
|
21
|
+
action: v.pipe(
|
|
22
|
+
v.object({
|
|
23
|
+
/** Type of action. */
|
|
24
|
+
type: v.pipe(
|
|
25
|
+
v.literal("agentEnableDexAbstraction"),
|
|
26
|
+
v.description("Type of action."),
|
|
27
|
+
),
|
|
28
|
+
}),
|
|
29
|
+
v.description("Action to perform."),
|
|
30
|
+
),
|
|
31
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
32
|
+
nonce: v.pipe(
|
|
33
|
+
UnsignedInteger,
|
|
34
|
+
v.description("Unique request identifier (current timestamp in ms)."),
|
|
35
|
+
),
|
|
36
|
+
/** Cryptographic signature. */
|
|
37
|
+
signature: v.pipe(
|
|
38
|
+
Signature,
|
|
39
|
+
v.description("Cryptographic signature."),
|
|
40
|
+
),
|
|
41
|
+
/** Expiration time of the action. */
|
|
42
|
+
expiresAfter: v.pipe(
|
|
43
|
+
v.optional(UnsignedInteger),
|
|
44
|
+
v.description("Expiration time of the action."),
|
|
45
|
+
),
|
|
46
|
+
}),
|
|
47
|
+
v.description("Enable HIP-3 DEX abstraction request."),
|
|
48
|
+
);
|
|
49
|
+
})();
|
|
50
|
+
export type AgentEnableDexAbstractionRequest = v.InferOutput<typeof AgentEnableDexAbstractionRequest>;
|
|
51
|
+
|
|
52
|
+
import { SuccessResponse } from "./_base.js";
|
|
53
|
+
export { SuccessResponse };
|
|
54
|
+
|
|
55
|
+
// -------------------- Function --------------------
|
|
56
|
+
|
|
57
|
+
/** Request options for the {@linkcode agentEnableDexAbstraction} function. */
|
|
58
|
+
export type AgentEnableDexAbstractionOptions = ExtractRequestOptions<
|
|
59
|
+
v.InferInput<typeof AgentEnableDexAbstractionRequest>
|
|
60
|
+
>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Enable HIP-3 DEX abstraction.
|
|
64
|
+
* @param config - General configuration for Exchange API requests.
|
|
65
|
+
* @param params - Parameters specific to the API request.
|
|
66
|
+
* @param opts - Request execution options.
|
|
67
|
+
* @returns Successful response without specific data.
|
|
68
|
+
*
|
|
69
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
70
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
71
|
+
*
|
|
72
|
+
* @see null
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
76
|
+
* import { agentEnableDexAbstraction } from "@nktkas/hyperliquid/api/exchange";
|
|
77
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
78
|
+
*
|
|
79
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
80
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
81
|
+
*
|
|
82
|
+
* await agentEnableDexAbstraction({ transport, wallet });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export async function agentEnableDexAbstraction(
|
|
86
|
+
config: ExchangeRequestConfig | MultiSignRequestConfig,
|
|
87
|
+
opts?: AgentEnableDexAbstractionOptions,
|
|
88
|
+
): Promise<SuccessResponse> {
|
|
89
|
+
const action = parser(AgentEnableDexAbstractionRequest.entries.action)({
|
|
90
|
+
type: "agentEnableDexAbstraction",
|
|
91
|
+
});
|
|
92
|
+
const expiresAfter = typeof config.defaultExpiresAfter === "number"
|
|
93
|
+
? config.defaultExpiresAfter
|
|
94
|
+
: await config.defaultExpiresAfter?.();
|
|
95
|
+
return await executeL1Action(config, { action, expiresAfter }, opts?.signal);
|
|
96
|
+
}
|
|
@@ -38,10 +38,10 @@ export const UsdClassTransferRequest = /* @__PURE__ */ (() => {
|
|
|
38
38
|
v.union([v.literal("Mainnet"), v.literal("Testnet")]),
|
|
39
39
|
v.description("HyperLiquid network."),
|
|
40
40
|
),
|
|
41
|
-
/** Amount to transfer (1 = 1
|
|
41
|
+
/** Amount to transfer (1 = $1). */
|
|
42
42
|
amount: v.pipe(
|
|
43
43
|
UnsignedDecimal,
|
|
44
|
-
v.description("Amount to transfer (1 = 1
|
|
44
|
+
v.description("Amount to transfer (1 = $1)."),
|
|
45
45
|
),
|
|
46
46
|
/** `true` for Spot to Perp, `false` for Perp to Spot. */
|
|
47
47
|
toPerp: v.pipe(
|
|
@@ -43,10 +43,10 @@ export const UsdSendRequest = /* @__PURE__ */ (() => {
|
|
|
43
43
|
Address,
|
|
44
44
|
v.description("Destination address."),
|
|
45
45
|
),
|
|
46
|
-
/** Amount to send (1 = 1
|
|
46
|
+
/** Amount to send (1 = $1). */
|
|
47
47
|
amount: v.pipe(
|
|
48
48
|
UnsignedDecimal,
|
|
49
|
-
v.description("Amount to send (1 = 1
|
|
49
|
+
v.description("Amount to send (1 = $1)."),
|
|
50
50
|
),
|
|
51
51
|
/** Unique request identifier (current timestamp in ms). */
|
|
52
52
|
time: v.pipe(
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Address, type DeepImmutable, Hex, parser, UnsignedInteger } from "../_base.js";
|
|
2
|
+
import {
|
|
3
|
+
type ExchangeRequestConfig,
|
|
4
|
+
executeUserSignedAction,
|
|
5
|
+
type ExtractRequestAction,
|
|
6
|
+
type ExtractRequestOptions,
|
|
7
|
+
getNonce,
|
|
8
|
+
getSignatureChainId,
|
|
9
|
+
type MultiSignRequestConfig,
|
|
10
|
+
Signature,
|
|
11
|
+
} from "./_base.js";
|
|
12
|
+
import * as v from "valibot";
|
|
13
|
+
|
|
14
|
+
// -------------------- Schemas --------------------
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
18
|
+
* @see null
|
|
19
|
+
*/
|
|
20
|
+
export const UserDexAbstractionExchangeRequest = /* @__PURE__ */ (() => {
|
|
21
|
+
return v.pipe(
|
|
22
|
+
v.object({
|
|
23
|
+
/** Action to perform. */
|
|
24
|
+
action: v.pipe(
|
|
25
|
+
v.object({
|
|
26
|
+
/** Type of action. */
|
|
27
|
+
type: v.pipe(
|
|
28
|
+
v.literal("userDexAbstraction"),
|
|
29
|
+
v.description("Type of action."),
|
|
30
|
+
),
|
|
31
|
+
/** Chain ID used for signing. */
|
|
32
|
+
signatureChainId: v.pipe(
|
|
33
|
+
Hex,
|
|
34
|
+
v.description("Chain ID used for signing."),
|
|
35
|
+
),
|
|
36
|
+
/** HyperLiquid network. */
|
|
37
|
+
hyperliquidChain: v.pipe(
|
|
38
|
+
v.union([v.literal("Mainnet"), v.literal("Testnet")]),
|
|
39
|
+
v.description("HyperLiquid network."),
|
|
40
|
+
),
|
|
41
|
+
/** User address. */
|
|
42
|
+
user: v.pipe(
|
|
43
|
+
Address,
|
|
44
|
+
v.description("User address."),
|
|
45
|
+
),
|
|
46
|
+
/** Whether to enable or disable HIP-3 DEX abstraction. */
|
|
47
|
+
enabled: v.pipe(
|
|
48
|
+
v.boolean(),
|
|
49
|
+
v.description("Whether to enable or disable HIP-3 DEX abstraction."),
|
|
50
|
+
),
|
|
51
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
52
|
+
nonce: v.pipe(
|
|
53
|
+
UnsignedInteger,
|
|
54
|
+
v.description("Unique request identifier (current timestamp in ms)."),
|
|
55
|
+
),
|
|
56
|
+
}),
|
|
57
|
+
v.description("Action to perform."),
|
|
58
|
+
),
|
|
59
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
60
|
+
nonce: v.pipe(
|
|
61
|
+
UnsignedInteger,
|
|
62
|
+
v.description("Unique request identifier (current timestamp in ms)."),
|
|
63
|
+
),
|
|
64
|
+
/** Cryptographic signature. */
|
|
65
|
+
signature: v.pipe(
|
|
66
|
+
Signature,
|
|
67
|
+
v.description("Cryptographic signature."),
|
|
68
|
+
),
|
|
69
|
+
}),
|
|
70
|
+
v.description("Enable/disable HIP-3 DEX abstraction."),
|
|
71
|
+
);
|
|
72
|
+
})();
|
|
73
|
+
export type UserDexAbstractionExchangeRequest = v.InferOutput<typeof UserDexAbstractionExchangeRequest>;
|
|
74
|
+
|
|
75
|
+
import { SuccessResponse } from "./_base.js";
|
|
76
|
+
export { SuccessResponse };
|
|
77
|
+
|
|
78
|
+
// -------------------- Function --------------------
|
|
79
|
+
|
|
80
|
+
/** Action parameters for the {@linkcode userDexAbstraction} function. */
|
|
81
|
+
export type UserDexAbstractionExchangeParameters = ExtractRequestAction<
|
|
82
|
+
v.InferInput<typeof UserDexAbstractionExchangeRequest>
|
|
83
|
+
>;
|
|
84
|
+
/** Request options for the {@linkcode userDexAbstraction} function. */
|
|
85
|
+
export type UserDexAbstractionExchangeOptions = ExtractRequestOptions<
|
|
86
|
+
v.InferInput<typeof UserDexAbstractionExchangeRequest>
|
|
87
|
+
>;
|
|
88
|
+
|
|
89
|
+
/** EIP-712 types for the {@linkcode userDexAbstraction} function. */
|
|
90
|
+
export const UserDexAbstractionTypes = {
|
|
91
|
+
"HyperliquidTransaction:UserDexAbstraction": [
|
|
92
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
93
|
+
{ name: "user", type: "address" },
|
|
94
|
+
{ name: "enabled", type: "bool" },
|
|
95
|
+
{ name: "nonce", type: "uint64" },
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Enable/disable HIP-3 DEX abstraction.
|
|
101
|
+
* @param config - General configuration for Exchange API requests.
|
|
102
|
+
* @param params - Parameters specific to the API request.
|
|
103
|
+
* @param opts - Request execution options.
|
|
104
|
+
* @returns Successful response without specific data.
|
|
105
|
+
*
|
|
106
|
+
* @throws {ApiRequestError} When the API returns an unsuccessful response.
|
|
107
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
108
|
+
*
|
|
109
|
+
* @see null
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { HttpTransport } from "@nktkas/hyperliquid";
|
|
113
|
+
* import { userDexAbstraction } from "@nktkas/hyperliquid/api/exchange";
|
|
114
|
+
* import { privateKeyToAccount } from "npm:viem/accounts";
|
|
115
|
+
*
|
|
116
|
+
* const wallet = privateKeyToAccount("0x..."); // viem or ethers
|
|
117
|
+
* const transport = new HttpTransport(); // or `WebSocketTransport`
|
|
118
|
+
*
|
|
119
|
+
* await userDexAbstraction(
|
|
120
|
+
* { transport, wallet },
|
|
121
|
+
* { user: "0x...", enabled: true },
|
|
122
|
+
* );
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export async function userDexAbstraction(
|
|
126
|
+
config: ExchangeRequestConfig | MultiSignRequestConfig,
|
|
127
|
+
params: DeepImmutable<UserDexAbstractionExchangeParameters>,
|
|
128
|
+
opts?: UserDexAbstractionExchangeOptions,
|
|
129
|
+
): Promise<SuccessResponse> {
|
|
130
|
+
const action = parser(UserDexAbstractionExchangeRequest.entries.action)({
|
|
131
|
+
type: "userDexAbstraction",
|
|
132
|
+
hyperliquidChain: config.transport.isTestnet ? "Testnet" : "Mainnet",
|
|
133
|
+
signatureChainId: await getSignatureChainId(config),
|
|
134
|
+
nonce: await getNonce(config),
|
|
135
|
+
...params,
|
|
136
|
+
});
|
|
137
|
+
return await executeUserSignedAction(
|
|
138
|
+
config,
|
|
139
|
+
{ action, types: UserDexAbstractionTypes },
|
|
140
|
+
opts?.signal,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
@@ -43,10 +43,10 @@ export const Withdraw3Request = /* @__PURE__ */ (() => {
|
|
|
43
43
|
Address,
|
|
44
44
|
v.description("Destination address."),
|
|
45
45
|
),
|
|
46
|
-
/** Amount to withdraw (1 = 1
|
|
46
|
+
/** Amount to withdraw (1 = $1). */
|
|
47
47
|
amount: v.pipe(
|
|
48
48
|
UnsignedDecimal,
|
|
49
|
-
v.description("Amount to withdraw (1 = 1
|
|
49
|
+
v.description("Amount to withdraw (1 = $1)."),
|
|
50
50
|
),
|
|
51
51
|
/** Unique request identifier (current timestamp in ms). */
|
|
52
52
|
time: v.pipe(
|