@vtxmacro/cli 2026.9.56 → 2026.9.58
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/bin/vtx-service-bootstrap.js +3 -1
- package/bin/vtx-service-launcher.js +2 -0
- package/bin/vtx.js +104 -71
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import { fileURLToPath } from "node:url";
|
|
|
16
16
|
// agent-cli-release.json
|
|
17
17
|
var agent_cli_release_default = {
|
|
18
18
|
package_name: "@vtxmacro/cli",
|
|
19
|
-
package_version: "2026.9.
|
|
19
|
+
package_version: "2026.9.58",
|
|
20
20
|
codex_package_name: "@openai/codex",
|
|
21
21
|
codex_version: "0.155.0",
|
|
22
22
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -203,6 +203,8 @@ var runtime_policy_generated_default = {
|
|
|
203
203
|
},
|
|
204
204
|
server_runtime: {
|
|
205
205
|
prompt_rescue: {
|
|
206
|
+
snapshot_max_age_seconds: 5,
|
|
207
|
+
snapshot_component_max_skew_seconds: 2,
|
|
206
208
|
client_long_poll_seconds: 20,
|
|
207
209
|
client_claim_http_timeout_milliseconds: 25e3,
|
|
208
210
|
client_presence_heartbeat_interval_milliseconds: 3e4,
|
|
@@ -86,6 +86,8 @@ var runtime_policy_generated_default = {
|
|
|
86
86
|
},
|
|
87
87
|
server_runtime: {
|
|
88
88
|
prompt_rescue: {
|
|
89
|
+
snapshot_max_age_seconds: 5,
|
|
90
|
+
snapshot_component_max_skew_seconds: 2,
|
|
89
91
|
client_long_poll_seconds: 20,
|
|
90
92
|
client_claim_http_timeout_milliseconds: 25e3,
|
|
91
93
|
client_presence_heartbeat_interval_milliseconds: 3e4,
|
package/bin/vtx.js
CHANGED
|
@@ -77,7 +77,7 @@ var init_agent_cli_release = __esm({
|
|
|
77
77
|
"agent-cli-release.json"() {
|
|
78
78
|
agent_cli_release_default = {
|
|
79
79
|
package_name: "@vtxmacro/cli",
|
|
80
|
-
package_version: "2026.9.
|
|
80
|
+
package_version: "2026.9.58",
|
|
81
81
|
codex_package_name: "@openai/codex",
|
|
82
82
|
codex_version: "0.155.0",
|
|
83
83
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -20544,6 +20544,8 @@ var init_runtime_policy_generated = __esm({
|
|
|
20544
20544
|
},
|
|
20545
20545
|
server_runtime: {
|
|
20546
20546
|
prompt_rescue: {
|
|
20547
|
+
snapshot_max_age_seconds: 5,
|
|
20548
|
+
snapshot_component_max_skew_seconds: 2,
|
|
20547
20549
|
client_long_poll_seconds: 20,
|
|
20548
20550
|
client_claim_http_timeout_milliseconds: 25e3,
|
|
20549
20551
|
client_presence_heartbeat_interval_milliseconds: 3e4,
|
|
@@ -42604,6 +42606,8 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
42604
42606
|
},
|
|
42605
42607
|
server_runtime: {
|
|
42606
42608
|
prompt_rescue: {
|
|
42609
|
+
snapshot_max_age_seconds: 5,
|
|
42610
|
+
snapshot_component_max_skew_seconds: 2,
|
|
42607
42611
|
client_long_poll_seconds: 20,
|
|
42608
42612
|
client_claim_http_timeout_milliseconds: 25e3,
|
|
42609
42613
|
client_presence_heartbeat_interval_milliseconds: 3e4,
|
|
@@ -48954,6 +48958,17 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48954
48958
|
let outcome = "cancelled";
|
|
48955
48959
|
let settled;
|
|
48956
48960
|
let acquiring = false;
|
|
48961
|
+
let observedRateLimit;
|
|
48962
|
+
let pendingPhase = null;
|
|
48963
|
+
const setPendingPhase = (next) => {
|
|
48964
|
+
if (next === pendingPhase) return;
|
|
48965
|
+
const previous = pendingPhase;
|
|
48966
|
+
pendingPhase = next;
|
|
48967
|
+
try {
|
|
48968
|
+
options.reservation?.onPendingPhaseChange?.(previous, next);
|
|
48969
|
+
} catch {
|
|
48970
|
+
}
|
|
48971
|
+
};
|
|
48957
48972
|
try {
|
|
48958
48973
|
checkAbort(signal);
|
|
48959
48974
|
if (ttlMs) {
|
|
@@ -48962,6 +48977,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48962
48977
|
if (existing) return existing;
|
|
48963
48978
|
const running = pending2.get(key);
|
|
48964
48979
|
if (!running) break;
|
|
48980
|
+
setPendingPhase("cache");
|
|
48965
48981
|
await new Promise((resolve13, reject) => {
|
|
48966
48982
|
const aborted2 = () => {
|
|
48967
48983
|
signal.removeEventListener("abort", aborted2);
|
|
@@ -48981,6 +48997,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48981
48997
|
}
|
|
48982
48998
|
if (options.reservation?.closed) throw new DOMException("Hyperliquid account read was cancelled.", "AbortError");
|
|
48983
48999
|
acquiring = true;
|
|
49000
|
+
setPendingPhase("admission");
|
|
48984
49001
|
permit = await admit(apiUrl, requestType, signal, void 0, deadline);
|
|
48985
49002
|
acquiring = false;
|
|
48986
49003
|
armDeadline(Math.min(deadline, permit?.expiresAt ?? Infinity));
|
|
@@ -48997,6 +49014,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
48997
49014
|
signal.addEventListener("abort", transportAborted, { once: true });
|
|
48998
49015
|
});
|
|
48999
49016
|
const transport = (async () => {
|
|
49017
|
+
setPendingPhase("transport");
|
|
49000
49018
|
const received = await fetch(`${apiUrl}/info`, {
|
|
49001
49019
|
method: "POST",
|
|
49002
49020
|
headers: { "Content-Type": "application/json" },
|
|
@@ -49005,8 +49023,9 @@ var init_hyperliquid_public_read = __esm({
|
|
|
49005
49023
|
});
|
|
49006
49024
|
checkAbort(signal);
|
|
49007
49025
|
if (received.status === 429) {
|
|
49026
|
+
observedRateLimit = new HyperliquidPublicReadError("public_rate_limited", "Hyperliquid public API returned HTTP 429.", requestType, 429);
|
|
49008
49027
|
await cooldown(apiUrl, received.headers.get("Retry-After"));
|
|
49009
|
-
throw
|
|
49028
|
+
throw observedRateLimit;
|
|
49010
49029
|
}
|
|
49011
49030
|
const receivedPayload = await received.json().catch((error48) => {
|
|
49012
49031
|
if (error48 instanceof SyntaxError) return {};
|
|
@@ -49017,6 +49036,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
49017
49036
|
})();
|
|
49018
49037
|
({ response, payload } = await Promise.race([transport, aborted2]));
|
|
49019
49038
|
} finally {
|
|
49039
|
+
setPendingPhase(null);
|
|
49020
49040
|
if (transportAborted) signal.removeEventListener("abort", transportAborted);
|
|
49021
49041
|
}
|
|
49022
49042
|
if (!response.ok) {
|
|
@@ -49034,6 +49054,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
49034
49054
|
}
|
|
49035
49055
|
return result2;
|
|
49036
49056
|
} catch (error48) {
|
|
49057
|
+
if (observedRateLimit) throw observedRateLimit;
|
|
49037
49058
|
if (options.signal?.aborted) {
|
|
49038
49059
|
outcome = "cancelled";
|
|
49039
49060
|
throw abortError2(options.signal);
|
|
@@ -49044,6 +49065,7 @@ var init_hyperliquid_public_read = __esm({
|
|
|
49044
49065
|
if (error48 instanceof Error && (error48.name === "TimeoutError" || error48.name === "AbortError")) throw new HyperliquidPublicReadError("public_timeout", "Hyperliquid public request timed out.", requestType);
|
|
49045
49066
|
throw error48;
|
|
49046
49067
|
} finally {
|
|
49068
|
+
setPendingPhase(null);
|
|
49047
49069
|
clearTimeout(timer);
|
|
49048
49070
|
options.signal?.removeEventListener("abort", callerAborted);
|
|
49049
49071
|
controller.abort();
|
|
@@ -50151,7 +50173,7 @@ var init_network_debug = __esm({
|
|
|
50151
50173
|
});
|
|
50152
50174
|
|
|
50153
50175
|
// lib/runtime/hyperliquid-account-state-adapter.ts
|
|
50154
|
-
var unsupportedUserActiveAssetCache, MAX_UNSUPPORTED_USER_ACTIVE_ASSET_CACHE_KEYS, UNSUPPORTED_USER_ACTIVE_ASSET_STORAGE_KEY, USER_FILLS_CACHE_STORAGE_PREFIX, ACCOUNT_STATE_CACHE_STORAGE_PREFIX, browserUserFillsCache, browserUserFillsInFlight, HYPERLIQUID_USER_FILLS_PROVIDER_PAGE_CAP, browserAccountStateCache, browserAccountStateInFlight, UNSUPPORTED_USER_ACTIVE_ASSET_DETAIL_PATTERNS, unsupportedUserActiveAssetCacheHydrated, hydrateUnsupportedUserActiveAssetCache, persistUnsupportedUserActiveAssetCache, toPositiveFinite, toFinite, firstFiniteNumber, parseFundingUsdcFromInfoPosition, buildActiveAssetCacheKey, buildUserFillsCacheKey, buildUserFillsStorageKey, buildAccountStateCacheKey, buildAccountStateStorageKey, hasActiveInfoRateLimitCooldown, requireNonNegativeConfigSeconds, requireAccountStateCacheConfig, requireUserFillsCacheConfig, normalizeFillSymbol, buildSymbolFilter, filterFillsBySymbols, readBrowserUserFillsCache, writeBrowserUserFillsCache, cloneBrowserAccountStateResult, withAccountStateEvidence, readBrowserAccountStateCache, writeBrowserAccountStateCache, isRateLimitError, createAbortError, waitForSharedBrowserRequest, waitForSharedBrowserUserFills, getBrowserActiveAssetTypeCandidates, normalizeHyperliquidErrorDetail, isUnsupportedUserActiveAssetError, rememberUnsupportedUserActiveAssetKey, parseInfoPositions, requireFinitePromptMetric, requirePromptClearinghouseState, requirePromptSpotState, normalizePerpDexName, listConfiguredPerpDexs, listPerpDexsForAccountState, prefixHip3PositionCoins, aggregateClearinghouseResponses, hasCompletePerpDexAccountMetrics, normalizeBrowserFillToTradeHistory, isPerpFill,
|
|
50176
|
+
var unsupportedUserActiveAssetCache, MAX_UNSUPPORTED_USER_ACTIVE_ASSET_CACHE_KEYS, UNSUPPORTED_USER_ACTIVE_ASSET_STORAGE_KEY, USER_FILLS_CACHE_STORAGE_PREFIX, ACCOUNT_STATE_CACHE_STORAGE_PREFIX, browserUserFillsCache, browserUserFillsInFlight, HYPERLIQUID_USER_FILLS_PROVIDER_PAGE_CAP, browserAccountStateCache, browserAccountStateInFlight, UNSUPPORTED_USER_ACTIVE_ASSET_DETAIL_PATTERNS, unsupportedUserActiveAssetCacheHydrated, hydrateUnsupportedUserActiveAssetCache, persistUnsupportedUserActiveAssetCache, toPositiveFinite, toFinite, firstFiniteNumber, parseFundingUsdcFromInfoPosition, buildActiveAssetCacheKey, buildUserFillsCacheKey, buildUserFillsStorageKey, buildAccountStateCacheKey, buildAccountStateStorageKey, hasActiveInfoRateLimitCooldown, requireNonNegativeConfigSeconds, requireAccountStateCacheConfig, requireUserFillsCacheConfig, normalizeFillSymbol, buildSymbolFilter, filterFillsBySymbols, readBrowserUserFillsCache, writeBrowserUserFillsCache, cloneBrowserAccountStateResult, withAccountStateEvidence, readBrowserAccountStateCache, writeBrowserAccountStateCache, isRateLimitError, createAbortError, waitForSharedBrowserRequest, waitForSharedBrowserUserFills, getBrowserActiveAssetTypeCandidates, normalizeHyperliquidErrorDetail, isUnsupportedUserActiveAssetError, rememberUnsupportedUserActiveAssetKey, parseInfoPositions, requireFinitePromptMetric, requirePromptClearinghouseState, requirePromptSpotState, normalizePerpDexName, listConfiguredPerpDexs, listPerpDexsForAccountState, prefixHip3PositionCoins, aggregateClearinghouseResponses, hasCompletePerpDexAccountMetrics, normalizeBrowserFillToTradeHistory, isPerpFill, settleAccountReads, fetchHyperliquidInfoRead, fetchHyperliquidInfoPayload, requireHyperliquidApiUrl, requireWalletAddress, parseInfoPositionSnapshot, fetchBrowserAccountState, fetchBrowserAccountStateUncached, fetchBrowserUserFills, fetchBrowserPositionSnapshot;
|
|
50155
50177
|
var init_hyperliquid_account_state_adapter = __esm({
|
|
50156
50178
|
"lib/runtime/hyperliquid-account-state-adapter.ts"() {
|
|
50157
50179
|
"use strict";
|
|
@@ -50167,6 +50189,7 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
50167
50189
|
init_hyperliquid_fee_contract();
|
|
50168
50190
|
init_hyperliquid_market_symbol();
|
|
50169
50191
|
init_network_debug();
|
|
50192
|
+
init_runtime_policy_generated();
|
|
50170
50193
|
unsupportedUserActiveAssetCache = /* @__PURE__ */ new Set();
|
|
50171
50194
|
MAX_UNSUPPORTED_USER_ACTIVE_ASSET_CACHE_KEYS = 512;
|
|
50172
50195
|
UNSUPPORTED_USER_ACTIVE_ASSET_STORAGE_KEY = "vtx:hyperliquid:unsupported-user-active-asset:v1";
|
|
@@ -50818,30 +50841,30 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
50818
50841
|
}
|
|
50819
50842
|
return true;
|
|
50820
50843
|
};
|
|
50821
|
-
|
|
50844
|
+
settleAccountReads = async (reads, controller) => {
|
|
50822
50845
|
try {
|
|
50823
50846
|
return await Promise.all(reads);
|
|
50824
50847
|
} catch (error48) {
|
|
50825
|
-
|
|
50826
|
-
|
|
50827
|
-
|
|
50828
|
-
|
|
50829
|
-
}
|
|
50848
|
+
controller.abort(error48);
|
|
50849
|
+
const settled = await Promise.allSettled(reads);
|
|
50850
|
+
for (const result2 of settled) {
|
|
50851
|
+
if (result2.status === "rejected" && result2.reason instanceof HyperliquidPublicReadError && result2.reason.code === "public_rate_limited") throw result2.reason;
|
|
50830
50852
|
}
|
|
50831
50853
|
throw error48;
|
|
50832
50854
|
}
|
|
50833
50855
|
};
|
|
50834
|
-
|
|
50856
|
+
fetchHyperliquidInfoRead = async (apiUrl, body, signal, reservation) => {
|
|
50835
50857
|
const trace = startRuntimeNetworkDebugTrace({ kind: "exchange", label: `hyperliquid_info:${String(body.type)}`, method: "POST", url: `${apiUrl.replace(/\/$/, "")}/info` });
|
|
50836
50858
|
try {
|
|
50837
50859
|
const result2 = await readHyperliquidPublicInfo(apiUrl, body, { signal, reservation });
|
|
50838
50860
|
trace.completeSuccess(200);
|
|
50839
|
-
return result2
|
|
50861
|
+
return result2;
|
|
50840
50862
|
} catch (error48) {
|
|
50841
50863
|
trace.completeError(error48, error48?.status ?? null);
|
|
50842
50864
|
throw error48;
|
|
50843
50865
|
}
|
|
50844
50866
|
};
|
|
50867
|
+
fetchHyperliquidInfoPayload = async (apiUrl, body, signal, reservation) => (await fetchHyperliquidInfoRead(apiUrl, body, signal, reservation)).payload;
|
|
50845
50868
|
requireHyperliquidApiUrl = (config2) => {
|
|
50846
50869
|
const apiUrl = String(config2.client_runtime_exchange_endpoints?.hyperliquid_api_url || "").trim();
|
|
50847
50870
|
if (!apiUrl) {
|
|
@@ -50984,6 +51007,26 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
50984
51007
|
{ type: "userDexAbstraction", user: walletAddress }
|
|
50985
51008
|
] : []
|
|
50986
51009
|
], input.signal, { cacheAccountMode: true, cacheValidUntilMs: input.publicReadDeadlineMs });
|
|
51010
|
+
if (input.onPublicReadPendingChange) {
|
|
51011
|
+
const pending3 = { cache: 0, admission: 0, transport: 0 };
|
|
51012
|
+
const reportPending = input.onPublicReadPendingChange;
|
|
51013
|
+
reservation.onPendingPhaseChange = (previous, next) => {
|
|
51014
|
+
if (previous) pending3[previous] -= 1;
|
|
51015
|
+
if (next) pending3[next] += 1;
|
|
51016
|
+
reportPending({ ...pending3 });
|
|
51017
|
+
};
|
|
51018
|
+
try {
|
|
51019
|
+
reportPending({ ...pending3 });
|
|
51020
|
+
} catch {
|
|
51021
|
+
}
|
|
51022
|
+
}
|
|
51023
|
+
const parentSignal = input.signal;
|
|
51024
|
+
const readController = new AbortController();
|
|
51025
|
+
const cancelReads = () => readController.abort(parentSignal?.reason);
|
|
51026
|
+
parentSignal?.addEventListener("abort", cancelReads, { once: true });
|
|
51027
|
+
if (parentSignal?.aborted) cancelReads();
|
|
51028
|
+
input = { ...input, signal: readController.signal };
|
|
51029
|
+
const awaitAccountReads = (reads) => settleAccountReads(reads, readController);
|
|
50987
51030
|
try {
|
|
50988
51031
|
const userFeesPromise = input.includeEffectiveTakerRate === true ? (async () => ({
|
|
50989
51032
|
...await readHyperliquidPublicInfo(apiUrl, { type: "userFees", user: walletAddress }, { signal: input.signal, reservation }).catch((error48) => {
|
|
@@ -51025,67 +51068,56 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
51025
51068
|
}
|
|
51026
51069
|
}));
|
|
51027
51070
|
}
|
|
51028
|
-
const
|
|
51029
|
-
const
|
|
51030
|
-
|
|
51031
|
-
{ type: "clearinghouseState", user: walletAddress },
|
|
51032
|
-
|
|
51033
|
-
|
|
51034
|
-
)
|
|
51035
|
-
|
|
51036
|
-
|
|
51037
|
-
}
|
|
51038
|
-
const dexResponses = await awaitAccountReads(
|
|
51039
|
-
dexNames.map(async (dexName) => {
|
|
51040
|
-
const response = await fetchHyperliquidInfoPayload(
|
|
51041
|
-
apiUrl,
|
|
51042
|
-
{ type: "clearinghouseState", user: walletAddress, dex: dexName },
|
|
51043
|
-
input.signal,
|
|
51044
|
-
reservation
|
|
51045
|
-
);
|
|
51071
|
+
const dynamicPromise = (async () => {
|
|
51072
|
+
const perpsDexes = ["", ...dexNames];
|
|
51073
|
+
const components = [
|
|
51074
|
+
...perpsDexes.map((dex) => ({ dex, body: { type: "clearinghouseState", user: walletAddress, ...dex ? { dex } : {} } })),
|
|
51075
|
+
{ body: { type: "spotClearinghouseState", user: walletAddress } }
|
|
51076
|
+
];
|
|
51077
|
+
const capture = async (component) => {
|
|
51078
|
+
try {
|
|
51079
|
+
const read = await fetchHyperliquidInfoRead(apiUrl, component.body, input.signal, reservation);
|
|
51046
51080
|
if (input.includeEffectiveTakerRate === true) {
|
|
51047
|
-
|
|
51081
|
+
if (component.dex == null) requirePromptSpotState(read.payload);
|
|
51082
|
+
else requirePromptClearinghouseState(read.payload, component.dex || "default");
|
|
51048
51083
|
}
|
|
51049
|
-
|
|
51050
|
-
|
|
51051
|
-
|
|
51052
|
-
|
|
51053
|
-
|
|
51054
|
-
})
|
|
51055
|
-
);
|
|
51056
|
-
const selectedPayload = selectedDex ? dexResponses.find((entry) => entry.dex === selectedDex)?.payload : defaultResponse;
|
|
51057
|
-
if (!selectedPayload) {
|
|
51058
|
-
throw new Error(`Missing selected Hyperliquid clearinghouse state for DEX ${selectedDex}.`);
|
|
51059
|
-
}
|
|
51060
|
-
return {
|
|
51061
|
-
payload: aggregateClearinghouseResponses([
|
|
51062
|
-
defaultResponse,
|
|
51063
|
-
...dexResponses.map((entry) => entry.payload)
|
|
51064
|
-
]),
|
|
51065
|
-
selectedPayload,
|
|
51066
|
-
dexPayloads: [
|
|
51067
|
-
{ dex: "", payload: defaultResponse },
|
|
51068
|
-
...dexResponses.map(({ dex, rawPayload }) => ({ dex, payload: rawPayload }))
|
|
51069
|
-
],
|
|
51070
|
-
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
51084
|
+
component.read = read;
|
|
51085
|
+
} catch (error48) {
|
|
51086
|
+
if (component.dex != null || input.forceRefresh || input.includeEffectiveTakerRate === true) throw error48;
|
|
51087
|
+
component.read = { payload: {}, fetchedAtMs: Date.now() };
|
|
51088
|
+
}
|
|
51071
51089
|
};
|
|
51072
|
-
|
|
51073
|
-
|
|
51074
|
-
|
|
51075
|
-
|
|
51076
|
-
|
|
51077
|
-
|
|
51078
|
-
{
|
|
51079
|
-
|
|
51080
|
-
|
|
51081
|
-
|
|
51082
|
-
|
|
51083
|
-
|
|
51084
|
-
throw error48;
|
|
51090
|
+
await awaitAccountReads(components.map(capture));
|
|
51091
|
+
if (input.publicReadDeadlineMs != null && input.includeEffectiveTakerRate === true && input.includeExactAccountMode === true) {
|
|
51092
|
+
const freshness = runtime_policy_generated_default.trading.engine.server_runtime.prompt_rescue;
|
|
51093
|
+
const horizonMs = Math.min(freshness.snapshot_max_age_seconds, freshness.snapshot_component_max_skew_seconds) * 1e3;
|
|
51094
|
+
for (; ; ) {
|
|
51095
|
+
const now = Date.now();
|
|
51096
|
+
const stale = components.filter(({ read }) => now - read.fetchedAtMs > horizonMs);
|
|
51097
|
+
if (!stale.length) break;
|
|
51098
|
+
if (now >= input.publicReadDeadlineMs) {
|
|
51099
|
+
throw new HyperliquidPublicReadError("public_timeout", "Hyperliquid public request timed out.", "clearinghouseState");
|
|
51100
|
+
}
|
|
51101
|
+
await awaitAccountReads(stale.map(capture));
|
|
51085
51102
|
}
|
|
51086
|
-
payload = {};
|
|
51087
51103
|
}
|
|
51088
|
-
|
|
51104
|
+
const perpsReads = components.slice(0, perpsDexes.length).map((component) => ({
|
|
51105
|
+
dex: component.dex,
|
|
51106
|
+
payload: component.read.payload,
|
|
51107
|
+
fetchedAtMs: component.read.fetchedAtMs
|
|
51108
|
+
}));
|
|
51109
|
+
const selectedRead = perpsReads.find(({ dex }) => dex === selectedDex);
|
|
51110
|
+
if (!selectedRead) throw new Error(`Missing selected Hyperliquid clearinghouse state for DEX ${selectedDex}.`);
|
|
51111
|
+
const spotRead = components[perpsDexes.length].read;
|
|
51112
|
+
return {
|
|
51113
|
+
perpsResult: {
|
|
51114
|
+
payload: aggregateClearinghouseResponses(perpsReads.map(({ dex, payload }) => dex ? prefixHip3PositionCoins(payload, dex) : payload)),
|
|
51115
|
+
selectedPayload: selectedDex ? prefixHip3PositionCoins(selectedRead.payload, selectedDex) : selectedRead.payload,
|
|
51116
|
+
dexPayloads: perpsReads.map(({ dex, payload }) => ({ dex, payload })),
|
|
51117
|
+
capturedAt: new Date(Math.min(...perpsReads.map(({ fetchedAtMs }) => fetchedAtMs))).toISOString()
|
|
51118
|
+
},
|
|
51119
|
+
spotResult: { payload: spotRead.payload, capturedAt: new Date(spotRead.fetchedAtMs).toISOString() }
|
|
51120
|
+
};
|
|
51089
51121
|
})();
|
|
51090
51122
|
const activeAssetPromise = input.includeActiveAssetData === false ? Promise.resolve(null) : (async () => {
|
|
51091
51123
|
let lastError = null;
|
|
@@ -51108,9 +51140,8 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
51108
51140
|
}
|
|
51109
51141
|
throw lastError instanceof Error ? lastError : new Error("Failed to fetch browser active asset data.");
|
|
51110
51142
|
})();
|
|
51111
|
-
const [perpsResult, spotResult, activeAssetResult, userFeesResult, exactAccountMode] = await awaitAccountReads([
|
|
51112
|
-
|
|
51113
|
-
spotPromise,
|
|
51143
|
+
const [{ perpsResult, spotResult }, activeAssetResult, userFeesResult, exactAccountMode] = await awaitAccountReads([
|
|
51144
|
+
dynamicPromise,
|
|
51114
51145
|
activeAssetPromise,
|
|
51115
51146
|
userFeesPromise,
|
|
51116
51147
|
exactAccountModePromise
|
|
@@ -51235,7 +51266,7 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
51235
51266
|
...effectiveTakerRates == null ? {} : { effectiveTakerRates },
|
|
51236
51267
|
...exactAccountMode == null || userFeesResult == null ? {} : {
|
|
51237
51268
|
promptRescueEvidence: {
|
|
51238
|
-
capturedAt:
|
|
51269
|
+
capturedAt: new Date(Math.min(Date.parse(perpsResult.capturedAt), Date.parse(spotResult.capturedAt))).toISOString(),
|
|
51239
51270
|
perpsCapturedAt: perpsResult.capturedAt,
|
|
51240
51271
|
spotCapturedAt: spotResult.capturedAt,
|
|
51241
51272
|
feesCapturedAt: userFeesResult.capturedAt,
|
|
@@ -51245,6 +51276,8 @@ var init_hyperliquid_account_state_adapter = __esm({
|
|
|
51245
51276
|
}
|
|
51246
51277
|
};
|
|
51247
51278
|
} finally {
|
|
51279
|
+
parentSignal?.removeEventListener("abort", cancelReads);
|
|
51280
|
+
readController.abort();
|
|
51248
51281
|
await releaseHyperliquidPublicReadReservation(reservation);
|
|
51249
51282
|
}
|
|
51250
51283
|
};
|