@artblocks/abx-sdk 0.1.0-alpha.9 → 0.2.0

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 (171) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/README.md +130 -0
  3. package/dist/abi/generated.d.ts +7942 -142
  4. package/dist/abi/generated.d.ts.map +1 -1
  5. package/dist/abi/generated.js +41 -23
  6. package/dist/abi/generated.js.map +1 -1
  7. package/dist/abi/index.d.ts +2364 -84
  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 +329 -0
  12. package/dist/anchors.d.ts.map +1 -0
  13. package/dist/anchors.js +744 -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 +23 -11
  21. package/dist/chains.d.ts.map +1 -1
  22. package/dist/chains.js +51 -19
  23. package/dist/chains.js.map +1 -1
  24. package/dist/chunks.d.ts +130 -32
  25. package/dist/chunks.d.ts.map +1 -1
  26. package/dist/chunks.js +140 -15
  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 +88 -1
  38. package/dist/create2.d.ts.map +1 -1
  39. package/dist/create2.js +174 -4
  40. package/dist/create2.js.map +1 -1
  41. package/dist/creator-token.d.ts +75 -8
  42. package/dist/creator-token.d.ts.map +1 -1
  43. package/dist/creator-token.js +98 -8
  44. package/dist/creator-token.js.map +1 -1
  45. package/dist/creators-service.d.ts +79 -0
  46. package/dist/creators-service.d.ts.map +1 -0
  47. package/dist/creators-service.js +171 -0
  48. package/dist/creators-service.js.map +1 -0
  49. package/dist/deploy.d.ts +224 -14
  50. package/dist/deploy.d.ts.map +1 -1
  51. package/dist/deploy.js +289 -111
  52. package/dist/deploy.js.map +1 -1
  53. package/dist/deployments.d.ts +38 -5
  54. package/dist/deployments.d.ts.map +1 -1
  55. package/dist/deployments.js +158 -45
  56. package/dist/deployments.js.map +1 -1
  57. package/dist/deps.d.ts +123 -6
  58. package/dist/deps.d.ts.map +1 -1
  59. package/dist/deps.js +249 -7
  60. package/dist/deps.js.map +1 -1
  61. package/dist/env.d.ts +5 -4
  62. package/dist/env.d.ts.map +1 -1
  63. package/dist/env.js +20 -5
  64. package/dist/env.js.map +1 -1
  65. package/dist/errors.d.ts +109 -0
  66. package/dist/errors.d.ts.map +1 -0
  67. package/dist/errors.js +148 -0
  68. package/dist/errors.js.map +1 -0
  69. package/dist/execute.d.ts +118 -0
  70. package/dist/execute.d.ts.map +1 -0
  71. package/dist/execute.js +159 -0
  72. package/dist/execute.js.map +1 -0
  73. package/dist/gateways.d.ts +79 -0
  74. package/dist/gateways.d.ts.map +1 -0
  75. package/dist/gateways.js +156 -0
  76. package/dist/gateways.js.map +1 -0
  77. package/dist/generator-document.d.ts +57 -0
  78. package/dist/generator-document.d.ts.map +1 -0
  79. package/dist/generator-document.js +123 -0
  80. package/dist/generator-document.js.map +1 -0
  81. package/dist/generator.d.ts +45 -3
  82. package/dist/generator.d.ts.map +1 -1
  83. package/dist/generator.js +29 -0
  84. package/dist/generator.js.map +1 -1
  85. package/dist/image-type.d.ts +14 -0
  86. package/dist/image-type.d.ts.map +1 -0
  87. package/dist/image-type.js +41 -0
  88. package/dist/image-type.js.map +1 -0
  89. package/dist/index.d.ts +20 -3
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +20 -3
  92. package/dist/index.js.map +1 -1
  93. package/dist/inspect.d.ts +48 -0
  94. package/dist/inspect.d.ts.map +1 -0
  95. package/dist/inspect.js +295 -0
  96. package/dist/inspect.js.map +1 -0
  97. package/dist/migrate.d.ts +41 -0
  98. package/dist/migrate.d.ts.map +1 -0
  99. package/dist/migrate.js +142 -0
  100. package/dist/migrate.js.map +1 -0
  101. package/dist/mime.d.ts +11 -0
  102. package/dist/mime.d.ts.map +1 -0
  103. package/dist/mime.js +40 -0
  104. package/dist/mime.js.map +1 -0
  105. package/dist/node.d.ts +69 -0
  106. package/dist/node.d.ts.map +1 -0
  107. package/dist/node.js +92 -0
  108. package/dist/node.js.map +1 -0
  109. package/dist/onchain-uri.d.ts +110 -0
  110. package/dist/onchain-uri.d.ts.map +1 -0
  111. package/dist/onchain-uri.js +276 -0
  112. package/dist/onchain-uri.js.map +1 -0
  113. package/dist/ops.d.ts +437 -13
  114. package/dist/ops.d.ts.map +1 -1
  115. package/dist/ops.js +754 -34
  116. package/dist/ops.js.map +1 -1
  117. package/dist/policy.d.ts +57 -0
  118. package/dist/policy.d.ts.map +1 -0
  119. package/dist/policy.js +35 -0
  120. package/dist/policy.js.map +1 -0
  121. package/dist/probe.d.ts +58 -0
  122. package/dist/probe.d.ts.map +1 -1
  123. package/dist/probe.js +190 -9
  124. package/dist/probe.js.map +1 -1
  125. package/dist/reconstruct.d.ts +135 -8
  126. package/dist/reconstruct.d.ts.map +1 -1
  127. package/dist/reconstruct.js +400 -84
  128. package/dist/reconstruct.js.map +1 -1
  129. package/dist/resume.d.ts +147 -0
  130. package/dist/resume.d.ts.map +1 -0
  131. package/dist/resume.js +146 -0
  132. package/dist/resume.js.map +1 -0
  133. package/dist/script-chunks.d.ts +105 -0
  134. package/dist/script-chunks.d.ts.map +1 -0
  135. package/dist/script-chunks.js +158 -0
  136. package/dist/script-chunks.js.map +1 -0
  137. package/dist/service.d.ts +172 -7
  138. package/dist/service.d.ts.map +1 -1
  139. package/dist/service.js +132 -10
  140. package/dist/service.js.map +1 -1
  141. package/dist/spine.d.ts +48 -4
  142. package/dist/spine.d.ts.map +1 -1
  143. package/dist/spine.js +0 -0
  144. package/dist/spine.js.map +1 -1
  145. package/dist/staging.d.ts +139 -0
  146. package/dist/staging.d.ts.map +1 -0
  147. package/dist/staging.js +139 -0
  148. package/dist/staging.js.map +1 -0
  149. package/dist/token.d.ts +11 -1
  150. package/dist/token.d.ts.map +1 -1
  151. package/dist/token.js +32 -1
  152. package/dist/token.js.map +1 -1
  153. package/dist/tokendata.d.ts +4 -4
  154. package/dist/tokendata.d.ts.map +1 -1
  155. package/dist/tokendata.js +28 -9
  156. package/dist/tokendata.js.map +1 -1
  157. package/dist/tokens.d.ts +74 -9
  158. package/dist/tokens.d.ts.map +1 -1
  159. package/dist/tokens.js +175 -5
  160. package/dist/tokens.js.map +1 -1
  161. package/dist/types.d.ts +107 -5
  162. package/dist/types.d.ts.map +1 -1
  163. package/dist/uri-lock.d.ts +17 -0
  164. package/dist/uri-lock.d.ts.map +1 -0
  165. package/dist/uri-lock.js +33 -0
  166. package/dist/uri-lock.js.map +1 -0
  167. package/dist/util.d.ts +74 -0
  168. package/dist/util.d.ts.map +1 -0
  169. package/dist/util.js +106 -0
  170. package/dist/util.js.map +1 -0
  171. package/package.json +15 -6
