@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
package/dist/chunks.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { type Address, type Hex, type PublicClient, type TransactionReceipt } from 'viem';
1
+ import { type Address, type Hex, type PublicClient } from 'viem';
2
+ import type { SendTx } from './execute.js';
2
3
  /**
3
4
  * Multi-chunk on-chain content — the off-chain side of {@link AbxChunkStore}.
4
5
  *
@@ -18,23 +19,12 @@ export interface PlannedChunk {
18
19
  compressed: boolean;
19
20
  }
20
21
  /**
21
- * One staging transaction, described in lane-agnostic terms: the SDK builds the calldata,
22
- * the caller decides how it's signed. The chunk-store writes are **ownerless**, so they can
23
- * be signed by any funded signer — the env key (hot lane) *or* a connected browser wallet
24
- * (wallet lane). Keeping the signer out of this module is what lets on-chain staging work
25
- * under every signing lane instead of assuming a hot key.
26
- *
27
- * `summary` + `fields` are surfaced to a human on the wallet sign page; `to: null` means a
28
- * contract creation (deploying the chunk store itself).
29
- */
30
- export interface StagingTx {
31
- to: Address | null;
32
- data: Hex;
33
- summary: string;
34
- fields: Record<string, string>;
35
- }
36
- /** Sign + broadcast one {@link StagingTx} and return its mined receipt (for event parsing). */
37
- export type SendStagingTx = (tx: StagingTx) => Promise<TransactionReceipt>;
22
+ * Chunk-store writes are staged in the SAME lane-agnostic terms as every other write: the SDK
23
+ * builds a {@link PreparedTx}, the caller decides how it's signed via a {@link SendTx}. These writes
24
+ * are **ownerless**, so they can be signed by any funded signer — the env key (hot lane) *or* a
25
+ * connected browser wallet (wallet lane). Keeping the signer out of this module is what lets
26
+ * on-chain staging work under every signing lane instead of assuming a hot key.
27
+ */
38
28
  /**
39
29
  * Split content into chunks, FastLZ-compressing each when `fastlz` is set (per-chunk — the
40
30
  * convention the store + reader expect). Pure: no chain, no I/O. A chunk is only stored
@@ -45,18 +35,64 @@ export declare function planChunks(content: Uint8Array, opts?: {
45
35
  chunkSize?: number;
46
36
  }): PlannedChunk[];
47
37
  /**
48
- * A per-transaction gas ceiling for packing chunk writes. Comfortably under mainnet's
49
- * ~30M block limit so a batch always fits with room for the base + calldata cost; the
50
- * planner splits content across multiple transactions to stay beneath it.
38
+ * A per-transaction gas ceiling for packing chunk writes; the planner splits content across
39
+ * multiple transactions to stay beneath it.
40
+ *
41
+ * **The binding constraint is `eth_estimateGas`, not the block gas limit.** Every send estimates
42
+ * first; a batch planned above the provider allowance fails before anything is sent.
43
+ *
44
+ * 8M leaves room for the base + calldata cost under that 16.7M ceiling. **Do not raise it toward a
45
+ * block limit.** If you raise it at all, measure the estimate allowance first — and note that these
46
+ * are third-party numbers that move.
51
47
  */
52
48
  export declare const DEFAULT_TX_GAS_BUDGET = 8000000;
53
49
  /**
54
- * Rough gas for writing one chunk as an SSTORE2 data contract: a fixed CREATE + base
55
- * overhead plus the code-deposit cost (~200 gas/byte) and calldata. Deliberately an
56
- * over-estimate so packed batches land safely inside {@link DEFAULT_TX_GAS_BUDGET};
57
- * the wallet still does the real `eth_estimateGas` before sending.
50
+ * Reference `eth_estimateGas` allowance — 2^24 — used to justify
51
+ * {@link DEFAULT_TX_GAS_BUDGET} against the limit that binds it rather than the block limit.
52
+ */
53
+ export declare const MEASURED_ESTIMATE_GAS_ALLOWANCE = 16777216;
54
+ /**
55
+ * Rough gas for writing `byteLength` bytes as an SSTORE2 data contract: a fixed CREATE + base
56
+ * overhead plus the code-deposit cost (~200 gas/byte) and calldata. Deliberately an over-estimate so
57
+ * packed batches land safely inside {@link DEFAULT_TX_GAS_BUDGET}; the wallet still does the real
58
+ * `eth_estimateGas` before sending. Takes a byte length directly (not a {@link PlannedChunk}) for a
59
+ * caller that already knows the size and has no content to allocate just to ask — a code project's
60
+ * on-chain SCRIPT chunk (`OnChainScript.setScriptChunk`, `contracts/src/libraries/AbxCodeLib.sol`) is
61
+ * the same SSTORE2 write as a content chunk, so it reuses this estimate rather than inventing a
62
+ * second one — see `commands/deploy.ts`'s code-setup transaction splitting.
58
63
  */
