@continuumdao/ctm-mpc-defi 0.2.7 → 0.2.9
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 +754 -104
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +693 -5
- package/dist/agent/catalog.js +721 -104
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/_shared/multisign-mcp-gas.md +20 -0
- package/dist/agent/skills/aave-v4/SKILL.md +0 -7
- package/dist/agent/skills/curve-dao/SKILL.md +0 -7
- package/dist/agent/skills/ethena/SKILL.md +1 -1
- package/dist/agent/skills/euler-v2/SKILL.md +1 -1
- package/dist/agent/skills/gmx/SKILL.md +29 -2
- package/dist/agent/skills/hyperliquid/SKILL.md +177 -0
- package/dist/agent/skills/lido/SKILL.md +1 -1
- package/dist/agent/skills/maple-syrup/SKILL.md +1 -1
- package/dist/agent/skills/sky/SKILL.md +1 -1
- package/dist/agent/skills/uniswap-v4/SKILL.md +0 -7
- package/dist/protocols/evm/hyperliquid/index.cjs +1177 -0
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -0
- package/dist/protocols/evm/hyperliquid/index.d.ts +515 -0
- package/dist/protocols/evm/hyperliquid/index.js +1109 -0
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,1109 @@
|
|
|
1
|
+
import { parseAbi, encodeAbiParameters, getAddress, encodeFunctionData, defineChain, createPublicClient, http, parseGwei, serializeTransaction, keccak256 } from 'viem';
|
|
2
|
+
import { fetchChainFeeParams, gasLimitFromEstimateAndChainConfig, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk';
|
|
3
|
+
|
|
4
|
+
// src/core/registry.ts
|
|
5
|
+
var modules = [];
|
|
6
|
+
function registerProtocolModule(mod) {
|
|
7
|
+
const existing = modules.findIndex((m) => m.id === mod.id);
|
|
8
|
+
if (existing >= 0) {
|
|
9
|
+
modules[existing] = mod;
|
|
10
|
+
} else {
|
|
11
|
+
modules.push(mod);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/protocols/evm/hyperliquid/support.ts
|
|
16
|
+
var HYPERLIQUID_SUPPORTED_CHAIN_IDS = [999, 998];
|
|
17
|
+
function isHyperliquidChainSupported(chainId) {
|
|
18
|
+
return HYPERLIQUID_SUPPORTED_CHAIN_IDS.includes(chainId);
|
|
19
|
+
}
|
|
20
|
+
function hyperliquidApiBaseUrl(chainId) {
|
|
21
|
+
return chainId === 998 ? "https://api.hyperliquid-testnet.xyz" : "https://api.hyperliquid.xyz";
|
|
22
|
+
}
|
|
23
|
+
function hyperliquidVaultStatsUrl(chainId) {
|
|
24
|
+
return chainId === 998 ? null : "https://stats-data.hyperliquid.xyz/Mainnet/vaults";
|
|
25
|
+
}
|
|
26
|
+
var HYPERLIQUID_HLP_VAULT_ADDRESS = "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303";
|
|
27
|
+
|
|
28
|
+
// src/protocols/evm/hyperliquid/constants.ts
|
|
29
|
+
var HYPERLIQUID_CORE_WRITER_ADDRESS = "0x3333333333333333333333333333333333333333";
|
|
30
|
+
var HYPERLIQUID_SPOT_ASSET_OFFSET = 1e4;
|
|
31
|
+
var HYPERLIQUID_CORE_WRITER_GAS_FALLBACK = 120000n;
|
|
32
|
+
var HYPERLIQUID_TIF = {
|
|
33
|
+
alo: 1,
|
|
34
|
+
gtc: 2,
|
|
35
|
+
ioc: 3
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/protocols/evm/hyperliquid/api.ts
|
|
39
|
+
async function hyperliquidInfoPost(chainId, body) {
|
|
40
|
+
const base = hyperliquidApiBaseUrl(chainId);
|
|
41
|
+
const res = await fetch(`${base}/info`, {
|
|
42
|
+
method: "POST",
|
|
43
|
+
headers: { "Content-Type": "application/json" },
|
|
44
|
+
body: JSON.stringify(body),
|
|
45
|
+
cache: "no-store"
|
|
46
|
+
});
|
|
47
|
+
if (!res.ok) {
|
|
48
|
+
const text = await res.text().catch(() => "");
|
|
49
|
+
throw new Error(`Hyperliquid info API failed (${res.status}): ${text.slice(0, 200)}`);
|
|
50
|
+
}
|
|
51
|
+
return await res.json();
|
|
52
|
+
}
|
|
53
|
+
async function hyperliquidFetchPerpMeta(args) {
|
|
54
|
+
const req = { type: "meta" };
|
|
55
|
+
if (args.dex?.trim()) req.dex = args.dex.trim();
|
|
56
|
+
const meta = await hyperliquidInfoPost(args.chainId, req);
|
|
57
|
+
const markets = (meta.universe ?? []).map((u, i) => ({
|
|
58
|
+
name: u.name,
|
|
59
|
+
asset: i,
|
|
60
|
+
szDecimals: u.szDecimals,
|
|
61
|
+
maxLeverage: u.maxLeverage,
|
|
62
|
+
onlyIsolated: u.onlyIsolated
|
|
63
|
+
}));
|
|
64
|
+
return { markets };
|
|
65
|
+
}
|
|
66
|
+
async function hyperliquidFetchSpotMeta(args) {
|
|
67
|
+
const meta = await hyperliquidInfoPost(args.chainId, { type: "spotMeta" });
|
|
68
|
+
const tokenByIndex = new Map((meta.tokens ?? []).map((t) => [t.index, t]));
|
|
69
|
+
const markets = (meta.universe ?? []).map((u, i) => {
|
|
70
|
+
const baseTokenIdx = u.tokens[0];
|
|
71
|
+
const token = baseTokenIdx != null ? tokenByIndex.get(baseTokenIdx) : void 0;
|
|
72
|
+
return {
|
|
73
|
+
name: u.name,
|
|
74
|
+
asset: 1e4 + i,
|
|
75
|
+
tokenIndex: i,
|
|
76
|
+
szDecimals: token?.szDecimals ?? 8
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
return { markets };
|
|
80
|
+
}
|
|
81
|
+
async function hyperliquidFetchAllMids(args) {
|
|
82
|
+
const req = { type: "allMids" };
|
|
83
|
+
if (args.dex?.trim()) req.dex = args.dex.trim();
|
|
84
|
+
const mids = await hyperliquidInfoPost(args.chainId, req);
|
|
85
|
+
return { mids };
|
|
86
|
+
}
|
|
87
|
+
async function hyperliquidFetchCandles(args) {
|
|
88
|
+
const endTime = args.endTimeMs ?? Date.now();
|
|
89
|
+
const startTime = args.startTimeMs ?? endTime - 7 * 24 * 60 * 60 * 1e3;
|
|
90
|
+
const raw = await hyperliquidInfoPost(args.chainId, {
|
|
91
|
+
type: "candleSnapshot",
|
|
92
|
+
req: {
|
|
93
|
+
coin: args.coin,
|
|
94
|
+
interval: args.interval,
|
|
95
|
+
startTime,
|
|
96
|
+
endTime
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const candles = (raw ?? []).map((c) => ({
|
|
100
|
+
timestampMs: c.t,
|
|
101
|
+
open: c.o,
|
|
102
|
+
high: c.h,
|
|
103
|
+
low: c.l,
|
|
104
|
+
close: c.c,
|
|
105
|
+
volume: c.v
|
|
106
|
+
}));
|
|
107
|
+
return { candles };
|
|
108
|
+
}
|
|
109
|
+
async function hyperliquidFetchMarketSnapshot(args) {
|
|
110
|
+
const interval = args.interval ?? "1h";
|
|
111
|
+
const [{ mids }, { candles }] = await Promise.all([
|
|
112
|
+
hyperliquidFetchAllMids({ chainId: args.chainId, dex: args.dex }),
|
|
113
|
+
hyperliquidFetchCandles({ chainId: args.chainId, coin: args.coin, interval })
|
|
114
|
+
]);
|
|
115
|
+
return {
|
|
116
|
+
coin: args.coin,
|
|
117
|
+
midUsd: mids[args.coin] ?? null,
|
|
118
|
+
fetchedAtMs: Date.now(),
|
|
119
|
+
interval,
|
|
120
|
+
candles
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async function hyperliquidFetchClearinghouseState(args) {
|
|
124
|
+
const req = { type: "clearinghouseState", user: args.user };
|
|
125
|
+
if (args.dex?.trim()) req.dex = args.dex.trim();
|
|
126
|
+
const state = await hyperliquidInfoPost(args.chainId, req);
|
|
127
|
+
return { state };
|
|
128
|
+
}
|
|
129
|
+
async function hyperliquidFetchSpotClearinghouseState(args) {
|
|
130
|
+
const state = await hyperliquidInfoPost(args.chainId, {
|
|
131
|
+
type: "spotClearinghouseState",
|
|
132
|
+
user: args.user
|
|
133
|
+
});
|
|
134
|
+
return { state };
|
|
135
|
+
}
|
|
136
|
+
function hyperliquidFmtLeverage(leverage) {
|
|
137
|
+
if (leverage?.value == null) return null;
|
|
138
|
+
const t = leverage.type === "isolated" ? "iso" : "cross";
|
|
139
|
+
return `${leverage.value}x ${t}`;
|
|
140
|
+
}
|
|
141
|
+
function hyperliquidPositiveSizeString(value) {
|
|
142
|
+
const n = Number.parseFloat(String(value ?? "0"));
|
|
143
|
+
if (!Number.isFinite(n) || n <= 0) return null;
|
|
144
|
+
return String(n);
|
|
145
|
+
}
|
|
146
|
+
async function hyperliquidFetchActiveAssetData(args) {
|
|
147
|
+
const raw = await hyperliquidInfoPost(args.chainId, {
|
|
148
|
+
type: "activeAssetData",
|
|
149
|
+
user: args.user,
|
|
150
|
+
coin: args.coin.trim()
|
|
151
|
+
});
|
|
152
|
+
const avail = raw.availableToTrade;
|
|
153
|
+
return {
|
|
154
|
+
activeAsset: {
|
|
155
|
+
markPx: raw.markPx?.trim() || null,
|
|
156
|
+
leverageLabel: hyperliquidFmtLeverage(raw.leverage),
|
|
157
|
+
availableToBuy: avail?.[0] != null ? hyperliquidPositiveSizeString(avail[0]) : null,
|
|
158
|
+
availableToSell: avail?.[1] != null ? hyperliquidPositiveSizeString(avail[1]) : null
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
async function hyperliquidFetchOpenOrders(args) {
|
|
163
|
+
const req = { type: "openOrders", user: args.user };
|
|
164
|
+
if (args.dex?.trim()) req.dex = args.dex.trim();
|
|
165
|
+
const orders = await hyperliquidInfoPost(args.chainId, req);
|
|
166
|
+
return { orders: orders ?? [] };
|
|
167
|
+
}
|
|
168
|
+
async function hyperliquidFetchUserVaultEquities(args) {
|
|
169
|
+
const rows = await hyperliquidInfoPost(args.chainId, {
|
|
170
|
+
type: "userVaultEquities",
|
|
171
|
+
user: args.user
|
|
172
|
+
});
|
|
173
|
+
return { rows: rows ?? [] };
|
|
174
|
+
}
|
|
175
|
+
var VAULT_CATALOG_MAX = 40;
|
|
176
|
+
var VAULT_MIN_TVL_USD = 1e3;
|
|
177
|
+
function vaultSummaryFromStatsRow(row) {
|
|
178
|
+
const summary = row.summary;
|
|
179
|
+
if (!summary?.vaultAddress?.trim() || !summary.name?.trim() || summary.isClosed) return null;
|
|
180
|
+
const tvl = Number.parseFloat(summary.tvl ?? "");
|
|
181
|
+
if (!Number.isFinite(tvl) || tvl < VAULT_MIN_TVL_USD) return null;
|
|
182
|
+
return {
|
|
183
|
+
vaultAddress: summary.vaultAddress,
|
|
184
|
+
name: summary.name.trim(),
|
|
185
|
+
apr: typeof row.apr === "number" && Number.isFinite(row.apr) ? row.apr : null,
|
|
186
|
+
tvlUsd: summary.tvl ?? null
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function sortVaultCatalog(vaults) {
|
|
190
|
+
const hlp = HYPERLIQUID_HLP_VAULT_ADDRESS.toLowerCase();
|
|
191
|
+
return [...vaults].sort((a, b) => {
|
|
192
|
+
const aHlp = a.vaultAddress.toLowerCase() === hlp;
|
|
193
|
+
const bHlp = b.vaultAddress.toLowerCase() === hlp;
|
|
194
|
+
if (aHlp && !bHlp) return -1;
|
|
195
|
+
if (bHlp && !aHlp) return 1;
|
|
196
|
+
return Number.parseFloat(b.tvlUsd ?? "0") - Number.parseFloat(a.tvlUsd ?? "0");
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
async function hyperliquidFetchVaultCatalogFromStats(chainId) {
|
|
200
|
+
const statsUrl = hyperliquidVaultStatsUrl(chainId);
|
|
201
|
+
if (!statsUrl) return [];
|
|
202
|
+
const res = await fetch(statsUrl, { cache: "no-store" });
|
|
203
|
+
if (!res.ok) {
|
|
204
|
+
const text = await res.text().catch(() => "");
|
|
205
|
+
throw new Error(`Hyperliquid vault stats failed (${res.status}): ${text.slice(0, 200)}`);
|
|
206
|
+
}
|
|
207
|
+
const raw = await res.json();
|
|
208
|
+
const byAddr = /* @__PURE__ */ new Map();
|
|
209
|
+
for (const row of raw ?? []) {
|
|
210
|
+
const vault = vaultSummaryFromStatsRow(row);
|
|
211
|
+
if (!vault) continue;
|
|
212
|
+
byAddr.set(vault.vaultAddress.toLowerCase(), vault);
|
|
213
|
+
}
|
|
214
|
+
return sortVaultCatalog([...byAddr.values()]).slice(0, VAULT_CATALOG_MAX);
|
|
215
|
+
}
|
|
216
|
+
async function hyperliquidFetchVaultDetails(args) {
|
|
217
|
+
const raw = await hyperliquidInfoPost(args.chainId, {
|
|
218
|
+
type: "vaultDetails",
|
|
219
|
+
vaultAddress: args.vaultAddress
|
|
220
|
+
});
|
|
221
|
+
if (!raw?.vaultAddress?.trim() || !raw.name?.trim() || raw.isClosed) return null;
|
|
222
|
+
return {
|
|
223
|
+
vaultAddress: raw.vaultAddress,
|
|
224
|
+
name: raw.name.trim(),
|
|
225
|
+
apr: typeof raw.apr === "number" && Number.isFinite(raw.apr) ? raw.apr : null,
|
|
226
|
+
tvlUsd: null
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
async function hyperliquidFetchVaultSummaries(args) {
|
|
230
|
+
const catalog = await hyperliquidFetchVaultCatalogFromStats(args.chainId);
|
|
231
|
+
const byAddr = new Map(catalog.map((v) => [v.vaultAddress.toLowerCase(), v]));
|
|
232
|
+
const executor = args.executorAddress?.trim().toLowerCase();
|
|
233
|
+
if (executor) {
|
|
234
|
+
const { rows } = await hyperliquidFetchUserVaultEquities({ chainId: args.chainId, user: executor });
|
|
235
|
+
const missing = rows.filter((r) => r.vaultAddress && !byAddr.has(r.vaultAddress.toLowerCase()));
|
|
236
|
+
const extras = await Promise.all(
|
|
237
|
+
missing.map(async (r) => hyperliquidFetchVaultDetails({ chainId: args.chainId, vaultAddress: r.vaultAddress }))
|
|
238
|
+
);
|
|
239
|
+
for (const vault of extras) {
|
|
240
|
+
if (vault) byAddr.set(vault.vaultAddress.toLowerCase(), vault);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return { vaults: sortVaultCatalog([...byAddr.values()]) };
|
|
244
|
+
}
|
|
245
|
+
async function hyperliquidFetchDexList(args) {
|
|
246
|
+
const raw = await hyperliquidInfoPost(args.chainId, {
|
|
247
|
+
type: "perpDexs"
|
|
248
|
+
});
|
|
249
|
+
if (!Array.isArray(raw)) return { dexes: [] };
|
|
250
|
+
const dexes = [];
|
|
251
|
+
for (const entry of raw) {
|
|
252
|
+
if (entry == null) continue;
|
|
253
|
+
if (typeof entry === "string") {
|
|
254
|
+
const name2 = entry.trim();
|
|
255
|
+
if (name2) dexes.push({ name: name2, fullName: name2 });
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const name = entry.name?.trim();
|
|
259
|
+
if (!name) continue;
|
|
260
|
+
const fullName = entry.fullName?.trim() || name;
|
|
261
|
+
dexes.push({ name, fullName });
|
|
262
|
+
}
|
|
263
|
+
return { dexes };
|
|
264
|
+
}
|
|
265
|
+
async function hyperliquidFetchDelegations(args) {
|
|
266
|
+
const raw = await hyperliquidInfoPost(args.chainId, {
|
|
267
|
+
type: "delegations",
|
|
268
|
+
user: args.user
|
|
269
|
+
});
|
|
270
|
+
return { delegations: raw ?? [] };
|
|
271
|
+
}
|
|
272
|
+
async function hyperliquidFetchStakingSummary(args) {
|
|
273
|
+
const raw = await hyperliquidInfoPost(args.chainId, {
|
|
274
|
+
type: "delegatorSummary",
|
|
275
|
+
user: args.user
|
|
276
|
+
});
|
|
277
|
+
return { delegated: raw?.delegated ?? "0", undelegated: raw?.undelegated ?? "0" };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/protocols/evm/hyperliquid/assets.ts
|
|
281
|
+
async function hyperliquidResolvePerpAsset(args) {
|
|
282
|
+
const coin = args.coin.trim();
|
|
283
|
+
const { markets } = await hyperliquidFetchPerpMeta({ chainId: args.chainId, dex: args.dex });
|
|
284
|
+
const hit = markets.find((m) => m.name.toLowerCase() === coin.toLowerCase());
|
|
285
|
+
if (!hit) throw new Error(`Unknown Hyperliquid perp market: ${coin}`);
|
|
286
|
+
return { asset: hit.asset, szDecimals: hit.szDecimals, maxLeverage: hit.maxLeverage };
|
|
287
|
+
}
|
|
288
|
+
async function hyperliquidResolveSpotAsset(args) {
|
|
289
|
+
const coin = args.coin.trim();
|
|
290
|
+
const { markets } = await hyperliquidFetchSpotMeta({ chainId: args.chainId });
|
|
291
|
+
const hit = markets.find((m) => m.name.toLowerCase() === coin.toLowerCase());
|
|
292
|
+
if (!hit) throw new Error(`Unknown Hyperliquid spot market: ${coin}`);
|
|
293
|
+
return { asset: hit.asset, szDecimals: hit.szDecimals };
|
|
294
|
+
}
|
|
295
|
+
async function hyperliquidResolveAsset(args) {
|
|
296
|
+
if (args.marketKind === "spot") {
|
|
297
|
+
const r = await hyperliquidResolveSpotAsset({ chainId: args.chainId, coin: args.coin });
|
|
298
|
+
return r;
|
|
299
|
+
}
|
|
300
|
+
return hyperliquidResolvePerpAsset({ chainId: args.chainId, coin: args.coin, dex: args.dex });
|
|
301
|
+
}
|
|
302
|
+
function hyperliquidIsSpotAssetId(asset) {
|
|
303
|
+
return asset >= HYPERLIQUID_SPOT_ASSET_OFFSET;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// src/protocols/evm/hyperliquid/reads.ts
|
|
307
|
+
function hyperliquidUsdAmountString(value) {
|
|
308
|
+
const n = Number.parseFloat(String(value ?? "0"));
|
|
309
|
+
if (!Number.isFinite(n) || n <= 0) return "0";
|
|
310
|
+
return n.toFixed(6).replace(/\.?0+$/, "") || "0";
|
|
311
|
+
}
|
|
312
|
+
function hyperliquidSpotUsdcAvailable(balances) {
|
|
313
|
+
const usdc = balances.find((b) => b.coin === "USDC");
|
|
314
|
+
if (!usdc) return "0";
|
|
315
|
+
const total = Number.parseFloat(String(usdc.total ?? "0"));
|
|
316
|
+
const hold = Number.parseFloat(String(usdc.hold ?? "0"));
|
|
317
|
+
if (!Number.isFinite(total)) return "0";
|
|
318
|
+
const avail = Math.max(0, total - (Number.isFinite(hold) ? hold : 0));
|
|
319
|
+
return hyperliquidUsdAmountString(String(avail));
|
|
320
|
+
}
|
|
321
|
+
async function hyperliquidFetchUsdClassBalances(args) {
|
|
322
|
+
const user = args.executorAddress.trim().toLowerCase();
|
|
323
|
+
const [{ state: spotState }, { state: perpState }] = await Promise.all([
|
|
324
|
+
hyperliquidFetchSpotClearinghouseState({ chainId: args.chainId, user }),
|
|
325
|
+
hyperliquidFetchClearinghouseState({ chainId: args.chainId, user })
|
|
326
|
+
]);
|
|
327
|
+
return {
|
|
328
|
+
balances: {
|
|
329
|
+
spotUsdcAvailable: hyperliquidSpotUsdcAvailable(spotState.balances ?? []),
|
|
330
|
+
perpWithdrawable: hyperliquidUsdAmountString(perpState.withdrawable)
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function fmtLeverage(leverage) {
|
|
335
|
+
if (leverage?.value == null) return null;
|
|
336
|
+
const t = leverage.type === "isolated" ? "iso" : "cross";
|
|
337
|
+
return `${leverage.value}x ${t}`;
|
|
338
|
+
}
|
|
339
|
+
function mapPositionRow(p) {
|
|
340
|
+
if (!p.coin) return null;
|
|
341
|
+
const szi = Number.parseFloat(String(p.szi ?? "0"));
|
|
342
|
+
if (!Number.isFinite(szi) || szi === 0) return null;
|
|
343
|
+
return {
|
|
344
|
+
key: `${p.coin}:${szi > 0 ? "long" : "short"}`,
|
|
345
|
+
coin: p.coin,
|
|
346
|
+
isLong: szi > 0,
|
|
347
|
+
size: String(Math.abs(szi)),
|
|
348
|
+
entryPx: p.entryPx ?? null,
|
|
349
|
+
positionValueUsd: p.positionValue ?? null,
|
|
350
|
+
unrealizedPnlUsd: p.unrealizedPnl ?? null,
|
|
351
|
+
liquidationPx: p.liquidationPx ?? null,
|
|
352
|
+
leverageLabel: fmtLeverage(p.leverage),
|
|
353
|
+
maxLeverage: typeof p.maxLeverage === "number" && Number.isFinite(p.maxLeverage) ? p.maxLeverage : null,
|
|
354
|
+
marginUsedUsd: p.marginUsed ?? null,
|
|
355
|
+
returnOnEquity: p.returnOnEquity ?? null
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
async function hyperliquidFetchOpenMarketContext(args) {
|
|
359
|
+
const user = args.executorAddress.trim().toLowerCase();
|
|
360
|
+
const coin = args.coin.trim();
|
|
361
|
+
const [{ activeAsset }, { state }] = await Promise.all([
|
|
362
|
+
hyperliquidFetchActiveAssetData({ chainId: args.chainId, user, coin }),
|
|
363
|
+
hyperliquidFetchClearinghouseState({ chainId: args.chainId, user, dex: args.dex })
|
|
364
|
+
]);
|
|
365
|
+
return {
|
|
366
|
+
context: {
|
|
367
|
+
activeAsset,
|
|
368
|
+
account: {
|
|
369
|
+
accountValueUsd: state.marginSummary?.accountValue ?? null,
|
|
370
|
+
totalMarginUsedUsd: state.marginSummary?.totalMarginUsed ?? null,
|
|
371
|
+
withdrawableUsd: state.withdrawable ?? null
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
async function hyperliquidFetchPositionDisplayRows(args) {
|
|
377
|
+
const user = args.executorAddress.trim().toLowerCase();
|
|
378
|
+
const { state } = await hyperliquidFetchClearinghouseState({
|
|
379
|
+
chainId: args.chainId,
|
|
380
|
+
user,
|
|
381
|
+
dex: args.dex
|
|
382
|
+
});
|
|
383
|
+
const rows = [];
|
|
384
|
+
for (const ap of state.assetPositions ?? []) {
|
|
385
|
+
const row = mapPositionRow(ap.position ?? {});
|
|
386
|
+
if (row) rows.push(row);
|
|
387
|
+
}
|
|
388
|
+
return { rows };
|
|
389
|
+
}
|
|
390
|
+
async function hyperliquidFetchOrdersForExecutor(args) {
|
|
391
|
+
return hyperliquidFetchOpenOrders({
|
|
392
|
+
chainId: args.chainId,
|
|
393
|
+
user: args.executorAddress.trim().toLowerCase(),
|
|
394
|
+
dex: args.dex
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
async function hyperliquidFetchMarketsSummary(args) {
|
|
398
|
+
const [{ markets }, { dexes }] = await Promise.all([
|
|
399
|
+
hyperliquidFetchPerpMeta({ chainId: args.chainId, dex: args.dex }),
|
|
400
|
+
hyperliquidFetchDexList({ chainId: args.chainId })
|
|
401
|
+
]);
|
|
402
|
+
return { markets, dexes };
|
|
403
|
+
}
|
|
404
|
+
async function hyperliquidFetchPositionsForExecutor(args) {
|
|
405
|
+
const { rows } = await hyperliquidFetchPositionDisplayRows(args);
|
|
406
|
+
return { positions: rows };
|
|
407
|
+
}
|
|
408
|
+
async function hyperliquidFetchOpenOrdersSummary(args) {
|
|
409
|
+
const { orders } = await hyperliquidFetchOrdersForExecutor(args);
|
|
410
|
+
return { orders };
|
|
411
|
+
}
|
|
412
|
+
async function hyperliquidFetchOpenContextSummary(args) {
|
|
413
|
+
const { context } = await hyperliquidFetchOpenMarketContext(args);
|
|
414
|
+
return { context };
|
|
415
|
+
}
|
|
416
|
+
async function hyperliquidFetchUsdClassBalancesSummary(args) {
|
|
417
|
+
const { balances } = await hyperliquidFetchUsdClassBalances(args);
|
|
418
|
+
return { balances };
|
|
419
|
+
}
|
|
420
|
+
async function hyperliquidFetchVaultCatalogSummary(args) {
|
|
421
|
+
const { vaults } = await hyperliquidFetchVaultSummaries({
|
|
422
|
+
chainId: args.chainId,
|
|
423
|
+
executorAddress: args.executorAddress
|
|
424
|
+
});
|
|
425
|
+
return { vaults };
|
|
426
|
+
}
|
|
427
|
+
async function hyperliquidFetchUserVaultEquitiesSummary(args) {
|
|
428
|
+
const { rows } = await hyperliquidFetchUserVaultEquities({
|
|
429
|
+
chainId: args.chainId,
|
|
430
|
+
user: args.executorAddress.trim().toLowerCase()
|
|
431
|
+
});
|
|
432
|
+
return { rows };
|
|
433
|
+
}
|
|
434
|
+
async function hyperliquidFetchStakingSummaryForExecutor(args) {
|
|
435
|
+
const summary = await hyperliquidFetchStakingSummary({
|
|
436
|
+
chainId: args.chainId,
|
|
437
|
+
user: args.executorAddress.trim().toLowerCase()
|
|
438
|
+
});
|
|
439
|
+
return { summary };
|
|
440
|
+
}
|
|
441
|
+
async function hyperliquidFetchDelegationsForExecutor(args) {
|
|
442
|
+
const { delegations } = await hyperliquidFetchDelegations({
|
|
443
|
+
chainId: args.chainId,
|
|
444
|
+
user: args.executorAddress.trim().toLowerCase()
|
|
445
|
+
});
|
|
446
|
+
return { delegations };
|
|
447
|
+
}
|
|
448
|
+
async function hyperliquidFetchMarketSnapshotSummary(args) {
|
|
449
|
+
const snapshot = await hyperliquidFetchMarketSnapshot(args);
|
|
450
|
+
return { snapshot };
|
|
451
|
+
}
|
|
452
|
+
var coreWriterAbi = parseAbi(["function sendRawAction(bytes data) external"]);
|
|
453
|
+
var ACTION_LIMIT_ORDER = 1;
|
|
454
|
+
var ACTION_VAULT_TRANSFER = 2;
|
|
455
|
+
var ACTION_TOKEN_DELEGATE = 3;
|
|
456
|
+
var ACTION_STAKING_DEPOSIT = 4;
|
|
457
|
+
var ACTION_STAKING_WITHDRAW = 5;
|
|
458
|
+
var ACTION_USD_CLASS_TRANSFER = 7;
|
|
459
|
+
var ACTION_CANCEL_BY_OID = 10;
|
|
460
|
+
var ACTION_CANCEL_BY_CLOID = 11;
|
|
461
|
+
function encodeActionHeader(actionId) {
|
|
462
|
+
const idHex = actionId.toString(16).padStart(6, "0");
|
|
463
|
+
return `0x01${idHex}`;
|
|
464
|
+
}
|
|
465
|
+
function encodeCoreWriterCalldata(actionId, paramsEncoded) {
|
|
466
|
+
const header = encodeActionHeader(actionId).slice(2);
|
|
467
|
+
const params = paramsEncoded.startsWith("0x") ? paramsEncoded.slice(2) : paramsEncoded;
|
|
468
|
+
const actionBytes = `0x${header}${params}`;
|
|
469
|
+
return encodeFunctionData({
|
|
470
|
+
abi: coreWriterAbi,
|
|
471
|
+
functionName: "sendRawAction",
|
|
472
|
+
args: [actionBytes]
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function hyperliquidEncodePx8(human) {
|
|
476
|
+
const n = typeof human === "number" ? human : Number.parseFloat(String(human).trim());
|
|
477
|
+
if (!Number.isFinite(n) || n < 0) throw new Error("Invalid price or size for Hyperliquid encoding.");
|
|
478
|
+
return BigInt(Math.round(n * 1e8));
|
|
479
|
+
}
|
|
480
|
+
function hyperliquidEncodeUsd6(human) {
|
|
481
|
+
const n = typeof human === "number" ? human : Number.parseFloat(String(human).trim());
|
|
482
|
+
if (!Number.isFinite(n) || n < 0) throw new Error("Invalid USD amount for Hyperliquid encoding.");
|
|
483
|
+
return BigInt(Math.round(n * 1e6));
|
|
484
|
+
}
|
|
485
|
+
function hyperliquidEncodeWei8(human) {
|
|
486
|
+
return hyperliquidEncodePx8(human);
|
|
487
|
+
}
|
|
488
|
+
function hyperliquidResolveTif(tif) {
|
|
489
|
+
const key = String(tif).trim().toLowerCase();
|
|
490
|
+
const v = HYPERLIQUID_TIF[key];
|
|
491
|
+
if (v == null) throw new Error(`Unknown time-in-force: ${tif}. Use alo, gtc, or ioc.`);
|
|
492
|
+
return v;
|
|
493
|
+
}
|
|
494
|
+
function buildCoreWriterLimitOrderCalldata(args) {
|
|
495
|
+
const params = encodeAbiParameters(
|
|
496
|
+
[
|
|
497
|
+
{ type: "uint32" },
|
|
498
|
+
{ type: "bool" },
|
|
499
|
+
{ type: "uint64" },
|
|
500
|
+
{ type: "uint64" },
|
|
501
|
+
{ type: "bool" },
|
|
502
|
+
{ type: "uint8" },
|
|
503
|
+
{ type: "uint128" }
|
|
504
|
+
],
|
|
505
|
+
[
|
|
506
|
+
args.asset,
|
|
507
|
+
args.isBuy,
|
|
508
|
+
hyperliquidEncodePx8(args.limitPxHuman),
|
|
509
|
+
hyperliquidEncodePx8(args.szHuman),
|
|
510
|
+
Boolean(args.reduceOnly),
|
|
511
|
+
hyperliquidResolveTif(args.tif ?? "gtc"),
|
|
512
|
+
args.cloid ?? 0n
|
|
513
|
+
]
|
|
514
|
+
);
|
|
515
|
+
return encodeCoreWriterCalldata(ACTION_LIMIT_ORDER, params);
|
|
516
|
+
}
|
|
517
|
+
function buildCoreWriterCancelByOidCalldata(args) {
|
|
518
|
+
const params = encodeAbiParameters(
|
|
519
|
+
[{ type: "uint32" }, { type: "uint64" }],
|
|
520
|
+
[args.asset, BigInt(args.oid)]
|
|
521
|
+
);
|
|
522
|
+
return encodeCoreWriterCalldata(ACTION_CANCEL_BY_OID, params);
|
|
523
|
+
}
|
|
524
|
+
function buildCoreWriterCancelByCloidCalldata(args) {
|
|
525
|
+
const params = encodeAbiParameters(
|
|
526
|
+
[{ type: "uint32" }, { type: "uint128" }],
|
|
527
|
+
[args.asset, args.cloid]
|
|
528
|
+
);
|
|
529
|
+
return encodeCoreWriterCalldata(ACTION_CANCEL_BY_CLOID, params);
|
|
530
|
+
}
|
|
531
|
+
function buildCoreWriterUsdClassTransferCalldata(args) {
|
|
532
|
+
const params = encodeAbiParameters(
|
|
533
|
+
[{ type: "uint64" }, { type: "bool" }],
|
|
534
|
+
[hyperliquidEncodeUsd6(args.usdHuman), args.toPerp]
|
|
535
|
+
);
|
|
536
|
+
return encodeCoreWriterCalldata(ACTION_USD_CLASS_TRANSFER, params);
|
|
537
|
+
}
|
|
538
|
+
function buildCoreWriterVaultTransferCalldata(args) {
|
|
539
|
+
const params = encodeAbiParameters(
|
|
540
|
+
[{ type: "address" }, { type: "bool" }, { type: "uint64" }],
|
|
541
|
+
[args.vault, args.isDeposit, hyperliquidEncodeUsd6(args.usdHuman)]
|
|
542
|
+
);
|
|
543
|
+
return encodeCoreWriterCalldata(ACTION_VAULT_TRANSFER, params);
|
|
544
|
+
}
|
|
545
|
+
function buildCoreWriterStakingDepositCalldata(args) {
|
|
546
|
+
const params = encodeAbiParameters([{ type: "uint64" }], [hyperliquidEncodeWei8(args.hypeHuman)]);
|
|
547
|
+
return encodeCoreWriterCalldata(ACTION_STAKING_DEPOSIT, params);
|
|
548
|
+
}
|
|
549
|
+
function buildCoreWriterStakingWithdrawCalldata(args) {
|
|
550
|
+
const params = encodeAbiParameters([{ type: "uint64" }], [hyperliquidEncodeWei8(args.hypeHuman)]);
|
|
551
|
+
return encodeCoreWriterCalldata(ACTION_STAKING_WITHDRAW, params);
|
|
552
|
+
}
|
|
553
|
+
function buildCoreWriterTokenDelegateCalldata(args) {
|
|
554
|
+
const params = encodeAbiParameters(
|
|
555
|
+
[{ type: "address" }, { type: "uint64" }, { type: "bool" }],
|
|
556
|
+
[args.validator, hyperliquidEncodeWei8(args.hypeHuman), args.isUndelegate]
|
|
557
|
+
);
|
|
558
|
+
return encodeCoreWriterCalldata(ACTION_TOKEN_DELEGATE, params);
|
|
559
|
+
}
|
|
560
|
+
function coreWriterStep(data) {
|
|
561
|
+
return {
|
|
562
|
+
to: HYPERLIQUID_CORE_WRITER_ADDRESS,
|
|
563
|
+
data,
|
|
564
|
+
value: 0n
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// src/core/purpose.ts
|
|
569
|
+
function mergePurposeText(purposeText, purposeSuffix) {
|
|
570
|
+
const t = purposeText.trim();
|
|
571
|
+
const suffix = (purposeSuffix ?? "").trim();
|
|
572
|
+
if (!suffix) return t;
|
|
573
|
+
return t ? `${t}
|
|
574
|
+
|
|
575
|
+
${suffix}` : suffix;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// src/core/envelope.ts
|
|
579
|
+
function finalizeMultisign(input) {
|
|
580
|
+
const { keyGen, destinationChainID, legs } = input;
|
|
581
|
+
if (legs.length === 0) {
|
|
582
|
+
throw new Error("finalizeMultisign requires at least one leg");
|
|
583
|
+
}
|
|
584
|
+
const ph = (keyGen.pubkeyhex ?? "").trim();
|
|
585
|
+
if (!ph) throw new Error("keyGen pubKey (pubkeyhex) is required");
|
|
586
|
+
const keyList = keyGen.keylist ?? [];
|
|
587
|
+
const clientId = getClientIdFromKeyGenResult(keyGen);
|
|
588
|
+
const first = legs[0];
|
|
589
|
+
const messageHashes = legs.map((l) => l.msgHash);
|
|
590
|
+
const messageRawBatch = legs.map((l) => l.msgRaw);
|
|
591
|
+
const batchMeta = legs.map((l) => ({
|
|
592
|
+
destinationAddress: l.destinationAddress,
|
|
593
|
+
signatureText: l.signatureText,
|
|
594
|
+
...l.audit
|
|
595
|
+
}));
|
|
596
|
+
const proposalTxParams = legs.map((l) => l.proposalTxParams).filter((p) => p != null && typeof p === "object");
|
|
597
|
+
const extraPayload = {
|
|
598
|
+
batchMeta,
|
|
599
|
+
...input.extraJSON ?? {}
|
|
600
|
+
};
|
|
601
|
+
const extraJSON = JSON.stringify(extraPayload);
|
|
602
|
+
const bodyForSign = {
|
|
603
|
+
keyList,
|
|
604
|
+
pubKey: ph,
|
|
605
|
+
msgHash: messageHashes[0],
|
|
606
|
+
msgRaw: first.msgRaw,
|
|
607
|
+
destinationChainID,
|
|
608
|
+
destinationAddress: input.destinationAddress ?? first.destinationAddress,
|
|
609
|
+
extraJSON,
|
|
610
|
+
signatureText: first.signatureText,
|
|
611
|
+
purpose: mergePurposeText(input.purposeText, input.purposeSuffix),
|
|
612
|
+
...first.feeSnapshot
|
|
613
|
+
};
|
|
614
|
+
if (legs.length > 1) {
|
|
615
|
+
bodyForSign.messageHashes = messageHashes;
|
|
616
|
+
bodyForSign.messageRawBatch = messageRawBatch;
|
|
617
|
+
}
|
|
618
|
+
if (proposalTxParams.length > 0) {
|
|
619
|
+
bodyForSign.proposalTxParams = proposalTxParams;
|
|
620
|
+
}
|
|
621
|
+
const valueWei = first.valueWei;
|
|
622
|
+
if (valueWei != null && valueWei > 0n) {
|
|
623
|
+
bodyForSign.value = valueWei.toString();
|
|
624
|
+
}
|
|
625
|
+
if (clientId) bodyForSign.clientId = clientId;
|
|
626
|
+
return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) };
|
|
627
|
+
}
|
|
628
|
+
function routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimit) {
|
|
629
|
+
if (chainGasLimit != null && Number.isFinite(chainGasLimit) && chainGasLimit > 0) {
|
|
630
|
+
return gasLimitFromEstimateAndChainConfig(estimatedGas, chainGasLimit);
|
|
631
|
+
}
|
|
632
|
+
return (estimatedGas * 12n + 9n) / 10n;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// src/chains/evm/buildBatch.ts
|
|
636
|
+
async function buildEvmMultisignBatch(args) {
|
|
637
|
+
const { context, steps } = args;
|
|
638
|
+
const {
|
|
639
|
+
chainId,
|
|
640
|
+
rpcUrl,
|
|
641
|
+
executorAddress,
|
|
642
|
+
chainDetail,
|
|
643
|
+
useCustomGas,
|
|
644
|
+
customGasChainDetails,
|
|
645
|
+
keyGen,
|
|
646
|
+
purposeText
|
|
647
|
+
} = context;
|
|
648
|
+
if (steps.length === 0) throw new Error("buildEvmMultisignBatch requires at least one step");
|
|
649
|
+
const ch = defineChain({
|
|
650
|
+
id: chainId,
|
|
651
|
+
name: "Destination",
|
|
652
|
+
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
653
|
+
rpcUrls: { default: { http: [rpcUrl] } }
|
|
654
|
+
});
|
|
655
|
+
const publicClient = createPublicClient({ chain: ch, transport: http(rpcUrl) });
|
|
656
|
+
const feeParams = await fetchChainFeeParams(rpcUrl, chainId);
|
|
657
|
+
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
658
|
+
const latestBaseFeeWei = !legacy ? (await publicClient.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
659
|
+
const gasLimitConfig = useCustomGas && chainDetail?.gasLimit != null ? Number(chainDetail.gasLimit) : void 0;
|
|
660
|
+
const chainGasLimitRouter = chainDetail?.gasLimit != null && Number.isFinite(Number(chainDetail.gasLimit)) && Number(chainDetail.gasLimit) > 0 ? Number(chainDetail.gasLimit) : void 0;
|
|
661
|
+
const gasFeeMultiplier = useCustomGas && chainDetail?.gasMultiplier != null ? Number(chainDetail.gasMultiplier) : void 0;
|
|
662
|
+
const executor = getAddress(executorAddress);
|
|
663
|
+
const baseNonce = await publicClient.getTransactionCount({ address: executor, blockTag: "pending" });
|
|
664
|
+
const legs = [];
|
|
665
|
+
for (let i = 0; i < steps.length; i++) {
|
|
666
|
+
const step = steps[i];
|
|
667
|
+
const currentNonce = baseNonce + i;
|
|
668
|
+
let estimatedGas;
|
|
669
|
+
if (args.estimateGasForStep) {
|
|
670
|
+
estimatedGas = await args.estimateGasForStep({ step, index: i, publicClient, executor });
|
|
671
|
+
} else {
|
|
672
|
+
try {
|
|
673
|
+
estimatedGas = await publicClient.estimateGas({
|
|
674
|
+
to: step.to,
|
|
675
|
+
data: step.data,
|
|
676
|
+
value: step.value,
|
|
677
|
+
account: executor
|
|
678
|
+
});
|
|
679
|
+
} catch {
|
|
680
|
+
estimatedGas = step.fallbackGas ?? 100000n;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
let gasLimitI;
|
|
684
|
+
if (args.resolveGasLimit) {
|
|
685
|
+
gasLimitI = await args.resolveGasLimit({ step, index: i, estimatedGas, publicClient });
|
|
686
|
+
} else if (step.routerSwap) {
|
|
687
|
+
gasLimitI = routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimitRouter);
|
|
688
|
+
} else {
|
|
689
|
+
gasLimitI = useCustomGas ? gasLimitFromEstimateAndChainConfig(estimatedGas, gasLimitConfig) : estimatedGas;
|
|
690
|
+
}
|
|
691
|
+
let proposalTxParams;
|
|
692
|
+
let feeSnapshot;
|
|
693
|
+
let serialized;
|
|
694
|
+
if (legacy) {
|
|
695
|
+
let gasPriceWei = await publicClient.getGasPrice();
|
|
696
|
+
if (useCustomGas && gasFeeMultiplier != null && gasFeeMultiplier > 0) {
|
|
697
|
+
gasPriceWei = gasPriceWei * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
698
|
+
}
|
|
699
|
+
if (useCustomGas && chainDetail?.gasPrice != null && chainDetail.gasPrice > 0) {
|
|
700
|
+
const configured = parseGwei(gweiToDecimalString(Number(chainDetail.gasPrice)));
|
|
701
|
+
if (configured > gasPriceWei) gasPriceWei = configured;
|
|
702
|
+
}
|
|
703
|
+
serialized = serializeTransaction({
|
|
704
|
+
type: "legacy",
|
|
705
|
+
to: step.to,
|
|
706
|
+
data: step.data,
|
|
707
|
+
value: step.value,
|
|
708
|
+
gas: gasLimitI,
|
|
709
|
+
gasPrice: gasPriceWei,
|
|
710
|
+
nonce: currentNonce,
|
|
711
|
+
chainId
|
|
712
|
+
});
|
|
713
|
+
proposalTxParams = {
|
|
714
|
+
nonce: currentNonce,
|
|
715
|
+
gasLimit: gasLimitI.toString(),
|
|
716
|
+
txType: "legacy",
|
|
717
|
+
gasPrice: gasPriceWei.toString()
|
|
718
|
+
};
|
|
719
|
+
feeSnapshot = proposalTxParamsToFeeSnapshot(proposalTxParams);
|
|
720
|
+
} else {
|
|
721
|
+
const fetchedBase = feeParams.baseFeeGwei ?? 0;
|
|
722
|
+
const fetchedPriority = feeParams.priorityFeeGwei ?? 0;
|
|
723
|
+
const configuredBase = useCustomGas && chainDetail?.baseFee != null ? Number(chainDetail.baseFee) : 0;
|
|
724
|
+
const configuredPriority = useCustomGas && chainDetail?.priorityFee != null ? Number(chainDetail.priorityFee) : 0;
|
|
725
|
+
const effectiveBaseFeeGwei = Math.max(fetchedBase, configuredBase);
|
|
726
|
+
const effectivePriorityFeeGwei = Math.max(fetchedPriority, configuredPriority);
|
|
727
|
+
const baseFeeMultiplierPct = useCustomGas && chainDetail?.baseFeeMultiplier != null ? Math.max(100, Number(chainDetail.baseFeeMultiplier)) : 100;
|
|
728
|
+
const baseComponentGwei = effectiveBaseFeeGwei * baseFeeMultiplierPct / 100;
|
|
729
|
+
const maxFeePerGasGwei = baseComponentGwei + effectivePriorityFeeGwei;
|
|
730
|
+
let maxPriorityFeePerGas = effectivePriorityFeeGwei > 0 ? parseGwei(gweiToDecimalString(effectivePriorityFeeGwei)) : parseGwei("1");
|
|
731
|
+
let maxFeePerGas = parseGwei(gweiToDecimalString(maxFeePerGasGwei));
|
|
732
|
+
if (useCustomGas && gasFeeMultiplier != null && gasFeeMultiplier > 0) {
|
|
733
|
+
maxPriorityFeePerGas = maxPriorityFeePerGas * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
734
|
+
maxFeePerGas = maxFeePerGas * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
735
|
+
}
|
|
736
|
+
({ maxFeePerGas, maxPriorityFeePerGas } = alignEip1559FeesWithLatestBase(
|
|
737
|
+
maxFeePerGas,
|
|
738
|
+
maxPriorityFeePerGas,
|
|
739
|
+
latestBaseFeeWei
|
|
740
|
+
));
|
|
741
|
+
serialized = serializeTransaction({
|
|
742
|
+
type: "eip1559",
|
|
743
|
+
to: step.to,
|
|
744
|
+
data: step.data,
|
|
745
|
+
value: step.value,
|
|
746
|
+
gas: gasLimitI,
|
|
747
|
+
maxFeePerGas,
|
|
748
|
+
maxPriorityFeePerGas,
|
|
749
|
+
nonce: currentNonce,
|
|
750
|
+
chainId
|
|
751
|
+
});
|
|
752
|
+
proposalTxParams = {
|
|
753
|
+
nonce: currentNonce,
|
|
754
|
+
gasLimit: gasLimitI.toString(),
|
|
755
|
+
txType: "eip1559",
|
|
756
|
+
maxFeePerGas: maxFeePerGas.toString(),
|
|
757
|
+
maxPriorityFeePerGas: maxPriorityFeePerGas.toString()
|
|
758
|
+
};
|
|
759
|
+
feeSnapshot = i === 0 ? proposalTxParamsToFeeSnapshot(proposalTxParams) : {};
|
|
760
|
+
}
|
|
761
|
+
const h = keccak256(serialized);
|
|
762
|
+
const msgHash = h.startsWith("0x") ? h.slice(2) : h;
|
|
763
|
+
const batchMetaExtra = args.buildBatchMeta({ step, index: i, gasLimit: gasLimitI });
|
|
764
|
+
legs.push({
|
|
765
|
+
msgHash,
|
|
766
|
+
msgRaw: i === 0 && args.firstMsgRawNo0x != null ? args.firstMsgRawNo0x : serialized,
|
|
767
|
+
destinationAddress: step.to,
|
|
768
|
+
signatureText: typeof batchMetaExtra.signatureText === "string" ? batchMetaExtra.signatureText : JSON.stringify(batchMetaExtra.signatureText ?? {}),
|
|
769
|
+
audit: batchMetaExtra,
|
|
770
|
+
feeSnapshot: i === 0 ? feeSnapshot : {},
|
|
771
|
+
proposalTxParams,
|
|
772
|
+
valueWei: i === 0 ? step.value : void 0
|
|
773
|
+
});
|
|
774
|
+
if (i === 0 && args.firstMsgRawNo0x != null) {
|
|
775
|
+
legs[0].msgRaw = args.firstMsgRawNo0x;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
const extraJSON = {};
|
|
779
|
+
if (useCustomGas && customGasChainDetails && Object.keys(customGasChainDetails).length > 0) {
|
|
780
|
+
extraJSON.customGasChainDetails = customGasChainDetails;
|
|
781
|
+
}
|
|
782
|
+
const result = finalizeMultisign({
|
|
783
|
+
keyGen,
|
|
784
|
+
purposeText,
|
|
785
|
+
purposeSuffix: args.purposeSuffix,
|
|
786
|
+
destinationChainID: String(chainId),
|
|
787
|
+
destinationAddress: args.destinationAddress ?? steps[0].to,
|
|
788
|
+
legs,
|
|
789
|
+
extraJSON: Object.keys(extraJSON).length > 0 ? extraJSON : void 0
|
|
790
|
+
});
|
|
791
|
+
const pv = args.payableValueWei;
|
|
792
|
+
if (pv != null && pv > 0n) {
|
|
793
|
+
result.bodyForSign.value = pv.toString();
|
|
794
|
+
}
|
|
795
|
+
return result;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// src/protocols/evm/hyperliquid/multisign.ts
|
|
799
|
+
async function buildCoreWriterMultisign(common, data, signatureMeta) {
|
|
800
|
+
const step = coreWriterStep(data);
|
|
801
|
+
return buildEvmMultisignBatch({
|
|
802
|
+
context: {
|
|
803
|
+
keyGen: common.keyGen,
|
|
804
|
+
chainCategory: "evm",
|
|
805
|
+
chainId: common.chainId,
|
|
806
|
+
rpcUrl: common.rpcUrl,
|
|
807
|
+
chainDetail: common.chainDetail,
|
|
808
|
+
useCustomGas: common.useCustomGas,
|
|
809
|
+
customGasChainDetails: common.customGasChainDetails ?? null,
|
|
810
|
+
executorAddress: getAddress(common.executorAddress),
|
|
811
|
+
purposeText: common.purposeText
|
|
812
|
+
},
|
|
813
|
+
steps: [{ ...step, fallbackGas: HYPERLIQUID_CORE_WRITER_GAS_FALLBACK }],
|
|
814
|
+
destinationAddress: step.to,
|
|
815
|
+
buildBatchMeta: () => ({
|
|
816
|
+
kind: "Hyperliquid",
|
|
817
|
+
...signatureMeta,
|
|
818
|
+
evm: { type: "hyperliquid_core_writer", version: 1, chainId: String(common.chainId) }
|
|
819
|
+
})
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
async function buildEvmMultisignBodyHyperliquidLimitOrderBatch(args) {
|
|
823
|
+
const marketKind = args.marketKind ?? "perp";
|
|
824
|
+
const { asset } = await hyperliquidResolveAsset({
|
|
825
|
+
chainId: args.chainId,
|
|
826
|
+
coin: args.coin,
|
|
827
|
+
marketKind,
|
|
828
|
+
dex: args.dex
|
|
829
|
+
});
|
|
830
|
+
const data = buildCoreWriterLimitOrderCalldata({
|
|
831
|
+
asset,
|
|
832
|
+
isBuy: args.isBuy,
|
|
833
|
+
limitPxHuman: args.limitPxHuman,
|
|
834
|
+
szHuman: args.szHuman,
|
|
835
|
+
reduceOnly: args.reduceOnly,
|
|
836
|
+
tif: args.tif
|
|
837
|
+
});
|
|
838
|
+
return buildCoreWriterMultisign(args, data, {
|
|
839
|
+
action: "limitOrder",
|
|
840
|
+
coin: args.coin,
|
|
841
|
+
marketKind,
|
|
842
|
+
isBuy: args.isBuy,
|
|
843
|
+
limitPxHuman: args.limitPxHuman,
|
|
844
|
+
szHuman: args.szHuman,
|
|
845
|
+
reduceOnly: Boolean(args.reduceOnly),
|
|
846
|
+
tif: args.tif ?? "gtc",
|
|
847
|
+
asset
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
async function buildEvmMultisignBodyHyperliquidCloseBatch(args) {
|
|
851
|
+
return buildEvmMultisignBodyHyperliquidLimitOrderBatch({
|
|
852
|
+
...args,
|
|
853
|
+
marketKind: "perp",
|
|
854
|
+
isBuy: !args.isLong,
|
|
855
|
+
reduceOnly: true,
|
|
856
|
+
tif: args.tif ?? "ioc"
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
async function buildEvmMultisignBodyHyperliquidCancelBatch(args) {
|
|
860
|
+
const marketKind = args.marketKind ?? "perp";
|
|
861
|
+
const { asset } = await hyperliquidResolveAsset({
|
|
862
|
+
chainId: args.chainId,
|
|
863
|
+
coin: args.coin,
|
|
864
|
+
marketKind,
|
|
865
|
+
dex: args.dex
|
|
866
|
+
});
|
|
867
|
+
const data = buildCoreWriterCancelByOidCalldata({ asset, oid: args.oid });
|
|
868
|
+
return buildCoreWriterMultisign(args, data, {
|
|
869
|
+
action: "cancelOrder",
|
|
870
|
+
coin: args.coin,
|
|
871
|
+
marketKind,
|
|
872
|
+
oid: args.oid,
|
|
873
|
+
asset
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
async function buildEvmMultisignBodyHyperliquidUsdClassTransferBatch(args) {
|
|
877
|
+
const data = buildCoreWriterUsdClassTransferCalldata({
|
|
878
|
+
usdHuman: args.usdHuman,
|
|
879
|
+
toPerp: args.toPerp
|
|
880
|
+
});
|
|
881
|
+
return buildCoreWriterMultisign(args, data, {
|
|
882
|
+
action: "usdClassTransfer",
|
|
883
|
+
usdHuman: args.usdHuman,
|
|
884
|
+
toPerp: args.toPerp
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
async function buildVaultMultisign(common, isDeposit) {
|
|
888
|
+
const vault = getAddress(common.vaultAddress);
|
|
889
|
+
const data = buildCoreWriterVaultTransferCalldata({
|
|
890
|
+
vault,
|
|
891
|
+
isDeposit,
|
|
892
|
+
usdHuman: common.usdHuman
|
|
893
|
+
});
|
|
894
|
+
const step = coreWriterStep(data);
|
|
895
|
+
return buildEvmMultisignBatch({
|
|
896
|
+
context: {
|
|
897
|
+
keyGen: common.keyGen,
|
|
898
|
+
chainCategory: "evm",
|
|
899
|
+
chainId: common.chainId,
|
|
900
|
+
rpcUrl: common.rpcUrl,
|
|
901
|
+
chainDetail: common.chainDetail,
|
|
902
|
+
useCustomGas: common.useCustomGas,
|
|
903
|
+
customGasChainDetails: common.customGasChainDetails ?? null,
|
|
904
|
+
executorAddress: getAddress(common.executorAddress),
|
|
905
|
+
purposeText: common.purposeText
|
|
906
|
+
},
|
|
907
|
+
steps: [{ ...step, fallbackGas: HYPERLIQUID_CORE_WRITER_GAS_FALLBACK }],
|
|
908
|
+
destinationAddress: step.to,
|
|
909
|
+
buildBatchMeta: () => ({
|
|
910
|
+
kind: "Hyperliquid",
|
|
911
|
+
action: isDeposit ? "vaultDeposit" : "vaultWithdraw",
|
|
912
|
+
vault,
|
|
913
|
+
usdHuman: common.usdHuman,
|
|
914
|
+
evm: { type: "hyperliquid_vault", version: 1, chainId: String(common.chainId) }
|
|
915
|
+
})
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
async function buildEvmMultisignBodyHyperliquidVaultDepositBatch(args) {
|
|
919
|
+
return buildVaultMultisign(args, true);
|
|
920
|
+
}
|
|
921
|
+
async function buildEvmMultisignBodyHyperliquidVaultWithdrawBatch(args) {
|
|
922
|
+
return buildVaultMultisign(args, false);
|
|
923
|
+
}
|
|
924
|
+
async function buildStakingMultisign(common, data, action, extra = {}) {
|
|
925
|
+
const step = coreWriterStep(data);
|
|
926
|
+
return buildEvmMultisignBatch({
|
|
927
|
+
context: {
|
|
928
|
+
keyGen: common.keyGen,
|
|
929
|
+
chainCategory: "evm",
|
|
930
|
+
chainId: common.chainId,
|
|
931
|
+
rpcUrl: common.rpcUrl,
|
|
932
|
+
chainDetail: common.chainDetail,
|
|
933
|
+
useCustomGas: common.useCustomGas,
|
|
934
|
+
customGasChainDetails: common.customGasChainDetails ?? null,
|
|
935
|
+
executorAddress: getAddress(common.executorAddress),
|
|
936
|
+
purposeText: common.purposeText
|
|
937
|
+
},
|
|
938
|
+
steps: [{ ...step, fallbackGas: HYPERLIQUID_CORE_WRITER_GAS_FALLBACK }],
|
|
939
|
+
destinationAddress: step.to,
|
|
940
|
+
buildBatchMeta: () => ({
|
|
941
|
+
kind: "Hyperliquid",
|
|
942
|
+
action,
|
|
943
|
+
hypeHuman: common.hypeHuman,
|
|
944
|
+
...extra,
|
|
945
|
+
evm: { type: "hyperliquid_staking", version: 1, chainId: String(common.chainId) }
|
|
946
|
+
})
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
async function buildEvmMultisignBodyHyperliquidStakeDepositBatch(args) {
|
|
950
|
+
const data = buildCoreWriterStakingDepositCalldata({ hypeHuman: args.hypeHuman });
|
|
951
|
+
return buildStakingMultisign(args, data, "stakingDeposit");
|
|
952
|
+
}
|
|
953
|
+
async function buildEvmMultisignBodyHyperliquidStakeWithdrawBatch(args) {
|
|
954
|
+
const data = buildCoreWriterStakingWithdrawCalldata({ hypeHuman: args.hypeHuman });
|
|
955
|
+
return buildStakingMultisign(args, data, "stakingWithdraw");
|
|
956
|
+
}
|
|
957
|
+
async function buildEvmMultisignBodyHyperliquidDelegateBatch(args) {
|
|
958
|
+
const validator = getAddress(args.validator);
|
|
959
|
+
const data = buildCoreWriterTokenDelegateCalldata({
|
|
960
|
+
validator,
|
|
961
|
+
hypeHuman: args.hypeHuman,
|
|
962
|
+
isUndelegate: args.isUndelegate
|
|
963
|
+
});
|
|
964
|
+
return buildStakingMultisign(args, data, args.isUndelegate ? "undelegate" : "delegate", { validator });
|
|
965
|
+
}
|
|
966
|
+
async function buildEvmMultisignBodyHyperliquidDelegateOnlyBatch(args) {
|
|
967
|
+
return buildEvmMultisignBodyHyperliquidDelegateBatch({ ...args, isUndelegate: false });
|
|
968
|
+
}
|
|
969
|
+
async function buildEvmMultisignBodyHyperliquidUndelegateBatch(args) {
|
|
970
|
+
return buildEvmMultisignBodyHyperliquidDelegateBatch({ ...args, isUndelegate: true });
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// src/protocols/evm/hyperliquid/index.ts
|
|
974
|
+
var HYPERLIQUID_PROTOCOL_ID = "hyperliquid";
|
|
975
|
+
var hyperliquidProtocolModule = {
|
|
976
|
+
id: HYPERLIQUID_PROTOCOL_ID,
|
|
977
|
+
chainCategory: "evm",
|
|
978
|
+
isChainSupported(ctx) {
|
|
979
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
980
|
+
const chainId = typeof ctx.chainId === "number" ? ctx.chainId : Number(ctx.chainId);
|
|
981
|
+
return Number.isFinite(chainId) && isHyperliquidChainSupported(chainId);
|
|
982
|
+
},
|
|
983
|
+
isTokenSupported(token) {
|
|
984
|
+
if (token.category !== "evm") return false;
|
|
985
|
+
return token.kind === "erc20" || token.kind === "native";
|
|
986
|
+
},
|
|
987
|
+
actions: [
|
|
988
|
+
{
|
|
989
|
+
id: "hyperliquid.limitOrder",
|
|
990
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
991
|
+
chainCategory: "evm",
|
|
992
|
+
description: "Place a Hyperliquid limit/IoC order via HyperEVM CoreWriter",
|
|
993
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
994
|
+
params: {
|
|
995
|
+
coin: { type: "string", required: true, description: "Market coin e.g. BTC" },
|
|
996
|
+
isBuy: { type: "boolean", required: true, description: "true for buy/long, false for sell/short" },
|
|
997
|
+
limitPxHuman: { type: "string", required: true, description: "Limit price" },
|
|
998
|
+
szHuman: { type: "string", required: true, description: "Order size in coin units" },
|
|
999
|
+
marketKind: { type: "string", required: false, description: "perp (default) or spot" },
|
|
1000
|
+
tif: { type: "string", required: false, description: "gtc, ioc, or alo" },
|
|
1001
|
+
dex: { type: "string", required: false, description: "HIP-3 dex name when applicable" }
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
id: "hyperliquid.close",
|
|
1006
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1007
|
+
chainCategory: "evm",
|
|
1008
|
+
description: "Close or reduce a perp via IoC reduce-only limit order (CoreWriter)",
|
|
1009
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1010
|
+
params: {
|
|
1011
|
+
coin: { type: "string", required: true, description: "Market coin" },
|
|
1012
|
+
isLong: { type: "boolean", required: true, description: "true if closing a long position" },
|
|
1013
|
+
limitPxHuman: { type: "string", required: true, description: "Limit price" },
|
|
1014
|
+
szHuman: { type: "string", required: true, description: "Size to close in coin units" }
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
id: "hyperliquid.cancel",
|
|
1019
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1020
|
+
chainCategory: "evm",
|
|
1021
|
+
description: "Cancel a Hyperliquid open order via CoreWriter",
|
|
1022
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1023
|
+
params: {
|
|
1024
|
+
coin: { type: "string", required: true, description: "Market coin" },
|
|
1025
|
+
oid: { type: "number", required: true, description: "Order id from openOrders" }
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
id: "hyperliquid.usdTransfer",
|
|
1030
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1031
|
+
chainCategory: "evm",
|
|
1032
|
+
description: "Move USDC between Hyperliquid spot and perp margin accounts",
|
|
1033
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1034
|
+
params: {
|
|
1035
|
+
usdHuman: { type: "string", required: true, description: "USD amount" },
|
|
1036
|
+
toPerp: { type: "boolean", required: true, description: "true spot\u2192perp, false perp\u2192spot" }
|
|
1037
|
+
}
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
id: "hyperliquid.vaultDeposit",
|
|
1041
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1042
|
+
chainCategory: "evm",
|
|
1043
|
+
description: "Deposit USD into a Hyperliquid vault",
|
|
1044
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1045
|
+
params: {
|
|
1046
|
+
vaultAddress: { type: "string", required: true, description: "Vault address" },
|
|
1047
|
+
usdHuman: { type: "string", required: true, description: "USD amount" }
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
id: "hyperliquid.vaultWithdraw",
|
|
1052
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1053
|
+
chainCategory: "evm",
|
|
1054
|
+
description: "Withdraw USD from a Hyperliquid vault (includes accrued PnL)",
|
|
1055
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1056
|
+
params: {
|
|
1057
|
+
vaultAddress: { type: "string", required: true, description: "Vault address" },
|
|
1058
|
+
usdHuman: { type: "string", required: true, description: "USD amount" }
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
id: "hyperliquid.stake",
|
|
1063
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1064
|
+
chainCategory: "evm",
|
|
1065
|
+
description: "Stake HYPE via CoreWriter",
|
|
1066
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1067
|
+
params: {
|
|
1068
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" }
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
id: "hyperliquid.unstake",
|
|
1073
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1074
|
+
chainCategory: "evm",
|
|
1075
|
+
description: "Unstake HYPE via CoreWriter",
|
|
1076
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1077
|
+
params: {
|
|
1078
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" }
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
id: "hyperliquid.delegate",
|
|
1083
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1084
|
+
chainCategory: "evm",
|
|
1085
|
+
description: "Delegate staked HYPE to a validator",
|
|
1086
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1087
|
+
params: {
|
|
1088
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" },
|
|
1089
|
+
validator: { type: "string", required: true, description: "Validator address" }
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
id: "hyperliquid.undelegate",
|
|
1094
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
1095
|
+
chainCategory: "evm",
|
|
1096
|
+
description: "Undelegate HYPE from a validator",
|
|
1097
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1098
|
+
params: {
|
|
1099
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" },
|
|
1100
|
+
validator: { type: "string", required: true, description: "Validator address" }
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
]
|
|
1104
|
+
};
|
|
1105
|
+
registerProtocolModule(hyperliquidProtocolModule);
|
|
1106
|
+
|
|
1107
|
+
export { HYPERLIQUID_CORE_WRITER_ADDRESS, HYPERLIQUID_CORE_WRITER_GAS_FALLBACK, HYPERLIQUID_HLP_VAULT_ADDRESS, HYPERLIQUID_PROTOCOL_ID, HYPERLIQUID_SPOT_ASSET_OFFSET, HYPERLIQUID_SUPPORTED_CHAIN_IDS, HYPERLIQUID_TIF, buildCoreWriterCancelByCloidCalldata, buildCoreWriterCancelByOidCalldata, buildCoreWriterLimitOrderCalldata, buildCoreWriterStakingDepositCalldata, buildCoreWriterStakingWithdrawCalldata, buildCoreWriterTokenDelegateCalldata, buildCoreWriterUsdClassTransferCalldata, buildCoreWriterVaultTransferCalldata, buildEvmMultisignBodyHyperliquidCancelBatch, buildEvmMultisignBodyHyperliquidCloseBatch, buildEvmMultisignBodyHyperliquidDelegateBatch, buildEvmMultisignBodyHyperliquidDelegateOnlyBatch, buildEvmMultisignBodyHyperliquidLimitOrderBatch, buildEvmMultisignBodyHyperliquidStakeDepositBatch, buildEvmMultisignBodyHyperliquidStakeWithdrawBatch, buildEvmMultisignBodyHyperliquidUndelegateBatch, buildEvmMultisignBodyHyperliquidUsdClassTransferBatch, buildEvmMultisignBodyHyperliquidVaultDepositBatch, buildEvmMultisignBodyHyperliquidVaultWithdrawBatch, coreWriterStep, hyperliquidApiBaseUrl, hyperliquidEncodePx8, hyperliquidEncodeUsd6, hyperliquidEncodeWei8, hyperliquidFetchActiveAssetData, hyperliquidFetchAllMids, hyperliquidFetchCandles, hyperliquidFetchClearinghouseState, hyperliquidFetchDelegations, hyperliquidFetchDelegationsForExecutor, hyperliquidFetchDexList, hyperliquidFetchMarketSnapshot, hyperliquidFetchMarketSnapshotSummary, hyperliquidFetchMarketsSummary, hyperliquidFetchOpenContextSummary, hyperliquidFetchOpenMarketContext, hyperliquidFetchOpenOrders, hyperliquidFetchOpenOrdersSummary, hyperliquidFetchOrdersForExecutor, hyperliquidFetchPerpMeta, hyperliquidFetchPositionDisplayRows, hyperliquidFetchPositionsForExecutor, hyperliquidFetchSpotClearinghouseState, hyperliquidFetchSpotMeta, hyperliquidFetchStakingSummary, hyperliquidFetchStakingSummaryForExecutor, hyperliquidFetchUsdClassBalances, hyperliquidFetchUsdClassBalancesSummary, hyperliquidFetchUserVaultEquities, hyperliquidFetchUserVaultEquitiesSummary, hyperliquidFetchVaultCatalogSummary, hyperliquidFetchVaultSummaries, hyperliquidIsSpotAssetId, hyperliquidProtocolModule, hyperliquidResolveAsset, hyperliquidResolvePerpAsset, hyperliquidResolveSpotAsset, hyperliquidResolveTif, hyperliquidVaultStatsUrl, isHyperliquidChainSupported };
|
|
1108
|
+
//# sourceMappingURL=index.js.map
|
|
1109
|
+
//# sourceMappingURL=index.js.map
|