@artblocks/abx-cli 0.1.0-alpha.17 → 0.1.0-alpha.18

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/dist/commands/deploy.d.ts +181 -0
  3. package/dist/commands/deploy.d.ts.map +1 -0
  4. package/dist/commands/deploy.js +2974 -0
  5. package/dist/commands/deploy.js.map +1 -0
  6. package/dist/commands/project.d.ts +134 -0
  7. package/dist/commands/project.d.ts.map +1 -0
  8. package/dist/commands/project.js +919 -0
  9. package/dist/commands/project.js.map +1 -0
  10. package/dist/commands/reads.d.ts +64 -0
  11. package/dist/commands/reads.d.ts.map +1 -0
  12. package/dist/commands/reads.js +635 -0
  13. package/dist/commands/reads.js.map +1 -0
  14. package/dist/commands/scaffold.d.ts +55 -0
  15. package/dist/commands/scaffold.d.ts.map +1 -0
  16. package/dist/commands/scaffold.js +470 -0
  17. package/dist/commands/scaffold.js.map +1 -0
  18. package/dist/commands/service.d.ts +41 -0
  19. package/dist/commands/service.d.ts.map +1 -0
  20. package/dist/commands/service.js +572 -0
  21. package/dist/commands/service.js.map +1 -0
  22. package/dist/commands/storage.d.ts +37 -0
  23. package/dist/commands/storage.d.ts.map +1 -0
  24. package/dist/commands/storage.js +335 -0
  25. package/dist/commands/storage.js.map +1 -0
  26. package/dist/config.d.ts +72 -2
  27. package/dist/config.d.ts.map +1 -1
  28. package/dist/config.js +201 -4
  29. package/dist/config.js.map +1 -1
  30. package/dist/deps.d.ts +6 -39
  31. package/dist/deps.d.ts.map +1 -1
  32. package/dist/deps.js +4 -68
  33. package/dist/deps.js.map +1 -1
  34. package/dist/errors.d.ts +20 -0
  35. package/dist/errors.d.ts.map +1 -0
  36. package/dist/errors.js +25 -0
  37. package/dist/errors.js.map +1 -0
  38. package/dist/flags.d.ts +34 -0
  39. package/dist/flags.d.ts.map +1 -1
  40. package/dist/flags.js +74 -0
  41. package/dist/flags.js.map +1 -1
  42. package/dist/main.js +57 -6751
  43. package/dist/main.js.map +1 -1
  44. package/dist/mintpage.d.ts.map +1 -1
  45. package/dist/mintpage.js +34 -40
  46. package/dist/mintpage.js.map +1 -1
  47. package/dist/output.d.ts +137 -0
  48. package/dist/output.d.ts.map +1 -0
  49. package/dist/output.js +504 -0
  50. package/dist/output.js.map +1 -0
  51. package/dist/ownerops.d.ts +23 -44
  52. package/dist/ownerops.d.ts.map +1 -1
  53. package/dist/ownerops.js +151 -233
  54. package/dist/ownerops.js.map +1 -1
  55. package/dist/preview.d.ts +8 -4
  56. package/dist/preview.d.ts.map +1 -1
  57. package/dist/preview.js +8 -17
  58. package/dist/preview.js.map +1 -1
  59. package/dist/provision.d.ts.map +1 -1
  60. package/dist/provision.js +10 -7
  61. package/dist/provision.js.map +1 -1
  62. package/dist/remote.d.ts +72 -7
  63. package/dist/remote.d.ts.map +1 -1
  64. package/dist/remote.js +211 -9
  65. package/dist/remote.js.map +1 -1
  66. package/dist/riskgate.d.ts +29 -0
  67. package/dist/riskgate.d.ts.map +1 -0
  68. package/dist/riskgate.js +91 -0
  69. package/dist/riskgate.js.map +1 -0
  70. package/dist/schema.d.ts +6 -0
  71. package/dist/schema.d.ts.map +1 -1
  72. package/dist/schema.js +12 -16
  73. package/dist/schema.js.map +1 -1
  74. package/dist/served.d.ts +1 -17
  75. package/dist/served.d.ts.map +1 -1
  76. package/dist/served.js +47 -0
  77. package/dist/served.js.map +1 -1
  78. package/dist/signer.d.ts +13 -0
  79. package/dist/signer.d.ts.map +1 -1
  80. package/dist/signer.js +42 -19
  81. package/dist/signer.js.map +1 -1
  82. package/dist/update-check.d.ts +27 -0
  83. package/dist/update-check.d.ts.map +1 -1
  84. package/dist/update-check.js +30 -0
  85. package/dist/update-check.js.map +1 -1
  86. package/package.json +6 -6
  87. package/skill/SKILL.md +7 -11
  88. package/skill/reference/code-projects.md +3 -3
  89. package/skill/reference/hosting.md +6 -6
  90. package/skill/reference/operating.md +2 -5
  91. package/skill/reference/setup.md +2 -2
  92. package/skill/reference/troubleshooting.md +1 -1
  93. package/dist/gas.d.ts +0 -63
  94. package/dist/gas.d.ts.map +0 -1
  95. package/dist/gas.js +0 -76
  96. package/dist/gas.js.map +0 -1
  97. package/dist/inspect.d.ts +0 -48
  98. package/dist/inspect.d.ts.map +0 -1
  99. package/dist/inspect.js +0 -290
  100. package/dist/inspect.js.map +0 -1
  101. package/dist/migrate.d.ts +0 -65
  102. package/dist/migrate.d.ts.map +0 -1
  103. package/dist/migrate.js +0 -180
  104. package/dist/migrate.js.map +0 -1
  105. package/dist/onchain-uri.d.ts +0 -81
  106. package/dist/onchain-uri.d.ts.map +0 -1
  107. package/dist/onchain-uri.js +0 -251
  108. package/dist/onchain-uri.js.map +0 -1
  109. package/dist/resume.d.ts +0 -96
  110. package/dist/resume.d.ts.map +0 -1
  111. package/dist/resume.js +0 -95
  112. package/dist/resume.js.map +0 -1
  113. package/dist/upload.d.ts +0 -28
  114. package/dist/upload.d.ts.map +0 -1
  115. package/dist/upload.js +0 -41
  116. package/dist/upload.js.map +0 -1
