@intent-engine/cli 0.1.22 → 0.1.26
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/src/admin-commands.d.ts +12 -0
- package/dist/src/admin-commands.js +140 -0
- package/dist/src/admin-commands.js.map +1 -0
- package/dist/src/agent/actions.d.ts +2 -0
- package/dist/src/agent/actions.js +1 -1
- package/dist/src/agent/actions.js.map +1 -1
- package/dist/src/agent/claims.js +13 -12
- package/dist/src/agent/claims.js.map +1 -1
- package/dist/src/agent/create.d.ts +1 -0
- package/dist/src/agent/create.js +18 -4
- package/dist/src/agent/create.js.map +1 -1
- package/dist/src/agent/mandate-agent.d.ts +2 -0
- package/dist/src/agent/mandate-agent.js +136 -0
- package/dist/src/agent/mandate-agent.js.map +1 -0
- package/dist/src/agent/mandate-grant.d.ts +2 -0
- package/dist/src/agent/mandate-grant.js +192 -0
- package/dist/src/agent/mandate-grant.js.map +1 -0
- package/dist/src/agent/mandate-revoke.d.ts +1 -0
- package/dist/src/agent/mandate-revoke.js +142 -0
- package/dist/src/agent/mandate-revoke.js.map +1 -0
- package/dist/src/agent/mandate-state.d.ts +33 -0
- package/dist/src/agent/mandate-state.js +85 -0
- package/dist/src/agent/mandate-state.js.map +1 -0
- package/dist/src/agent/mandate.d.ts +4 -26
- package/dist/src/agent/mandate.js +4 -479
- package/dist/src/agent/mandate.js.map +1 -1
- package/dist/src/agent/mcp.js +10 -5
- package/dist/src/agent/mcp.js.map +1 -1
- package/dist/src/agent/prepare.js +1 -1
- package/dist/src/agent/prepare.js.map +1 -1
- package/dist/src/agent/problems.d.ts +15 -1
- package/dist/src/agent/problems.js +38 -2
- package/dist/src/agent/problems.js.map +1 -1
- package/dist/src/agent/read.d.ts +13 -0
- package/dist/src/agent/read.js +56 -7
- package/dist/src/agent/read.js.map +1 -1
- package/dist/src/agent/registry.js +8 -2
- package/dist/src/agent/registry.js.map +1 -1
- package/dist/src/agent/relay.d.ts +2 -0
- package/dist/src/agent/relay.js +11 -3
- package/dist/src/agent/relay.js.map +1 -1
- package/dist/src/agent/sales.d.ts +29 -0
- package/dist/src/agent/sales.js +248 -0
- package/dist/src/agent/sales.js.map +1 -0
- package/dist/src/agent/signed-prepare.d.ts +1 -0
- package/dist/src/agent/signed-prepare.js +141 -0
- package/dist/src/agent/signed-prepare.js.map +1 -0
- package/dist/src/agent/signed-relay.d.ts +25 -0
- package/dist/src/agent/signed-relay.js +68 -0
- package/dist/src/agent/signed-relay.js.map +1 -0
- package/dist/src/agent/signed-submit.d.ts +2 -0
- package/dist/src/agent/signed-submit.js +137 -0
- package/dist/src/agent/signed-submit.js.map +1 -0
- package/dist/src/agent/signed-terms.d.ts +85 -0
- package/dist/src/agent/signed-terms.js +84 -0
- package/dist/src/agent/signed-terms.js.map +1 -0
- package/dist/src/agent/signed.d.ts +4 -13
- package/dist/src/agent/signed.js +4 -361
- package/dist/src/agent/signed.js.map +1 -1
- package/dist/src/agent/wallet/account.d.ts +4 -0
- package/dist/src/agent/wallet/account.js +84 -0
- package/dist/src/agent/wallet/account.js.map +1 -0
- package/dist/src/agent/wallet/attest.d.ts +4 -0
- package/dist/src/agent/wallet/attest.js +178 -0
- package/dist/src/agent/wallet/attest.js.map +1 -0
- package/dist/src/agent/wallet/delivery.d.ts +13 -0
- package/dist/src/agent/wallet/delivery.js +171 -0
- package/dist/src/agent/wallet/delivery.js.map +1 -0
- package/dist/src/agent/wallet/escrow.d.ts +7 -0
- package/dist/src/agent/wallet/escrow.js +164 -0
- package/dist/src/agent/wallet/escrow.js.map +1 -0
- package/dist/src/agent/wallet/fills.d.ts +27 -0
- package/dist/src/agent/wallet/fills.js +80 -0
- package/dist/src/agent/wallet/fills.js.map +1 -0
- package/dist/src/agent/wallet/guard.d.ts +57 -0
- package/dist/src/agent/wallet/guard.js +205 -0
- package/dist/src/agent/wallet/guard.js.map +1 -0
- package/dist/src/agent/wallet/offer.d.ts +50 -0
- package/dist/src/agent/wallet/offer.js +80 -0
- package/dist/src/agent/wallet/offer.js.map +1 -0
- package/dist/src/agent/wallet/receipt.d.ts +42 -0
- package/dist/src/agent/wallet/receipt.js +102 -0
- package/dist/src/agent/wallet/receipt.js.map +1 -0
- package/dist/src/agent/wallet/record.d.ts +31 -0
- package/dist/src/agent/wallet/record.js +178 -0
- package/dist/src/agent/wallet/record.js.map +1 -0
- package/dist/src/agent/wallet/releases.d.ts +40 -0
- package/dist/src/agent/wallet/releases.js +236 -0
- package/dist/src/agent/wallet/releases.js.map +1 -0
- package/dist/src/agent/wallet/split.d.ts +10 -0
- package/dist/src/agent/wallet/split.js +271 -0
- package/dist/src/agent/wallet/split.js.map +1 -0
- package/dist/src/agent/wallet/trade.d.ts +14 -0
- package/dist/src/agent/wallet/trade.js +243 -0
- package/dist/src/agent/wallet/trade.js.map +1 -0
- package/dist/src/agent/wallet/wait.d.ts +5 -0
- package/dist/src/agent/wallet/wait.js +99 -0
- package/dist/src/agent/wallet/wait.js.map +1 -0
- package/dist/src/agent/wallet.d.ts +18 -72
- package/dist/src/agent/wallet.js +26 -1216
- package/dist/src/agent/wallet.js.map +1 -1
- package/dist/src/arg-options.d.ts +333 -0
- package/dist/src/arg-options.js +310 -0
- package/dist/src/arg-options.js.map +1 -0
- package/dist/src/arg-usage.d.ts +7 -0
- package/dist/src/arg-usage.js +53 -0
- package/dist/src/arg-usage.js.map +1 -0
- package/dist/src/arg-values.d.ts +47 -0
- package/dist/src/arg-values.js +280 -0
- package/dist/src/arg-values.js.map +1 -0
- package/dist/src/args.d.ts +7 -487
- package/dist/src/args.js +89 -880
- package/dist/src/args.js.map +1 -1
- package/dist/src/artifact.d.ts +22 -0
- package/dist/src/artifact.js +89 -0
- package/dist/src/artifact.js.map +1 -0
- package/dist/src/check-process.d.ts +39 -0
- package/dist/src/check-process.js +338 -0
- package/dist/src/check-process.js.map +1 -0
- package/dist/src/command-builders.d.ts +37 -0
- package/dist/src/command-builders.js +216 -0
- package/dist/src/command-builders.js.map +1 -0
- package/dist/src/command-types.d.ts +227 -0
- package/dist/src/command-types.js +2 -0
- package/dist/src/command-types.js.map +1 -0
- package/dist/src/commands.d.ts +7 -43
- package/dist/src/commands.js +67 -426
- package/dist/src/commands.js.map +1 -1
- package/dist/src/event-feed.d.ts +13 -0
- package/dist/src/event-feed.js +46 -0
- package/dist/src/event-feed.js.map +1 -0
- package/dist/src/flow-commands.d.ts +8 -0
- package/dist/src/flow-commands.js +116 -0
- package/dist/src/flow-commands.js.map +1 -0
- package/dist/src/flows.d.ts +6 -0
- package/dist/src/flows.js +84 -10
- package/dist/src/flows.js.map +1 -1
- package/dist/src/job-commands.d.ts +9 -0
- package/dist/src/job-commands.js +89 -0
- package/dist/src/job-commands.js.map +1 -0
- package/dist/src/judge-errors.d.ts +12 -0
- package/dist/src/judge-errors.js +16 -0
- package/dist/src/judge-errors.js.map +1 -0
- package/dist/src/judge.d.ts +28 -0
- package/dist/src/judge.js +169 -0
- package/dist/src/judge.js.map +1 -0
- package/dist/src/main.d.ts +4 -1
- package/dist/src/main.js +26 -10
- package/dist/src/main.js.map +1 -1
- package/dist/src/order-builders.d.ts +10 -0
- package/dist/src/order-builders.js +172 -0
- package/dist/src/order-builders.js.map +1 -0
- package/dist/src/render.d.ts +1 -0
- package/dist/src/render.js +9 -0
- package/dist/src/render.js.map +1 -1
- package/dist/src/runtime.d.ts +22 -0
- package/dist/src/runtime.js +2 -0
- package/dist/src/runtime.js.map +1 -0
- package/dist/src/solve-commands.d.ts +25 -0
- package/dist/src/solve-commands.js +171 -0
- package/dist/src/solve-commands.js.map +1 -0
- package/dist/src/tokens.js +2 -1
- package/dist/src/tokens.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/wallet.d.ts +4 -1
- package/dist/src/wallet.js +25 -5
- package/dist/src/wallet.js.map +1 -1
- package/package.json +16 -7
- package/dist/src/events.d.ts +0 -8
- package/dist/src/events.js +0 -43
- package/dist/src/events.js.map +0 -1
- package/dist/src/transport.d.ts +0 -208
- package/dist/src/transport.js +0 -441
- package/dist/src/transport.js.map +0 -1
package/dist/src/args.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
|
-
import {
|
|
3
|
-
import { MAX_EXPIRES_IN } from "./agent/create.js";
|
|
4
|
-
import { MANDATE_KIND_NAMES } from "./agent/mandate.js";
|
|
2
|
+
import { AUTO_PRICE_CAP } from "./compute.js";
|
|
5
3
|
import { MAX_SUBMIT_WITHIN } from "./agent/signed.js";
|
|
6
|
-
import { DEVNET_URL
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { DEVNET_URL } from "./tokens.js";
|
|
5
|
+
import { ACCEPTS, OPTIONS } from "./arg-options.js";
|
|
6
|
+
import { addressList, amountOf, https, key, memoUrlOf, mintList, named, noRepeats, noSub, onlyAccepted, optionalField, outputOf, parseAddress, parseBounded, parseFeeBps, parseI64, parseKindFees, parseKinds, parseLimit, parseMaxRent, parsePause, parsePriority, parseSolCost, required, sha256Of, u64, unitsOf, UsageError, } from "./arg-values.js";
|
|
7
|
+
import { agentSpec, authorityOf, configChange, JUDGE_TIMEOUT, market, MAX_JUDGE_TIMEOUT, maxPagesOf, profitFloors, relaySpec, releaseOption, runOf, solveFeeAboveCap, treasury, walletLimits, } from "./command-builders.js";
|
|
8
|
+
import { createTerms, mandate, terms } from "./order-builders.js";
|
|
9
|
+
import { USAGE } from "./arg-usage.js";
|
|
10
|
+
import { DEFAULT_MAX_RENT, DEFAULT_MAX_SOL_COST } from "@intent-engine/solver";
|
|
11
|
+
export { ACCEPTS, GLOBAL_OPTIONS, SUB_ACCEPTS, TOKEN_SIDES } from "./arg-options.js";
|
|
12
|
+
export { COMMANDS, SHAPES, USAGE, usageOf } from "./arg-usage.js";
|
|
13
|
+
export { MAX_EVENT_LIMIT, MAX_RENT_FORMAT, MAX_SOL_COST_FORMAT, outputOf, parseFeeBps, parseI64, parseKinds, parseLimit, parseMaxRent, parsePause, parsePriority, parseSolCost, parseU64, SHA256_NEEDED, UsageError, } from "./arg-values.js";
|
|
14
|
+
export { expiry, MANDATE_USE_KINDS, needsSpecHash, order, SPEC_HASH_FORMAT } from "./order-builders.js";
|
|
15
|
+
export { AGENT_DEFAULT_HOURLY_LAMPORTS, AGENT_NEEDS_OWNERS, ISSUE_ALONE, ISSUE_FORMAT, JUDGE_TIMEOUT, MAX_DELIVERY_PAGES, MAX_JUDGE_TIMEOUT, ONE_MARKET, RELAY_DEFAULT_HOURLY_LAMPORTS, RELAY_DEFAULT_TTL, RELAY_MAX_TTL, RELAY_NEEDS_FEES, RELEASE_NEEDED, RUN_NEEDED, solveFeeAboveCap, TREASURY_CREATE_NEEDS_MINTS, WALLET_LIMITS_NEED_WALLET, zeroProfit, } from "./command-builders.js";
|
|
9
16
|
export const DEFAULT_URL = "http://127.0.0.1:8899";
|
|
10
17
|
export const CLUSTERS = {
|
|
11
18
|
localnet: DEFAULT_URL,
|
|
@@ -18,882 +25,11 @@ export const ENV_KEYPAIR = "INTENT_ENGINE_KEYPAIR";
|
|
|
18
25
|
const SETUP_CLUSTER = "devnet";
|
|
19
26
|
export const WALLET_NOT_MAINNET = "mcp --wallet keeps its key in a file on this machine, so it serves devnet, testnet and localnet only";
|
|
20
27
|
const BALANCE_OF_ONE = "balance takes --keypair or --owner, not both";
|
|
21
|
-
export const GLOBAL_OPTIONS = ["output", "help"];
|
|
22
|
-
export class UsageError extends Error {
|
|
23
|
-
}
|
|
24
|
-
export const RELAY_NEEDS_FEES = "--relayer needs --relay-fee naming every input token it relays as mint=amount; amount may be 0, and other tokens are refused";
|
|
25
|
-
export const AGENT_NEEDS_OWNERS = "--agent needs --agent-owners naming every owner whose mandates this agent key may use";
|
|
26
|
-
export const RELAY_DEFAULT_TTL = 24 * 60 * 60;
|
|
27
|
-
export const RELAY_DEFAULT_HOURLY_LAMPORTS = 100000000n;
|
|
28
|
-
export const AGENT_DEFAULT_HOURLY_LAMPORTS = 50000000n;
|
|
29
|
-
export const RELAY_MAX_TTL = 365 * 24 * 60 * 60;
|
|
30
|
-
const RELAY_DEFAULT_PER_HOUR = 10;
|
|
31
|
-
const RELAY_MIN_TTL = 60;
|
|
32
|
-
export const TOKEN_SIDES = {
|
|
33
|
-
"amount-in": "input",
|
|
34
|
-
make: "input",
|
|
35
|
-
"per-intent": "input",
|
|
36
|
-
total: "input",
|
|
37
|
-
"agent-fee": "input",
|
|
38
|
-
"floor-in": "input",
|
|
39
|
-
"relayer-fee": "input",
|
|
40
|
-
amount: "input",
|
|
41
|
-
"min-out": "output",
|
|
42
|
-
take: "output",
|
|
43
|
-
"start-out": "output",
|
|
44
|
-
"end-out": "output",
|
|
45
|
-
"floor-out": "output",
|
|
46
|
-
};
|
|
47
|
-
const OPTIONS = {
|
|
48
|
-
url: { type: "string" },
|
|
49
|
-
keypair: { type: "string" },
|
|
50
|
-
relayer: { type: "string" },
|
|
51
|
-
agent: { type: "string" },
|
|
52
|
-
wallet: { type: "boolean" },
|
|
53
|
-
"wallet-per-trade": { type: "string" },
|
|
54
|
-
"wallet-per-hour": { type: "string" },
|
|
55
|
-
"relay-max-lamports": { type: "string" },
|
|
56
|
-
"relay-max-ttl": { type: "string" },
|
|
57
|
-
"relay-per-hour": { type: "string" },
|
|
58
|
-
"relay-hourly-lamports": { type: "string" },
|
|
59
|
-
"relay-fee": { type: "string" },
|
|
60
|
-
"priority-fee": { type: "string" },
|
|
61
|
-
authority: { type: "string" },
|
|
62
|
-
"fill-disabled": { type: "string" },
|
|
63
|
-
"new-admin": { type: "string" },
|
|
64
|
-
"agent-hourly-lamports": { type: "string" },
|
|
65
|
-
"agent-owners": { type: "string" },
|
|
66
|
-
owner: { type: "string" },
|
|
67
|
-
nonce: { type: "string" },
|
|
68
|
-
at: { type: "string" },
|
|
69
|
-
base: { type: "string" },
|
|
70
|
-
"input-mint": { type: "string" },
|
|
71
|
-
"output-mint": { type: "string" },
|
|
72
|
-
"expires-at": { type: "string" },
|
|
73
|
-
"amount-in": { type: "string" },
|
|
74
|
-
"min-out": { type: "string" },
|
|
75
|
-
make: { type: "string" },
|
|
76
|
-
take: { type: "string" },
|
|
77
|
-
guardian: { type: "string" },
|
|
78
|
-
"fee-recipient": { type: "string" },
|
|
79
|
-
"fee-bps": { type: "string" },
|
|
80
|
-
kinds: { type: "string" },
|
|
81
|
-
flags: { type: "string" },
|
|
82
|
-
"dry-run": { type: "boolean" },
|
|
83
|
-
yes: { type: "boolean" },
|
|
84
|
-
help: { type: "boolean" },
|
|
85
|
-
version: { type: "boolean" },
|
|
86
|
-
follow: { type: "boolean" },
|
|
87
|
-
watch: { type: "boolean" },
|
|
88
|
-
output: { type: "string" },
|
|
89
|
-
interval: { type: "string" },
|
|
90
|
-
"expires-in": { type: "string" },
|
|
91
|
-
"start-out": { type: "string" },
|
|
92
|
-
"end-out": { type: "string" },
|
|
93
|
-
"start-at": { type: "string" },
|
|
94
|
-
"end-at": { type: "string" },
|
|
95
|
-
"min-result": { type: "string" },
|
|
96
|
-
"max-result": { type: "string" },
|
|
97
|
-
attestor: { type: "string" },
|
|
98
|
-
"per-intent": { type: "string" },
|
|
99
|
-
total: { type: "string" },
|
|
100
|
-
"max-intents": { type: "string" },
|
|
101
|
-
"max-ttl": { type: "string" },
|
|
102
|
-
"valid-for": { type: "string" },
|
|
103
|
-
"floor-out": { type: "string" },
|
|
104
|
-
"floor-in": { type: "string" },
|
|
105
|
-
"agent-fee": { type: "string" },
|
|
106
|
-
id: { type: "string" },
|
|
107
|
-
mint: { type: "string" },
|
|
108
|
-
amount: { type: "string" },
|
|
109
|
-
out: { type: "string" },
|
|
110
|
-
file: { type: "string" },
|
|
111
|
-
"submit-within": { type: "string" },
|
|
112
|
-
"relayer-fee": { type: "string" },
|
|
113
|
-
units: { type: "string" },
|
|
114
|
-
"fund-accounts": { type: "boolean" },
|
|
115
|
-
limit: { type: "string" },
|
|
116
|
-
bounty: { type: "string" },
|
|
117
|
-
"create-fee": { type: "string" },
|
|
118
|
-
"kind-fees": { type: "string" },
|
|
119
|
-
"partner-cut": { type: "string" },
|
|
120
|
-
partner: { type: "string" },
|
|
121
|
-
jupiter: { type: "string" },
|
|
122
|
-
jito: { type: "string" },
|
|
123
|
-
tip: { type: "string" },
|
|
124
|
-
"min-profit": { type: "string" },
|
|
125
|
-
issue: { type: "string" },
|
|
126
|
-
"max-fee-bps": { type: "string" },
|
|
127
|
-
"slippage-bps": { type: "string" },
|
|
128
|
-
"route-program": { type: "string" },
|
|
129
|
-
"lookup-table": { type: "string" },
|
|
130
|
-
solver: { type: "string" },
|
|
131
|
-
"partner-bps": { type: "string" },
|
|
132
|
-
mints: { type: "string" },
|
|
133
|
-
create: { type: "boolean" },
|
|
134
|
-
};
|
|
135
|
-
const KIND_NAMES = {
|
|
136
|
-
swap: Kind.SwapExactIn,
|
|
137
|
-
limit: Kind.LimitOrder,
|
|
138
|
-
dutch: Kind.DutchAuction,
|
|
139
|
-
attested: Kind.AttestedResult,
|
|
140
|
-
};
|
|
141
|
-
const PAUSE_NAMES = { none: 0, create: 1, fill: 2, all: 3 };
|
|
142
|
-
export function parseKinds(text) {
|
|
143
|
-
return parseKindSet(text, "kinds", false);
|
|
144
|
-
}
|
|
145
|
-
function parseKindSet(text, key, allowNone) {
|
|
146
|
-
if (allowNone && text === "none") {
|
|
147
|
-
return 0n;
|
|
148
|
-
}
|
|
149
|
-
let mask = 0n;
|
|
150
|
-
for (const name of text.split(",")) {
|
|
151
|
-
const kind = KIND_NAMES[name];
|
|
152
|
-
if (kind === undefined) {
|
|
153
|
-
throw new UsageError(`--${key} takes ${allowNone ? "none or " : ""}a comma list of swap, limit, dutch, attested; got ${name}`);
|
|
154
|
-
}
|
|
155
|
-
mask |= kindBit(kind);
|
|
156
|
-
}
|
|
157
|
-
return mask;
|
|
158
|
-
}
|
|
159
|
-
export function parsePause(text, key) {
|
|
160
|
-
const flags = PAUSE_NAMES[text];
|
|
161
|
-
if (flags === undefined) {
|
|
162
|
-
throw new UsageError(`--${key} must be none, create, fill or all`);
|
|
163
|
-
}
|
|
164
|
-
return flags;
|
|
165
|
-
}
|
|
166
|
-
function parseBounded(text, key, max, min = 0) {
|
|
167
|
-
if (!/^\d+$/.test(text) || BigInt(text) > BigInt(max) || BigInt(text) < BigInt(min)) {
|
|
168
|
-
throw new UsageError(`--${key} must be an integer from ${min} to ${max}`);
|
|
169
|
-
}
|
|
170
|
-
return Number(text);
|
|
171
|
-
}
|
|
172
|
-
function parseKindFees(text) {
|
|
173
|
-
const bps = [0, 0, 0, 0];
|
|
174
|
-
let mask = 0;
|
|
175
|
-
if (text === "") {
|
|
176
|
-
return { mask, bps };
|
|
177
|
-
}
|
|
178
|
-
for (const pair of text.split(",")) {
|
|
179
|
-
const [name, value] = pair.split("=");
|
|
180
|
-
const kind = name === undefined ? undefined : KIND_NAMES[name];
|
|
181
|
-
if (kind === undefined || value === undefined) {
|
|
182
|
-
throw new UsageError(`--kind-fees takes name=bps pairs for swap, limit, dutch, attested; got ${pair}`);
|
|
183
|
-
}
|
|
184
|
-
if ((mask & (1 << kind)) !== 0) {
|
|
185
|
-
throw new UsageError(`--kind-fees names ${name} twice`);
|
|
186
|
-
}
|
|
187
|
-
mask |= 1 << kind;
|
|
188
|
-
bps[kind - 1] = parseBounded(value, "kind-fees", 0xffff);
|
|
189
|
-
}
|
|
190
|
-
return { mask, bps };
|
|
191
|
-
}
|
|
192
|
-
export const MAX_EVENT_LIMIT = 1_000;
|
|
193
|
-
export function parseLimit(text) {
|
|
194
|
-
if (!/^\d+$/.test(text) || Number(text) < 1 || Number(text) > MAX_EVENT_LIMIT) {
|
|
195
|
-
throw new UsageError(`--limit must be an integer from 1 to ${MAX_EVENT_LIMIT}`);
|
|
196
|
-
}
|
|
197
|
-
return Number(text);
|
|
198
|
-
}
|
|
199
|
-
export function parseFeeBps(text) {
|
|
200
|
-
if (!/^\d+$/.test(text) || BigInt(text) > 65535n) {
|
|
201
|
-
throw new UsageError("--fee-bps must be an integer from 0 to 65535");
|
|
202
|
-
}
|
|
203
|
-
return Number(text);
|
|
204
|
-
}
|
|
205
|
-
const EXPIRY = ["expires-at", "expires-in"];
|
|
206
|
-
const ORDER = [
|
|
207
|
-
"amount-in",
|
|
208
|
-
"min-out",
|
|
209
|
-
"make",
|
|
210
|
-
"take",
|
|
211
|
-
"start-out",
|
|
212
|
-
"end-out",
|
|
213
|
-
"start-at",
|
|
214
|
-
"end-at",
|
|
215
|
-
"min-result",
|
|
216
|
-
"max-result",
|
|
217
|
-
"attestor",
|
|
218
|
-
];
|
|
219
|
-
const MANDATE_ORDER = ORDER.filter((o) => o !== "min-result" && o !== "max-result" && o !== "attestor");
|
|
220
|
-
export const MANDATE_USE_KINDS = "a mandate covers swap, limit and dutch orders; name one of those";
|
|
221
|
-
export const ACCEPTS = {
|
|
222
|
-
setup: ["url", "keypair"],
|
|
223
|
-
balance: ["url", "keypair", "owner", "mints"],
|
|
224
|
-
pda: ["owner", "nonce"],
|
|
225
|
-
show: ["url", "owner", "nonce"],
|
|
226
|
-
domain: ["url"],
|
|
227
|
-
mcp: [
|
|
228
|
-
"url",
|
|
229
|
-
"priority-fee",
|
|
230
|
-
"relayer",
|
|
231
|
-
"relay-max-lamports",
|
|
232
|
-
"relay-max-ttl",
|
|
233
|
-
"relay-per-hour",
|
|
234
|
-
"relay-hourly-lamports",
|
|
235
|
-
"relay-fee",
|
|
236
|
-
"agent",
|
|
237
|
-
"agent-hourly-lamports",
|
|
238
|
-
"agent-owners",
|
|
239
|
-
"wallet",
|
|
240
|
-
"wallet-per-trade",
|
|
241
|
-
"wallet-per-hour",
|
|
242
|
-
],
|
|
243
|
-
quote: ["url", "owner", "nonce", "at"],
|
|
244
|
-
cancel: ["url", "priority-fee", "keypair", "nonce"],
|
|
245
|
-
expire: ["url", "priority-fee", "keypair", "owner", "nonce"],
|
|
246
|
-
close: ["url", "priority-fee", "keypair", "owner", "nonce"],
|
|
247
|
-
"advance-nonce": ["url", "priority-fee", "keypair", "base"],
|
|
248
|
-
"advance-epoch": ["url", "priority-fee", "keypair"],
|
|
249
|
-
"init-config": ["url", "priority-fee", "keypair", "authority", "yes", "guardian", "fee-recipient", "fee-bps", "kinds", "flags"],
|
|
250
|
-
"raise-pause": ["url", "priority-fee", "keypair", "authority", "yes", "flags"],
|
|
251
|
-
"set-economics": ["url", "priority-fee", "keypair", "authority", "yes", "bounty", "create-fee", "kind-fees", "partner-cut"],
|
|
252
|
-
"update-config": [
|
|
253
|
-
"url",
|
|
254
|
-
"priority-fee",
|
|
255
|
-
"keypair",
|
|
256
|
-
"authority",
|
|
257
|
-
"yes",
|
|
258
|
-
"guardian",
|
|
259
|
-
"fee-recipient",
|
|
260
|
-
"fee-bps",
|
|
261
|
-
"kinds",
|
|
262
|
-
"fill-disabled",
|
|
263
|
-
],
|
|
264
|
-
"propose-admin": ["url", "priority-fee", "keypair", "authority", "yes", "new-admin"],
|
|
265
|
-
"accept-admin": ["url", "priority-fee", "keypair", "authority", "yes"],
|
|
266
|
-
solve: ["url", "priority-fee", "keypair", "jupiter", "issue", "jito", "tip", "min-profit", "max-fee-bps", "slippage-bps", "route-program", "lookup-table", "watch", "interval"],
|
|
267
|
-
"solver-table": ["url", "solver", "mints"],
|
|
268
|
-
"lower-pause": ["url", "priority-fee", "keypair", "authority", "yes", "flags"],
|
|
269
|
-
events: ["url", "limit", "follow", "interval"],
|
|
270
|
-
crank: ["url", "priority-fee", "keypair", "dry-run", "fund-accounts"],
|
|
271
|
-
treasury: ["url", "priority-fee", "keypair", "yes", "mints", "create"],
|
|
272
|
-
create: [
|
|
273
|
-
"url",
|
|
274
|
-
"priority-fee",
|
|
275
|
-
"keypair",
|
|
276
|
-
"yes",
|
|
277
|
-
"nonce",
|
|
278
|
-
"input-mint",
|
|
279
|
-
"output-mint",
|
|
280
|
-
...EXPIRY,
|
|
281
|
-
...ORDER,
|
|
282
|
-
"partner",
|
|
283
|
-
"partner-bps",
|
|
284
|
-
"units",
|
|
285
|
-
],
|
|
286
|
-
list: ["url", "keypair", "owner"],
|
|
287
|
-
mandate: [
|
|
288
|
-
"url",
|
|
289
|
-
"priority-fee",
|
|
290
|
-
"keypair",
|
|
291
|
-
"yes",
|
|
292
|
-
"owner",
|
|
293
|
-
"agent",
|
|
294
|
-
"id",
|
|
295
|
-
"input-mint",
|
|
296
|
-
"output-mint",
|
|
297
|
-
"kinds",
|
|
298
|
-
"per-intent",
|
|
299
|
-
"total",
|
|
300
|
-
"max-intents",
|
|
301
|
-
"max-ttl",
|
|
302
|
-
"valid-for",
|
|
303
|
-
"floor-out",
|
|
304
|
-
"floor-in",
|
|
305
|
-
"partner",
|
|
306
|
-
"partner-bps",
|
|
307
|
-
"agent-fee",
|
|
308
|
-
"nonce",
|
|
309
|
-
...EXPIRY,
|
|
310
|
-
...ORDER,
|
|
311
|
-
"units",
|
|
312
|
-
],
|
|
313
|
-
approve: ["url", "priority-fee", "keypair", "yes", "mint", "amount", "units"],
|
|
314
|
-
"revoke-approval": ["url", "priority-fee", "keypair", "yes", "mint"],
|
|
315
|
-
signed: [
|
|
316
|
-
"url",
|
|
317
|
-
"keypair",
|
|
318
|
-
"yes",
|
|
319
|
-
"out",
|
|
320
|
-
"file",
|
|
321
|
-
"nonce",
|
|
322
|
-
"input-mint",
|
|
323
|
-
"output-mint",
|
|
324
|
-
"submit-within",
|
|
325
|
-
"relayer-fee",
|
|
326
|
-
...EXPIRY,
|
|
327
|
-
...ORDER,
|
|
328
|
-
"partner",
|
|
329
|
-
"partner-bps",
|
|
330
|
-
"units",
|
|
331
|
-
],
|
|
332
|
-
};
|
|
333
|
-
export const SUB_ACCEPTS = {
|
|
334
|
-
mandate: {
|
|
335
|
-
grant: [
|
|
336
|
-
"url",
|
|
337
|
-
"priority-fee",
|
|
338
|
-
"keypair",
|
|
339
|
-
"yes",
|
|
340
|
-
"agent",
|
|
341
|
-
"id",
|
|
342
|
-
"input-mint",
|
|
343
|
-
"output-mint",
|
|
344
|
-
"kinds",
|
|
345
|
-
"per-intent",
|
|
346
|
-
"total",
|
|
347
|
-
"max-intents",
|
|
348
|
-
"max-ttl",
|
|
349
|
-
"valid-for",
|
|
350
|
-
"floor-out",
|
|
351
|
-
"floor-in",
|
|
352
|
-
"partner",
|
|
353
|
-
"partner-bps",
|
|
354
|
-
"agent-fee",
|
|
355
|
-
"units",
|
|
356
|
-
],
|
|
357
|
-
show: ["url", "keypair", "agent", "id", "owner"],
|
|
358
|
-
revoke: ["url", "priority-fee", "keypair", "yes", "agent", "id"],
|
|
359
|
-
use: ["url", "priority-fee", "keypair", "yes", "owner", "id", "nonce", ...EXPIRY, ...MANDATE_ORDER, "units"],
|
|
360
|
-
},
|
|
361
|
-
signed: {
|
|
362
|
-
prepare: [
|
|
363
|
-
"url",
|
|
364
|
-
"keypair",
|
|
365
|
-
"yes",
|
|
366
|
-
"out",
|
|
367
|
-
"nonce",
|
|
368
|
-
"input-mint",
|
|
369
|
-
"output-mint",
|
|
370
|
-
"submit-within",
|
|
371
|
-
"relayer-fee",
|
|
372
|
-
...EXPIRY,
|
|
373
|
-
...ORDER,
|
|
374
|
-
"partner",
|
|
375
|
-
"partner-bps",
|
|
376
|
-
"units",
|
|
377
|
-
],
|
|
378
|
-
submit: ["url", "keypair", "yes", "file"],
|
|
379
|
-
},
|
|
380
|
-
};
|
|
381
|
-
function noRepeats(argv) {
|
|
382
|
-
const seen = new Set();
|
|
383
|
-
for (const arg of argv) {
|
|
384
|
-
if (arg === "--") {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
if (!arg.startsWith("--")) {
|
|
388
|
-
continue;
|
|
389
|
-
}
|
|
390
|
-
const name = arg.slice(2).split("=")[0] ?? "";
|
|
391
|
-
if (seen.has(name)) {
|
|
392
|
-
throw new UsageError(`--${name} is given more than once`);
|
|
393
|
-
}
|
|
394
|
-
seen.add(name);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
function onlyAccepted(verb, sub, values) {
|
|
398
|
-
const accepted = verb === undefined ? undefined : (SUB_ACCEPTS[verb]?.[sub ?? ""] ?? ACCEPTS[verb]);
|
|
399
|
-
const named = verb !== undefined && SUB_ACCEPTS[verb]?.[sub ?? ""] !== undefined ? `${verb} ${sub}` : verb;
|
|
400
|
-
if (accepted === undefined) {
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
for (const [key, value] of Object.entries(values)) {
|
|
404
|
-
if (value !== undefined &&
|
|
405
|
-
!accepted.includes(key) &&
|
|
406
|
-
!GLOBAL_OPTIONS.includes(key)) {
|
|
407
|
-
throw new UsageError(`${named} does not take --${key}`);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
function required(values, key) {
|
|
412
|
-
const value = values[key];
|
|
413
|
-
if (value === undefined) {
|
|
414
|
-
throw new UsageError(`missing --${key}`);
|
|
415
|
-
}
|
|
416
|
-
return value;
|
|
417
|
-
}
|
|
418
|
-
export function parseU64(text, key) {
|
|
419
|
-
if (!/^\d+$/.test(text) || BigInt(text) > U64_MAX) {
|
|
420
|
-
throw new UsageError(`--${key} must be an integer from 0 to ${U64_MAX}`);
|
|
421
|
-
}
|
|
422
|
-
return BigInt(text);
|
|
423
|
-
}
|
|
424
|
-
export function parseI64(text, key) {
|
|
425
|
-
if (!/^-?\d+$/.test(text) || BigInt(text) < I64_MIN || BigInt(text) > I64_MAX) {
|
|
426
|
-
throw new UsageError(`--${key} must be an integer from ${I64_MIN} to ${I64_MAX}`);
|
|
427
|
-
}
|
|
428
|
-
return BigInt(text);
|
|
429
|
-
}
|
|
430
|
-
function parseAddress(text, key) {
|
|
431
|
-
try {
|
|
432
|
-
return address(text);
|
|
433
|
-
}
|
|
434
|
-
catch {
|
|
435
|
-
throw new UsageError(`--${key} is not a base58 address`);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
const u64 = (values, key) => parseU64(required(values, key), key);
|
|
439
|
-
const key = (values, name) => parseAddress(required(values, name), name);
|
|
440
|
-
function amountOf(values, name) {
|
|
441
|
-
const side = TOKEN_SIDES[name];
|
|
442
|
-
if (values.units === "raw" || side === undefined) {
|
|
443
|
-
return u64(values, name).toString();
|
|
444
|
-
}
|
|
445
|
-
const text = required(values, name);
|
|
446
|
-
if (!TOKEN_AMOUNT_PATTERN.test(text)) {
|
|
447
|
-
throw new UsageError(`--${name} must be a token amount like 12 or 0.5`);
|
|
448
|
-
}
|
|
449
|
-
return { tokens: text, side };
|
|
450
|
-
}
|
|
451
|
-
function unitsOf(values) {
|
|
452
|
-
if (values.units !== undefined && values.units !== "raw" && values.units !== "tokens") {
|
|
453
|
-
throw new UsageError("--units must be raw or tokens");
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
const timeOf = (values, name) => parseI64(required(values, name), name).toString();
|
|
457
|
-
const ORDER_FIELDS = {
|
|
458
|
-
swap: ["amount-in", "min-out"],
|
|
459
|
-
limit: ["make", "take"],
|
|
460
|
-
dutch: ["amount-in", "start-out", "end-out", "start-at", "end-at"],
|
|
461
|
-
attested: ["amount-in", "min-result", "max-result", "attestor"],
|
|
462
|
-
};
|
|
463
|
-
export function order(kind, values) {
|
|
464
|
-
const fields = kind === undefined ? undefined : ORDER_FIELDS[kind];
|
|
465
|
-
if (fields === undefined) {
|
|
466
|
-
throw new UsageError("name the order kind: swap, limit, dutch or attested");
|
|
467
|
-
}
|
|
468
|
-
for (const name of ORDER) {
|
|
469
|
-
if (values[name] !== undefined && !fields.includes(name)) {
|
|
470
|
-
throw new UsageError(`a ${kind} order does not take --${name}`);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
switch (kind) {
|
|
474
|
-
case "swap":
|
|
475
|
-
return { kind, amount_in: amountOf(values, "amount-in"), min_out: amountOf(values, "min-out") };
|
|
476
|
-
case "limit":
|
|
477
|
-
return { kind, make_amount: amountOf(values, "make"), take_amount: amountOf(values, "take") };
|
|
478
|
-
case "dutch":
|
|
479
|
-
return {
|
|
480
|
-
kind,
|
|
481
|
-
amount_in: amountOf(values, "amount-in"),
|
|
482
|
-
start_out: amountOf(values, "start-out"),
|
|
483
|
-
end_out: amountOf(values, "end-out"),
|
|
484
|
-
start_time: timeOf(values, "start-at"),
|
|
485
|
-
end_time: timeOf(values, "end-at"),
|
|
486
|
-
};
|
|
487
|
-
default:
|
|
488
|
-
return {
|
|
489
|
-
kind,
|
|
490
|
-
amount_in: amountOf(values, "amount-in"),
|
|
491
|
-
min_result: amountOf(values, "min-result"),
|
|
492
|
-
max_result: amountOf(values, "max-result"),
|
|
493
|
-
attestor: key(values, "attestor"),
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
export function expiry(values) {
|
|
498
|
-
if ((values["expires-at"] === undefined) === (values["expires-in"] === undefined)) {
|
|
499
|
-
throw new UsageError("give exactly one of --expires-at or --expires-in");
|
|
500
|
-
}
|
|
501
|
-
return values["expires-at"] === undefined
|
|
502
|
-
? { expires_in: parseBounded(required(values, "expires-in"), "expires-in", MAX_EXPIRES_IN) }
|
|
503
|
-
: { expires_at: timeOf(values, "expires-at") };
|
|
504
|
-
}
|
|
505
|
-
function partner(values) {
|
|
506
|
-
if (values.partner === undefined && values["partner-bps"] === undefined) {
|
|
507
|
-
return {};
|
|
508
|
-
}
|
|
509
|
-
return {
|
|
510
|
-
partner: {
|
|
511
|
-
account: key(values, "partner"),
|
|
512
|
-
bps: parseBounded(required(values, "partner-bps"), "partner-bps", MAX_PARTNER_BPS),
|
|
513
|
-
},
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
const optionalField = (values, name, field, read) => values[name] === undefined ? {} : { [field]: read(values, name) };
|
|
517
|
-
function terms(kind, values) {
|
|
518
|
-
return {
|
|
519
|
-
input_mint: key(values, "input-mint"),
|
|
520
|
-
output_mint: key(values, "output-mint"),
|
|
521
|
-
order: order(kind, values),
|
|
522
|
-
...expiry(values),
|
|
523
|
-
...optionalField(values, "nonce", "nonce", amountOf),
|
|
524
|
-
...partner(values),
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
function grant(values) {
|
|
528
|
-
const kinds = required(values, "kinds").split(",");
|
|
529
|
-
for (const name of kinds) {
|
|
530
|
-
if (!MANDATE_KIND_NAMES.includes(name)) {
|
|
531
|
-
throw new UsageError(`--kinds takes a comma list of swap, limit, dutch; got ${name}`);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
return {
|
|
535
|
-
agent: key(values, "agent"),
|
|
536
|
-
input_mint: key(values, "input-mint"),
|
|
537
|
-
output_mint: key(values, "output-mint"),
|
|
538
|
-
kinds,
|
|
539
|
-
per_intent: amountOf(values, "per-intent"),
|
|
540
|
-
total: amountOf(values, "total"),
|
|
541
|
-
max_intents: parseBounded(required(values, "max-intents"), "max-intents", 0xffff_ffff),
|
|
542
|
-
max_ttl: parseBounded(required(values, "max-ttl"), "max-ttl", MAX_EXPIRES_IN),
|
|
543
|
-
valid_for: parseBounded(required(values, "valid-for"), "valid-for", MAX_EXPIRES_IN),
|
|
544
|
-
floor: { out: amountOf(values, "floor-out"), in: amountOf(values, "floor-in") },
|
|
545
|
-
...optionalField(values, "id", "id", amountOf),
|
|
546
|
-
...partner(values),
|
|
547
|
-
...optionalField(values, "agent-fee", "agent_fee", amountOf),
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
function mandate(sub, kind, remote, values) {
|
|
551
|
-
const flow = (name, input) => ({
|
|
552
|
-
name: "flow",
|
|
553
|
-
...remote,
|
|
554
|
-
flow: name,
|
|
555
|
-
keypair: required(values, "keypair"),
|
|
556
|
-
yes: values.yes === true,
|
|
557
|
-
input,
|
|
558
|
-
});
|
|
559
|
-
const ref = () => ({ agent: key(values, "agent"), ...optionalField(values, "id", "id", amountOf) });
|
|
560
|
-
if (sub !== "use") {
|
|
561
|
-
noSub(kind);
|
|
562
|
-
}
|
|
563
|
-
switch (sub) {
|
|
564
|
-
case "grant":
|
|
565
|
-
return flow("mandate-grant", grant(values));
|
|
566
|
-
case "revoke":
|
|
567
|
-
return flow("mandate-revoke", ref());
|
|
568
|
-
case "show":
|
|
569
|
-
return {
|
|
570
|
-
name: "lookup",
|
|
571
|
-
...remote,
|
|
572
|
-
lookup: "mandate-show",
|
|
573
|
-
keypair: values.keypair,
|
|
574
|
-
input: { ...ref(), ...optionalField(values, "owner", "owner", key) },
|
|
575
|
-
};
|
|
576
|
-
case "use":
|
|
577
|
-
if (kind === "attested") {
|
|
578
|
-
throw new UsageError(MANDATE_USE_KINDS);
|
|
579
|
-
}
|
|
580
|
-
return flow("mandate-use", {
|
|
581
|
-
owner: key(values, "owner"),
|
|
582
|
-
order: order(kind, values),
|
|
583
|
-
...expiry(values),
|
|
584
|
-
...optionalField(values, "id", "id", amountOf),
|
|
585
|
-
...optionalField(values, "nonce", "nonce", amountOf),
|
|
586
|
-
});
|
|
587
|
-
default:
|
|
588
|
-
throw new UsageError("mandate needs grant, show, revoke or use");
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
function https(text, key) {
|
|
592
|
-
let parsed;
|
|
593
|
-
try {
|
|
594
|
-
parsed = new URL(text);
|
|
595
|
-
}
|
|
596
|
-
catch {
|
|
597
|
-
throw new UsageError(`--${key} is not a url`);
|
|
598
|
-
}
|
|
599
|
-
if (parsed.protocol !== "https:") {
|
|
600
|
-
throw new UsageError(`--${key} must be an https url`);
|
|
601
|
-
}
|
|
602
|
-
return text.replace(/\/+$/, "");
|
|
603
|
-
}
|
|
604
|
-
function relaySpec(values) {
|
|
605
|
-
const policy = [
|
|
606
|
-
values["relay-max-lamports"],
|
|
607
|
-
values["relay-max-ttl"],
|
|
608
|
-
values["relay-per-hour"],
|
|
609
|
-
values["relay-hourly-lamports"],
|
|
610
|
-
values["relay-fee"],
|
|
611
|
-
];
|
|
612
|
-
if (values.relayer === undefined) {
|
|
613
|
-
if (policy.some((v) => v !== undefined)) {
|
|
614
|
-
throw new UsageError("the --relay-* limits need --relayer");
|
|
615
|
-
}
|
|
616
|
-
return undefined;
|
|
617
|
-
}
|
|
618
|
-
if (values["relay-fee"] === undefined) {
|
|
619
|
-
throw new UsageError(RELAY_NEEDS_FEES);
|
|
620
|
-
}
|
|
621
|
-
const maxTtl = parseBounded(values["relay-max-ttl"] ?? String(RELAY_DEFAULT_TTL), "relay-max-ttl", RELAY_MAX_TTL);
|
|
622
|
-
const perHour = parseBounded(values["relay-per-hour"] ?? String(RELAY_DEFAULT_PER_HOUR), "relay-per-hour", 3_600);
|
|
623
|
-
if (maxTtl < RELAY_MIN_TTL || perHour < 1) {
|
|
624
|
-
throw new UsageError(`--relay-max-ttl must be at least ${RELAY_MIN_TTL} and --relay-per-hour at least 1`);
|
|
625
|
-
}
|
|
626
|
-
return {
|
|
627
|
-
keypair: values.relayer,
|
|
628
|
-
maxLamports: values["relay-max-lamports"] === undefined ? 0n : u64(values, "relay-max-lamports"),
|
|
629
|
-
maxTtl: BigInt(maxTtl),
|
|
630
|
-
perHour,
|
|
631
|
-
hourlyLamports: values["relay-hourly-lamports"] === undefined
|
|
632
|
-
? RELAY_DEFAULT_HOURLY_LAMPORTS
|
|
633
|
-
: u64(values, "relay-hourly-lamports"),
|
|
634
|
-
fees: mintAmounts(values["relay-fee"], "relay-fee"),
|
|
635
|
-
};
|
|
636
|
-
}
|
|
637
|
-
function mintAmounts(text, name) {
|
|
638
|
-
const amounts = new Map();
|
|
639
|
-
for (const entry of text === undefined ? [] : text.split(",")) {
|
|
640
|
-
const [mint, amount, ...rest] = entry.split("=");
|
|
641
|
-
if (mint === undefined || amount === undefined || rest.length > 0) {
|
|
642
|
-
throw new UsageError(`--${name} takes mint=amount pairs separated by commas`);
|
|
643
|
-
}
|
|
644
|
-
const key = parseAddress(mint.trim(), name);
|
|
645
|
-
if (amounts.has(key)) {
|
|
646
|
-
throw new UsageError(`--${name} names ${key} twice`);
|
|
647
|
-
}
|
|
648
|
-
amounts.set(key, parseU64(amount.trim(), name));
|
|
649
|
-
}
|
|
650
|
-
return amounts;
|
|
651
|
-
}
|
|
652
|
-
export const WALLET_LIMITS_NEED_WALLET = "--wallet-per-trade and --wallet-per-hour need --wallet";
|
|
653
|
-
const wholeTokens = (key) => `--${key} takes token=amount pairs separated by commas, such as SOL=0.1,TEST=20`;
|
|
654
|
-
function tokenAmounts(text, key, url) {
|
|
655
|
-
const amounts = new Map();
|
|
656
|
-
for (const entry of text === undefined ? [] : text.split(",")) {
|
|
657
|
-
const [name, amount, ...rest] = entry.split("=");
|
|
658
|
-
if (name === undefined || amount === undefined || rest.length > 0 || !TOKEN_AMOUNT_PATTERN.test(amount.trim())) {
|
|
659
|
-
throw new UsageError(wholeTokens(key));
|
|
660
|
-
}
|
|
661
|
-
const mint = tokenNamed(name.trim(), url);
|
|
662
|
-
if (mint instanceof Error) {
|
|
663
|
-
throw new UsageError(`--${key}: ${mint.message}`);
|
|
664
|
-
}
|
|
665
|
-
const parsed = parseAddress(mint, key);
|
|
666
|
-
if (amounts.has(parsed)) {
|
|
667
|
-
throw new UsageError(`--${key} names ${name.trim()} twice`);
|
|
668
|
-
}
|
|
669
|
-
amounts.set(parsed, amount.trim());
|
|
670
|
-
}
|
|
671
|
-
return amounts;
|
|
672
|
-
}
|
|
673
|
-
function walletLimits(values, url) {
|
|
674
|
-
if (values.wallet !== true) {
|
|
675
|
-
if (values["wallet-per-trade"] !== undefined || values["wallet-per-hour"] !== undefined) {
|
|
676
|
-
throw new UsageError(WALLET_LIMITS_NEED_WALLET);
|
|
677
|
-
}
|
|
678
|
-
return null;
|
|
679
|
-
}
|
|
680
|
-
return {
|
|
681
|
-
perTrade: tokenAmounts(values["wallet-per-trade"], "wallet-per-trade", url),
|
|
682
|
-
perHour: tokenAmounts(values["wallet-per-hour"], "wallet-per-hour", url),
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
function agentSpec(values) {
|
|
686
|
-
if (values.agent === undefined) {
|
|
687
|
-
if (values["agent-hourly-lamports"] !== undefined || values["agent-owners"] !== undefined) {
|
|
688
|
-
throw new UsageError("the --agent-* limits need --agent");
|
|
689
|
-
}
|
|
690
|
-
return undefined;
|
|
691
|
-
}
|
|
692
|
-
const owners = values["agent-owners"];
|
|
693
|
-
if (owners === undefined) {
|
|
694
|
-
throw new UsageError(AGENT_NEEDS_OWNERS);
|
|
695
|
-
}
|
|
696
|
-
return {
|
|
697
|
-
keypair: values.agent,
|
|
698
|
-
hourlyLamports: values["agent-hourly-lamports"] === undefined
|
|
699
|
-
? AGENT_DEFAULT_HOURLY_LAMPORTS
|
|
700
|
-
: u64(values, "agent-hourly-lamports"),
|
|
701
|
-
owners: owners.split(",").map((o) => parseAddress(o.trim(), "agent-owners")),
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
|
-
export function parsePriority(text) {
|
|
705
|
-
if (text === undefined) {
|
|
706
|
-
return 0n;
|
|
707
|
-
}
|
|
708
|
-
if (text === "auto") {
|
|
709
|
-
return "auto";
|
|
710
|
-
}
|
|
711
|
-
const price = parseU64(text, "priority-fee");
|
|
712
|
-
if (price > MAX_PRIORITY_PRICE) {
|
|
713
|
-
throw new UsageError(`--priority-fee is micro-lamports per compute unit and at most ${MAX_PRIORITY_PRICE}; use auto for the recent market price`);
|
|
714
|
-
}
|
|
715
|
-
return price;
|
|
716
|
-
}
|
|
717
|
-
function authorityOf(values) {
|
|
718
|
-
if (values.keypair !== undefined && values.authority !== undefined) {
|
|
719
|
-
throw new UsageError("pass --keypair to sign and send, or --authority to print an unsigned transaction, not both");
|
|
720
|
-
}
|
|
721
|
-
if (values.authority !== undefined) {
|
|
722
|
-
if (values.yes === true) {
|
|
723
|
-
throw new UsageError("--yes signs and sends with --keypair; --authority only prints an unsigned transaction");
|
|
724
|
-
}
|
|
725
|
-
return { authority: key(values, "authority") };
|
|
726
|
-
}
|
|
727
|
-
return { keypair: required(values, "keypair"), yes: values.yes === true };
|
|
728
|
-
}
|
|
729
|
-
function configChange(values) {
|
|
730
|
-
const change = {
|
|
731
|
-
guardian: values.guardian === undefined ? undefined : key(values, "guardian"),
|
|
732
|
-
feeRecipient: values["fee-recipient"] === undefined ? undefined : key(values, "fee-recipient"),
|
|
733
|
-
feeBps: values["fee-bps"] === undefined ? undefined : parseFeeBps(values["fee-bps"]),
|
|
734
|
-
enabledKinds: values.kinds === undefined ? undefined : parseKinds(values.kinds),
|
|
735
|
-
fillDisabledKinds: values["fill-disabled"] === undefined ? undefined : parseKindSet(values["fill-disabled"], "fill-disabled", true),
|
|
736
|
-
};
|
|
737
|
-
if (Object.values(change).every((v) => v === undefined)) {
|
|
738
|
-
throw new UsageError("update-config needs at least one of --guardian, --fee-recipient, --fee-bps, --kinds, --fill-disabled");
|
|
739
|
-
}
|
|
740
|
-
return change;
|
|
741
|
-
}
|
|
742
|
-
const MINT_KEYS = ["input-mint", "output-mint", "mint"];
|
|
743
|
-
function resolved(text, url) {
|
|
744
|
-
const mint = tokenNamed(text, url);
|
|
745
|
-
if (mint instanceof Error) {
|
|
746
|
-
throw new UsageError(mint.message);
|
|
747
|
-
}
|
|
748
|
-
return mint;
|
|
749
|
-
}
|
|
750
|
-
function named(values, url) {
|
|
751
|
-
for (const name of MINT_KEYS) {
|
|
752
|
-
const text = values[name];
|
|
753
|
-
if (text !== undefined) {
|
|
754
|
-
values[name] = resolved(text, url);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
if (values.mints !== undefined) {
|
|
758
|
-
values.mints = values.mints
|
|
759
|
-
.split(",")
|
|
760
|
-
.map((m) => resolved(m.trim(), url))
|
|
761
|
-
.join(",");
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
function mintList(text) {
|
|
765
|
-
return addressList(text, "mints");
|
|
766
|
-
}
|
|
767
|
-
export const ISSUE_FORMAT = "--issue takes <input mint>:<output mint>=<out>/<in> entries separated by commas";
|
|
768
|
-
export const ONE_MARKET = "solve needs exactly one of --jupiter or --issue";
|
|
769
|
-
export const ISSUE_ALONE = "--issue mints the output itself, so --slippage-bps and --route-program do not apply";
|
|
770
|
-
function issues(text) {
|
|
771
|
-
const routes = [];
|
|
772
|
-
for (const entry of text.split(",")) {
|
|
773
|
-
const match = /^([^:=/]+):([^:=/]+)=([^:=/]+)\/([^:=/]+)$/.exec(entry.trim());
|
|
774
|
-
if (match === null) {
|
|
775
|
-
throw new UsageError(ISSUE_FORMAT);
|
|
776
|
-
}
|
|
777
|
-
const [, input = "", output = "", out = "", per = ""] = match;
|
|
778
|
-
const route = {
|
|
779
|
-
inputMint: parseAddress(input.trim(), "issue"),
|
|
780
|
-
outputMint: parseAddress(output.trim(), "issue"),
|
|
781
|
-
out: parseU64(out.trim(), "issue"),
|
|
782
|
-
in: parseU64(per.trim(), "issue"),
|
|
783
|
-
};
|
|
784
|
-
if (route.out === 0n || route.in === 0n) {
|
|
785
|
-
throw new UsageError("--issue rates must be positive on both sides");
|
|
786
|
-
}
|
|
787
|
-
if (routes.some((r) => r.inputMint === route.inputMint && r.outputMint === route.outputMint)) {
|
|
788
|
-
throw new UsageError(`--issue names ${route.inputMint}:${route.outputMint} twice`);
|
|
789
|
-
}
|
|
790
|
-
routes.push(route);
|
|
791
|
-
}
|
|
792
|
-
return routes;
|
|
793
|
-
}
|
|
794
|
-
function market(values) {
|
|
795
|
-
if ((values.jupiter === undefined) === (values.issue === undefined)) {
|
|
796
|
-
throw new UsageError(ONE_MARKET);
|
|
797
|
-
}
|
|
798
|
-
if (values.issue === undefined) {
|
|
799
|
-
return { jupiter: https(required(values, "jupiter"), "jupiter"), issue: [] };
|
|
800
|
-
}
|
|
801
|
-
if (values["slippage-bps"] !== undefined || values["route-program"] !== undefined) {
|
|
802
|
-
throw new UsageError(ISSUE_ALONE);
|
|
803
|
-
}
|
|
804
|
-
return { jupiter: undefined, issue: issues(values.issue) };
|
|
805
|
-
}
|
|
806
|
-
function addressList(text, name) {
|
|
807
|
-
const items = [...new Set(text.split(",").map((m) => m.trim()))];
|
|
808
|
-
if (items.some((m) => m === "")) {
|
|
809
|
-
throw new UsageError(`--${name} takes a comma list of addresses`);
|
|
810
|
-
}
|
|
811
|
-
return items.map((m) => parseAddress(m, name));
|
|
812
|
-
}
|
|
813
|
-
export const TREASURY_CREATE_NEEDS_MINTS = "--create needs --mints naming the tokens to open treasury accounts for; anyone can open intents in any token, so the list must be yours";
|
|
814
|
-
function treasury(remote, values) {
|
|
815
|
-
const create = values.create === true;
|
|
816
|
-
if (values.yes === true && !create) {
|
|
817
|
-
throw new UsageError("--yes only applies with --create");
|
|
818
|
-
}
|
|
819
|
-
if (create && values.mints === undefined) {
|
|
820
|
-
throw new UsageError(TREASURY_CREATE_NEEDS_MINTS);
|
|
821
|
-
}
|
|
822
|
-
return {
|
|
823
|
-
name: "treasury",
|
|
824
|
-
...remote,
|
|
825
|
-
mints: values.mints === undefined ? null : mintList(values.mints),
|
|
826
|
-
create,
|
|
827
|
-
keypair: create ? required(values, "keypair") : values.keypair,
|
|
828
|
-
yes: values.yes === true,
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
function noSub(sub) {
|
|
832
|
-
if (sub !== undefined) {
|
|
833
|
-
throw new UsageError(`unexpected argument ${sub}`);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
28
|
export function clusterUrl(text) {
|
|
837
29
|
return CLUSTERS[text] ?? text;
|
|
838
30
|
}
|
|
839
|
-
export function outputOf(argv) {
|
|
840
|
-
const at = argv.lastIndexOf("--output");
|
|
841
|
-
const inline = argv.findLast((a) => a.startsWith("--output="));
|
|
842
|
-
const value = at >= 0 ? argv[at + 1] : inline?.slice("--output=".length);
|
|
843
|
-
if (value === undefined) {
|
|
844
|
-
return "json";
|
|
845
|
-
}
|
|
846
|
-
if (value !== "json" && value !== "text") {
|
|
847
|
-
throw new UsageError("--output must be json or text");
|
|
848
|
-
}
|
|
849
|
-
return value;
|
|
850
|
-
}
|
|
851
31
|
export const MAX_FOLLOW_INTERVAL = 3_600;
|
|
852
32
|
export const WATCH_INTERVAL = 5;
|
|
853
|
-
export const COMMANDS = "setup | balance | pda | domain | mcp | show config | show intent | quote | cancel | expire | close | advance-nonce | advance-epoch | create swap|limit|dutch|attested | list | mandate grant|show|revoke|use <kind> | approve | revoke-approval | signed prepare <kind>|submit | init-config | update-config | set-economics | propose-admin | accept-admin | solve | raise-pause | lower-pause | crank | treasury | solver-table | events | version | help [command]";
|
|
854
|
-
export const USAGE = `usage: ${COMMANDS}`;
|
|
855
|
-
const MANDATE_ORDER_SHAPE = "(--amount-in --min-out | --make --take | --amount-in --start-out --end-out --start-at --end-at)";
|
|
856
|
-
const ORDER_SHAPE = "(--amount-in --min-out | --make --take | --amount-in --start-out --end-out --start-at --end-at | --amount-in --min-result --max-result --attestor)";
|
|
857
|
-
const PARTNER_SHAPE = "[--partner <address> --partner-bps <n>]";
|
|
858
|
-
export const SHAPES = {
|
|
859
|
-
setup: "[--url <cluster>] [--keypair <file>]",
|
|
860
|
-
balance: "[--keypair <file> | --owner <address>] [--mints <mint,...>]",
|
|
861
|
-
pda: "--owner <address> --nonce <n>",
|
|
862
|
-
show: "config | intent --owner <address> --nonce <n>",
|
|
863
|
-
domain: "",
|
|
864
|
-
mcp: "[--wallet [--wallet-per-trade <token=amount,...>] [--wallet-per-hour <token=amount,...>]] [--relayer <keypair> --relay-fee <mint=amount,...> [--relay-max-lamports] [--relay-max-ttl] [--relay-per-hour] [--relay-hourly-lamports]] [--agent <keypair> --agent-owners <address,...> [--agent-hourly-lamports]]",
|
|
865
|
-
quote: "--owner <address> --nonce <n> [--at <unix>]",
|
|
866
|
-
cancel: "--keypair <file> --nonce <n>",
|
|
867
|
-
expire: "--keypair <file> --owner <address> --nonce <n>",
|
|
868
|
-
close: "--keypair <file> --owner <address> --nonce <n>",
|
|
869
|
-
"advance-nonce": "--keypair <file> --base <n>",
|
|
870
|
-
"advance-epoch": "--keypair <file>",
|
|
871
|
-
"init-config": "(--keypair <file> [--yes] | --authority <address>) --guardian --fee-recipient --fee-bps --kinds [--flags create|fill|all]",
|
|
872
|
-
"update-config": "(--keypair <file> [--yes] | --authority <address>) and any of --guardian --fee-recipient --fee-bps --kinds --fill-disabled",
|
|
873
|
-
"propose-admin": "(--keypair <file> [--yes] | --authority <address>) --new-admin <address>",
|
|
874
|
-
"accept-admin": "(--keypair <file> [--yes] | --authority <address>)",
|
|
875
|
-
"raise-pause": "(--keypair <file> [--yes] | --authority <address>) --flags create|fill|all",
|
|
876
|
-
"lower-pause": "(--keypair <file> [--yes] | --authority <address>) --flags create|fill|all",
|
|
877
|
-
"set-economics": "(--keypair <file> [--yes] | --authority <address>) --bounty --create-fee [--kind-fees] [--partner-cut]",
|
|
878
|
-
solve: "--keypair <file> (--jupiter <url> | --issue <input mint>:<output mint>=<out>/<in>,...) --min-profit <output mint=raw,...> [--priority-fee <micro-lamports|auto>] [--max-fee-bps <n>] [--slippage-bps <n>] [--jito <url> [--tip <lamports>]] [--route-program <program the aggregator swaps through>] [--lookup-table <address,...>] [--watch [--interval <seconds>]]",
|
|
879
|
-
"solver-table": "--solver <address> --mints <mint,...>",
|
|
880
|
-
crank: "--keypair <file> [--dry-run] [--fund-accounts]",
|
|
881
|
-
treasury: "[--mints <mint,...>] [--create --mints <mint,...> --keypair <payer file> [--yes]]",
|
|
882
|
-
events: "[--limit <n>] [--follow [--interval <seconds>]]",
|
|
883
|
-
create: `swap|limit|dutch|attested --keypair <file> --input-mint --output-mint (--expires-at | --expires-in) ${ORDER_SHAPE} [--nonce <n>] ${PARTNER_SHAPE} [--units tokens|raw] [--yes]`,
|
|
884
|
-
list: "--owner <address> or --keypair <file>; --owner wins when both are given",
|
|
885
|
-
mandate: `grant --keypair <file> --agent --input-mint --output-mint --kinds --per-intent --total --max-intents --max-ttl --valid-for --floor-out --floor-in [--agent-fee] ${PARTNER_SHAPE} [--id] [--units tokens|raw] [--yes] | show --agent (--owner <address> | --keypair <file>) [--id] | revoke --keypair <file> --agent [--id] [--yes] | use swap|limit|dutch --keypair <file> --owner (--expires-at | --expires-in) ${MANDATE_ORDER_SHAPE} [--id] [--nonce <n>] [--units tokens|raw] [--yes]`,
|
|
886
|
-
approve: "--keypair <file> --mint <mint> --amount <amount> [--units tokens|raw] [--yes]",
|
|
887
|
-
"revoke-approval": "--keypair <file> --mint <mint> [--yes]",
|
|
888
|
-
signed: `prepare swap|limit|dutch|attested --keypair <file> --out <file> --input-mint --output-mint (--expires-at | --expires-in) ${ORDER_SHAPE} [--nonce <n>] [--submit-within <seconds>] [--relayer-fee] ${PARTNER_SHAPE} [--units tokens|raw] [--yes] | submit --keypair <relayer file> --file <file> [--yes]`,
|
|
889
|
-
};
|
|
890
|
-
export function usageOf(verb) {
|
|
891
|
-
const known = verb !== undefined && ACCEPTS[verb] !== undefined;
|
|
892
|
-
return {
|
|
893
|
-
usage: known ? `${verb} ${SHAPES[verb] ?? ""}`.trim() : COMMANDS,
|
|
894
|
-
options: known ? [...(ACCEPTS[verb] ?? []), ...GLOBAL_OPTIONS].map((o) => `--${o}`) : [],
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
33
|
export function parse(argv, env = {}) {
|
|
898
34
|
noRepeats(argv);
|
|
899
35
|
let parsed;
|
|
@@ -940,6 +76,9 @@ export function parse(argv, env = {}) {
|
|
|
940
76
|
case "pda":
|
|
941
77
|
noSub(sub);
|
|
942
78
|
return { name: "pda", owner: key(values, "owner"), nonce: u64(values, "nonce") };
|
|
79
|
+
case "hash":
|
|
80
|
+
noSub(sub);
|
|
81
|
+
return { name: "hash", artifact: required(values, "artifact") };
|
|
943
82
|
case "show":
|
|
944
83
|
if (sub === "config") {
|
|
945
84
|
return { name: "show-config", ...remote };
|
|
@@ -983,7 +122,14 @@ export function parse(argv, env = {}) {
|
|
|
983
122
|
};
|
|
984
123
|
case "cancel":
|
|
985
124
|
noSub(sub);
|
|
986
|
-
return {
|
|
125
|
+
return {
|
|
126
|
+
name: "cancel",
|
|
127
|
+
...remote,
|
|
128
|
+
keypair: required(values, "keypair"),
|
|
129
|
+
yes: values.yes === true,
|
|
130
|
+
nonce: u64(values, "nonce"),
|
|
131
|
+
close: values.close === true,
|
|
132
|
+
};
|
|
987
133
|
case "expire":
|
|
988
134
|
case "close":
|
|
989
135
|
noSub(sub);
|
|
@@ -991,6 +137,7 @@ export function parse(argv, env = {}) {
|
|
|
991
137
|
name: verb,
|
|
992
138
|
...remote,
|
|
993
139
|
keypair: required(values, "keypair"),
|
|
140
|
+
yes: values.yes === true,
|
|
994
141
|
owner: key(values, "owner"),
|
|
995
142
|
nonce: u64(values, "nonce"),
|
|
996
143
|
};
|
|
@@ -1046,6 +193,9 @@ export function parse(argv, env = {}) {
|
|
|
1046
193
|
if (values.interval !== undefined && values.watch !== true) {
|
|
1047
194
|
throw new UsageError("--interval needs --watch");
|
|
1048
195
|
}
|
|
196
|
+
if (remote.priority !== "auto" && remote.priority > AUTO_PRICE_CAP) {
|
|
197
|
+
throw new UsageError(solveFeeAboveCap);
|
|
198
|
+
}
|
|
1049
199
|
return {
|
|
1050
200
|
name: "solve",
|
|
1051
201
|
...remote,
|
|
@@ -1053,8 +203,10 @@ export function parse(argv, env = {}) {
|
|
|
1053
203
|
...market(values),
|
|
1054
204
|
jito: values.jito === undefined ? undefined : https(values.jito, "jito"),
|
|
1055
205
|
tipLamports,
|
|
1056
|
-
minProfit:
|
|
206
|
+
minProfit: profitFloors(required(values, "min-profit")),
|
|
1057
207
|
maxFeeBps: parseBounded(values["max-fee-bps"] ?? "100", "max-fee-bps", 200),
|
|
208
|
+
maxSolCost: values["max-sol-cost"] === undefined ? DEFAULT_MAX_SOL_COST : parseSolCost(values["max-sol-cost"]),
|
|
209
|
+
maxRent: values["max-rent"] === undefined ? DEFAULT_MAX_RENT : parseMaxRent(values["max-rent"]),
|
|
1058
210
|
slippageBps: parseBounded(values["slippage-bps"] ?? "50", "slippage-bps", 10_000),
|
|
1059
211
|
routeProgram: values["route-program"] === undefined ? undefined : parseAddress(values["route-program"], "route-program"),
|
|
1060
212
|
lookupTables: values["lookup-table"] === undefined ? [] : addressList(values["lookup-table"], "lookup-table"),
|
|
@@ -1087,6 +239,63 @@ export function parse(argv, env = {}) {
|
|
|
1087
239
|
case "treasury":
|
|
1088
240
|
noSub(sub);
|
|
1089
241
|
return treasury(remote, values);
|
|
242
|
+
case "jobs":
|
|
243
|
+
noSub(sub);
|
|
244
|
+
return { name: "jobs", ...remote, attestor: values.attestor === undefined ? undefined : key(values, "attestor") };
|
|
245
|
+
case "deliver":
|
|
246
|
+
noSub(sub);
|
|
247
|
+
return {
|
|
248
|
+
name: "deliver",
|
|
249
|
+
...remote,
|
|
250
|
+
keypair: required(values, "keypair"),
|
|
251
|
+
yes: values.yes === true,
|
|
252
|
+
intent: key(values, "intent"),
|
|
253
|
+
sha256: sha256Of(required(values, "sha256")),
|
|
254
|
+
workUrl: memoUrlOf(required(values, "work-url"), "work-url"),
|
|
255
|
+
};
|
|
256
|
+
case "deliveries":
|
|
257
|
+
noSub(sub);
|
|
258
|
+
return { name: "deliveries", ...remote, attestor: key(values, "attestor"), intent: key(values, "intent"), maxPages: maxPagesOf(values) };
|
|
259
|
+
case "receipt":
|
|
260
|
+
noSub(sub);
|
|
261
|
+
return {
|
|
262
|
+
name: "receipt",
|
|
263
|
+
...remote,
|
|
264
|
+
owner: key(values, "owner"),
|
|
265
|
+
nonce: u64(values, "nonce"),
|
|
266
|
+
sha256: values.sha256 === undefined ? undefined : sha256Of(values.sha256),
|
|
267
|
+
...releaseOption(values),
|
|
268
|
+
};
|
|
269
|
+
case "record-delivery":
|
|
270
|
+
noSub(sub);
|
|
271
|
+
return {
|
|
272
|
+
name: "record-delivery",
|
|
273
|
+
...remote,
|
|
274
|
+
keypair: required(values, "keypair"),
|
|
275
|
+
yes: values.yes === true,
|
|
276
|
+
owner: key(values, "owner"),
|
|
277
|
+
nonce: u64(values, "nonce"),
|
|
278
|
+
sha256: sha256Of(required(values, "sha256")),
|
|
279
|
+
...releaseOption(values),
|
|
280
|
+
};
|
|
281
|
+
case "judge":
|
|
282
|
+
noSub(sub);
|
|
283
|
+
return {
|
|
284
|
+
name: "judge",
|
|
285
|
+
...remote,
|
|
286
|
+
keypair: required(values, "keypair"),
|
|
287
|
+
yes: values.yes === true,
|
|
288
|
+
owner: key(values, "owner"),
|
|
289
|
+
nonce: u64(values, "nonce"),
|
|
290
|
+
spec: required(values, "spec"),
|
|
291
|
+
artifact: required(values, "artifact"),
|
|
292
|
+
run: runOf(required(values, "run")),
|
|
293
|
+
payTo: values["pay-to"] === undefined ? undefined : key(values, "pay-to"),
|
|
294
|
+
result: values.result === undefined ? undefined : u64(values, "result"),
|
|
295
|
+
timeout: parseBounded(values.timeout ?? String(JUDGE_TIMEOUT), "timeout", MAX_JUDGE_TIMEOUT, 1),
|
|
296
|
+
verdict: values.verdict,
|
|
297
|
+
maxPages: maxPagesOf(values),
|
|
298
|
+
};
|
|
1090
299
|
case "solver-table":
|
|
1091
300
|
noSub(sub);
|
|
1092
301
|
return { name: "solver-table", ...remote, solver: key(values, "solver"), mints: mintList(required(values, "mints")) };
|
|
@@ -1106,7 +315,7 @@ export function parse(argv, env = {}) {
|
|
|
1106
315
|
flow: "create",
|
|
1107
316
|
keypair: required(values, "keypair"),
|
|
1108
317
|
yes: values.yes === true,
|
|
1109
|
-
input:
|
|
318
|
+
input: createTerms(sub, values),
|
|
1110
319
|
};
|
|
1111
320
|
case "list":
|
|
1112
321
|
noSub(sub);
|