@elizaos/plugin-hyperliquid-app 2.0.3-beta.6 → 2.0.3-beta.7
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/HyperliquidAppView.d.ts +4 -0
- package/dist/HyperliquidAppView.d.ts.map +1 -0
- package/dist/HyperliquidAppView.interact.d.ts +10 -0
- package/dist/HyperliquidAppView.interact.d.ts.map +1 -0
- package/dist/HyperliquidAppView.interact.js +70 -0
- package/dist/HyperliquidAppView.interact.js.map +1 -0
- package/dist/HyperliquidAppView.js +199 -0
- package/dist/HyperliquidAppView.js.map +1 -0
- package/dist/HyperliquidPositionsPanel.d.ts +12 -0
- package/dist/HyperliquidPositionsPanel.d.ts.map +1 -0
- package/dist/HyperliquidPositionsPanel.js +194 -0
- package/dist/HyperliquidPositionsPanel.js.map +1 -0
- package/dist/HyperliquidView.d.ts +14 -0
- package/dist/HyperliquidView.d.ts.map +1 -0
- package/dist/HyperliquidView.js +56 -0
- package/dist/HyperliquidView.js.map +1 -0
- package/dist/__fixtures__/contract.d.ts +5 -0
- package/dist/__fixtures__/contract.d.ts.map +1 -0
- package/dist/__fixtures__/contract.js +87 -0
- package/dist/__fixtures__/contract.js.map +1 -0
- package/dist/actions/perpetual-market.d.ts +38 -0
- package/dist/actions/perpetual-market.d.ts.map +1 -0
- package/dist/actions/perpetual-market.js +653 -0
- package/dist/actions/perpetual-market.js.map +1 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +15 -0
- package/dist/client.js.map +1 -0
- package/dist/components/HyperliquidSpatialView.d.ts +46 -0
- package/dist/components/HyperliquidSpatialView.d.ts.map +1 -0
- package/dist/components/HyperliquidSpatialView.js +214 -0
- package/dist/components/HyperliquidSpatialView.js.map +1 -0
- package/dist/hyperliquid-app-view-bundle.d.ts +3 -0
- package/dist/hyperliquid-app-view-bundle.d.ts.map +1 -0
- package/dist/hyperliquid-app-view-bundle.js +7 -0
- package/dist/hyperliquid-app-view-bundle.js.map +1 -0
- package/dist/hyperliquid-app.d.ts +4 -0
- package/dist/hyperliquid-app.d.ts.map +1 -0
- package/dist/hyperliquid-app.js +18 -0
- package/dist/hyperliquid-app.js.map +1 -0
- package/dist/hyperliquid-contracts.d.ts +152 -0
- package/dist/hyperliquid-contracts.d.ts.map +1 -0
- package/dist/hyperliquid-contracts.js +17 -0
- package/dist/hyperliquid-contracts.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +130 -0
- package/dist/plugin.js.map +1 -0
- package/dist/register-routes.d.ts +2 -0
- package/dist/register-routes.d.ts.map +1 -0
- package/dist/register-routes.js +6 -0
- package/dist/register-routes.js.map +1 -0
- package/dist/register-terminal-view.d.ts +15 -0
- package/dist/register-terminal-view.d.ts.map +1 -0
- package/dist/register-terminal-view.js +34 -0
- package/dist/register-terminal-view.js.map +1 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +17 -0
- package/dist/register.js.map +1 -0
- package/dist/routes.d.ts +25 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +485 -0
- package/dist/routes.js.map +1 -0
- package/dist/ui.d.ts +6 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +12 -0
- package/dist/ui.js.map +1 -0
- package/dist/useHyperliquidState.d.ts +20 -0
- package/dist/useHyperliquidState.d.ts.map +1 -0
- package/dist/useHyperliquidState.js +72 -0
- package/dist/useHyperliquidState.js.map +1 -0
- package/dist/views/bundle.js +463 -0
- package/dist/views/bundle.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export declare const HYPERLIQUID_API_BASE = "https://api.hyperliquid.xyz";
|
|
2
|
+
export declare const HYPERLIQUID_EXECUTION_BLOCKED_REASON = "Signed Hyperliquid exchange mutations are disabled until the native app has a real managed or local execution path.";
|
|
3
|
+
export declare const HYPERLIQUID_EXECUTION_NOT_IMPLEMENTED_REASON = "A signer is available, but signed Hyperliquid exchange execution remains disabled in this native app.";
|
|
4
|
+
export declare const HYPERLIQUID_ACCOUNT_BLOCKED_REASON = "Connect a managed Eliza Cloud vault or set HYPERLIQUID_ACCOUNT_ADDRESS / HL_ACCOUNT_ADDRESS to read account-specific positions and orders.";
|
|
5
|
+
export declare const HYPERLIQUID_VAULT_GUIDANCE = "Connect Eliza Cloud or Steward to use a managed vault. Public market reads do not require a vault.";
|
|
6
|
+
export declare const HYPERLIQUID_LOCAL_KEY_GUIDANCE = "Advanced optional path: set EVM_PRIVATE_KEY, HYPERLIQUID_PRIVATE_KEY, or HL_PRIVATE_KEY only when running a local signer intentionally. Public market reads do not require local keys.";
|
|
7
|
+
export declare const HYPERLIQUID_API_WALLET_GUIDANCE = "Optional Hyperliquid API-wallet delegation uses HYPERLIQUID_AGENT_KEY or HL_AGENT_KEY after a managed vault or local signer exists. It is not required for public reads.";
|
|
8
|
+
export type HyperliquidCredentialMode = "managed_vault" | "local_key" | "none";
|
|
9
|
+
export type HyperliquidAccountSource = "managed_vault" | "env_account" | "none";
|
|
10
|
+
export interface HyperliquidReadinessStatus {
|
|
11
|
+
publicReads: boolean;
|
|
12
|
+
accountReads: boolean;
|
|
13
|
+
signer: boolean;
|
|
14
|
+
execution: false;
|
|
15
|
+
}
|
|
16
|
+
export interface HyperliquidAccountStatus {
|
|
17
|
+
address: string | null;
|
|
18
|
+
source: HyperliquidAccountSource;
|
|
19
|
+
guidance: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface HyperliquidVaultStatus {
|
|
22
|
+
configured: boolean;
|
|
23
|
+
ready: boolean;
|
|
24
|
+
address: string | null;
|
|
25
|
+
guidance: string;
|
|
26
|
+
}
|
|
27
|
+
export interface HyperliquidApiWalletStatus {
|
|
28
|
+
configured: boolean;
|
|
29
|
+
guidance: string;
|
|
30
|
+
}
|
|
31
|
+
export interface HyperliquidStatusResponse {
|
|
32
|
+
publicReadReady: boolean;
|
|
33
|
+
signerReady: boolean;
|
|
34
|
+
executionReady: boolean;
|
|
35
|
+
executionBlockedReason: string | null;
|
|
36
|
+
accountAddress: string | null;
|
|
37
|
+
apiBaseUrl: string;
|
|
38
|
+
credentialMode: HyperliquidCredentialMode;
|
|
39
|
+
readiness: HyperliquidReadinessStatus;
|
|
40
|
+
account: HyperliquidAccountStatus;
|
|
41
|
+
vault: HyperliquidVaultStatus;
|
|
42
|
+
apiWallet: HyperliquidApiWalletStatus;
|
|
43
|
+
}
|
|
44
|
+
export interface HyperliquidMarket {
|
|
45
|
+
name: string;
|
|
46
|
+
index: number;
|
|
47
|
+
szDecimals: number;
|
|
48
|
+
maxLeverage: number | null;
|
|
49
|
+
onlyIsolated: boolean;
|
|
50
|
+
isDelisted: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface HyperliquidMarketsResponse {
|
|
53
|
+
markets: HyperliquidMarket[];
|
|
54
|
+
source: "hyperliquid-info-meta";
|
|
55
|
+
fetchedAt: string;
|
|
56
|
+
}
|
|
57
|
+
export interface HyperliquidFundingRate {
|
|
58
|
+
coin: string;
|
|
59
|
+
index: number;
|
|
60
|
+
funding: string;
|
|
61
|
+
premium: string | null;
|
|
62
|
+
markPx: string | null;
|
|
63
|
+
oraclePx: string | null;
|
|
64
|
+
openInterest: string | null;
|
|
65
|
+
}
|
|
66
|
+
export interface HyperliquidFundingResponse {
|
|
67
|
+
rates: HyperliquidFundingRate[];
|
|
68
|
+
source: "hyperliquid-info-meta-and-asset-ctxs";
|
|
69
|
+
fetchedAt: string;
|
|
70
|
+
}
|
|
71
|
+
export interface HyperliquidPosition {
|
|
72
|
+
coin: string;
|
|
73
|
+
size: string;
|
|
74
|
+
entryPx: string | null;
|
|
75
|
+
positionValue: string | null;
|
|
76
|
+
unrealizedPnl: string | null;
|
|
77
|
+
returnOnEquity: string | null;
|
|
78
|
+
liquidationPx: string | null;
|
|
79
|
+
marginUsed: string | null;
|
|
80
|
+
leverageType: string | null;
|
|
81
|
+
leverageValue: number | null;
|
|
82
|
+
/**
|
|
83
|
+
* Current mark price, derived server-side as `|positionValue| / |size|`.
|
|
84
|
+
* Stringified USD; null when either input is unreadable.
|
|
85
|
+
*/
|
|
86
|
+
markPx: string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Distance from the current mark to the liquidation price, as a percent of
|
|
89
|
+
* mark (bigger = safer). Computed server-side against the real mark (not the
|
|
90
|
+
* entry price), so the view never does financial math. Null when mark or
|
|
91
|
+
* liquidation price are unreadable.
|
|
92
|
+
*/
|
|
93
|
+
distanceToLiquidationPct: number | null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Account-level margin summary derived from the Hyperliquid
|
|
97
|
+
* `clearinghouseState` `marginSummary` block. Mirrors the waifu patron
|
|
98
|
+
* "account health" strip (account value, withdrawable, total notional,
|
|
99
|
+
* aggregate unrealized PnL) so the AppView can render the same hero stats.
|
|
100
|
+
* All values are stringified USD as returned by Hyperliquid; null when the
|
|
101
|
+
* account has never traded or the field is absent.
|
|
102
|
+
*/
|
|
103
|
+
export interface HyperliquidAccountSummary {
|
|
104
|
+
accountValue: string | null;
|
|
105
|
+
totalNotionalPosition: string | null;
|
|
106
|
+
totalMarginUsed: string | null;
|
|
107
|
+
totalRawUsd: string | null;
|
|
108
|
+
withdrawable: string | null;
|
|
109
|
+
/** Sum of per-position unrealized PnL, in USD. Null when unreadable. */
|
|
110
|
+
totalUnrealizedPnl: string | null;
|
|
111
|
+
/**
|
|
112
|
+
* Effective account leverage = `totalNotionalPosition / accountValue`,
|
|
113
|
+
* computed server-side. Null when either input is unreadable or account value
|
|
114
|
+
* is non-positive.
|
|
115
|
+
*/
|
|
116
|
+
effectiveLeverage: number | null;
|
|
117
|
+
}
|
|
118
|
+
export interface HyperliquidPositionsResponse {
|
|
119
|
+
accountAddress: string | null;
|
|
120
|
+
positions: HyperliquidPosition[];
|
|
121
|
+
/**
|
|
122
|
+
* Account margin/value summary. Optional for back-compat: older route
|
|
123
|
+
* builds and the no-account path omit it (null).
|
|
124
|
+
*/
|
|
125
|
+
summary: HyperliquidAccountSummary | null;
|
|
126
|
+
readBlockedReason: string | null;
|
|
127
|
+
fetchedAt: string | null;
|
|
128
|
+
}
|
|
129
|
+
export interface HyperliquidOrder {
|
|
130
|
+
coin: string;
|
|
131
|
+
side: string;
|
|
132
|
+
limitPx: string;
|
|
133
|
+
size: string;
|
|
134
|
+
oid: number;
|
|
135
|
+
timestamp: number;
|
|
136
|
+
reduceOnly: boolean;
|
|
137
|
+
orderType: string | null;
|
|
138
|
+
tif: string | null;
|
|
139
|
+
cloid: string | null;
|
|
140
|
+
}
|
|
141
|
+
export interface HyperliquidOrdersResponse {
|
|
142
|
+
accountAddress: string | null;
|
|
143
|
+
orders: HyperliquidOrder[];
|
|
144
|
+
readBlockedReason: string | null;
|
|
145
|
+
fetchedAt: string | null;
|
|
146
|
+
}
|
|
147
|
+
export interface HyperliquidExecutionDisabledResponse {
|
|
148
|
+
executionReady: false;
|
|
149
|
+
executionBlockedReason: string;
|
|
150
|
+
credentialMode: HyperliquidCredentialMode;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=hyperliquid-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperliquid-contracts.d.ts","sourceRoot":"","sources":["../src/hyperliquid-contracts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,eAAO,MAAM,oCAAoC,wHACsE,CAAC;AAExH,eAAO,MAAM,4CAA4C,0GACgD,CAAC;AAE1G,eAAO,MAAM,kCAAkC,+IAC+F,CAAC;AAE/I,eAAO,MAAM,0BAA0B,uGAC+D,CAAC;AAEvG,eAAO,MAAM,8BAA8B,2LAC+I,CAAC;AAE3L,eAAO,MAAM,+BAA+B,6KACgI,CAAC;A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AAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,yBAAyB,CAAC;CAC3C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const HYPERLIQUID_API_BASE = "https://api.hyperliquid.xyz";
|
|
2
|
+
const HYPERLIQUID_EXECUTION_BLOCKED_REASON = "Signed Hyperliquid exchange mutations are disabled until the native app has a real managed or local execution path.";
|
|
3
|
+
const HYPERLIQUID_EXECUTION_NOT_IMPLEMENTED_REASON = "A signer is available, but signed Hyperliquid exchange execution remains disabled in this native app.";
|
|
4
|
+
const HYPERLIQUID_ACCOUNT_BLOCKED_REASON = "Connect a managed Eliza Cloud vault or set HYPERLIQUID_ACCOUNT_ADDRESS / HL_ACCOUNT_ADDRESS to read account-specific positions and orders.";
|
|
5
|
+
const HYPERLIQUID_VAULT_GUIDANCE = "Connect Eliza Cloud or Steward to use a managed vault. Public market reads do not require a vault.";
|
|
6
|
+
const HYPERLIQUID_LOCAL_KEY_GUIDANCE = "Advanced optional path: set EVM_PRIVATE_KEY, HYPERLIQUID_PRIVATE_KEY, or HL_PRIVATE_KEY only when running a local signer intentionally. Public market reads do not require local keys.";
|
|
7
|
+
const HYPERLIQUID_API_WALLET_GUIDANCE = "Optional Hyperliquid API-wallet delegation uses HYPERLIQUID_AGENT_KEY or HL_AGENT_KEY after a managed vault or local signer exists. It is not required for public reads.";
|
|
8
|
+
export {
|
|
9
|
+
HYPERLIQUID_ACCOUNT_BLOCKED_REASON,
|
|
10
|
+
HYPERLIQUID_API_BASE,
|
|
11
|
+
HYPERLIQUID_API_WALLET_GUIDANCE,
|
|
12
|
+
HYPERLIQUID_EXECUTION_BLOCKED_REASON,
|
|
13
|
+
HYPERLIQUID_EXECUTION_NOT_IMPLEMENTED_REASON,
|
|
14
|
+
HYPERLIQUID_LOCAL_KEY_GUIDANCE,
|
|
15
|
+
HYPERLIQUID_VAULT_GUIDANCE
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=hyperliquid-contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hyperliquid-contracts.ts"],"sourcesContent":["export const HYPERLIQUID_API_BASE = \"https://api.hyperliquid.xyz\";\n\nexport const HYPERLIQUID_EXECUTION_BLOCKED_REASON =\n \"Signed Hyperliquid exchange mutations are disabled until the native app has a real managed or local execution path.\";\n\nexport const HYPERLIQUID_EXECUTION_NOT_IMPLEMENTED_REASON =\n \"A signer is available, but signed Hyperliquid exchange execution remains disabled in this native app.\";\n\nexport const HYPERLIQUID_ACCOUNT_BLOCKED_REASON =\n \"Connect a managed Eliza Cloud vault or set HYPERLIQUID_ACCOUNT_ADDRESS / HL_ACCOUNT_ADDRESS to read account-specific positions and orders.\";\n\nexport const HYPERLIQUID_VAULT_GUIDANCE =\n \"Connect Eliza Cloud or Steward to use a managed vault. Public market reads do not require a vault.\";\n\nexport const HYPERLIQUID_LOCAL_KEY_GUIDANCE =\n \"Advanced optional path: set EVM_PRIVATE_KEY, HYPERLIQUID_PRIVATE_KEY, or HL_PRIVATE_KEY only when running a local signer intentionally. Public market reads do not require local keys.\";\n\nexport const HYPERLIQUID_API_WALLET_GUIDANCE =\n \"Optional Hyperliquid API-wallet delegation uses HYPERLIQUID_AGENT_KEY or HL_AGENT_KEY after a managed vault or local signer exists. It is not required for public reads.\";\n\nexport type HyperliquidCredentialMode = \"managed_vault\" | \"local_key\" | \"none\";\n\nexport type HyperliquidAccountSource = \"managed_vault\" | \"env_account\" | \"none\";\n\nexport interface HyperliquidReadinessStatus {\n publicReads: boolean;\n accountReads: boolean;\n signer: boolean;\n execution: false;\n}\n\nexport interface HyperliquidAccountStatus {\n address: string | null;\n source: HyperliquidAccountSource;\n guidance: string | null;\n}\n\nexport interface HyperliquidVaultStatus {\n configured: boolean;\n ready: boolean;\n address: string | null;\n guidance: string;\n}\n\nexport interface HyperliquidApiWalletStatus {\n configured: boolean;\n guidance: string;\n}\n\nexport interface HyperliquidStatusResponse {\n publicReadReady: boolean;\n signerReady: boolean;\n executionReady: boolean;\n executionBlockedReason: string | null;\n accountAddress: string | null;\n apiBaseUrl: string;\n credentialMode: HyperliquidCredentialMode;\n readiness: HyperliquidReadinessStatus;\n account: HyperliquidAccountStatus;\n vault: HyperliquidVaultStatus;\n apiWallet: HyperliquidApiWalletStatus;\n}\n\nexport interface HyperliquidMarket {\n name: string;\n index: number;\n szDecimals: number;\n maxLeverage: number | null;\n onlyIsolated: boolean;\n isDelisted: boolean;\n}\n\nexport interface HyperliquidMarketsResponse {\n markets: HyperliquidMarket[];\n source: \"hyperliquid-info-meta\";\n fetchedAt: string;\n}\n\nexport interface HyperliquidFundingRate {\n coin: string;\n index: number;\n funding: string;\n premium: string | null;\n markPx: string | null;\n oraclePx: string | null;\n openInterest: string | null;\n}\n\nexport interface HyperliquidFundingResponse {\n rates: HyperliquidFundingRate[];\n source: \"hyperliquid-info-meta-and-asset-ctxs\";\n fetchedAt: string;\n}\n\nexport interface HyperliquidPosition {\n coin: string;\n size: string;\n entryPx: string | null;\n positionValue: string | null;\n unrealizedPnl: string | null;\n returnOnEquity: string | null;\n liquidationPx: string | null;\n marginUsed: string | null;\n leverageType: string | null;\n leverageValue: number | null;\n /**\n * Current mark price, derived server-side as `|positionValue| / |size|`.\n * Stringified USD; null when either input is unreadable.\n */\n markPx: string | null;\n /**\n * Distance from the current mark to the liquidation price, as a percent of\n * mark (bigger = safer). Computed server-side against the real mark (not the\n * entry price), so the view never does financial math. Null when mark or\n * liquidation price are unreadable.\n */\n distanceToLiquidationPct: number | null;\n}\n\n/**\n * Account-level margin summary derived from the Hyperliquid\n * `clearinghouseState` `marginSummary` block. Mirrors the waifu patron\n * \"account health\" strip (account value, withdrawable, total notional,\n * aggregate unrealized PnL) so the AppView can render the same hero stats.\n * All values are stringified USD as returned by Hyperliquid; null when the\n * account has never traded or the field is absent.\n */\nexport interface HyperliquidAccountSummary {\n accountValue: string | null;\n totalNotionalPosition: string | null;\n totalMarginUsed: string | null;\n totalRawUsd: string | null;\n withdrawable: string | null;\n /** Sum of per-position unrealized PnL, in USD. Null when unreadable. */\n totalUnrealizedPnl: string | null;\n /**\n * Effective account leverage = `totalNotionalPosition / accountValue`,\n * computed server-side. Null when either input is unreadable or account value\n * is non-positive.\n */\n effectiveLeverage: number | null;\n}\n\nexport interface HyperliquidPositionsResponse {\n accountAddress: string | null;\n positions: HyperliquidPosition[];\n /**\n * Account margin/value summary. Optional for back-compat: older route\n * builds and the no-account path omit it (null).\n */\n summary: HyperliquidAccountSummary | null;\n readBlockedReason: string | null;\n fetchedAt: string | null;\n}\n\nexport interface HyperliquidOrder {\n coin: string;\n side: string;\n limitPx: string;\n size: string;\n oid: number;\n timestamp: number;\n reduceOnly: boolean;\n orderType: string | null;\n tif: string | null;\n cloid: string | null;\n}\n\nexport interface HyperliquidOrdersResponse {\n accountAddress: string | null;\n orders: HyperliquidOrder[];\n readBlockedReason: string | null;\n fetchedAt: string | null;\n}\n\nexport interface HyperliquidExecutionDisabledResponse {\n executionReady: false;\n executionBlockedReason: string;\n credentialMode: HyperliquidCredentialMode;\n}\n"],"mappings":"AAAO,MAAM,uBAAuB;AAE7B,MAAM,uCACX;AAEK,MAAM,+CACX;AAEK,MAAM,qCACX;AAEK,MAAM,6BACX;AAEK,MAAM,iCACX;AAEK,MAAM,kCACX;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./actions/perpetual-market";
|
|
2
|
+
export * from "./client";
|
|
3
|
+
export * from "./HyperliquidAppView";
|
|
4
|
+
export { interact } from "./HyperliquidAppView.interact";
|
|
5
|
+
export { HyperliquidView } from "./HyperliquidView";
|
|
6
|
+
export { HYPERLIQUID_APP_NAME, hyperliquidApp } from "./hyperliquid-app";
|
|
7
|
+
export * from "./hyperliquid-contracts";
|
|
8
|
+
export { hyperliquidPlugin } from "./plugin";
|
|
9
|
+
export * from "./register";
|
|
10
|
+
export * from "./routes";
|
|
11
|
+
export * from "./useHyperliquidState";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzE,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "./actions/perpetual-market.js";
|
|
2
|
+
export * from "./client.js";
|
|
3
|
+
export * from "./HyperliquidAppView.js";
|
|
4
|
+
import { interact } from "./HyperliquidAppView.interact";
|
|
5
|
+
import { HyperliquidView } from "./HyperliquidView.js";
|
|
6
|
+
import { HYPERLIQUID_APP_NAME, hyperliquidApp } from "./hyperliquid-app.js";
|
|
7
|
+
export * from "./hyperliquid-contracts.js";
|
|
8
|
+
import { hyperliquidPlugin } from "./plugin.js";
|
|
9
|
+
export * from "./register.js";
|
|
10
|
+
export * from "./routes.js";
|
|
11
|
+
export * from "./useHyperliquidState.js";
|
|
12
|
+
export {
|
|
13
|
+
HYPERLIQUID_APP_NAME,
|
|
14
|
+
HyperliquidView,
|
|
15
|
+
hyperliquidApp,
|
|
16
|
+
hyperliquidPlugin,
|
|
17
|
+
interact
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./actions/perpetual-market.js\";\nexport * from \"./client.js\";\nexport * from \"./HyperliquidAppView.js\";\nexport { interact } from \"./HyperliquidAppView.interact\";\nexport { HyperliquidView } from \"./HyperliquidView.js\";\nexport { HYPERLIQUID_APP_NAME, hyperliquidApp } from \"./hyperliquid-app.js\";\nexport * from \"./hyperliquid-contracts.js\";\nexport { hyperliquidPlugin } from \"./plugin.js\";\nexport * from \"./register.js\";\nexport * from \"./routes.js\";\nexport * from \"./useHyperliquidState.js\";\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB,sBAAsB;AACrD,cAAc;AACd,SAAS,yBAAyB;AAClC,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,MAAM,EAIP,MAAM,eAAe,CAAC;AAgHvB,eAAO,MAAM,iBAAiB,EAAE,MAiC/B,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hyperliquidActions,
|
|
3
|
+
PERPETUAL_MARKET_SERVICE_TYPE,
|
|
4
|
+
PerpetualMarketService
|
|
5
|
+
} from "./actions/perpetual-market.js";
|
|
6
|
+
import { handleHyperliquidRoute } from "./routes.js";
|
|
7
|
+
function toHttpIncomingMessage(req) {
|
|
8
|
+
if (typeof req !== "object" || req === null || typeof req.method !== "string" || typeof req.headers !== "object") {
|
|
9
|
+
throw new TypeError("Hyperliquid routes require a Node HTTP request");
|
|
10
|
+
}
|
|
11
|
+
return req;
|
|
12
|
+
}
|
|
13
|
+
function toHttpServerResponse(res) {
|
|
14
|
+
if (typeof res !== "object" || res === null || typeof res.end !== "function" || typeof res.setHeader !== "function") {
|
|
15
|
+
throw new TypeError("Hyperliquid routes require a Node HTTP response");
|
|
16
|
+
}
|
|
17
|
+
return res;
|
|
18
|
+
}
|
|
19
|
+
function hyperliquidRouteHandler(pathname) {
|
|
20
|
+
return async (req, res) => {
|
|
21
|
+
const httpReq = toHttpIncomingMessage(req);
|
|
22
|
+
const httpRes = toHttpServerResponse(res);
|
|
23
|
+
const method = (httpReq.method ?? "GET").toUpperCase();
|
|
24
|
+
await handleHyperliquidRoute(httpReq, httpRes, pathname, method);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const hyperliquidRoutes = [
|
|
28
|
+
{
|
|
29
|
+
type: "GET",
|
|
30
|
+
path: "/api/hyperliquid/status",
|
|
31
|
+
rawPath: true,
|
|
32
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/status")
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "GET",
|
|
36
|
+
path: "/api/hyperliquid/markets",
|
|
37
|
+
rawPath: true,
|
|
38
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/markets")
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: "GET",
|
|
42
|
+
path: "/api/hyperliquid/funding",
|
|
43
|
+
rawPath: true,
|
|
44
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/funding")
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "GET",
|
|
48
|
+
path: "/api/hyperliquid/positions",
|
|
49
|
+
rawPath: true,
|
|
50
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/positions")
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: "GET",
|
|
54
|
+
path: "/api/hyperliquid/orders",
|
|
55
|
+
rawPath: true,
|
|
56
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/orders")
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "POST",
|
|
60
|
+
path: "/api/hyperliquid/orders/open",
|
|
61
|
+
rawPath: true,
|
|
62
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/orders/open")
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "POST",
|
|
66
|
+
path: "/api/hyperliquid/orders/close",
|
|
67
|
+
rawPath: true,
|
|
68
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/orders/close")
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "POST",
|
|
72
|
+
path: "/api/hyperliquid/leverage",
|
|
73
|
+
rawPath: true,
|
|
74
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/leverage")
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "POST",
|
|
78
|
+
path: "/api/hyperliquid/margin",
|
|
79
|
+
rawPath: true,
|
|
80
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/margin")
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: "POST",
|
|
84
|
+
path: "/api/hyperliquid/bridge",
|
|
85
|
+
rawPath: true,
|
|
86
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/bridge")
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "POST",
|
|
90
|
+
path: "/api/hyperliquid/tpsl",
|
|
91
|
+
rawPath: true,
|
|
92
|
+
handler: hyperliquidRouteHandler("/api/hyperliquid/tpsl")
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
const hyperliquidPlugin = {
|
|
96
|
+
name: "@elizaos/plugin-hyperliquid-app",
|
|
97
|
+
description: "Native Hyperliquid perpetual market status, market, position, and trading-readiness routes/actions for elizaOS",
|
|
98
|
+
actions: hyperliquidActions,
|
|
99
|
+
services: [PerpetualMarketService],
|
|
100
|
+
routes: hyperliquidRoutes,
|
|
101
|
+
views: [
|
|
102
|
+
// ONE declaration → GUI + XR + TUI, all drawn from the single
|
|
103
|
+
// HyperliquidView spatial source. `modalities` is a plain literal here
|
|
104
|
+
// (plugin.ts is not in the view bundle), so no brand-new `@elizaos/core`
|
|
105
|
+
// runtime export reaches the bundle build.
|
|
106
|
+
{
|
|
107
|
+
id: "hyperliquid",
|
|
108
|
+
label: "Hyperliquid",
|
|
109
|
+
description: "Hyperliquid perpetual markets \u2014 positions, trading status, and market data",
|
|
110
|
+
icon: "TrendingUp",
|
|
111
|
+
path: "/hyperliquid",
|
|
112
|
+
modalities: ["gui", "xr", "tui"],
|
|
113
|
+
bundlePath: "dist/views/bundle.js",
|
|
114
|
+
componentExport: "HyperliquidView",
|
|
115
|
+
tags: ["trading", "perps", "hyperliquid", "crypto"],
|
|
116
|
+
visibleInManager: true,
|
|
117
|
+
desktopTabEnabled: true
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
async dispose(runtime) {
|
|
121
|
+
const svc = runtime.getService(
|
|
122
|
+
PERPETUAL_MARKET_SERVICE_TYPE
|
|
123
|
+
);
|
|
124
|
+
await svc?.stop();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
hyperliquidPlugin
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import type http from \"node:http\";\nimport type {\n IAgentRuntime,\n Plugin,\n Route,\n RouteRequest,\n RouteResponse,\n} from \"@elizaos/core\";\nimport {\n hyperliquidActions,\n PERPETUAL_MARKET_SERVICE_TYPE,\n PerpetualMarketService,\n} from \"./actions/perpetual-market.js\";\nimport { handleHyperliquidRoute } from \"./routes.js\";\n\nfunction toHttpIncomingMessage(req: RouteRequest): http.IncomingMessage {\n if (\n typeof req !== \"object\" ||\n req === null ||\n typeof req.method !== \"string\" ||\n typeof req.headers !== \"object\"\n ) {\n throw new TypeError(\"Hyperliquid routes require a Node HTTP request\");\n }\n return req as http.IncomingMessage;\n}\n\nfunction toHttpServerResponse(res: RouteResponse): http.ServerResponse {\n if (\n typeof res !== \"object\" ||\n res === null ||\n typeof res.end !== \"function\" ||\n typeof res.setHeader !== \"function\"\n ) {\n throw new TypeError(\"Hyperliquid routes require a Node HTTP response\");\n }\n return res as unknown as http.ServerResponse;\n}\n\nfunction hyperliquidRouteHandler(\n pathname: string,\n): NonNullable<Route[\"handler\"]> {\n return async (req, res) => {\n const httpReq = toHttpIncomingMessage(req);\n const httpRes = toHttpServerResponse(res);\n const method = (httpReq.method ?? \"GET\").toUpperCase();\n await handleHyperliquidRoute(httpReq, httpRes, pathname, method);\n };\n}\n\nconst hyperliquidRoutes: Route[] = [\n {\n type: \"GET\",\n path: \"/api/hyperliquid/status\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/status\"),\n },\n {\n type: \"GET\",\n path: \"/api/hyperliquid/markets\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/markets\"),\n },\n {\n type: \"GET\",\n path: \"/api/hyperliquid/funding\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/funding\"),\n },\n {\n type: \"GET\",\n path: \"/api/hyperliquid/positions\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/positions\"),\n },\n {\n type: \"GET\",\n path: \"/api/hyperliquid/orders\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/orders\"),\n },\n {\n type: \"POST\",\n path: \"/api/hyperliquid/orders/open\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/orders/open\"),\n },\n {\n type: \"POST\",\n path: \"/api/hyperliquid/orders/close\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/orders/close\"),\n },\n {\n type: \"POST\",\n path: \"/api/hyperliquid/leverage\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/leverage\"),\n },\n {\n type: \"POST\",\n path: \"/api/hyperliquid/margin\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/margin\"),\n },\n {\n type: \"POST\",\n path: \"/api/hyperliquid/bridge\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/bridge\"),\n },\n {\n type: \"POST\",\n path: \"/api/hyperliquid/tpsl\",\n rawPath: true,\n handler: hyperliquidRouteHandler(\"/api/hyperliquid/tpsl\"),\n },\n];\n\nexport const hyperliquidPlugin: Plugin = {\n name: \"@elizaos/plugin-hyperliquid-app\",\n description:\n \"Native Hyperliquid perpetual market status, market, position, and trading-readiness routes/actions for elizaOS\",\n actions: hyperliquidActions,\n services: [PerpetualMarketService],\n routes: hyperliquidRoutes,\n views: [\n // ONE declaration → GUI + XR + TUI, all drawn from the single\n // HyperliquidView spatial source. `modalities` is a plain literal here\n // (plugin.ts is not in the view bundle), so no brand-new `@elizaos/core`\n // runtime export reaches the bundle build.\n {\n id: \"hyperliquid\",\n label: \"Hyperliquid\",\n description:\n \"Hyperliquid perpetual markets — positions, trading status, and market data\",\n icon: \"TrendingUp\",\n path: \"/hyperliquid\",\n modalities: [\"gui\", \"xr\", \"tui\"],\n bundlePath: \"dist/views/bundle.js\",\n componentExport: \"HyperliquidView\",\n tags: [\"trading\", \"perps\", \"hyperliquid\", \"crypto\"],\n visibleInManager: true,\n desktopTabEnabled: true,\n },\n ],\n async dispose(runtime: IAgentRuntime) {\n const svc = runtime.getService<PerpetualMarketService>(\n PERPETUAL_MARKET_SERVICE_TYPE,\n );\n await svc?.stop();\n },\n};\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AAEvC,SAAS,sBAAsB,KAAyC;AACtE,MACE,OAAO,QAAQ,YACf,QAAQ,QACR,OAAO,IAAI,WAAW,YACtB,OAAO,IAAI,YAAY,UACvB;AACA,UAAM,IAAI,UAAU,gDAAgD;AAAA,EACtE;AACA,SAAO;AACT;AAEA,SAAS,qBAAqB,KAAyC;AACrE,MACE,OAAO,QAAQ,YACf,QAAQ,QACR,OAAO,IAAI,QAAQ,cACnB,OAAO,IAAI,cAAc,YACzB;AACA,UAAM,IA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AAS,wBAAwB,yBAAyB;AAAA,EAC5D;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,wBAAwB,yBAAyB;AAAA,EAC5D;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,wBAAwB,uBAAuB;AAAA,EAC1D;AACF;AAEO,MAAM,oBAA4B;AAAA,EACvC,MAAM;AAAA,EACN,aACE;AAAA,EACF,SAAS;AAAA,EACT,UAAU,CAAC,sBAAsB;AAAA,EACjC,QAAQ;AAAA,EACR,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aACE;AAAA,MACF,MAAM;AAAA,MACN,MAAM;AAAA,MACN,YAAY,CAAC,OAAO,MAAM,KAAK;AAAA,MAC/B,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,MAAM,CAAC,WAAW,SAAS,eAAe,QAAQ;AAAA,MAClD,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,IACrB;AAAA,EACF;AAAA,EACA,MAAM,QAAQ,SAAwB;AACpC,UAAM,MAAM,QAAQ;AAAA,MAClB;AAAA,IACF;AACA,UAAM,KAAK,KAAK;AAAA,EAClB;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-routes.d.ts","sourceRoot":"","sources":["../src/register-routes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { registerAppRoutePluginLoader } from "@elizaos/core";
|
|
2
|
+
registerAppRoutePluginLoader("@elizaos/plugin-hyperliquid-app", async () => {
|
|
3
|
+
const { hyperliquidPlugin } = await import("./plugin.js");
|
|
4
|
+
return hyperliquidPlugin;
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=register-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register-routes.ts"],"sourcesContent":["import { registerAppRoutePluginLoader } from \"@elizaos/core\";\n\nregisterAppRoutePluginLoader(\"@elizaos/plugin-hyperliquid-app\", async () => {\n const { hyperliquidPlugin } = await import(\"./plugin.js\");\n return hyperliquidPlugin;\n});\n"],"mappings":"AAAA,SAAS,oCAAoC;AAE7C,6BAA6B,mCAAmC,YAAY;AAC1E,QAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,aAAa;AACxD,SAAO;AACT,CAAC;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register the Hyperliquid view for terminal rendering.
|
|
3
|
+
*
|
|
4
|
+
* The agent terminal mounts plugin views by id from the `@elizaos/tui` terminal
|
|
5
|
+
* registry. This makes the plugin's `viewType: "tui"` declaration render for
|
|
6
|
+
* real in the terminal (the unified {@link HyperliquidSpatialView}) rather than
|
|
7
|
+
* only navigating a GUI shell. A module-level snapshot lets a host push live
|
|
8
|
+
* read state; without one it defaults to a read-blocked, empty dashboard.
|
|
9
|
+
*/
|
|
10
|
+
import { type HyperliquidSnapshot } from "./components/HyperliquidSpatialView.tsx";
|
|
11
|
+
/** Update the snapshot the registered terminal view renders from. */
|
|
12
|
+
export declare function setHyperliquidTerminalSnapshot(next: HyperliquidSnapshot): void;
|
|
13
|
+
/** Register the Hyperliquid terminal view; returns an unregister function. */
|
|
14
|
+
export declare function registerHyperliquidTerminalView(): () => void;
|
|
15
|
+
//# sourceMappingURL=register-terminal-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-terminal-view.d.ts","sourceRoot":"","sources":["../src/register-terminal-view.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,yCAAyC,CAAC;AAmBjD,qEAAqE;AACrE,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,mBAAmB,GACxB,IAAI,CAEN;AAED,8EAA8E;AAC9E,wBAAgB,+BAA+B,IAAI,MAAM,IAAI,CAI5D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { registerSpatialTerminalView } from "@elizaos/ui/spatial/tui";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import {
|
|
4
|
+
HyperliquidSpatialView
|
|
5
|
+
} from "./components/HyperliquidSpatialView.js";
|
|
6
|
+
const EMPTY = {
|
|
7
|
+
status: {
|
|
8
|
+
publicReadReady: false,
|
|
9
|
+
signerReady: false,
|
|
10
|
+
executionReady: false,
|
|
11
|
+
credentialMode: "none",
|
|
12
|
+
accountAddress: null,
|
|
13
|
+
vaultReady: false,
|
|
14
|
+
executionBlockedReason: null
|
|
15
|
+
},
|
|
16
|
+
markets: [],
|
|
17
|
+
positions: [],
|
|
18
|
+
orders: []
|
|
19
|
+
};
|
|
20
|
+
let current = EMPTY;
|
|
21
|
+
function setHyperliquidTerminalSnapshot(next) {
|
|
22
|
+
current = next;
|
|
23
|
+
}
|
|
24
|
+
function registerHyperliquidTerminalView() {
|
|
25
|
+
return registerSpatialTerminalView(
|
|
26
|
+
"hyperliquid",
|
|
27
|
+
() => createElement(HyperliquidSpatialView, { snapshot: current })
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
registerHyperliquidTerminalView,
|
|
32
|
+
setHyperliquidTerminalSnapshot
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=register-terminal-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register-terminal-view.tsx"],"sourcesContent":["/**\n * Register the Hyperliquid view for terminal rendering.\n *\n * The agent terminal mounts plugin views by id from the `@elizaos/tui` terminal\n * registry. This makes the plugin's `viewType: \"tui\"` declaration render for\n * real in the terminal (the unified {@link HyperliquidSpatialView}) rather than\n * only navigating a GUI shell. A module-level snapshot lets a host push live\n * read state; without one it defaults to a read-blocked, empty dashboard.\n */\n\nimport { registerSpatialTerminalView } from \"@elizaos/ui/spatial/tui\";\nimport { createElement } from \"react\";\nimport {\n type HyperliquidSnapshot,\n HyperliquidSpatialView,\n} from \"./components/HyperliquidSpatialView.js\";\n\nconst EMPTY: HyperliquidSnapshot = {\n status: {\n publicReadReady: false,\n signerReady: false,\n executionReady: false,\n credentialMode: \"none\",\n accountAddress: null,\n vaultReady: false,\n executionBlockedReason: null,\n },\n markets: [],\n positions: [],\n orders: [],\n};\n\nlet current: HyperliquidSnapshot = EMPTY;\n\n/** Update the snapshot the registered terminal view renders from. */\nexport function setHyperliquidTerminalSnapshot(\n next: HyperliquidSnapshot,\n): void {\n current = next;\n}\n\n/** Register the Hyperliquid terminal view; returns an unregister function. */\nexport function registerHyperliquidTerminalView(): () => void {\n return registerSpatialTerminalView(\"hyperliquid\", () =>\n createElement(HyperliquidSpatialView, { snapshot: current }),\n );\n}\n"],"mappings":"AAUA,SAAS,mCAAmC;AAC5C,SAAS,qBAAqB;AAC9B;AAAA,EAEE;AAAA,OACK;AAEP,MAAM,QAA6B;AAAA,EACjC,QAAQ;AAAA,IACN,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,wBAAwB;AAAA,EAC1B;AAAA,EACA,SAAS,CAAC;AAAA,EACV,WAAW,CAAC;AAAA,EACZ,QAAQ,CAAC;AACX;AAEA,IAAI,UAA+B;AAG5B,SAAS,+BACd,MACM;AACN,YAAU;AACZ;AAGO,SAAS,kCAA8C;AAC5D,SAAO;AAAA,IAA4B;AAAA,IAAe,MAChD,cAAc,wBAAwB,EAAE,UAAU,QAAQ,CAAC;AAAA,EAC7D;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC"}
|
package/dist/register.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./hyperliquid-app.js";
|
|
2
|
+
import { registerAppShellPage } from "@elizaos/ui/app-shell-registry";
|
|
3
|
+
if (typeof window === "undefined") {
|
|
4
|
+
void import("./register-terminal-view.js").then((m) => m.registerHyperliquidTerminalView()).catch(() => {
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
registerAppShellPage({
|
|
8
|
+
id: "hyperliquid",
|
|
9
|
+
pluginId: "@elizaos/plugin-hyperliquid-app",
|
|
10
|
+
label: "Hyperliquid",
|
|
11
|
+
icon: "TrendingUp",
|
|
12
|
+
path: "/hyperliquid",
|
|
13
|
+
loader: () => import("./hyperliquid-app-view-bundle.js").then((m) => ({
|
|
14
|
+
default: m.HyperliquidView
|
|
15
|
+
}))
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/register.ts"],"sourcesContent":["import \"./hyperliquid-app.js\";\nimport { registerAppShellPage } from \"@elizaos/ui/app-shell-registry\";\n\n// In a terminal host (the Node agent, no DOM), register the Hyperliquid view so\n// it renders inline in the terminal. Lazy + DOM-guarded so the terminal engine\n// stays out of browser/mobile bundles.\nif (typeof window === \"undefined\") {\n void import(\"./register-terminal-view.js\")\n .then((m) => m.registerHyperliquidTerminalView())\n .catch(() => {\n // Terminal rendering is best-effort; never block plugin load.\n });\n}\n\n// iOS/Android disable DynamicViewLoader, so register this view's already-bundled\n// component as an in-process app-shell page. Web/desktop dedupe it against the\n// agent-served bundle entry (network wins -> DynamicViewLoader), so it only adds\n// the render path on native. See packages/app/src/mobile-plugin-views.ts.\nregisterAppShellPage({\n id: \"hyperliquid\",\n pluginId: \"@elizaos/plugin-hyperliquid-app\",\n label: \"Hyperliquid\",\n icon: \"TrendingUp\",\n path: \"/hyperliquid\",\n loader: () =>\n import(\"./hyperliquid-app-view-bundle.js\").then((m) => ({\n default: m.HyperliquidView,\n })),\n});\n"],"mappings":"AAAA,OAAO;AACP,SAAS,4BAA4B;AAKrC,IAAI,OAAO,WAAW,aAAa;AACjC,OAAK,OAAO,6BAA6B,EACtC,KAAK,CAAC,MAAM,EAAE,gCAAgC,CAAC,EAC/C,MAAM,MAAM;AAAA,EAEb,CAAC;AACL;AAMA,qBAAqB;AAAA,EACnB,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ,MACN,OAAO,kCAAkC,EAAE,KAAK,CAAC,OAAO;AAAA,IACtD,SAAS,EAAE;AAAA,EACb,EAAE;AACN,CAAC;","names":[]}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type http from "node:http";
|
|
2
|
+
import { type HyperliquidAccountSummary, type HyperliquidFundingRate, type HyperliquidMarket, type HyperliquidOrder, type HyperliquidPosition } from "./hyperliquid-contracts";
|
|
3
|
+
export type HyperliquidFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
export interface HyperliquidRouteState {
|
|
5
|
+
fetchImpl?: HyperliquidFetch;
|
|
6
|
+
env?: NodeJS.ProcessEnv;
|
|
7
|
+
now?: () => Date;
|
|
8
|
+
}
|
|
9
|
+
interface HyperliquidClearinghouseSnapshot {
|
|
10
|
+
positions: HyperliquidPosition[];
|
|
11
|
+
summary: HyperliquidAccountSummary;
|
|
12
|
+
}
|
|
13
|
+
interface HyperliquidInfoClient {
|
|
14
|
+
getMarkets(): Promise<HyperliquidMarket[]>;
|
|
15
|
+
getFundingRates(): Promise<HyperliquidFundingRate[]>;
|
|
16
|
+
getPositions(accountAddress: string): Promise<HyperliquidClearinghouseSnapshot>;
|
|
17
|
+
getOpenOrders(accountAddress: string): Promise<HyperliquidOrder[]>;
|
|
18
|
+
}
|
|
19
|
+
export declare function handleHyperliquidRoute(_req: http.IncomingMessage, res: http.ServerResponse, pathname: string, method: string, state?: HyperliquidRouteState): Promise<boolean>;
|
|
20
|
+
export declare function createHyperliquidInfoClient({ fetchImpl, apiBaseUrl, }: {
|
|
21
|
+
fetchImpl: HyperliquidFetch;
|
|
22
|
+
apiBaseUrl?: string;
|
|
23
|
+
}): HyperliquidInfoClient;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EASL,KAAK,yBAAyB,EAI9B,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAErB,KAAK,mBAAmB,EAGzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,gBAAgB,GAAG,CAC7B,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAmBD,UAAU,gCAAgC;IACxC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,OAAO,EAAE,yBAAyB,CAAC;CACpC;AAED,UAAU,qBAAqB;IAC7B,UAAU,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC3C,eAAe,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACrD,YAAY,CACV,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC7C,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;CACpE;AAOD,wBAAsB,sBAAsB,CAC1C,IAAI,EA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