@@ -0,0 +1,139 @@
1
+ import { ensureChunkStore, planChunks, planContentTxs, stageContent } from './chunks.js';
2
+ import { encodeReader } from './token.js';
3
+ import { METADATA_REPRESENTATION as R } from './spine.js';
4
+ // ── Two independent costs, and the one that binds is the READ ────────────────
5
+ //
6
+ // WRITE cost is ~200 gas/byte (SSTORE2 code deposit) + per-chunk tx overhead, paid once by the
7
+ // creator. Past these soft limits, off-chain (Arweave pay-once, or a hosted resolver + IPFS) is FAR
8
+ // cheaper — on-chain's remaining edge is self-resolution, not cost. Per-file limit ≈ one 22 KB
9
+ // storage chunk; project limit caps the whole collection's write gas. Neither says anything about
10
+ // whether the result can be READ.
11
+ export const ONCHAIN_IMAGE_SOFT_LIMIT = 24 * 1024; // per file
12
+ export const ONCHAIN_PROJECT_SOFT_LIMIT = 256 * 1024; // whole collection, WRITE cost only
13
+ /** Whether `bytesLen` is past the point where on-chain storage stops being the cost-sane choice to
14
+ * WRITE. Says nothing about readability — that's {@link classifyOnchainReadSize}. */
15
+ export function exceedsOnchainSoftLimit(bytesLen) {
16
+ return bytesLen > ONCHAIN_IMAGE_SOFT_LIMIT;
17
+ }
18
+ // READ cost is the constraint nobody sees coming, and it is the one that decides whether a
19
+ // marketplace, an indexer, or another contract can see the token at all. The renderer assembles the
20
+ // whole document on every `tokenURI` call, and that cost is **superlinear**: EVM memory expansion
21
+ // carries a quadratic term, and the chunk store's `read()` concatenates chunk by chunk. So there is
22
+ // no honest flat "gas per KB" — the rate itself climbs with size.
23
+ //
24
+ // Measured (`forge`, `OneOfOneImage` + `AbxMetadataRenderer`, callee execution gas for one
25
+ // `tokenURI` call — no caller-side returndata copy, which a node serving `eth_call` doesn't pay
26
+ // either; `reader` = the representation `--onchain-image` produces, 22,000-byte chunks):
27
+ //
28
+ // content tokenURI gas per KB content tokenURI gas per KB
29
+ // 3 KB 1,123,327 374,000 100 KB 40,254,159 403,000
30
+ // 10 KB 3,588,993 359,000 128 KB 53,559,735 418,000
31
+ // 23 KB 8,346,220 363,000 187 KB 86,021,071 460,000
32
+ // 40 KB 14,740,366 369,000 256 KB 131,269,134 513,000
33
+ // 50 KB 18,759,333 375,000
34
+ // 75 KB 29,137,215 388,000
35
+ // 90 KB 35,868,124 399,000
36
+ //
37
+ // So: **~360,000–405,000 gas per KB across the 10–100 KB range that matters, climbing past that**
38
+ // (~460,000/KB at 187 KB, ~510,000/KB at 256 KB). The 3 KB row is higher per KB because the JSON
39
+ // wrapper is a fixed cost the content hasn't yet dwarfed.
40
+ //
41
+ // `inline` and `reader` agree within ~1% up to 75 KB — the cost is the renderer's own string
42
+ // building, not the storage mechanism, which is why `--compress fastlz` makes a field cheaper to
43
+ // WRITE and not one gas cheaper to read. They diverge above that (reader 1.8% dearer at 90 KB, 2.4%
44
+ // at 128 KB, 5.5% at 187 KB, 9.6% at 256 KB) because the store's read loop is quadratic in chunk
45
+ // count.
46
+ //
47
+ // Readability is a property of the endpoint, not the chain, so `probeEthCallGasCap` measures it.
48
+ // Do not conflate the `eth_call` cap with either the block gas limit or `eth_estimateGas` allowance.
49
+ // There is no fixed-size refusal: the toolkit reports the estimated cost and measured endpoint cap.
50
+ /** Measured `tokenURI` gas per KB at the BOTTOM of the readable range (10 KB). The rate is not
51
+ * flat — see the note above, and use {@link tokenUriGasEstimate} for a figure at a given size. */
52
+ export const TOKEN_URI_GAS_PER_KB_LOW = 360_000;
53
+ /** Measured `tokenURI` gas per KB at the TOP of the readable range (100 KB). Past that the rate
54
+ * keeps climbing (~460,000/KB at 187 KB), so this is a range endpoint, not a ceiling. */
55
+ export const TOKEN_URI_GAS_PER_KB_HIGH = 405_000;
56
+ /** From here up, the read is worth NAMING a number for (~15M gas at 40 KB) — a note about cost, not
57
+ * a statement about whether the token can be read. Every endpoint measured serves well past this. */
58
+ export const ONCHAIN_READ_WARN_BYTES = 40 * 1024;
59
+ /**
60
+ * Conservative `eth_call` reference based on geth's default `--rpc.gascap`. It is a floor, not a
61
+ * ceiling. Use {@link probeEthCallGasCap} to learn what the configured endpoint actually serves.
62
+ */
63
+ export const ETH_CALL_GAS_FLOOR = 50_000_000;
64
+ /**
65
+ * Rough `tokenURI` gas for `bytesLen` of on-chain content — orientation, not a quote.
66
+ *
67
+ * Fitted to the measurements above as `350,000·KB + 650·KB²`: within ~3% of measured from 10 KB to
68
+ * 256 KB, and slightly high rather than low, which is the right direction for a number a creator
69
+ * plans against. A flat per-KB rate was wrong at both ends — it overstated a 10 KB read by ~30% and
70
+ * understated a 256 KB one by ~10%.
71
+ */
72
+ export function tokenUriGasEstimate(bytesLen) {
73
+ const kb = bytesLen / 1024;
74
+ return Math.round(kb * 350_000 + kb * kb * 650);
75
+ }
76
+ /** How much on-chain content a node with `gasCap` can serve in one `tokenURI` — the inverse of
77
+ * {@link tokenUriGasEstimate}, solved for bytes. Orientation, same ~3% fit. */
78
+ export function readableBytesAtGas(gasCap) {
79
+ // 650·KB² + 350,000·KB − gasCap = 0
80
+ const kb = (-350_000 + Math.sqrt(350_000 ** 2 + 4 * 650 * gasCap)) / (2 * 650);
81
+ return Math.max(0, Math.round(kb * 1024));
82
+ }
83
+ /**
84
+ * Classify `bytesLen` of on-chain content by who can READ the token carrying it.
85
+ *
86
+ * `capGas` is the caller's measured `eth_call` allowance ({@link probeEthCallGasCap}); pass `null`
87
+ * or omit it when it could not be measured, and the verdict degrades to the two bands that do not
88
+ * need it. Kept in the SDK so the SDK and the CLI cannot disagree about the boundary.
89
+ */
90
+ export function classifyOnchainReadSize(bytesLen, capGas) {
91
+ const gas = tokenUriGasEstimate(bytesLen);
92
+ if (gas <= ETH_CALL_GAS_FLOOR)
93
+ return 'ok';
94
+ if (capGas != null && gas > capGas)
95
+ return 'beyond-local-rpc';
96
+ return 'endpoint-dependent';
97
+ }
98
+ /**
99
+ * Pure staging plan for a piece of content — chunk count + transaction shape — with NO chain
100
+ * writes, no signer, no `ensureChunkStore`. Shared by {@link stageFieldContent} (which then
101
+ * actually stages) and a dry-run preview, so the count a human is told up front is the same one
102
+ * real staging produces. `content` must already be in its final pre-chunking form — gzipped when
103
+ * `compress === 'gzip'` (see the module doc for why that step isn't here). `chunkSize` defaults to
104
+ * {@link planChunks}'s default (currently 22 KB), so e.g. a 2.8 KB SVG is 1 chunk.
105
+ */
106
+ export function planStagedContent(content, compress) {
107
+ const fastlz = compress === 'fastlz';
108
+ const planned = planChunks(content, { fastlz });
109
+ const plan = planContentTxs(planned);
110
+ const representation = compress === 'gzip' ? R.readerGzip : R.reader;
111
+ const stagedBytes = planned.reduce((n, c) => n + c.data.length, 0);
112
+ return { content, fastlz, chunks: planned.length, stagedBytes, plan, representation };
113
+ }
114
+ /**
115
+ * Put `content` on-chain as SSTORE2 chunks behind the shared reader, and return the field's
116
+ * `(representation, value)`. `fastlz` compresses per chunk (reader decodes on read → stays
117
+ * on-chain renderable); `gzip` compresses the whole content (off-chain decode → the
118
+ * `reader-gzip` representation, not on-chain renderable).
119
+ *
120
+ * Staging is one atomic `writeContent` (content fits a single tx's gas) or gas-bounded chunk-write
121
+ * `multicall`s plus a final manifest write — {@link stageContent} picks. These store writes use
122
+ * `send` (typically the env key on the hot lane, or the connected wallet on the wallet lane) — the
123
+ * data contracts are ownerless, so any funded signer may write them; the caller signs the field-set
124
+ * that references the manifest separately.
125
+ */
126
+ export async function stageFieldContent(args) {
127
+ const notify = args.onEvent ?? (() => { });
128
+ const p = planStagedContent(args.content, args.compress);
129
+ const resolvedStore = args.store ??
130
+ (await ensureChunkStore(args.publicClient, args.send, {
131
+ chainId: args.chainId,
132
+ onEvent: (e) => notify({ kind: 'chunk-store', event: e }),
133
+ }));
134
+ notify({ kind: 'planned', field: args.field, store: resolvedStore, contentPlan: p });
135
+ const { manifest, txHashes } = await stageContent(args.send, { store: resolvedStore, content: p.content, fastlz: p.fastlz, chainId: args.chainId });
136
+ notify({ kind: 'staged', field: args.field, manifest, txHashes });
137
+ return { value: encodeReader(resolvedStore, manifest), representation: p.representation };
138
+ }
139
+ //# sourceMappingURL=staging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staging.js","sourceRoot":"","sources":["../src/staging.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAA2C,MAAM,aAAa,CAAC;AACjI,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,uBAAuB,IAAI,CAAC,EAAC,MAAM,YAAY,CAAC;AAuBxD,gFAAgF;AAChF,EAAE;AACF,+FAA+F;AAC/F,oGAAoG;AACpG,+FAA+F;AAC/F,kGAAkG;AAClG,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,CAAC,C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token.d.ts CHANGED
@@ -15,6 +15,16 @@ export declare function verifyAgainstHash(bytes: Uint8Array | string, field: Met
15
15
  * Decode a `reader` field value → `(reader, pointer)` addresses. Content is then
16
16
  * obtained on-chain by `IAbxOnChainReader(reader).read(pointer)` (an `eth_call`). The
17
17
  * reader encapsulates storage + on-chain decoding; this just unpacks the two addresses.
18
+ *
19
+ * Requires the CANONICAL `abi.encode(address reader, address pointer)` shape: exactly two
20
+ * 32-byte words, each zero-padded in its leading 12 bytes. `decodeAbiParameters` alone is
21
+ * too permissive to use as the only gate here — it happily reads an `address` out of a word
22
+ * with non-zero padding, and it ignores any bytes beyond the words a type list needs, so a
23
+ * truncated-then-repadded, trailing-garbage, or double-encoded (e.g. `abi.encode(bytes)`
24
+ * wrapping a reader pair) value can decode into a plausible but wrong address pair instead
25
+ * of failing. Because the decoded `reader` address is then `eth_call`'d directly (see
26
+ * `resolveFieldBytes` in token-api), a silent mis-decode here is a wrong-contract call, not
27
+ * a cosmetic bug — so this checks shape and padding itself before trusting the ABI decode.
18
28
  */