package/dist/remote.d.ts CHANGED
@@ -4,19 +4,28 @@
4
4
  * specs/self-host-toolkit/remote-services.md); 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>). A managed provider's
8
- * per-account API key lives here and deliberately NEVER falls back to
9
- * ABX_RESOLVER_ADMIN_TOKEN, so your node-admin secret can't silently go to a
10
- * third party.
11
- * --remote <url> an ad-hoc URL token from --remote-token or ABX_RESOLVER_ADMIN_TOKEN.
7
+ * (same env-name normalization as ABX_RPC_URLS_<CHAIN>). "self" is just a name
8
+ * under this SAME conventionthe 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
+ * --remote <url> an ad-hoc URL — token from --remote-token or ABX_REMOTE_SELF_TOKEN (the local
13
+ * client credential for a node you run; `abx deploy-resolver` generates it).
12
14
  * --remote bare: the self-host default — ABX_PUBLIC_BASE_URL (the URL baked on-chain,
13
- * else ABX_RESOLVER_URL) + ABX_RESOLVER_ADMIN_TOKEN. Unchanged from day one.
15
+ * else ABX_RESOLVER_URL) + ABX_REMOTE_SELF_TOKEN.
14
16
  *
15
17
  * Every token here authorizes indexing/metadata control only — never on-chain signing — so the
16
18
  * "no signing key on the host" rule is intact. (`--remote-token`, not `--token`: `--token` already
17
19
  * means a token ID across the owner ops.)
20
+ *
21
+ * The RESOLVER's own env var — what gates ITS control plane, server-side (packages/token-api/src/
22
+ * control-plane.ts) — is unchanged: still `ABX_RESOLVER_ADMIN_TOKEN`. Only the CLIENT-side lookup
23
+ * for a self-run node moved to the named-remote grammar above; `abx deploy-resolver` prints the exact
24
+ * command that carries the value across the name boundary (fly secrets set ABX_RESOLVER_ADMIN_TOKEN
25
+ * from your local ABX_REMOTE_SELF_TOKEN).
18
26
  */
19
- import { AbxServiceClient } from '@artblocks/abx-sdk';
27
+ import { AbxServiceClient, type Address, type IndexError, type IndexErrorClass, type IndexStatus, type RegisterProjectResult, type RemoteProjectStatus } from '@artblocks/abx-sdk';
28
+ import { type Flags } from './flags.js';
20
29
  export type RemoteSource = 'url' | 'named' | 'default';
