@continuumdao/ctm-mpc-defi 0.2.48 → 0.2.50
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/dist/agent/catalog.cjs +1664 -5
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +2705 -7
- package/dist/agent/catalog.js +1599 -6
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/derive/SKILL.md +112 -0
- package/dist/agent/skills/hyperliquid/SKILL.md +22 -2
- package/dist/agent/skills/trueo/SKILL.md +64 -0
- package/dist/chains/evm/index.d.ts +118 -6
- package/dist/chains/near/index.d.ts +7 -1
- package/dist/chains/solana/index.d.ts +7 -1
- package/dist/core/index.cjs +3 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +138 -7
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +848 -16
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.d.ts +600 -6
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +125 -5
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/arcus/index.d.ts +66 -2
- package/dist/protocols/evm/circle-cctp/index.d.ts +71 -2
- package/dist/protocols/evm/compound-v3/index.d.ts +52 -1
- package/dist/protocols/evm/continuum-dao/index.d.ts +56 -1
- package/dist/protocols/evm/curve-dao/index.d.ts +66 -2
- package/dist/protocols/evm/derive/index.cjs +2655 -0
- package/dist/protocols/evm/derive/index.cjs.map +1 -0
- package/dist/protocols/evm/derive/index.d.ts +859 -0
- package/dist/protocols/evm/derive/index.js +2536 -0
- package/dist/protocols/evm/derive/index.js.map +1 -0
- package/dist/protocols/evm/ethena/index.d.ts +52 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +115 -16
- package/dist/protocols/evm/gmx/index.d.ts +66 -2
- package/dist/protocols/evm/hyperliquid/index.cjs +545 -267
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.d.ts +152 -7
- package/dist/protocols/evm/hyperliquid/index.js +535 -269
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/lido/index.d.ts +52 -1
- package/dist/protocols/evm/maple/index.d.ts +52 -1
- package/dist/protocols/evm/morpho/index.d.ts +115 -4
- package/dist/protocols/evm/pendle/index.cjs +3 -1
- package/dist/protocols/evm/pendle/index.cjs.map +1 -1
- package/dist/protocols/evm/pendle/index.d.ts +125 -5
- package/dist/protocols/evm/pendle/index.js +3 -1
- package/dist/protocols/evm/pendle/index.js.map +1 -1
- package/dist/protocols/evm/permit2/index.d.ts +14 -1
- package/dist/protocols/evm/sky/index.d.ts +52 -1
- package/dist/protocols/evm/trueo/index.cjs +2308 -0
- package/dist/protocols/evm/trueo/index.cjs.map +1 -0
- package/dist/protocols/evm/trueo/index.d.ts +1254 -0
- package/dist/protocols/evm/trueo/index.js +2165 -0
- package/dist/protocols/evm/trueo/index.js.map +1 -0
- package/dist/protocols/evm/uniswap-v4/index.d.ts +78 -4
- package/dist/protocols/evm/venice/index.d.ts +52 -1
- package/package.json +12 -2
- package/dist/buildBatch-tsEUVn_a.d.ts +0 -45
- package/dist/eip712Multisign-6oNIlObj.d.ts +0 -39
- package/dist/envelope-Cm-llShH.d.ts +0 -37
- package/dist/merklDistributor-CdqtZC9N.d.ts +0 -65
- package/dist/multisign-Dr0j9fHm.d.ts +0 -489
- package/dist/registry-BvsXh0-r.d.ts +0 -8
- package/dist/types-RJpoU4Pc.d.ts +0 -34
- package/dist/types-lIfv59N1.d.ts +0 -63
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseAbi, encodeAbiParameters, keccak256, getAddress, parseUnits, encodeFunctionData, hashTypedData, defineChain, createPublicClient, parseGwei, serializeTransaction, stringToHex, http } from 'viem';
|
|
2
|
-
import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
3
1
|
import { encode } from '@msgpack/msgpack';
|
|
2
|
+
import { parseAbi, keccak256, encodeAbiParameters, getAddress, parseUnits, encodeFunctionData, hashTypedData, defineChain, createPublicClient, parseGwei, serializeTransaction, stringToHex, http } from 'viem';
|
|
3
|
+
import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
4
4
|
|
|
5
5
|
// src/core/registry.ts
|
|
6
6
|
var modules = [];
|
|
@@ -63,6 +63,340 @@ var HYPERLIQUID_MAX_CANDLE_LIMIT = 200;
|
|
|
63
63
|
var HYPERLIQUID_MAX_OHLCV_BARS = 2e3;
|
|
64
64
|
var HYPERLIQUID_DEFAULT_LOOKBACK_DAYS = 14;
|
|
65
65
|
var HYPERLIQUID_MAX_LOOKBACK_DAYS = 90;
|
|
66
|
+
var EXCHANGE_DOMAIN = {
|
|
67
|
+
name: "Exchange",
|
|
68
|
+
version: "1",
|
|
69
|
+
chainId: 1337,
|
|
70
|
+
verifyingContract: "0x0000000000000000000000000000000000000000"
|
|
71
|
+
};
|
|
72
|
+
var AGENT_TYPES = {
|
|
73
|
+
Agent: [
|
|
74
|
+
{ name: "source", type: "string" },
|
|
75
|
+
{ name: "connectionId", type: "bytes32" }
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
function adjustMsgpackValue(value) {
|
|
79
|
+
if (Array.isArray(value)) return value.map(adjustMsgpackValue);
|
|
80
|
+
if (typeof value === "object" && value !== null) {
|
|
81
|
+
const result = {};
|
|
82
|
+
for (const key of Object.keys(value)) {
|
|
83
|
+
const entry = value[key];
|
|
84
|
+
if (entry !== void 0) result[key] = adjustMsgpackValue(entry);
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
if (typeof value === "number" && Number.isInteger(value) && (value >= 4294967296 || value < -2147483648)) {
|
|
89
|
+
return BigInt(value);
|
|
90
|
+
}
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
function toUint64Bytes(n) {
|
|
94
|
+
const bytes = new Uint8Array(8);
|
|
95
|
+
new DataView(bytes.buffer).setBigUint64(0, BigInt(n));
|
|
96
|
+
return bytes;
|
|
97
|
+
}
|
|
98
|
+
function concatBytes(...parts) {
|
|
99
|
+
const total = parts.reduce((sum, p) => sum + p.length, 0);
|
|
100
|
+
const out = new Uint8Array(total);
|
|
101
|
+
let offset = 0;
|
|
102
|
+
for (const p of parts) {
|
|
103
|
+
out.set(p, offset);
|
|
104
|
+
offset += p.length;
|
|
105
|
+
}
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
function hexToBytes(hex) {
|
|
109
|
+
const h = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
110
|
+
const bytes = new Uint8Array(h.length / 2);
|
|
111
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
112
|
+
bytes[i] = parseInt(h.slice(i * 2, i * 2 + 2), 16);
|
|
113
|
+
}
|
|
114
|
+
return bytes;
|
|
115
|
+
}
|
|
116
|
+
function createHyperliquidL1ActionHash(args) {
|
|
117
|
+
const { action, nonce, vaultAddress, expiresAfter } = args;
|
|
118
|
+
const actionBytes = encode(adjustMsgpackValue(action));
|
|
119
|
+
const nonceBytes = toUint64Bytes(nonce);
|
|
120
|
+
const vaultMarker = vaultAddress ? new Uint8Array([1]) : new Uint8Array([0]);
|
|
121
|
+
const vaultBytes = vaultAddress ? hexToBytes(vaultAddress) : new Uint8Array();
|
|
122
|
+
const expiresMarker = expiresAfter !== void 0 ? new Uint8Array([0]) : new Uint8Array();
|
|
123
|
+
const expiresBytes = expiresAfter !== void 0 ? toUint64Bytes(expiresAfter) : new Uint8Array();
|
|
124
|
+
const bytes = concatBytes(actionBytes, nonceBytes, vaultMarker, vaultBytes, expiresMarker, expiresBytes);
|
|
125
|
+
return keccak256(bytes);
|
|
126
|
+
}
|
|
127
|
+
function buildHyperliquidAgentTypedData(args) {
|
|
128
|
+
const connectionId = createHyperliquidL1ActionHash(args);
|
|
129
|
+
const source = args.isTestnet ? "b" : "a";
|
|
130
|
+
return {
|
|
131
|
+
domain: EXCHANGE_DOMAIN,
|
|
132
|
+
types: AGENT_TYPES,
|
|
133
|
+
primaryType: "Agent",
|
|
134
|
+
message: {
|
|
135
|
+
source,
|
|
136
|
+
connectionId
|
|
137
|
+
},
|
|
138
|
+
connectionId,
|
|
139
|
+
nonce: args.nonce,
|
|
140
|
+
action: args.action
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function buildHyperliquidUpdateLeverageAction(args) {
|
|
144
|
+
const leverage = Math.trunc(args.leverage);
|
|
145
|
+
if (!Number.isFinite(leverage) || leverage < 1) {
|
|
146
|
+
throw new Error("leverage must be a positive integer");
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
type: "updateLeverage",
|
|
150
|
+
asset: args.asset,
|
|
151
|
+
isCross: args.isCross !== false,
|
|
152
|
+
leverage
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function parseHyperliquidBorrowLendAmount(amountHuman) {
|
|
156
|
+
if (amountHuman == null) return null;
|
|
157
|
+
const trimmed = String(amountHuman).trim();
|
|
158
|
+
if (!trimmed || trimmed.toLowerCase() === "max") return null;
|
|
159
|
+
return hyperliquidFloatToWire(trimmed);
|
|
160
|
+
}
|
|
161
|
+
function buildHyperliquidBorrowLendAction(args) {
|
|
162
|
+
const operation = args.operation;
|
|
163
|
+
if (operation !== "supply" && operation !== "withdraw" && operation !== "repay" && operation !== "borrow") {
|
|
164
|
+
throw new Error("operation must be supply, withdraw, repay, or borrow");
|
|
165
|
+
}
|
|
166
|
+
const token = Math.trunc(args.token);
|
|
167
|
+
if (!Number.isFinite(token) || token < 0) {
|
|
168
|
+
throw new Error("token must be a non-negative integer token index");
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
type: "borrowLend",
|
|
172
|
+
operation,
|
|
173
|
+
token,
|
|
174
|
+
amount: args.amount
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function hyperliquidFloatToWire(value) {
|
|
178
|
+
const n = typeof value === "number" ? value : Number.parseFloat(String(value).trim());
|
|
179
|
+
if (!Number.isFinite(n)) throw new Error("Invalid Hyperliquid wire number.");
|
|
180
|
+
const rounded = n.toFixed(8);
|
|
181
|
+
if (Math.abs(Number.parseFloat(rounded) - n) >= 1e-12) {
|
|
182
|
+
throw new Error(`Hyperliquid wire value ${value} has too many decimal places.`);
|
|
183
|
+
}
|
|
184
|
+
const normalized = Number(rounded === "-0" ? "0" : rounded);
|
|
185
|
+
return String(normalized);
|
|
186
|
+
}
|
|
187
|
+
function hyperliquidL1TifFromKey(tif) {
|
|
188
|
+
const key = String(tif ?? "gtc").trim().toLowerCase();
|
|
189
|
+
if (key === "alo") return "Alo";
|
|
190
|
+
if (key === "ioc") return "Ioc";
|
|
191
|
+
if (key === "gtc") return "Gtc";
|
|
192
|
+
throw new Error(`Unknown time-in-force: ${tif}. Use alo, gtc, or ioc.`);
|
|
193
|
+
}
|
|
194
|
+
function buildHyperliquidLimitOrderWire(args) {
|
|
195
|
+
return {
|
|
196
|
+
a: args.asset,
|
|
197
|
+
b: args.isBuy,
|
|
198
|
+
p: hyperliquidFloatToWire(args.limitPxHuman),
|
|
199
|
+
s: hyperliquidFloatToWire(args.szHuman),
|
|
200
|
+
r: Boolean(args.reduceOnly),
|
|
201
|
+
t: { limit: { tif: hyperliquidL1TifFromKey(args.tif) } }
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function buildHyperliquidTriggerOrderWire(args) {
|
|
205
|
+
const mode = args.tpslExecMode ?? "limit_at_trigger";
|
|
206
|
+
const triggerPx = hyperliquidFloatToWire(args.triggerPxHuman);
|
|
207
|
+
const limitPx = mode === "market" ? triggerPx : hyperliquidFloatToWire(args.limitPxHuman ?? args.triggerPxHuman);
|
|
208
|
+
return {
|
|
209
|
+
a: args.asset,
|
|
210
|
+
b: args.isBuy,
|
|
211
|
+
p: limitPx,
|
|
212
|
+
s: hyperliquidFloatToWire(args.szHuman),
|
|
213
|
+
r: true,
|
|
214
|
+
t: {
|
|
215
|
+
trigger: {
|
|
216
|
+
isMarket: mode === "market",
|
|
217
|
+
triggerPx,
|
|
218
|
+
tpsl: args.tpsl
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function validateHyperliquidTpslGeometry(args) {
|
|
224
|
+
const entry = Number.parseFloat(String(args.entryPxHuman).trim());
|
|
225
|
+
const tp = args.takeProfitTriggerPxHuman?.trim() != null && args.takeProfitTriggerPxHuman.trim() !== "" ? Number.parseFloat(args.takeProfitTriggerPxHuman.trim()) : null;
|
|
226
|
+
const sl = args.stopLossTriggerPxHuman?.trim() != null && args.stopLossTriggerPxHuman.trim() !== "" ? Number.parseFloat(args.stopLossTriggerPxHuman.trim()) : null;
|
|
227
|
+
if (!Number.isFinite(entry)) throw new Error("Invalid entry limit price for TP/SL validation.");
|
|
228
|
+
if (tp != null && !Number.isFinite(tp)) throw new Error("Invalid take-profit trigger price.");
|
|
229
|
+
if (sl != null && !Number.isFinite(sl)) throw new Error("Invalid stop-loss trigger price.");
|
|
230
|
+
if (args.isBuy) {
|
|
231
|
+
if (sl != null && sl >= entry) {
|
|
232
|
+
throw new Error("Long stop-loss must be below entry price.");
|
|
233
|
+
}
|
|
234
|
+
if (tp != null && tp <= entry) {
|
|
235
|
+
throw new Error("Long take-profit must be above entry price.");
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
if (sl != null && sl <= entry) {
|
|
239
|
+
throw new Error("Short stop-loss must be above entry price.");
|
|
240
|
+
}
|
|
241
|
+
if (tp != null && tp >= entry) {
|
|
242
|
+
throw new Error("Short take-profit must be below entry price.");
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function buildHyperliquidNormalTpslOrderWires(args) {
|
|
247
|
+
validateHyperliquidTpslGeometry({
|
|
248
|
+
isBuy: args.isBuy,
|
|
249
|
+
entryPxHuman: args.limitPxHuman,
|
|
250
|
+
takeProfitTriggerPxHuman: args.takeProfitTriggerPxHuman,
|
|
251
|
+
stopLossTriggerPxHuman: args.stopLossTriggerPxHuman
|
|
252
|
+
});
|
|
253
|
+
const orders = [
|
|
254
|
+
buildHyperliquidLimitOrderWire({
|
|
255
|
+
asset: args.asset,
|
|
256
|
+
isBuy: args.isBuy,
|
|
257
|
+
limitPxHuman: args.limitPxHuman,
|
|
258
|
+
szHuman: args.szHuman,
|
|
259
|
+
tif: args.tif
|
|
260
|
+
})
|
|
261
|
+
];
|
|
262
|
+
const closeIsBuy = !args.isBuy;
|
|
263
|
+
const tp = args.takeProfitTriggerPxHuman?.trim();
|
|
264
|
+
const sl = args.stopLossTriggerPxHuman?.trim();
|
|
265
|
+
if (tp) {
|
|
266
|
+
orders.push(
|
|
267
|
+
buildHyperliquidTriggerOrderWire({
|
|
268
|
+
asset: args.asset,
|
|
269
|
+
isBuy: closeIsBuy,
|
|
270
|
+
szHuman: args.szHuman,
|
|
271
|
+
triggerPxHuman: tp,
|
|
272
|
+
tpsl: "tp",
|
|
273
|
+
tpslExecMode: args.tpslExecMode
|
|
274
|
+
})
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
if (sl) {
|
|
278
|
+
orders.push(
|
|
279
|
+
buildHyperliquidTriggerOrderWire({
|
|
280
|
+
asset: args.asset,
|
|
281
|
+
isBuy: closeIsBuy,
|
|
282
|
+
szHuman: args.szHuman,
|
|
283
|
+
triggerPxHuman: sl,
|
|
284
|
+
tpsl: "sl",
|
|
285
|
+
tpslExecMode: args.tpslExecMode
|
|
286
|
+
})
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
return orders;
|
|
290
|
+
}
|
|
291
|
+
function buildHyperliquidOrderAction(args) {
|
|
292
|
+
return {
|
|
293
|
+
type: "order",
|
|
294
|
+
orders: args.orders,
|
|
295
|
+
grouping: args.grouping ?? "na"
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
var TRAILING_PCT_DECIMALS = 4;
|
|
299
|
+
function parseHyperliquidTrailingOffsetType(value) {
|
|
300
|
+
const key = String(value ?? "percentage").trim().toLowerCase();
|
|
301
|
+
if (key === "price" || key === "px" || key === "distance") return "price";
|
|
302
|
+
if (key === "percentage" || key === "percent" || key === "pct" || key === "%") return "percentage";
|
|
303
|
+
throw new Error("trailingOffsetType must be price or percentage.");
|
|
304
|
+
}
|
|
305
|
+
function hyperliquidTrailingPercentToWire(value) {
|
|
306
|
+
const raw = typeof value === "number" ? String(value) : String(value).trim();
|
|
307
|
+
const stripped = raw.endsWith("%") ? raw.slice(0, -1).trim() : raw;
|
|
308
|
+
const n = Number.parseFloat(stripped);
|
|
309
|
+
if (!Number.isFinite(n) || n <= 0) {
|
|
310
|
+
throw new Error("Trailing retracement percentage must be greater than zero.");
|
|
311
|
+
}
|
|
312
|
+
return `${n.toFixed(TRAILING_PCT_DECIMALS)}%`;
|
|
313
|
+
}
|
|
314
|
+
function buildHyperliquidTrailingRetracement(args) {
|
|
315
|
+
const offset = String(args.offsetHuman ?? "").trim();
|
|
316
|
+
if (!offset) throw new Error("trailingOffsetHuman is required.");
|
|
317
|
+
if (args.offsetType === "percentage") {
|
|
318
|
+
return { pct: hyperliquidTrailingPercentToWire(offset) };
|
|
319
|
+
}
|
|
320
|
+
const px = hyperliquidFloatToWire(offset);
|
|
321
|
+
if (Number.parseFloat(px) <= 0) {
|
|
322
|
+
throw new Error("Trailing retracement distance must be greater than zero.");
|
|
323
|
+
}
|
|
324
|
+
return { px };
|
|
325
|
+
}
|
|
326
|
+
var HYPERLIQUID_TRAILING_ACTIVATION_PX_ERROR = "Invalid trailing activation price.";
|
|
327
|
+
var POSITIVE_DECIMAL_RE = /^\d+(\.\d+)?$/;
|
|
328
|
+
function parseHyperliquidTrailingActivationPx(value) {
|
|
329
|
+
if (value == null) return null;
|
|
330
|
+
const raw = String(value).trim().replace(/,/g, "");
|
|
331
|
+
if (!raw) return null;
|
|
332
|
+
if (!POSITIVE_DECIMAL_RE.test(raw)) {
|
|
333
|
+
throw new Error(HYPERLIQUID_TRAILING_ACTIVATION_PX_ERROR);
|
|
334
|
+
}
|
|
335
|
+
const px = Number.parseFloat(raw);
|
|
336
|
+
if (!Number.isFinite(px) || px <= 0) {
|
|
337
|
+
throw new Error(HYPERLIQUID_TRAILING_ACTIVATION_PX_ERROR);
|
|
338
|
+
}
|
|
339
|
+
hyperliquidFloatToWire(raw);
|
|
340
|
+
return raw;
|
|
341
|
+
}
|
|
342
|
+
function isHyperliquidTrailingActivationPxHuman(value) {
|
|
343
|
+
try {
|
|
344
|
+
parseHyperliquidTrailingActivationPx(value);
|
|
345
|
+
return true;
|
|
346
|
+
} catch {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function validateHyperliquidTrailingStopParams(args) {
|
|
351
|
+
buildHyperliquidTrailingRetracement({
|
|
352
|
+
offsetType: args.offsetType,
|
|
353
|
+
offsetHuman: args.offsetHuman
|
|
354
|
+
});
|
|
355
|
+
parseHyperliquidTrailingActivationPx(args.activationPxHuman);
|
|
356
|
+
}
|
|
357
|
+
function parseHyperliquidTrailingStopParams(args) {
|
|
358
|
+
const offset = args.trailingOffsetHuman?.trim();
|
|
359
|
+
if (!offset) return null;
|
|
360
|
+
const params = {
|
|
361
|
+
offsetType: parseHyperliquidTrailingOffsetType(args.trailingOffsetType),
|
|
362
|
+
offsetHuman: offset,
|
|
363
|
+
activationPxHuman: args.trailingActivationPxHuman?.trim() || void 0
|
|
364
|
+
};
|
|
365
|
+
validateHyperliquidTrailingStopParams(params);
|
|
366
|
+
return params;
|
|
367
|
+
}
|
|
368
|
+
function buildHyperliquidTrailingStopAction(args) {
|
|
369
|
+
const asset = Math.trunc(args.asset);
|
|
370
|
+
if (!Number.isFinite(asset) || asset < 0) {
|
|
371
|
+
throw new Error("asset must be a non-negative integer.");
|
|
372
|
+
}
|
|
373
|
+
const retracement = buildHyperliquidTrailingRetracement({
|
|
374
|
+
offsetType: args.offsetType,
|
|
375
|
+
offsetHuman: args.offsetHuman
|
|
376
|
+
});
|
|
377
|
+
const activation = parseHyperliquidTrailingActivationPx(args.activationPxHuman);
|
|
378
|
+
return {
|
|
379
|
+
type: "trailingStop",
|
|
380
|
+
asset,
|
|
381
|
+
isBuy: Boolean(args.isBuy),
|
|
382
|
+
sz: hyperliquidFloatToWire(args.szHuman),
|
|
383
|
+
reduceOnly: Boolean(args.reduceOnly),
|
|
384
|
+
retracement,
|
|
385
|
+
activationPx: activation ? hyperliquidFloatToWire(activation) : null
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function parseHyperliquidTrailingTriggerCondition(triggerCondition) {
|
|
389
|
+
const text = String(triggerCondition ?? "").trim();
|
|
390
|
+
if (!text) return null;
|
|
391
|
+
const retracement = text.match(/(?:^|,\s*)retracement\s+([^,]+)/i)?.[1]?.trim();
|
|
392
|
+
if (!retracement) return null;
|
|
393
|
+
const activationRaw = text.match(/(?:^|,\s*)activation\s+(?:above|below)\s+([^,]+)/i)?.[1]?.trim();
|
|
394
|
+
const bestMatch = text.match(/(?:^|,\s*)best\s+([^,]+)/i);
|
|
395
|
+
const bestRaw = bestMatch?.[1]?.trim();
|
|
396
|
+
const bestPx = bestRaw && bestRaw.toLowerCase() !== "waiting" && Number.isFinite(Number.parseFloat(bestRaw)) ? bestRaw : null;
|
|
397
|
+
const activationPx = activationRaw && Number.isFinite(Number.parseFloat(activationRaw)) ? activationRaw : null;
|
|
398
|
+
return { retracement, activationPx, bestPx };
|
|
399
|
+
}
|
|
66
400
|
|
|
67
401
|
// src/protocols/evm/hyperliquid/api.ts
|
|
68
402
|
async function hyperliquidInfoPost(chainId, body) {
|
|
@@ -341,6 +675,12 @@ async function hyperliquidFetchActiveAssetData(args) {
|
|
|
341
675
|
}
|
|
342
676
|
};
|
|
343
677
|
}
|
|
678
|
+
function enrichHyperliquidFrontendOpenOrder(order) {
|
|
679
|
+
const parsed = order.trailingStop ?? parseHyperliquidTrailingTriggerCondition(order.triggerCondition);
|
|
680
|
+
const looksTrailing = parsed != null || String(order.orderType ?? "").toLowerCase().includes("trailing");
|
|
681
|
+
if (!looksTrailing) return order;
|
|
682
|
+
return { ...order, trailingStop: parsed ?? order.trailingStop ?? null };
|
|
683
|
+
}
|
|
344
684
|
async function hyperliquidFetchOpenOrders(args) {
|
|
345
685
|
const req = { type: "openOrders", user: args.user };
|
|
346
686
|
if (args.dex?.trim()) req.dex = args.dex.trim();
|
|
@@ -351,7 +691,7 @@ async function hyperliquidFetchFrontendOpenOrders(args) {
|
|
|
351
691
|
const req = { type: "frontendOpenOrders", user: args.user };
|
|
352
692
|
if (args.dex?.trim()) req.dex = args.dex.trim();
|
|
353
693
|
const orders = await hyperliquidInfoPost(args.chainId, req);
|
|
354
|
-
return { orders: orders ?? [] };
|
|
694
|
+
return { orders: (orders ?? []).map(enrichHyperliquidFrontendOpenOrder) };
|
|
355
695
|
}
|
|
356
696
|
async function hyperliquidFetchUserVaultEquities(args) {
|
|
357
697
|
const rows = await hyperliquidInfoPost(args.chainId, {
|
|
@@ -820,7 +1160,7 @@ async function hyperliquidFetchPositionDisplayRows(args) {
|
|
|
820
1160
|
return { rows };
|
|
821
1161
|
}
|
|
822
1162
|
async function hyperliquidFetchOrdersForExecutor(args) {
|
|
823
|
-
return
|
|
1163
|
+
return hyperliquidFetchFrontendOpenOrders({
|
|
824
1164
|
chainId: args.chainId,
|
|
825
1165
|
user: args.executorAddress.trim().toLowerCase(),
|
|
826
1166
|
dex: args.dex
|
|
@@ -1505,308 +1845,203 @@ function buildEip712Multisign(args) {
|
|
|
1505
1845
|
legs
|
|
1506
1846
|
});
|
|
1507
1847
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
Agent: [
|
|
1516
|
-
{ name: "source", type: "string" },
|
|
1517
|
-
{ name: "connectionId", type: "bytes32" }
|
|
1518
|
-
]
|
|
1519
|
-
};
|
|
1520
|
-
function adjustMsgpackValue(value) {
|
|
1521
|
-
if (Array.isArray(value)) return value.map(adjustMsgpackValue);
|
|
1522
|
-
if (typeof value === "object" && value !== null) {
|
|
1523
|
-
const result = {};
|
|
1524
|
-
for (const key of Object.keys(value)) {
|
|
1525
|
-
const entry = value[key];
|
|
1526
|
-
if (entry !== void 0) result[key] = adjustMsgpackValue(entry);
|
|
1527
|
-
}
|
|
1528
|
-
return result;
|
|
1529
|
-
}
|
|
1530
|
-
if (typeof value === "number" && Number.isInteger(value) && (value >= 4294967296 || value < -2147483648)) {
|
|
1531
|
-
return BigInt(value);
|
|
1532
|
-
}
|
|
1533
|
-
return value;
|
|
1534
|
-
}
|
|
1535
|
-
function toUint64Bytes(n) {
|
|
1536
|
-
const bytes = new Uint8Array(8);
|
|
1537
|
-
new DataView(bytes.buffer).setBigUint64(0, BigInt(n));
|
|
1538
|
-
return bytes;
|
|
1539
|
-
}
|
|
1540
|
-
function concatBytes(...parts) {
|
|
1541
|
-
const total = parts.reduce((sum, p) => sum + p.length, 0);
|
|
1542
|
-
const out = new Uint8Array(total);
|
|
1543
|
-
let offset = 0;
|
|
1544
|
-
for (const p of parts) {
|
|
1545
|
-
out.set(p, offset);
|
|
1546
|
-
offset += p.length;
|
|
1547
|
-
}
|
|
1548
|
-
return out;
|
|
1549
|
-
}
|
|
1550
|
-
function hexToBytes(hex) {
|
|
1551
|
-
const h = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
1552
|
-
const bytes = new Uint8Array(h.length / 2);
|
|
1553
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
1554
|
-
bytes[i] = parseInt(h.slice(i * 2, i * 2 + 2), 16);
|
|
1555
|
-
}
|
|
1556
|
-
return bytes;
|
|
1557
|
-
}
|
|
1558
|
-
function createHyperliquidL1ActionHash(args) {
|
|
1559
|
-
const { action, nonce, vaultAddress, expiresAfter } = args;
|
|
1560
|
-
const actionBytes = encode(adjustMsgpackValue(action));
|
|
1561
|
-
const nonceBytes = toUint64Bytes(nonce);
|
|
1562
|
-
const vaultMarker = vaultAddress ? new Uint8Array([1]) : new Uint8Array([0]);
|
|
1563
|
-
const vaultBytes = vaultAddress ? hexToBytes(vaultAddress) : new Uint8Array();
|
|
1564
|
-
const expiresMarker = expiresAfter !== void 0 ? new Uint8Array([0]) : new Uint8Array();
|
|
1565
|
-
const expiresBytes = expiresAfter !== void 0 ? toUint64Bytes(expiresAfter) : new Uint8Array();
|
|
1566
|
-
const bytes = concatBytes(actionBytes, nonceBytes, vaultMarker, vaultBytes, expiresMarker, expiresBytes);
|
|
1567
|
-
return keccak256(bytes);
|
|
1568
|
-
}
|
|
1569
|
-
function buildHyperliquidAgentTypedData(args) {
|
|
1570
|
-
const connectionId = createHyperliquidL1ActionHash(args);
|
|
1571
|
-
const source = args.isTestnet ? "b" : "a";
|
|
1572
|
-
return {
|
|
1573
|
-
domain: EXCHANGE_DOMAIN,
|
|
1574
|
-
types: AGENT_TYPES,
|
|
1575
|
-
primaryType: "Agent",
|
|
1576
|
-
message: {
|
|
1577
|
-
source,
|
|
1578
|
-
connectionId
|
|
1579
|
-
},
|
|
1580
|
-
connectionId,
|
|
1848
|
+
|
|
1849
|
+
// src/protocols/evm/hyperliquid/exchangeMultisign.ts
|
|
1850
|
+
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
1851
|
+
function hyperliquidExchangeLeg(args) {
|
|
1852
|
+
const isTestnet = args.chainId === 998;
|
|
1853
|
+
const typed = buildHyperliquidAgentTypedData({
|
|
1854
|
+
action: args.action,
|
|
1581
1855
|
nonce: args.nonce,
|
|
1582
|
-
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
function buildHyperliquidUpdateLeverageAction(args) {
|
|
1586
|
-
const leverage = Math.trunc(args.leverage);
|
|
1587
|
-
if (!Number.isFinite(leverage) || leverage < 1) {
|
|
1588
|
-
throw new Error("leverage must be a positive integer");
|
|
1589
|
-
}
|
|
1856
|
+
isTestnet
|
|
1857
|
+
});
|
|
1590
1858
|
return {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1859
|
+
typedData: {
|
|
1860
|
+
domain: typed.domain,
|
|
1861
|
+
types: typed.types,
|
|
1862
|
+
primaryType: typed.primaryType,
|
|
1863
|
+
message: typed.message
|
|
1864
|
+
},
|
|
1865
|
+
delivery: {
|
|
1866
|
+
kind: "hyperliquid_exchange",
|
|
1867
|
+
chainId: args.chainId,
|
|
1868
|
+
isTestnet,
|
|
1869
|
+
action: args.action,
|
|
1870
|
+
nonce: args.nonce
|
|
1871
|
+
},
|
|
1872
|
+
audit: {
|
|
1873
|
+
...args.audit,
|
|
1874
|
+
nonce: args.nonce,
|
|
1875
|
+
connectionId: typed.connectionId
|
|
1876
|
+
}
|
|
1595
1877
|
};
|
|
1596
1878
|
}
|
|
1597
|
-
function
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1879
|
+
function resolveTrailingForLimit(args) {
|
|
1880
|
+
return parseHyperliquidTrailingStopParams({
|
|
1881
|
+
trailingOffsetHuman: args.trailingOffsetHuman,
|
|
1882
|
+
trailingOffsetType: args.trailingOffsetType,
|
|
1883
|
+
trailingActivationPxHuman: args.trailingActivationPxHuman
|
|
1884
|
+
});
|
|
1602
1885
|
}
|
|
1603
|
-
function
|
|
1604
|
-
const
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
throw new Error("token must be a non-negative integer token index");
|
|
1886
|
+
async function buildHyperliquidLimitOrderWithTpslMultisign(args) {
|
|
1887
|
+
const marketKind = args.marketKind ?? "perp";
|
|
1888
|
+
const trailing = resolveTrailingForLimit(args);
|
|
1889
|
+
const tp = args.takeProfitTriggerPxHuman?.trim();
|
|
1890
|
+
const sl = args.stopLossTriggerPxHuman?.trim();
|
|
1891
|
+
if (trailing && sl) {
|
|
1892
|
+
throw new Error("Cannot combine a trailing stop with a fixed stopLossTriggerPxHuman.");
|
|
1611
1893
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
amount: args.amount
|
|
1617
|
-
};
|
|
1618
|
-
}
|
|
1619
|
-
function hyperliquidFloatToWire(value) {
|
|
1620
|
-
const n = typeof value === "number" ? value : Number.parseFloat(String(value).trim());
|
|
1621
|
-
if (!Number.isFinite(n)) throw new Error("Invalid Hyperliquid wire number.");
|
|
1622
|
-
const rounded = n.toFixed(8);
|
|
1623
|
-
if (Math.abs(Number.parseFloat(rounded) - n) >= 1e-12) {
|
|
1624
|
-
throw new Error(`Hyperliquid wire value ${value} has too many decimal places.`);
|
|
1894
|
+
if (!tp && !sl && !trailing) {
|
|
1895
|
+
throw new Error(
|
|
1896
|
+
"At least one of takeProfitTriggerPxHuman, stopLossTriggerPxHuman, or trailingOffsetHuman is required for L1 bracket orders."
|
|
1897
|
+
);
|
|
1625
1898
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
}
|
|
1629
|
-
function hyperliquidL1TifFromKey(tif) {
|
|
1630
|
-
const key = String(tif ?? "gtc").trim().toLowerCase();
|
|
1631
|
-
if (key === "alo") return "Alo";
|
|
1632
|
-
if (key === "ioc") return "Ioc";
|
|
1633
|
-
if (key === "gtc") return "Gtc";
|
|
1634
|
-
throw new Error(`Unknown time-in-force: ${tif}. Use alo, gtc, or ioc.`);
|
|
1635
|
-
}
|
|
1636
|
-
function buildHyperliquidLimitOrderWire(args) {
|
|
1637
|
-
return {
|
|
1638
|
-
a: args.asset,
|
|
1639
|
-
b: args.isBuy,
|
|
1640
|
-
p: hyperliquidFloatToWire(args.limitPxHuman),
|
|
1641
|
-
s: hyperliquidFloatToWire(args.szHuman),
|
|
1642
|
-
r: Boolean(args.reduceOnly),
|
|
1643
|
-
t: { limit: { tif: hyperliquidL1TifFromKey(args.tif) } }
|
|
1644
|
-
};
|
|
1645
|
-
}
|
|
1646
|
-
function buildHyperliquidTriggerOrderWire(args) {
|
|
1647
|
-
const mode = args.tpslExecMode ?? "limit_at_trigger";
|
|
1648
|
-
const triggerPx = hyperliquidFloatToWire(args.triggerPxHuman);
|
|
1649
|
-
const limitPx = mode === "market" ? triggerPx : hyperliquidFloatToWire(args.limitPxHuman ?? args.triggerPxHuman);
|
|
1650
|
-
return {
|
|
1651
|
-
a: args.asset,
|
|
1652
|
-
b: args.isBuy,
|
|
1653
|
-
p: limitPx,
|
|
1654
|
-
s: hyperliquidFloatToWire(args.szHuman),
|
|
1655
|
-
r: true,
|
|
1656
|
-
t: {
|
|
1657
|
-
trigger: {
|
|
1658
|
-
isMarket: mode === "market",
|
|
1659
|
-
triggerPx,
|
|
1660
|
-
tpsl: args.tpsl
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
};
|
|
1664
|
-
}
|
|
1665
|
-
function validateHyperliquidTpslGeometry(args) {
|
|
1666
|
-
const entry = Number.parseFloat(String(args.entryPxHuman).trim());
|
|
1667
|
-
const tp = args.takeProfitTriggerPxHuman?.trim() != null && args.takeProfitTriggerPxHuman.trim() !== "" ? Number.parseFloat(args.takeProfitTriggerPxHuman.trim()) : null;
|
|
1668
|
-
const sl = args.stopLossTriggerPxHuman?.trim() != null && args.stopLossTriggerPxHuman.trim() !== "" ? Number.parseFloat(args.stopLossTriggerPxHuman.trim()) : null;
|
|
1669
|
-
if (!Number.isFinite(entry)) throw new Error("Invalid entry limit price for TP/SL validation.");
|
|
1670
|
-
if (tp != null && !Number.isFinite(tp)) throw new Error("Invalid take-profit trigger price.");
|
|
1671
|
-
if (sl != null && !Number.isFinite(sl)) throw new Error("Invalid stop-loss trigger price.");
|
|
1672
|
-
if (args.isBuy) {
|
|
1673
|
-
if (sl != null && sl >= entry) {
|
|
1674
|
-
throw new Error("Long stop-loss must be below entry price.");
|
|
1675
|
-
}
|
|
1676
|
-
if (tp != null && tp <= entry) {
|
|
1677
|
-
throw new Error("Long take-profit must be above entry price.");
|
|
1678
|
-
}
|
|
1679
|
-
} else {
|
|
1680
|
-
if (sl != null && sl <= entry) {
|
|
1681
|
-
throw new Error("Short stop-loss must be above entry price.");
|
|
1682
|
-
}
|
|
1683
|
-
if (tp != null && tp >= entry) {
|
|
1684
|
-
throw new Error("Short take-profit must be below entry price.");
|
|
1685
|
-
}
|
|
1899
|
+
if (trailing && marketKind !== "perp") {
|
|
1900
|
+
throw new Error("Trailing stops are available for perp markets only.");
|
|
1686
1901
|
}
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
takeProfitTriggerPxHuman: args.takeProfitTriggerPxHuman,
|
|
1693
|
-
stopLossTriggerPxHuman: args.stopLossTriggerPxHuman
|
|
1902
|
+
const { asset } = await hyperliquidResolveAsset({
|
|
1903
|
+
chainId: args.chainId,
|
|
1904
|
+
coin: args.coin,
|
|
1905
|
+
marketKind,
|
|
1906
|
+
dex: args.dex
|
|
1694
1907
|
});
|
|
1695
|
-
const
|
|
1908
|
+
const hasFixedTpsl = Boolean(tp || sl);
|
|
1909
|
+
const orderWires = hasFixedTpsl ? buildHyperliquidNormalTpslOrderWires({
|
|
1910
|
+
asset,
|
|
1911
|
+
isBuy: args.isBuy,
|
|
1912
|
+
limitPxHuman: args.limitPxHuman,
|
|
1913
|
+
szHuman: args.szHuman,
|
|
1914
|
+
tif: args.tif,
|
|
1915
|
+
takeProfitTriggerPxHuman: tp || void 0,
|
|
1916
|
+
stopLossTriggerPxHuman: sl || void 0,
|
|
1917
|
+
tpslExecMode: args.tpslExecMode
|
|
1918
|
+
}) : [
|
|
1696
1919
|
buildHyperliquidLimitOrderWire({
|
|
1697
|
-
asset
|
|
1920
|
+
asset,
|
|
1698
1921
|
isBuy: args.isBuy,
|
|
1699
1922
|
limitPxHuman: args.limitPxHuman,
|
|
1700
1923
|
szHuman: args.szHuman,
|
|
1701
1924
|
tif: args.tif
|
|
1702
1925
|
})
|
|
1703
1926
|
];
|
|
1704
|
-
const
|
|
1705
|
-
const
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
isBuy: closeIsBuy,
|
|
1927
|
+
const grouping = hasFixedTpsl ? "normalTpsl" : "na";
|
|
1928
|
+
const orderAction = buildHyperliquidOrderAction({
|
|
1929
|
+
orders: orderWires,
|
|
1930
|
+
grouping
|
|
1931
|
+
});
|
|
1932
|
+
const nonce = args.nonce ?? Date.now();
|
|
1933
|
+
const legs = [
|
|
1934
|
+
hyperliquidExchangeLeg({
|
|
1935
|
+
action: orderAction,
|
|
1936
|
+
nonce,
|
|
1937
|
+
chainId: args.chainId,
|
|
1938
|
+
audit: {
|
|
1939
|
+
protocol: "hyperliquid",
|
|
1940
|
+
action: hasFixedTpsl ? "limitOrderWithTpsl" : "limitOrderWithTrailingStop",
|
|
1941
|
+
coin: args.coin,
|
|
1942
|
+
marketKind,
|
|
1943
|
+
asset,
|
|
1944
|
+
isBuy: args.isBuy,
|
|
1945
|
+
limitPxHuman: args.limitPxHuman,
|
|
1724
1946
|
szHuman: args.szHuman,
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
tpslExecMode: args.tpslExecMode
|
|
1947
|
+
takeProfitTriggerPxHuman: tp ?? null,
|
|
1948
|
+
stopLossTriggerPxHuman: sl ?? null,
|
|
1949
|
+
tpslExecMode: hasFixedTpsl ? args.tpslExecMode ?? "limit_at_trigger" : null,
|
|
1950
|
+
grouping,
|
|
1951
|
+
trailingOffsetHuman: trailing?.offsetHuman ?? null,
|
|
1952
|
+
trailingOffsetType: trailing?.offsetType ?? null,
|
|
1953
|
+
trailingActivationPxHuman: trailing?.activationPxHuman ?? null
|
|
1954
|
+
}
|
|
1955
|
+
})
|
|
1956
|
+
];
|
|
1957
|
+
if (trailing) {
|
|
1958
|
+
const trailingAction = buildHyperliquidTrailingStopAction({
|
|
1959
|
+
asset,
|
|
1960
|
+
isBuy: !args.isBuy,
|
|
1961
|
+
szHuman: args.szHuman,
|
|
1962
|
+
reduceOnly: true,
|
|
1963
|
+
offsetType: trailing.offsetType,
|
|
1964
|
+
offsetHuman: trailing.offsetHuman,
|
|
1965
|
+
activationPxHuman: trailing.activationPxHuman
|
|
1966
|
+
});
|
|
1967
|
+
legs.push(
|
|
1968
|
+
hyperliquidExchangeLeg({
|
|
1969
|
+
action: trailingAction,
|
|
1970
|
+
nonce: nonce + 1,
|
|
1971
|
+
chainId: args.chainId,
|
|
1972
|
+
audit: {
|
|
1973
|
+
protocol: "hyperliquid",
|
|
1974
|
+
action: "trailingStop",
|
|
1975
|
+
coin: args.coin,
|
|
1976
|
+
marketKind,
|
|
1977
|
+
asset,
|
|
1978
|
+
isBuy: trailingAction.isBuy,
|
|
1979
|
+
szHuman: args.szHuman,
|
|
1980
|
+
reduceOnly: true,
|
|
1981
|
+
trailingOffsetHuman: trailing.offsetHuman,
|
|
1982
|
+
trailingOffsetType: trailing.offsetType,
|
|
1983
|
+
trailingActivationPxHuman: trailing.activationPxHuman ?? null
|
|
1984
|
+
}
|
|
1728
1985
|
})
|
|
1729
1986
|
);
|
|
1730
1987
|
}
|
|
1731
|
-
return
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
};
|
|
1988
|
+
return buildEip712Multisign({
|
|
1989
|
+
keyGen: args.keyGen,
|
|
1990
|
+
purposeText: args.purposeText,
|
|
1991
|
+
destinationChainID: String(args.chainId),
|
|
1992
|
+
destinationAddress: ZERO_ADDRESS,
|
|
1993
|
+
legs
|
|
1994
|
+
});
|
|
1739
1995
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1996
|
+
async function buildHyperliquidTrailingStopMultisign(args) {
|
|
1997
|
+
const trailing = parseHyperliquidTrailingStopParams({
|
|
1998
|
+
trailingOffsetHuman: args.trailingOffsetHuman,
|
|
1999
|
+
trailingOffsetType: args.trailingOffsetType,
|
|
2000
|
+
trailingActivationPxHuman: args.trailingActivationPxHuman
|
|
2001
|
+
});
|
|
2002
|
+
if (!trailing) {
|
|
2003
|
+
throw new Error("trailingOffsetHuman is required for a trailing stop.");
|
|
2004
|
+
}
|
|
1745
2005
|
const { asset } = await hyperliquidResolveAsset({
|
|
1746
2006
|
chainId: args.chainId,
|
|
1747
2007
|
coin: args.coin,
|
|
1748
|
-
marketKind,
|
|
2008
|
+
marketKind: "perp",
|
|
1749
2009
|
dex: args.dex
|
|
1750
2010
|
});
|
|
1751
|
-
const
|
|
1752
|
-
const sl = args.stopLossTriggerPxHuman?.trim();
|
|
1753
|
-
if (!tp && !sl) {
|
|
1754
|
-
throw new Error("At least one of takeProfitTriggerPxHuman or stopLossTriggerPxHuman is required for bracket orders.");
|
|
1755
|
-
}
|
|
1756
|
-
const orderWires = buildHyperliquidNormalTpslOrderWires({
|
|
2011
|
+
const action = buildHyperliquidTrailingStopAction({
|
|
1757
2012
|
asset,
|
|
1758
2013
|
isBuy: args.isBuy,
|
|
1759
|
-
limitPxHuman: args.limitPxHuman,
|
|
1760
2014
|
szHuman: args.szHuman,
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
});
|
|
1766
|
-
const action = buildHyperliquidOrderAction({
|
|
1767
|
-
orders: orderWires,
|
|
1768
|
-
grouping: "normalTpsl"
|
|
2015
|
+
reduceOnly: args.reduceOnly !== false,
|
|
2016
|
+
offsetType: trailing.offsetType,
|
|
2017
|
+
offsetHuman: trailing.offsetHuman,
|
|
2018
|
+
activationPxHuman: trailing.activationPxHuman
|
|
1769
2019
|
});
|
|
1770
2020
|
const nonce = args.nonce ?? Date.now();
|
|
1771
|
-
const isTestnet = args.chainId === 998;
|
|
1772
|
-
const typed = buildHyperliquidAgentTypedData({ action, nonce, isTestnet });
|
|
1773
2021
|
return buildEip712Multisign({
|
|
1774
2022
|
keyGen: args.keyGen,
|
|
1775
2023
|
purposeText: args.purposeText,
|
|
1776
2024
|
destinationChainID: String(args.chainId),
|
|
1777
2025
|
destinationAddress: ZERO_ADDRESS,
|
|
1778
2026
|
legs: [
|
|
1779
|
-
{
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
primaryType: typed.primaryType,
|
|
1784
|
-
message: typed.message
|
|
1785
|
-
},
|
|
1786
|
-
delivery: {
|
|
1787
|
-
kind: "hyperliquid_exchange",
|
|
1788
|
-
chainId: args.chainId,
|
|
1789
|
-
isTestnet,
|
|
1790
|
-
action,
|
|
1791
|
-
nonce
|
|
1792
|
-
},
|
|
2027
|
+
hyperliquidExchangeLeg({
|
|
2028
|
+
action,
|
|
2029
|
+
nonce,
|
|
2030
|
+
chainId: args.chainId,
|
|
1793
2031
|
audit: {
|
|
1794
2032
|
protocol: "hyperliquid",
|
|
1795
|
-
action: "
|
|
2033
|
+
action: "trailingStop",
|
|
1796
2034
|
coin: args.coin,
|
|
1797
|
-
marketKind,
|
|
2035
|
+
marketKind: "perp",
|
|
1798
2036
|
asset,
|
|
1799
|
-
isBuy:
|
|
1800
|
-
limitPxHuman: args.limitPxHuman,
|
|
2037
|
+
isBuy: action.isBuy,
|
|
1801
2038
|
szHuman: args.szHuman,
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
nonce,
|
|
1807
|
-
connectionId: typed.connectionId
|
|
2039
|
+
reduceOnly: action.reduceOnly,
|
|
2040
|
+
trailingOffsetHuman: trailing.offsetHuman,
|
|
2041
|
+
trailingOffsetType: trailing.offsetType,
|
|
2042
|
+
trailingActivationPxHuman: trailing.activationPxHuman ?? null
|
|
1808
2043
|
}
|
|
1809
|
-
}
|
|
2044
|
+
})
|
|
1810
2045
|
]
|
|
1811
2046
|
});
|
|
1812
2047
|
}
|
|
@@ -1915,7 +2150,9 @@ async function buildHyperliquidBorrowLendMultisign(args) {
|
|
|
1915
2150
|
|
|
1916
2151
|
// src/protocols/evm/hyperliquid/multisign.ts
|
|
1917
2152
|
function hasHyperliquidBracketTpsl(args) {
|
|
1918
|
-
return Boolean(
|
|
2153
|
+
return Boolean(
|
|
2154
|
+
args.takeProfitTriggerPxHuman?.trim() || args.stopLossTriggerPxHuman?.trim() || args.trailingOffsetHuman?.trim()
|
|
2155
|
+
);
|
|
1919
2156
|
}
|
|
1920
2157
|
async function buildCoreWriterMultisign(common, data, signatureMeta) {
|
|
1921
2158
|
const step = coreWriterStep(data);
|
|
@@ -1943,7 +2180,14 @@ async function buildCoreWriterMultisign(common, data, signatureMeta) {
|
|
|
1943
2180
|
async function buildEvmMultisignBodyHyperliquidLimitOrderBatch(args) {
|
|
1944
2181
|
if (hasHyperliquidBracketTpsl(args)) {
|
|
1945
2182
|
if (args.reduceOnly) {
|
|
1946
|
-
throw new Error("reduceOnly cannot be combined with takeProfitTriggerPxHuman or
|
|
2183
|
+
throw new Error("reduceOnly cannot be combined with takeProfitTriggerPxHuman, stopLossTriggerPxHuman, or a trailing stop.");
|
|
2184
|
+
}
|
|
2185
|
+
if (args.trailingOffsetHuman?.trim()) {
|
|
2186
|
+
parseHyperliquidTrailingStopParams({
|
|
2187
|
+
trailingOffsetHuman: args.trailingOffsetHuman,
|
|
2188
|
+
trailingOffsetType: args.trailingOffsetType,
|
|
2189
|
+
trailingActivationPxHuman: args.trailingActivationPxHuman
|
|
2190
|
+
});
|
|
1947
2191
|
}
|
|
1948
2192
|
return buildHyperliquidLimitOrderWithTpslMultisign({
|
|
1949
2193
|
keyGen: args.keyGen,
|
|
@@ -1958,7 +2202,10 @@ async function buildEvmMultisignBodyHyperliquidLimitOrderBatch(args) {
|
|
|
1958
2202
|
tif: args.tif,
|
|
1959
2203
|
takeProfitTriggerPxHuman: args.takeProfitTriggerPxHuman,
|
|
1960
2204
|
stopLossTriggerPxHuman: args.stopLossTriggerPxHuman,
|
|
1961
|
-
tpslExecMode: args.tpslExecMode
|
|
2205
|
+
tpslExecMode: args.tpslExecMode,
|
|
2206
|
+
trailingOffsetHuman: args.trailingOffsetHuman,
|
|
2207
|
+
trailingOffsetType: args.trailingOffsetType,
|
|
2208
|
+
trailingActivationPxHuman: args.trailingActivationPxHuman
|
|
1962
2209
|
});
|
|
1963
2210
|
}
|
|
1964
2211
|
const marketKind = args.marketKind ?? "perp";
|
|
@@ -2322,7 +2569,7 @@ function hyperliquidOrderClosesPosition(position, orderSide) {
|
|
|
2322
2569
|
return position.isLong ? side === "A" : side === "B";
|
|
2323
2570
|
}
|
|
2324
2571
|
function hyperliquidOrderCountsAsPendingClose(order) {
|
|
2325
|
-
return Boolean(order.reduceOnly) || Boolean(order.isTrigger);
|
|
2572
|
+
return Boolean(order.reduceOnly) || Boolean(order.isTrigger) || Boolean(order.trailingStop) || String(order.orderType ?? "").toLowerCase().includes("trailing");
|
|
2326
2573
|
}
|
|
2327
2574
|
function hyperliquidPendingCloseForPosition(args) {
|
|
2328
2575
|
const positionSize = parsePositiveSize(args.position.size);
|
|
@@ -2379,7 +2626,26 @@ var hyperliquidProtocolModule = {
|
|
|
2379
2626
|
dex: { type: "string", required: false, description: "HIP-3 dex name when applicable" },
|
|
2380
2627
|
takeProfitTriggerPxHuman: { type: "string", required: false, description: "TP trigger \u2014 enables L1 bracket with SL" },
|
|
2381
2628
|
stopLossTriggerPxHuman: { type: "string", required: false, description: "SL trigger \u2014 enables L1 bracket with TP" },
|
|
2382
|
-
tpslExecMode: { type: "string", required: false, description: "limit_at_trigger (default) or market" }
|
|
2629
|
+
tpslExecMode: { type: "string", required: false, description: "limit_at_trigger (default) or market" },
|
|
2630
|
+
trailingOffsetHuman: { type: "string", required: false, description: "Trailing retracement \u2014 EIP-712 trailingStop (cannot combine with SL)" },
|
|
2631
|
+
trailingOffsetType: { type: "string", required: false, description: "price or percentage" },
|
|
2632
|
+
trailingActivationPxHuman: { type: "string", required: false, description: "Optional activation mark price" }
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2635
|
+
{
|
|
2636
|
+
id: "hyperliquid.trailingStop",
|
|
2637
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
2638
|
+
chainCategory: "evm",
|
|
2639
|
+
description: "Place a Hyperliquid perp trailing stop via L1 trailingStop action (EIP-712 /exchange)",
|
|
2640
|
+
commonParams: ["keyGen", "purposeText"],
|
|
2641
|
+
params: {
|
|
2642
|
+
coin: { type: "string", required: true, description: "Perp coin" },
|
|
2643
|
+
isBuy: { type: "boolean", required: true, description: "false closes a long / opens a short" },
|
|
2644
|
+
szHuman: { type: "string", required: true, description: "Size in coin units" },
|
|
2645
|
+
trailingOffsetHuman: { type: "string", required: true, description: "Retracement distance or percent" },
|
|
2646
|
+
trailingOffsetType: { type: "string", required: false, description: "price or percentage (default)" },
|
|
2647
|
+
trailingActivationPxHuman: { type: "string", required: false, description: "Optional activation mark price" },
|
|
2648
|
+
reduceOnly: { type: "boolean", required: false, description: "true (default) reduces a position" }
|
|
2383
2649
|
}
|
|
2384
2650
|
},
|
|
2385
2651
|
{
|
|
@@ -2532,6 +2798,6 @@ var hyperliquidProtocolModule = {
|
|
|
2532
2798
|
};
|
|
2533
2799
|
registerProtocolModule(hyperliquidProtocolModule);
|
|
2534
2800
|
|
|
2535
|
-
export { HYPERLIQUID_BRIDGE_ARBITRUM_MAINNET_CHAIN_ID, HYPERLIQUID_BRIDGE_ARBITRUM_TESTNET_CHAIN_ID, HYPERLIQUID_BRIDGE_ERC20_TRANSFER_FALLBACK_GAS, HYPERLIQUID_BRIDGE_MIN_DEPOSIT_USDC, HYPERLIQUID_CORE_WRITER_ADDRESS, HYPERLIQUID_CORE_WRITER_GAS_FALLBACK, HYPERLIQUID_DEFAULT_CANDLE_LIMIT, HYPERLIQUID_DEFAULT_LOOKBACK_DAYS, HYPERLIQUID_DEFAULT_OHLCV_INTERVAL, HYPERLIQUID_HLP_VAULT_ADDRESS, HYPERLIQUID_HYPEREVM_USDC_MAINNET, HYPERLIQUID_HYPEREVM_USDC_TESTNET, HYPERLIQUID_INTERVAL_MS, HYPERLIQUID_MAX_CANDLE_LIMIT, HYPERLIQUID_MAX_LOOKBACK_DAYS, HYPERLIQUID_MAX_OHLCV_BARS, HYPERLIQUID_PROTOCOL_ID, HYPERLIQUID_SPOT_ASSET_OFFSET, HYPERLIQUID_SUPPORTED_CHAIN_IDS, HYPERLIQUID_TIF, HYPERLIQUID_USER_SIGNED_DOMAIN, HYPERLIQUID_USER_SIGNED_SIGNATURE_CHAIN_ID, HYPERLIQUID_WITHDRAW_SIGN_TYPES, buildCoreWriterCancelByCloidCalldata, buildCoreWriterCancelByOidCalldata, buildCoreWriterLimitOrderCalldata, buildCoreWriterStakingDepositCalldata, buildCoreWriterStakingWithdrawCalldata, buildCoreWriterTokenDelegateCalldata, buildCoreWriterUsdClassTransferCalldata, buildCoreWriterVaultTransferCalldata, buildEvmMultisignBodyHyperliquidBridgeDepositBatch, buildEvmMultisignBodyHyperliquidCancelBatch, buildEvmMultisignBodyHyperliquidCloseBatch, buildEvmMultisignBodyHyperliquidDelegateBatch, buildEvmMultisignBodyHyperliquidDelegateOnlyBatch, buildEvmMultisignBodyHyperliquidLimitOrderBatch, buildEvmMultisignBodyHyperliquidStakeDepositBatch, buildEvmMultisignBodyHyperliquidStakeWithdrawBatch, buildEvmMultisignBodyHyperliquidUndelegateBatch, buildEvmMultisignBodyHyperliquidUsdClassTransferBatch, buildEvmMultisignBodyHyperliquidVaultDepositBatch, buildEvmMultisignBodyHyperliquidVaultWithdrawBatch, buildHyperliquidAgentTypedData, buildHyperliquidBorrowLendAction, buildHyperliquidBorrowLendMultisign, buildHyperliquidBridgeWithdrawMultisign, buildHyperliquidLimitOrderWire, buildHyperliquidLimitOrderWithTpslMultisign, buildHyperliquidNormalTpslOrderWires, buildHyperliquidOrderAction, buildHyperliquidTriggerOrderWire, buildHyperliquidUpdateLeverageAction, buildHyperliquidUpdateLeverageMultisign, buildHyperliquidWithdraw3Action, buildHyperliquidWithdraw3TypedData, coreWriterStep, createHyperliquidL1ActionHash, hyperliquidApiBaseUrl, hyperliquidBridgeArbitrumChainId, hyperliquidBridgeConfig, hyperliquidCanonicalLendCoin, hyperliquidCollectAllPerpMarkets, hyperliquidCollectHip3StockMarkets, hyperliquidCollectNativePerpMarkets, hyperliquidEncodePx8, hyperliquidEncodeUsd6, hyperliquidEncodeWei8, hyperliquidFetchActiveAssetData, hyperliquidFetchAllBorrowLendReserveStates, hyperliquidFetchAllMids, hyperliquidFetchBorrowLendReserveState, hyperliquidFetchBorrowLendUserState, hyperliquidFetchCandles, hyperliquidFetchClearinghouseState, hyperliquidFetchDelegations, hyperliquidFetchDelegationsForExecutor, hyperliquidFetchDexList, hyperliquidFetchFrontendOpenOrders, hyperliquidFetchLendMarketsSummary, hyperliquidFetchLendPositionsSummary, hyperliquidFetchMarketSnapshot, hyperliquidFetchMarketSnapshotSummary, hyperliquidFetchMarketsSummary, hyperliquidFetchOhlcvRange, hyperliquidFetchOhlcvSummary, hyperliquidFetchOpenContextSummary, hyperliquidFetchOpenMarketContext, hyperliquidFetchOpenOrders, hyperliquidFetchOpenOrdersSummary, hyperliquidFetchOrdersForExecutor, hyperliquidFetchPerpAssetContext, hyperliquidFetchPerpConciseAnnotations, hyperliquidFetchPerpMeta, hyperliquidFetchPositionDisplayRows, hyperliquidFetchPositionsForExecutor, hyperliquidFetchSpotClearinghouseState, hyperliquidFetchSpotMeta, hyperliquidFetchSpotTokens, hyperliquidFetchStakingSummary, hyperliquidFetchStakingSummaryForExecutor, hyperliquidFetchStockMarketsSummary, hyperliquidFetchUsdClassBalances, hyperliquidFetchUsdClassBalancesSummary, hyperliquidFetchUserAbstraction, hyperliquidFetchUserVaultEquities, hyperliquidFetchUserVaultEquitiesSummary, hyperliquidFetchVaultApysSummary, hyperliquidFetchVaultCatalogSummary, hyperliquidFetchVaultSummaries, hyperliquidFloatToWire, hyperliquidInferDexFromCoin, hyperliquidIsSpotAssetId, hyperliquidL1TifFromKey, hyperliquidLendRoleFromLtv, hyperliquidManualBorrowEnabled, hyperliquidMarketSymbol, hyperliquidOrderClosesPosition, hyperliquidOrderCountsAsPendingClose, hyperliquidPendingCloseByCoin, hyperliquidPendingCloseForPosition, hyperliquidProtocolModule, hyperliquidResolveAsset, hyperliquidResolveLendTokenForChain, hyperliquidResolveOhlcvWindow, hyperliquidResolvePerpAsset, hyperliquidResolvePerpMarket, hyperliquidResolveSpotAsset, hyperliquidResolveSpotToken, hyperliquidResolveTif, hyperliquidSearchMarkets, hyperliquidSearchMarketsSummary, hyperliquidVaultStatsUrl, isHyperliquidBridgeArbitrumChainSupported, isHyperliquidBridgeArbitrumUsdcRow, isHyperliquidChainSupported, isHyperliquidHyperEvmUsdcRow, mapHyperliquidLendMarketRows, parseHyperliquidBorrowLendAmount, parseHyperliquidBorrowLendReserveTuples, parseHyperliquidBorrowLendUserState, validateHyperliquidTpslGeometry };
|
|
2801
|
+
export { HYPERLIQUID_BRIDGE_ARBITRUM_MAINNET_CHAIN_ID, HYPERLIQUID_BRIDGE_ARBITRUM_TESTNET_CHAIN_ID, HYPERLIQUID_BRIDGE_ERC20_TRANSFER_FALLBACK_GAS, HYPERLIQUID_BRIDGE_MIN_DEPOSIT_USDC, HYPERLIQUID_CORE_WRITER_ADDRESS, HYPERLIQUID_CORE_WRITER_GAS_FALLBACK, HYPERLIQUID_DEFAULT_CANDLE_LIMIT, HYPERLIQUID_DEFAULT_LOOKBACK_DAYS, HYPERLIQUID_DEFAULT_OHLCV_INTERVAL, HYPERLIQUID_HLP_VAULT_ADDRESS, HYPERLIQUID_HYPEREVM_USDC_MAINNET, HYPERLIQUID_HYPEREVM_USDC_TESTNET, HYPERLIQUID_INTERVAL_MS, HYPERLIQUID_MAX_CANDLE_LIMIT, HYPERLIQUID_MAX_LOOKBACK_DAYS, HYPERLIQUID_MAX_OHLCV_BARS, HYPERLIQUID_PROTOCOL_ID, HYPERLIQUID_SPOT_ASSET_OFFSET, HYPERLIQUID_SUPPORTED_CHAIN_IDS, HYPERLIQUID_TIF, HYPERLIQUID_TRAILING_ACTIVATION_PX_ERROR, HYPERLIQUID_USER_SIGNED_DOMAIN, HYPERLIQUID_USER_SIGNED_SIGNATURE_CHAIN_ID, HYPERLIQUID_WITHDRAW_SIGN_TYPES, buildCoreWriterCancelByCloidCalldata, buildCoreWriterCancelByOidCalldata, buildCoreWriterLimitOrderCalldata, buildCoreWriterStakingDepositCalldata, buildCoreWriterStakingWithdrawCalldata, buildCoreWriterTokenDelegateCalldata, buildCoreWriterUsdClassTransferCalldata, buildCoreWriterVaultTransferCalldata, buildEvmMultisignBodyHyperliquidBridgeDepositBatch, buildEvmMultisignBodyHyperliquidCancelBatch, buildEvmMultisignBodyHyperliquidCloseBatch, buildEvmMultisignBodyHyperliquidDelegateBatch, buildEvmMultisignBodyHyperliquidDelegateOnlyBatch, buildEvmMultisignBodyHyperliquidLimitOrderBatch, buildEvmMultisignBodyHyperliquidStakeDepositBatch, buildEvmMultisignBodyHyperliquidStakeWithdrawBatch, buildEvmMultisignBodyHyperliquidUndelegateBatch, buildEvmMultisignBodyHyperliquidUsdClassTransferBatch, buildEvmMultisignBodyHyperliquidVaultDepositBatch, buildEvmMultisignBodyHyperliquidVaultWithdrawBatch, buildHyperliquidAgentTypedData, buildHyperliquidBorrowLendAction, buildHyperliquidBorrowLendMultisign, buildHyperliquidBridgeWithdrawMultisign, buildHyperliquidLimitOrderWire, buildHyperliquidLimitOrderWithTpslMultisign, buildHyperliquidNormalTpslOrderWires, buildHyperliquidOrderAction, buildHyperliquidTrailingRetracement, buildHyperliquidTrailingStopAction, buildHyperliquidTrailingStopMultisign, buildHyperliquidTriggerOrderWire, buildHyperliquidUpdateLeverageAction, buildHyperliquidUpdateLeverageMultisign, buildHyperliquidWithdraw3Action, buildHyperliquidWithdraw3TypedData, coreWriterStep, createHyperliquidL1ActionHash, enrichHyperliquidFrontendOpenOrder, hyperliquidApiBaseUrl, hyperliquidBridgeArbitrumChainId, hyperliquidBridgeConfig, hyperliquidCanonicalLendCoin, hyperliquidCollectAllPerpMarkets, hyperliquidCollectHip3StockMarkets, hyperliquidCollectNativePerpMarkets, hyperliquidEncodePx8, hyperliquidEncodeUsd6, hyperliquidEncodeWei8, hyperliquidFetchActiveAssetData, hyperliquidFetchAllBorrowLendReserveStates, hyperliquidFetchAllMids, hyperliquidFetchBorrowLendReserveState, hyperliquidFetchBorrowLendUserState, hyperliquidFetchCandles, hyperliquidFetchClearinghouseState, hyperliquidFetchDelegations, hyperliquidFetchDelegationsForExecutor, hyperliquidFetchDexList, hyperliquidFetchFrontendOpenOrders, hyperliquidFetchLendMarketsSummary, hyperliquidFetchLendPositionsSummary, hyperliquidFetchMarketSnapshot, hyperliquidFetchMarketSnapshotSummary, hyperliquidFetchMarketsSummary, hyperliquidFetchOhlcvRange, hyperliquidFetchOhlcvSummary, hyperliquidFetchOpenContextSummary, hyperliquidFetchOpenMarketContext, hyperliquidFetchOpenOrders, hyperliquidFetchOpenOrdersSummary, hyperliquidFetchOrdersForExecutor, hyperliquidFetchPerpAssetContext, hyperliquidFetchPerpConciseAnnotations, hyperliquidFetchPerpMeta, hyperliquidFetchPositionDisplayRows, hyperliquidFetchPositionsForExecutor, hyperliquidFetchSpotClearinghouseState, hyperliquidFetchSpotMeta, hyperliquidFetchSpotTokens, hyperliquidFetchStakingSummary, hyperliquidFetchStakingSummaryForExecutor, hyperliquidFetchStockMarketsSummary, hyperliquidFetchUsdClassBalances, hyperliquidFetchUsdClassBalancesSummary, hyperliquidFetchUserAbstraction, hyperliquidFetchUserVaultEquities, hyperliquidFetchUserVaultEquitiesSummary, hyperliquidFetchVaultApysSummary, hyperliquidFetchVaultCatalogSummary, hyperliquidFetchVaultSummaries, hyperliquidFloatToWire, hyperliquidInferDexFromCoin, hyperliquidIsSpotAssetId, hyperliquidL1TifFromKey, hyperliquidLendRoleFromLtv, hyperliquidManualBorrowEnabled, hyperliquidMarketSymbol, hyperliquidOrderClosesPosition, hyperliquidOrderCountsAsPendingClose, hyperliquidPendingCloseByCoin, hyperliquidPendingCloseForPosition, hyperliquidProtocolModule, hyperliquidResolveAsset, hyperliquidResolveLendTokenForChain, hyperliquidResolveOhlcvWindow, hyperliquidResolvePerpAsset, hyperliquidResolvePerpMarket, hyperliquidResolveSpotAsset, hyperliquidResolveSpotToken, hyperliquidResolveTif, hyperliquidSearchMarkets, hyperliquidSearchMarketsSummary, hyperliquidTrailingPercentToWire, hyperliquidVaultStatsUrl, isHyperliquidBridgeArbitrumChainSupported, isHyperliquidBridgeArbitrumUsdcRow, isHyperliquidChainSupported, isHyperliquidHyperEvmUsdcRow, isHyperliquidTrailingActivationPxHuman, mapHyperliquidLendMarketRows, parseHyperliquidBorrowLendAmount, parseHyperliquidBorrowLendReserveTuples, parseHyperliquidBorrowLendUserState, parseHyperliquidTrailingActivationPx, parseHyperliquidTrailingOffsetType, parseHyperliquidTrailingStopParams, parseHyperliquidTrailingTriggerCondition, validateHyperliquidTpslGeometry, validateHyperliquidTrailingStopParams };
|
|
2536
2802
|
//# sourceMappingURL=index.js.map
|
|
2537
2803
|
//# sourceMappingURL=index.js.map
|