@artblocks/abx-cli 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (137) hide show
  1. package/CHANGELOG.md +1991 -0
  2. package/assets/renderer-scaffold/src/interfaces/IAbxParams.sol +17 -0
  3. package/assets/renderer-scaffold/test/MyRenderer.t.sol +51 -2
  4. package/dist/commands/deploy.d.ts +206 -0
  5. package/dist/commands/deploy.d.ts.map +1 -0
  6. package/dist/commands/deploy.js +4273 -0
  7. package/dist/commands/deploy.js.map +1 -0
  8. package/dist/commands/project.d.ts +241 -0
  9. package/dist/commands/project.d.ts.map +1 -0
  10. package/dist/commands/project.js +1060 -0
  11. package/dist/commands/project.js.map +1 -0
  12. package/dist/commands/reads.d.ts +64 -0
  13. package/dist/commands/reads.d.ts.map +1 -0
  14. package/dist/commands/reads.js +697 -0
  15. package/dist/commands/reads.js.map +1 -0
  16. package/dist/commands/scaffold.d.ts +71 -0
  17. package/dist/commands/scaffold.d.ts.map +1 -0
  18. package/dist/commands/scaffold.js +552 -0
  19. package/dist/commands/scaffold.js.map +1 -0
  20. package/dist/commands/service.d.ts +41 -0
  21. package/dist/commands/service.d.ts.map +1 -0
  22. package/dist/commands/service.js +618 -0
  23. package/dist/commands/service.js.map +1 -0
  24. package/dist/commands/storage.d.ts +37 -0
  25. package/dist/commands/storage.d.ts.map +1 -0
  26. package/dist/commands/storage.js +343 -0
  27. package/dist/commands/storage.js.map +1 -0
  28. package/dist/config.d.ts +91 -2
  29. package/dist/config.d.ts.map +1 -1
  30. package/dist/config.js +244 -11
  31. package/dist/config.js.map +1 -1
  32. package/dist/conformance.d.ts +31 -0
  33. package/dist/conformance.d.ts.map +1 -0
  34. package/dist/conformance.js +371 -0
  35. package/dist/conformance.js.map +1 -0
  36. package/dist/deps.d.ts +6 -39
  37. package/dist/deps.d.ts.map +1 -1
  38. package/dist/deps.js +4 -68
  39. package/dist/deps.js.map +1 -1
  40. package/dist/errors.d.ts +20 -0
  41. package/dist/errors.d.ts.map +1 -0
  42. package/dist/errors.js +25 -0
  43. package/dist/errors.js.map +1 -0
  44. package/dist/flag-allowlists.d.ts +53 -0
  45. package/dist/flag-allowlists.d.ts.map +1 -0
  46. package/dist/flag-allowlists.js +148 -0
  47. package/dist/flag-allowlists.js.map +1 -0
  48. package/dist/flags.d.ts +41 -0
  49. package/dist/flags.d.ts.map +1 -1
  50. package/dist/flags.js +94 -1
  51. package/dist/flags.js.map +1 -1
  52. package/dist/jsonout.d.ts +37 -0
  53. package/dist/jsonout.d.ts.map +1 -0
  54. package/dist/jsonout.js +68 -0
  55. package/dist/jsonout.js.map +1 -0
  56. package/dist/kind.d.ts +53 -0
  57. package/dist/kind.d.ts.map +1 -0
  58. package/dist/kind.js +94 -0
  59. package/dist/kind.js.map +1 -0
  60. package/dist/main.js +534 -4708
  61. package/dist/main.js.map +1 -1
  62. package/dist/mintpage.d.ts +17 -2
  63. package/dist/mintpage.d.ts.map +1 -1
  64. package/dist/mintpage.js +214 -52
  65. package/dist/mintpage.js.map +1 -1
  66. package/dist/output.d.ts +148 -0
  67. package/dist/output.d.ts.map +1 -0
  68. package/dist/output.js +634 -0
  69. package/dist/output.js.map +1 -0
  70. package/dist/ownerops.d.ts +132 -44
  71. package/dist/ownerops.d.ts.map +1 -1
  72. package/dist/ownerops.js +1151 -329
  73. package/dist/ownerops.js.map +1 -1
  74. package/dist/preview.d.ts +81 -0
  75. package/dist/preview.d.ts.map +1 -0
  76. package/dist/preview.js +535 -0
  77. package/dist/preview.js.map +1 -0
  78. package/dist/prompt.d.ts +17 -0
  79. package/dist/prompt.d.ts.map +1 -0
  80. package/dist/prompt.js +19 -0
  81. package/dist/prompt.js.map +1 -0
  82. package/dist/provision.d.ts.map +1 -1
  83. package/dist/provision.js +10 -7
  84. package/dist/provision.js.map +1 -1
  85. package/dist/remote.d.ts +134 -53
  86. package/dist/remote.d.ts.map +1 -1
  87. package/dist/remote.js +358 -46
  88. package/dist/remote.js.map +1 -1
  89. package/dist/riskgate.d.ts +29 -0
  90. package/dist/riskgate.d.ts.map +1 -0
  91. package/dist/riskgate.js +91 -0
  92. package/dist/riskgate.js.map +1 -0
  93. package/dist/scaffold.d.ts +10 -0
  94. package/dist/scaffold.d.ts.map +1 -0
  95. package/dist/scaffold.js +52 -0
  96. package/dist/scaffold.js.map +1 -0
  97. package/dist/schema.d.ts +18 -1
  98. package/dist/schema.d.ts.map +1 -1
  99. package/dist/schema.js +74 -23
  100. package/dist/schema.js.map +1 -1
  101. package/dist/served.d.ts +30 -0
  102. package/dist/served.d.ts.map +1 -0
  103. package/dist/served.js +112 -0
  104. package/dist/served.js.map +1 -0
  105. package/dist/signer.d.ts +13 -0
  106. package/dist/signer.d.ts.map +1 -1
  107. package/dist/signer.js +80 -14
  108. package/dist/signer.js.map +1 -1
  109. package/dist/update-check.d.ts +83 -4
  110. package/dist/update-check.d.ts.map +1 -1
  111. package/dist/update-check.js +132 -17
  112. package/dist/update-check.js.map +1 -1
  113. package/package.json +10 -6
  114. package/skill/SKILL.md +108 -62
  115. package/skill/reference/code-projects.md +109 -13
  116. package/skill/reference/creator-token.md +86 -0
  117. package/skill/reference/decisions.md +87 -0
  118. package/skill/reference/hosting.md +48 -15
  119. package/skill/reference/operating.md +32 -8
  120. package/skill/reference/setup.md +10 -3
  121. package/skill/reference/troubleshooting.md +31 -4
  122. package/dist/inspect.d.ts +0 -48
  123. package/dist/inspect.d.ts.map +0 -1
  124. package/dist/inspect.js +0 -184
  125. package/dist/inspect.js.map +0 -1
  126. package/dist/migrate.d.ts +0 -65
  127. package/dist/migrate.d.ts.map +0 -1
  128. package/dist/migrate.js +0 -180
  129. package/dist/migrate.js.map +0 -1
  130. package/dist/onchain-uri.d.ts +0 -97
  131. package/dist/onchain-uri.d.ts.map +0 -1
  132. package/dist/onchain-uri.js +0 -243
  133. package/dist/onchain-uri.js.map +0 -1
  134. package/dist/upload.d.ts +0 -28
  135. package/dist/upload.d.ts.map +0 -1
  136. package/dist/upload.js +0 -41
  137. package/dist/upload.js.map +0 -1
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Per-command flag allowlists — the one place that knows which flags each command accepts, so the
3
+ * dispatcher can surface a typo'd or unsupported flag instead of silently ignoring it (B30).
4
+ *
5
+ * WHY THIS FILE EXISTS, and why the obvious shortcut doesn't work
6
+ * --------------------------------------------------------------
7
+ * The CLI used to have three different behaviors for an unrecognized flag: `deploy*` REFUSED,
8
+ * `preview`/`tokens`/`storage status`/`attach` WARNED, and ~35 other commands said nothing at all —
9
+ * so `abx set-royalty --bsp 500` or `abx minter buy --quantiy 5` did something quietly different from
10
+ * what was asked. That silence is the worst failure mode the CLI has, because the creator's next
11
+ * action is to believe it worked.
12
+ *
13
+ * The tempting fix is to DERIVE each allowlist from the `usage` string every command already declares.
14
+ * An audit of all ~45 commands says that would be actively harmful: several shared helpers read flags
15
+ * that appear in NO usage string anywhere. `storageOverrides()` reads twelve
16
+ * (`--backend`, `--gateway`, `--public-base`, `--storage-signer`, …) and is pulled in by `add`,
17
+ * `render`, `effects`, `migrate`, `storage upload`, and `storage balance|topup`; `--remote-token` is
18
+ * read by `index`, `verify`, `forget`, `status`, and `migrate`. A usage-derived allowlist would warn on
19
+ * every one of those — a false warning on a VALID flag, which is worse than the silence it replaces,
20
+ * because a notice people learn to distrust stops working for the real cases too.
21
+ *
22
+ * So the sets below are explicit, and composed from the shared groups by name. A command absent from
23
+ * `COMMAND_FLAGS` is simply not checked — this can grow incrementally, and an unlisted command keeps
24
+ * exactly its old behavior rather than acquiring a half-right allowlist.
25
+ */
26
+ /**
27
+ * Flags EVERY owner write accepts: the signing lane (`laneFromFlags`), the opt-in confirm gate, the
28
+ * wallet-lane plumbing, the post-write reindex nudge (`reindexIfKnown` → `resolveRemote`), and
29
+ * `--json`. Sourced from `riskgate.ts` + `ownerops.ts`, never from a usage string.
30
+ */
31
+ export declare const SHARED_WRITE: readonly ["send", "sign", "unsigned", "dry-run", "yes", "confirm", "port", "sign-url-file", "remote", "remote-token", "json"];
32
+ /**
33
+ * What `storageOverrides()` (config.ts) reads. Any command that resolves a storage backend from flags
34
+ * accepts all twelve — and none of them are documented per-command, which is exactly why a
35
+ * usage-derived allowlist would have been wrong.
36
+ */
37
+ export declare const STORAGE_OVERRIDE: readonly ["backend", "endpoint", "bucket", "region", "prefix", "public-base", "gateway", "mode", "api-url", "upload-url", "provider", "storage-signer"];
38
+ /** `remoteFlag()` / `resolveRemote()` — a named service plus its token. */
39
+ export declare const REMOTE: readonly ["remote", "remote-token"];
40
+ /**
41
+ * Command → accepted flags. Keys are the dispatch names in `main.ts`; a two-word command is keyed by
42
+ * `"<cmd> <sub>"` (e.g. `"storage upload"`) and falls back to the bare command when no subcommand row
43
+ * exists. `deploy`/`deploy-series`/`deploy-code` are deliberately ABSENT: they already enforce their
44
+ * own exhaustive allowlists via `refuseStrayFlags`, and duplicating those sets here would be a second
45
+ * copy to drift.
46
+ */
47
+ export declare const COMMAND_FLAGS: Record<string, ReadonlySet<string>>;
48
+ /**
49
+ * The allowlist for a dispatched command, preferring a `"<cmd> <sub>"` row. Returns undefined when the
50
+ * command isn't listed, which means "don't check" — never "nothing is allowed".
51
+ */
52
+ export declare function allowlistFor(cmd: string, sub?: string): ReadonlySet<string> | undefined;
53
+ //# sourceMappingURL=flag-allowlists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag-allowlists.d.ts","sourceRoot":"","sources":["../src/flag-allowlists.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,+HAYf,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,yJAanB,CAAC;AAEX,2EAA2E;AAC3E,eAAO,MAAM,MAAM,qCAAsC,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAuE7D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAMvF"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Per-command flag allowlists — the one place that knows which flags each command accepts, so the
3
+ * dispatcher can surface a typo'd or unsupported flag instead of silently ignoring it (B30).
4
+ *
5
+ * WHY THIS FILE EXISTS, and why the obvious shortcut doesn't work
6
+ * --------------------------------------------------------------
7
+ * The CLI used to have three different behaviors for an unrecognized flag: `deploy*` REFUSED,
8
+ * `preview`/`tokens`/`storage status`/`attach` WARNED, and ~35 other commands said nothing at all —
9
+ * so `abx set-royalty --bsp 500` or `abx minter buy --quantiy 5` did something quietly different from
10
+ * what was asked. That silence is the worst failure mode the CLI has, because the creator's next
11
+ * action is to believe it worked.
12
+ *
13
+ * The tempting fix is to DERIVE each allowlist from the `usage` string every command already declares.
14
+ * An audit of all ~45 commands says that would be actively harmful: several shared helpers read flags
15
+ * that appear in NO usage string anywhere. `storageOverrides()` reads twelve
16
+ * (`--backend`, `--gateway`, `--public-base`, `--storage-signer`, …) and is pulled in by `add`,
17
+ * `render`, `effects`, `migrate`, `storage upload`, and `storage balance|topup`; `--remote-token` is
18
+ * read by `index`, `verify`, `forget`, `status`, and `migrate`. A usage-derived allowlist would warn on
19
+ * every one of those — a false warning on a VALID flag, which is worse than the silence it replaces,
20
+ * because a notice people learn to distrust stops working for the real cases too.
21
+ *
22
+ * So the sets below are explicit, and composed from the shared groups by name. A command absent from
23
+ * `COMMAND_FLAGS` is simply not checked — this can grow incrementally, and an unlisted command keeps
24
+ * exactly its old behavior rather than acquiring a half-right allowlist.
25
+ */
26
+ /**
27
+ * Flags EVERY owner write accepts: the signing lane (`laneFromFlags`), the opt-in confirm gate, the
28
+ * wallet-lane plumbing, the post-write reindex nudge (`reindexIfKnown` → `resolveRemote`), and
29
+ * `--json`. Sourced from `riskgate.ts` + `ownerops.ts`, never from a usage string.
30
+ */
31
+ export const SHARED_WRITE = [
32
+ 'send',
33
+ 'sign',
34
+ 'unsigned',
35
+ 'dry-run',
36
+ 'yes',
37
+ 'confirm',
38
+ 'port',
39
+ 'sign-url-file',
40
+ 'remote',
41
+ 'remote-token',
42
+ 'json',
43
+ ];
44
+ /**
45
+ * What `storageOverrides()` (config.ts) reads. Any command that resolves a storage backend from flags
46
+ * accepts all twelve — and none of them are documented per-command, which is exactly why a
47
+ * usage-derived allowlist would have been wrong.
48
+ */
49
+ export const STORAGE_OVERRIDE = [
50
+ 'backend',
51
+ 'endpoint',
52
+ 'bucket',
53
+ 'region',
54
+ 'prefix',
55
+ 'public-base',
56
+ 'gateway',
57
+ 'mode',
58
+ 'api-url',
59
+ 'upload-url',
60
+ 'provider',
61
+ 'storage-signer',
62
+ ];
63
+ /** `remoteFlag()` / `resolveRemote()` — a named service plus its token. */
64
+ export const REMOTE = ['remote', 'remote-token'];
65
+ const set = (...groups) => new Set(groups.flat());
66
+ /**
67
+ * Command → accepted flags. Keys are the dispatch names in `main.ts`; a two-word command is keyed by
68
+ * `"<cmd> <sub>"` (e.g. `"storage upload"`) and falls back to the bare command when no subcommand row
69
+ * exists. `deploy`/`deploy-series`/`deploy-code` are deliberately ABSENT: they already enforce their
70
+ * own exhaustive allowlists via `refuseStrayFlags`, and duplicating those sets here would be a second
71
+ * copy to drift.
72
+ */
73
+ export const COMMAND_FLAGS = {
74
+ // ── read-only ──
75
+ inspect: set(['dep']),
76
+ predict: set(['salt', 'for', 'factory', 'copies', 'script', 'code-dir', 'image-renderer', 'dir', 'image']),
77
+ tokenuri: set(['token', 'fetch', 'json']),
78
+ contracturi: set([]),
79
+ tokens: set(['json', 'limit', 'from', 'holder']),
80
+ state: set(['json']),
81
+ status: set(['watch'], REMOTE),
82
+ verify: set(['json', 'yes', 'generator'], REMOTE),
83
+ doctor: set(['for', 'fix', 'global', 'agent']),
84
+ serve: set(['port']),
85
+ 'skill install': set(['target', 'global', 'agent']),
86
+ 'skill path': set(['target', 'global', 'agent']),
87
+ // ── indexing / projection ──
88
+ add: set(['from-block', 'factory', 'label', 'description', 'external-url', 'full', 'yes', 'traits', 'attributes', 'no-wait', 'dry-run'], REMOTE, STORAGE_OVERRIDE),
89
+ index: set(['full', 'no-wait', 'yes'], REMOTE),
90
+ forget: set([], REMOTE),
91
+ migrate: set(['from', 'to', 'from-block', 'factory', 'label', 'yes'], REMOTE, STORAGE_OVERRIDE),
92
+ remote: set(['conformance', 'remote-token', 'chain-id', 'address', 'from-block']),
93
+ // ── rendering / effects ──
94
+ render: set(['force', 'effects-url'], REMOTE, STORAGE_OVERRIDE),
95
+ effects: set(['once', 'port', 'interval-ms', 'concurrency'], REMOTE, STORAGE_OVERRIDE),
96
+ 'mint-page': set(['dir', 'name', 'rpc', 'minter-contract']),
97
+ 'scaffold-renderer': set(['force']),
98
+ // ── hosting artifacts ──
99
+ 'deploy-resolver': set(['provider', 'domain', 'app', 'dir', 'from-source']),
100
+ 'deploy-effects': set(['provider', 'resolver-url', 'app', 'dir', 'interval-ms', 'env-id']),
101
+ // ── storage ──
102
+ // `show` honors the full override set now (it previews what a given set of flags WOULD resolve to);
103
+ // before that it read env-only, and the warning correctly fired because the flags really were ignored.
104
+ storage: set(['check'], STORAGE_OVERRIDE),
105
+ 'storage show': set(['check'], STORAGE_OVERRIDE),
106
+ 'storage upload': set(['key', 'json', 'dry-run'], STORAGE_OVERRIDE),
107
+ 'storage balance': set(['for'], STORAGE_OVERRIDE),
108
+ 'storage topup': set(['usd'], STORAGE_OVERRIDE),
109
+ 'storage backup-key': set(['out']),
110
+ // ── owner writes (every one also takes SHARED_WRITE) ──
111
+ refresh: set(['token']), // sends no tx — SHARED_WRITE deliberately does NOT apply
112
+ 'set-minter': set(['minter'], SHARED_WRITE),
113
+ 'set-max-invocations': set(['max'], SHARED_WRITE),
114
+ 'ping-uri': set(['token-ids'], SHARED_WRITE),
115
+ 'configure-param': set(['file', 'remote'], SHARED_WRITE),
116
+ 'set-schema': set(['schema', 'force'], SHARED_WRITE),
117
+ 'retire-param': set([], SHARED_WRITE),
118
+ 'set-param-hooks': set(['configure', 'augment', 'transfer', 'clear'], SHARED_WRITE),
119
+ 'set-dependency': set([], SHARED_WRITE),
120
+ 'remove-last-dependency': set([], SHARED_WRITE),
121
+ 'set-dependency-registry': set([], SHARED_WRITE),
122
+ 'lock-dependencies': set([], SHARED_WRITE),
123
+ 'set-primary-payee': set(['payee'], SHARED_WRITE),
124
+ pause: set([], SHARED_WRITE),
125
+ unpause: set([], SHARED_WRITE),
126
+ 'set-token-uri': set(['uri', 'override', 'token'], SHARED_WRITE),
127
+ 'set-contract-uri': set(['uri', 'override'], SHARED_WRITE),
128
+ 'set-royalty': set(['bps', 'receiver'], SHARED_WRITE),
129
+ 'set-transfer-validator': set([], SHARED_WRITE),
130
+ 'set-field': set(['field', 'text', 'value', 'representation', 'collection', 'token', 'file', 'compress'], SHARED_WRITE),
131
+ 'lock-field': set(['field', 'collection', 'token', 'force-field'], SHARED_WRITE),
132
+ 'set-renderer': set(['collection', 'off', 'renderer'], SHARED_WRITE),
133
+ 'lock-uri': set(['collection'], SHARED_WRITE),
134
+ 'set-admin': set(['to'], SHARED_WRITE),
135
+ };
136
+ /**
137
+ * The allowlist for a dispatched command, preferring a `"<cmd> <sub>"` row. Returns undefined when the
138
+ * command isn't listed, which means "don't check" — never "nothing is allowed".
139
+ */
140
+ export function allowlistFor(cmd, sub) {
141
+ if (sub) {
142
+ const withSub = COMMAND_FLAGS[`${cmd} ${sub}`];
143
+ if (withSub)
144
+ return withSub;
145
+ }
146
+ return COMMAND_FLAGS[cmd];
147
+ }
148
+ //# sourceMappingURL=flag-allowlists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag-allowlists.js","sourceRoot":"","sources":["../src/flag-allowlists.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;GAIG;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E,UAAU,CAAC,EAAE,YAAY,CAAC;IACpE,UAAU,EAAE,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC7C,WAAW,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,GAAY;IACpD,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;QAC/C,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;IAC9B,CAAC;IACD,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
package/dist/flags.d.ts CHANGED
@@ -9,6 +9,7 @@
9
9
  * the first (a real footgun on a multi-param drop; a Select's options use `|` not `,`, so the
10
10
  * comma-join never collides with an option list).