21
30
  export interface RemoteTarget {
22
31
  /** Base URL, trailing slashes stripped. */
@@ -39,6 +48,16 @@ export declare function tokenSourceLabel(t: RemoteTarget): string;
39
48
  * `tokenFlag` is `--remote-token` and wins over any env token for this invocation.
40
49
  */
41
50
  export declare function resolveRemote(spec: string | undefined, tokenFlag?: string, env?: NodeJS.ProcessEnv): RemoteTarget | null;
51
+ /**
52
+ * The OLD client-side var (`ABX_RESOLVER_ADMIN_TOKEN`) sitting unused in `.env` because the
53
+ * self-host default's credential moved to the named-remote grammar (`ABX_REMOTE_SELF_TOKEN`) — a
54
+ * silent fallback would mean an operator's `.env` never gets renamed, so this is the ONE place both
55
+ * {@link requireRemoteToken} (the hard-stop for a real command) and `abx doctor` (the same fault,
56
+ * surfaced before a command needs it) decide whether to flag it — sharing the check means they can
57
+ * never drift on the condition. `null` when there's nothing to flag (old var absent, or the new one
58
+ * is already set and simply wins).
59
+ */
60
+ export declare function selfTokenMigrationWarning(env?: NodeJS.ProcessEnv): string | null;
42
61
  /** The token, when the remote is the command's OBJECT (add/index/forget/render/migrate-dest) —
43
62
  * a missing credential is a hard stop that names the exact var to set. */
44
63
  export declare function requireRemoteToken(t: RemoteTarget, env?: NodeJS.ProcessEnv): string;
@@ -71,4 +90,50 @@ export declare function serviceClient(t: RemoteTarget): AbxServiceClient;
71
90
  * bare 404 on /v1 — no control plane at this URL (pre-/v1 node, or not an ABX service).
72
91
  */
73
92
  export declare function describeRemoteError(err: unknown, t: RemoteTarget, label: string): Error;
93
+ export declare function remoteFlag(flags: Flags): RemoteTarget | null;
94
+ /**
95
+ * The factory-verification tri-state, said plainly. `null` means the check never ran (no factory
96
+ * configured, or the configured one has no code on this chain — common on a local/dev chain), which
97
+ * is NOT the same as the chain telling us this contract isn't a clone of it.
98
+ */
99
+ export declare function canonicalLabel(isCanonical: boolean | null | undefined): string;
100
+ /** How a lifecycle state reads at a glance — the same word everywhere it's printed. */
101
+ export declare function statusLabel(s: IndexStatus): string;
102
+ /** `label value` with only the label dimmed — status values carry their own color, and wrapping
103
+ * them in `info()` would fight it. */
104
+ export declare const statusRow: (label: string, value: string) => void;
105
+ /**
106
+ * What to DO about a failure class — whose problem it is and whether waiting is the answer.
107
+ * The class alone told an agent enough to reason it out; it does not tell a creator, and "whose
108
+ * problem is this" is the single question a failed catch-up has to answer.
109
+ */
110
+ export declare function indexErrorAction(cls: IndexErrorClass): string;
111
+ /** The one wording for "registered, but catch-up failed" — shared by add/index so both say the same
112
+ * thing: what failed, whose problem it is, and that the registration survived. */
113
+ export declare function failedCatchUpMessage(address: Address, remote: RemoteTarget, err: IndexError | undefined, check: string): string;
114
+ /**
115
+ * One human line for a status read: where it is, how far along, and why if it's unhappy.
116
+ *
117
+ * What "where" means depends on the state, so say the right thing rather than one number that reads
118
+ * differently in each: a percentage is only honest while BACKFILLING (see indexProgress). A `live`
119
+ * project's `toBlock` only advances when that project has events, so on a busy chain a perfectly
120
+ * current project sits far below head — printing that as a ratio makes healthy look broken.
121
+ */
122
+ export declare function statusLine(s: RemoteProjectStatus): string;
123
+ /**
124
+ * Report a register/reindex answer, whichever of the two conformant shapes the service used.
125
+ *
126
+ * A `200` already carries the counts. A `202` means the registration is durable and catch-up is still
127
+ * running — so by default we poll to a terminal state and print the SAME summary line, giving the
128
+ * human the "waits, then tells you what happened" UX without the service holding a socket open for
129
+ * minutes. `--no-wait` stops at the 202 and names the command that checks later.
130
+ */
131
+ export declare function reportRemoteIndexing(remote: RemoteTarget, chainId: number, address: Address, r: RegisterProjectResult, flags: Flags, verb: string): Promise<void>;
132
+ /** "3 live, 1 backfilling, 1 failed (rpc_rate_limited)" — the one-line answer to "is my stuff ok?" */
133
+ export declare function rollUp(projects: Array<{
134
+ status?: IndexStatus;
135
+ error?: {
136
+ class: string;
137
+ };
138
+ }>): string;
74
139
  //# sourceMappingURL=remote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAC,gBAAgB,EAA6B,MAAM,oBAAoB,CAAC;AAEhF,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAEvD,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,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AAM,GACX,OAAO,CAAC,IAAI,CAAC,CAmEf;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
@@ -4,19 +4,29 @@
4
4
  * specs/self-host-toolkit/remote-services.md); 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>). A managed provider's
8
- * per-account API key lives here and deliberately NEVER falls back to
9
- * ABX_RESOLVER_ADMIN_TOKEN, so your node-admin secret can't silently go to a
10
- * third party.
11
- * --remote <url> an ad-hoc URL token from --remote-token or ABX_RESOLVER_ADMIN_TOKEN.
7
+ * (same env-name normalization as ABX_RPC_URLS_<CHAIN>). "self" is just a name
8
+ * under this SAME conventionthe 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
+ * --remote <url> an ad-hoc URL — token from --remote-token or ABX_REMOTE_SELF_TOKEN (the local
13
+ * client credential for a node you run; `abx deploy-resolver` generates it).
12
14
  * --remote bare: the self-host default — ABX_PUBLIC_BASE_URL (the URL baked on-chain,
13
- * else ABX_RESOLVER_URL) + ABX_RESOLVER_ADMIN_TOKEN. Unchanged from day one.
15
+ * else ABX_RESOLVER_URL) + ABX_REMOTE_SELF_TOKEN.
14
16
  *
15
17
  * Every token here authorizes indexing/metadata control only — never on-chain signing — so the
16
18
  * "no signing key on the host" rule is intact. (`--remote-token`, not `--token`: `--token` already
17
19
  * means a token ID across the owner ops.)
20
+ *
21
+ * The RESOLVER's own env var — what gates ITS control plane, server-side (packages/token-api/src/
22
+ * control-plane.ts) — is unchanged: still `ABX_RESOLVER_ADMIN_TOKEN`. Only the CLIENT-side lookup
23
+ * for a self-run node moved to the named-remote grammar above; `abx deploy-resolver` prints the exact
24
+ * command that carries the value across the name boundary (fly secrets set ABX_RESOLVER_ADMIN_TOKEN
25
+ * from your local ABX_REMOTE_SELF_TOKEN).
18
26
  */
19
- import { AbxServiceClient, AbxServiceError, envSuffix } from '@artblocks/abx-sdk';
27
+ import { AbxIndexTimeoutError, AbxServiceClient, AbxServiceError, envSuffix, indexProgress, isAccepted, } from '@artblocks/abx-sdk';
28
+ import { CHAIN } from './config.js';
29
+ import { bold, c, dim, g, info, ok, warn } from './output.js';
20
30
  /** How to refer to the credential this target is using, in an error the creator has to act on. */
