@xploai/core 1.0.12 → 1.0.14
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/adapters.test.js +136 -8
- package/dist/adapters.test.js.map +1 -1
- package/dist/agent-auth-hint.d.ts +16 -0
- package/dist/agent-auth-hint.js +85 -0
- package/dist/agent-auth-hint.js.map +1 -0
- package/dist/agent-auth-hint.test.d.ts +1 -0
- package/dist/agent-auth-hint.test.js +72 -0
- package/dist/agent-auth-hint.test.js.map +1 -0
- package/dist/audit.d.ts +39 -1
- package/dist/audit.js +160 -14
- package/dist/audit.js.map +1 -1
- package/dist/audit.test.d.ts +1 -0
- package/dist/audit.test.js +90 -0
- package/dist/audit.test.js.map +1 -0
- package/dist/claude-code-adapter.d.ts +3 -0
- package/dist/claude-code-adapter.js +9 -3
- package/dist/claude-code-adapter.js.map +1 -1
- package/dist/claw-adapter.js +1 -1
- package/dist/claw-adapter.js.map +1 -1
- package/dist/cli-adapter.d.ts +7 -0
- package/dist/cli-adapter.js +24 -0
- package/dist/cli-adapter.js.map +1 -1
- package/dist/codex-adapter.d.ts +10 -0
- package/dist/codex-adapter.js +80 -13
- package/dist/codex-adapter.js.map +1 -1
- package/dist/grokbot-adapter.d.ts +11 -0
- package/dist/grokbot-adapter.js +44 -2
- package/dist/grokbot-adapter.js.map +1 -1
- package/dist/hyperliquid-adapter.d.ts +79 -0
- package/dist/hyperliquid-adapter.js +474 -0
- package/dist/hyperliquid-adapter.js.map +1 -0
- package/dist/hyperliquid-adapter.test.d.ts +1 -0
- package/dist/hyperliquid-adapter.test.js +366 -0
- package/dist/hyperliquid-adapter.test.js.map +1 -0
- package/dist/hyperliquid-journal.d.ts +1 -0
- package/dist/hyperliquid-journal.js +41 -0
- package/dist/hyperliquid-journal.js.map +1 -0
- package/dist/hyperliquid-network.d.ts +18 -0
- package/dist/hyperliquid-network.js +36 -0
- package/dist/hyperliquid-network.js.map +1 -0
- package/dist/hyperliquid-network.test.d.ts +1 -0
- package/dist/hyperliquid-network.test.js +26 -0
- package/dist/hyperliquid-network.test.js.map +1 -0
- package/dist/hyperliquid-path.d.ts +13 -0
- package/dist/hyperliquid-path.js +27 -0
- package/dist/hyperliquid-path.js.map +1 -0
- package/dist/hyperliquid-strategy-limits.d.ts +53 -0
- package/dist/hyperliquid-strategy-limits.js +118 -0
- package/dist/hyperliquid-strategy-limits.js.map +1 -0
- package/dist/hyperliquid-strategy-limits.test.d.ts +1 -0
- package/dist/hyperliquid-strategy-limits.test.js +87 -0
- package/dist/hyperliquid-strategy-limits.test.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/onchainos-guard-bin.d.ts +2 -0
- package/dist/onchainos-guard-bin.js +75 -0
- package/dist/onchainos-guard-bin.js.map +1 -0
- package/dist/onchainos-path.d.ts +1 -0
- package/dist/onchainos-path.js +1 -1
- package/dist/onchainos-path.js.map +1 -1
- package/dist/signer-binding.d.ts +45 -0
- package/dist/signer-binding.js +121 -0
- package/dist/signer-binding.js.map +1 -0
- package/dist/signer-binding.test.d.ts +1 -0
- package/dist/signer-binding.test.js +221 -0
- package/dist/signer-binding.test.js.map +1 -0
- package/dist/strategy-quotes.d.ts +5 -0
- package/dist/strategy-quotes.js +195 -0
- package/dist/strategy-quotes.js.map +1 -0
- package/dist/strategy-quotes.test.d.ts +1 -0
- package/dist/strategy-quotes.test.js +99 -0
- package/dist/strategy-quotes.test.js.map +1 -0
- package/dist/swap-intent.d.ts +7 -0
- package/dist/swap-intent.js +65 -0
- package/dist/swap-intent.js.map +1 -0
- package/dist/swap-intent.test.d.ts +1 -0
- package/dist/swap-intent.test.js +64 -0
- package/dist/swap-intent.test.js.map +1 -0
- package/dist/write-guard.d.ts +100 -0
- package/dist/write-guard.js +451 -0
- package/dist/write-guard.js.map +1 -0
- package/dist/write-guard.test.d.ts +1 -0
- package/dist/write-guard.test.js +448 -0
- package/dist/write-guard.test.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperliquid-path.js","sourceRoot":"","sources":["../src/hyperliquid-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,2BAA2B,GAAG,EAAE,EAAE,qBAAqB,GAAG,EAAE,CAAU,CAAC;AAE7G;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC1E,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9C,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;YACzC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAClC,IAAI,gBAAgB,CAAC,SAAS,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SpotStrategyAuthorizer, StrategyAuthorizer } from "./hyperliquid-adapter.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a strategy may do on this machine. The user sets it when starting the daemon, so the
|
|
4
|
+
* ceiling on automatic spending lives on the machine that signs, not in the backend.
|
|
5
|
+
*/
|
|
6
|
+
export interface StrategyLimits {
|
|
7
|
+
/** Coins a strategy may trade, upper case. Anything else is refused. */
|
|
8
|
+
coins: string[];
|
|
9
|
+
/** Largest single order, size times limit price, in USD. */
|
|
10
|
+
maxOrderUsd: number;
|
|
11
|
+
/** Highest leverage an order may ask for. When set, an order must name its leverage. */
|
|
12
|
+
maxLeverage?: number;
|
|
13
|
+
}
|
|
14
|
+
export type StrategyLimitsResult = {
|
|
15
|
+
ok: true;
|
|
16
|
+
limits: StrategyLimits | undefined;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
export interface SpotStrategyLimits {
|
|
22
|
+
pairs: string[];
|
|
23
|
+
maxOrderUsd: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads the daemon's strategy options. Nothing set means strategies stay off (limits undefined).
|
|
27
|
+
* A half-set configuration is an error: a missing ceiling must never read as "no ceiling".
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseStrategyLimits(input: {
|
|
30
|
+
coins?: string;
|
|
31
|
+
maxOrderUsd?: string;
|
|
32
|
+
maxLeverage?: string;
|
|
33
|
+
}): StrategyLimitsResult;
|
|
34
|
+
export declare function parseSpotStrategyLimits(input: {
|
|
35
|
+
pairs?: string;
|
|
36
|
+
maxOrderUsd?: string;
|
|
37
|
+
}): {
|
|
38
|
+
ok: true;
|
|
39
|
+
limits?: SpotStrategyLimits;
|
|
40
|
+
} | {
|
|
41
|
+
ok: false;
|
|
42
|
+
error: string;
|
|
43
|
+
};
|
|
44
|
+
export declare function createSpotLimitAuthorizer(limits: SpotStrategyLimits): SpotStrategyAuthorizer;
|
|
45
|
+
/**
|
|
46
|
+
* The authorizer behind `--hyperliquid-strategy-*`. It judges the intent alone, with no help from
|
|
47
|
+
* the backend:
|
|
48
|
+
* - an order must be a limit order, so its worth (size times price) is known before signing;
|
|
49
|
+
* - strict reduce-only orders retain the coin and order-value checks, and use the venue's existing leverage;
|
|
50
|
+
* - close, take-profit/stop-loss and cancel intents need only an allowed coin;
|
|
51
|
+
* - deposit, withdraw and register never run for a strategy, whatever the limits are.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createLimitAuthorizer(limits: StrategyLimits): StrategyAuthorizer;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { HyperliquidSpotPair } from "@xploai/shared";
|
|
2
|
+
function parseOrderCeiling(text) {
|
|
3
|
+
const value = Number(text);
|
|
4
|
+
const canonical = text.replace(/^0+(?=\d)/, "").replace(/(\.\d*?[1-9])0+$|\.0+$/, "$1");
|
|
5
|
+
if (/^\d+(\.\d+)?$/.test(text) && String(value) === canonical && value > 0)
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reads the daemon's strategy options. Nothing set means strategies stay off (limits undefined).
|
|
10
|
+
* A half-set configuration is an error: a missing ceiling must never read as "no ceiling".
|
|
11
|
+
*/
|
|
12
|
+
export function parseStrategyLimits(input) {
|
|
13
|
+
const coinsText = input.coins?.trim() ?? "";
|
|
14
|
+
const maxOrderText = input.maxOrderUsd?.trim() ?? "";
|
|
15
|
+
const leverageText = input.maxLeverage?.trim() ?? "";
|
|
16
|
+
if (coinsText === "" && maxOrderText === "" && leverageText === "")
|
|
17
|
+
return { ok: true, limits: undefined };
|
|
18
|
+
if (coinsText === "" || maxOrderText === "") {
|
|
19
|
+
return { ok: false, error: "Hyperliquid strategy trading needs both --hyperliquid-strategy-coins and --hyperliquid-strategy-max-order-usd" };
|
|
20
|
+
}
|
|
21
|
+
const coins = [...new Set(coinsText.split(",").map((coin) => coin.trim().toUpperCase()).filter(Boolean))];
|
|
22
|
+
if (coins.length === 0 || coins.some((coin) => !/^[A-Z0-9]{1,12}$/.test(coin))) {
|
|
23
|
+
return { ok: false, error: "--hyperliquid-strategy-coins must be a comma separated list of coin symbols such as BTC,ETH" };
|
|
24
|
+
}
|
|
25
|
+
const maxOrderUsd = parseOrderCeiling(maxOrderText);
|
|
26
|
+
if (maxOrderUsd === undefined) {
|
|
27
|
+
return { ok: false, error: "--hyperliquid-strategy-max-order-usd must be a positive number" };
|
|
28
|
+
}
|
|
29
|
+
let maxLeverage;
|
|
30
|
+
if (leverageText !== "") {
|
|
31
|
+
maxLeverage = Number(leverageText);
|
|
32
|
+
if (!/^\d{1,3}$/.test(leverageText) || maxLeverage < 1 || maxLeverage > 100) {
|
|
33
|
+
return { ok: false, error: "--hyperliquid-strategy-max-leverage must be a whole number from 1 to 100" };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { ok: true, limits: { coins, maxOrderUsd, ...(maxLeverage !== undefined ? { maxLeverage } : {}) } };
|
|
37
|
+
}
|
|
38
|
+
export function parseSpotStrategyLimits(input) {
|
|
39
|
+
const pairsText = input.pairs?.trim() ?? "";
|
|
40
|
+
const maxOrderText = input.maxOrderUsd?.trim() ?? "";
|
|
41
|
+
if (!pairsText && !maxOrderText)
|
|
42
|
+
return { ok: true };
|
|
43
|
+
if (!pairsText || !maxOrderText) {
|
|
44
|
+
return { ok: false, error: "Hyperliquid spot strategies need both --hyperliquid-spot-strategy-pairs and --hyperliquid-spot-strategy-max-order-usd" };
|
|
45
|
+
}
|
|
46
|
+
const pairs = [...new Set(pairsText.split(",").map(pair => pair.trim()))];
|
|
47
|
+
if (pairs.length > 100 || pairs.some(pair => !HyperliquidSpotPair.safeParse(pair).success)) {
|
|
48
|
+
return { ok: false, error: "--hyperliquid-spot-strategy-pairs needs up to 100 canonical USDC pair ids, e.g. PURR/USDC,@107" };
|
|
49
|
+
}
|
|
50
|
+
const maxOrderUsd = parseOrderCeiling(maxOrderText);
|
|
51
|
+
return maxOrderUsd === undefined ? { ok: false, error: "--hyperliquid-spot-strategy-max-order-usd must be a positive number" }
|
|
52
|
+
: { ok: true, limits: { pairs, maxOrderUsd } };
|
|
53
|
+
}
|
|
54
|
+
function decimalFraction(value) {
|
|
55
|
+
const match = /^(\d+)(?:\.(\d+))?$/.exec(value);
|
|
56
|
+
if (!match)
|
|
57
|
+
return;
|
|
58
|
+
const fraction = match[2] ?? "";
|
|
59
|
+
return [BigInt(match[1] + fraction), 10n ** BigInt(fraction.length)];
|
|
60
|
+
}
|
|
61
|
+
const refuse = (reason) => ({ ok: false, reason: `${reason} Nothing was sent.` });
|
|
62
|
+
function withinOrderCeiling(sizeText, priceText, maxOrderUsd) {
|
|
63
|
+
const size = decimalFraction(sizeText);
|
|
64
|
+
const price = decimalFraction(priceText);
|
|
65
|
+
const cap = decimalFraction(String(maxOrderUsd));
|
|
66
|
+
return size && price && cap && size[0] * price[0] * cap[1] <= cap[0] * size[1] * price[1];
|
|
67
|
+
}
|
|
68
|
+
export function createSpotLimitAuthorizer(limits) {
|
|
69
|
+
const pairs = new Set(limits.pairs);
|
|
70
|
+
return async ({ pair, price, size }) => {
|
|
71
|
+
if (!pairs.has(pair))
|
|
72
|
+
return refuse(`${pair} is not on this machine's spot strategy pair list.`);
|
|
73
|
+
if (!withinOrderCeiling(size, price, limits.maxOrderUsd)) {
|
|
74
|
+
return refuse(`Spot order value is over this machine's strategy limit of ${limits.maxOrderUsd} USD.`);
|
|
75
|
+
}
|
|
76
|
+
return { ok: true, maxOrderUsd: limits.maxOrderUsd };
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The authorizer behind `--hyperliquid-strategy-*`. It judges the intent alone, with no help from
|
|
81
|
+
* the backend:
|
|
82
|
+
* - an order must be a limit order, so its worth (size times price) is known before signing;
|
|
83
|
+
* - strict reduce-only orders retain the coin and order-value checks, and use the venue's existing leverage;
|
|
84
|
+
* - close, take-profit/stop-loss and cancel intents need only an allowed coin;
|
|
85
|
+
* - deposit, withdraw and register never run for a strategy, whatever the limits are.
|
|
86
|
+
*/
|
|
87
|
+
export function createLimitAuthorizer(limits) {
|
|
88
|
+
const coins = new Set(limits.coins);
|
|
89
|
+
return async (params) => {
|
|
90
|
+
const intent = params.intent;
|
|
91
|
+
switch (intent.op) {
|
|
92
|
+
case "order": {
|
|
93
|
+
if (!coins.has(intent.coin.toUpperCase()))
|
|
94
|
+
return refuse(`${intent.coin} is not on this machine's strategy coin list.`);
|
|
95
|
+
if (intent.orderType !== "limit" || intent.price === undefined) {
|
|
96
|
+
return refuse("A strategy may only place limit orders on this machine, so the order value is known before it is signed.");
|
|
97
|
+
}
|
|
98
|
+
if (!withinOrderCeiling(intent.size, intent.price, limits.maxOrderUsd)) {
|
|
99
|
+
return refuse(`Order value is over this machine's strategy limit of ${limits.maxOrderUsd} USD.`);
|
|
100
|
+
}
|
|
101
|
+
if (limits.maxLeverage !== undefined && !(params.strict && intent.reduceOnly === true)) {
|
|
102
|
+
if (intent.leverage === undefined)
|
|
103
|
+
return refuse(`This machine caps strategy leverage at ${limits.maxLeverage}x, so the order must name its leverage.`);
|
|
104
|
+
if (intent.leverage > limits.maxLeverage)
|
|
105
|
+
return refuse(`Leverage ${intent.leverage}x is over this machine's strategy limit of ${limits.maxLeverage}x.`);
|
|
106
|
+
}
|
|
107
|
+
return { ok: true, maxOrderUsd: limits.maxOrderUsd };
|
|
108
|
+
}
|
|
109
|
+
case "close":
|
|
110
|
+
case "tpsl":
|
|
111
|
+
case "cancel":
|
|
112
|
+
return coins.has(intent.coin.toUpperCase()) ? { ok: true } : refuse(`${intent.coin} is not on this machine's strategy coin list.`);
|
|
113
|
+
default:
|
|
114
|
+
return refuse(`A strategy may not run ${intent.op}.`);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=hyperliquid-strategy-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperliquid-strategy-limits.js","sourceRoot":"","sources":["../src/hyperliquid-strategy-limits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAmC,MAAM,gBAAgB,CAAC;AAyBtF,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC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AAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,+CAA+C,CAAC,CAAC;YACrI;gBACE,OAAO,MAAM,CAAC,0BAA0B,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import { HyperliquidTaskParams } from "@xploai/shared";
|
|
4
|
+
import { createLimitAuthorizer, parseStrategyLimits } from "./hyperliquid-strategy-limits.js";
|
|
5
|
+
const task = {};
|
|
6
|
+
const params = (intent) => HyperliquidTaskParams.parse({ intent, origin: "strategy" });
|
|
7
|
+
const limitOrder = { op: "order", coin: "BTC", side: "buy", size: "0.001", orderType: "limit", price: "60000" };
|
|
8
|
+
describe("parseStrategyLimits", () => {
|
|
9
|
+
it("leaves strategies off when nothing is set", () => {
|
|
10
|
+
assert.deepEqual(parseStrategyLimits({}), { ok: true, limits: undefined });
|
|
11
|
+
assert.deepEqual(parseStrategyLimits({ coins: " ", maxOrderUsd: "" }), { ok: true, limits: undefined });
|
|
12
|
+
});
|
|
13
|
+
it("reads a full configuration and normalises the coin list", () => {
|
|
14
|
+
assert.deepEqual(parseStrategyLimits({ coins: "btc, ETH,btc", maxOrderUsd: "50", maxLeverage: "3" }), {
|
|
15
|
+
ok: true,
|
|
16
|
+
limits: { coins: ["BTC", "ETH"], maxOrderUsd: 50, maxLeverage: 3 },
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
it("refuses a half set or malformed configuration instead of treating it as no limit", () => {
|
|
20
|
+
for (const input of [
|
|
21
|
+
{ coins: "BTC" },
|
|
22
|
+
{ maxOrderUsd: "50" },
|
|
23
|
+
{ maxLeverage: "3" },
|
|
24
|
+
{ coins: "BTC", maxOrderUsd: "0" },
|
|
25
|
+
{ coins: "BTC", maxOrderUsd: "-5" },
|
|
26
|
+
{ coins: "BTC", maxOrderUsd: "1e3" },
|
|
27
|
+
{ coins: "BT C", maxOrderUsd: "5" },
|
|
28
|
+
{ coins: "BTC", maxOrderUsd: "5", maxLeverage: "0" },
|
|
29
|
+
{ coins: "BTC", maxOrderUsd: "5", maxLeverage: "101" },
|
|
30
|
+
]) {
|
|
31
|
+
assert.equal(parseStrategyLimits(input).ok, false, JSON.stringify(input));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe("createLimitAuthorizer", () => {
|
|
36
|
+
const authorize = createLimitAuthorizer({ coins: ["BTC"], maxOrderUsd: 100, maxLeverage: 5 });
|
|
37
|
+
const run = (intent) => authorize(params(intent), task);
|
|
38
|
+
it("allows a limit order inside every limit, exactly at the ceiling included", async () => {
|
|
39
|
+
assert.deepEqual(await run({ ...limitOrder, leverage: 3 }), { ok: true, maxOrderUsd: 100 });
|
|
40
|
+
assert.deepEqual(await run({ ...limitOrder, size: "0.0016", price: "62500", leverage: 5 }), { ok: true, maxOrderUsd: 100 });
|
|
41
|
+
});
|
|
42
|
+
it("refuses a coin that is not listed, whatever its case", async () => {
|
|
43
|
+
assert.equal((await run({ ...limitOrder, coin: "DOGE", leverage: 2 })).ok, false);
|
|
44
|
+
assert.deepEqual(await run({ ...limitOrder, coin: "btc", leverage: 2 }), { ok: true, maxOrderUsd: 100 });
|
|
45
|
+
});
|
|
46
|
+
it("refuses a market order, because its value is not known before signing", async () => {
|
|
47
|
+
const verdict = await run({ op: "order", coin: "BTC", side: "buy", size: "0.001", leverage: 2 });
|
|
48
|
+
assert.equal(verdict.ok, false);
|
|
49
|
+
});
|
|
50
|
+
it("refuses an order over the value ceiling", async () => {
|
|
51
|
+
const verdict = await run({ ...limitOrder, size: "0.002", leverage: 2 });
|
|
52
|
+
assert.equal(verdict.ok, false);
|
|
53
|
+
assert.match(verdict.reason, /over this machine's strategy limit/);
|
|
54
|
+
});
|
|
55
|
+
it("requires leverage and keeps it under the cap when a cap is set", async () => {
|
|
56
|
+
assert.equal((await run(limitOrder)).ok, false);
|
|
57
|
+
assert.equal((await run({ ...limitOrder, leverage: 6 })).ok, false);
|
|
58
|
+
});
|
|
59
|
+
it("keeps notional and coin limits for strict reduce-only orders using existing leverage", async () => {
|
|
60
|
+
const executionId = "05786cb0-7c1f-40da-98ab-e3821eeabc23";
|
|
61
|
+
const close = (order) => authorize(HyperliquidTaskParams.parse({
|
|
62
|
+
origin: "strategy", executionId, confirm: true,
|
|
63
|
+
intent: { ...limitOrder, side: "sell", leverage: 6, isolated: true, reduceOnly: true, ...order },
|
|
64
|
+
strict: { cloid: "0x" + executionId.replaceAll("-", ""), accountId: "account", address: "0x" + "1".repeat(40),
|
|
65
|
+
expiresAt: new Date().toISOString(), authorizationRevision: 1, expectedPosition: "0.01",
|
|
66
|
+
maxNotionalUsd: "0", maxMarginUsd: "0", fillWitness: { since: 1, count: 0, lastTid: null } },
|
|
67
|
+
}), task);
|
|
68
|
+
assert.equal((await close({})).ok, true);
|
|
69
|
+
assert.equal((await close({ coin: "ETH" })).ok, false);
|
|
70
|
+
assert.equal((await close({ size: "0.002" })).ok, false);
|
|
71
|
+
});
|
|
72
|
+
it("does not ask for leverage when no cap is configured", async () => {
|
|
73
|
+
const open = createLimitAuthorizer({ coins: ["BTC"], maxOrderUsd: 100 });
|
|
74
|
+
assert.deepEqual(await open(params(limitOrder), task), { ok: true, maxOrderUsd: 100 });
|
|
75
|
+
});
|
|
76
|
+
it("lets close, tp/sl and cancel through for a listed coin only", async () => {
|
|
77
|
+
assert.deepEqual(await run({ op: "close", coin: "BTC" }), { ok: true });
|
|
78
|
+
assert.deepEqual(await run({ op: "tpsl", coin: "BTC", slPx: "50000" }), { ok: true });
|
|
79
|
+
assert.deepEqual(await run({ op: "cancel", coin: "BTC", orderId: 7 }), { ok: true });
|
|
80
|
+
assert.equal((await run({ op: "close", coin: "ETH" })).ok, false);
|
|
81
|
+
});
|
|
82
|
+
it("never lets a strategy move funds in or out", async () => {
|
|
83
|
+
assert.equal((await run({ op: "deposit", amount: "50" })).ok, false);
|
|
84
|
+
assert.equal((await run({ op: "withdraw", amount: "50" })).ok, false);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=hyperliquid-strategy-limits.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperliquid-strategy-limits.test.js","sourceRoot":"","sources":["../src/hyperliquid-strategy-limits.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE9F,MAAM,IAAI,GAAG,EAAW,CAAC;AACzB,MAAM,MAAM,GAAG,CAAC,MAAe,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AAChG,MAAM,UAAU,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAEhH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CA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AAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACrE,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,12 @@ export * from "./claude-code-adapter.js";
|
|
|
6
6
|
export * from "./codex-adapter.js";
|
|
7
7
|
export * from "./grokbot-adapter.js";
|
|
8
8
|
export * from "./cli-adapter.js";
|
|
9
|
+
export * from "./hyperliquid-network.js";
|
|
10
|
+
export * from "./hyperliquid-path.js";
|
|
11
|
+
export * from "./hyperliquid-adapter.js";
|
|
12
|
+
export * from "./hyperliquid-strategy-limits.js";
|
|
9
13
|
export * from "./onchainos-path.js";
|
|
14
|
+
export * from "./write-guard.js";
|
|
15
|
+
export * from "./agent-auth-hint.js";
|
|
16
|
+
export * from "./strategy-quotes.js";
|
|
17
|
+
export * from "./swap-intent.js";
|
package/dist/index.js
CHANGED
|
@@ -6,5 +6,13 @@ export * from "./claude-code-adapter.js";
|
|
|
6
6
|
export * from "./codex-adapter.js";
|
|
7
7
|
export * from "./grokbot-adapter.js";
|
|
8
8
|
export * from "./cli-adapter.js";
|
|
9
|
+
export * from "./hyperliquid-network.js";
|
|
10
|
+
export * from "./hyperliquid-path.js";
|
|
11
|
+
export * from "./hyperliquid-adapter.js";
|
|
12
|
+
export * from "./hyperliquid-strategy-limits.js";
|
|
9
13
|
export * from "./onchainos-path.js";
|
|
14
|
+
export * from "./write-guard.js";
|
|
15
|
+
export * from "./agent-auth-hint.js";
|
|
16
|
+
export * from "./strategy-quotes.js";
|
|
17
|
+
export * from "./swap-intent.js";
|
|
10
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The shim an agent run sees first on its PATH for `onchainos` and for the Hyperliquid plugin (see
|
|
3
|
+
// write-guard.ts). Reads pass through to the real binary; fund-moving commands run only when the
|
|
4
|
+
// user approved this exact argv, otherwise they are recorded and refused.
|
|
5
|
+
//
|
|
6
|
+
// Which tool was called is told by LUMORA_GUARD_TOOL, set by the per-name shim script. An approved
|
|
7
|
+
// Hyperliquid command is written with the tool name first (["hyperliquid-plugin", "order", ...]),
|
|
8
|
+
// so an approval for one tool can never match the other.
|
|
9
|
+
import { spawnSync } from "node:child_process";
|
|
10
|
+
import { appendFileSync, readFileSync } from "node:fs";
|
|
11
|
+
import { delimiter, join } from "node:path";
|
|
12
|
+
import { findHyperliquidBinaries } from "./hyperliquid-path.js";
|
|
13
|
+
import { findOnchainosBinaries } from "./onchainos-path.js";
|
|
14
|
+
import { HYPERLIQUID_GUARD_TOOL, WRITE_BLOCKED_MESSAGE, describeHyperliquidCall, describeOnchainosCall, isApprovedArgv, hyperliquidGuardPolicy, isOnchainosWriteCommand, parseApprovedCommands, } from "./write-guard.js";
|
|
15
|
+
const argv = process.argv.slice(2);
|
|
16
|
+
const guardDir = process.env.LUMORA_GUARD_DIR ?? "";
|
|
17
|
+
const isHyperliquid = process.env.LUMORA_GUARD_TOOL === HYPERLIQUID_GUARD_TOOL;
|
|
18
|
+
function approvedCommands() {
|
|
19
|
+
try {
|
|
20
|
+
return parseApprovedCommands(JSON.parse(readFileSync(join(guardDir, "approved.json"), "utf8")));
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return []; // Unreadable approvals mean nothing is approved.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// What the user approves and what is recorded when refused: the argv, led by the tool name for the plugin.
|
|
27
|
+
const approvalArgv = isHyperliquid ? [HYPERLIQUID_GUARD_TOOL, ...argv] : argv;
|
|
28
|
+
// Every call is noted (command group, subcommand and chain only) before it runs, so the daemon can
|
|
29
|
+
// tell the dashboard what the agent is doing while it works. Best effort: a call is never held up
|
|
30
|
+
// or refused because the note could not be written.
|
|
31
|
+
const policy = isHyperliquid ? hyperliquidGuardPolicy(argv) : isOnchainosWriteCommand(argv) ? "approval" : "read";
|
|
32
|
+
const adapterOnly = policy === "adapter_only";
|
|
33
|
+
const blocked = adapterOnly || (policy === "approval" && !isApprovedArgv(approvalArgv, approvedCommands()));
|
|
34
|
+
const described = isHyperliquid ? describeHyperliquidCall(argv) : describeOnchainosCall(argv);
|
|
35
|
+
if (described) {
|
|
36
|
+
try {
|
|
37
|
+
appendFileSync(join(guardDir, "calls.jsonl"), `${JSON.stringify({ ...described, ...(isHyperliquid ? { tool: HYPERLIQUID_GUARD_TOOL } : {}), blocked, adapterOnly })}\n`);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// Not worth failing the agent's command for.
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (adapterOnly) {
|
|
44
|
+
process.stderr.write(`${JSON.stringify({ ok: false, error: { code: "adapter_only", message: "Use the dedicated Follow or account setup flow for this operation." } })}\n`);
|
|
45
|
+
process.exit(3);
|
|
46
|
+
}
|
|
47
|
+
if (blocked) {
|
|
48
|
+
try {
|
|
49
|
+
appendFileSync(join(guardDir, "blocked.jsonl"), `${JSON.stringify(approvalArgv)}\n`);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Still refuse even if the record cannot be written.
|
|
53
|
+
}
|
|
54
|
+
process.stderr.write(`${JSON.stringify({ ok: false, error: { code: "approval_required", message: WRITE_BLOCKED_MESSAGE } })}\n`);
|
|
55
|
+
process.exit(3);
|
|
56
|
+
}
|
|
57
|
+
// The real binary runs without the guard directory on its PATH. For the plugin this matters: it
|
|
58
|
+
// signs by calling `onchainos wallet sign-message`, whose argv cannot be approved in advance, and an
|
|
59
|
+
// approved plugin command is the user's consent for those calls.
|
|
60
|
+
const withoutShim = (process.env.PATH ?? "").split(delimiter).filter((dir) => dir && dir !== guardDir).join(delimiter);
|
|
61
|
+
const cleanEnv = { ...process.env, PATH: withoutShim };
|
|
62
|
+
const realBin = isHyperliquid
|
|
63
|
+
? process.env.LUMORA_REAL_HYPERLIQUID || findHyperliquidBinaries(cleanEnv)[0]
|
|
64
|
+
: process.env.LUMORA_REAL_ONCHAINOS || findOnchainosBinaries(cleanEnv)[0];
|
|
65
|
+
if (!realBin) {
|
|
66
|
+
process.stderr.write(`${isHyperliquid ? "hyperliquid-plugin" : "onchainos"} is not installed on this machine\n`);
|
|
67
|
+
process.exit(127);
|
|
68
|
+
}
|
|
69
|
+
const child = spawnSync(realBin, argv, { stdio: "inherit", env: cleanEnv });
|
|
70
|
+
if (child.error) {
|
|
71
|
+
process.stderr.write(`${child.error.message}\n`);
|
|
72
|
+
process.exit(127);
|
|
73
|
+
}
|
|
74
|
+
process.exit(child.status ?? (child.signal ? 128 : 1));
|
|
75
|
+
//# sourceMappingURL=onchainos-guard-bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onchainos-guard-bin.js","sourceRoot":"","sources":["../src/onchainos-guard-bin.ts"],"names":[],"mappings":";AACA,mGAAmG;AACnG,iGAAiG;AACjG,0EAA0E;AAC1E,EAAE;AACF,mGAAmG;AACnG,kGAAkG;AAClG,yDAAyD;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC;AACpD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,sBAAsB,CAAC;AAE/E,SAAS,gBAAgB;IACvB,IAAI,CAAC;QACH,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,MA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G,CAAC,qBAAqB,IAAI,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5E,IAAI,CAAC,OAAO,EAAE,CAAC;IACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,qCAAqC,CAAC,CAAC;IACjH,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AACD,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC5E,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;IACjD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/onchainos-path.d.ts
CHANGED
package/dist/onchainos-path.js
CHANGED
|
@@ -2,7 +2,7 @@ import { accessSync, constants, statSync } from "node:fs";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { delimiter, join } from "node:path";
|
|
4
4
|
const BIN_NAME = process.platform === "win32" ? "onchainos.exe" : "onchainos";
|
|
5
|
-
function isExecutableFile(path) {
|
|
5
|
+
export function isExecutableFile(path) {
|
|
6
6
|
try {
|
|
7
7
|
if (!statSync(path).isFile())
|
|
8
8
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onchainos-path.js","sourceRoot":"","sources":["../src/onchainos-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,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AC/B,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC;QAC3B,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC;QAC3B,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC;QAC3B,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;QACjB,mBAAmB;QACnB,gBAAgB;QAChB,UAAU;KACX,CAAC;IACF,IAAI,GAAG,CAAC,iBAAiB;QAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;IACzE,IAAI,GAAG,CAAC,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,qBAAqB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACxE,OAAO,sBAAsB,CAAC,GAAG,CAAC;SAC/B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;SACjC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pins a signing command to the payer the user confirmed.
|
|
3
|
+
*
|
|
4
|
+
* `onchainos` signs with the account that is selected on the machine at the moment a command runs. A confirmation
|
|
5
|
+
* made for wallet A can therefore be spent from wallet B if the selected account is switched in between. The dashboard
|
|
6
|
+
* names the confirmed payer on every command that signs; this check is the executor's own last look before anything
|
|
7
|
+
* is signed:
|
|
8
|
+
*
|
|
9
|
+
* - a signing command that arrives without a payer is refused (an older queued task, or an older dashboard),
|
|
10
|
+
* - a payer that is not an address of the account active on this machine is refused,
|
|
11
|
+
* - a payer given twice (in the argv and beside it) that disagrees with itself is refused,
|
|
12
|
+
* - and if the accounts cannot be read at all, nothing is signed, because the payer cannot be confirmed.
|
|
13
|
+
*
|
|
14
|
+
* The payer is read from the command's own flag where the CLI has one (`--from` on `wallet send|contract-call|sign-message`,
|
|
15
|
+
* `--wallet` on `swap execute` and `cross-chain execute`), so the CLI is held to it as well. Limit-order commands have no
|
|
16
|
+
* such flag; for them the dashboard sends the payer beside the argv (`payer` in the task params).
|
|
17
|
+
*/
|
|
18
|
+
/** Start of every refusal, so a caller can tell "refused before signing" from a CLI failure. */
|
|
19
|
+
export declare const SIGNER_CHECK_PREFIX = "Wallet account check failed";
|
|
20
|
+
export type SignerBinding = {
|
|
21
|
+
/** `group subcommand`, e.g. `wallet send`. */
|
|
22
|
+
command: string;
|
|
23
|
+
/** The payer named in the argv itself, when the command has a flag for it. */
|
|
24
|
+
payer?: string;
|
|
25
|
+
/** Kept for the refusal text and for tests. */
|
|
26
|
+
strategy?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The binding of a signing command, or null for any other command.
|
|
30
|
+
*
|
|
31
|
+
* The command is found as any adjacent pair of bare words that names a signing command, not only the first two
|
|
32
|
+
* tokens: a global option ahead of the group (`--output json wallet send`) must not hide it. Matching more than
|
|
33
|
+
* strictly needed only means more commands are checked, never fewer.
|
|
34
|
+
*/
|
|
35
|
+
export declare function signerBindingOf(argv: readonly string[]): SignerBinding | null;
|
|
36
|
+
/** EVM addresses compare case-insensitively (EIP-55 casing); every other chain's address compares exactly. */
|
|
37
|
+
export declare const sameAddress: (a: string, b: string) => boolean;
|
|
38
|
+
/** Every address in a `wallet addresses` envelope: each array under `data` holds `{ address }` entries, one list per chain family. */
|
|
39
|
+
export declare function addressesFromEnvelope(text: string): string[] | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Returns why this command must not be signed, or undefined when it may run.
|
|
42
|
+
* `listAccountAddresses` reads the addresses of the account that is active on this machine right now; undefined means it could not.
|
|
43
|
+
* `expectedPayer` is the payer the dashboard sent beside the argv, for commands whose CLI has no payer flag.
|
|
44
|
+
*/
|
|
45
|
+
export declare function checkSignerBinding(argv: readonly string[], listAccountAddresses: () => Promise<string[] | undefined>, expectedPayer?: string): Promise<string | undefined>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pins a signing command to the payer the user confirmed.
|
|
3
|
+
*
|
|
4
|
+
* `onchainos` signs with the account that is selected on the machine at the moment a command runs. A confirmation
|
|
5
|
+
* made for wallet A can therefore be spent from wallet B if the selected account is switched in between. The dashboard
|
|
6
|
+
* names the confirmed payer on every command that signs; this check is the executor's own last look before anything
|
|
7
|
+
* is signed:
|
|
8
|
+
*
|
|
9
|
+
* - a signing command that arrives without a payer is refused (an older queued task, or an older dashboard),
|
|
10
|
+
* - a payer that is not an address of the account active on this machine is refused,
|
|
11
|
+
* - a payer given twice (in the argv and beside it) that disagrees with itself is refused,
|
|
12
|
+
* - and if the accounts cannot be read at all, nothing is signed, because the payer cannot be confirmed.
|
|
13
|
+
*
|
|
14
|
+
* The payer is read from the command's own flag where the CLI has one (`--from` on `wallet send|contract-call|sign-message`,
|
|
15
|
+
* `--wallet` on `swap execute` and `cross-chain execute`), so the CLI is held to it as well. Limit-order commands have no
|
|
16
|
+
* such flag; for them the dashboard sends the payer beside the argv (`payer` in the task params).
|
|
17
|
+
*/
|
|
18
|
+
/** Start of every refusal, so a caller can tell "refused before signing" from a CLI failure. */
|
|
19
|
+
export const SIGNER_CHECK_PREFIX = "Wallet account check failed";
|
|
20
|
+
/** The flag that names the paying account, per signing command; null when the CLI has none. */
|
|
21
|
+
const SIGNING_COMMANDS = {
|
|
22
|
+
wallet: { send: "--from", "contract-call": "--from", "sign-message": "--from" },
|
|
23
|
+
swap: { execute: "--wallet" },
|
|
24
|
+
"cross-chain": { execute: "--wallet" },
|
|
25
|
+
strategy: { "create-limit": null, cancel: null, resume: null },
|
|
26
|
+
};
|
|
27
|
+
const flagValue = (argv, flag) => {
|
|
28
|
+
let found;
|
|
29
|
+
for (let i = 0; i < argv.length; i++) {
|
|
30
|
+
const token = argv[i];
|
|
31
|
+
if (token === flag) {
|
|
32
|
+
const next = argv[i + 1];
|
|
33
|
+
found = next !== undefined && !next.startsWith("--") ? next : undefined;
|
|
34
|
+
}
|
|
35
|
+
else if (token.startsWith(`${flag}=`)) {
|
|
36
|
+
found = token.slice(flag.length + 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const trimmed = found?.trim();
|
|
40
|
+
return trimmed ? trimmed : undefined;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The binding of a signing command, or null for any other command.
|
|
44
|
+
*
|
|
45
|
+
* The command is found as any adjacent pair of bare words that names a signing command, not only the first two
|
|
46
|
+
* tokens: a global option ahead of the group (`--output json wallet send`) must not hide it. Matching more than
|
|
47
|
+
* strictly needed only means more commands are checked, never fewer.
|
|
48
|
+
*/
|
|
49
|
+
export function signerBindingOf(argv) {
|
|
50
|
+
const words = argv.filter((token) => !token.startsWith("-"));
|
|
51
|
+
for (let i = 0; i + 1 < words.length; i++) {
|
|
52
|
+
const subcommands = SIGNING_COMMANDS[words[i]];
|
|
53
|
+
const sub = words[i + 1];
|
|
54
|
+
if (!subcommands || !Object.prototype.hasOwnProperty.call(subcommands, sub))
|
|
55
|
+
continue;
|
|
56
|
+
const flag = subcommands[sub];
|
|
57
|
+
return {
|
|
58
|
+
command: `${words[i]} ${sub}`,
|
|
59
|
+
payer: flag ? flagValue(argv, flag) : undefined,
|
|
60
|
+
strategy: flagValue(argv, "--strategy"),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const isEvmAddress = (value) => /^0x[0-9a-fA-F]{40}$/.test(value);
|
|
66
|
+
/** EVM addresses compare case-insensitively (EIP-55 casing); every other chain's address compares exactly. */
|
|
67
|
+
export const sameAddress = (a, b) => a === b || (isEvmAddress(a) && isEvmAddress(b) && a.toLowerCase() === b.toLowerCase());
|
|
68
|
+
const shorten = (address) => (address.length > 14 ? `${address.slice(0, 6)}…${address.slice(-4)}` : address);
|
|
69
|
+
/** Every address in a `wallet addresses` envelope: each array under `data` holds `{ address }` entries, one list per chain family. */
|
|
70
|
+
export function addressesFromEnvelope(text) {
|
|
71
|
+
let envelope;
|
|
72
|
+
try {
|
|
73
|
+
envelope = JSON.parse(text);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
if (!envelope || typeof envelope !== "object")
|
|
79
|
+
return undefined;
|
|
80
|
+
const { ok, data } = envelope;
|
|
81
|
+
if (ok !== true || !data || typeof data !== "object")
|
|
82
|
+
return undefined;
|
|
83
|
+
const out = [];
|
|
84
|
+
for (const list of Object.values(data)) {
|
|
85
|
+
if (!Array.isArray(list))
|
|
86
|
+
continue;
|
|
87
|
+
for (const entry of list) {
|
|
88
|
+
const address = entry && typeof entry === "object" ? entry.address : undefined;
|
|
89
|
+
if (typeof address === "string" && address.trim())
|
|
90
|
+
out.push(address.trim());
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Returns why this command must not be signed, or undefined when it may run.
|
|
97
|
+
* `listAccountAddresses` reads the addresses of the account that is active on this machine right now; undefined means it could not.
|
|
98
|
+
* `expectedPayer` is the payer the dashboard sent beside the argv, for commands whose CLI has no payer flag.
|
|
99
|
+
*/
|
|
100
|
+
export async function checkSignerBinding(argv, listAccountAddresses, expectedPayer) {
|
|
101
|
+
const binding = signerBindingOf(argv);
|
|
102
|
+
if (!binding)
|
|
103
|
+
return undefined;
|
|
104
|
+
const expected = typeof expectedPayer === "string" && expectedPayer.trim() ? expectedPayer.trim() : undefined;
|
|
105
|
+
if (binding.payer && expected && !sameAddress(binding.payer, expected)) {
|
|
106
|
+
return `${SIGNER_CHECK_PREFIX}: this request names two different paying wallets (${shorten(binding.payer)} and ${shorten(expected)}), so it was not signed. Start it again from the dashboard.`;
|
|
107
|
+
}
|
|
108
|
+
const payer = binding.payer ?? expected;
|
|
109
|
+
if (!payer) {
|
|
110
|
+
return `${SIGNER_CHECK_PREFIX}: this request names no paying wallet, so it was not signed. Start it again from the dashboard.`;
|
|
111
|
+
}
|
|
112
|
+
const addresses = await listAccountAddresses();
|
|
113
|
+
if (!addresses || addresses.length === 0) {
|
|
114
|
+
return `${SIGNER_CHECK_PREFIX}: the wallet accounts on this machine could not be read, so the paying wallet ${shorten(payer)} could not be confirmed and nothing was signed.`;
|
|
115
|
+
}
|
|
116
|
+
if (!addresses.some((address) => sameAddress(address, payer))) {
|
|
117
|
+
return `${SIGNER_CHECK_PREFIX}: the wallet account active on this machine is not the one that was confirmed (${shorten(payer)}), so nothing was signed. Switch back to that account and try again.`;
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=signer-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer-binding.js","sourceRoot":"","sources":["../src/signer-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,gGAAgG;AAChG,MAAM,CAAC,MAAM,mBAAmB,GAAG,6BAA6B,CAAC;AAEjE,+FAA+F;AAC/F,MAAM,gBAAgB,GAAqF;IACzG,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE;IAC/E,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;IAC7B,aAAa,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;IACtC,QAAQ,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;CAC/D,CAAC;AAWF,MAA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