@artblocks/abx-sdk 0.1.0-alpha.3 → 0.1.0-alpha.30

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 (147) hide show
  1. package/CHANGELOG.md +11 -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 +318 -0
  12. package/dist/anchors.d.ts.map +1 -0
  13. package/dist/anchors.js +701 -0
  14. package/dist/anchors.js.map +1 -0
  15. package/dist/chains.d.ts +19 -9
  16. package/dist/chains.d.ts.map +1 -1
  17. package/dist/chains.js +31 -15
  18. package/dist/chains.js.map +1 -1
  19. package/dist/chunks.d.ts +67 -26
  20. package/dist/chunks.d.ts.map +1 -1
  21. package/dist/chunks.js +82 -9
  22. package/dist/chunks.js.map +1 -1
  23. package/dist/clients.d.ts +23 -11
  24. package/dist/clients.d.ts.map +1 -1
  25. package/dist/clients.js +17 -18
  26. package/dist/clients.js.map +1 -1
  27. package/dist/create2.d.ts +84 -1
  28. package/dist/create2.d.ts.map +1 -1
  29. package/dist/create2.js +158 -2
  30. package/dist/create2.js.map +1 -1
  31. package/dist/creator-token.d.ts +132 -0
  32. package/dist/creator-token.d.ts.map +1 -0
  33. package/dist/creator-token.js +183 -0
  34. package/dist/creator-token.js.map +1 -0
  35. package/dist/deploy.d.ts +234 -14
  36. package/dist/deploy.d.ts.map +1 -1
  37. package/dist/deploy.js +289 -111
  38. package/dist/deploy.js.map +1 -1
  39. package/dist/deployments.d.ts +70 -5
  40. package/dist/deployments.d.ts.map +1 -1
  41. package/dist/deployments.js +139 -30
  42. package/dist/deployments.js.map +1 -1
  43. package/dist/deps.d.ts +123 -6
  44. package/dist/deps.d.ts.map +1 -1
  45. package/dist/deps.js +249 -7
  46. package/dist/deps.js.map +1 -1
  47. package/dist/env.d.ts +5 -4
  48. package/dist/env.d.ts.map +1 -1
  49. package/dist/env.js +20 -5
  50. package/dist/env.js.map +1 -1
  51. package/dist/errors.d.ts +94 -0
  52. package/dist/errors.d.ts.map +1 -0
  53. package/dist/errors.js +126 -0
  54. package/dist/errors.js.map +1 -0
  55. package/dist/execute.d.ts +118 -0
  56. package/dist/execute.d.ts.map +1 -0
  57. package/dist/execute.js +159 -0
  58. package/dist/execute.js.map +1 -0
  59. package/dist/gateways.d.ts +79 -0
  60. package/dist/gateways.d.ts.map +1 -0
  61. package/dist/gateways.js +156 -0
  62. package/dist/gateways.js.map +1 -0
  63. package/dist/generator-document.d.ts +57 -0
  64. package/dist/generator-document.d.ts.map +1 -0
  65. package/dist/generator-document.js +123 -0
  66. package/dist/generator-document.js.map +1 -0
  67. package/dist/generator.d.ts +44 -2
  68. package/dist/generator.d.ts.map +1 -1
  69. package/dist/generator.js +29 -0
  70. package/dist/generator.js.map +1 -1
  71. package/dist/index.d.ts +18 -3
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +18 -3
  74. package/dist/index.js.map +1 -1
  75. package/dist/inspect.d.ts +48 -0
  76. package/dist/inspect.d.ts.map +1 -0
  77. package/dist/inspect.js +295 -0
  78. package/dist/inspect.js.map +1 -0
  79. package/dist/migrate.d.ts +41 -0
  80. package/dist/migrate.d.ts.map +1 -0
  81. package/dist/migrate.js +142 -0
  82. package/dist/migrate.js.map +1 -0
  83. package/dist/mime.d.ts +11 -0
  84. package/dist/mime.d.ts.map +1 -0
  85. package/dist/mime.js +40 -0
  86. package/dist/mime.js.map +1 -0
  87. package/dist/node.d.ts +10 -0
  88. package/dist/node.d.ts.map +1 -0
  89. package/dist/node.js +24 -0
  90. package/dist/node.js.map +1 -0
  91. package/dist/onchain-uri.d.ts +110 -0
  92. package/dist/onchain-uri.d.ts.map +1 -0
  93. package/dist/onchain-uri.js +276 -0
  94. package/dist/onchain-uri.js.map +1 -0
  95. package/dist/ops.d.ts +507 -14
  96. package/dist/ops.d.ts.map +1 -1
  97. package/dist/ops.js +850 -34
  98. package/dist/ops.js.map +1 -1
  99. package/dist/policy.d.ts +57 -0
  100. package/dist/policy.d.ts.map +1 -0
  101. package/dist/policy.js +35 -0
  102. package/dist/policy.js.map +1 -0
  103. package/dist/probe.d.ts +58 -0
  104. package/dist/probe.d.ts.map +1 -1
  105. package/dist/probe.js +190 -9
  106. package/dist/probe.js.map +1 -1
  107. package/dist/reconstruct.d.ts +114 -2
  108. package/dist/reconstruct.d.ts.map +1 -1
  109. package/dist/reconstruct.js +443 -98
  110. package/dist/reconstruct.js.map +1 -1
  111. package/dist/resume.d.ts +96 -0
  112. package/dist/resume.d.ts.map +1 -0
  113. package/dist/resume.js +95 -0
  114. package/dist/resume.js.map +1 -0
  115. package/dist/script-chunks.d.ts +24 -0
  116. package/dist/script-chunks.d.ts.map +1 -0
  117. package/dist/script-chunks.js +63 -0
  118. package/dist/script-chunks.js.map +1 -0
  119. package/dist/service.d.ts +151 -9
  120. package/dist/service.d.ts.map +1 -1
  121. package/dist/service.js +103 -11
  122. package/dist/service.js.map +1 -1
  123. package/dist/spine.d.ts +47 -4
  124. package/dist/spine.d.ts.map +1 -1
  125. package/dist/spine.js +0 -0
  126. package/dist/spine.js.map +1 -1
  127. package/dist/staging.d.ts +139 -0
  128. package/dist/staging.d.ts.map +1 -0
  129. package/dist/staging.js +139 -0
  130. package/dist/staging.js.map +1 -0
  131. package/dist/token.d.ts +1 -1
  132. package/dist/token.js +1 -1
  133. package/dist/tokendata.d.ts +63 -3
  134. package/dist/tokendata.d.ts.map +1 -1
  135. package/dist/tokendata.js +81 -19
  136. package/dist/tokendata.js.map +1 -1
  137. package/dist/tokens.d.ts +119 -0
  138. package/dist/tokens.d.ts.map +1 -0
  139. package/dist/tokens.js +317 -0
  140. package/dist/tokens.js.map +1 -0
  141. package/dist/types.d.ts +107 -5
  142. package/dist/types.d.ts.map +1 -1
  143. package/dist/util.d.ts +74 -0
  144. package/dist/util.d.ts.map +1 -0
  145. package/dist/util.js +106 -0
  146. package/dist/util.js.map +1 -0
  147. package/package.json +15 -6