21
31
  export function tokenSourceLabel(t) {
22
32
  return t.tokenFrom === 'flag' ? 'the token you passed with --remote-token' : t.tokenVar;
@@ -35,11 +45,11 @@ export function resolveRemote(spec, tokenFlag, env = process.env) {
35
45
  if (!base) {
36
46
  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');
37
47
  }
38
- return { url: strip(base), token: tokenFlag ?? env.ABX_RESOLVER_ADMIN_TOKEN, source: 'default', tokenVar: 'ABX_RESOLVER_ADMIN_TOKEN', tokenFrom: tokenFlag ? 'flag' : 'env' };
48
+ return { url: strip(base), token: tokenFlag ?? env.ABX_REMOTE_SELF_TOKEN, source: 'default', tokenVar: 'ABX_REMOTE_SELF_TOKEN', tokenFrom: tokenFlag ? 'flag' : 'env' };
39
49
  }
40
50
  // `--remote <url>` — ad-hoc URL, self-host credential conventions
41
51
  if (spec.includes('://')) {
42
- return { url: strip(spec), token: tokenFlag ?? env.ABX_RESOLVER_ADMIN_TOKEN, source: 'url', tokenVar: 'ABX_RESOLVER_ADMIN_TOKEN', tokenFrom: tokenFlag ? 'flag' : 'env' };
52
+ return { url: strip(spec), token: tokenFlag ?? env.ABX_REMOTE_SELF_TOKEN, source: 'url', tokenVar: 'ABX_REMOTE_SELF_TOKEN', tokenFrom: tokenFlag ? 'flag' : 'env' };
43
53
  }
44
54
  // `--remote <name>` — a named remote (a managed provider, another node of yours, a staging box)
45
55
  const name = envSuffix(spec);
@@ -52,6 +62,21 @@ export function resolveRemote(spec, tokenFlag, env = process.env) {
52
62
  }
53
63
  return { url: strip(url), token: tokenFlag ?? env[tokenVar], name, source: 'named', tokenVar, tokenFrom: tokenFlag ? 'flag' : 'env' };
54
64
  }
65
+ /**
66
+ * The OLD client-side var (`ABX_RESOLVER_ADMIN_TOKEN`) sitting unused in `.env` because the
67
+ * self-host default's credential moved to the named-remote grammar (`ABX_REMOTE_SELF_TOKEN`) — a
68
+ * silent fallback would mean an operator's `.env` never gets renamed, so this is the ONE place both
69
+ * {@link requireRemoteToken} (the hard-stop for a real command) and `abx doctor` (the same fault,
70
+ * surfaced before a command needs it) decide whether to flag it — sharing the check means they can
71
+ * never drift on the condition. `null` when there's nothing to flag (old var absent, or the new one
72
+ * is already set and simply wins).
73
+ */
74
+ export function selfTokenMigrationWarning(env = process.env) {
75
+ if (!env.ABX_RESOLVER_ADMIN_TOKEN || env.ABX_REMOTE_SELF_TOKEN)
76
+ return null;
77
+ return ('ABX_RESOLVER_ADMIN_TOKEN is set but is no longer read for the self-host default — rename it to ' +
78
+ 'ABX_REMOTE_SELF_TOKEN (and, if you address it by name, ABX_REMOTE_SELF_URL).');
79
+ }
55
80
  /** The token, when the remote is the command's OBJECT (add/index/forget/render/migrate-dest) —
56
81
  * a missing credential is a hard stop that names the exact var to set. */
57
82
  export function requireRemoteToken(t, env = process.env) {
@@ -64,6 +89,12 @@ export function requireRemoteToken(t, env = process.env) {
64
89
  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.` +
65
90
  (nearMiss ? `\n Found ${nearMiss.key} in your env — that name isn't read; rename it to ${t.tokenVar}.` : ''));
66
91
  }
92
+ // The self-host default/URL lane used to read ABX_RESOLVER_ADMIN_TOKEN directly. It's now just
93
+ // the named remote called "self" — no special-casing, same grammar as any other name — so the OLD
94
+ // var is never read here. No silent fallback: point at both new vars, once, by name.
95
+ const migration = selfTokenMigrationWarning(env);
96
+ if (migration)
97
+ throw new Error(`${migration} Or pass --remote-token.`);
67
98
  throw new Error(`remote ops need ${t.tokenVar} in your .env — it must match the token set on the resolver ` +
68
99
  '(`abx deploy-resolver` generates one and wires both sides). Or pass --remote-token.');
69
100
  }
@@ -155,4 +186,175 @@ export function describeRemoteError(err, t, label) {
155
186
  }
156
187
  return new Error(`${label}: ${err.message}`);
157
188
  }
