@artblocks/abx-token-api 0.1.0-alpha.5 → 0.1.0-alpha.50

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 (51) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/dist/code.d.ts +33 -12
  3. package/dist/code.d.ts.map +1 -1
  4. package/dist/code.js +68 -56
  5. package/dist/code.js.map +1 -1
  6. package/dist/{art.d.ts → content.d.ts} +5 -5
  7. package/dist/content.d.ts.map +1 -0
  8. package/dist/{art.js → content.js} +6 -6
  9. package/dist/content.js.map +1 -0
  10. package/dist/control-plane.d.ts +24 -13
  11. package/dist/control-plane.d.ts.map +1 -1
  12. package/dist/control-plane.js +289 -43
  13. package/dist/control-plane.js.map +1 -1
  14. package/dist/dashboard.d.ts.map +1 -1
  15. package/dist/dashboard.js +55 -8
  16. package/dist/dashboard.js.map +1 -1
  17. package/dist/deps.d.ts +28 -110
  18. package/dist/deps.d.ts.map +1 -1
  19. package/dist/deps.js +34 -184
  20. package/dist/deps.js.map +1 -1
  21. package/dist/index.d.ts +8 -8
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +13 -11
  24. package/dist/index.js.map +1 -1
  25. package/dist/metadata.d.ts +87 -4
  26. package/dist/metadata.d.ts.map +1 -1
  27. package/dist/metadata.js +343 -105
  28. package/dist/metadata.js.map +1 -1
  29. package/dist/resolve.d.ts +0 -2
  30. package/dist/resolve.d.ts.map +1 -1
  31. package/dist/resolve.js +0 -5
  32. package/dist/resolve.js.map +1 -1
  33. package/dist/server.d.ts +4 -1
  34. package/dist/server.d.ts.map +1 -1
  35. package/dist/server.js +257 -70
  36. package/dist/server.js.map +1 -1
  37. package/dist/watcher.d.ts +1 -1
  38. package/dist/watcher.d.ts.map +1 -1
  39. package/dist/watcher.js +137 -8
  40. package/dist/watcher.js.map +1 -1
  41. package/package.json +9 -8
  42. package/dist/abxjs.d.ts +0 -13
  43. package/dist/abxjs.d.ts.map +0 -1
  44. package/dist/abxjs.js +0 -49
  45. package/dist/abxjs.js.map +0 -1
  46. package/dist/art.d.ts.map +0 -1
  47. package/dist/art.js.map +0 -1
  48. package/dist/inline.d.ts +0 -19
  49. package/dist/inline.d.ts.map +0 -1
  50. package/dist/inline.js +0 -23
  51. package/dist/inline.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,155 @@