@@ -0,0 +1,110 @@
1
+ /**
2
+ * The on-chain tokenURI lane for code projects (`abx deploy-code --onchain-uri`) — pure leg
3
+ * composition + the verify-time honesty reads, all unit-testable with a mocked client.
4
+ *
5
+ * The lane (site/content/docs/protocol/code-projects.mdx → "The canonical generator — AbxGenerator" +
6
+ * site/content/docs/protocol/metadata.mdx → "URI resolution"): the collection-scope `animation_url`
7
+ * field points at the canonical generator via the `renderer` representation
8
+ * (`abi.encode(address)`), and the token's `tokenURIRenderer` toggles tokenURI to the canonical
9
+ * on-chain metadata renderer (`setContractURIRenderer` does the same for contractURI). Both ride
10
+ * the EXISTING setup multicall, before the mints.
11
+ *
12
+ * The param surface is NOT part of that wiring: params enumerate ON-CHAIN (`contractParamKeys` /
13
+ * `tokenParamKeys`, maintained by the write paths themselves), so the generator reads the key set
14
+ * straight from the token. The old `params.keys` CSV convention is retired — nothing writes it any
15
+ * more.
16
+ */
17
+ import { type Address, type Hex } from 'viem';
18
+ import { type GeneratorReadClient, type GeneratorStatus } from './generator.js';
19
+ import { type DepCheck, type ParsedDependencyRef } from './deps.js';
20
+ import type { ProjectState } from './types.js';
21
+ /**
22
+ * The `--onchain-uri` legs of the setup multicall, in order:
23
+ * 1. collection-scope `animation_url` field → representation `renderer`,
24
+ * value `abi.encode(generator)` (the canonical generator computes the live view on-chain);
25
+ * 2. `setTokenURIRenderer(metadataRenderer)` — tokenURI resolves ON-CHAIN from here on;
26
+ * 3. `setContractURIRenderer(metadataRenderer)` — contractURI too (parity with the 1/1 lane).
27
+ * Placed BEFORE the mint legs so every token is born with the on-chain lane fully configured.
28
+ *
29
+ * There is no param leg: the generator enumerates the param surface from the token itself
30
+ * (`contractParamKeys` / `tokenParamKeys`), so there is nothing for a deploy to declare.
31
+ */
32
+ export declare function onchainUriSetupCalls(args: {
33
+ generator: Address;
34
+ metadataRenderer: Address;
35
+ }): Hex[];
36
+ /** The SET param keys: `contractParamKeys()`, plus `tokenParamKeys(tokenId)` when a token is named.
37
+ * Null when the getters are absent — a LEGACY project deployed before enumeration shipped (or a
38
+ * token type with no Params extension at all). */
39
+ export declare function readSetParamKeys(client: GeneratorReadClient, contract: Address, tokenId?: bigint): Promise<{
40
+ contract: string[];
41
+ token: string[];
42
+ } | null>;
43
+ /** The DECLARED (governed) keys: `paramSchemaKeys()`, append-only — including keys declared but
44
+ * never yet written, which are otherwise undiscoverable. Null on a legacy project. */
45
+ export declare function readParamSchemaKeys(client: GeneratorReadClient, contract: Address): Promise<string[] | null>;
46
+ /** The project's three param-lifecycle hook addresses (`paramHooks()`), zeroes included — null on a
47
+ * project with no ConfigurableParams surface (a 1/1, a plain Series, an image edition).
48
+ *
49
+ * The `transferHook` in this trio is a **veto**: its revert fails the transfer, and a mint is a
50
+ * transfer from `0x0`, so a reverting hook stops minting too. Whether the trio can still change is
51
+ * a separate read — `readParamHooksLocked` (ops.ts), or the `ParamHooksFrozen` fold. */
52
+ export declare function readParamHooks(client: GeneratorReadClient, contract: Address): Promise<{
53
+ configureHook: Address;
54
+ augmentHook: Address;
55
+ transferHook: Address;
56
+ } | null>;
57
+ /** Does this token expose the enumeration surface at all? The one-call probe behind the repoint
58
+ * guard: the canonical generator reads params from chain, so pointing a token that lacks these
59
+ * getters at it makes every param silently invisible. */
60
+ export declare function hasParamEnumeration(client: GeneratorReadClient, contract: Address): Promise<boolean>;
61
+ /** What the deploy can honestly promise about the generator's template branch, derived from
62
+ * the selection-time dependency report (never a new RPC): chain-complete iff every registry
63
+ * dep has proven ON-CHAIN bytes (OnChain refs read their data contract directly, so they
64
+ * count as on-chain; `abx verify` is the from-chain confirmation either way). */
65
+ export declare function expectedChainComplete(deps: ParsedDependencyRef[], checks: DepCheck[]): {
66
+ expected: boolean | null;
67
+ detail: string;
68
+ };
69
+ /** The generator this project's on-chain lane actually uses: the collection `animation_url`
70
+ * field's `renderer` value when set (that address is what the metadata renderer staticcalls),
71
+ * else the chain's canonical generator. Null when neither exists. */
72
+ export declare function generatorFor(state: ProjectState, override?: string): Address | null;
73
+ /** Whether verify should run the on-chain-URI report: the tokenURIRenderer toggle is on, or
74
+ * the collection `animation` field points at a field renderer (the generator). */
75
+ export declare function hasOnChainUriLane(state: ProjectState): boolean;
76
+ export interface TokenUriProbe {
77
+ tokenId: string;
78
+ /** Which accessor was actually read — `tokenURI` on a 721, `uri` on an ERC-1155 edition. Readouts
79
+ * quote this so an edition is never described in 721 terms. */
80
+ accessor: 'tokenURI' | 'uri';
81
+ /** tokenURI(id)/uri(id) is a `data:application/json;base64,` URI (resolves on-chain, any RPC). */
82
+ onChainJson: boolean;
83
+ uriPrefix: string;
84
+ animation: {
85
+ form: 'data-html';
86
+ bytes: number;
87
+ marker: string | null;
88
+ } | {
89
+ form: 'url';
90
+ url: string;
91
+ } | {
92
+ form: 'data-other';
93
+ prefix: string;
94
+ } | {
95
+ form: 'missing';
96
+ };
97
+ }
98
+ export interface OnChainUriReport {
99
+ generator: Address;
100
+ status: GeneratorStatus;
101
+ /** Null when no token is minted yet (tokenURI would revert). */
102
+ probe: TokenUriProbe | null;
103
+ }
104
+ /**
105
+ * The verify-time on-chain-URI report: `generator.onChainStatus(token)` (branch ·
106
+ * chain-completeness · unresolved refs · URL budget) plus a `tokenURI` probe of the lowest
107
+ * minted token — decoded, with the `animation_url` form checked against the branch.
108
+ */
109
+ export declare function onChainUriReport(client: GeneratorReadClient, state: ProjectState, generatorOverride?: string): Promise<OnChainUriReport>;
110
+ //# sourceMappingURL=onchain-uri.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onchain-uri.d.ts","sourceRoot":"","sources":["../src/onchain-uri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAkC,KAAK,OAAO,E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
3
+ * composition + the verify-time honesty reads, all unit-testable with a mocked client.
4
+ *
5
+ * The lane (site/content/docs/protocol/code-projects.mdx → "The canonical generator — AbxGenerator" +
6
+ * site/content/docs/protocol/metadata.mdx → "URI resolution"): the collection-scope `animation_url`
7
+ * field points at the canonical generator via the `renderer` representation
8
+ * (`abi.encode(address)`), and the token's `tokenURIRenderer` toggles tokenURI to the canonical
9
+ * on-chain metadata renderer (`setContractURIRenderer` does the same for contractURI). Both ride
10
+ * the EXISTING setup multicall, before the mints.
11
+ *
12
+ * The param surface is NOT part of that wiring: params enumerate ON-CHAIN (`contractParamKeys` /
13
+ * `tokenParamKeys`, maintained by the write paths themselves), so the generator reads the key set
14
+ * straight from the token. The old `params.keys` CSV convention is retired — nothing writes it any
15
+ * more.
16
+ */
17
+ import { encodeFunctionData, zeroAddress } from 'viem';
18
+ import { decodeTag, encodeTag, METADATA_FIELD as F, METADATA_REPRESENTATION as R } from './spine.js';
19
+ import { seriesCodeAbi } from './abi/index.js';
20
+ import { readGeneratorStatus } from './generator.js';
21
+ import { resolveGenerator } from './deployments.js';
22
+ import { decodeFieldRenderer, encodeFieldRenderer } from './token.js';
23
+ import { DEP_RESOLUTION } from './deps.js';
24
+ import { parseDataUri, base64ToBytes } from './util.js';
25
+ /**
26
+ * The `--onchain-uri` legs of the setup multicall, in order:
27
+ * 1. collection-scope `animation_url` field → representation `renderer`,
28
+ * value `abi.encode(generator)` (the canonical generator computes the live view on-chain);
29
+ * 2. `setTokenURIRenderer(metadataRenderer)` — tokenURI resolves ON-CHAIN from here on;
30
+ * 3. `setContractURIRenderer(metadataRenderer)` — contractURI too (parity with the 1/1 lane).
31
+ * Placed BEFORE the mint legs so every token is born with the on-chain lane fully configured.
32
+ *
33
+ * There is no param leg: the generator enumerates the param surface from the token itself
34
+ * (`contractParamKeys` / `tokenParamKeys`), so there is nothing for a deploy to declare.
35
+ */
36
+ export function onchainUriSetupCalls(args) {
37
+ const calls = [];
38
+ // The `animation_url` leg points at the generator (which computes the doc from a PROGRAM). A
39
+ // renderer-only drop (in-chain SVG, no program) has no generator — and baking this leg at a ZERO
40
+ // generator would make the metadata renderer staticcall a codeless address and REVERT every
41
+ // tokenURI. So emit it only when there's a real generator; otherwise there's simply no animation_url
42
+ // (optional by spec — the metadata renderer omits an unset field).
43
+ if (args.generator !== zeroAddress) {
44
+ calls.push(encodeFunctionData({
45
+ abi: seriesCodeAbi,
46
+ functionName: 'setContractField',
47
+ args: [encodeTag(F.animationUrl), encodeTag(R.renderer), encodeFieldRenderer(args.generator)],
48
+ }));
49
+ }
50
+ calls.push(encodeFunctionData({ abi: seriesCodeAbi, functionName: 'setTokenURIRenderer', args: [args.metadataRenderer] }), encodeFunctionData({ abi: seriesCodeAbi, functionName: 'setContractURIRenderer', args: [args.metadataRenderer] }));
51
+ return calls;
52
+ }
53
+ // ── the param surface, enumerated FROM CHAIN ──────────────────────────────────
54
+ // `key ∈ list ⟺ the param isSet` — the contract maintains both key lists inside the write paths
55
+ // themselves, so nothing off-chain has to be kept in step. `seed` is deliberately never listed
56
+ // (every consumer reads it as a tokenData coordinate). Enumeration order is unspecified; the
57
+ // canonical serialization sorts.
58
+ /** The SET param keys: `contractParamKeys()`, plus `tokenParamKeys(tokenId)` when a token is named.
59
+ * Null when the getters are absent — a LEGACY project deployed before enumeration shipped (or a
60
+ * token type with no Params extension at all). */
61
+ export async function readSetParamKeys(client, contract, tokenId) {
62
+ try {
63
+ const contractKeys = (await client.readContract({
64
+ address: contract,
65
+ abi: seriesCodeAbi,
66
+ functionName: 'contractParamKeys',
67
+ args: [],
68
+ }));
69
+ const tokenKeys = tokenId === undefined
70
+ ? []
71
+ : (await client.readContract({
72
+ address: contract,
73
+ abi: seriesCodeAbi,
74
+ functionName: 'tokenParamKeys',
75
+ args: [tokenId],
76
+ }));
77
+ return { contract: contractKeys.map(decodeTag), token: tokenKeys.map(decodeTag) };
78
+ }
79
+ catch {
80
+ return null;
81
+ }
82
+ }
83
+ /** The DECLARED (governed) keys: `paramSchemaKeys()`, append-only — including keys declared but
84
+ * never yet written, which are otherwise undiscoverable. Null on a legacy project. */
85
+ export async function readParamSchemaKeys(client, contract) {
86
+ try {
87
+ const keys = (await client.readContract({
88
+ address: contract,
89
+ abi: seriesCodeAbi,
90
+ functionName: 'paramSchemaKeys',
91
+ args: [],
92
+ }));
93
+ return keys.map(decodeTag);
94
+ }
95
+ catch {
96
+ return null;
97
+ }
98
+ }
99
+ /** The project's three param-lifecycle hook addresses (`paramHooks()`), zeroes included — null on a
100
+ * project with no ConfigurableParams surface (a 1/1, a plain Series, an image edition).
101
+ *
102
+ * The `transferHook` in this trio is a **veto**: its revert fails the transfer, and a mint is a
103
+ * transfer from `0x0`, so a reverting hook stops minting too. Whether the trio can still change is
104
+ * a separate read — `readParamHooksLocked` (ops.ts), or the `ParamHooksFrozen` fold. */
105
+ export async function readParamHooks(client, contract) {
106
+ try {
107
+ const [configureHook, augmentHook, transferHook] = (await client.readContract({
108
+ address: contract,
109
+ abi: seriesCodeAbi,
110
+ functionName: 'paramHooks',
111
+ args: [],
112
+ }));
113
+ return { configureHook, augmentHook, transferHook };
114
+ }
115
+ catch {
116
+ return null;
117
+ }
118
+ }
119
+ /** Does this token expose the enumeration surface at all? The one-call probe behind the repoint
120
+ * guard: the canonical generator reads params from chain, so pointing a token that lacks these
121
+ * getters at it makes every param silently invisible. */
122
+ export async function hasParamEnumeration(client, contract) {
123
+ try {
124
+ await client.readContract({ address: contract, abi: seriesCodeAbi, functionName: 'tokenParamKeys', args: [0n] });
125
+ return true;
126
+ }
127
+ catch {
128
+ return false;
129
+ }
130
+ }
131
+ // ── the chain-complete expectation (deploy-time, from the P1 dependency report) ──
132
+ /** What the deploy can honestly promise about the generator's template branch, derived from
133
+ * the selection-time dependency report (never a new RPC): chain-complete iff every registry
134
+ * dep has proven ON-CHAIN bytes (OnChain refs read their data contract directly, so they
135
+ * count as on-chain; `abx verify` is the from-chain confirmation either way). */
136
+ export function expectedChainComplete(deps, checks) {
137
+ if (deps.length === 0)
138
+ return { expected: true, detail: 'no dependencies — the document assembles from the script chunks alone' };
139
+ const registryDeps = deps.filter((d) => d.resolution === DEP_RESOLUTION.registry);
140
+ if (registryDeps.length === 0) {
141
+ return { expected: true, detail: 'all dependencies are on-chain data contracts (read directly)' };
142
+ }
143
+ const byDep = new Map(checks.map((c) => [c.dep, c]));
144
+ const cdnOnly = [];
145
+ const missing = [];
146
+ let unknown = false;
147
+ for (const d of registryDeps) {
148
+ const chk = byDep.get(d.display);
149
+ if (!chk || chk.status === 'skipped')
150
+ unknown = true;
151
+ else if (chk.status === 'not-found')
152
+ missing.push(d.display);
153
+ else if (!chk.details.availableOnChain)
154
+ cdnOnly.push(d.display);
155
+ }
156
+ if (missing.length)
157
+ return { expected: false, detail: `${missing.join(', ')} not on the registry — the generator will emit an unresolved marker` };
158
+ if (cdnOnly.length)
159
+ return { expected: false, detail: `${cdnOnly.join(', ')} CDN-served (the normal production path) — serves fine, NOT chain-complete` };
160
+ if (unknown)
161
+ return { expected: null, detail: 'registry check was skipped (RPC unreachable) — `abx verify` reads the truth from chain' };
162
+ return { expected: true, detail: 'every dependency has ON-CHAIN bytes — no server, gateway, or CDN in the graph' };
163
+ }
164
+ // ── verify: the honesty reads (`onChainStatus` + a tokenURI probe) ─────────────
165
+ /** The generator this project's on-chain lane actually uses: the collection `animation_url`
166
+ * field's `renderer` value when set (that address is what the metadata renderer staticcalls),
167
+ * else the chain's canonical generator. Null when neither exists. */
168
+ export function generatorFor(state, override) {
169
+ const field = state.collectionFields.find((f) => f.field === F.animationUrl && f.representation === R.renderer);
170
+ if (field) {
171
+ try {
172
+ return decodeFieldRenderer(field.value);
173
+ }
174
+ catch {
175
+ /* malformed value — fall through to the manifest */
176
+ }
177
+ }
178
+ return resolveGenerator(state.chainId, override) ?? null;
179
+ }
180
+ /** Whether verify should run the on-chain-URI report: the tokenURIRenderer toggle is on, or
181
+ * the collection `animation` field points at a field renderer (the generator). */
182
+ export function hasOnChainUriLane(state) {
183
+ const rendererSet = !!state.tokenURIRenderer && state.tokenURIRenderer !== zeroAddress;
184
+ const animationRenderer = state.collectionFields.some((f) => f.field === F.animationUrl && f.representation === R.renderer);
185
+ return rendererSet || animationRenderer;
186
+ }
187
+ const erc721TokenUriAbi = [
188
+ {
189
+ type: 'function',
190
+ name: 'tokenURI',
191
+ stateMutability: 'view',
192
+ inputs: [{ name: 'id', type: 'uint256' }],
193
+ outputs: [{ name: '', type: 'string' }],
194
+ },
195
+ ];
196
+ /** The three ERC-1155 members of the `contractType` ladder — the ones that expose `uri(id)` instead
197
+ * of `tokenURI(id)`. Kept as a set so adding a token family is one edit, not a string-shape guess. */
198
+ const EDITION_CONTRACT_TYPES = new Set(['1of1-edition', 'edition', 'edition-code']);
199
+ /** The 1155 twin of the probe above. An edition exposes `uri(id)`, NOT `tokenURI(id)` — probing a
200
+ * 721 selector on an edition reverts, which surfaced as `verify` reporting "on-chain URI check
201
+ * unavailable" (plus a raw viem dump) for EVERY edition. Mirrors `reconstruct.ts`'s uriAbi/uriFn. */
202
+ const erc1155UriAbi = [
203
+ {
204
+ type: 'function',
205
+ name: 'uri',
206
+ stateMutability: 'view',
207
+ inputs: [{ name: 'id', type: 'uint256' }],
208
+ outputs: [{ name: '', type: 'string' }],
209
+ },
210
+ ];
211
+ /** An HTML comment marker the generator emits on degradation (`<!-- abx:… -->`), or null. */
212
+ function degradationMarker(html) {
213
+ const m = /<!--\s*abx:[^>]*-->/.exec(html);
214
+ return m ? m[0] : null;
215
+ }
216
+ function probeAnimation(animationUrl) {
217
+ if (!animationUrl)
218
+ return { form: 'missing' };
219
+ const parsed = parseDataUri(animationUrl);
220
+ if (parsed && parsed.mime === 'text/html' && parsed.base64) {
221
+ const bytes = base64ToBytes(parsed.body);
222
+ const html = new TextDecoder().decode(bytes);
223
+ return { form: 'data-html', bytes: bytes.length, marker: degradationMarker(html) };
224
+ }
225
+ if (animationUrl.startsWith('data:'))
226
+ return { form: 'data-other', prefix: animationUrl.slice(0, 40) };
227
+ return { form: 'url', url: animationUrl };
228
+ }
229
+ /**
230
+ * The verify-time on-chain-URI report: `generator.onChainStatus(token)` (branch ·
231
+ * chain-completeness · unresolved refs · URL budget) plus a `tokenURI` probe of the lowest
232
+ * minted token — decoded, with the `animation_url` form checked against the branch.
233
+ */
234
+ export async function onChainUriReport(client, state, generatorOverride) {
235
+ const generator = generatorFor(state, generatorOverride);
236
+ if (!generator) {
237
+ throw new Error(`no AbxGenerator known for chain ${state.chainId} — set ABX_GENERATOR=0x… (or update @artblocks/abx-sdk's deployments manifest)`);
238
+ }
239
+ const status = await readGeneratorStatus(client, generator, state.address);
240
+ // LIVE tokens only, and the reason is sharper than tidiness: this probe reads the LOWEST id it
241
+ // finds, and `tokenURI` reverts `NonexistentToken` for a burned one. Burned ids must not make the
242
+ // collection's on-chain-URI lane report as broken.
243
+ const minted = state.tokens.filter((t) => t.lifecycle === 'live').map((t) => BigInt(t.tokenId));
244
+ let probe = null;
245
+ if (minted.length) {
246
+ const tokenId = minted.reduce((a, b) => (b < a ? b : a));
247
+ const isEdition = EDITION_CONTRACT_TYPES.has(state.contractType ?? '');
248
+ const uri = (await client.readContract({
249
+ address: state.address,
250
+ abi: isEdition ? erc1155UriAbi : erc721TokenUriAbi,
251
+ functionName: isEdition ? 'uri' : 'tokenURI',
252
+ args: [tokenId],
253
+ }));
254
+ const parsed = parseDataUri(uri);
255
+ const isOnChainJson = !!parsed && parsed.mime === 'application/json' && parsed.base64;
256
+ let animation = { form: 'missing' };
257
+ if (parsed && isOnChainJson) {
258
+ try {
259
+ const json = JSON.parse(new TextDecoder().decode(base64ToBytes(parsed.body)));
260
+ animation = probeAnimation(typeof json.animation_url === 'string' ? json.animation_url : undefined);
261
+ }
262
+ catch {
263
+ /* undecodable JSON — reported as onChainJson with a missing animation */
264
+ }
265
+ }
266
+ probe = {
267
+ tokenId: tokenId.toString(),
268
+ accessor: isEdition ? 'uri' : 'tokenURI',
269
+ onChainJson: isOnChainJson,
270
+ uriPrefix: uri.slice(0, 48),
271
+ animation,
272
+ };
273
+ }
274
+ return { generator, status, probe };
275
+ }
276
+ //# sourceMappingURL=onchain-uri.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onchain-uri.js","sourceRoot":"","sources":["../src/onchain-uri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAyB,MAAM,MAAM,CAAC;AAC7E,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,cAAc,IAAI,CAAC,EAAE,uBAAuB,IAAI,CAAC,EAAC,MAAM,YAAY,CAAC;AACnG,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,mBAAmB,EAAiD,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,cAAc,EAA0C,MAAM,WAAW,CAAC;AAElF,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAqD;IACxF,MAAM,KAAK,GAAU,EAAE,CAAC;IACxB,6FAA6F;IAC7F,iGAAiG;IACjG,4FAA4F;IAC5F,qGAAqG;IACrG,mEAAmE;IACnE,IAAI,IAAI,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CACR,kBAAkB,CAAC;YACjB,GAAG,EAAE,aAAa;YAClB,YAAY,EAAE,kBAAkB;YAChC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC9F,CAAC,CACH,CAAC;IACJ,C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