189
+ // The `--remote <name|url>` target (remote.ts owns the convention): a named remote's
190
+ // `ABX_REMOTE_<NAME>_URL/_TOKEN`, an ad-hoc URL, or bare `--remote` = the self-host default.
191
+ // Returns null for a local op (the default).
192
+ export function remoteFlag(flags) {
193
+ return resolveRemote(flags.remote, flags['remote-token']);
194
+ }
195
+ /**
196
+ * The factory-verification tri-state, said plainly. `null` means the check never ran (no factory
197
+ * configured, or the configured one has no code on this chain — common on a local/dev chain), which
198
+ * is NOT the same as the chain telling us this contract isn't a clone of it.
199
+ */
200
+ export function canonicalLabel(isCanonical) {
201
+ if (isCanonical === true)
202
+ return g('yes (factory-verified)');
203
+ if (isCanonical === false)
204
+ return `${c.orange}NO — not a clone of the configured factory${c.reset}`;
205
+ return dim('not checked (no canonical factory for this chain — `abx doctor` shows which)');
206
+ }
207
+ /** How a lifecycle state reads at a glance — the same word everywhere it's printed. */
208
+ export function statusLabel(s) {
209
+ if (s === 'live')
210
+ return g('live');
211
+ if (s === 'failed')
212
+ return `${c.orange}failed${c.reset}`;
213
+ if (s === 'stale')
214
+ return `${c.orange}stale${c.reset}`;
215
+ return dim(s); // queued | backfilling — in progress, not a problem
216
+ }
217
+ /** `label value` with only the label dimmed — status values carry their own color, and wrapping
218
+ * them in `info()` would fight it. */
219
+ export const statusRow = (label, value) => console.log(` ${dim(label.padEnd(10))} ${value}`);
220
+ /**
221
+ * What to DO about a failure class — whose problem it is and whether waiting is the answer.
222
+ * The class alone told an agent enough to reason it out; it does not tell a creator, and "whose
223
+ * problem is this" is the single question a failed catch-up has to answer.
224
+ */
225
+ export function indexErrorAction(cls) {
226
+ if (cls === 'rpc_rate_limited')
227
+ 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.";
228
+ if (cls === 'rpc_unavailable')
229
+ 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.";
230
+ if (cls === 'not_abx_contract')
231
+ return 'the service found no ABX events at that address on this chain — check the address and that the service serves the right chain.';
232
+ return 'the cause is in the service operator’s logs — nothing you can fix from here; contact them if it persists.';
233
+ }
234
+ /** The one wording for "registered, but catch-up failed" — shared by add/index so both say the same
235
+ * thing: what failed, whose problem it is, and that the registration survived. */
236
+ export function failedCatchUpMessage(address, remote, err, check) {
237
+ const cls = err?.class;
238
+ return (`${address} is registered on ${remote.url}, but its catch-up FAILED` +
239
+ `${cls ? ` (${cls}${err?.message ? `: ${err.message}` : ''})` : ''}.\n` +
240
+ ` ${cls ? `→ ${indexErrorAction(cls)}\n ` : ''}` +
241
+ `The registration is durable and the service retries with backoff — watch it with ${bold(check + ' --watch')}.`);
242
+ }
243
+ /**
244
+ * One human line for a status read: where it is, how far along, and why if it's unhappy.
245
+ *
246
+ * What "where" means depends on the state, so say the right thing rather than one number that reads
247
+ * differently in each: a percentage is only honest while BACKFILLING (see indexProgress). A `live`
248
+ * project's `toBlock` only advances when that project has events, so on a busy chain a perfectly
249
+ * current project sits far below head — printing that as a ratio makes healthy look broken.
250
+ */
251
+ export function statusLine(s) {
252
+ const p = indexProgress(s);
253
+ let where;
254
+ if (p)
255
+ where = `${s.toBlock}/${s.headBlock} ${dim(`(${p.percent}%)`)}`;
256
+ else if (!s.toBlock)
257
+ where = dim('not indexed yet');
258
+ else if (s.status === 'live')
259
+ where = `${g('caught up')} ${dim(`· scanned through block ${s.toBlock}`)}`;
260
+ else if (s.status === 'stale')
261
+ where = `${dim('not tracking head right now')} ${dim(`· scanned through block ${s.toBlock}${s.headBlock ? ` of ${s.headBlock}` : ''}`)}`;
262
+ else
263
+ where = dim(`scanned through block ${s.toBlock}`);
264
+ const why = s.error ? ` ${c.orange}${s.error.class}${c.reset}${s.error.message ? dim(` — ${s.error.message}`) : ''}` : '';
265
+ return `${statusLabel(s.status)} ${where}${why}`;
266
+ }
267
+ /**
268
+ * Report a register/reindex answer, whichever of the two conformant shapes the service used.
269
+ *
270
+ * A `200` already carries the counts. A `202` means the registration is durable and catch-up is still
271
+ * running — so by default we poll to a terminal state and print the SAME summary line, giving the
272
+ * human the "waits, then tells you what happened" UX without the service holding a socket open for
273
+ * minutes. `--no-wait` stops at the 202 and names the command that checks later.
274
+ */
275
+ export async function reportRemoteIndexing(remote, chainId, address, r, flags, verb) {
276
+ // A real ABX clone ALWAYS emits a spine (its extension registrations at minimum), so a caught-up
277
+ // projection with zero events means the service scanned the wrong chain/floor or its RPC hasn't
278
+ // served the logs — not that the project is empty. A ✓ there is the lie that produces an empty
279
+ // dashboard (the same guard `reindexAfterDeploy` applies locally).
280
+ const settledLine = (events, tail) => {
281
+ if (events > 0)
282
+ ok(`remote resolver ${verb} ${address}: ${tail}`);
283
+ else
284
+ 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.`);
285
+ };
286
+ if (!isAccepted(r)) {
287
+ settledLine(r.project.eventCount, `${r.project.eventCount} events ${dim(`(${r.mode}, ${r.elapsedMs}ms)`)}`);
288
+ return;
289
+ }
290
+ const spec = remote.name ? remote.name.toLowerCase() : remote.source === 'default' ? '' : remote.url;
291
+ const check = `abx status ${address} --remote${spec ? ` ${spec}` : ''}`;
292
+ // The registration is durable in EVERY branch here — but don't claim it "is catching up" when the
293
+ // service already told us the catch-up failed. Two different sentences for two different facts.
294
+ if (r.project.status === 'failed') {
295
+ // Lead with the OUTCOME, not the sub-step that succeeded: a line starting "registered on …" skims
296
+ // as success even with the failure later in the sentence (a reviewer read it exactly that way).
297
+ warn(`${bold('catch-up FAILED')} on ${remote.url} — nothing is being served yet ${dim('(the registration itself is durable; the service retries it)')}`);
298
+ }
299
+ else {
300
+ info(`registered — ${r.project.status} ${dim('(the service accepted it and is catching up; the registration is durable)')}`);
301
+ }
302
+ // A known failure is not something to "not wait" for — we already have the answer, so report it as
303
+ // one regardless of --no-wait (never a ✓ over a broken index).
304
+ if (flags['no-wait'] !== undefined && r.project.status !== 'failed') {
305
+ info(`not waiting (--no-wait). Check with ${bold(check)}`);
306
+ return;
307
+ }
308
+ const label = `remote ${verb === 'indexed' ? 'add' : 'index'}`;
309
+ if (r.project.status === 'failed') {
310
+ // Fetch the class the register response may not have carried, so the "whose problem" line is
311
+ // never missing on the path that reports the failure soonest.
312
+ const st = await serviceClient(remote).projectStatus(chainId, address).catch(() => undefined);
313
+ throw new Error(`${label}: ${failedCatchUpMessage(address, remote, st?.error ?? undefined, check)}`);
314
+ }
315
+ let shown = -100;
316
+ let lastStatus;
317
+ try {
318
+ const final = await serviceClient(remote).awaitIndexed(chainId, address, {
319
+ onProgress: (s) => {
320
+ const p = indexProgress(s);
321
+ // Print on a state change or a meaningful step — a poll line every 3s is noise in a log an
322
+ // agent has to read back.
323
+ if (s.status !== lastStatus || (p && p.percent - shown >= 10)) {
324
+ lastStatus = s.status;
325
+ if (p)
326
+ shown = p.percent;
327
+ console.log(` ${statusLine(s)}`);
328
+ }
329
+ },
330
+ });
331
+ if (final.status === 'failed') {
332
+ throw new Error(`${label}: ${failedCatchUpMessage(address, remote, final.error, check)}`);
333
+ }
334
+ settledLine(final.eventCount, `${final.eventCount} events, ${final.tokenCount} token(s) ${dim('(live)')}`);
335
+ }
336
+ catch (err) {
337
+ if (err instanceof AbxIndexTimeoutError) {
338
+ warn(`${address} is still ${err.last?.status ?? 'catching up'} on ${remote.url} — nothing is lost, it just isn't done.`);
339
+ info(`follow it with ${bold(check + ' --watch')}`);
340
+ return;
341
+ }
342
+ // The service went away mid-wait (or rejected the poll). The registration still landed — say
343
+ // which failure this is, in the same words every other remote command uses.
344
+ if (err instanceof AbxServiceError)
345
+ throw describeRemoteError(err, remote, `remote ${verb}: registered, but polling status`);
346
+ throw err;
347
+ }
348
+ }
349
+ /** "3 live, 1 backfilling, 1 failed (rpc_rate_limited)" — the one-line answer to "is my stuff ok?" */
350
+ export function rollUp(projects) {
351
+ const counts = new Map();
352
+ for (const p of projects) {
353
+ const k = p.status ?? 'unknown';
354
+ counts.set(k, (counts.get(k) ?? 0) + 1);
355
+ }
356
+ const classes = [...new Set(projects.filter((p) => p.error).map((p) => p.error.class))];
357
+ const parts = [...counts.entries()].map(([k, n]) => `${n} ${k}`);
358
+ return `${parts.join(', ')}${classes.length ? ` ${dim(`(${classes.join(', ')})`)}` : ''}`;
359
+ }
158
360
  //# sourceMappingURL=remote.js.map