1
+ # @artblocks/abx-token-api
2
+
3
+ ## 0.1.0-alpha.50
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [56973c4]
8
+ - @artblocks/abx-sdk@0.1.0-alpha.47
9
+ - @artblocks/abx-indexer@0.1.0-alpha.48
10
+ - @artblocks/abx-storage@0.1.0-alpha.47
11
+
12
+ ## 0.1.0-alpha.49
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [ddb2e0b]
17
+ - Updated dependencies [76cfc6a]
18
+ - @artblocks/abx-sdk@0.1.0-alpha.46
19
+ - @artblocks/abx-indexer@0.1.0-alpha.47
20
+ - @artblocks/abx-storage@0.1.0-alpha.46
21
+
22
+ ## 0.1.0-alpha.48
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [d925eb1]
27
+ - @artblocks/abx-sdk@0.1.0-alpha.45
28
+ - @artblocks/abx-indexer@0.1.0-alpha.46
29
+ - @artblocks/abx-storage@0.1.0-alpha.45
30
+
31
+ ## 0.1.0-alpha.47
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [22abce8]
36
+ - @artblocks/abx-sdk@0.1.0-alpha.44
37
+ - @artblocks/abx-indexer@0.1.0-alpha.45
38
+ - @artblocks/abx-storage@0.1.0-alpha.44
39
+
40
+ ## 0.1.0-alpha.46
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [2290b0a]
45
+ - @artblocks/abx-sdk@0.1.0-alpha.43
46
+ - @artblocks/abx-indexer@0.1.0-alpha.44
47
+ - @artblocks/abx-storage@0.1.0-alpha.43
48
+
49
+ ## 0.1.0-alpha.45
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies [ea57f7a]
54
+ - @artblocks/abx-sdk@0.1.0-alpha.42
55
+ - @artblocks/abx-indexer@0.1.0-alpha.43
56
+ - @artblocks/abx-storage@0.1.0-alpha.42
57
+
58
+ ## 0.1.0-alpha.44
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [8ccbede]
63
+ - @artblocks/abx-sdk@0.1.0-alpha.41
64
+ - @artblocks/abx-indexer@0.1.0-alpha.42
65
+ - @artblocks/abx-storage@0.1.0-alpha.41
66
+
67
+ ## 0.1.0-alpha.43
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [b9197bc]
72
+ - @artblocks/abx-sdk@0.1.0-alpha.40
73
+ - @artblocks/abx-indexer@0.1.0-alpha.41
74
+ - @artblocks/abx-storage@0.1.0-alpha.40
75
+
76
+ ## 0.1.0-alpha.42
77
+
78
+ ### Patch Changes
79
+
80
+ - Updated dependencies [3d7fe3c]
81
+ - Updated dependencies [7b462e2]
82
+ - @artblocks/abx-sdk@0.1.0-alpha.39
83
+ - @artblocks/abx-indexer@0.1.0-alpha.40
84
+ - @artblocks/abx-storage@0.1.0-alpha.39
85
+
86
+ ## 0.1.0-alpha.41
87
+
88
+ ### Patch Changes
89
+
90
+ - Updated dependencies [c2400a7]
91
+ - @artblocks/abx-sdk@0.1.0-alpha.38
92
+ - @artblocks/abx-indexer@0.1.0-alpha.39
93
+ - @artblocks/abx-storage@0.1.0-alpha.38
94
+
95
+ ## 0.1.0-alpha.40
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies [4512962]
100
+ - @artblocks/abx-sdk@0.1.0-alpha.37
101
+ - @artblocks/abx-indexer@0.1.0-alpha.38
102
+ - @artblocks/abx-storage@0.1.0-alpha.37
103
+
104
+ ## 0.1.0-alpha.39
105
+
106
+ ### Patch Changes
107
+
108
+ - Updated dependencies [5522192]
109
+ - @artblocks/abx-sdk@0.1.0-alpha.36
110
+ - @artblocks/abx-indexer@0.1.0-alpha.37
111
+ - @artblocks/abx-storage@0.1.0-alpha.36
112
+
113
+ ## 0.1.0-alpha.38
114
+
115
+ ### Minor Changes
116
+
117
+ - 21e3d6c: Drop-in for existing v2 integrations; new deployments use the v3 production-candidate contracts.
118
+ Record the synchronized v3 factory generation and testnet deployments, retain full v2 service
119
+ compatibility (including already-assigned v2 sale minters), and update the renderer scaffold to
120
+ `abx-contracts` 3.0.0.
121
+
122
+ ### Patch Changes
123
+
124
+ - Updated dependencies [21e3d6c]
125
+ - Updated dependencies [a73922c]
126
+ - @artblocks/abx-sdk@0.1.0-alpha.35
127
+ - @artblocks/abx-indexer@0.1.0-alpha.36
128
+ - @artblocks/abx-storage@0.1.0-alpha.35
129
+
130
+ ## 0.1.0-alpha.37
131
+
132
+ ### Minor Changes
133
+
134
+ - 9065128: Drop-in for existing clients; service consumers can now inspect verified contract-generation facts.
135
+ Advertise understood generations and include a project generation in summaries and status responses
136
+ only when factory provenance and the on-chain core version agree.
137
+
138
+ ### Patch Changes
139
+
140
+ - Updated dependencies [3ddba71]
141
+ - Updated dependencies [9065128]
142
+ - @artblocks/abx-sdk@0.1.0-alpha.34
143
+ - @artblocks/abx-storage@0.1.0-alpha.34
144
+ - @artblocks/abx-indexer@0.1.0-alpha.35
145
+
146
+ ## 0.1.0-alpha.36
147
+
148
+ ### Patch Changes
149
+
150
+ - 9242a05: Prepare package metadata, release notes, and public-facing source comments for the initial public
151
+ source release.
152
+ - Updated dependencies [9242a05]
153
+ - @artblocks/abx-indexer@0.1.0-alpha.34
154
+ - @artblocks/abx-sdk@0.1.0-alpha.33
155
+ - @artblocks/abx-storage@0.1.0-alpha.33
package/dist/code.d.ts CHANGED
@@ -18,12 +18,42 @@ export declare function liveViewUrl(baseUrl: string, chainId: number, address: s
18
18
  /** Whether the derived live view should fill `animation_url` (code present, not suppressed). */
19
19
  export declare function liveViewEnabled(state: ProjectState): boolean;
20
20
  export { isCodeProject };
21
+ /**
22
+ * Whether the live view can be served — and, when it can't, WHICH KIND of "can't" it is.
23
+ *
24
+ * The `/a/` route used to collapse every negative into one confident verdict about the *contract*
25
+ * ("not a code project"), when at least one of them is a statement about the *index*. `chunkCount`
26
+ * is a head read, so a template-mode project whose chunks have not been folded in yet reads as
27
+ * zero — not-yet-a-code-project to the check, and forever-not-a-code-project to the reader. A
28
+ * tester lost a day to that wording: they got `live · caught up · 127 events · 32 tokens` from the
29
+ * node and this 404 from `/a/`, concluded the resolver did not recognise the SeriesCode factory,
30
+ * and a `--full` re-index did not clear it.
31
+ *
32
+ * `contractType` is folded from the deployed extensions, so it knows this is a code project before
33
+ * any code lands — which is exactly the distinction the route needs.
34
+ *
35
+ * - `ready` — there is executable content; go serve it.
36
+ * - `indexing` — this IS a code contract, but its code hasn't been folded in yet. Retry-able.
37
+ * - `not-a-code-project` — no executable content and nothing says there should be. Terminal.
38
+ *
39
+ * Pure, and deliberately so: this is a projection-only decision that needs no RPC (a contract with
40
+ * no executable content does not acquire some when a chain client appears), which is why the route
41
+ * answers it before touching one.
42
+ */
43
+ export type LiveViewAvailability = 'ready' | 'indexing' | 'not-a-code-project';
44
+ export declare function liveViewAvailability(state: ProjectState): LiveViewAvailability;
21
45
  /**
22
46
  * A render-artifact locator (`ipfs://<cid>`, `ar://<txid>`, or an absolute `https://…`) → a fetchable
23
- * URL, applying the IPFS/Arweave gateway at SERVE time (overridable via env). Mirrors `codeLocatorUrl`'s
24
- * gateway handling; an already-absolute URL is returned verbatim (never re-prefixed).
47
+ * URL, applying the gateway at SERVE time. Same source of truth as `codeLocatorUrl` and the metadata
48
+ * planes: the collection's `abx_gateway_*` preference first, this host's env as the floor. An
49
+ * already-absolute URL is returned verbatim (never re-prefixed).
50
+ *
51
+ * `state` is required rather than optional because these locators are the SAME project's content
52
+ * reached by a different route (an effect artifact, a computed `text/uri-list`), and a redirect that
53
+ * ignored the project's stated gateway while `image` honoured it would be a difference nobody could
54
+ * explain from the chain.
25
55
  */
26
- export declare function resolveLocatorUrl(locator: string): string;
56
+ export declare function resolveLocatorUrl(state: ProjectState, locator: string): string;
27
57
  /**
28
58
  * The token's CURRENT settled inputsHash — the effect-run identity every artifact address is
29
59
  * keyed by. SETTLED tokenData (augment: false) — must mirror the producer's addressing
@@ -61,13 +91,4 @@ export type LiveView = {
61
91
  export declare function resolveLiveView(client: PublicClient, state: ProjectState, token: TokenState, fetchFn?: typeof fetch): Promise<LiveView>;
62
92
  /** Reset the in-process entry-document cache — for tests. */
63
93
  export declare function resetEntryDocumentCache(): void;
64
- /**
65
- * Inject `window.abxTokenData` (and, when the document doesn't already carry one, a
66
- * `<base href="{code root}/">` so relative asset paths keep riding the gateway) at the
67
- * very top of `<head>` — before any build script can execute; abx.js resolves the global
68
- * first. String-level and deliberately robust rather than a full HTML parse: no `<head>`
69
- * → inject right after `<html …>`; neither → prepend. First `<base>` wins in HTML, so an
70
- * existing one is never doubled.
71
- */
72
- export declare function injectTokenDataIntoHtml(html: string, tokenDataJson: string, codeRoot: string): string;
73
94
  //# sourceMappingURL=code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.ts"],"names":[],"mappings":"AACA,OAAO,EAML,aAAa,EAEb,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAK3D;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtG;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAE5D;AAED,OAAO,EAAC,aAAa,EAAC,CAAC;AAEvB;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM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CAAC,CAIhD;AAED,MAAM,MAAM,QAAQ,GAAG;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAAC;AAElG;;;;;wDAKwD;AACxD,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAmCnB;AAYD,6DAA6D;AAC7D,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
package/dist/code.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import { hexToString } from 'viem';
2
- import { buildTokenData, codeField, contentDigestOf, contractParamString, inputsHash, isCodeProject, renderArtifactKey, } from '@artblocks/abx-sdk';
2
+ import { buildGeneratorDocument, buildTokenData, codeField, contentDigestOf, contractParamString, gatewayConfigFromEnv, projectGatewayPrefix, projectGatewayUrl, injectTokenDataIntoHtml, inputsHash, isCodeProject, renderArtifactKey, } from '@artblocks/abx-sdk';
3
3
  import { seriesCodeAbi } from '@artblocks/abx-sdk';
4
- import { ABX_JS } from './abxjs.js';
5
4
  import { checkUrlBudget, dependencyScriptTags, recordDirectoryServe } from './deps.js';
6
- import { escapeInlineJson, escapeInlineScript } from './inline.js';
7
5
  /**
8
6
  * The live view + the render-effect consumption seam.
9
7
  *
@@ -26,21 +24,60 @@ export function liveViewEnabled(state) {
26
24
  return isCodeProject(state) && contractParamString(state, 'display.animation') !== 'none';
27
25
  }
28
26
  export { isCodeProject };
27
+ /** The contract types that COMPOSE OnChainScript, and so could carry executable content.
28
+ * `edition-code` is the ERC-1155 twin of `code` and was missing here — see below. */
29
+ const CODE_CONTRACT_TYPES = new Set(['code', 'edition-code']);
30
+ export function liveViewAvailability(state) {
31
+ if (isCodeProject(state))
32
+ return 'ready';
33
+ if (!CODE_CONTRACT_TYPES.has(state.contractType ?? ''))
34
+ return 'not-a-code-project';
35
+ // A code CONTRACT with no executable content is one of two very different things, and the
36
+ // difference is exactly what this function exists to draw:
37
+ //
38
+ // - its chunks have not been folded in yet → retry (`indexing`)
39
+ // - it is a RENDERER-ONLY project and never will → terminal (`not-a-code-project`)
40
+ //
41
+ // `chunkCount` is a HEAD read, so it separates them: a number is what the chain says right now,
42
+ // and `0` means there is no script to wait for. `null` means nobody has asked the chain yet
43
+ // (projection-only reconstruction, or the read failed), which is genuinely unknown — and the
44
+ // honest answer to unknown is the retryable one.
45
+ //
46
+ // Both halves were wrong before. A renderer-only `SeriesCode` (`--image-renderer --onchain-uri`
47
+ // with no `--script`) answered `indexing` forever, so the live-view route served 503 +
48
+ // `Retry-After` for content that does not exist and never would. And `edition-code` was simply
49
+ // absent from the type check, so an EditionCode mid-index answered the TERMINAL 404 — the exact
50
+ // inverse failure this function's own docstring says cost a tester a day, just on the 1155 lane.
51
+ const chunkCount = state.script?.chunkCount ?? null;
52
+ if (chunkCount === 0)
53
+ return 'not-a-code-project';
54
+ return 'indexing';
55
+ }
29
56
  /**
30
57
  * A render-artifact locator (`ipfs://<cid>`, `ar://<txid>`, or an absolute `https://…`) → a fetchable
31
- * URL, applying the IPFS/Arweave gateway at SERVE time (overridable via env). Mirrors `codeLocatorUrl`'s
32
- * gateway handling; an already-absolute URL is returned verbatim (never re-prefixed).
58
+ * URL, applying the gateway at SERVE time. Same source of truth as `codeLocatorUrl` and the metadata
59
+ * planes: the collection's `abx_gateway_*` preference first, this host's env as the floor. An
60
+ * already-absolute URL is returned verbatim (never re-prefixed).
61
+ *
62
+ * `state` is required rather than optional because these locators are the SAME project's content
63
+ * reached by a different route (an effect artifact, a computed `text/uri-list`), and a redirect that
64
+ * ignored the project's stated gateway while `image` honoured it would be a difference nobody could
65
+ * explain from the chain.
33
66
  */
34
- export function resolveLocatorUrl(locator) {
67
+ export function resolveLocatorUrl(state, locator) {
35
68
  if (/^https?:\/\//i.test(locator))
36
69
  return locator;
37
- if (locator.startsWith('ipfs://')) {
38
- const gw = process.env.ABX_IPFS_GATEWAY ?? 'https://ipfs.io';
39
- return `${gw.replace(/\/$/, '')}/ipfs/${locator.slice('ipfs://'.length)}`;
40
- }
41
- if (locator.startsWith('ar://')) {
42
- const gw = process.env.ABX_ARWEAVE_GATEWAY ?? 'https://arweave.net';
43
- return `${gw.replace(/\/$/, '')}/${locator.slice('ar://'.length)}`;
70
+ // Explicit compose (the on-chain preference + the SDK's env helper) rather than a single call, so
71
+ // the env read (`ABX_IPFS_GATEWAY`/`ABX_ARWEAVE_GATEWAY`) is visibly host-side here, at the
72
+ // one place this resolver actually reads it.
73
+ const gateways = gatewayConfigFromEnv();
74
+ for (const network of ['ipfs', 'arweave']) {
75
+ const scheme = network === 'ipfs' ? 'ipfs://' : 'ar://';
76
+ if (locator.startsWith(scheme)) {
77
+ const wrapped = projectGatewayUrl(network, locator, projectGatewayPrefix(state, network, gateways));
78
+ if (wrapped !== null)
79
+ return wrapped;
80
+ }
44
81
  }
45
82
  return locator;
46
83
  }
@@ -75,7 +112,7 @@ export async function resolveLiveView(client, state, token, fetchFn = fetch) {
75
112
  const { json } = await buildTokenData(client, state, token, { augment: process.env.ABX_DISABLE_AUGMENT !== '1' });
76
113
  const code = codeField(state);
77
114
  if (code) {
78
- const base = codeLocatorUrl(code.representation, code.value);
115
+ const base = codeLocatorUrl(state, code.representation, code.value);
79
116
  if (!base)
80
117
  return null;
81
118
  const entry = base.endsWith('.html') ? base : `${base.replace(/\/$/, '')}/index.html`;
@@ -136,31 +173,17 @@ async function fetchEntryDocument(representation, url, fetchFn) {
136
173
  entryDocCache.set(url, { html, expiresAt: Date.now() + ttl });
137
174
  return html;
138
175
  }
176
+ // `injectTokenDataIntoHtml` lives in `@artblocks/abx-sdk` (src/generator-document.ts).
139
177
  /**
140
- * Inject `window.abxTokenData` (and, when the document doesn't already carry one, a
141
- * `<base href="{code root}/">` so relative asset paths keep riding the gateway) at the
142
- * very top of `<head>` — before any build script can execute; abx.js resolves the global
143
- * first. String-level and deliberately robust rather than a full HTML parse: no `<head>`
144
- * → inject right after `<html …>`; neither → prepend. First `<base>` wins in HTML, so an
145
- * existing one is never doubled.
178
+ * A `code` field locator → a fetchable https URL.
179
+ *
180
+ * The twin of `AbxGenerator._directoryUrl`'s gateway handling, and it reads the SAME source the
181
+ * generator does: the collection's reserved `abx_gateway_ipfs` / `abx_gateway_arweave` field, with
182
+ * this host's env as the floor beneath it. That is the whole point of `state` being a parameter
183
+ * here — the two lanes serve the same project, so they must agree on the code root's URL, and this
184
+ * used to consult env alone while the generator consulted a contract param.
146
185
  */
147
- export function injectTokenDataIntoHtml(html, tokenDataJson, codeRoot) {
148
- const baseTag = /<base[\s/>]/i.test(html) ? '' : `<base href="${codeRoot}">`;
149
- const injection = `${baseTag}<script>window.abxTokenData=${escapeInlineJson(tokenDataJson)};</script>`;
150
- const head = /<head(\s[^>]*)?>/i.exec(html);
151
- if (head) {
152
- const at = head.index + head[0].length;
153
- return html.slice(0, at) + injection + html.slice(at);
154
- }
155
- const htmlTag = /<html(\s[^>]*)?>/i.exec(html);
156
- if (htmlTag) {
157
- const at = htmlTag.index + htmlTag[0].length;
158
- return html.slice(0, at) + injection + html.slice(at);
159
- }
160
- return injection + html;
161
- }
162
- /** A `code` field locator → a fetchable https URL (gateways overridable via env). */
163
- function codeLocatorUrl(representation, value) {
186
+ function codeLocatorUrl(state, representation, value) {
164
187
  const text = hexToString(value);
165
188
  // A stored locator can already be an absolute URL (e.g. a gateway URL saved verbatim by an older
166
189
  // deploy) — serve it directly rather than prefixing a gateway again (which double-prefixes to a
@@ -169,13 +192,11 @@ function codeLocatorUrl(representation, value) {
169
192
  return text;
170
193
  if (representation === 'url')
171
194
  return text;
172
- if (representation === 'ipfs') {
173
- const gw = process.env.ABX_IPFS_GATEWAY ?? 'https://ipfs.io';
174
- return `${gw.replace(/\/$/, '')}/ipfs/${text.replace(/^ipfs:\/\//, '')}`;
175
- }
176
- if (representation === 'arweave') {
177
- const gw = process.env.ABX_ARWEAVE_GATEWAY ?? 'https://arweave.net';
178
- return `${gw.replace(/\/$/, '')}/${text.replace(/^ar:\/\//, '')}`;
195
+ if (representation === 'ipfs' || representation === 'arweave') {
196
+ // Explicit compose (the on-chain preference + this host's env floor) — the env read stays
197
+ // visibly host-side here, at the one place this resolver actually reaches for it.
198
+ const prefix = projectGatewayPrefix(state, representation, gatewayConfigFromEnv());
199
+ return projectGatewayUrl(representation, text, prefix);
179
200
  }
180
201
  return null; // `code` is locators-only by the registry; anything else is unserveable
181
202
  }
@@ -197,20 +218,11 @@ async function assembleGeneratorDocument(client, state, tokenDataJson) {
197
218
  const script = reads
198
219
  .map((r) => (r.status === 'success' ? hexToString(r.result) : ''))
199
220
  .join('\n');
200
- // Dependencies resolve per the registry order (specs/protocol/dependency-registry.md
221
+ // Dependencies resolve per the registry order (site/content/docs/protocol/code-projects.mdx
201
222
  // "Consumers"): the collection's registry pointer (on-chain bytes → preferredCDN) → the
202
223
  // built-in CDN map. Resolution never throws — the document always assembles.
203
224
  const depTags = await dependencyScriptTags(client, state);
204
- return [
205
- '<!doctype html>',
206
- '<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">',
207
- '<style>html,body{margin:0;padding:0;overflow:hidden}canvas{display:block}</style>',
208
- `<script>window.abxTokenData=${escapeInlineJson(tokenDataJson)};</script>`,
209
- `<script>${ABX_JS}</script>`,
210
- ...depTags,
211
- '</head><body>',
212
- `<script>\n${escapeInlineScript(script)}\n</script>`,
213
- '</body></html>',
214
- ].join('\n');
225
+ return buildGeneratorDocument(script, tokenDataJson, depTags);
215
226
  }
227
+ // `buildGeneratorDocument` lives in `@artblocks/abx-sdk` (src/generator-document.ts).
216
228
  //# sourceMappingURL=code.js.map
package/dist/code.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"code.js","sourceRoot":"","sources":["../src/code.ts"],"names":[],"mappings":"AA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I,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,wEAAwE;AACvF,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,yBAAyB,CACtC,MAAoB,EACpB,KAAmB,EACnB,aAAqB;IAErB,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,UAAU,IAAI,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC;QACpC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,CAAC,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5C,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,GAAG,EAAE,aAAa;YAClB,YAAY,EAAE,aAAa;YAC3B,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SAClB,CAAC,CAAU;QACZ,YAAY,EAAE,IAAI;KACnB,CAAC,CAAsF,CAAC;IACzF,MAAM,MAAM,GAAG,KAAK;SACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACxE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,4FAA4F;IAC5F,wFAAwF;IACxF,6EAA6E;IAC7E,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE1D,OAAO,sBAAsB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED,sFAAsF"}
@@ -11,16 +11,16 @@ import { type Hex } from 'viem';
11
11
  */
12
12
  export declare const IMAGE_MEDIA_TYPE = "image/svg+xml";
13
13
  /** Deterministic generative SVG for a contract address. Pure: address → bytes. */
14
- export declare function generateArt(address: string): string;
15
- /** keccak256 of the generated art's UTF-8 bytes — the value committed on-chain (image `keccak256` field). */
16
- export declare function artContentHash(address: string): Hex;
14
+ export declare function generateContent(address: string): string;
15
+ /** keccak256 of the generated content's UTF-8 bytes — the value committed on-chain (image `keccak256` field). */
16
+ export declare function contentHash(address: string): Hex;
17
17
  /**
18
18
  * The required-field *fallback* image — a simple, deterministic placeholder used when a
19
19
  * token has no resolvable `image` (unset, or a representation the surface can't load).
20
20
  * Deliberately trivial so it is **byte-identical** to the on-chain renderer's
21
21
  * `_fallbackImage` (`AbxMetadataRenderer`): background = the address's first 3 bytes,
22
- * label = `#tokenId`. Distinct from {generateArt} (the demo's *chosen* content) — this is
22
+ * label = `#tokenId`. Distinct from {generateContent} (the demo's *chosen* content) — this is
23
23
  * the "nothing was set" placeholder both the on-chain and off-chain resolvers agree on.
24
24
  */
25
25
  export declare function fallbackImageSvg(address: string, tokenId: string | number | bigint): string;
26
- //# sourceMappingURL=art.d.ts.map
26
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,GAAG,EAAC,MAAM,MAAM,CAAC;AAExD;;;;;;;;;GASG;AAEH,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAahD,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA6CvD;AAED,iHAAiH;AACjH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAEhD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAQ3F"}
@@ -21,7 +21,7 @@ function mulberry32(seed) {
21
21
  };
22
22
  }
23
23
  /** Deterministic generative SVG for a contract address. Pure: address → bytes. */
24
- export function generateArt(address) {
24
+ export function generateContent(address) {
25
25
  const clean = address.toLowerCase().replace(/^0x/, '').padEnd(40, '0');
26
26
  const seed = parseInt(clean.slice(0, 8), 16) ^ parseInt(clean.slice(8, 16), 16);
27
27
  const rnd = mulberry32(seed);
@@ -63,16 +63,16 @@ export function generateArt(address) {
63
63
  `</svg>`,
64
64
  ].join('');
65
65
  }
66
- /** keccak256 of the generated art's UTF-8 bytes — the value committed on-chain (image `keccak256` field). */
67
- export function artContentHash(address) {
68
- return keccak256(stringToBytes(generateArt(address)));
66
+ /** keccak256 of the generated content's UTF-8 bytes — the value committed on-chain (image `keccak256` field). */
67
+ export function contentHash(address) {
68
+ return keccak256(stringToBytes(generateContent(address)));
69
69
  }
70
70
  /**
71
71
  * The required-field *fallback* image — a simple, deterministic placeholder used when a
72
72
  * token has no resolvable `image` (unset, or a representation the surface can't load).
73
73
  * Deliberately trivial so it is **byte-identical** to the on-chain renderer's
74
74
  * `_fallbackImage` (`AbxMetadataRenderer`): background = the address's first 3 bytes,
75
- * label = `#tokenId`. Distinct from {generateArt} (the demo's *chosen* content) — this is
75
+ * label = `#tokenId`. Distinct from {generateContent} (the demo's *chosen* content) — this is
76
76
  * the "nothing was set" placeholder both the on-chain and off-chain resolvers agree on.
77
77
  */
78
78
  export function fallbackImageSvg(address, tokenId) {
@@ -82,4 +82,4 @@ export function fallbackImageSvg(address, tokenId) {
82
82
  `<text x="250" y="264" font-family="monospace" font-size="42" fill="#ffffff" text-anchor="middle">#${tokenId}</text>` +
83
83
  `</svg>`);
84
84
  }
85
- //# sourceMappingURL=art.js.map
85
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,aAAa,EAAW,MAAM,MAAM,CAAC;AAExD;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD,SAAS,UA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,CAAC;IACH,CAAC;IAED,OAAO;QACL,kDAAkD,IAAI,aAAa,IAAI,kBAAkB,IAAI,IAAI,IAAI,IAAI;QACzG,gBAAgB,IAAI,aAAa,IAAI,WAAW,EAAE,KAAK;QACvD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACf,QAAQ;KACT,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,SAAS,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,OAAiC;IACjF,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnE,OAAO,CACL,yFAAyF;QACzF,yCAAyC,KAAK,KAAK;QACnD,qGAAqG,OAAO,SAAS;QACrH,QAAQ,CACT,CAAC;AACJ,CAAC"}
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * The /v1 control plane + the service descriptor — the resolver's ONE write surface, speaking the
3
- * provider-neutral interface pinned by specs/self-host-toolkit/remote-services.md. Everything here
4
- * is index/metadata control (register, list, deregister, reindex, status, effect publishes): the
3
+ * provider-neutral interface pinned by site/content/docs/using-abx/remote-services.mdx. Everything here
4
+ * is index/metadata control (register, list, deregister, reindex, status, artifact registration): the
5
5
  * bearer token never signs anything on-chain, so the "no signing key on the host" rule is intact.
6
6
  *
7
7
  * This module never imports server.ts (one-way dependency), which is why the shared HTTP helpers
8
8
  * (sendJson, the bearer guard) live here and the read plane imports them.
9
9
  */
10
10
  import type { IncomingMessage, ServerResponse } from 'node:http';
11
- import { type ProjectState, type ServiceDescriptor } from '@artblocks/abx-sdk';
11
+ import { type ProjectState, type ServiceDescriptor, type ServiceErrorCode } from '@artblocks/abx-sdk';
12
12
  import type { SelfHostIndexer } from '@artblocks/abx-indexer';
13
13
  import type { StorageBackend } from '@artblocks/abx-storage';
14
14
  export interface ControlPlaneContext {
@@ -22,6 +22,9 @@ export interface ControlPlaneContext {
22
22
  baseUrl: string;
23
23
  }
24
24
  export declare function sendJson(res: ServerResponse, status: number, body: unknown): void;
25
+ /** Every non-2xx control-plane response: `{error: <human>, code: <machine>}` — clients key off
26
+ * `code`, never off prose (site/content/docs/using-abx/remote-services.mdx → Errors). */
27
+ export declare function sendError(res: ServerResponse, status: number, code: ServiceErrorCode, message: string, extra?: Record<string, unknown>): void;
25
28
  /**
26
29
  * The ONE bearer guard for every gated route: 404 code `disabled` when no token is configured on
27
30
  * the host (the write surface honestly doesn't exist — the descriptor omits the control-plane
@@ -30,19 +33,24 @@ export declare function sendJson(res: ServerResponse, status: number, body: unkn
30
33
  * spec-defined for multi-tenant providers; this single-token reference never emits it.
31
34
  */
32
35
  export declare function requireBearer(req: IncomingMessage, res: ServerResponse): boolean;
36
+ /** Explicit adapter/support claim for this service build. Append only after its tests pass. */
37
+ export declare const SUPPORTED_CONTRACT_GENERATION_IDS: readonly ["abx-core-v3", "abx-core-v2"];
33
38
  /** The one-line project summary shared by `GET /api/projects` and the register/reindex responses. */
34
39
  export declare function summarize(s: ProjectState): {
40
+ reconstructedAt: string;
41
+ copies?: string | undefined;
42
+ mintedCount: number;
43
+ burnedCount?: number;
44
+ extensions: string[];
45
+ eventCount: number;
46
+ tokenCount: number;
47
+ contractGeneration?: import("@artblocks/abx-sdk").ContractGenerationSummary | undefined;
35
48
  address: `0x${string}`;
36
49
  name: string | null;
37
50
  symbol: string | null;
38
51
  owner: `0x${string}` | null;
39
52
  abxVersion: number | null;
40
53
  isCanonical: boolean | null;
41
- extensions: string[];
42
- eventCount: number;
43
- tokenCount: number;
44
- mintedCount: number;
45
- reconstructedAt: string;
46
54
  };
47
55
  /** Parse a stored content-locators JSON column → `{hash: locator}` (lowercased keys, never throws). */
48
56
  export declare function safeLocators(json: string): Record<string, string> | undefined;
@@ -62,11 +70,14 @@ export declare function planRegistrationFloor(bodyFromBlock: string | undefined,
62
70
  } | null;
63
71
  /**
64
72
  * `GET /.well-known/abx-service` — what this node supports, agent-readably (public, no auth).
65
- * The control-plane + effects-publish interfaces (and `auth`) appear iff the bearer token is
66
- * configured: a token-less self-host node honestly advertises no remote control surface — which
67
- * is how a client tells "disabled" from "wrong URL". `render` appears when a runner rides behind
68
- * this resolver (ABX_EFFECTS_URL); its declared effects come from a best-effort `/health` probe.
69
- * Provider identity (name, signup/docs URLs) is deployment env — no provider ships in this code.
73
+ * The control-plane interface (and `auth`) appears iff the bearer token is configured: a token-less
74
+ * self-host node honestly advertises no remote control surface — which is how a client tells
75
+ * "disabled" from "wrong URL". The artifact-registry routes ride `abx-control-plane/v1` rather than
76
+ * an id of their own: once referenced output is locator-only, accepting a registration is a database
77
+ * insert, so there is no infrastructure a node could lack that would justify a separate capability
78
+ * flag. `render` appears when a runner rides behind this resolver (ABX_EFFECTS_URL); its declared
79
+ * effects come from a best-effort `/health` probe. Provider identity (name, signup/docs URLs) is
80
+ * deployment env — no provider ships in this code.
70
81
  */
71
82
  export declare function serviceDescriptor(ctx: ControlPlaneContext): Promise<ServiceDescriptor>;
72
83
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../src/control-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAC/D,OAAO,EAWL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAG3D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,eAAe,C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