11
11
  */
12
+ import { type Hex } from 'viem';
12
13
  export type Flags = Record<string, string | undefined>;
13
14
  /** Flags where every occurrence counts (values comma-join, in argv order). */
14
15
  export declare const REPEATABLE_FLAGS: ReadonlySet<string>;
@@ -18,7 +19,18 @@ export declare const REPEATABLE_FLAGS: ReadonlySet<string>;
18
19
  * `no-update-check` opts out of the startup update nudge (see update-check.ts).
19
20
  */
20
21
  export declare const GLOBAL_FLAGS: ReadonlySet<string>;
22
+ /** Whether `--dry-run` was passed. The one place that truthiness is decided — every write command
23
+ * (owner-op or deploy) reads it through here rather than hand-rolling `!!flags['dry-run']`, so a
24
+ * fresh command can't ship with a *slightly* different spelling of the same check (or skip it). */
25
+ export declare function isDryRun(flags: Flags): boolean;
21
26
  export declare function parseFlags(args: string[]): Flags;
27
+ /**
28
+ * The bare (non-flag) arguments, with flag VALUES removed — the mirror of {@link parseFlags}, and
29
+ * deliberately next to it: the two must consume argv by the same rule or a flag's value looks like a
30
+ * positional. (Hand-rolling `args.filter(a => !a.startsWith('-'))` reads `--token 0` as a stray
31
+ * positional `0`, which is exactly the bug a stray-positional check is meant to catch.)
32
+ */
33
+ export declare function positionalArgs(args: string[]): string[];
22
34
  /**
23
35
  * The flag keys in `flags` that are NOT in `allowed` — for a non-fatal "unrecognized flag"
24
36
  * notice at a command's entry. {@link parseFlags} keeps any `--k` it sees, so a typo'd or
@@ -28,4 +40,33 @@ export declare function parseFlags(args: string[]): Flags;
28
40
  * scripted deploy (owner's stateless/scriptable line — see cli-ux-decisions).
29
41
  */