19
29
  export declare function decodeReader(value: Hex): {
20
30
  reader: Address;
@@ -24,7 +34,7 @@ export declare function decodeReader(value: Hex): {
24
34
  export declare function encodeReader(reader: Address, pointer: Address): Hex;
25
35
  /**
26
36
  * Encode a `renderer` field value — `abi.encode(address fieldRenderer)` (the representations
27
- * table, specs/protocol/onchain-metadata.md). Content is COMPUTED at read: the metadata
37
+ * table, site/content/docs/protocol/metadata.mdx). Content is COMPUTED at read: the metadata
28
38
  * renderer (and the off-chain resolver) staticcall `render(token, tokenId, field)` on it.
29
39
  */
30
40
  export declare function encodeFieldRenderer(fieldRenderer: Address): Hex;
@@ -1 +1 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAC,aAAa,EAAE,YAAY,EAAE,UAAU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E,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,CAG1F;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAExF;AAED,wBAAgB,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAEzD;AAID,oDAAoD;AACpD,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAMvD;AAED,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAE5D;AAED,8GAA8G;AAC9G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI,CAKlG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CA4B5E;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,GAAG,CAInE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,OAAO,GAAG,GAAG,CAE/D;AAED,+FAA+F;AAC/F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAGvD"}
package/dist/token.js CHANGED
@@ -39,8 +39,39 @@ export function verifyAgainstHash(bytes, field) {
39
39
  * Decode a `reader` field value → `(reader, pointer)` addresses. Content is then
40
40
  * obtained on-chain by `IAbxOnChainReader(reader).read(pointer)` (an `eth_call`). The
41
41
  * reader encapsulates storage + on-chain decoding; this just unpacks the two addresses.
42
+ *
43
+ * Requires the CANONICAL `abi.encode(address reader, address pointer)` shape: exactly two
44
+ * 32-byte words, each zero-padded in its leading 12 bytes. `decodeAbiParameters` alone is
45
+ * too permissive to use as the only gate here — it happily reads an `address` out of a word
46
+ * with non-zero padding, and it ignores any bytes beyond the words a type list needs, so a
47
+ * truncated-then-repadded, trailing-garbage, or double-encoded (e.g. `abi.encode(bytes)`
48
+ * wrapping a reader pair) value can decode into a plausible but wrong address pair instead
49
+ * of failing. Because the decoded `reader` address is then `eth_call`'d directly (see
50
+ * `resolveFieldBytes` in token-api), a silent mis-decode here is a wrong-contract call, not
51
+ * a cosmetic bug — so this checks shape and padding itself before trusting the ABI decode.
42
52
  */
43
53
  export function decodeReader(value) {
54
+ const hex = value.slice(2);
55
+ const WORD_HEX_LEN = 64; // one 32-byte ABI word, as hex chars
56
+ const EXPECTED_HEX_LEN = WORD_HEX_LEN * 2; // exactly two words: (address reader, address pointer)
57
+ if (hex.length !== EXPECTED_HEX_LEN) {
58
+ throw new Error(`decodeReader: expected exactly two 32-byte ABI words (abi.encode(address reader, address ` +
59
+ `pointer) — ${EXPECTED_HEX_LEN / 2} bytes), received ${hex.length / 2} bytes (${value}). This ` +
60
+ `looks like a truncated, trailing-byte, or double-encoded value; only output from ` +
61
+ `encodeReader() is accepted.`);
62
+ }
63
+ const ZERO_PAD = '0'.repeat(24); // the 12 zero bytes a canonical address word pads with
64
+ const words = [
65
+ ['reader', hex.slice(0, WORD_HEX_LEN)],
66
+ ['pointer', hex.slice(WORD_HEX_LEN, WORD_HEX_LEN * 2)],
67
+ ];
68
+ for (const [name, word] of words) {
69
+ if (!word.startsWith(ZERO_PAD)) {
70
+ throw new Error(`decodeReader: ${name} word is not canonically zero-padded — expected its leading 12 bytes ` +
71
+ `to be zero, received 0x${word}. A non-zero-padded address word is not produced by ` +
72
+ `encodeReader() and is rejected as a non-canonical encoding.`);
73
+ }
74
+ }
44
75
  const [reader, pointer] = decodeAbiParameters([{ type: 'address' }, { type: 'address' }], value);
45
76
  return { reader, pointer };
46
77
  }
@@ -52,7 +83,7 @@ export function encodeReader(reader, pointer) {
52
83
  }
53
84
  /**
54
85
  * Encode a `renderer` field value — `abi.encode(address fieldRenderer)` (the representations
55
- * table, specs/protocol/onchain-metadata.md). Content is COMPUTED at read: the metadata
86
+ * table, site/content/docs/protocol/metadata.mdx). Content is COMPUTED at read: the metadata
56
87
  * renderer (and the off-chain resolver) staticcall `render(token, tokenId, field)` on it.
57
88
  */
58
89
  export function encodeFieldRenderer(fieldRenderer) {
package/dist/token.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,WAAW,EACX,UAAU,EACV,mBAAmB,GAGpB,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,uBAAuB,IAAI,CAAC,EAAC,MAAM,YAAY,CAAC;AAGxD,qDAAqD;AACrD,MAAM,UAAU,SAAS,CAAC,KAAmB,EAAE,OAAwB;IACrE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC;AAC5D,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,OAAO,CAAC,MAAuB,EAAE,SAAiB;IAChE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,IAAI,IAAI,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,cAAsB;IAC9C,OAAO,cAAc,KAAK,CAAC,CAAC,MAAM,IAAI,cAAc,KAAK,CAAC,CAAC,MAAM,CAAC;AACpE,CAAC;AAED,gFAAgF;AAEhF,oDAAoD;AACpD,MAAM,UAAU,UAAU,CAAC,KAAoB;IAC7C,IAAI,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IACzE,OAAO,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAQ,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,aAAsB;IACxD,OAAO,CAAC,KAAK,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAQ,CAAC;AAChF,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,mBAAmB,CAAC,KAAU;IAC5C,MAAM,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,CAAC,EAAC,IAAI,EAAE,SAAS,EAAC,CAAC,EAAE,KAAK,CAAc,CAAC;IAChF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -2,7 +2,7 @@ import { type Address, type Hex, type PublicClient } from 'viem';
2
2
  import type { MetadataField, ParamSchema, ParamValue, ProjectState, TokenState } from './types.js';
3
3
  /**
4
4
  * The canonical `tokenData` assembly — the off-chain serializer the spec names as
5
- * authoritative (`specs/protocol/code-projects.md`). One flat object: the reserved
5
+ * authoritative (`site/content/docs/protocol/code-projects.mdx`). One flat object: the reserved
6
6
  * coordinates + every param (contract ∪ token scope, token wins) + the augment hook's
7
7
  * entries (augment wins per key), every value its canonical string (`chainId` alone is
8
8
  * a number). The serialization is canonical because it is *hashed*: an effect's
@@ -49,7 +49,7 @@ export declare function buildTokenData(client: PublicClient | null, state: Proje
49
49
  /** The canonical serialization: lexicographically sorted keys, compact JSON, UTF-8. */
50
50
  export declare function canonicalTokenDataJson(data: Record<string, string | number>): string;
51
51
  /**
52
- * The effect run identity (`specs/protocol/effects.md`):
52
+ * The effect run identity (`site/content/docs/protocol/effects.mdx`):
53
53
  * `keccak256(contentDigest ‖ canonical tokenData ‖ environmentId)`. Deterministic across
54
54
  * producers and consumers — the resolver computes the CURRENT hash and looks up exactly
55
55
  * that artifact, so a param change re-addresses output and stale renders are never served.
@@ -67,7 +67,7 @@ export declare function contentDigestOf(state: ProjectState): Hex | null;
67
67
  */
68
68
  export declare function renderArtifactKey(chainId: number, address: string, tokenId: string, hash: Hex, outputKey?: string, effectKey?: string): Hex;
69
69
  /**
70
- * The **bound** effect outputs — `specs/protocol/effects.md → Bound vs referenced`. An output is
70
+ * The **bound** effect outputs (`site/content/docs/protocol/effects.mdx#metadata-binding`). An output is
71
71
  * bound iff a binding stitches its *content* into the metadata JSON, which is what decides who holds
72
72
  * its bytes:
73
73
  *
@@ -97,7 +97,7 @@ export interface DecodedParam {
97
97
  value: string;
98
98
  /** A data-backed param's full content length in bytes; `null` for a literal, and for a blob
99
99
  * that didn't read (the value degraded to the hash). Callers that bound inline content —
100
- * the off-chain resolver's `abx_params`, mirroring the on-chain renderer's inline ceiling —
100
+ * the off-chain resolver's params handling (spec v8 removed the `abx_params` projection from both lanes), mirroring the renderer's former inline ceiling (removed with the projection) —
101
101
  * measure THIS, the same length the chain measures. */
102
102
  contentBytes: number | null;
103
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tokendata.d.ts","sourceRoot":"","sources":["../src/tokendata.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAC,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAEjG;;;;;;;;;;;;;GAaG;AAEH;;;sDAGsD;AACtD,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CAKvD,CAAC;AAMH,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACtC,+FAA+F;IAC/F,IAAI,EAAE,MAAM,CAAC;CACd;AAED,6FAA6F;AAC7F,wBAAgB,SA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GAAG,IAAI,EAC3B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,EACf,CAAC,EAAE,UAAU,EACb,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,YAAY,CAAC,CAsCvB"}
package/dist/tokendata.js CHANGED
@@ -1,9 +1,10 @@
1
- import { concat, hexToBytes, keccak256, parseAbi, stringToBytes, } from 'viem';
1
+ import { bytesToHex, concat, hexToBytes, keccak256, parseAbi, stringToBytes, } from 'viem';
2
2
  import { seriesCodeAbi } from './abi/index.js';
3
3
  import { decodeScalarParam } from './spine.js';
4
+ import { bytesToBase64 } from './util.js';
4
5
  /**
5
6
  * The canonical `tokenData` assembly — the off-chain serializer the spec names as
6
- * authoritative (`specs/protocol/code-projects.md`). One flat object: the reserved
7
+ * authoritative (`site/content/docs/protocol/code-projects.mdx`). One flat object: the reserved
7
8
  * coordinates + every param (contract ∪ token scope, token wins) + the augment hook's
8
9
  * entries (augment wins per key), every value its canonical string (`chainId` alone is
9
10
  * a number). The serialization is canonical because it is *hashed*: an effect's
@@ -69,8 +70,15 @@ export async function buildTokenData(client, state, token, opts = {}) {
69
70
  for (const p of token.params ?? [])
70
71
  merged.set(p.key, { p, tokenScope: true });
71
72
  for (const [key, { p, tokenScope }] of merged) {
72
- if (RESERVED_TOKEN_DATA_KEYS.has(key) && key !== 'seed')
73
- continue; // coordinates win
73
+ // Coordinates win. `seed` is the one reserved key allowed through — but only from TOKEN
74
+ // scope, matching the on-chain document exactly: `TokenDataLib.begin` reads
75
+ // `tokenParam(tokenId, "seed")` and never falls back to contract scope. Letting a
76
+ // contract-scope `seed` through here (the merged map holds both scopes) meant an unseeded
77
+ // token carried a seed off-chain that the on-chain generator did not have — the two lanes
78
+ // disagreeing about what a token's seed is, which is the one value they must agree on.
79
+ // Contract-scope `seed` remains settable on-chain by design; it simply is not a token's seed.
80
+ if (RESERVED_TOKEN_DATA_KEYS.has(key) && !(key === 'seed' && tokenScope))
81
+ continue;
74
82
  data[key] = (await decodeParam(client, state.address, token.tokenId, p, tokenScope, schemas.get(key))).value;
75
83
  }
76
84
  // augment hook — last, wins per key (except the reserved coordinates). Skipped for the
@@ -106,7 +114,7 @@ export function canonicalTokenDataJson(data) {
106
114
  return JSON.stringify(sorted);
107
115
  }
108
116
  /**
109
- * The effect run identity (`specs/protocol/effects.md`):
117
+ * The effect run identity (`site/content/docs/protocol/effects.mdx`):
110
118
  * `keccak256(contentDigest ‖ canonical tokenData ‖ environmentId)`. Deterministic across
111
119
  * producers and consumers — the resolver computes the CURRENT hash and looks up exactly
112
120
  * that artifact, so a param change re-addresses output and stale renders are never served.
@@ -137,7 +145,7 @@ export function renderArtifactKey(chainId, address, tokenId, hash, outputKey = '
137
145
  return keccak256(stringToBytes(`${chainId}/${address.toLowerCase()}/${tokenId}/${effectKey}/${hash}/${outputKey}`));
138
146
  }
139
147
  /**
140
- * The **bound** effect outputs — `specs/protocol/effects.md → Bound vs referenced`. An output is
148
+ * The **bound** effect outputs (`site/content/docs/protocol/effects.mdx#metadata-binding`). An output is
141
149
  * bound iff a binding stitches its *content* into the metadata JSON, which is what decides who holds
142
150
  * its bytes:
143
151
  *
@@ -171,8 +179,19 @@ export function isBoundOutput(effectKey, outputKey) {
171
179
  export async function decodeParam(client, token, tokenId, p, tokenScope, schema) {
172
180
  const literal = (value) => ({ value, contentBytes: null });
173
181
  if (!p.valueIsHash) {
182
+ // `seed`'s wire format is INVARIANT: always the raw 32-byte hex, schema or no schema. The
183
+ // on-chain side (`TokenDataLib.begin`) emits `toHexString(seed, 32)` unconditionally and never
184
+ // consults a schema, so consulting one here would fork the work. Concretely: a project that
185
+ // lets an authorized party choose the seed value declares a `seed` schema (typically
186
+ // `Uint256Range` — note this is "pick the value", not a re-roll: the caller supplies it), and this
187
+ // decode would then hand the work `"777"` where the on-chain generator hands it
188
+ // `"0x00…0309"` — the same token rendering differently depending on which surface served it.
189
+ // A `seed` schema governs WHO may write it and within what bounds; it does not change how it
190
+ // reads. Checked before the schema branch for exactly that reason.
191
+ if (p.key === 'seed')
192
+ return literal(p.value);
174
193
  if (!schema)
175
- return literal(p.key === 'seed' ? p.value : decodeTagLoose(p.value));
194
+ return literal(decodeTagLoose(p.value));
176
195
  if (schema.paramType === 'Select') {
177
196
  const idx = Number(BigInt(p.value));
178
197
  return literal(schema.selectOptions[idx] ?? String(idx));
@@ -192,7 +211,7 @@ export async function decodeParam(client, token, tokenId, p, tokenScope, schema)
192
211
  const bytes = hexToBytes(blob);
193
212
  const value = schema?.paramType === 'String'
194
213
  ? new TextDecoder().decode(bytes)
195
- : Buffer.from(bytes).toString('base64'); // Bytes + schema-less: base64 at read
214
+ : bytesToBase64(bytes); // Bytes + schema-less: base64 at read
196
215
  return { value, contentBytes: bytes.length };
197
216
  }
198
217
  catch {
@@ -216,6 +235,6 @@ function decodeBytes32Key(key) {
216
235
  function keyToBytes32(key) {
217
236
  const bytes = new Uint8Array(32);
218
237
  bytes.set(stringToBytes(key).slice(0, 32));
219
- return `0x${Buffer.from(bytes).toString('hex')}`;
238
+ return bytesToHex(bytes);
220
239
  }
221
240
  //# sourceMappingURL=tokendata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokendata.js","sourceRoot":"","sources":["../src/tokendata.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,QAAQ,EACR,aAAa,GAId,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAqB,MAAM,YAAY,CAAC;AAGjE;;;;;;;;;;;;;GAaG;AAEH;;;sDAGsD;AACtD,MAAM,CAAC,MAAM,wBAAwB,GAAwB,IAAI,GAAG,CAAC;IACnE,SAAS;IACT,iBAAiB;IACjB,SAAS;IACT,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,QAAQ,CAAC;IAC9B,0GAA0G;CAC3G,CA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AAG,CAAC,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,CAAC;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAClF,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7D,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAQ;IAChC,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
package/dist/tokens.d.ts CHANGED
@@ -1,12 +1,35 @@
1
1
  import { type Address, type Hex, type PublicClient } from 'viem';
2
2
  export interface TokenRow {
3
3
  tokenId: string;
4
- /**
5
- * `null` when `ownerOf` reverts. That is deliberately NOT reported as "not minted": an id past
6
- * the mint frontier and a **burned** id both revert identically, and a chain-only read cannot
7
- * tell them apart without the Transfer log it is the point of this path not to need.
8
- */
4
+ /** `null` when `ownerOf` reverts — see {@link lifecycle}, which says WHY it reverted whenever the
5
+ * chain gives enough evidence to tell. Always `null` on an ERC-1155 edition: an id can have many
6
+ * concurrent holders, and *which* holders is not chain-enumerable outside the event log (that's
7
+ * the indexer's job, not a head read). */
9
8
  owner: Address | null;
9
+ /**
10
+ * Does a token exist at this id right now — from head reads alone, no event log. The same words the
11
+ * fold uses ({@link TokenState.lifecycle}), plus `'unknown'` for the one case where a head read
12
+ * genuinely cannot say and the log can:
13
+ *
14
+ * - `'live'` — `ownerOf` answered (721), or `totalSupply(id) > 0` (edition).
15
+ * - `'burned'` — 721 only, terminal, and *decidable at head*: `nextTokenId` is a mint frontier that
16
+ * only ever rises, so an id BELOW it whose `ownerOf` reverts was minted and destroyed. A listing
17
+ * enumerates `0 … nextTokenId - 1`, so inside that range a revert IS a burn.
18
+ * - `'unminted'` — 721: at or past the frontier, never issued.
19
+ * - `'no-live-copies'` — editions: `totalSupply(id) == 0`. **The same word the fold uses for the
20
+ * same id**, deliberately: the fold could distinguish never-minted from fully-burned and does not,
21
+ * because the distinction has no consumer (the id can mint again either way). One field name, one
22
+ * value per id, whichever lane produced it.
23
+ * - `'unknown'` — a 1/1 exposes no `nextTokenId`, so a reverting `ownerOf` there is evidence of
24
+ * nothing: it is equally consistent with never-minted and with burned. The log settles it; a head
25
+ * read must not guess. This is the *only* remaining case, and it is why the word exists.
26
+ *
27
+ * The first draft had this lane answer `'unknown'` for an edition at zero while the fold answered
28
+ * `'burned'` for the same id — two values under one field name, which is the sibling-drift class
29
+ * this repo treats as a bug (see {@link TokenState.maxSupply}'s note). Splitting `'burned'` from
30
+ * `'no-live-copies'` is what makes the claim true instead of aspirational.
31
+ */
32
+ lifecycle: 'live' | 'burned' | 'unminted' | 'no-live-copies' | 'unknown';
10
33
  /**
11
34
  * The mint-time seed as the raw `bytes32` — exactly what `tokenData` carries. A schema is what
12
35
  * buys a human decode and `seed` deliberately has none, so raw hex IS its canonical form.
@@ -15,20 +38,62 @@ export interface TokenRow {
15
38
  seed: Hex | null;
16
39
  /**
17
40
  * Token-scope params, decoded to their canonical strings. Contract-scope params are listed once
18
- * on {@link TokenListing.contractParams} rather than repeated per row; the artwork sees
41
+ * on {@link TokenListing.contractParams} rather than repeated per row; the work sees
19
42
  * contract ∪ token with **token winning** (see `buildTokenData`, the canonical assembly).
20
43
  */
21
44
  params: Record<string, string>;
45
+ /** ERC-1155 editions only — this id's live supply (`totalSupply(id)`), as a decimal string.
46
+ * Absent on a 721 token. */
47
+ supply?: string;
48
+ /** ERC-1155 editions only — this id's current supply cap (`maxSupply(id)`; `"0"` reads as
49
+ * open/uncapped exactly like the contract's own convention). Absent on a 721 token. */
50
+ maxSupply?: string;
22
51
  }
52
+ /** What an edition id's cap actually means. `closed` is the state the on-chain getter cannot express
53
+ * (`maxSupply(id)` returns `0` for both "never capped" and "deliberately closed") — see
54
+ * {@link editionCapOf}. */
55
+ export type EditionCap = {
56
+ kind: 'open';
57
+ } | {
58
+ kind: 'capped';
59
+ cap: string;
60
+ } | {
61
+ kind: 'closed';
62
+ };
63
+ /**
64
+ * Read an edition id's cap without re-deriving the rule at each call site — the derivation this
65
+ * protocol got wrong twice, in opposite directions: the on-chain getter overloads `0`, and the
66
+ * event fold used to miss the collection default entirely.
67
+ *
68
+ * Pass a folded {@link TokenState} (from `reconstructProject`) to get all three states. Pass a
69
+ * head-read {@link TokenRow}, which has no `maxSupplyOverridden` because a state read cannot know
70
+ * it, and a `'0'` cap reads `open` — the documented on-chain convention, and the reason
71
+ * `IAbxEditionSupply` tells an integrator rendering a buy button to consult the log.
72
+ *
73
+ * `null` ⇒ no cap information at all (a 721 token, or a row from a projection written before
74
+ * `DefaultMaxSupplySet` was folded).
75
+ */
76
+ export declare function editionCapOf(token: {
77
+ maxSupply?: string;
78
+ maxSupplyOverridden?: boolean;
79
+ }): EditionCap | null;
23
80
  export interface TokenListing {
24
81
  chainId: number;
25
82
  address: Address;
26
83
  /** Ids `0 … nextTokenId - 1` have been minted at some point. `null` on a token type with no
27
- * sequential mint frontier (a 1/1, which is always just token 0). */
84
+ * sequential mint frontier — a 1/1 (always just token 0), or an ERC-1155 edition (ids are
85
+ * caller-named, not a cursor; see each row's own `supply`/`maxSupply` instead). */
28
86
  nextTokenId: number | null;
29
- /** Live supply (mints − burns) — differs from `nextTokenId` only if tokens were burned. */
87
+ /** Live supply (mints − burns) — differs from `nextTokenId` only if tokens were burned. `null`
88
+ * on an edition: there's no unconditional whole-contract total, only a per-id one (each row's
89
+ * `supply`). */
30
90
  totalSupply: number | null;
31
- maxInvocations: number | null;
91
+ /** How many tokens have been destroyed: `nextTokenId − totalSupply`, both of which the contract
92
+ * keeps (the frontier counts mints and never falls; the total counts live tokens). `null` when
93
+ * either is absent — a 1/1, or an edition, where burns are per id (each row's `supply`). */
94
+ burnedCount: number | null;
95
+ /** Exact uint256 value as a decimal string. Never narrowed through JavaScript `number`. */
96
+ maxInvocations: string | null;
32
97
  /**
33
98
  * Whether the contract exposes the params surface at all. `false` for the image token types
34
99
  * (they have no Params extension), in which case every row's `seed` is `null` and `params` is
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAC,MAAM,MAAM,CAAC;AA+B5E,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB;;;;OAIG;IACH,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB;0EACsE;IACtE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,2FAA2F;IAC3F,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;8FAC0F;IAC1F,mBAAmB,EAAE,OAAO,CAAC;IAC7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