@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
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,12 +197,13 @@ 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;
@@ -193,9 +236,64 @@ export type ChunkStoreEvent = {
193
236
  * may have put it there before the manifest caught up — self-healing, and never a duplicate at a
194
237
  * random CREATE address); otherwise deploy it. Ownerless, so any funded signer may stand it up.
195
238
  */
196
- export declare function ensureChunkStore(publicClient: PublicClient, send: SendStagingTx, opts?: {
239
+ export declare function ensureChunkStore(publicClient: PublicClient, send: SendTx, opts?: {
197
240
  chainId: number;
198
241
  override?: string;
199
242
  onEvent?: (e: ChunkStoreEvent) => void;
200
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>;
201
299
  //# sourceMappingURL=chunks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunks.d.ts","sourceRoot":"","sources":["../src/chunks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,MAAM,CAAC;AAOd;;;;;;;;;GASG;AAEH;2FAC2F;AAC3F,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC,iFAAiF;AACjF,MAA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;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,GACrC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAC,GACnB;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAC,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,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,4 +1,4 @@
1
- import { encodeFunctionData, parseEventLogs, } from 'viem';
1
+ import { bytesToHex, encodeFunctionData, parseEventLogs } from 'viem';
2
2
  import { abxChunkStoreAbi, abxChunkStoreBytecode } from './abi/index.js';
3
3
  import { resolveChunkStore } from './deployments.js';
4
4
  import { predictChunkStore } from './create2.js';
@@ -17,6 +17,13 @@ import { ABX_SALT, CREATE2_PROXY, create2Calldata, predictCreate2Address } from
17
17
  /** SSTORE2 data-contract code limit is 24576 bytes (EIP-170) minus the STOP byte; chunk
18
18
  * conservatively so even an incompressible FastLZ chunk (slight expansion) still fits. */
19
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
+ */
20
27
  /**
21
28
  * Split content into chunks, FastLZ-compressing each when `fastlz` is set (per-chunk — the
22
29
  * convention the store + reader expect). Pure: no chain, no I/O. A chunk is only stored
@@ -38,21 +45,82 @@ export function planChunks(content, opts = {}) {
38
45
  }
39
46
  return chunks;
40
47
  }
41
- const toHex = (b) => `0x${Buffer.from(b).toString('hex')}`;
48
+ const toHex = (b) => bytesToHex(b);
42
49
  /**
43
- * A per-transaction gas ceiling for packing chunk writes. Comfortably under mainnet's
44
- * ~30M block limit so a batch always fits with room for the base + calldata cost; the
45
- * 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.
46
59
  */
47
60
  export const DEFAULT_TX_GAS_BUDGET = 8_000_000;
48
61
  /**
49
- * Rough gas for writing one chunk as an SSTORE2 data contract: a fixed CREATE + base
50
- * overhead plus the code-deposit cost (~200 gas/byte) and calldata. Deliberately an
51
- * over-estimate so packed batches land safely inside {@link DEFAULT_TX_GAS_BUDGET};
52
- * 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.
53
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.
75
+ */
76
+ export function estimateChunkGasForBytes(byteLength) {
77
+ return 40_000 + byteLength * 240;
78
+ }
79
+ /** {@link estimateChunkGasForBytes}, from a {@link PlannedChunk} already in hand. */
54
80
  export function estimateChunkGas(chunk) {
55
- 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;
56
124
  }
57
125
  /**
58
126
  * Decide the transaction shape for a piece of content. When the whole thing fits one
@@ -88,15 +156,18 @@ export function planContentTxs(chunks, opts = {}) {
88
156
  * Deploy `AbxChunkStore` — the shared, stateless multi-chunk store + reader. Deploy once
89
157
  * per chain (like the renderer); every chunked field references it as its `reader`.
90
158
  */
91
- export async function deployChunkStore(send) {
159
+ export async function deployChunkStore(send, opts) {
92
160
  // CREATE2 via the keyless proxy + canonical salt → the SAME address on every chain (matches the
93
161
  // forge `DeployChunkStore` script and the manifest). The address is deterministic, so we compute
94
162
  // it rather than read `receipt.contractAddress` (which is null — the tx targets the proxy, not a
95
163
  // contract creation). Deploy only when the store isn't already there (the caller checks first).
96
164
  const chunkStore = predictCreate2Address(ABX_SALT.chunkStore, abxChunkStoreBytecode);
97
165
  const receipt = await send({
166
+ op: 'deploy-chunk-store',
98
167
  to: CREATE2_PROXY,
99
168
  data: create2Calldata(ABX_SALT.chunkStore, abxChunkStoreBytecode),
169
+ value: '0x0',
170
+ chainId: opts.chainId,
100
171
  summary: 'Deploy the shared on-chain chunk store (AbxChunkStore) — CREATE2, deterministic address',
101
172
  fields: { contract: 'AbxChunkStore', address: chunkStore, note: 'one-time, ownerless, shared by every chunked field' },
102
173
  });
@@ -125,8 +196,11 @@ export async function storeSupportsWriteContent(publicClient, store) {
125
196
  /** Write one chunk as an SSTORE2 data contract; returns its address (from `ChunkWritten`). */
126
197
  export async function writeChunk(send, args) {
127
198
  const receipt = await send({
199
+ op: 'write-chunk',
128
200
  to: args.store,
129
201
  data: encodeFunctionData({ abi: abxChunkStoreAbi, functionName: 'writeChunk', args: [toHex(args.data)] }),
202
+ value: '0x0',
203
+ chainId: args.chainId,
130
204
  summary: 'Stage one on-chain content chunk',
131
205
  fields: { store: args.store, bytes: String(args.data.length) },
132
206
  });
@@ -144,12 +218,15 @@ export async function writeChunk(send, args) {
144
218
  */
145
219
  export async function writeContent(send, args) {
146
220
  const receipt = await send({
221
+ op: 'write-content',
147
222
  to: args.store,
148
223
  data: encodeFunctionData({
149
224
  abi: abxChunkStoreAbi,
150
225
  functionName: 'writeContent',
151
226
  args: [args.chunks.map((c) => toHex(c.data)), args.chunks.map((c) => c.compressed)],
152
227
  }),
228
+ value: '0x0',
229
+ chainId: args.chainId,
153
230
  summary: `Stage on-chain content (${args.chunks.length} chunk${args.chunks.length === 1 ? '' : 's'}, atomic)`,
154
231
  fields: { store: args.store, chunks: String(args.chunks.length) },
155
232
  });
@@ -169,8 +246,11 @@ export async function writeContent(send, args) {
169
246
  export async function writeChunkBatch(send, args) {
170
247
  const calls = args.chunks.map((c) => encodeFunctionData({ abi: abxChunkStoreAbi, functionName: 'writeChunk', args: [toHex(c.data)] }));
171
248
  const receipt = await send({
249
+ op: 'write-chunk-batch',
172
250
  to: args.store,
173
251
  data: encodeFunctionData({ abi: abxChunkStoreAbi, functionName: 'multicall', args: [calls] }),
252
+ value: '0x0',
253
+ chainId: args.chainId,
174
254
  summary: `Stage ${args.chunks.length} on-chain content chunk${args.chunks.length === 1 ? '' : 's'} (batch)`,
175
255
  fields: { store: args.store, chunks: String(args.chunks.length) },
176
256
  });
@@ -200,28 +280,31 @@ export async function stageContent(send, args) {
200
280
  const plan = planContentTxs(chunks, { gasBudget: args.gasBudget });
201
281
  const txHashes = [];
202
282
  if (plan.mode === 'single') {
203
- const { manifest, txHash } = await writeContent(send, { store: args.store, chunks });
283
+ const { manifest, txHash } = await writeContent(send, { store: args.store, chunks, chainId: args.chainId });
204
284
  return { manifest, txHashes: [txHash], chunkCount: chunks.length };
205
285
  }
206
286
  const written = [];
207
287
  for (const batch of plan.batches) {
208
- const res = await writeChunkBatch(send, { store: args.store, chunks: batch });
288
+ const res = await writeChunkBatch(send, { store: args.store, chunks: batch, chainId: args.chainId });
209
289
  written.push(...res.written);
210
290
  txHashes.push(res.txHash);
211
291
  }
212
- 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 });
213
293
  txHashes.push(txHash);
214
294
  return { manifest, txHashes, chunkCount: chunks.length };
215
295
  }
216
296
  /** Write the manifest (ordered chunk list); returns its address (the `reader` pointer). */
217
297
  export async function writeManifest(send, args) {
218
298
  const receipt = await send({
299
+ op: 'write-manifest',
219
300
  to: args.store,
220
301
  data: encodeFunctionData({
221
302
  abi: abxChunkStoreAbi,
222
303
  functionName: 'writeManifest',
223
304
  args: [args.chunks.map((c) => ({ pointer: c.pointer, compressed: c.compressed }))],
224
305
  }),
306
+ value: '0x0',
307
+ chainId: args.chainId,
225
308
  summary: `Write the on-chain content manifest (${args.chunks.length} chunk${args.chunks.length === 1 ? '' : 's'})`,
226
309
  fields: { store: args.store, chunks: String(args.chunks.length) },
227
310
  });
@@ -265,8 +348,50 @@ export async function ensureChunkStore(publicClient, send, opts = { chainId: 0 }
265
348
  }
266
349
  }
267
350
  notify({ kind: 'deploying' });
268
- const { chunkStore } = await deployChunkStore(send);
351
+ const { chunkStore } = await deployChunkStore(send, { chainId: opts.chainId });
269
352
  notify({ kind: 'deployed', address: chunkStore, inManifest: false });
270
353
  return chunkStore;
271
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
+ }
272
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,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAE7F;;;;;;;;;GASG;AAEH;2FAC2F;AAC3F,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AA4BzC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,OAAmB,EACnB,OAA+C,EAAE;IAEjD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,IAAI,kBAAkB,CAAC;IAClD,MAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC1C,IAAI,IAAI,CAAC,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, type WalletClient, type Account } from 'viem';
1
+ import { type PublicClient, type WalletClient, type Account, type Hex } from 'viem';
2
2
  export interface ClientOptions {
3
3
  chainKey?: string;
4
+ /** A single RPC endpoint — wins outright over everything else (env included). */
4
5
  rpcUrl?: string;
6
+ /** Several RPC endpoints, in preference order (a viem `fallback` transport failing over
7
+ * across them). Loses to `rpcUrl` when both are set; otherwise takes precedence over env
8
+ * resolution — see {@link resolveRpcUrls}'s override → env → manifest precedence. */
9
+ rpcUrls?: string[];
5
10
  }
6
11
  /** A read-only client — all the indexer and token API ever need. */
7
12
  export declare function makePublicClient(opts?: ClientOptions): PublicClient;
@@ -21,22 +26,29 @@ export declare function makePublicClient(opts?: ClientOptions): PublicClient;
21
26
  export declare function assertChainId(chainKey?: string, opts?: {
22
27
  allowUnreachable?: boolean;
23
28
  }): Promise<void>;
29
+ export interface WalletClientOptions extends ClientOptions {
30
+ /** An explicit key — bypasses `ABX_DEPLOYER_PK` (and any `.env`) entirely. For a caller that
31
+ * already resolved a key itself (a browser-wallet bridge is the OTHER signing lane — this is
32
+ * for a host embedding the SDK with its own key management, not that lane). */
33
+ privateKey?: Hex;
34
+ }
24
35
  /**
25
- * A signing client, backed by a private key from the environment. The SDK never
26
- * takes custody of keys beyond reading them from the operator's own env — there
27
- * is no key storage, no prompt, no remote signer here.
36
+ * A signing client, backed by a private key. The SDK never takes custody of keys beyond
37
+ * reading them from the operator's own env (or an explicit override) — there is no key
38
+ * storage, no prompt, no remote signer here.
28
39
  *
29
- * Key precedence: `ABX_DEPLOYER_PK` → `SEPOLIA_FUNDED_PK` → `SEPOLIA_WALLET_PK`.
40
+ * Key resolution: `opts.privateKey` → `ABX_DEPLOYER_PK`. That is the ONLY env name read —
41
+ * `SEPOLIA_FUNDED_PK` / `SEPOLIA_WALLET_PK` (earlier alphas) are no longer consulted.
30
42
  */
31
- export declare function makeWalletClient(opts?: ClientOptions): {
43
+ export declare function makeWalletClient(opts?: WalletClientOptions): {
32
44
  wallet: WalletClient;
33
45
  account: Account;
34
46
  };
35
47
  /**
36
- * The env signing key (0x-normalized), same precedence as {@link makeWalletClient}
37
- * (`ABX_DEPLOYER_PK` → `SEPOLIA_FUNDED_PK` → `SEPOLIA_WALLET_PK`), or `undefined` if none is set.
38
- * For reusing the hot key as a *storage* signing identity (an Ethereum Turbo identity) without
39
- * constructing a wallet client. Never throws.
48
+ * The signing key (0x-normalized), same resolution as {@link makeWalletClient}
49
+ * (`override` → `ABX_DEPLOYER_PK`), or `undefined` if none is set. For reusing the hot key as
50
+ * a *storage* signing identity (an Ethereum Turbo identity) without constructing a wallet
51
+ * client. Never throws.
40
52
  */
41
- export declare function envSigningKey(): `0x${string}` | undefined;
53
+ export declare function envSigningKey(override?: Hex): `0x${string}` | undefined;
42
54
  //# sourceMappingURL=clients.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,OAAO,EACb,MAAM,MAAM,CAAC;AAKd,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,aAAkB,GAAG,YAAY,CAEvE;AAID;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CACjC,QAAQ,GAAE,MAA0B,EACpC,IAAI,GAAE;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAM,GACtC,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,aAAkB,GAAG;IAC1D,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAYA;AAOD;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,KAAK,MAAM,EAAE,G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