30
42
  export declare function unknownFlags(flags: Flags, allowed: Iterable<string>): string[];
43
+ /** Warn (never throw) on a flag the command doesn't recognize — a typo'd or unsupported flag
44
+ * otherwise no-ops INVISIBLY (the worst failure mode for a write-adjacent value like a mistyped
45
+ * --royalty-bps). Non-fatal, per the owner's scriptability line ([[cli-ux-decisions]]). */
46
+ export declare const FLAG_HINTS: Record<string, (cmd: string) => string | undefined>;
47
+ /**
48
+ * Unknown flags on a command that can SEND: refuse, don't warn.
49
+ *
50
+ * This used to warn and carry on, and `--chain sepolia` proved why that isn't enough — the warning was
51
+ * accurate, it scrolled past, and the deploy ran on the DEFAULT chain. On a dry run that costs a
52
+ * confused minute; on a funded send it is a wrong-chain deploy. "Prose that was ignored once will be
53
+ * ignored again" is the standing rule here, so the tx-sending commands stop instead.
54
+ *
55
+ * Safe to refuse rather than warn because a flag absent from the allowlist is, by construction, one
56
+ * the command never reads — verified per command by comparing every `flags.x` read in its body against
57
+ * its allowlist. So refusal cannot break a working flag; it only makes an already-ignored one loud.
58
+ *
59
+ * `--dry-run` refuses identically. A preview that accepts what the real send rejects is its own trap:
60
+ * you'd validate a command in preview and have it fail at the moment it matters.
61
+ */
62
+ export declare function refuseStrayFlags(flags: Flags, allowed: ReadonlySet<string>, cmd: string): void;
63
+ /** Unknown flags on a READ-ONLY command: warn, don't refuse. Nothing can be mis-sent, and a stray
64
+ * flag on `preview`/`inspect` shouldn't stop a creator mid-iteration. */
65
+ export declare function warnStrayFlags(flags: Flags, allowed: ReadonlySet<string>, cmd: string): void;
66
+ /** The wallet-lane owner-pinning guard: on `--sign` with no `--for`, whichever wallet connects
67
+ * becomes owner + royalty receiver + mint recipient (the launch-readiness "random wallet owns the
68
+ * collection" trap). Fires uniformly on deploy / deploy-series / deploy-code. */
69
+ export declare function warnSignWithoutFor(flags: Flags): void;
70
+ /** Validate an explicit --salt (a 32-byte hex). Undefined when absent. */
71
+ export declare function parseSaltFlag(raw: string | undefined): Hex | undefined;
31
72
  //# sourceMappingURL=flags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEvD,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAA8B,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAAgC,CAAC;AAE9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAchD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAG9E"}