@@ -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;AAmBhF,kGAAkG;AAClG,MAAM,UAAU,gBAAgB,CAAC,CAAe;IAC9C,OAAO,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1F,CAAC;AAED;;;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,C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AG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,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,29 @@
1
+ import { type Address } from '@artblocks/abx-sdk';
2
+ import { type Lane, type SignResult, type TxProvider } from './signer.js';
3
+ import { type Flags } from './flags.js';
4
+ /** Resolve the signing lane from flags: `--unsigned` (cold) · `--sign` (wallet) · default hot. The
5
+ * one place this decision is made — every write reads the same three flags the same way. */
6
+ export declare function laneFromFlags(flags: Flags): Lane;
7
+ /**
8
+ * Opt-in pre-send confirmation gate (`--confirm`). OFF by default → scripted use is untouched. Even
9
+ * when opted in, it never blocks automation: `--yes` or a non-TTY stdin proceeds silently. Only an
10
+ * interactive `--confirm` prints the summary and waits for a y/N. Aborts on anything but yes.
11
+ */
12
+ export declare function confirmSend(summary: string, flags: Flags): Promise<void>;
13
+ export interface GatedSendOptions {
14
+ chainKey: string;
15
+ /** The address that must sign (onlyOwner / token holder) — shown to the human, guards the hot
16
+ * lane, and (when set) printed on the dry-run preview. */
17
+ expectedSigner?: Address;
18
+ }
19
+ /**
20
+ * The one send choke point for a SINGLE already-prepared write: `--dry-run` preview (nothing sent,
21
+ * returns `null`) → optional `--confirm` prompt → lane selection → `signTx`. Every caller — an
22
+ * owner-op's `runWrite`/`runMinterWrite`, or the deploy family's resumed-setup send — resolves to
23
+ * this, so the two families can never again each carry their own (possibly diverging) idea of what
24
+ * `--dry-run` or `--confirm` means. The historical bug class this forecloses structurally: a write
25
+ * reaching the send lane under `--dry-run` because some caller re-derived the check by hand and
26
+ * missed a branch.
27
+ */
28
+ export declare function gatedSend(provider: TxProvider, flags: Flags, opts: GatedSendOptions): Promise<SignResult | null>;
29
+ //# sourceMappingURL=riskgate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"riskgate.d.ts","sourceRoot":"","sources":["../src/riskgate.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgB,KAAK,OAAO,EAAkB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAS,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAC,MAAM,aAAa,CAAC;AAChF,OAAO,EAAW,KAAK,KAAK,EAAC,MAAM,YAAY,CAAC;AAOhD;6FAC6F;AAC7F,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAIhD;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAO9E;AAcD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB;+DAC2D;IAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAiBtH"}
@@ -0,0 +1,91 @@
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 { zeroAddress } from 'viem';
19
+ import { createInterface } from 'node:readline';
20
+ import { assertChainId } from '@artblocks/abx-sdk';
21
+ import { signTx } from './signer.js';
22
+ import { isDryRun } from './flags.js';
23
+ // ── tiny ANSI (kept local — every module here stands alone; see signer.ts/ownerops.ts) ───────
24
+ const C = { reset: '\x1b[0m', dim: '\x1b[2m', bold: '\x1b[1m' };
25
+ const dim = (s) => `${C.dim}${s}${C.reset}`;
26
+ const bold = (s) => `${C.bold}${s}${C.reset}`;
27
+ /** Resolve the signing lane from flags: `--unsigned` (cold) · `--sign` (wallet) · default hot. The
28
+ * one place this decision is made — every write reads the same three flags the same way. */
29
+ export function laneFromFlags(flags) {
30
+ if (flags.unsigned)
31
+ return 'unsigned';
32
+ if (flags.sign)
33
+ return 'sign';
34
+ return 'send';
35
+ }
36
+ /**
37
+ * Opt-in pre-send confirmation gate (`--confirm`). OFF by default → scripted use is untouched. Even
38
+ * when opted in, it never blocks automation: `--yes` or a non-TTY stdin proceeds silently. Only an
39
+ * interactive `--confirm` prints the summary and waits for a y/N. Aborts on anything but yes.
40
+ */
41
+ export async function confirmSend(summary, flags) {
42
+ if (flags.confirm === undefined)
43
+ return; // not opted in
44
+ if (flags.yes !== undefined || !process.stdin.isTTY)
45
+ return; // don't stall scripts/CI
46
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
47
+ const answer = await new Promise((resolve) => rl.question(`\n ${summary}\n Proceed? [y/N] `, resolve));
48
+ rl.close();
49
+ if (!/^y(es)?$/i.test(answer.trim()))
50
+ throw new Error('aborted at --confirm (nothing sent).');
51
+ }
52
+ async function resolveProvider(provider, signer) {
53
+ return typeof provider === 'function' ? await provider(signer) : provider;
54
+ }
55
+ function printDryRunPreview(prepared, flags, expectedSigner) {
56
+ console.log(`\n ${bold('◆ ' + prepared.summary)} ${dim('(dry run — nothing sent)')}`);
57
+ for (const [k, v] of Object.entries(prepared.fields))
58
+ console.log(` ${dim(k.padEnd(12))} ${v}`);
59
+ console.log(` ${dim('to'.padEnd(12))} ${prepared.to ?? dim('(contract deploy)')}`);
60
+ if (expectedSigner)
61
+ console.log(` ${dim('owner'.padEnd(12))} ${expectedSigner}`);
62
+ console.log(dim(`\n Re-run without --dry-run to send (lane: ${laneFromFlags(flags)}).\n`));
63
+ }
64
+ /**
65
+ * The one send choke point for a SINGLE already-prepared write: `--dry-run` preview (nothing sent,
66
+ * returns `null`) → optional `--confirm` prompt → lane selection → `signTx`. Every caller — an
67
+ * owner-op's `runWrite`/`runMinterWrite`, or the deploy family's resumed-setup send — resolves to
68
+ * this, so the two families can never again each carry their own (possibly diverging) idea of what
69
+ * `--dry-run` or `--confirm` means. The historical bug class this forecloses structurally: a write
70
+ * reaching the send lane under `--dry-run` because some caller re-derived the check by hand and
71
+ * missed a branch.
72
+ */
73
+ export async function gatedSend(provider, flags, opts) {
74
+ if (isDryRun(flags)) {
75
+ const prepared = await resolveProvider(provider, opts.expectedSigner ?? zeroAddress);
76
+ printDryRunPreview(prepared, flags, opts.expectedSigner);
77
+ return null;
78
+ }
79
+ await assertChainId(opts.chainKey); // verify the RPC really is the target chain before any irreversible write
80
+ const preview = await resolveProvider(provider, opts.expectedSigner ?? zeroAddress);
81
+ await confirmSend(preview.summary, flags);
82
+ return signTx(provider, {
83
+ lane: laneFromFlags(flags),
84
+ chainKey: opts.chainKey,
85
+ expectedSigner: opts.expectedSigner,
86
+ yes: !!flags.yes,
87
+ port: flags.port ? Number(flags.port) : undefined,
88
+ signUrlFile: flags['sign-url-file'],
89
+ });
90
+ }
91
+ //# sourceMappingURL=riskgate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"riskgate.js","sourceRoot":"","sources":["../src/riskgate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AACjC,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAgC,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAC,MAAM,EAA8C,MAAM,aAAa,CAAC;AAChF,OAAO,EAAC,QAAQ,EAAa,MAAM,YAAY,CAAC;AAEhD,gGAAgG;AAChG,MAAM,CAAC,GAAG,EAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;AAC9D,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;AACpD,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;AAEtD;6FAC6F;AAC7F,MAAM,UAAU,aAAa,CAAC,KAAY;IACxC,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,UAAU,CAAC;IACtC,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC;IAC9B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK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AAG;QAChB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QACjD,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC;KACpC,CAAC,CAAC;AACL,CAAC"}
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  import type { Address, Hex } from 'viem';
2
+ /** The `--schema` type/auth/format catalog, shown wherever the CLI nudges `--schema`. Kept accurate
3
+ * to the on-chain enums (PARAM_TYPES / AUTH_OPTIONS) + the Select-options / Range-bounds format —
4
+ * the old hint advertised non-existent `Anyone`/`Admin` auth legs. Used by both `deploy-code`
5
+ * (commands/deploy.ts) and `inspect` (commands/reads.ts), so it lives here beside the rest of the
6
+ * `--schema` machinery rather than in either command module. */
7
+ export declare const SCHEMA_CATALOG: string;
2
8
  export interface ParsedSchema {
3
9
  key: string;
4
10
  paramType: number;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAC,OAAO,EAAE,GAAG,EAAC,MAAM,MAAM,CAAC;AAOvC,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,sGAAsG;IACtG,WAAW,EAAE,OAAO,CAAC;IACrB;uGACmG;IACnG,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAID;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU7C;AAQD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2F1D;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,EAAE,CAMxE;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAatD"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAC,OAAO,EAAE,GAAG,EAAC,MAAM,MAAM,CAAC;AAIvC;;;;iEAIiE;AACjE,eAAO,MAAM,cAAc,QAI+B,CAAC;AAK3D,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,sGAAsG;IACtG,WAAW,EAAE,OAAO,CAAC;IACrB;uGACmG;IACnG,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAID;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU7C;AAQD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2F1D;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,EAAE,CAMxE;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAatD"}