64
+ export declare function estimateChunkGasForBytes(byteLength: number): number;
65
+ /** {@link estimateChunkGasForBytes}, from a {@link PlannedChunk} already in hand. */
59
66
  export declare function estimateChunkGas(chunk: PlannedChunk): number;
67
+ /**
68
+ * Rough, deliberately-conservative gas for the code-project setup legs that are NOT raw content
69
+ * chunks — a `setParamSchema`, a `setDependency`/`setDependencyRegistry`, an on-chain-URI wiring
70
+ * call, a reserve `mint`. Unlike {@link estimateChunkGasForBytes} these are flat per-call estimates:
71
+ * none of them pays an EVM code-deposit, so their cost doesn't scale with a byte length. Shared by
72
+ * `commands/deploy.ts`'s fresh-deploy cost-guidance heuristic AND its setup-transaction gas-bounded
73
+ * batching, so the two can never disagree about what one of these calls costs.
74
+ */
75
+ export declare const SETUP_LEG_GAS: {
76
+ readonly schema: 45000;
77
+ readonly dependency: 55000;
78
+ readonly onchainUri: 60000;
79
+ readonly mint: 65000;
80
+ };
81
+ /**
82
+ * Pack arbitrary gas-costed items into gas-bounded batches, preserving order — the call-level
83
+ * sibling of {@link planContentTxs}'s own greedy bin-packing loop, generalized so a caller whose
84
+ * "chunk" is a setup CALL (a schema declare, a dependency pointer, a mint) rather than a content byte
85
+ * range can reuse the identical algorithm and budget instead of inventing a second one. Splits only
86
+ * BETWEEN items — an item whose own `.gas` alone exceeds `gasBudget` still rides alone in its own
87
+ * batch (that batch is simply over-budget, not necessarily over the harder `eth_estimateGas` ceiling
88
+ * — a caller that must refuse an indivisible-too-large leg checks {@link MEASURED_ESTIMATE_GAS_ALLOWANCE}
89
+ * itself, separately, BEFORE calling this).
90
+ */
91
+ export declare function packCallsByGas<T extends {
92
+ gas: number;
93
+ }>(items: readonly T[], opts?: {
94
+ gasBudget?: number;
95
+ }): T[][];
60
96
  /** How content will be written on-chain — one atomic tx, or several batched ones. */