1
+ {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAC,KAAK,GAAG,EAAC,MAAM,MAAM,CAAC;AAG9B,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEvD,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAuC,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAAgC,CAAC;AAE9E;;oGAEoG;AACpG,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAE9C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAchD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWvD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAG9E;AAED;;4FAE4F;AAI5F,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAK1E,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAU9F;AAED;0EAC0E;AAC1E,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAS5F;AAED;;kFAEkF;AAClF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAIrD;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAMtE"}
package/dist/flags.js CHANGED
@@ -1,11 +1,18 @@
1
+ import { bold, info, warn } from './output.js';
1
2
  /** Flags where every occurrence counts (values comma-join, in argv order). */
2
- export const REPEATABLE_FLAGS = new Set(['dep', 'schema']);
3
+ export const REPEATABLE_FLAGS = new Set(['dep', 'schema', 'param']);
3
4
  /**
4
5
  * Flags valid on ANY command (handled centrally in main, not by a command handler), so
5
6
  * {@link unknownFlags} never flags them as unrecognized regardless of the per-command allowlist.
6
7
  * `no-update-check` opts out of the startup update nudge (see update-check.ts).
7
8
  */
8
9
  export const GLOBAL_FLAGS = new Set(['no-update-check']);
10
+ /** Whether `--dry-run` was passed. The one place that truthiness is decided — every write command
11
+ * (owner-op or deploy) reads it through here rather than hand-rolling `!!flags['dry-run']`, so a
12
+ * fresh command can't ship with a *slightly* different spelling of the same check (or skip it). */
13
+ export function isDryRun(flags) {
14
+ return !!flags['dry-run'];
15
+ }
9
16
  export function parseFlags(args) {
10
17
  const out = {};
11
18
  const set = (k, v) => {
@@ -25,6 +32,25 @@ export function parseFlags(args) {
25
32
  }
26
33
  return out;
27
34
  }
35
+ /**
36
+ * The bare (non-flag) arguments, with flag VALUES removed — the mirror of {@link parseFlags}, and
37
+ * deliberately next to it: the two must consume argv by the same rule or a flag's value looks like a
38
+ * positional. (Hand-rolling `args.filter(a => !a.startsWith('-'))` reads `--token 0` as a stray
39
+ * positional `0`, which is exactly the bug a stray-positional check is meant to catch.)
40
+ */
41
+ export function positionalArgs(args) {
42
+ const out = [];
43
+ for (let i = 0; i < args.length; i++) {
44
+ const a = args[i];
45
+ if (a.startsWith('--')) {
46
+ if (a.indexOf('=') === -1 && args[i + 1] && !args[i + 1].startsWith('--'))
47
+ i++; // this flag consumes the next token
48
+ continue;
49
+ }
50
+ out.push(a);
51
+ }
52
+ return out;
53
+ }
28
54
  /**
29
55
  * The flag keys in `flags` that are NOT in `allowed` — for a non-fatal "unrecognized flag"
30
56
  * notice at a command's entry. {@link parseFlags} keeps any `--k` it sees, so a typo'd or
@@ -37,4 +63,71 @@ export function unknownFlags(flags, allowed) {
37
63
  const ok = new Set(allowed);
38
64
  return Object.keys(flags).filter((k) => !ok.has(k) && !GLOBAL_FLAGS.has(k));
39
65
  }
66
+ /** Warn (never throw) on a flag the command doesn't recognize — a typo'd or unsupported flag
67
+ * otherwise no-ops INVISIBLY (the worst failure mode for a write-adjacent value like a mistyped
68
+ * --royalty-bps). Non-fatal, per the owner's scriptability line ([[cli-ux-decisions]]). */
69
+ // Targeted "did you mean" hints for the flags creators most often invent (seen across agent sessions).
70
+ // A stray flag is otherwise silently ignored, so a wrong-but-plausible one (a price/supply flag that
71
+ // doesn't exist) reads as "it worked." Command-aware so a flag valid elsewhere isn't mis-hinted.
72
+ export const FLAG_HINTS = {
73
+ count: (cmd) => (cmd === 'deploy-code' ? 'did you mean --max <N> (the supply cap)?' : undefined),
74
+ price: () => 'a sale price is NOT set at deploy — configure it after with `abx minter configure <addr> --price <eth>`.',
75
+ supply: () => 'did you mean --max <N> (the supply cap)?',
76
+ amount: () => 'a sale price/amount is set post-deploy via `abx minter configure`.',
77
+ };
78
+ /**
79
+ * Unknown flags on a command that can SEND: refuse, don't warn.
80
+ *
81
+ * This used to warn and carry on, and `--chain sepolia` proved why that isn't enough — the warning was
82
+ * accurate, it scrolled past, and the deploy ran on the DEFAULT chain. On a dry run that costs a
83
+ * confused minute; on a funded send it is a wrong-chain deploy. "Prose that was ignored once will be
84
+ * ignored again" is the standing rule here, so the tx-sending commands stop instead.
85
+ *
86
+ * Safe to refuse rather than warn because a flag absent from the allowlist is, by construction, one
87
+ * the command never reads — verified per command by comparing every `flags.x` read in its body against
88
+ * its allowlist. So refusal cannot break a working flag; it only makes an already-ignored one loud.
89
+ *
90
+ * `--dry-run` refuses identically. A preview that accepts what the real send rejects is its own trap:
91
+ * you'd validate a command in preview and have it fail at the moment it matters.
92
+ */
93
+ export function refuseStrayFlags(flags, allowed, cmd) {
94
+ const stray = unknownFlags(flags, allowed);
95
+ if (!stray.length)
96
+ return;
97
+ const hints = stray.map((f) => FLAG_HINTS[f]?.(cmd)).filter(Boolean);
98
+ throw new Error(`unrecognized flag(s): ${stray.map((f) => '--' + f).join(', ')} — this command would have ignored them silently, so it is refusing instead.\n` +
99
+ hints.map((h, i) => ` ↳ --${stray[i]}: ${h}`).join('\n') +
100
+ (hints.length ? '\n' : '') +
101
+ ` see \`abx help ${cmd}\` for the flags it accepts.`);
102
+ }
103
+ /** Unknown flags on a READ-ONLY command: warn, don't refuse. Nothing can be mis-sent, and a stray
104
+ * flag on `preview`/`inspect` shouldn't stop a creator mid-iteration. */
105
+ export function warnStrayFlags(flags, allowed, cmd) {
106
+ const stray = unknownFlags(flags, allowed);
107
+ if (stray.length) {
108
+ warn(`unrecognized flag(s), ignored: ${stray.map((f) => bold('--' + f)).join(', ')} — see \`abx help ${cmd}\`. (A misspelled or unsupported flag silently does nothing.)`);
109
+ for (const f of stray) {
110
+ const hint = FLAG_HINTS[f]?.(cmd);
111
+ if (hint)
112
+ info(` ↳ --${f}: ${hint}`);
113
+ }
114
+ }
115
+ }
116
+ /** The wallet-lane owner-pinning guard: on `--sign` with no `--for`, whichever wallet connects
117
+ * becomes owner + royalty receiver + mint recipient (the launch-readiness "random wallet owns the
118
+ * collection" trap). Fires uniformly on deploy / deploy-series / deploy-code. */
119
+ export function warnSignWithoutFor(flags) {
120
+ if (flags.sign !== undefined && !flags.for) {
121
+ warn(`--sign without --for: whichever wallet connects becomes ${bold('owner + royalty receiver + mint recipient')}. Pass ${bold('--for <your address>')} to PIN it — the sign page then refuses a mismatched wallet (the intended safety on the wallet lane).`);
122
+ }
123
+ }
124
+ /** Validate an explicit --salt (a 32-byte hex). Undefined when absent. */
125
+ export function parseSaltFlag(raw) {
126
+ if (!raw || raw === 'true')
127
+ return undefined;
128
+ if (!/^0x[0-9a-fA-F]{64}$/.test(raw)) {
129
+ throw new Error(`--salt must be a 32-byte hex (0x + 64 hex chars); got '${raw}'`);
130
+ }
131
+ return raw;
132
+ }
40
133
  //# sourceMappingURL=flags.js.map
package/dist/flags.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAaA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC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K,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAC3C,IAAI,CAAC,2DAA2D,IAAI,CAAC,2CAA2C,CAAC,UAAU,IAAI,CAAC,sBAAsB,CAAC,uGAAuG,CAAC,CAAC;IAClQ,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,aAAa,CAAC,GAAuB;IACnD,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IAC7C,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,0DAA0D,GAAG,GAAG,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,GAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { Flags } from './flags.js';
2
+ /**
3
+ * `--json`: make **stdout a machine channel**.
4
+ *
5
+ * The rule this enforces, from an integrator who drove the CLI from a server: *a value a program
6
+ * needs must be obtainable without parsing prose.* They had to regex-scrape ANSI-coloured stdout for
7
+ * every value — and an escape code ended up inside a locator, was written into a stored player URL,
8
+ * and 404'd in production. The cause was found only by inspecting stored bytes.
9
+ *
10
+ * So under `--json`, stdout carries exactly one JSON document and nothing else. Every narration line
11
+ * the command would print for a human goes to **stderr** instead — not suppressed, because a human
12
+ * watching a deploy still wants to see it, and a program redirecting stdout still gets a clean parse.
13
+ * The update-check already wrote to stderr for precisely this reason; this carries that instinct
14
+ * through to the values themselves.
15
+ *
16
+ * It works by swapping `console.log` for the duration rather than threading a `quiet` flag through
17
+ * every command body. That is deliberate: the alternative is touching dozens of call sites, where the
18
+ * one that gets missed is a stray line that corrupts a parse — the exact failure mode being fixed.
19
+ * `console.error`/`console.warn` are untouched (already stderr), and the payload is written through a
20
+ * captured reference to the real `console.log`, so nothing can intercept it back.
21
+ */
22
+ export declare function jsonMode(flags: Flags): boolean;
23
+ /**
24
+ * Run `body` and, under `--json`, print whatever it returns as the sole contents of stdout.
25
+ *
26
+ * `body` receives an `emit` it may call to contribute the payload incrementally — for a command that
27
+ * discovers its value midway (a deploy learning its address) and would otherwise have to restructure
28
+ * to return it at the end. The last `emit` wins; a returned value overrides both.
29
+ *
30
+ * Without `--json` this is a plain pass-through: zero behaviour change on the human path.
31
+ */
32
+ export declare function withJson<T extends Record<string, unknown>>(flags: Flags, body: (emit: (payload: T) => void) => Promise<T | void>): Promise<void>;
33
+ /** BigInt-safe JSON: bigints become decimal strings rather than throwing. Every on-chain number a
34
+ * payload carries (supply, a token id, a block) arrives as a bigint, and `JSON.stringify` refuses
35
+ * them outright — so a payload builder that forgets one would fail at the last line of a deploy. */
36
+ export declare function jsonSafe<T>(value: T): T;
37
+ //# sourceMappingURL=jsonout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonout.d.ts","sourceRoot":"","sources":["../src/jsonout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAE9C;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,KAAK,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GACtD,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;qGAEqG;AACrG,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEvC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * `--json`: make **stdout a machine channel**.
3
+ *
4
+ * The rule this enforces, from an integrator who drove the CLI from a server: *a value a program
5
+ * needs must be obtainable without parsing prose.* They had to regex-scrape ANSI-coloured stdout for
6
+ * every value — and an escape code ended up inside a locator, was written into a stored player URL,
7
+ * and 404'd in production. The cause was found only by inspecting stored bytes.
8
+ *
9
+ * So under `--json`, stdout carries exactly one JSON document and nothing else. Every narration line
10
+ * the command would print for a human goes to **stderr** instead — not suppressed, because a human
11
+ * watching a deploy still wants to see it, and a program redirecting stdout still gets a clean parse.
12
+ * The update-check already wrote to stderr for precisely this reason; this carries that instinct
13
+ * through to the values themselves.
14
+ *
15
+ * It works by swapping `console.log` for the duration rather than threading a `quiet` flag through
16
+ * every command body. That is deliberate: the alternative is touching dozens of call sites, where the
17
+ * one that gets missed is a stray line that corrupts a parse — the exact failure mode being fixed.
18
+ * `console.error`/`console.warn` are untouched (already stderr), and the payload is written through a
19
+ * captured reference to the real `console.log`, so nothing can intercept it back.
20
+ */
21
+ export function jsonMode(flags) {
22
+ return flags.json !== undefined;
23
+ }
24
+ /**
25
+ * Run `body` and, under `--json`, print whatever it returns as the sole contents of stdout.
26
+ *
27
+ * `body` receives an `emit` it may call to contribute the payload incrementally — for a command that
28
+ * discovers its value midway (a deploy learning its address) and would otherwise have to restructure
29
+ * to return it at the end. The last `emit` wins; a returned value overrides both.
30
+ *
31
+ * Without `--json` this is a plain pass-through: zero behaviour change on the human path.
32
+ */
33
+ export async function withJson(flags, body) {
34
+ let payload;
35
+ const emit = (p) => {
36
+ payload = p;
37
+ };
38
+ if (!jsonMode(flags)) {
39
+ await body(emit);
40
+ return;
41
+ }
42
+ const realLog = console.log;
43
+ // Route human narration to stderr. Mirrors console.log's own formatting closely enough for
44
+ // progress text; nothing structured goes through here.
45
+ console.log = (...args) => process.stderr.write(args.map((a) => String(a)).join(' ') + '\n');
46
+ try {
47
+ const returned = await body(emit);
48
+ const out = returned ?? payload;
49
+ // A command that emitted nothing is a bug in that command, not a silent empty object — say so on
50
+ // stderr and leave stdout empty rather than writing `{}` that a caller would trust.
51
+ if (out === undefined) {
52
+ process.stderr.write('abx: --json produced no payload for this command (please report it)\n');
53
+ process.exitCode = 1;
54
+ return;
55
+ }
56
+ realLog(JSON.stringify(out, null, 2));
57
+ }
58
+ finally {
59
+ console.log = realLog;
60
+ }
61
+ }
62
+ /** BigInt-safe JSON: bigints become decimal strings rather than throwing. Every on-chain number a
63
+ * payload carries (supply, a token id, a block) arrives as a bigint, and `JSON.stringify` refuses
64
+ * them outright — so a payload builder that forgets one would fail at the last line of a deploy. */
65
+ export function jsonSafe(value) {
66
+ return JSON.parse(JSON.stringify(value, (_k, v) => (typeof v === 'bigint' ? v.toString() : v)));
67
+ }
68
+ //# sourceMappingURL=jsonout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonout.js","sourceRoot":"","sources":["../src/jsonout.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAY;IACnC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,KAAY,EACZ,IAAuD;IAEvD,IAAI,OAAsB,CAAC;IAC3B,MAAM,IAAI,GAAG,CAAC,CAAI,EAAE,EAAE;QACpB,OAAO,GAAG,CAAC,CAAC;IACd,CAAC,CAAC;IACF,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAC5B,2FAA2F;IAC3F,uDAAuD;IACvD,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACxG,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,GAAG,GAAI,QAA0B,IAAI,OAAO,CAAC;QACnD,iGAAiG;QACjG,oFAAoF;QACpF,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;YAC9F,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC;IACxB,CAAC;AACH,CAAC;AAED;;qGAEqG;AACrG,MAAM,UAAU,QAAQ,CAAI,KAAQ;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAM,CAAC;AACvG,CAAC"}
package/dist/kind.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Centralized token-kind detection — one shared probe for the six concrete ABX token types, from
3
+ * three plain `eth_call`s (no events, no local index). Before this existed, the same "is this a
4
+ * 721 or an edition, and which concrete type" question was answered by ad-hoc, slightly different
5
+ * probes scattered across `commands/project.ts` (`state`), `commands/scaffold.ts`
6
+ * (`assertMintableSeries`), and `ownerops.ts` (the `set-param-hooks` guard) — this gives it one
7
+ * name and one place to live, so a new call site (mint/transfer/minter kind-awareness) doesn't
8
+ * grow a fourth copy.
9
+ *
10
+ * The discriminator mirrors the SDK's `ProjectState.contractType` union (reconstruct.ts) exactly,
11
+ * but this is a LIVE probe, not an event fold: `state`, `mint-page`, and the owner-op guards need a
12
+ * snapshot with no local index and no getLogs scan.
13
+ *
14
+ * ERC-165 0xd9b67a26 (ERC-1155) → the edition family (OneOfOneEdition / EditionImage / EditionCode)
15
+ * maxInvocations() → present on the multi-id twins (Series/SeriesCode, EditionImage/Code)
16
+ * the Params/ConfigurableParams surface (`paramHooks()`) → present only on the two code twins
17
+ *
18
+ * Every probe is defensive (try/catch → false) — a getter absent because the extension isn't
19
+ * composed and a getter absent because there's no contract at that address read identically here.
20
+ * That made the three negative probes collapse to the SAME answer for an address with no code at
21
+ * all: all three fail, so the ladder fell through to its `1of1` default and every empty address was
22
+ * reported as a confident "OneOfOneImage". Callers were supposed to rule that out first (`state`
23
+ * does), but `set-max-supply` and `minter buy` did not, and told edition owners "…is a OneOfOneImage
24
+ * (721) — drop your edition flags" whenever the address was mistyped or the chain was wrong (the
25
+ * default is base-sepolia, so a Sepolia contract hits this immediately). So the existence check now
26
+ * lives HERE, once, ahead of the probes — every call site inherits it and cannot forget it.
27
+ */
28
+ import type { Address, PublicClient } from 'viem';
29
+ /** Mirrors the SDK's `ProjectState.contractType` (reconstruct.ts) — the 721 ladder and its
30
+ * ERC-1155 edition twin, one rung apart. */
31
+ export type TokenKind = '1of1' | 'series' | 'code' | '1of1-edition' | 'edition' | 'edition-code';
32
+ export interface TokenKindInfo {
33
+ kind: TokenKind;
34
+ /** The single fact most call sites actually branch on — true for the three ERC-1155 twins. */
35
+ isEdition: boolean;
36
+ /** The concrete contract name, for a readout ("EditionImage (edition) state"). */
37
+ label: string;
38
+ }
39
+ /**
40
+ * Which of the six concrete ABX token types `address` is — the shared discriminator every command
41
+ * that branches on kind should call instead of re-deriving its own probe. Three live `eth_call`s,
42
+ * in the order that lets each short-circuit the next: ERC-165 first (edition family or not), then
43
+ * `maxInvocations()` (multi-id or not), then the Params surface (code or not).
44
+ */
45
+ export declare function detectTokenKind(client: PublicClient, address: Address): Promise<TokenKindInfo>;
46
+ /** Convenience for a call site that only needs the one boolean (is this an ERC-1155 edition, at
47
+ * all) — the cheapest single probe, so a guard that doesn't need the full breakdown doesn't pay
48
+ * for the other two calls. */
49
+ export declare function isEditionContract(client: PublicClient, address: Address): Promise<boolean>;
50
+ /** Human, one-line description of a kind — `"EditionImage (edition)"`, `"SeriesImage (series)"` —
51
+ * the shared phrasing for a readout header (`state`, `tokens`). */
52
+ export declare function describeKind(info: TokenKindInfo): string;
53
+ //# sourceMappingURL=kind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind.d.ts","sourceRoot":"","sources":["../src/kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAEhD;6CAC6C;AAC7C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,GAAG,cAAc,CAAC;AAEjG,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,8FAA8F;IAC9F,SAAS,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;CACf;AAkED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAYpG;AAED;;+BAE+B;AAC/B,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEhG;AAED;oEACoE;AACpE,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAExD"}