@artblocks/abx-sdk 0.1.0-alpha.4 → 0.1.0-alpha.41

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 (159) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +130 -0
  3. package/dist/abi/generated.d.ts +8502 -129
  4. package/dist/abi/generated.d.ts.map +1 -1
  5. package/dist/abi/generated.js +40 -22
  6. package/dist/abi/generated.js.map +1 -1
  7. package/dist/abi/index.d.ts +2645 -168
  8. package/dist/abi/index.d.ts.map +1 -1
  9. package/dist/abi/index.js +34 -7
  10. package/dist/abi/index.js.map +1 -1
  11. package/dist/anchors.d.ts +325 -0
  12. package/dist/anchors.d.ts.map +1 -0
  13. package/dist/anchors.js +740 -0
  14. package/dist/anchors.js.map +1 -0
  15. package/dist/chain-support.d.ts +28 -0
  16. package/dist/chain-support.d.ts.map +1 -0
  17. package/dist/chain-support.js +65 -0
  18. package/dist/chain-support.js.map +1 -0
  19. package/dist/chain-support.json +60 -0
  20. package/dist/chains.d.ts +24 -10
  21. package/dist/chains.d.ts.map +1 -1
  22. package/dist/chains.js +51 -17
  23. package/dist/chains.js.map +1 -1
  24. package/dist/chunks.d.ts +162 -31
  25. package/dist/chunks.d.ts.map +1 -1
  26. package/dist/chunks.js +179 -14
  27. package/dist/chunks.js.map +1 -1
  28. package/dist/clients.d.ts +23 -11
  29. package/dist/clients.d.ts.map +1 -1
  30. package/dist/clients.js +17 -18
  31. package/dist/clients.js.map +1 -1
  32. package/dist/contract-generations.d.ts +58 -0
  33. package/dist/contract-generations.d.ts.map +1 -0
  34. package/dist/contract-generations.js +109 -0
  35. package/dist/contract-generations.js.map +1 -0
  36. package/dist/contract-generations.json +48 -0
  37. package/dist/create2.d.ts +84 -1
  38. package/dist/create2.d.ts.map +1 -1
  39. package/dist/create2.js +158 -2
  40. package/dist/create2.js.map +1 -1
  41. package/dist/creator-token.d.ts +132 -0
  42. package/dist/creator-token.d.ts.map +1 -0
  43. package/dist/creator-token.js +183 -0
  44. package/dist/creator-token.js.map +1 -0
  45. package/dist/deploy.d.ts +234 -14
  46. package/dist/deploy.d.ts.map +1 -1
  47. package/dist/deploy.js +289 -111
  48. package/dist/deploy.js.map +1 -1
  49. package/dist/deployments.d.ts +38 -5
  50. package/dist/deployments.d.ts.map +1 -1
  51. package/dist/deployments.js +157 -30
  52. package/dist/deployments.js.map +1 -1
  53. package/dist/deps.d.ts +123 -6
  54. package/dist/deps.d.ts.map +1 -1
  55. package/dist/deps.js +249 -7
  56. package/dist/deps.js.map +1 -1
  57. package/dist/env.d.ts +5 -4
  58. package/dist/env.d.ts.map +1 -1
  59. package/dist/env.js +20 -5
  60. package/dist/env.js.map +1 -1
  61. package/dist/errors.d.ts +109 -0
  62. package/dist/errors.d.ts.map +1 -0
  63. package/dist/errors.js +148 -0
  64. package/dist/errors.js.map +1 -0
  65. package/dist/execute.d.ts +118 -0
  66. package/dist/execute.d.ts.map +1 -0
  67. package/dist/execute.js +159 -0
  68. package/dist/execute.js.map +1 -0
  69. package/dist/gateways.d.ts +79 -0
  70. package/dist/gateways.d.ts.map +1 -0
  71. package/dist/gateways.js +156 -0
  72. package/dist/gateways.js.map +1 -0
  73. package/dist/generator-document.d.ts +57 -0
  74. package/dist/generator-document.d.ts.map +1 -0
  75. package/dist/generator-document.js +123 -0
  76. package/dist/generator-document.js.map +1 -0
  77. package/dist/generator.d.ts +44 -2
  78. package/dist/generator.d.ts.map +1 -1
  79. package/dist/generator.js +29 -0
  80. package/dist/generator.js.map +1 -1
  81. package/dist/index.d.ts +19 -3
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +19 -3
  84. package/dist/index.js.map +1 -1
  85. package/dist/inspect.d.ts +48 -0
  86. package/dist/inspect.d.ts.map +1 -0
  87. package/dist/inspect.js +295 -0
  88. package/dist/inspect.js.map +1 -0
  89. package/dist/migrate.d.ts +41 -0
  90. package/dist/migrate.d.ts.map +1 -0
  91. package/dist/migrate.js +142 -0
  92. package/dist/migrate.js.map +1 -0
  93. package/dist/mime.d.ts +11 -0
  94. package/dist/mime.d.ts.map +1 -0
  95. package/dist/mime.js +40 -0
  96. package/dist/mime.js.map +1 -0
  97. package/dist/node.d.ts +69 -0
  98. package/dist/node.d.ts.map +1 -0
  99. package/dist/node.js +92 -0
  100. package/dist/node.js.map +1 -0
  101. package/dist/onchain-uri.d.ts +110 -0
  102. package/dist/onchain-uri.d.ts.map +1 -0
  103. package/dist/onchain-uri.js +276 -0
  104. package/dist/onchain-uri.js.map +1 -0
  105. package/dist/ops.d.ts +507 -14
  106. package/dist/ops.d.ts.map +1 -1
  107. package/dist/ops.js +850 -34
  108. package/dist/ops.js.map +1 -1
  109. package/dist/policy.d.ts +57 -0
  110. package/dist/policy.d.ts.map +1 -0
  111. package/dist/policy.js +35 -0
  112. package/dist/policy.js.map +1 -0
  113. package/dist/probe.d.ts +58 -0
  114. package/dist/probe.d.ts.map +1 -1
  115. package/dist/probe.js +190 -9
  116. package/dist/probe.js.map +1 -1
  117. package/dist/reconstruct.d.ts +141 -3
  118. package/dist/reconstruct.d.ts.map +1 -1
  119. package/dist/reconstruct.js +479 -100
  120. package/dist/reconstruct.js.map +1 -1
  121. package/dist/resume.d.ts +147 -0
  122. package/dist/resume.d.ts.map +1 -0
  123. package/dist/resume.js +146 -0
  124. package/dist/resume.js.map +1 -0
  125. package/dist/script-chunks.d.ts +105 -0
  126. package/dist/script-chunks.d.ts.map +1 -0
  127. package/dist/script-chunks.js +158 -0
  128. package/dist/script-chunks.js.map +1 -0
  129. package/dist/service.d.ts +155 -9
  130. package/dist/service.d.ts.map +1 -1
  131. package/dist/service.js +103 -11
  132. package/dist/service.js.map +1 -1
  133. package/dist/spine.d.ts +47 -4
  134. package/dist/spine.d.ts.map +1 -1
  135. package/dist/spine.js +0 -0
  136. package/dist/spine.js.map +1 -1
  137. package/dist/staging.d.ts +139 -0
  138. package/dist/staging.d.ts.map +1 -0
  139. package/dist/staging.js +139 -0
  140. package/dist/staging.js.map +1 -0
  141. package/dist/token.d.ts +11 -1
  142. package/dist/token.d.ts.map +1 -1
  143. package/dist/token.js +32 -1
  144. package/dist/token.js.map +1 -1
  145. package/dist/tokendata.d.ts +63 -3
  146. package/dist/tokendata.d.ts.map +1 -1
  147. package/dist/tokendata.js +81 -19
  148. package/dist/tokendata.js.map +1 -1
  149. package/dist/tokens.d.ts +119 -0
  150. package/dist/tokens.d.ts.map +1 -0
  151. package/dist/tokens.js +317 -0
  152. package/dist/tokens.js.map +1 -0
  153. package/dist/types.d.ts +107 -5
  154. package/dist/types.d.ts.map +1 -1
  155. package/dist/util.d.ts +74 -0
  156. package/dist/util.d.ts.map +1 -0
  157. package/dist/util.js +106 -0
  158. package/dist/util.js.map +1 -0
  159. package/package.json +15 -6
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Gateway resolution for content-addressed locators (`ipfs://…`, `ar://…`) is split into a pure
3
+ * resolver and a
4
+ * separate env-reading piece so a host with its own gateway config never has to touch
5
+ * `process.env` through this module at all, and so this stays reachable from a browser bundle
6
+ * (see `test/browser-bundle.test.ts` — no `process.env` read outside {@link gatewayConfigFromEnv},
7
+ * which itself goes through {@link readEnv} and degrades to "no override" rather than throwing
8
+ * where `process` doesn't exist).
9
+ */
10
+ import { readEnv } from './util.js';
11
+ import { GATEWAY_FIELD, GATEWAY_FLOOR, METADATA_REPRESENTATION as R } from './spine.js';
12
+ import { inlineText } from './token.js';
13
+ /**
14
+ * The gateway BASE for a locator network, given already-resolved `overrides` — PURE, no env
15
+ * read. Defaults to the generic public gateways (`ipfs.io` / `arweave.net`) when `overrides`
16
+ * doesn't name one; any other `network` (e.g. `http`, which carries its own base) resolves to
17
+ * `''`. Callers that want override → env → default precedence compose this with
18
+ * {@link gatewayConfigFromEnv} themselves (see `@artblocks/abx-storage`'s `resolveGatewayBase`
19
+ * for the reference compose) — kept separate so a host with its own config source never has this
20
+ * function reach into `process.env` on its behalf.
21
+ */
22
+ export function resolveGatewayBase(network, overrides) {
23
+ if (network === 'ipfs')
24
+ return overrides?.ipfs || 'https://ipfs.io';
25
+ if (network === 'arweave')
26
+ return overrides?.arweave || 'https://arweave.net';
27
+ return '';
28
+ }
29
+ /**
30
+ * The ONLY env-reading piece of this module: `ABX_IPFS_GATEWAY` / `ABX_ARWEAVE_GATEWAY`, read via
31
+ * {@link readEnv} (safe where `process` doesn't exist). Exported separately from
32
+ * {@link resolveGatewayBase} so a host with its own gateway configuration (a database row, a
33
+ * remote config service) never has to touch `process.env` through this package at all — it just
34
+ * never calls this function and passes its own overrides straight to the pure resolver instead.
35
+ */
36
+ export function gatewayConfigFromEnv() {
37
+ const ipfs = readEnv('ABX_IPFS_GATEWAY');
38
+ const arweave = readEnv('ABX_ARWEAVE_GATEWAY');
39
+ const out = {};
40
+ if (ipfs)
41
+ out.ipfs = ipfs;
42
+ if (arweave)
43
+ out.arweave = arweave;
44
+ return out;
45
+ }
46
+ /** Build the URL that asks `gateway` for `id`. A locator that is already an absolute URL is asked
47
+ * verbatim — rewriting someone's URL would answer a question they didn't ask. */
48
+ export function gatewayUrlFor(network, id, gateway) {
49
+ if (/^https?:\/\//i.test(id))
50
+ return id;
51
+ const base = gateway.replace(/\/+$/, '');
52
+ // A path suffix (a directory manifest entry, e.g. `<txid>/index.html`) rides along untouched.
53
+ return network === 'ipfs' ? `${base}/ipfs/${id}` : `${base}/${id}`;
54
+ }
55
+ const SCHEME = { ipfs: 'ipfs://', arweave: 'ar://' };
56
+ /**
57
+ * Normalize a gateway HOST (the `ABX_IPFS_GATEWAY` / `ABX_ARWEAVE_GATEWAY` shape, and what
58
+ * {@link resolveGatewayBase} returns) into the on-chain PREFIX shape — trailing path included, so
59
+ * projection is a raw concat. A value that already ends in the scheme's path segment is left
60
+ * alone, so an operator may configure either form.
61
+ */
62
+ export function gatewayPrefixFrom(network, base) {
63
+ const trimmed = base.replace(/\/+$/, '');
64
+ if (!trimmed)
65
+ return GATEWAY_FLOOR[network];
66
+ if (network === 'arweave')
67
+ return `${trimmed}/`;
68
+ return trimmed.endsWith('/ipfs') ? `${trimmed}/` : `${trimmed}/ipfs/`;
69
+ }
70
+ /**
71
+ * The gateway prefix this project prefers for a scheme: the collection's reserved
72
+ * `abx_gateway_*` field, else the host's env/override default, else the public floor.
73
+ *
74
+ * The env read is a FLOOR, never an override. When a project has stated a preference on chain,
75
+ * every conforming resolver must serve that one — otherwise the same token renders differently
76
+ * depending on who is serving it, which is the property `abx_provenance` exists to make checkable.
77
+ * When a project has stated nothing, a host with its own gateway is strictly better than
78
+ * `ipfs.io`, and a managed provider serving a token it does not own has no other way to say so.
79
+ */
80
+ export function projectGatewayPrefix(state, network, overrides) {
81
+ const onChain = state.collectionFields.find(
82
+ // Only `inline` counts. A prefix is a short UTF-8 string, and accepting exactly one
83
+ // representation keeps this rule identical on the renderer, the generator and here.
84
+ (f) => f.field === GATEWAY_FIELD[network] && f.representation === R.inline);
85
+ if (onChain) {
86
+ // No `.trim()`: the on-chain `_gatewayPrefix` returns the stored bytes verbatim (any non-empty
87
+ // `inline` value wins), so trimming here would make the two serving planes disagree on a
88
+ // whitespace-padded prefix — the same byte-parity class this projection exists to hold. The field
89
+ // store rejects an empty value, so a set field is always non-empty.
90
+ const stated = inlineText(onChain);
91
+ if (stated)
92
+ return stated;
93
+ }
94
+ const host = overrides?.[network];
95
+ return host ? gatewayPrefixFrom(network, host) : GATEWAY_FLOOR[network];
96
+ }
97
+ /**
98
+ * Project a content-addressed field value into its https URL, byte-identically to the deployed
99
+ * renderer. `null` when the value locates nothing (`ipfs://` with no CID) — the caller omits an
100
+ * optional field or falls back on a required one, rather than emitting a bare prefix that 404s.
101
+ *
102
+ * Order is load-bearing and mirrors the Solidity exactly: strip the scheme, THEN substitute
103
+ * `{id}`, THEN check for an absolute URL. That last check is what stops a value which already
104
+ * names its own host — precisely what a `backend.locator()` return looks like — from coming back
105
+ * as `https://arweave.net/https://arweave.net/<txid>`.
106
+ */
107
+ export function projectGatewayUrl(network, value, prefix, tokenId) {
108
+ let id = value;
109
+ const scheme = SCHEME[network];
110
+ if (id.startsWith(scheme))
111
+ id = id.slice(scheme.length);
112
+ if (!id)
113
+ return null;
114
+ // One collection-scope `ipfs` field addresses a whole pinned directory. Skipped on the
115
+ // collection surface, which has no tokenId — the same reason `url-template` is omitted there.
116
+ if (tokenId !== undefined)
117
+ id = id.split('{id}').join(tokenId);
118
+ if (/^https?:\/\//i.test(id))
119
+ return id;
120
+ return prefix + id;
121
+ }
122
+ /**
123
+ * The inverse of {@link gatewayUrlFor} / {@link projectGatewayUrl}: recover the bare content id
124
+ * (CID or txid, plus any path suffix) from whatever form a locator arrived in.
125
+ *
126
+ * This exists because a storage backend's `locator()` returns a **gateway HTTPS URL** — the form an
127
+ * operator can click — while an `ipfs` / `arweave` metadata field must hold IDENTITY, with the
128
+ * gateway supplied at read time. Baking the operator's gateway host into the field is exactly the
129
+ * weld this projection was built to remove: it makes a CID unmigratable and makes the chain report
130
+ * `source: url` for bytes that live on IPFS.
131
+ *
132
+ * `null` when no id can be recovered — notably a subdomain-style gateway
133
+ * (`https://<cid>.ipfs.dweb.link`), which ABX's own backends never produce. A caller that gets
134
+ * `null` should keep the URL as a plain `url` field and SAY so, rather than guess.
135
+ */
136
+ export function contentIdFromLocator(network, locator) {
137
+ const trimmed = locator.trim();
138
+ if (!trimmed)
139
+ return null;
140
+ const scheme = SCHEME[network];
141
+ if (trimmed.startsWith(scheme))
142
+ return trimmed.slice(scheme.length) || null;
143
+ if (!/^https?:\/\//i.test(trimmed))
144
+ return trimmed; // already bare
145
+ if (network === 'ipfs') {
146
+ const at = trimmed.lastIndexOf('/ipfs/');
147
+ return at === -1 ? null : trimmed.slice(at + '/ipfs/'.length) || null;
148
+ }
149
+ // Strip the origin by hand rather than via `new URL().pathname`, which percent-encodes: an Arweave
150
+ // directory template `https://arweave.net/TXDIR/{id}.png` came back as `TXDIR/%7Bid%7D.png`, and
151
+ // that value would have been COMMITTED ON CHAIN — where nothing substitutes `%7Bid%7D`, so every
152
+ // token in the collection would resolve to the same missing file.
153
+ const afterOrigin = trimmed.replace(/^https?:\/\/[^/]*\/?/i, '');
154
+ return afterOrigin || null;
155
+ }
156
+ //# sourceMappingURL=gateways.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateways.js","sourceRoot":"","sources":["../src/gateways.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,uBAAuB,IAAI,CAAC,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAetC;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoC,EAAE,SAA4B;IACnG,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,SAAS,EAAE,IAAI,IAAI,iBAAiB,CAAC;IACpE,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,EAAE,OAAO,IAAI,qBAAqB,CAAC;IAC9E,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAqB,EAAE,CAAC;IACjC,IAAI,IAAI;QAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,IAAI,OAAO;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IACnC,OAAO,GAAG,CAAC;AACb,CAAC;AAED;kFACkF;AAClF,MAAM,UAAU,aAAa,CAAC,OAAuB,EAAE,EAAU,EAAE,OAAe;IAChF,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CA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AAO,OAAO,CAAC,CAAC,eAAe;IACnE,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IACxE,CAAC;IACD,mGAAmG;IACnG,iGAAiG;IACjG,iGAAiG;IACjG,kEAAkE;IAClE,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IACjE,OAAO,WAAW,IAAI,IAAI,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The generator-document family — the template-mode runtime companion, the inline-safety
3
+ * escapes, and the pure document-shape builders. Every piece here is a pure string operation with no chain
4
+ * access and no Node dependency, so it belongs in the neutral layer a resolver, a CLI preview,
5
+ * and any third-party provider all consume identically — one definition of the runtime surface
6
+ * and the document shape, so none of them can quietly drift from what the others emit.
7
+ */
8
+ /**
9
+ * `abx.js` — the runtime companion (the hl-gen.js analog), served at `/abx.js` and
10
+ * inlined into template-mode documents. Convention, not protocol: a directory build
11
+ * includes it; the generator injects the same surface.
12
+ *
13
+ * tokenData resolution order (the durability chain): the injected `window.abxTokenData`
14
+ * global (template mode) → the `?abx=` query param (base64url canonical JSON — the
15
+ * live-view route) → the `?chainId&contract&tokenId` coordinate floor (a build opened
16
+ * bare from a gateway still knows which token it is; full param reads from RPC are the
17
+ * render-node's job, not this shim's).
18
+ */
19
+ export declare const ABX_JS = "(function () {\n var abx = (window.abx = window.abx || {});\n function fromQuery() {\n try {\n var q = new URLSearchParams(location.search);\n var packed = q.get('abx');\n if (packed) {\n var b64 = packed.replace(/-/g, '+').replace(/_/g, '/');\n return JSON.parse(new TextDecoder().decode(Uint8Array.from(atob(b64), function (c) { return c.charCodeAt(0); })));\n }\n // coordinate floor: enough for a deterministic piece opened bare from a gateway\n if (q.get('contract') && q.get('tokenId')) {\n return {\n chainId: Number(q.get('chainId') || 1),\n contractAddress: String(q.get('contract')).toLowerCase(),\n tokenId: String(q.get('tokenId')),\n };\n }\n } catch (e) {}\n return null;\n }\n abx.tokenData = window.abxTokenData || fromQuery();\n abx.__traits = null;\n abx.__done = false;\n /** The script reports its computed traits (script-defined features; captured at render). */\n abx.traits = function (t) {\n abx.__traits = t;\n try { document.dispatchEvent(new CustomEvent('abx:traits', {detail: t})); } catch (e) {}\n return t;\n };\n /** Output-complete \u2014 the capture point for the render effect. Optional (timeout fallback). */\n abx.done = function () {\n abx.__done = true;\n try { document.dispatchEvent(new CustomEvent('abx:done')); } catch (e) {}\n };\n})();\n";
20
+ /**
21
+ * Inline-document safety — the one HTML parsing rule that matters when embedding
22
+ * content inside <script> elements: the parser ends the element at the first
23
+ * `</script`, regardless of JS string/comment context. Two content shapes, two
24
+ * semantics-preserving escapes:
25
+ *
26
+ * - JS source (libraries, creator scripts): `</script` → `<\/script`. In valid JS the
27
+ * sequence can only occur inside a string, template, regex, or comment — contexts
28
+ * where `\/` is identical to `/` — so the transform never changes behavior.
29
+ * - JSON (the injected `window.abxTokenData`): every `<` → `\u003c`. `<` only occurs
30
+ * inside JSON strings (never in the syntax), and `\u003c` parses to the same
31
+ * character — the canonical (hashed) serialization is untouched; only the delivery
32
+ * form differs.
33
+ */
34
+ /** JS source safe to inline inside a <script> element. Case-insensitive because HTML end tags
35
+ * are; the on-chain generator matches this (see `AbxGenerator._escapedScript`). */
36
+ export declare function escapeInlineScript(src: string): string;
37
+ /** A JSON payload safe to inline inside a <script> element (parse-identical). */
38
+ export declare function escapeInlineJson(json: string): string;
39
+ /**
40
+ * Inject `window.abxTokenData` (and, when the document doesn't already carry one, a
41
+ * `<base href="{code root}/">` so relative asset paths keep riding the gateway) at the
42
+ * very top of `<head>` — before any build script can execute; abx.js resolves the global
43
+ * first. String-level and deliberately robust rather than a full HTML parse: no `<head>`
44
+ * → inject right after `<html …>`; neither → prepend. First `<base>` wins in HTML, so an
45
+ * existing one is never doubled.
46
+ */
47
+ export declare function injectTokenDataIntoHtml(html: string, tokenDataJson: string, codeRoot: string): string;
48
+ /**
49
+ * The template-mode document shape, pure — no chain access, so a caller that already has a
50
+ * script + dep tags in hand (the resolver's own chain-fetched assembly; `abx preview`'s offline
51
+ * studio, local-file + CDN-resolved) can build the byte-identical document. Exported for exactly
52
+ * that reason: **one** definition of the shape, so a caller can never quietly drift from what the
53
+ * generator actually serves — the failure mode a hand-maintained duplicate (with a "keep these in
54
+ * sync" comment and nothing enforcing it) invites.
55
+ */
56
+ export declare function buildGeneratorDocument(script: string, tokenDataJson: string, depTags: string[]): string;
57
+ //# sourceMappingURL=generator-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-document.d.ts","sourceRoot":"","sources":["../src/generator-document.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,o4CAoClB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AAEH;oFACoF;AACpF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAcrG;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAYvG"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * The generator-document family — the template-mode runtime companion, the inline-safety
3
+ * escapes, and the pure document-shape builders. Every piece here is a pure string operation with no chain
4
+ * access and no Node dependency, so it belongs in the neutral layer a resolver, a CLI preview,
5
+ * and any third-party provider all consume identically — one definition of the runtime surface
6
+ * and the document shape, so none of them can quietly drift from what the others emit.
7
+ */
8
+ /**
9
+ * `abx.js` — the runtime companion (the hl-gen.js analog), served at `/abx.js` and
10
+ * inlined into template-mode documents. Convention, not protocol: a directory build
11
+ * includes it; the generator injects the same surface.
12
+ *
13
+ * tokenData resolution order (the durability chain): the injected `window.abxTokenData`
14
+ * global (template mode) → the `?abx=` query param (base64url canonical JSON — the
15
+ * live-view route) → the `?chainId&contract&tokenId` coordinate floor (a build opened
16
+ * bare from a gateway still knows which token it is; full param reads from RPC are the
17
+ * render-node's job, not this shim's).
18
+ */
19
+ export const ABX_JS = `(function () {
20
+ var abx = (window.abx = window.abx || {});
21
+ function fromQuery() {
22
+ try {
23
+ var q = new URLSearchParams(location.search);
24
+ var packed = q.get('abx');
25
+ if (packed) {
26
+ var b64 = packed.replace(/-/g, '+').replace(/_/g, '/');
27
+ return JSON.parse(new TextDecoder().decode(Uint8Array.from(atob(b64), function (c) { return c.charCodeAt(0); })));
28
+ }
29
+ // coordinate floor: enough for a deterministic piece opened bare from a gateway
30
+ if (q.get('contract') && q.get('tokenId')) {
31
+ return {
32
+ chainId: Number(q.get('chainId') || 1),
33
+ contractAddress: String(q.get('contract')).toLowerCase(),
34
+ tokenId: String(q.get('tokenId')),
35
+ };
36
+ }
37
+ } catch (e) {}
38
+ return null;
39
+ }
40
+ abx.tokenData = window.abxTokenData || fromQuery();
41
+ abx.__traits = null;
42
+ abx.__done = false;
43
+ /** The script reports its computed traits (script-defined features; captured at render). */
44
+ abx.traits = function (t) {
45
+ abx.__traits = t;
46
+ try { document.dispatchEvent(new CustomEvent('abx:traits', {detail: t})); } catch (e) {}
47
+ return t;
48
+ };
49
+ /** Output-complete — the capture point for the render effect. Optional (timeout fallback). */
50
+ abx.done = function () {
51
+ abx.__done = true;
52
+ try { document.dispatchEvent(new CustomEvent('abx:done')); } catch (e) {}
53
+ };
54
+ })();
55
+ `;
56
+ /**
57
+ * Inline-document safety — the one HTML parsing rule that matters when embedding
58
+ * content inside <script> elements: the parser ends the element at the first
59
+ * `</script`, regardless of JS string/comment context. Two content shapes, two
60
+ * semantics-preserving escapes:
61
+ *
62
+ * - JS source (libraries, creator scripts): `</script` → `<\/script`. In valid JS the
63
+ * sequence can only occur inside a string, template, regex, or comment — contexts
64
+ * where `\/` is identical to `/` — so the transform never changes behavior.
65
+ * - JSON (the injected `window.abxTokenData`): every `<` → `\u003c`. `<` only occurs
66
+ * inside JSON strings (never in the syntax), and `\u003c` parses to the same
67
+ * character — the canonical (hashed) serialization is untouched; only the delivery
68
+ * form differs.
69
+ */
70
+ /** JS source safe to inline inside a <script> element. Case-insensitive because HTML end tags
71
+ * are; the on-chain generator matches this (see `AbxGenerator._escapedScript`). */
72
+ export function escapeInlineScript(src) {
73
+ return src.replace(/<\/(script)/gi, '<\\/$1');
74
+ }
75
+ /** A JSON payload safe to inline inside a <script> element (parse-identical). */
76
+ export function escapeInlineJson(json) {
77
+ return json.replace(/</g, '\\u003c');
78
+ }
79
+ /**
80
+ * Inject `window.abxTokenData` (and, when the document doesn't already carry one, a
81
+ * `<base href="{code root}/">` so relative asset paths keep riding the gateway) at the
82
+ * very top of `<head>` — before any build script can execute; abx.js resolves the global
83
+ * first. String-level and deliberately robust rather than a full HTML parse: no `<head>`
84
+ * → inject right after `<html …>`; neither → prepend. First `<base>` wins in HTML, so an
85
+ * existing one is never doubled.
86
+ */
87
+ export function injectTokenDataIntoHtml(html, tokenDataJson, codeRoot) {
88
+ const baseTag = /<base[\s/>]/i.test(html) ? '' : `<base href="${codeRoot}">`;
89
+ const injection = `${baseTag}<script>window.abxTokenData=${escapeInlineJson(tokenDataJson)};</script>`;
90
+ const head = /<head(\s[^>]*)?>/i.exec(html);
91
+ if (head) {
92
+ const at = head.index + head[0].length;
93
+ return html.slice(0, at) + injection + html.slice(at);
94
+ }
95
+ const htmlTag = /<html(\s[^>]*)?>/i.exec(html);
96
+ if (htmlTag) {
97
+ const at = htmlTag.index + htmlTag[0].length;
98
+ return html.slice(0, at) + injection + html.slice(at);
99
+ }
100
+ return injection + html;
101
+ }
102
+ /**
103
+ * The template-mode document shape, pure — no chain access, so a caller that already has a
104
+ * script + dep tags in hand (the resolver's own chain-fetched assembly; `abx preview`'s offline
105
+ * studio, local-file + CDN-resolved) can build the byte-identical document. Exported for exactly
106
+ * that reason: **one** definition of the shape, so a caller can never quietly drift from what the
107
+ * generator actually serves — the failure mode a hand-maintained duplicate (with a "keep these in
108
+ * sync" comment and nothing enforcing it) invites.
109
+ */
110
+ export function buildGeneratorDocument(script, tokenDataJson, depTags) {
111
+ return [
112
+ '<!doctype html>',
113
+ '<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">',
114
+ '<style>html,body{margin:0;padding:0;overflow:hidden}canvas{display:block}</style>',
115
+ `<script>window.abxTokenData=${escapeInlineJson(tokenDataJson)};</script>`,
116
+ `<script>${ABX_JS}</script>`,
117
+ ...depTags,
118
+ '</head><body>',
119
+ `<script>\n${escapeInlineScript(script)}\n</script>`,
120
+ '</body></html>',
121
+ ].join('\n');
122
+ }
123
+ //# sourceMappingURL=generator-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator-document.js","sourceRoot":"","sources":["../src/generator-document.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCrB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AAEH;oFACoF;AACpF,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C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CAAC,YAAY;QAC1E,WAAW,MAAM,WAAW;QAC5B,GAAG,OAAO;QACV,eAAe;QACf,aAAa,kBAAkB,CAAC,MAAM,CAAC,aAAa;QACpD,gBAAgB;KACjB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The canonical on-chain generator — `AbxGenerator` (specs/protocol/code-projects.md →
2
+ * The canonical on-chain generator — `AbxGenerator` (site/content/docs/protocol/code-projects.mdx →
3
3
  * "The canonical generator"). One field renderer for the `animation_url` field serving both
4
4
  * code custody modes: **template** (script chunks → the full HTML document, chain-complete
5
5
  * when every dependency resolves to on-chain bytes) and **directory** (`code` field → a
@@ -98,6 +98,42 @@ export declare const abxGeneratorAbi: readonly [{
98
98
  readonly name: "";
99
99
  readonly type: "string";
100
100
  }];
101
+ }, {
102
+ readonly type: "function";
103
+ readonly name: "abxJs";
104
+ readonly stateMutability: "view";
105
+ readonly inputs: readonly [];
106
+ readonly outputs: readonly [{
107
+ readonly name: "";
108
+ readonly type: "string";
109
+ }];
110
+ }, {
111
+ readonly type: "function";
112
+ readonly name: "gunzipScript";
113
+ readonly stateMutability: "view";
114
+ readonly inputs: readonly [];
115
+ readonly outputs: readonly [{
116
+ readonly name: "";
117
+ readonly type: "string";
118
+ }];
119
+ }, {
120
+ readonly type: "function";
121
+ readonly name: "registryScriptChunk";
122
+ readonly stateMutability: "view";
123
+ readonly inputs: readonly [{
124
+ readonly name: "registry";
125
+ readonly type: "address";
126
+ }, {
127
+ readonly name: "ref";
128
+ readonly type: "bytes32";
129
+ }, {
130
+ readonly name: "index";
131
+ readonly type: "uint256";
132
+ }];
133
+ readonly outputs: readonly [{
134
+ readonly name: "";
135
+ readonly type: "string";
136
+ }];
101
137
  }];
102
138
  /** `AbxGenerator`'s branch constants, by index: 0 = none, 1 = template, 2 = directory. */
103
139
  export declare const GENERATOR_BRANCHES: readonly ["none", "template", "directory"];
@@ -108,7 +144,13 @@ export declare const GENERATOR_URL_BUDGET_BYTES = 8192;
108
144
  export interface GeneratorStatus {
109
145
  branch: number;
110
146
  branchName: GeneratorBranch;
111
- /** Template branch with EVERY dependency resolved to proven on-chain bytes. Always false off it. */
147
+ /** Template branch with EVERY dependency resolved to on-chain bytes — no server, gateway, or CDN
148
+ * in the graph. Always false off it.
149
+ *
150
+ * A claim about WHERE the bytes come from, never about whether they are frozen: a `Registry`
151
+ * dependency is re-fetched from the registry contract on every read, so its bytes can change while
152
+ * this stays `true` — including after `lockDependencies` (which freezes the ref and the registry
153
+ * pointer, not another contract's storage). Don't render this as "immutable" in a UI. */
112
154
  chainComplete: boolean;
113
155
  /** Refs that emit `<!-- abx:unresolved … -->` markers, decoded to their readable tags. */
114
156
  unresolvedRefs: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAC,OAAO,EAAM,MAAM,MAAM,CAAC;AAGvC,sFAAsF;AACtF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDlB,CAAC;AAEX,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,4CAA6C,CAAC;AAC7E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,2FAA2F;AAC3F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,yFAAyF;AACzF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,eAAe,CAAC;IAC5B,oGAAoG;IACpG,aAAa,EAAE,OAAO,CAAC;IACvB,0FAA0F;IAC1F,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,qFAAqF;IACrF,aAAa,EAAE,OAAO,CAAC;CACxB;A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AAW,mBAAmB;IAClC,YAAY,CAAC,IAAI,EAAE;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE,SAAS,OAAO,EAAE,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;KAC1B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtB;AAED,6FAA6F;AAC7F,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,mBAAmB,EAC3B,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,eAAe,CAAC,CAc1B"}
package/dist/generator.js CHANGED
@@ -57,6 +57,35 @@ export const abxGeneratorAbi = [
57
57
  ],
58
58
  outputs: [{ name: '', type: 'string' }],
59
59
  },
60
+ // The rest of the piecewise set. `document` on a large project can exceed a node's eth_call gas cap
61
+ // (tokenURI assembly measures ~360-405k gas per KB, climbing with size), and these are how a client assembles the same
62
+ // document from pieces instead: the two baked runtime blobs, plus a registry dependency's chunks
63
+ // one at a time. Every read here is an OFF-CHAIN view call by design — no contract calls them.
64
+ {
65
+ type: 'function',
66
+ name: 'abxJs',
67
+ stateMutability: 'view',
68
+ inputs: [],
69
+ outputs: [{ name: '', type: 'string' }],
70
+ },
71
+ {
72
+ type: 'function',
73
+ name: 'gunzipScript',
74
+ stateMutability: 'view',
75
+ inputs: [],
76
+ outputs: [{ name: '', type: 'string' }],
77
+ },
78
+ {
79
+ type: 'function',
80
+ name: 'registryScriptChunk',
81
+ stateMutability: 'view',
82
+ inputs: [
83
+ { name: 'registry', type: 'address' },
84
+ { name: 'ref', type: 'bytes32' },
85
+ { name: 'index', type: 'uint256' },
86
+ ],
87
+ outputs: [{ name: '', type: 'string' }],
88
+ },
60
89
  ];
61
90
  /** `AbxGenerator`'s branch constants, by index: 0 = none, 1 = template, 2 = directory. */
62
91
  export const GENERATOR_BRANCHES = ['none', 'template', 'directory'];
@@ -1 +1 @@
1
- {"version":3,"file":"generator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;QACb,cAAc,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC3D,aAAa;KACd,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -11,22 +11,38 @@
11
11
  export type { Address, Hex, PublicClient, WalletClient, Account } from 'viem';
12
12
  export * from './types.js';
13
13
  export * from './spine.js';
14
+ export * from './chain-support.js';
14
15
  export * from './chains.js';
15
16
  export * from './clients.js';
16
- export * from './deploy.js';
17
17
  export * from './ops.js';
18
+ export * from './execute.js';
19
+ export * from './errors.js';
20
+ export * from './deploy.js';
21
+ export * from './anchors.js';
18
22
  export * from './reconstruct.js';
23
+ export * from './resume.js';
19
24
  export * from './tokendata.js';
20
25
  export * from './probe.js';
21
26
  export * from './token.js';
27
+ export * from './tokens.js';
22
28
  export * from './traits.js';
23
29
  export * from './fastlz.js';
24
30
  export * from './chunks.js';
25
31
  export * from './create2.js';
32
+ export * from './creator-token.js';
26
33
  export * from './deployments.js';
27
34
  export * from './deps.js';
35
+ export * from './gateways.js';
28
36
  export * from './generator.js';
37
+ export * from './generator-document.js';
38
+ export * from './inspect.js';
39
+ export * from './script-chunks.js';
40
+ export * from './migrate.js';
41
+ export * from './mime.js';
42
+ export * from './onchain-uri.js';
43
+ export * from './policy.js';
29
44
  export * from './service.js';
30
- export { loadDotEnv, parseEnvContent } from './env.js';
31
- export { oneOfOneImageAbi, oneOfOneImageFactoryAbi, seriesImageAbi, seriesImageFactoryAbi, seriesCodeAbi, seriesCodeFactoryAbi, abxSeedSourceAbi, abxMetadataRendererAbi, abxChunkStoreAbi, abxFixedPriceMinterAbi, spineEventAbi, } from './abi/index.js';
45
+ export * from './staging.js';
46
+ export * from './util.js';
47
+ export { oneOfOneImageAbi, oneOfOneImageFactoryAbi, seriesImageAbi, seriesImageFactoryAbi, seriesCodeAbi, seriesCodeFactoryAbi, oneOfOneEditionAbi, oneOfOneEditionFactoryAbi, editionImageAbi, editionImageFactoryAbi, editionCodeAbi, editionCodeFactoryAbi, abxSeedSourceAbi, abxMetadataRendererAbi, abxChunkStoreAbi, abxFixedPriceMinterAbi, abxFixedPriceMinter1155Abi, spineEventAbi, } from './abi/index.js';
32
48
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AAE5E,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACd,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,YAAY,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
@@ -1,21 +1,37 @@
1
1
  export * from './types.js';
2
2
  export * from './spine.js';
3
+ export * from './chain-support.js';
3
4
  export * from './chains.js';
4
5
  export * from './clients.js';
5
- export * from './deploy.js';
6
6
  export * from './ops.js';
7
+ export * from './execute.js';
8
+ export * from './errors.js';
9
+ export * from './deploy.js';
10
+ export * from './anchors.js';
7
11
  export * from './reconstruct.js';
12
+ export * from './resume.js';
8
13
  export * from './tokendata.js';
9
14
  export * from './probe.js';
10
15
  export * from './token.js';
16
+ export * from './tokens.js';
11
17
  export * from './traits.js';
12
18
  export * from './fastlz.js';
13
19
  export * from './chunks.js';
14
20
  export * from './create2.js';
21
+ export * from './creator-token.js';
15
22
  export * from './deployments.js';
16
23
  export * from './deps.js';
24
+ export * from './gateways.js';
17
25
  export * from './generator.js';
26
+ export * from './generator-document.js';
27
+ export * from './inspect.js';
28
+ export * from './script-chunks.js';
29
+ export * from './migrate.js';
30
+ export * from './mime.js';
31
+ export * from './onchain-uri.js';
32
+ export * from './policy.js';
18
33
  export * from './service.js';
19
- export { loadDotEnv, parseEnvContent } from './env.js';
20
- export { oneOfOneImageAbi, oneOfOneImageFactoryAbi, seriesImageAbi, seriesImageFactoryAbi, seriesCodeAbi, seriesCodeFactoryAbi, abxSeedSourceAbi, abxMetadataRendererAbi, abxChunkStoreAbi, abxFixedPriceMinterAbi, spineEventAbi, } from './abi/index.js';
34
+ export * from './staging.js';
35
+ export * from './util.js';
36
+ export { oneOfOneImageAbi, oneOfOneImageFactoryAbi, seriesImageAbi, seriesImageFactoryAbi, seriesCodeAbi, seriesCodeFactoryAbi, oneOfOneEditionAbi, oneOfOneEditionFactoryAbi, editionImageAbi, editionImageFactoryAbi, editionCodeAbi, editionCodeFactoryAbi, abxSeedSourceAbi, abxMetadataRendererAbi, abxChunkStoreAbi, abxFixedPriceMinterAbi, abxFixedPriceMinter1155Abi, spineEventAbi, } from './abi/index.js';
21
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACd,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC1B,aAAa,GACd,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * `abx inspect <script.js>` — static analysis of a generative script, BEFORE picking a lane.
3
+ *
4
+ * The membrane fix behind this: an agent (or creator) should DERIVE the deployment lane from what
5
+ * the script actually needs — are there traits? are they reproducible on-chain? how big is the
6
+ * assembled document (does a single `tokenURI` eth_call even fit)? — instead of guessing "fully
7
+ * on-chain!" and walking it back. This module is the pure analysis; `cmdInspect` formats it.
8
+ *
9
+ * Static only — it never executes the script (that's the resolver/runner's job, and executing
10
+ * untrusted code in the CLI would be a footgun). Everything here is regex/heuristic over the source.
11
+ */
12
+ export type TraitFeasibility = 'none' | 'exact-likely' | 'careful' | 'infeasible' | 'unknown';
13
+ export interface ScriptAnalysis {
14
+ bytes: number;
15
+ estChunks: number;
16
+ traits: {
17
+ present: boolean;
18
+ keys: string[];
19
+ };
20
+ paramHints: string[];
21
+ prng: {
22
+ seeded: boolean;
23
+ usesBareRandom: boolean;
24
+ usesMathRandom: boolean;
25
+ usesNoise: boolean;
26
+ };
27
+ depHints: string[];
28
+ looksP5: boolean;
29
+ feasibility: {
30
+ verdict: TraitFeasibility;
31
+ reason: string;
32
+ };
33
+ doc: {
34
+ estBytes: number;
35
+ deps: string[];
36
+ fitsSingleCall: boolean;
37
+ unknownDepSizes: boolean;
38
+ };
39
+ runtime: {
40
+ readsTokenData: boolean;
41
+ reportsTraits: boolean;
42
+ wrongGlobal: string | null;
43
+ };
44
+ }
45
+ export declare function analyzeScript(source: string, declaredDeps?: string[]): ScriptAnalysis;
46
+ /** A one-line lane recommendation derived from the analysis (the decision-tree output). */
47
+ export declare function recommendLane(a: ScriptAnalysis): string;
48
+ //# sourceMappingURL=inspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAC,CAAC;IAC3C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,cAAc,EAAE,OAAO,CAAC;QAAC,cAAc,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAC,CAAC;IAC9F,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,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