61
97
  export type ContentTxPlan = {
62
98
  mode: 'single';
@@ -81,7 +117,9 @@ export declare function planContentTxs(chunks: PlannedChunk[], opts?: {
81
117
  * Deploy `AbxChunkStore` — the shared, stateless multi-chunk store + reader. Deploy once
82
118
  * per chain (like the renderer); every chunked field references it as its `reader`.
83
119
  */
84
- export declare function deployChunkStore(send: SendStagingTx): Promise<{
120
+ export declare function deployChunkStore(send: SendTx, opts: {
121
+ chainId: number;
122
+ }): Promise<{
85
123
  chunkStore: Address;
86
124
  txHash: Hex;
87
125
  blockNumber: bigint;
@@ -96,9 +134,10 @@ export declare function deployChunkStore(send: SendStagingTx): Promise<{
96
134
  */
97
135
  export declare function storeSupportsWriteContent(publicClient: PublicClient, store: Address): Promise<boolean>;
98
136
  /** Write one chunk as an SSTORE2 data contract; returns its address (from `ChunkWritten`). */
99
- export declare function writeChunk(send: SendStagingTx, args: {
137
+ export declare function writeChunk(send: SendTx, args: {
100
138
  store: Address;
101
139
  data: Uint8Array;
140
+ chainId: number;
102
141
  }): Promise<{
103
142
  pointer: Address;
104
143
  txHash: Hex;
@@ -109,9 +148,10 @@ export declare function writeChunk(send: SendStagingTx, args: {
109
148
  * fits a single tx's gas (see {@link planContentTxs}); returns the manifest address (the
110
149
  * `reader` pointer) from the `ManifestWritten` event.
111
150
  */
112
- export declare function writeContent(send: SendStagingTx, args: {
151
+ export declare function writeContent(send: SendTx, args: {
113
152
  store: Address;
114
153
  chunks: ReadonlyArray<PlannedChunk>;
154
+ chainId: number;
115
155
  }): Promise<{
116
156
  manifest: Address;
117
157
  txHash: Hex;
@@ -123,9 +163,10 @@ export declare function writeContent(send: SendStagingTx, args: {
123
163
  * batches, concatenates the returned pointers, then calls {@link writeManifest}. Pairs
124
164
  * each pointer with its planned `compressed` flag for manifest assembly.
125
165
  */
126
- export declare function writeChunkBatch(send: SendStagingTx, args: {
166
+ export declare function writeChunkBatch(send: SendTx, args: {
127
167
  store: Address;
128
168
  chunks: ReadonlyArray<PlannedChunk>;
169
+ chainId: number;
129
170
  }): Promise<{
130
171
  written: Array<{
131
172
  pointer: Address;
@@ -143,9 +184,10 @@ export declare function writeChunkBatch(send: SendStagingTx, args: {
143
184
  * This is the same path whether the manifest is later baked into a deploy's `InitParams`
144
185
  * or set on a live token — staging always precedes the contract that references it.
145
186
  */
146
- export declare function stageContent(send: SendStagingTx, args: {
187
+ export declare function stageContent(send: SendTx, args: {
147
188
  store: Address;
148
189
  content: Uint8Array;
190
+ chainId: number;
149
191
  fastlz?: boolean;
150
192
  chunkSize?: number;
151
193
  gasBudget?: number;
@@ -155,14 +197,103 @@ export declare function stageContent(send: SendStagingTx, args: {
155
197
  chunkCount: number;
156
198
  }>;
157
199
  /** Write the manifest (ordered chunk list); returns its address (the `reader` pointer). */
158
- export declare function writeManifest(send: SendStagingTx, args: {
200
+ export declare function writeManifest(send: SendTx, args: {
159
201
  store: Address;
160
202
  chunks: ReadonlyArray<{
161
203
  pointer: Address;
162
204
  compressed: boolean;
163
205
  }>;
206
+ chainId: number;
164
207
  }): Promise<{
165
208
  manifest: Address;
166
209
  txHash: Hex;
167
210
  }>;
211
+ /** Progress from {@link ensureChunkStore}, so a caller can narrate without the SDK printing. */
212
+ export type ChunkStoreEvent = {
213
+ kind: 'stale';
214
+ address: Address;
215
+ } | {
216
+ kind: 'canonical';
217
+ address: Address;
218
+ } | {
219
+ kind: 'deploying';
220
+ } | {
221
+ kind: 'deployed';
222
+ address: Address;
223
+ inManifest: boolean;
224
+ };
225
+ /**
226
+ * Resolve a usable multi-chunk content store for this chain, deploying one if needed.
227
+ *
228
+ * This is the bootstrap every on-chain-content path needs, and it existed only inside the CLI — so an
229
+ * SDK integrator got `resolveChunkStore()` (which may return undefined) plus a separate
230
+ * `storeSupportsWriteContent()` they had to remember to call. Forget the second and an incapable
231
+ * store fails *deep inside a mint, after transactions have already landed*. One team hand-rolled this
232
+ * guard for exactly that reason; exporting it is cheaper than every integrator rediscovering it.
233
+ *
234
+ * Three ways to succeed, in order: the listed store if it exists AND exposes the current ABI; the
235
+ * CREATE2-deterministic address (the store is canonical, so a forge script or an earlier lazy deploy
236
+ * may have put it there before the manifest caught up — self-healing, and never a duplicate at a
237
+ * random CREATE address); otherwise deploy it. Ownerless, so any funded signer may stand it up.
238
+ */
239
+ export declare function ensureChunkStore(publicClient: PublicClient, send: SendTx, opts?: {
240
+ chainId: number;
241
+ override?: string;
242
+ onEvent?: (e: ChunkStoreEvent) => void;
243
+ }): Promise<Address>;
244
+ /**
245
+ * What {@link probeChunkStore} found — mirrors `probeSeedSource`/`probeTransferValidator` (see
246
+ * ops.ts / creator-token.ts): every failure is a verdict, never a thrown error, so a caller — a
247
+ * server startup check, in particular — can branch on the reason instead of catching.
248
+ *
249
+ * - `ok` — a store is configured, has code, and answers the current `writeContent` ABI.
250
+ * - `unconfigured` — no override, no `ABX_CHUNK_STORE`, and no manifest entry for this chain.
251
+ * There is nothing to probe. {@link ensureChunkStore} would deploy one here;
252
+ * THIS function never does — see its doc for why.
253
+ * - `no-code` — an address is configured (override, env, or manifest) but nothing is
254
+ * deployed there on this chain: a chain-id mismatch, a wiped local devnet, or
255
+ * a manifest entry for a chain the caller isn't actually talking to.
256
+ * - `incompatible` — code exists but reverts the empty `writeContent([],[])` probe: either a
257
+ * store deployed before that ABI existed, or an address that was never a chunk
258
+ * store at all.
259
+ * - `unreachable` — the RPC didn't answer `getCode`. Says nothing about the address; retry,
260
+ * don't refuse on the merits (mirrors the sibling probes' treatment of a
261
+ * transport failure).
262
+ */
263
+ export type ChunkStoreVerdict = 'ok' | 'unconfigured' | 'no-code' | 'incompatible' | 'unreachable';
264
+ /**
265
+ * The result of {@link probeChunkStore} — verdict plus what was observed, for a message.
266
+ * `address` is absent only for `unconfigured`, where there is nothing to name.
267
+ */
268
+ export interface ChunkStoreProbe {
269
+ verdict: ChunkStoreVerdict;
270
+ address?: Address;
271
+ /** First line of the transport error, for `unreachable`. */
272
+ error?: string;
273
+ }
274
+ /**
275
+ * Resolve a usable multi-chunk content store WITHOUT ever deploying one — the fail-closed sibling
276
+ * to {@link ensureChunkStore}, for the caller that must never send a transaction to answer "is
277
+ * there a usable store here" (a request-scoped service, a read-only server startup check).
278
+ *
279
+ * `ensureChunkStore`'s last resort is a deploy, which is the right call for a CLI staging path (a
280
+ * human is present, a signer is funded, standing up shared infra on demand is the point) and the
281
+ * wrong call for a service: it has no business sending a transaction just because it was asked
282
+ * whether a store exists, and "silently deployed a new chunk store during a health check" would be
283
+ * its own incident. So this composes the SAME two primitives `ensureChunkStore` uses — address
284
+ * resolution ({@link resolveChunkStore}) and the ABI probe ({@link storeSupportsWriteContent}) —
285
+ * into a read-only check that returns a verdict a caller can log, alert on, and refuse to start
286
+ * on, instead of an address or a thrown error.
287
+ *
288
+ * Deliberately does NOT fall back to the CREATE2-deterministic address the way `ensureChunkStore`
289
+ * does: that fallback exists to self-heal a manifest that hasn't caught up with an out-of-band
290
+ * deploy, which is a staging-time convenience, not part of "does the address this caller is
291
+ * actually configured with work" — the question a startup check asks. An explicit `override` (or
292
+ * `ABX_CHUNK_STORE`) still takes precedence over the chain's manifest default, exactly as it does
293
+ * for `ensureChunkStore` — {@link resolveChunkStore} is the single place that precedence lives.
294
+ */
295
+ export declare function probeChunkStore(publicClient: PublicClient, opts: {
296
+ chainId: number;
297
+ override?: string;
298
+ }): Promise<ChunkStoreProbe>;
168
299
  //# sourceMappingURL=chunks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"A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EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;CAAgB,GAChG,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,cAAc,GAAG,SAAS,GAAG,cAAc,GAAG,aAAa,CAAC;AAEnG;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,GACzC,OAAO,CAAC,eAAe,CAAC,CAY1B"}
package/dist/chunks.js CHANGED
@@ -1,5 +1,7 @@
1
- import { encodeFunctionData, parseEventLogs, } from 'viem';
1
+ import { bytesToHex, encodeFunctionData, parseEventLogs } from 'viem';
2
2
  import { abxChunkStoreAbi, abxChunkStoreBytecode } from './abi/index.js';
3
+ import { resolveChunkStore } from './deployments.js';
4
+ import { predictChunkStore } from './create2.js';
3
5
  import { flzCompress } from './fastlz.js';
4
6
  import { ABX_SALT, CREATE2_PROXY, create2Calldata, predictCreate2Address } from './create2.js';
5
7
  /**
@@ -15,6 +17,13 @@ import { ABX_SALT, CREATE2_PROXY, create2Calldata, predictCreate2Address } from
15
17
  /** SSTORE2 data-contract code limit is 24576 bytes (EIP-170) minus the STOP byte; chunk
16
18
  * conservatively so even an incompressible FastLZ chunk (slight expansion) still fits. */
17
19
  export const DEFAULT_CHUNK_SIZE = 22_000;
20
+ /**
21
+ * Chunk-store writes are staged in the SAME lane-agnostic terms as every other write: the SDK
22
+ * builds a {@link PreparedTx}, the caller decides how it's signed via a {@link SendTx}. These writes
23
+ * are **ownerless**, so they can be signed by any funded signer — the env key (hot lane) *or* a
24
+ * connected browser wallet (wallet lane). Keeping the signer out of this module is what lets
25
+ * on-chain staging work under every signing lane instead of assuming a hot key.
26
+ */
18
27
  /**
19
28
  * Split content into chunks, FastLZ-compressing each when `fastlz` is set (per-chunk — the
20
29
  * convention the store + reader expect). Pure: no chain, no I/O. A chunk is only stored
@@ -36,21 +45,82 @@ export function planChunks(content, opts = {}) {
36
45
  }
37
46
  return chunks;
38
47
  }
39
- const toHex = (b) => `0x${Buffer.from(b).toString('hex')}`;
48
+ const toHex = (b) => bytesToHex(b);
40
49
  /**
41
- * A per-transaction gas ceiling for packing chunk writes. Comfortably under mainnet's
42
- * ~30M block limit so a batch always fits with room for the base + calldata cost; the
43
- * planner splits content across multiple transactions to stay beneath it.
50
+ * A per-transaction gas ceiling for packing chunk writes; the planner splits content across
51
+ * multiple transactions to stay beneath it.
52
+ *
53
+ * **The binding constraint is `eth_estimateGas`, not the block gas limit.** Every send estimates
54
+ * first; a batch planned above the provider allowance fails before anything is sent.
55
+ *
56
+ * 8M leaves room for the base + calldata cost under that 16.7M ceiling. **Do not raise it toward a
57
+ * block limit.** If you raise it at all, measure the estimate allowance first — and note that these
58
+ * are third-party numbers that move.
44
59
  */
45
60
  export const DEFAULT_TX_GAS_BUDGET = 8_000_000;
46
61
  /**
47
- * Rough gas for writing one chunk as an SSTORE2 data contract: a fixed CREATE + base
48
- * overhead plus the code-deposit cost (~200 gas/byte) and calldata. Deliberately an
49
- * over-estimate so packed batches land safely inside {@link DEFAULT_TX_GAS_BUDGET};
50
- * the wallet still does the real `eth_estimateGas` before sending.
62
+ * Reference `eth_estimateGas` allowance — 2^24 — used to justify
63
+ * {@link DEFAULT_TX_GAS_BUDGET} against the limit that binds it rather than the block limit.
64
+ */
65
+ export const MEASURED_ESTIMATE_GAS_ALLOWANCE = 16_777_216;
66
+ /**
67
+ * Rough gas for writing `byteLength` bytes as an SSTORE2 data contract: a fixed CREATE + base
68
+ * overhead plus the code-deposit cost (~200 gas/byte) and calldata. Deliberately an over-estimate so
69
+ * packed batches land safely inside {@link DEFAULT_TX_GAS_BUDGET}; the wallet still does the real
70
+ * `eth_estimateGas` before sending. Takes a byte length directly (not a {@link PlannedChunk}) for a
71
+ * caller that already knows the size and has no content to allocate just to ask — a code project's
72
+ * on-chain SCRIPT chunk (`OnChainScript.setScriptChunk`, `contracts/src/libraries/AbxCodeLib.sol`) is
73
+ * the same SSTORE2 write as a content chunk, so it reuses this estimate rather than inventing a
74
+ * second one — see `commands/deploy.ts`'s code-setup transaction splitting.
51
75
  */
76
+ export function estimateChunkGasForBytes(byteLength) {
77
+ return 40_000 + byteLength * 240;
78
+ }
79
+ /** {@link estimateChunkGasForBytes}, from a {@link PlannedChunk} already in hand. */
52
80
  export function estimateChunkGas(chunk) {
53
- return 40_000 + chunk.data.length * 240;
81
+ return estimateChunkGasForBytes(chunk.data.length);
82
+ }
83
+ /**
84
+ * Rough, deliberately-conservative gas for the code-project setup legs that are NOT raw content
85
+ * chunks — a `setParamSchema`, a `setDependency`/`setDependencyRegistry`, an on-chain-URI wiring
86
+ * call, a reserve `mint`. Unlike {@link estimateChunkGasForBytes} these are flat per-call estimates:
87
+ * none of them pays an EVM code-deposit, so their cost doesn't scale with a byte length. Shared by
88
+ * `commands/deploy.ts`'s fresh-deploy cost-guidance heuristic AND its setup-transaction gas-bounded
89
+ * batching, so the two can never disagree about what one of these calls costs.
90
+ */
91
+ export const SETUP_LEG_GAS = {
92
+ schema: 45_000,
93
+ dependency: 55_000,
94
+ onchainUri: 60_000,
95
+ mint: 65_000,
96
+ };
97
+ /**
98
+ * Pack arbitrary gas-costed items into gas-bounded batches, preserving order — the call-level
99
+ * sibling of {@link planContentTxs}'s own greedy bin-packing loop, generalized so a caller whose
100
+ * "chunk" is a setup CALL (a schema declare, a dependency pointer, a mint) rather than a content byte
101
+ * range can reuse the identical algorithm and budget instead of inventing a second one. Splits only
102
+ * BETWEEN items — an item whose own `.gas` alone exceeds `gasBudget` still rides alone in its own
103
+ * batch (that batch is simply over-budget, not necessarily over the harder `eth_estimateGas` ceiling
104
+ * — a caller that must refuse an indivisible-too-large leg checks {@link MEASURED_ESTIMATE_GAS_ALLOWANCE}
105
+ * itself, separately, BEFORE calling this).
106
+ */
107
+ export function packCallsByGas(items, opts = {}) {
108
+ const budget = opts.gasBudget ?? DEFAULT_TX_GAS_BUDGET;
109
+ const batches = [];
110
+ let cur = [];
111
+ let curGas = 0;
112
+ for (const item of items) {
113
+ if (cur.length > 0 && curGas + item.gas > budget) {
114
+ batches.push(cur);
115
+ cur = [];
116
+ curGas = 0;
117
+ }
118
+ cur.push(item);
119
+ curGas += item.gas;
120
+ }
121
+ if (cur.length > 0)
122
+ batches.push(cur);
123
+ return batches;
54
124
  }
55
125
  /**
56
126
  * Decide the transaction shape for a piece of content. When the whole thing fits one
@@ -86,15 +156,18 @@ export function planContentTxs(chunks, opts = {}) {
86
156
  * Deploy `AbxChunkStore` — the shared, stateless multi-chunk store + reader. Deploy once
87
157
  * per chain (like the renderer); every chunked field references it as its `reader`.
88
158
  */
89
- export async function deployChunkStore(send) {
159
+ export async function deployChunkStore(send, opts) {
90
160
  // CREATE2 via the keyless proxy + canonical salt → the SAME address on every chain (matches the
91
161
  // forge `DeployChunkStore` script and the manifest). The address is deterministic, so we compute
92
162
  // it rather than read `receipt.contractAddress` (which is null — the tx targets the proxy, not a
93
163
  // contract creation). Deploy only when the store isn't already there (the caller checks first).
94
164
  const chunkStore = predictCreate2Address(ABX_SALT.chunkStore, abxChunkStoreBytecode);
95
165
  const receipt = await send({
166
+ op: 'deploy-chunk-store',
96
167
  to: CREATE2_PROXY,
97
168
  data: create2Calldata(ABX_SALT.chunkStore, abxChunkStoreBytecode),
169
+ value: '0x0',
170
+ chainId: opts.chainId,
98
171
  summary: 'Deploy the shared on-chain chunk store (AbxChunkStore) — CREATE2, deterministic address',
99
172
  fields: { contract: 'AbxChunkStore', address: chunkStore, note: 'one-time, ownerless, shared by every chunked field' },
100
173
  });
@@ -123,8 +196,11 @@ export async function storeSupportsWriteContent(publicClient, store) {
123
196
  /** Write one chunk as an SSTORE2 data contract; returns its address (from `ChunkWritten`). */
124
197
  export async function writeChunk(send, args) {
125
198
  const receipt = await send({
199
+ op: 'write-chunk',
126
200
  to: args.store,
127
201
  data: encodeFunctionData({ abi: abxChunkStoreAbi, functionName: 'writeChunk', args: [toHex(args.data)] }),
202
+ value: '0x0',
203
+ chainId: args.chainId,
128
204
  summary: 'Stage one on-chain content chunk',
129
205
  fields: { store: args.store, bytes: String(args.data.length) },
130
206
  });
@@ -142,12 +218,15 @@ export async function writeChunk(send, args) {
142
218
  */
143
219
  export async function writeContent(send, args) {
144
220
  const receipt = await send({
221
+ op: 'write-content',
145
222
  to: args.store,
146
223
  data: encodeFunctionData({
147
224
  abi: abxChunkStoreAbi,
148
225
  functionName: 'writeContent',
149
226
  args: [args.chunks.map((c) => toHex(c.data)), args.chunks.map((c) => c.compressed)],
150
227
  }),
228
+ value: '0x0',
229
+ chainId: args.chainId,
151
230
  summary: `Stage on-chain content (${args.chunks.length} chunk${args.chunks.length === 1 ? '' : 's'}, atomic)`,
152
231
  fields: { store: args.store, chunks: String(args.chunks.length) },
153
232
  });
@@ -167,8 +246,11 @@ export async function writeContent(send, args) {
167
246
  export async function writeChunkBatch(send, args) {
168
247
  const calls = args.chunks.map((c) => encodeFunctionData({ abi: abxChunkStoreAbi, functionName: 'writeChunk', args: [toHex(c.data)] }));
169
248
  const receipt = await send({
249
+ op: 'write-chunk-batch',
170
250
  to: args.store,
171
251
  data: encodeFunctionData({ abi: abxChunkStoreAbi, functionName: 'multicall', args: [calls] }),
252
+ value: '0x0',
253
+ chainId: args.chainId,
172
254
  summary: `Stage ${args.chunks.length} on-chain content chunk${args.chunks.length === 1 ? '' : 's'} (batch)`,
173
255
  fields: { store: args.store, chunks: String(args.chunks.length) },
174
256
  });
@@ -198,28 +280,31 @@ export async function stageContent(send, args) {
198
280
  const plan = planContentTxs(chunks, { gasBudget: args.gasBudget });
199
281
  const txHashes = [];
200
282
  if (plan.mode === 'single') {
201
- const { manifest, txHash } = await writeContent(send, { store: args.store, chunks });
283
+ const { manifest, txHash } = await writeContent(send, { store: args.store, chunks, chainId: args.chainId });
202
284
  return { manifest, txHashes: [txHash], chunkCount: chunks.length };
203
285
  }
204
286
  const written = [];
205
287
  for (const batch of plan.batches) {
206
- const res = await writeChunkBatch(send, { store: args.store, chunks: batch });
288
+ const res = await writeChunkBatch(send, { store: args.store, chunks: batch, chainId: args.chainId });
207
289
  written.push(...res.written);
208
290
  txHashes.push(res.txHash);
209
291
  }
210
- const { manifest, txHash } = await writeManifest(send, { store: args.store, chunks: written });
292
+ const { manifest, txHash } = await writeManifest(send, { store: args.store, chunks: written, chainId: args.chainId });
211
293
  txHashes.push(txHash);
212
294
  return { manifest, txHashes, chunkCount: chunks.length };
213
295
  }
214
296
  /** Write the manifest (ordered chunk list); returns its address (the `reader` pointer). */
215
297
  export async function writeManifest(send, args) {
216
298
  const receipt = await send({
299
+ op: 'write-manifest',
217
300
  to: args.store,
218
301
  data: encodeFunctionData({
219
302
  abi: abxChunkStoreAbi,
220
303
  functionName: 'writeManifest',
221
304
  args: [args.chunks.map((c) => ({ pointer: c.pointer, compressed: c.compressed }))],
222
305
  }),
306
+ value: '0x0',
307
+ chainId: args.chainId,
223
308
  summary: `Write the on-chain content manifest (${args.chunks.length} chunk${args.chunks.length === 1 ? '' : 's'})`,
224
309
  fields: { store: args.store, chunks: String(args.chunks.length) },
225
310
  });
@@ -229,4 +314,84 @@ export async function writeManifest(send, args) {
229
314
  throw new Error('writeManifest emitted no ManifestWritten event');
230
315
  return { manifest, txHash: receipt.transactionHash };
231
316
  }
317
+ /**
318
+ * Resolve a usable multi-chunk content store for this chain, deploying one if needed.
319
+ *
320
+ * This is the bootstrap every on-chain-content path needs, and it existed only inside the CLI — so an
321
+ * SDK integrator got `resolveChunkStore()` (which may return undefined) plus a separate
322
+ * `storeSupportsWriteContent()` they had to remember to call. Forget the second and an incapable
323
+ * store fails *deep inside a mint, after transactions have already landed*. One team hand-rolled this
324
+ * guard for exactly that reason; exporting it is cheaper than every integrator rediscovering it.
325
+ *
326
+ * Three ways to succeed, in order: the listed store if it exists AND exposes the current ABI; the
327
+ * CREATE2-deterministic address (the store is canonical, so a forge script or an earlier lazy deploy
328
+ * may have put it there before the manifest caught up — self-healing, and never a duplicate at a
329
+ * random CREATE address); otherwise deploy it. Ownerless, so any funded signer may stand it up.
330
+ */
331
+ export async function ensureChunkStore(publicClient, send, opts = { chainId: 0 }) {
332
+ const notify = opts.onEvent ?? (() => { });
333
+ const listed = resolveChunkStore(opts.chainId, opts.override);
334
+ if (listed) {
335
+ const code = await publicClient.getCode({ address: listed });
336
+ if (code && code !== '0x') {
337
+ if (await storeSupportsWriteContent(publicClient, listed))
338
+ return listed;
339
+ notify({ kind: 'stale', address: listed });
340
+ }
341
+ }
342
+ const predicted = predictChunkStore();
343
+ if (!listed || listed.toLowerCase() !== predicted.toLowerCase()) {
344
+ const code = await publicClient.getCode({ address: predicted });
345
+ if (code && code !== '0x' && (await storeSupportsWriteContent(publicClient, predicted))) {
346
+ notify({ kind: 'canonical', address: predicted });
347
+ return predicted;
348
+ }
349
+ }
350
+ notify({ kind: 'deploying' });
351
+ const { chunkStore } = await deployChunkStore(send, { chainId: opts.chainId });
352
+ notify({ kind: 'deployed', address: chunkStore, inManifest: false });
353
+ return chunkStore;
354
+ }
355
+ /**
356
+ * Resolve a usable multi-chunk content store WITHOUT ever deploying one — the fail-closed sibling
357
+ * to {@link ensureChunkStore}, for the caller that must never send a transaction to answer "is
358
+ * there a usable store here" (a request-scoped service, a read-only server startup check).
359
+ *
360
+ * `ensureChunkStore`'s last resort is a deploy, which is the right call for a CLI staging path (a
361
+ * human is present, a signer is funded, standing up shared infra on demand is the point) and the
362
+ * wrong call for a service: it has no business sending a transaction just because it was asked
363
+ * whether a store exists, and "silently deployed a new chunk store during a health check" would be
364
+ * its own incident. So this composes the SAME two primitives `ensureChunkStore` uses — address
365
+ * resolution ({@link resolveChunkStore}) and the ABI probe ({@link storeSupportsWriteContent}) —
366
+ * into a read-only check that returns a verdict a caller can log, alert on, and refuse to start
367
+ * on, instead of an address or a thrown error.
368
+ *
369
+ * Deliberately does NOT fall back to the CREATE2-deterministic address the way `ensureChunkStore`
370
+ * does: that fallback exists to self-heal a manifest that hasn't caught up with an out-of-band
371
+ * deploy, which is a staging-time convenience, not part of "does the address this caller is
372
+ * actually configured with work" — the question a startup check asks. An explicit `override` (or
373
+ * `ABX_CHUNK_STORE`) still takes precedence over the chain's manifest default, exactly as it does
374
+ * for `ensureChunkStore` — {@link resolveChunkStore} is the single place that precedence lives.
375
+ */
376
+ export async function probeChunkStore(publicClient, opts) {
377
+ const address = resolveChunkStore(opts.chainId, opts.override);
378
+ if (!address)
379
+ return { verdict: 'unconfigured' };
380
+ let code;
381
+ try {
382
+ code = await publicClient.getCode({ address });
383
+ }
384
+ catch (err) {
385
+ return { verdict: 'unreachable', address, error: firstLine(err) };
386
+ }
387
+ if (!code || code === '0x')
388
+ return { verdict: 'no-code', address };
389
+ if (!(await storeSupportsWriteContent(publicClient, address)))
390
+ return { verdict: 'incompatible', address };
391
+ return { verdict: 'ok', address };
392
+ }
393
+ /** First line of an error message — a revert reason is readable; viem's full dump is not. */
394
+ function firstLine(err) {
395
+ return String(err?.message ?? err).split('\n')[0].trim();
396
+ }
232
397
  //# sourceMappingURL=chunks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunks.js","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,GAKf,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,gBAAgB,EAAE,qBAAqB,EAAC,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,qBAA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