@artblocks/abx-cli 0.1.0-alpha.9 → 0.2.0
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/CHANGELOG.md +429 -0
- package/assets/renderer-scaffold/README.md +44 -13
- package/assets/renderer-scaffold/foundry.toml +5 -0
- package/assets/renderer-scaffold/remappings.txt +1 -1
- package/assets/renderer-scaffold/script/DeployHooks.s.sol +24 -0
- package/assets/renderer-scaffold/script/Preview.s.sol +99 -0
- package/assets/renderer-scaffold/src/MyHooks.sol +20 -0
- package/assets/renderer-scaffold/src/MyRenderer.sol +4 -4
- package/assets/renderer-scaffold/src/MyTraits.sol +2 -2
- package/assets/renderer-scaffold/test/MyRenderer.t.sol +60 -3
- package/dist/bin.d.ts +26 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +63 -0
- package/dist/bin.js.map +1 -0
- package/dist/capabilities.d.ts +132 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +175 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/commands/auth.d.ts +54 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +483 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/contract.d.ts +19 -0
- package/dist/commands/contract.d.ts.map +1 -0
- package/dist/commands/contract.js +171 -0
- package/dist/commands/contract.js.map +1 -0
- package/dist/commands/deploy.d.ts +296 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +5756 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/feedback.d.ts +7 -0
- package/dist/commands/feedback.d.ts.map +1 -0
- package/dist/commands/feedback.js +154 -0
- package/dist/commands/feedback.js.map +1 -0
- package/dist/commands/maintenance.d.ts +4 -0
- package/dist/commands/maintenance.d.ts.map +1 -0
- package/dist/commands/maintenance.js +114 -0
- package/dist/commands/maintenance.js.map +1 -0
- package/dist/commands/project.d.ts +458 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +1837 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/reads.d.ts +85 -0
- package/dist/commands/reads.d.ts.map +1 -0
- package/dist/commands/reads.js +881 -0
- package/dist/commands/reads.js.map +1 -0
- package/dist/commands/scaffold.d.ts +89 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/scaffold.js +741 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/service.d.ts +67 -0
- package/dist/commands/service.d.ts.map +1 -0
- package/dist/commands/service.js +761 -0
- package/dist/commands/service.js.map +1 -0
- package/dist/commands/storage.d.ts +51 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +399 -0
- package/dist/commands/storage.js.map +1 -0
- package/dist/commands/submit-app.d.ts +102 -0
- package/dist/commands/submit-app.d.ts.map +1 -0
- package/dist/commands/submit-app.js +638 -0
- package/dist/commands/submit-app.js.map +1 -0
- package/dist/config.d.ts +94 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +332 -12
- package/dist/config.js.map +1 -1
- package/dist/conformance.d.ts +31 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +400 -0
- package/dist/conformance.js.map +1 -0
- package/dist/contract-read-error.d.ts +5 -0
- package/dist/contract-read-error.d.ts.map +1 -0
- package/dist/contract-read-error.js +37 -0
- package/dist/contract-read-error.js.map +1 -0
- package/dist/creator-agent.d.ts +49 -0
- package/dist/creator-agent.d.ts.map +1 -0
- package/dist/creator-agent.js +363 -0
- package/dist/creator-agent.js.map +1 -0
- package/dist/creator-keyring.d.ts +26 -0
- package/dist/creator-keyring.d.ts.map +1 -0
- package/dist/creator-keyring.js +57 -0
- package/dist/creator-keyring.js.map +1 -0
- package/dist/creator-signer.d.ts +52 -0
- package/dist/creator-signer.d.ts.map +1 -0
- package/dist/creator-signer.js +267 -0
- package/dist/creator-signer.js.map +1 -0
- package/dist/deploy-plan.d.ts +218 -0
- package/dist/deploy-plan.d.ts.map +1 -0
- package/dist/deploy-plan.js +20 -0
- package/dist/deploy-plan.js.map +1 -0
- package/dist/deps.d.ts +6 -39
- package/dist/deps.d.ts.map +1 -1
- package/dist/deps.js +4 -68
- package/dist/deps.js.map +1 -1
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +32 -0
- package/dist/errors.js.map +1 -0
- package/dist/flag-allowlists.d.ts +53 -0
- package/dist/flag-allowlists.d.ts.map +1 -0
- package/dist/flag-allowlists.js +188 -0
- package/dist/flag-allowlists.js.map +1 -0
- package/dist/flags.d.ts +53 -0
- package/dist/flags.d.ts.map +1 -1
- package/dist/flags.js +151 -1
- package/dist/flags.js.map +1 -1
- package/dist/jsonout.d.ts +37 -0
- package/dist/jsonout.d.ts.map +1 -0
- package/dist/jsonout.js +79 -0
- package/dist/jsonout.js.map +1 -0
- package/dist/kind.d.ts +57 -0
- package/dist/kind.d.ts.map +1 -0
- package/dist/kind.js +122 -0
- package/dist/kind.js.map +1 -0
- package/dist/main.js +859 -5374
- package/dist/main.js.map +1 -1
- package/dist/mintpage.d.ts +17 -2
- package/dist/mintpage.d.ts.map +1 -1
- package/dist/mintpage.js +241 -54
- package/dist/mintpage.js.map +1 -1
- package/dist/output.d.ts +184 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +774 -0
- package/dist/output.js.map +1 -0
- package/dist/ownerops.d.ts +463 -59
- package/dist/ownerops.d.ts.map +1 -1
- package/dist/ownerops.js +2329 -366
- package/dist/ownerops.js.map +1 -1
- package/dist/preview.d.ts +23 -5
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +95 -43
- package/dist/preview.js.map +1 -1
- package/dist/provision.d.ts +3 -13
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +19 -21
- package/dist/provision.js.map +1 -1
- package/dist/remote.d.ts +116 -9
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +371 -14
- package/dist/remote.js.map +1 -1
- package/dist/riskgate.d.ts +101 -0
- package/dist/riskgate.d.ts.map +1 -0
- package/dist/riskgate.js +343 -0
- package/dist/riskgate.js.map +1 -0
- package/dist/scaffold.d.ts +12 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +56 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema.d.ts +36 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +121 -26
- package/dist/schema.js.map +1 -1
- package/dist/script-chunks.d.ts +8 -0
- package/dist/script-chunks.d.ts.map +1 -0
- package/dist/script-chunks.js +35 -0
- package/dist/script-chunks.js.map +1 -0
- package/dist/served.d.ts +30 -0
- package/dist/served.d.ts.map +1 -0
- package/dist/served.js +112 -0
- package/dist/served.js.map +1 -0
- package/dist/signer.d.ts +20 -1
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +110 -18
- package/dist/signer.js.map +1 -1
- package/dist/update-check.d.ts +60 -9
- package/dist/update-check.d.ts.map +1 -1
- package/dist/update-check.js +105 -18
- package/dist/update-check.js.map +1 -1
- package/package.json +17 -12
- package/skill/SKILL.md +213 -354
- package/skill/agents/openai.yaml +4 -0
- package/skill/reference/capabilities.md +195 -0
- package/skill/reference/code.md +236 -0
- package/skill/reference/creator-token.md +94 -0
- package/skill/reference/deploy.md +191 -0
- package/skill/reference/diagnose.md +178 -0
- package/skill/reference/hosting.md +191 -102
- package/skill/reference/operate.md +237 -0
- package/skill/reference/services.md +173 -0
- package/skill/reference/setup.md +221 -42
- package/assets/renderer-scaffold/src/interfaces/IAbxFieldRenderer.sol +0 -32
- package/assets/renderer-scaffold/src/interfaces/IAbxParams.sol +0 -26
- package/dist/inspect.d.ts +0 -48
- package/dist/inspect.d.ts.map +0 -1
- package/dist/inspect.js +0 -184
- package/dist/inspect.js.map +0 -1
- package/dist/migrate.d.ts +0 -65
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js +0 -180
- package/dist/migrate.js.map +0 -1
- package/dist/onchain-uri.d.ts +0 -97
- package/dist/onchain-uri.d.ts.map +0 -1
- package/dist/onchain-uri.js +0 -243
- package/dist/onchain-uri.js.map +0 -1
- package/dist/upload.d.ts +0 -28
- package/dist/upload.d.ts.map +0 -1
- package/dist/upload.js +0 -41
- package/dist/upload.js.map +0 -1
- package/skill/reference/code-projects.md +0 -246
- package/skill/reference/operating.md +0 -118
- package/skill/reference/troubleshooting.md +0 -28
package/dist/remote.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAEL,gBAAgB,EAMhB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,KAAK,KAAK,EAAC,MAAM,YAAY,CAAC;AAGtC,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAC1D,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,4FAA4F;IAC5F,QAAQ,EAAE,MAAM,CAAC;IACjB;;wCAEoC;IACpC,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC5B;AAED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CAQ/H;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAUzD;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,CAAC,EAAE,qBAAqB,EACxB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,qBAAqB,CAAC,CA4FhC;AAED,sGAAsG;AACtG,wBAAgB,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAA;CAAC,CAAC,GAAG,MAAM,CAS/F"}
|
package/dist/remote.js
CHANGED
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Remote-resolver resolution — which service `--remote` means, and whose credential drives it.
|
|
3
3
|
* The HTTP client itself lives in the SDK (`AbxServiceClient`, speaking the /v1 control plane from
|
|
4
|
-
*
|
|
4
|
+
* site/content/docs/using-abx/remote-services.mdx); this module owns the CLI conventions around it:
|
|
5
5
|
*
|
|
6
6
|
* --remote <name> a NAMED remote — `ABX_REMOTE_<NAME>_URL` + `ABX_REMOTE_<NAME>_TOKEN` in .env
|
|
7
|
-
* (same env-name normalization as ABX_RPC_URLS_<CHAIN>).
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* (same env-name normalization as ABX_RPC_URLS_<CHAIN>). "self" is just a name
|
|
8
|
+
* under this SAME convention — the node YOU run reads ABX_REMOTE_SELF_URL/_TOKEN
|
|
9
|
+
* with zero special-casing below. A managed provider's per-account API key lives
|
|
10
|
+
* under its own name — and deliberately NEVER falls back to ABX_REMOTE_SELF_TOKEN,
|
|
11
|
+
* so your node-admin secret can't silently go to a third party.
|
|
12
|
+
* `abx` is the built-in first-party name: https://services.abx.io plus
|
|
13
|
+
* ABX_SERVICES_API_KEY. It needs no URL pasted into project configuration.
|
|
14
|
+
* --remote <url> an ad-hoc URL — token from --remote-token or ABX_REMOTE_SELF_TOKEN (the local
|
|
15
|
+
* client credential for a node you run; `abx deploy-resolver` generates it).
|
|
12
16
|
* --remote bare: the self-host default — ABX_PUBLIC_BASE_URL (the URL baked on-chain,
|
|
13
|
-
* else ABX_RESOLVER_URL) +
|
|
17
|
+
* else ABX_RESOLVER_URL) + ABX_REMOTE_SELF_TOKEN.
|
|
14
18
|
*
|
|
15
19
|
* Every token here authorizes indexing/metadata control only — never on-chain signing — so the
|
|
16
20
|
* "no signing key on the host" rule is intact. (`--remote-token`, not `--token`: `--token` already
|
|
17
21
|
* means a token ID across the owner ops.)
|
|
22
|
+
*
|
|
23
|
+
* The RESOLVER's own env var — what gates ITS control plane, server-side (packages/token-api/src/
|
|
24
|
+
* control-plane.ts) — is unchanged: still `ABX_RESOLVER_ADMIN_TOKEN`. Only the CLIENT-side lookup
|
|
25
|
+
* for a self-run node moved to the named-remote grammar above; `abx deploy-resolver` prints the exact
|
|
26
|
+
* command that carries the value across the name boundary (fly secrets set ABX_RESOLVER_ADMIN_TOKEN
|
|
27
|
+
* from your local ABX_REMOTE_SELF_TOKEN).
|
|
18
28
|
*/
|
|
19
|
-
import { AbxServiceClient, AbxServiceError, envSuffix } from '@artblocks/abx-sdk';
|
|
29
|
+
import { AbxIndexTimeoutError, AbxServiceClient, AbxServiceError, CONTROL_PLANE_INTERFACE, envSuffix, indexProgress, isAccepted, } from '@artblocks/abx-sdk';
|
|
30
|
+
import { CHAIN } from './config.js';
|
|
31
|
+
import { bold, c, dim, g, info, ok, warn } from './output.js';
|
|
32
|
+
export const ABX_SERVICES_URL = 'https://services.abx.io';
|
|
33
|
+
export const ABX_SERVICES_API_KEY_VAR = 'ABX_SERVICES_API_KEY';
|
|
34
|
+
/** How to refer to the credential this target is using, in an error the creator has to act on. */
|
|
35
|
+
export function tokenSourceLabel(t) {
|
|
36
|
+
return t.tokenFrom === 'flag' ? 'the token you passed with --remote-token' : t.tokenVar;
|
|
37
|
+
}
|
|
20
38
|
/**
|
|
21
39
|
* Resolve the `--remote` flag value (undefined = local op → null). Pure: pass `env` in tests.
|
|
22
40
|
* `tokenFlag` is `--remote-token` and wins over any env token for this invocation.
|
|
@@ -31,11 +49,24 @@ export function resolveRemote(spec, tokenFlag, env = process.env) {
|
|
|
31
49
|
if (!base) {
|
|
32
50
|
throw new Error('`--remote` needs a target: pass `--remote <name>` (ABX_REMOTE_<NAME>_URL in .env), `--remote https://host`, or set ABX_PUBLIC_BASE_URL in .env');
|
|
33
51
|
}
|
|
34
|
-
return { url: strip(base), token: tokenFlag ?? env.
|
|
52
|
+
return { url: strip(base), token: tokenFlag ?? env.ABX_REMOTE_SELF_TOKEN, source: 'default', tokenVar: 'ABX_REMOTE_SELF_TOKEN', tokenFrom: tokenFlag ? 'flag' : 'env' };
|
|
35
53
|
}
|
|
36
54
|
// `--remote <url>` — ad-hoc URL, self-host credential conventions
|
|
37
55
|
if (spec.includes('://')) {
|
|
38
|
-
return { url: strip(spec), token: tokenFlag ?? env.
|
|
56
|
+
return { url: strip(spec), token: tokenFlag ?? env.ABX_REMOTE_SELF_TOKEN, source: 'url', tokenVar: 'ABX_REMOTE_SELF_TOKEN', tokenFrom: tokenFlag ? 'flag' : 'env' };
|
|
57
|
+
}
|
|
58
|
+
// The first-party provider has a stable, verified identity. Keep it out of standing agent docs
|
|
59
|
+
// and generic URL config: a user stores only the credential, while an explicit URL remains the
|
|
60
|
+
// escape hatch for local/staging services.
|
|
61
|
+
if (envSuffix(spec) === 'ABX') {
|
|
62
|
+
return {
|
|
63
|
+
url: ABX_SERVICES_URL,
|
|
64
|
+
token: tokenFlag ?? env[ABX_SERVICES_API_KEY_VAR],
|
|
65
|
+
name: 'ABX',
|
|
66
|
+
source: 'builtin',
|
|
67
|
+
tokenVar: ABX_SERVICES_API_KEY_VAR,
|
|
68
|
+
tokenFrom: tokenFlag ? 'flag' : 'env',
|
|
69
|
+
};
|
|
39
70
|
}
|
|
40
71
|
// `--remote <name>` — a named remote (a managed provider, another node of yours, a staging box)
|
|
41
72
|
const name = envSuffix(spec);
|
|
@@ -46,13 +77,32 @@ export function resolveRemote(spec, tokenFlag, env = process.env) {
|
|
|
46
77
|
throw new Error(`--remote ${spec}: no ${urlVar} in your .env. Set ${urlVar}=<the provider's base URL> (+ ${tokenVar}=<your API key>). ` +
|
|
47
78
|
`(Meant a URL? Pass a scheme: --remote https://host)`);
|
|
48
79
|
}
|
|
49
|
-
return { url: strip(url), token: tokenFlag ?? env[tokenVar], name, source: 'named', tokenVar };
|
|
80
|
+
return { url: strip(url), token: tokenFlag ?? env[tokenVar], name, source: 'named', tokenVar, tokenFrom: tokenFlag ? 'flag' : 'env' };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The OLD client-side var (`ABX_RESOLVER_ADMIN_TOKEN`) sitting unused in `.env` because the
|
|
84
|
+
* self-host default's credential moved to the named-remote grammar (`ABX_REMOTE_SELF_TOKEN`) — a
|
|
85
|
+
* silent fallback would mean an operator's `.env` never gets renamed, so this is the ONE place both
|
|
86
|
+
* {@link requireRemoteToken} (the hard-stop for a real command) and `abx doctor` (the same fault,
|
|
87
|
+
* surfaced before a command needs it) decide whether to flag it — sharing the check means they can
|
|
88
|
+
* never drift on the condition. `null` when there's nothing to flag (old var absent, or the new one
|
|
89
|
+
* is already set and simply wins).
|
|
90
|
+
*/
|
|
91
|
+
export function selfTokenMigrationWarning(env = process.env) {
|
|
92
|
+
if (!env.ABX_RESOLVER_ADMIN_TOKEN || env.ABX_REMOTE_SELF_TOKEN)
|
|
93
|
+
return null;
|
|
94
|
+
return ('ABX_RESOLVER_ADMIN_TOKEN is set but is no longer read for the self-host default — rename it to ' +
|
|
95
|
+
'ABX_REMOTE_SELF_TOKEN (and, if you address it by name, ABX_REMOTE_SELF_URL).');
|
|
50
96
|
}
|
|
51
97
|
/** The token, when the remote is the command's OBJECT (add/index/forget/render/migrate-dest) —
|
|
52
98
|
* a missing credential is a hard stop that names the exact var to set. */
|
|
53
99
|
export function requireRemoteToken(t, env = process.env) {
|
|
54
100
|
if (t.token)
|
|
55
101
|
return t.token;
|
|
102
|
+
if (t.source === 'builtin') {
|
|
103
|
+
throw new Error(`remote 'abx' needs ${ABX_SERVICES_API_KEY_VAR} in your private .env, or --remote-token. ` +
|
|
104
|
+
`Run \`abx auth login\` for the browser-approved flow (manual fallback: ${ABX_SERVICES_URL}/signup).`);
|
|
105
|
+
}
|
|
56
106
|
if (t.source === 'named') {
|
|
57
107
|
// The likeliest cause of "URL but no token" is a near-miss var name, and the value is sitting
|
|
58
108
|
// right there in .env — so name it instead of letting them diff strings by eye.
|
|
@@ -60,17 +110,27 @@ export function requireRemoteToken(t, env = process.env) {
|
|
|
60
110
|
throw new Error(`remote '${t.name}' has a URL but no token — set ${t.tokenVar} in your .env (the API key the provider issued), or pass --remote-token.` +
|
|
61
111
|
(nearMiss ? `\n Found ${nearMiss.key} in your env — that name isn't read; rename it to ${t.tokenVar}.` : ''));
|
|
62
112
|
}
|
|
113
|
+
// The self-host default/URL lane used to read ABX_RESOLVER_ADMIN_TOKEN directly. It's now just
|
|
114
|
+
// the named remote called "self" — no special-casing, same grammar as any other name — so the OLD
|
|
115
|
+
// var is never read here. No silent fallback: point at both new vars, once, by name.
|
|
116
|
+
const migration = selfTokenMigrationWarning(env);
|
|
117
|
+
if (migration)
|
|
118
|
+
throw new Error(`${migration} Or pass --remote-token.`);
|
|
63
119
|
throw new Error(`remote ops need ${t.tokenVar} in your .env — it must match the token set on the resolver ` +
|
|
64
120
|
'(`abx deploy-resolver` generates one and wires both sides). Or pass --remote-token.');
|
|
65
121
|
}
|
|
66
122
|
/** Every named remote configured in the env (`ABX_REMOTE_<NAME>_URL`). The normalized name is
|
|
67
123
|
* canonical — the env convention is lossy, so enumeration reads the env, never inverts it. */
|
|
68
124
|
export function listConfiguredRemotes(env = process.env) {
|
|
69
|
-
const out = [
|
|
125
|
+
const out = [
|
|
126
|
+
{ name: 'ABX', url: ABX_SERVICES_URL, hasToken: !!env[ABX_SERVICES_API_KEY_VAR] },
|
|
127
|
+
];
|
|
70
128
|
for (const [key, value] of Object.entries(env)) {
|
|
71
129
|
const m = /^ABX_REMOTE_(.+)_URL$/.exec(key);
|
|
72
130
|
if (!m || !value)
|
|
73
131
|
continue;
|
|
132
|
+
if (m[1] === 'ABX')
|
|
133
|
+
continue;
|
|
74
134
|
out.push({ name: m[1], url: value.replace(/\/+$/, ''), hasToken: !!env[`ABX_REMOTE_${m[1]}_TOKEN`] });
|
|
75
135
|
}
|
|
76
136
|
return out.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -99,6 +159,74 @@ export function misnamedRemoteVars(env = process.env) {
|
|
|
99
159
|
export function serviceClient(t) {
|
|
100
160
|
return new AbxServiceClient({ baseUrl: t.url, token: t.token });
|
|
101
161
|
}
|
|
162
|
+
/** Resolve one provider interface from the catalog selected by `--remote`. */
|
|
163
|
+
export async function serviceInterfaceClient(t, interfaceId, descriptor) {
|
|
164
|
+
const catalog = serviceClient(t);
|
|
165
|
+
try {
|
|
166
|
+
return await catalog.forInterface(interfaceId, descriptor);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
// Pre-descriptor self-hosted resolvers served every route from the supplied origin. Preserve
|
|
170
|
+
// that compatibility only when discovery itself is absent; a catalog that answers and omits an
|
|
171
|
+
// interface is an intentional capability boundary and must not be guessed around.
|
|
172
|
+
if (!descriptor && err instanceof AbxServiceError && err.status === 404)
|
|
173
|
+
return catalog;
|
|
174
|
+
throw err;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** The provider-neutral control-plane client used by registration, status and artifact writes. */
|
|
178
|
+
export async function controlPlaneClient(t, descriptor) {
|
|
179
|
+
return serviceInterfaceClient(t, CONTROL_PLANE_INTERFACE, descriptor);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Is this named remote's stored credential actually accepted? One cheap authed read, so `doctor` can
|
|
183
|
+
* report capability instead of mere presence.
|
|
184
|
+
*
|
|
185
|
+
* Doctor is the command a creator runs FIRST, and it used to print a clean `remotes: meridian` for a
|
|
186
|
+
* key the service rejects — the 401 only surfaced later, from `abx remote <name>`, after they had
|
|
187
|
+
* already trusted the line. Same class as an RPC that answers `[]` because it pruned its logs: an
|
|
188
|
+
* empty success is not evidence of capability.
|
|
189
|
+
*
|
|
190
|
+
* Never throws and never blocks doctor for long: a short per-attempt timeout, and anything that is
|
|
191
|
+
* not a definitive rejection is reported as a soft note rather than a ✗, because a slow or briefly
|
|
192
|
+
* unreachable provider is not a misconfiguration the creator can act on.
|
|
193
|
+
*/
|
|
194
|
+
export async function probeRemoteCredential(name, timeoutMs = 4000) {
|
|
195
|
+
const target = resolveRemote(name);
|
|
196
|
+
if (!target)
|
|
197
|
+
return { ok: false, fatal: false, detail: '(unresolved)' };
|
|
198
|
+
try {
|
|
199
|
+
// retryDelayMs 0: a 401 is definitive and never retries anyway, but an unreachable provider
|
|
200
|
+
// would otherwise back off across four attempts and stall the one command that must stay quick.
|
|
201
|
+
const catalog = new AbxServiceClient({ baseUrl: target.url, token: target.token, timeoutMs, retryDelayMs: 0 });
|
|
202
|
+
let client;
|
|
203
|
+
try {
|
|
204
|
+
client = await catalog.forInterface(CONTROL_PLANE_INTERFACE);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
if (!(err instanceof AbxServiceError && err.status === 404))
|
|
208
|
+
throw err;
|
|
209
|
+
client = catalog;
|
|
210
|
+
}
|
|
211
|
+
const projects = await client.listProjects();
|
|
212
|
+
return { ok: true, fatal: false, detail: `· ${projects.length} project(s) visible` };
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
if (err instanceof AbxServiceError && err.status === 401) {
|
|
216
|
+
return { ok: false, fatal: true, detail: `token rejected (401) — fix or rotate ${tokenVarFor(name)}` };
|
|
217
|
+
}
|
|
218
|
+
if (err instanceof AbxServiceError && err.status === 403) {
|
|
219
|
+
return { ok: false, fatal: false, detail: '(authorized key, scoped by the provider — not a misconfiguration)' };
|
|
220
|
+
}
|
|
221
|
+
return { ok: false, fatal: false, detail: `(unreachable right now: ${err.message.slice(0, 60)})` };
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/** The env var a named remote's token is read from — the one to name when it is rejected. */
|
|
225
|
+
export function tokenVarFor(name) {
|
|
226
|
+
if (name.toUpperCase() === 'ABX')
|
|
227
|
+
return ABX_SERVICES_API_KEY_VAR;
|
|
228
|
+
return `ABX_REMOTE_${name.toUpperCase()}_TOKEN`;
|
|
229
|
+
}
|
|
102
230
|
/**
|
|
103
231
|
* Map a control-plane failure to an actionable CLI error. Keys off `AbxServiceError.code`/status,
|
|
104
232
|
* never off message prose (the machine-code half of the interface spec):
|
|
@@ -117,16 +245,27 @@ export function describeRemoteError(err, t, label) {
|
|
|
117
245
|
? ' (bare `--remote` uses ABX_PUBLIC_BASE_URL, else ABX_RESOLVER_URL)'
|
|
118
246
|
: t.source === 'named'
|
|
119
247
|
? ` (from ABX_REMOTE_${t.name}_URL)`
|
|
120
|
-
: ''
|
|
248
|
+
: t.source === 'builtin'
|
|
249
|
+
? ' (built-in first-party ABX Services target)'
|
|
250
|
+
: '';
|
|
121
251
|
return new Error(`${label}: nothing responded at ${t.url}${from}. Is it running, and is that the right address?`);
|
|
122
252
|
}
|
|
123
253
|
if (err.status === 401) {
|
|
124
|
-
return new Error(`${label}: 401 unauthorized — ${t.url} rejected
|
|
254
|
+
return new Error(`${label}: 401 unauthorized — ${t.url} rejected ${tokenSourceLabel(t)}. ` +
|
|
255
|
+
(t.tokenFrom === 'flag'
|
|
256
|
+
? `That value is wrong or stale — get a fresh key from the provider (${t.tokenVar} in .env is what a normal run reads).`
|
|
257
|
+
: 'Fix or rotate the key (or pass --remote-token to test a replacement).'));
|
|
125
258
|
}
|
|
126
259
|
if (err.status === 403) {
|
|
127
260
|
return new Error(`${label}: 403 forbidden — the token is valid but not authorized for this project/chain (provider-side scoping, not a typo). ` +
|
|
128
261
|
`Check the provider's dashboard and its descriptor (\`abx remote ${t.name ?? t.url}\`).`);
|
|
129
262
|
}
|
|
263
|
+
if (err.code === 'not_registered') {
|
|
264
|
+
// The likeliest cause when READING a remote (status/index/render) is that the bridge step was
|
|
265
|
+
// never done — the service has no idea this contract exists. Name the fix, not the 404.
|
|
266
|
+
return new Error(`${label}: ${t.url} doesn't have this project registered — it can't serve or report on a contract it was never told about. ` +
|
|
267
|
+
`Register it: \`abx add <address> --remote ${t.name?.toLowerCase() ?? t.url}\`.`);
|
|
268
|
+
}
|
|
130
269
|
if (err.code === 'disabled') {
|
|
131
270
|
return new Error(`${label}: the resolver at ${t.url} has no control-plane token configured — it can't accept remote registrations. For your own node, set ABX_RESOLVER_ADMIN_TOKEN on it (\`abx deploy-resolver\` wires it).`);
|
|
132
271
|
}
|
|
@@ -134,6 +273,224 @@ export function describeRemoteError(err, t, label) {
|
|
|
134
273
|
return new Error(`${label}: ${t.url} has no /v1 control plane — an older resolver (redeploy it: \`abx deploy-resolver\`), or not an ABX service. ` +
|
|
135
274
|
`Check: curl ${t.url}/.well-known/abx-service`);
|
|
136
275
|
}
|
|
276
|
+
// A 5xx that volunteered a failure CLASS is the difference between "wait" and "something is
|
|
277
|
+
// broken" — and it's the only thing a credential-free 500 body is allowed to tell us, so use it.
|
|
278
|
+
if (err.class === 'rpc_rate_limited' || err.class === 'rpc_unavailable') {
|
|
279
|
+
return new Error(`${label}: the service reached its chain RPC ${err.class === 'rpc_rate_limited' ? 'rate limit' : 'and got no answer'} (${err.class}) — ` +
|
|
280
|
+
`not your credential and not your address. It retries with backoff; check progress with \`abx status <address> --remote ${t.name?.toLowerCase() ?? t.url}\`.`);
|
|
281
|
+
}
|
|
137
282
|
return new Error(`${label}: ${err.message}`);
|
|
138
283
|
}
|
|
284
|
+
// The `--remote <name|url>` target (remote.ts owns the convention): a named remote's
|
|
285
|
+
// `ABX_REMOTE_<NAME>_URL/_TOKEN`, an ad-hoc URL, or bare `--remote` = the self-host default.
|
|
286
|
+
// Returns null for a local op (the default).
|
|
287
|
+
export function remoteFlag(flags) {
|
|
288
|
+
return resolveRemote(flags.remote, flags['remote-token']);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The factory-verification tri-state, said plainly. `null` means the check never ran (no factory
|
|
292
|
+
* configured, or the configured one has no code on this chain — common on a local/dev chain), which
|
|
293
|
+
* is NOT the same as the chain telling us this contract isn't a clone of it.
|
|
294
|
+
*/
|
|
295
|
+
export function canonicalLabel(isCanonical, provenance) {
|
|
296
|
+
if (isCanonical === true) {
|
|
297
|
+
// Say WHICH generation stamped it, and its core version — "canonically ABX v3" is a thing a
|
|
298
|
+
// consumer can repeat, and `abxVersion()` on the clone is where they can verify it themselves.
|
|
299
|
+
const v = provenance?.coreVersion !== null && provenance?.coreVersion !== undefined ? ` — ABX v${provenance.coreVersion}` : '';
|
|
300
|
+
if (provenance?.generation === 'prior') {
|
|
301
|
+
return `${g('yes (factory-verified)')}${dim(`${v}, a PRIOR anchor generation — canonically ABX, deployed by a factory since replaced`)}`;
|
|
302
|
+
}
|
|
303
|
+
return g(`yes (factory-verified${v})`);
|
|
304
|
+
}
|
|
305
|
+
// "the configured factory" (singular) understated the check and misdirected the reader: since the
|
|
306
|
+
// edition anchors were added, `detectCanonicalFactory` probes ALL SIX trust anchors (three 721 +
|
|
307
|
+
// three ERC-1155) and only falls back to the 1/1 anchor when none of them claim the clone. So a
|
|
308
|
+
// `false` means "no trust anchor this CLI knows deployed this", not "you configured the wrong one" —
|
|
309
|
+
// and the usual real cause is a contract from a SUPERSEDED factory, or one deployed by hand.
|
|
310
|
+
if (isCanonical === false) {
|
|
311
|
+
return `${c.orange}NO — not a clone of any trust anchor this CLI knows${c.reset}${dim(' (a superseded factory, or deployed outside one — `abx doctor` lists the current anchors)')}`;
|
|
312
|
+
}
|
|
313
|
+
if (provenance && provenance.anchorsAnswered === 0) {
|
|
314
|
+
return dim('not checked (no anchor answered — a coverage gap, not a verdict; retry or check the RPC)');
|
|
315
|
+
}
|
|
316
|
+
return dim('not checked (no canonical factory for this chain — `abx doctor` shows which)');
|
|
317
|
+
}
|
|
318
|
+
/** How a lifecycle state reads at a glance — the same word everywhere it's printed. */
|
|
319
|
+
export function statusLabel(s) {
|
|
320
|
+
if (s === 'live')
|
|
321
|
+
return g('live');
|
|
322
|
+
if (s === 'failed')
|
|
323
|
+
return `${c.orange}failed${c.reset}`;
|
|
324
|
+
if (s === 'stale')
|
|
325
|
+
return `${c.orange}stale${c.reset}`;
|
|
326
|
+
return dim(s); // queued | backfilling — in progress, not a problem
|
|
327
|
+
}
|
|
328
|
+
/** `label value` with only the label dimmed — status values carry their own color, and wrapping
|
|
329
|
+
* them in `info()` would fight it. */
|
|
330
|
+
export const statusRow = (label, value) => console.log(` ${dim(label.padEnd(10))} ${value}`);
|
|
331
|
+
/**
|
|
332
|
+
* What to DO about a failure class — whose problem it is and whether waiting is the answer.
|
|
333
|
+
* The class alone told an agent enough to reason it out; it does not tell a creator, and "whose
|
|
334
|
+
* problem is this" is the single question a failed catch-up has to answer.
|
|
335
|
+
*/
|
|
336
|
+
export function indexErrorAction(cls) {
|
|
337
|
+
if (cls === 'rpc_rate_limited')
|
|
338
|
+
return "the SERVICE's chain RPC is throttled — not your key, address, or chain. It retries on its own; if it stays this way, that's the operator's to fix.";
|
|
339
|
+
if (cls === 'rpc_unavailable')
|
|
340
|
+
return "the SERVICE can't reach its chain RPC — not your key, address, or chain. It retries on its own; if it stays this way, contact the operator.";
|
|
341
|
+
if (cls === 'not_abx_contract')
|
|
342
|
+
return 'the service found no ABX events at that address on this chain — check the address and that the service serves the right chain.';
|
|
343
|
+
return 'the cause is in the service operator’s logs — nothing you can fix from here; contact them if it persists.';
|
|
344
|
+
}
|
|
345
|
+
/** The one wording for "registered, but catch-up failed" — shared by add/index so both say the same
|
|
346
|
+
* thing: what failed, whose problem it is, and that the registration survived. */
|
|
347
|
+
export function failedCatchUpMessage(address, remote, err, check) {
|
|
348
|
+
const cls = err?.class;
|
|
349
|
+
return (`${address} is registered on ${remote.url}, but its catch-up FAILED` +
|
|
350
|
+
`${cls ? ` (${cls}${err?.message ? `: ${err.message}` : ''})` : ''}.\n` +
|
|
351
|
+
` ${cls ? `→ ${indexErrorAction(cls)}\n ` : ''}` +
|
|
352
|
+
`The registration is durable and the service retries with backoff — watch it with ${bold(check + ' --watch')}.`);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* One human line for a status read: where it is, how far along, and why if it's unhappy.
|
|
356
|
+
*
|
|
357
|
+
* What "where" means depends on the state, so say the right thing rather than one number that reads
|
|
358
|
+
* differently in each: a percentage is only honest while BACKFILLING (see indexProgress). A `live`
|
|
359
|
+
* project's `toBlock` only advances when that project has events, so on a busy chain a perfectly
|
|
360
|
+
* current project sits far below head — printing that as a ratio makes healthy look broken.
|
|
361
|
+
*/
|
|
362
|
+
export function statusLine(s) {
|
|
363
|
+
const p = indexProgress(s);
|
|
364
|
+
let where;
|
|
365
|
+
if (p)
|
|
366
|
+
where = `${s.toBlock}/${s.headBlock} ${dim(`(${p.percent}%)`)}`;
|
|
367
|
+
else if (!s.toBlock)
|
|
368
|
+
where = dim('not indexed yet');
|
|
369
|
+
else if (s.status === 'live')
|
|
370
|
+
where = `${g('caught up')} ${dim(`· scanned through block ${s.toBlock}`)}`;
|
|
371
|
+
else if (s.status === 'stale')
|
|
372
|
+
where = `${dim('not tracking head right now')} ${dim(`· scanned through block ${s.toBlock}${s.headBlock ? ` of ${s.headBlock}` : ''}`)}`;
|
|
373
|
+
else
|
|
374
|
+
where = dim(`scanned through block ${s.toBlock}`);
|
|
375
|
+
const why = s.error ? ` ${c.orange}${s.error.class}${c.reset}${s.error.message ? dim(` — ${s.error.message}`) : ''}` : '';
|
|
376
|
+
return `${statusLabel(s.status)} ${where}${why}`;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Report a register/reindex answer, whichever of the two conformant shapes the service used.
|
|
380
|
+
*
|
|
381
|
+
* A `200` already carries the counts. A `202` means the registration is durable and catch-up is still
|
|
382
|
+
* running — so by default we poll to a terminal state and print the SAME summary line, giving the
|
|
383
|
+
* human the "waits, then tells you what happened" UX without the service holding a socket open for
|
|
384
|
+
* minutes. `--no-wait` stops at the 202 and names the command that checks later.
|
|
385
|
+
*/
|
|
386
|
+
export async function reportRemoteIndexing(remote, chainId, address, r, flags, verb, client) {
|
|
387
|
+
const control = client ?? (await controlPlaneClient(remote));
|
|
388
|
+
// A real ABX clone ALWAYS emits a spine (its extension registrations at minimum), so a caught-up
|
|
389
|
+
// projection with zero events means the service scanned the wrong chain/floor or its RPC hasn't
|
|
390
|
+
// served the logs — not that the project is empty. A ✓ there is the lie that produces an empty
|
|
391
|
+
// dashboard (the same guard `reindexAfterDeploy` applies locally).
|
|
392
|
+
const settledLine = (events, tail) => {
|
|
393
|
+
if (events > 0)
|
|
394
|
+
ok(`remote resolver ${verb} ${address}: ${tail}`);
|
|
395
|
+
else
|
|
396
|
+
warn(`${address} is registered and caught up on ${remote.url}, but with ${bold('0 events')} — it will serve nothing. Check the service covers ${CHAIN} and that its RPC serves logs from the deploy block.`);
|
|
397
|
+
};
|
|
398
|
+
if (!isAccepted(r)) {
|
|
399
|
+
settledLine(r.project.eventCount, `${r.project.eventCount} events ${dim(`(${r.mode}, ${r.elapsedMs}ms)`)}`);
|
|
400
|
+
return {
|
|
401
|
+
status: r.project.status ?? 'live',
|
|
402
|
+
completed: true,
|
|
403
|
+
backfilling: false,
|
|
404
|
+
eventCount: r.project.eventCount,
|
|
405
|
+
tokenCount: r.project.tokenCount,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
const spec = remote.name ? remote.name.toLowerCase() : remote.source === 'default' ? '' : remote.url;
|
|
409
|
+
const check = `abx status ${address} --remote${spec ? ` ${spec}` : ''}`;
|
|
410
|
+
// The registration is durable in EVERY branch here — but don't claim it "is catching up" when the
|
|
411
|
+
// service already told us the catch-up failed. Two different sentences for two different facts.
|
|
412
|
+
if (r.project.status === 'failed') {
|
|
413
|
+
// Lead with the outcome, not the successful sub-step: a line starting "registered on …" reads
|
|
414
|
+
// as success even with the failure later in the sentence.
|
|
415
|
+
warn(`${bold('catch-up FAILED')} on ${remote.url} — nothing is being served yet ${dim('(the registration itself is durable; the service retries it)')}`);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
info(`registered — ${r.project.status} ${dim('(the service accepted it and is catching up; the registration is durable)')}`);
|
|
419
|
+
}
|
|
420
|
+
// A known failure is not something to "not wait" for — we already have the answer, so report it as
|
|
421
|
+
// one regardless of --no-wait (never a ✓ over a broken index).
|
|
422
|
+
if (flags['no-wait'] !== undefined && r.project.status !== 'failed') {
|
|
423
|
+
info(`not waiting (--no-wait). Check with ${bold(check)}`);
|
|
424
|
+
return {
|
|
425
|
+
status: r.project.status,
|
|
426
|
+
completed: false,
|
|
427
|
+
backfilling: r.project.status === 'queued' || r.project.status === 'backfilling',
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
const label = `remote ${verb === 'indexed' ? 'add' : 'index'}`;
|
|
431
|
+
if (r.project.status === 'failed') {
|
|
432
|
+
// Fetch the class the register response may not have carried, so the "whose problem" line is
|
|
433
|
+
// never missing on the path that reports the failure soonest.
|
|
434
|
+
const st = await control.projectStatus(chainId, address).catch(() => undefined);
|
|
435
|
+
throw new Error(`${label}: ${failedCatchUpMessage(address, remote, st?.error ?? undefined, check)}`);
|
|
436
|
+
}
|
|
437
|
+
let shown = -100;
|
|
438
|
+
let lastStatus;
|
|
439
|
+
try {
|
|
440
|
+
const final = await control.awaitIndexed(chainId, address, {
|
|
441
|
+
onProgress: (s) => {
|
|
442
|
+
const p = indexProgress(s);
|
|
443
|
+
// Print on a state change or a meaningful step — a poll line every 3s is noise in a log an
|
|
444
|
+
// agent has to read back.
|
|
445
|
+
if (s.status !== lastStatus || (p && p.percent - shown >= 10)) {
|
|
446
|
+
lastStatus = s.status;
|
|
447
|
+
if (p)
|
|
448
|
+
shown = p.percent;
|
|
449
|
+
console.log(` ${statusLine(s)}`);
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
if (final.status === 'failed') {
|
|
454
|
+
throw new Error(`${label}: ${failedCatchUpMessage(address, remote, final.error, check)}`);
|
|
455
|
+
}
|
|
456
|
+
settledLine(final.eventCount, `${final.eventCount} events, ${final.tokenCount} token(s) ${dim('(live)')}`);
|
|
457
|
+
return {
|
|
458
|
+
status: final.status,
|
|
459
|
+
completed: final.status === 'live',
|
|
460
|
+
backfilling: final.status === 'backfilling',
|
|
461
|
+
eventCount: final.eventCount,
|
|
462
|
+
tokenCount: final.tokenCount,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
catch (err) {
|
|
466
|
+
if (err instanceof AbxIndexTimeoutError) {
|
|
467
|
+
warn(`${address} is still ${err.last?.status ?? 'catching up'} on ${remote.url} — nothing is lost, it just isn't done.`);
|
|
468
|
+
info(`follow it with ${bold(check + ' --watch')}`);
|
|
469
|
+
const status = err.last?.status ?? r.project.status;
|
|
470
|
+
return {
|
|
471
|
+
status,
|
|
472
|
+
completed: false,
|
|
473
|
+
backfilling: status === 'queued' || status === 'backfilling',
|
|
474
|
+
eventCount: err.last?.eventCount,
|
|
475
|
+
tokenCount: err.last?.tokenCount,
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
// The service went away mid-wait (or rejected the poll). The registration still landed — say
|
|
479
|
+
// which failure this is, in the same words every other remote command uses.
|
|
480
|
+
if (err instanceof AbxServiceError)
|
|
481
|
+
throw describeRemoteError(err, remote, `remote ${verb}: registered, but polling status`);
|
|
482
|
+
throw err;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
/** "3 live, 1 backfilling, 1 failed (rpc_rate_limited)" — the one-line answer to "is my stuff ok?" */
|
|
486
|
+
export function rollUp(projects) {
|
|
487
|
+
const counts = new Map();
|
|
488
|
+
for (const p of projects) {
|
|
489
|
+
const k = p.status ?? 'unknown';
|
|
490
|
+
counts.set(k, (counts.get(k) ?? 0) + 1);
|
|
491
|
+
}
|
|
492
|
+
const classes = [...new Set(projects.filter((p) => p.error).map((p) => p.error.class))];
|
|
493
|
+
const parts = [...counts.entries()].map(([k, n]) => `${n} ${k}`);
|
|
494
|
+
return `${parts.join(', ')}${classes.length ? ` ${dim(`(${classes.join(', ')})`)}` : ''}`;
|
|
495
|
+
}
|
|
139
496
|
//# sourceMappingURL=remote.js.map
|
package/dist/remote.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAC,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAehF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAwB,EACxB,SAAkB,EAClB,MAAyB,OAAO,CAAC,GAAG;IAEpC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEnD,+FAA+F;IAC/F,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,GAAG,CAAC,mBAAmB,IAAI,GAAG,CAAC,gBAAgB,CAAC;QAC7D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CACb,gJAAgJ,CACjJ,CAAC;QACJ,CAAC;QACD,OAAO,EAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,IAAI,GAA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AE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzF,MAAM,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjE,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's one risk gate for a write — the choke point every signing path (owner-op or deploy)
|
|
3
|
+
* routes an already-prepared tx through, so `--dry-run` and `--confirm` behave IDENTICALLY no
|
|
4
|
+
* matter which command reached them.
|
|
5
|
+
*
|
|
6
|
+
* Before this module existed, the same three-part shape (preview-and-stop under `--dry-run` →
|
|
7
|
+
* optional interactive `--confirm` → pick a lane → sign) was hand-written THREE times: ownerops.ts's
|
|
8
|
+
* `runWrite` (every owner-op), a near-identical `runMinterWrite` ("the minter path does not go
|
|
9
|
+
* through runWrite, so it needs its OWN dry-run guard" — its own comment conceding the duplication),
|
|
10
|
+
* and a third copy inline in main.ts's `deploy-code --resume` send path. Each could drift from the
|
|
11
|
+
* others without anyone deciding it should — and the two owner-op copies HAD already drifted: only
|
|
12
|
+
* one of them printed the `owner` line on a dry-run preview when the caller supplied one.
|
|
13
|
+
*
|
|
14
|
+
* `gatedSend` is the merge. Callers that had NO `--confirm` support (every owner-op) gain it for
|
|
15
|
+
* free just by routing through here — there is no owner-op-specific reason they lacked it; it was
|
|
16
|
+
* simply never wired.
|
|
17
|
+
*/
|
|
18
|
+
import { type PublicClient } from 'viem';
|
|
19
|
+
import { type Address } from '@artblocks/abx-sdk';
|
|
20
|
+
import { type Lane, type SignResult, type TxProvider } from './signer.js';
|
|
21
|
+
import { type Flags } from './flags.js';
|
|
22
|
+
/** Resolve the signing lane from flags: `--unsigned` (cold) · `--sign` (wallet) · `--sponsor`
|
|
23
|
+
* (ABX creator wallet) · default hot. The one place every write makes this decision. */
|
|
24
|
+
export declare function laneFromFlags(flags: Flags): Lane;
|
|
25
|
+
/**
|
|
26
|
+
* Refuse a real deploy on the HOT lane when there is no key to sign with — before the command has
|
|
27
|
+
* spent anything.
|
|
28
|
+
*
|
|
29
|
+
* The signing lanes are checked at *signing* time, which is the end of a deploy. Everything that
|
|
30
|
+
* makes a deploy possible happens first, and some of it is neither free nor reversible: `--backend
|
|
31
|
+
* arweave|ipfs|cloud` UPLOADS the creator's art before any transaction is prepared. So a deploy run
|
|
32
|
+
* with no key, and no `--dry-run` to say "preview only", would mint an Arweave identity, publish the
|
|
33
|
+
* art, and only THEN discover it could never have deployed. Under Turbo's free tier the upload
|
|
34
|
+
* *succeeds*, so the art is published permanently — an irreversible side effect from a run that was
|
|
35
|
+
* always going to fail.
|
|
36
|
+
*
|
|
37
|
+
* `--dry-run` guards every signing choke point (`isDryRun`, `gatedSend`); this is the same idea one
|
|
38
|
+
* step earlier, and the rule it enforces is the sibling of that one: **a spend or a publish never
|
|
39
|
+
* precedes the check that this run can be signed at all.** Only the hot lane is checked — `--sign`
|
|
40
|
+
* (browser wallet) and `--unsigned` (offline signer) deliberately have no local key, and a preview
|
|
41
|
+
* spends nothing.
|
|
42
|
+
*/
|
|
43
|
+
export declare function assertLaneCanSign(flags: Flags): void;
|
|
44
|
+
/**
|
|
45
|
+
* Opt-in pre-send confirmation gate (`--confirm`). OFF by default → scripted use is untouched. Even
|
|
46
|
+
* when opted in, it never blocks automation: `--yes` or a non-TTY stdin proceeds silently. Only an
|
|
47
|
+
* interactive `--confirm` prints the summary and waits for a y/N. Aborts on anything but yes.
|
|
48
|
+
*/
|
|
49
|
+
export declare function confirmSend(summary: string, flags: Flags): Promise<void>;
|
|
50
|
+
export interface DryRunSimulation {
|
|
51
|
+
/** Three honest states, never collapsed into one another: `would-succeed` is earned (state check
|
|
52
|
+
* passed AND the signer can afford it), `would-revert` is a proven failure (a state revert OR an
|
|
53
|
+
* insufficient-funds shortfall — see `reason`), and `unknown` means neither could be established —
|
|
54
|
+
* it is NOT a synonym for "probably fine" and must never be reported as `would-succeed`. */
|
|
55
|
+
status: 'would-succeed' | 'would-revert' | 'unknown';
|
|
56
|
+
reason?: string;
|
|
57
|
+
/** The gas the REAL send would use, from the same {@link pinGas} `makeHotSender` calls at send
|
|
58
|
+
* time — never `transaction.gasFloor` (a proven MINIMUM used to detect an implausible estimate,
|
|
59
|
+
* not a prediction of what the send needs; see `pinGas`'s own doc in execute.ts). Present only
|
|
60
|
+
* when a real estimate was obtained. Decimal string — a `bigint` doesn't survive `JSON.stringify`. */
|
|
61
|
+
estimatedGas?: string;
|
|
62
|
+
/** `estimatedGas × current gas price`, plus the tx's own value if any — in wei, decimal string. */
|
|
63
|
+
estimatedCostWei?: string;
|
|
64
|
+
/** The signer's current balance, in wei, decimal string — present whenever a balance read was
|
|
65
|
+
* attempted, so the numbers behind an insufficient-funds verdict are visible even to a caller
|
|
66
|
+
* that only reads the JSON. */
|
|
67
|
+
balanceWei?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A revert's own name, when the payload carries one — `RoyaltyTooHigh()` instead of a raw hex dump
|
|
71
|
+
* or "reverted for an unknown reason".
|
|
72
|
+
*
|
|
73
|
+
* Whether we get one is the NODE's choice, not ours: many public endpoints (measured:
|
|
74
|
+
* `base-sepolia-rpc.publicnode.com` and `sepolia.base.org`) answer a failed `eth_call` with a bare
|
|
75
|
+
* `execution reverted` and no data at all. So the no-data case says *that*, rather than implying we
|
|
76
|
+
* looked at a reason and couldn't read it.
|
|
77
|
+
*/
|
|
78
|
+
export declare function revertReason(err: unknown): string;
|
|
79
|
+
export interface GatedSendOptions {
|
|
80
|
+
chainKey: string;
|
|
81
|
+
/** The address that must sign (onlyOwner / token holder) — shown to the human, guards the hot
|
|
82
|
+
* lane, and (when set) printed on the dry-run preview. */
|
|
83
|
+
expectedSigner?: Address;
|
|
84
|
+
/** Test-only seam: a pre-built client for the dry-run simulation, instead of one `simulateDryRun`
|
|
85
|
+
* would otherwise construct from `chainKey`. Every production caller omits this. */
|
|
86
|
+
client?: PublicClient;
|
|
87
|
+
}
|
|
88
|
+
/** Resolve the signer a preview should simulate from the same source the hot send will use.
|
|
89
|
+
* Explicit owner/buyer pinning always wins; wallet and cold lanes cannot be inferred locally. */
|
|
90
|
+
export declare function previewSigner(flags: Flags, explicit?: Address, signingKey?: `0x${string}` | undefined): Address | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* The one send choke point for a SINGLE already-prepared write: `--dry-run` preview (nothing sent,
|
|
93
|
+
* returns `null`) → optional `--confirm` prompt → lane selection → `signTx`. Every caller — an
|
|
94
|
+
* owner-op's `runWrite`/`runMinterWrite`, or the deploy family's resumed-setup send — resolves to
|
|
95
|
+
* this, so the two families can never again each carry their own (possibly diverging) idea of what
|
|
96
|
+
* `--dry-run` or `--confirm` means. The historical bug class this forecloses structurally: a write
|
|
97
|
+
* reaching the send lane under `--dry-run` because some caller re-derived the check by hand and
|
|
98
|
+
* missed a branch.
|
|
99
|
+
*/
|
|
100
|
+
export declare function gatedSend(provider: TxProvider, flags: Flags, opts: GatedSendOptions): Promise<SignResult | null>;
|
|
101
|
+
//# sourceMappingURL=riskgate.d.ts.map
|