package/dist/schema.js CHANGED
@@ -19,8 +19,17 @@
19
19
  * outer delimiters appear there. Omit the bracket on a Range → unbounded (min=max=0, the prior
20
20
  * behavior). A Select with no bracket, or a bracket on a type that takes none, is a clear error.
21
21
  */
22
- import { PARAM_TYPES, AUTH_OPTIONS, encodeScalarParam } from '@artblocks/abx-sdk';
22
+ import { PARAM_TYPES, AUTH_OPTIONS, decodeScalarParam, encodeScalarParam } from '@artblocks/abx-sdk';
23
23
  const ZERO32 = `0x${'0'.repeat(64)}`;
24
+ /** The `--schema` type/auth/format catalog, shown wherever the CLI nudges `--schema`. Kept accurate
25
+ * to the on-chain enums (PARAM_TYPES / AUTH_OPTIONS) + the Select-options / Range-bounds format —
26
+ * the old hint advertised non-existent `Anyone`/`Admin` auth legs. Used by both `deploy-code`
27
+ * (commands/deploy.ts) and `inspect` (commands/reads.ts), so it lives here beside the rest of the
28
+ * `--schema` machinery rather than in either command module. */
29
+ export const SCHEMA_CATALOG = 'Types: Bool·Select·Uint256Range·Int256Range·DecimalRange·HexColor·Timestamp·String·Bytes; ' +
30
+ 'Auth: Artist·TokenOwner·Address (or the Or-combos, e.g. ArtistOrTokenOwner). ' +
31
+ 'Select needs options — key:Select[A|B|C]:Auth; a Range takes bounds — key:Uint256Range[0..100]:Auth. ' +
32
+ 'A palette collectors set = palette:HexColor:TokenOwner';
24
33
  /** The types that accept a `[min..max]` bound (the contract's min/max fields are meaningful here). */
25
34
  const BOUNDED_TYPES = new Set(['Uint256Range', 'Int256Range', 'DecimalRange', 'Timestamp']);
26
35
  const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
@@ -156,25 +165,12 @@ export function describeSchema(s) {
156
165
  if (type === 'Select')
157
166
  detail = `[${s.selectOptions.join(' | ')}]`;
158
167
  else if (s.min !== ZERO32 || s.max !== ZERO32) {
159
- const lo = decodeBound(type, s.min);
160
- const hi = decodeBound(type, s.max);
168
+ const lo = decodeScalarParam(type, s.min);
169
+ const hi = decodeScalarParam(type, s.max);
161
170
  detail = `[${lo}..${hi}]`;
162
171
  }
163
172
  const who = s.authAddress && s.authAddress !== ZERO_ADDR ? `(${s.authAddress})` : '';
164
173
  const lock = s.lockAfter ? `:lock=${new Date(s.lockAfter * 1000).toISOString().slice(0, 19)}Z` : '';
165
174
  return `${s.key}:${type}${detail}:${auth}${who}${lock}`;
166
175
  }
167
- function decodeBound(typeName, v) {
168
- // Cheap display-only decode (the SDK's decodeScalarParam is the canonical one, but this keeps the
169
- // readout dependency-light for the two Range cases that matter in a bound).
170
- if (typeName === 'Int256Range')
171
- return BigInt.asIntN(256, BigInt(v)).toString();
172
- if (typeName === 'DecimalRange') {
173
- const scaled = BigInt(v);
174
- const whole = scaled / 10000000000n;
175
- const frac = (scaled % 10000000000n).toString().padStart(10, '0').replace(/0+$/, '');
176
- return frac ? `${whole}.${frac}` : `${whole}`;
177
- }
178
- return BigInt(v).toString();
179
- }
180
176
  //# sourceMappingURL=schema.js.map