@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/CHANGELOG.md ADDED
@@ -0,0 +1,207 @@
1
+ # @artblocks/abx-sdk
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7947ba9: Drop-in for read-only consumers. Hosts that serve stored images should adopt `storedImageType`.
8
+
9
+ On-chain raster images now display correctly. Stored `image` bytes are labelled with the new reserved
10
+ `abx_image_type` field, and fall back to `image/svg+xml` when it is unset. Before this change, a JPEG
11
+ or PNG staged with `--onchain-image` was served as SVG, which browsers show as a broken image.
12
+
13
+ - SDK: `METADATA_FIELD.imageType`, `storedImageType`, `isDeclarableImageType`, and
14
+ `DEFAULT_STORED_IMAGE_TYPE`. `isCurrentRenderer` now requires renderer spec v12, and the
15
+ canonical renderer address points at the v12 build.
16
+ - CLI: `deploy --onchain-image`, `deploy-series --onchain-image`, and `set-field --field image --file`
17
+ declare a raster's type from its file extension. They refuse formats browsers don't draw, such as
18
+ TIFF, PSD, video, and files without an extension, before anything is staged.
19
+ - Token API: the image route, the `/data/image` route, and the `artifacts` manifest serve the
20
+ declared type.
21
+
22
+ ## 0.1.0
23
+
24
+ ### Minor Changes
25
+
26
+ - 21e3d6c: Drop-in for existing v2 integrations; new deployments use the canonical v3 contracts.
27
+ Record the synchronized v3 factory generation and testnet deployments, retain full v2 service
28
+ compatibility (including already-assigned v2 sale minters), and update the renderer scaffold to
29
+ `abx-contracts` 3.0.0.
30
+ - 22abce8: Generalize the creator-wallet sponsorship lane to direct zero-value contract creation and
31
+ receipt-dependent on-chain image staging. Add `abx deploy-contract` for exact Foundry artifact or
32
+ initcode deployment through any signing lane.
33
+ - ea57f7a: Add provider-neutral remote interface discovery, the ABX Creators account API client, and the Base
34
+ Sepolia creator-wallet `--sponsor` signing lane. A provider catalog may advertise its account and
35
+ wallet interfaces at a separate HTTPS origin without changing existing same-origin remotes.
36
+ - 3ddba71: Drop-in for existing SDK callers; new consumers can inspect contract-generation compatibility.
37
+ Add the append-only generation registry, stable lookup helpers, and lifecycle and operation support
38
+ to provenance results.
39
+ - 9065128: Drop-in for existing clients; service consumers can now inspect verified contract-generation facts.
40
+ Advertise understood generations and include a project generation in summaries and status responses
41
+ only when factory provenance and the on-chain core version agree.
42
+
43
+ ### Patch Changes
44
+
45
+ - 4d5e2b1: Return minimal metadata for unminted token positions and keep their image, data, and live-view URLs unavailable until mint.
46
+ - 56973c4: Preserve `maxInvocations` as an exact uint256 value instead of narrowing it through a JavaScript
47
+ number. Reuse an existing hosted-service credential on login and add self-service API-key listing
48
+ and revocation for accounts at their active-key limit.
49
+ - 2290b0a: Recover ambiguous creator-wallet submissions through the existing operation status instead of replaying them. Sponsored sends now keep polling safely when the provider response is temporarily unknown and surface the operation ID if reconciliation cannot complete.
50
+ - b9197bc: Record the exact-match canonical Robinhood Chain production deployment while keeping the network
51
+ disabled until its services and low-value acceptance gates pass.
52
+ - 8ccbede: Enable Robinhood Chain production as beta after canonical deployment, paired-testnet qualification,
53
+ and managed-service validation. Surface the same real-funds warning and testnet-first gate used for
54
+ other production beta networks.
55
+ - d925eb1: Breaking only for SDK callers that directly prepared an unsupported sponsored `to: null` request;
56
+ drop-in for existing hot, wallet, and unsigned deployments. Route sponsored custom-contract
57
+ deployments through ABX's existing keyless CREATE2 proxy, expose the exact signer-bound salt and
58
+ predicted address, verify code after confirmation, and document the proxy constructor-caller boundary.
59
+ - 8f35dae: Prepare package metadata, release notes, and public-facing source comments for the initial public
60
+ source release.
61
+ - 719b9fe: Make the bundled skill read network and sponsorship support from CLI capabilities and the live
62
+ service descriptor instead of a hardcoded network list. Refresh public documentation references in
63
+ the published packages.
64
+ - c2400a7: Stage Robinhood Chain and its testnet as disabled qualification targets, keep the network registry
65
+ focused on the current roadmap, and stop sale inspection from turning RPC read failures into false
66
+ zero-state results.
67
+ - 3d7fe3c: Record the verified canonical Robinhood Chain Testnet deployment and enable the network for
68
+ experimental qualification with explicit CLI and agent guidance.
69
+ - 7b462e2: Update the SDK's Viem dependency to the latest compatible patch release.
70
+ - ddb2e0b: Refuse irreversible URI locks when the current token or collection base uses `abx.io`. Clarify that
71
+ managed resolver URLs must remain mutable unless a creator-controlled domain is routed and verified.
72
+ - 4512962: Enable Base production as beta, add a keyless read fallback, and surface production risk and paired-testnet guidance in the CLI, agent skill, and public docs.
73
+ - 76cfc6a: Follow each remote service interface's advertised origin so provider catalogs can separate token data from account and control APIs.
74
+ - 5522192: Record the source-verified Base production contract deployment while keeping Base disabled for CLI
75
+ use until the separate beta-enablement release.
76
+
77
+ ## 0.1.0-alpha.49
78
+
79
+ ### Patch Changes
80
+
81
+ - 719b9fe: Make the bundled skill read network and sponsorship support from CLI capabilities and the live
82
+ service descriptor instead of a hardcoded network list. Refresh public documentation references in
83
+ the published packages.
84
+
85
+ ## 0.1.0-alpha.48
86
+
87
+ ### Patch Changes
88
+
89
+ - 4d5e2b1: Return minimal metadata for unminted token positions and keep their image, data, and live-view URLs unavailable until mint.
90
+
91
+ ## 0.1.0-alpha.47
92
+
93
+ ### Patch Changes
94
+
95
+ - 56973c4: Preserve `maxInvocations` as an exact uint256 value instead of narrowing it through a JavaScript
96
+ number. Reuse an existing hosted-service credential on login and add self-service API-key listing
97
+ and revocation for accounts at their active-key limit.
98
+
99
+ ## 0.1.0-alpha.46
100
+
101
+ ### Patch Changes
102
+
103
+ - ddb2e0b: Refuse irreversible URI locks when the current token or collection base uses `abx.io`. Clarify that
104
+ managed resolver URLs must remain mutable unless a creator-controlled domain is routed and verified.
105
+ - 76cfc6a: Follow each remote service interface's advertised origin so provider catalogs can separate token data from account and control APIs.
106
+
107
+ ## 0.1.0-alpha.45
108
+
109
+ ### Patch Changes
110
+
111
+ - d925eb1: Breaking only for SDK callers that directly prepared an unsupported sponsored `to: null` request;
112
+ drop-in for existing hot, wallet, and unsigned deployments. Route sponsored custom-contract
113
+ deployments through ABX's existing keyless CREATE2 proxy, expose the exact signer-bound salt and
114
+ predicted address, verify code after confirmation, and document the proxy constructor-caller boundary.
115
+
116
+ ## 0.1.0-alpha.44
117
+
118
+ ### Minor Changes
119
+
120
+ - 22abce8: Generalize the creator-wallet sponsorship lane to direct zero-value contract creation and
121
+ receipt-dependent on-chain image staging. Add `abx deploy-contract` for exact Foundry artifact or
122
+ initcode deployment through any signing lane.
123
+
124
+ ## 0.1.0-alpha.43
125
+
126
+ ### Patch Changes
127
+
128
+ - 2290b0a: Recover ambiguous creator-wallet submissions through the existing operation status instead of replaying them. Sponsored sends now keep polling safely when the provider response is temporarily unknown and surface the operation ID if reconciliation cannot complete.
129
+
130
+ ## 0.1.0-alpha.42
131
+
132
+ ### Minor Changes
133
+
134
+ - ea57f7a: Add provider-neutral remote interface discovery, the ABX Creators account API client, and the Base
135
+ Sepolia creator-wallet `--sponsor` signing lane. A provider catalog may advertise its account and
136
+ wallet interfaces at a separate HTTPS origin without changing existing same-origin remotes.
137
+
138
+ ## 0.1.0-alpha.41
139
+
140
+ ### Patch Changes
141
+
142
+ - 8ccbede: Enable Robinhood Chain production as beta after canonical deployment, paired-testnet qualification,
143
+ and managed-service validation. Surface the same real-funds warning and testnet-first gate used for
144
+ other production beta networks.
145
+
146
+ ## 0.1.0-alpha.40
147
+
148
+ ### Patch Changes
149
+
150
+ - b9197bc: Record the exact-match canonical Robinhood Chain production deployment while keeping the network
151
+ disabled until its services and low-value acceptance gates pass.
152
+
153
+ ## 0.1.0-alpha.39
154
+
155
+ ### Patch Changes
156
+
157
+ - 3d7fe3c: Record the verified canonical Robinhood Chain Testnet deployment and enable the network for
158
+ experimental qualification with explicit CLI and agent guidance.
159
+ - 7b462e2: Update the SDK's Viem dependency to the latest compatible patch release.
160
+
161
+ ## 0.1.0-alpha.38
162
+
163
+ ### Patch Changes
164
+
165
+ - c2400a7: Stage Robinhood Chain and its testnet as disabled qualification targets, keep the network registry
166
+ focused on the current roadmap, and stop sale inspection from turning RPC read failures into false
167
+ zero-state results.
168
+
169
+ ## 0.1.0-alpha.37
170
+
171
+ ### Patch Changes
172
+
173
+ - 4512962: Enable Base production as beta, add a keyless read fallback, and surface production risk and paired-testnet guidance in the CLI, agent skill, and public docs.
174
+
175
+ ## 0.1.0-alpha.36
176
+
177
+ ### Patch Changes
178
+
179
+ - 5522192: Record the source-verified Base production contract deployment while keeping Base disabled for CLI
180
+ use until the separate beta-enablement release.
181
+
182
+ ## 0.1.0-alpha.35
183
+
184
+ ### Minor Changes
185
+
186
+ - 21e3d6c: Drop-in for existing v2 integrations; new deployments use the v3 production-candidate contracts.
187
+ Record the synchronized v3 factory generation and testnet deployments, retain full v2 service
188
+ compatibility (including already-assigned v2 sale minters), and update the renderer scaffold to
189
+ `abx-contracts` 3.0.0.
190
+
191
+ ## 0.1.0-alpha.34
192
+
193
+ ### Minor Changes
194
+
195
+ - 3ddba71: Drop-in for existing SDK callers; new consumers can inspect contract-generation compatibility.
196
+ Add the append-only generation registry, stable lookup helpers, and lifecycle and operation support
197
+ to provenance results.
198
+ - 9065128: Drop-in for existing clients; service consumers can now inspect verified contract-generation facts.
199
+ Advertise understood generations and include a project generation in summaries and status responses
200
+ only when factory provenance and the on-chain core version agree.
201
+
202
+ ## 0.1.0-alpha.33
203
+
204
+ ### Patch Changes
205
+
206
+ - 9242a05: Prepare package metadata, release notes, and public-facing source comments for the initial public
207
+ source release.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @artblocks/abx-sdk
2
+
3
+ The neutral, low-level TypeScript library for the ABX protocol — deploy, reconstruct from chain,
4
+ resolve a token, verify content. It picks no provider, no UX, and (beyond a default chain target)
5
+ no chain. Every ABX surface is built on this: the [`abx` CLI](https://docs.abx.io/docs/using-abx/installation)
6
+ is a shell over it, the reference resolver reads through it, and a competing provider can import
7
+ this same public library. If you're scripting one-off operations, the CLI is usually faster to
8
+ reach for — install with `abx skill install` and let an agent drive it. Reach for the SDK when you're
9
+ building something programmatic: a server, a mint endpoint, a scheduled job.
10
+
11
+ ESM-only, built on [viem](https://viem.sh), requires Node 22.13+. The package's main entry is
12
+ **browser-safe** — bundled and tested under `platform: 'browser'` on every change.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm install @artblocks/abx-sdk viem
18
+ ```
19
+
20
+ ```ts
21
+ import { makePublicClient, ensureFactory, deployOneOfOne } from '@artblocks/abx-sdk';
22
+ import { oneOfOneImageAbi } from '@artblocks/abx-sdk/abi';
23
+ ```
24
+
25
+ ## The send-injection model
26
+
27
+ Every write returns a `PreparedTx` — unsigned, with a human-readable `summary`/`fields` for a sign
28
+ page. The SDK never signs or broadcasts; it takes one function you provide:
29
+
30
+ ```ts
31
+ type SendTx = (tx: PreparedTx) => Promise<TransactionReceipt>;
32
+ ```
33
+
34
+ Every `deploy*`/`ensure*`/`prepare*`-and-execute function takes a `SendTx` as an argument, so how a
35
+ transaction gets signed is entirely your call:
36
+
37
+ - **`makeHotSender({ wallet, account, publicClient, onEvent? })`** — for an env/hot key. Pins the
38
+ nonce once (a distributed RPC can briefly serve a stale count right after a send, so it tracks the
39
+ nonce locally rather than re-reading it), detects an `eth_estimateGas` that came back impossibly
40
+ low (a sign the node hasn't seen a just-deployed target's code yet) and retries rather than sending
41
+ an under-funded transaction, and throws a typed `TxRevertedError` — never reports a burned,
42
+ reverted transaction as "confirmed."
43
+ - **Bring your own** — a browser wallet, a Safe/multisig flow, a queue you drain later. Anything
44
+ that signs a `PreparedTx.data` and returns a `TransactionReceipt` works.
45
+
46
+ Sequences: `runPrepared(txs, send)` sends a list in order. `batchOps(ops)` collapses same-target
47
+ runs into one `Multicallable.multicall` transaction — several owner edits become one signature,
48
+ all-or-nothing.
49
+
50
+ ## Worked example: deploy → upload → mint → read
51
+
52
+ ```ts
53
+ import {
54
+ makePublicClient, makeWalletClient, makeHotSender,
55
+ ensureFactory, deployOneOfOne, saltFor, predictClone,
56
+ prepareMint, runPrepared, listTokens, reconstructProject, readSaleConfig,
57
+ encodeTag, type OneOfOneInitParams,
58
+ } from '@artblocks/abx-sdk';
59
+ import { resolveBackend, uploadAndLocate } from '@artblocks/abx-storage';
60
+ import { zeroAddress, toHex } from 'viem';
61
+
62
+ const publicClient = makePublicClient({ chainKey: 'base-sepolia' });
63
+ const { wallet, account } = makeWalletClient({ chainKey: 'base-sepolia' }); // reads ABX_DEPLOYER_PK
64
+ const send = makeHotSender({ wallet, account, publicClient });
65
+
66
+ // 1. Deploy — resolve (or bootstrap) the chain's trust anchor, then deploy a clone.
67
+ const factory = await ensureFactory(publicClient, send, { chainId: 84532 });
68
+ const salt = saltFor(account.address); // front-run-proof: reserves the address to this signer
69
+ const clone = await predictClone(publicClient, { factory, salt });
70
+
71
+ // 2. Upload — put the image somewhere fetchable before baking its URL on-chain.
72
+ const backend = resolveBackend({ backend: 'ipfs' }); // or 'cloud' / 'arweave' / 'fs'
73
+ const bytes = new Uint8Array(/* … read your file … */);
74
+ const { locator } = await uploadAndLocate(backend, 'art.png', { bytes, contentType: 'image/png' });
75
+
76
+ const params: OneOfOneInitParams = {
77
+ owner: account.address,
78
+ mintTo: zeroAddress, // defer minting to step 3
79
+ name: 'My Piece', symbol: 'MYPC',
80
+ tokenURIBase: '', tokenURIRenderer: zeroAddress,
81
+ contractURIBase: '', contractURIRenderer: zeroAddress,
82
+ royaltyReceiver: account.address, royaltyBps: 500,
83
+ transferValidator: zeroAddress, // plain ERC-721; see ERC-721C in the site docs to opt in
84
+ tokenFields: [
85
+ // Bake the uploaded locator on-chain as the `image` field (an ipfs:// URI here; `arweave`/
86
+ // `url`/`keccak256` are the other off-chain representations — see the site docs for the choice,
87
+ // and `stageFieldContent` to put the bytes fully on-chain instead).
88
+ { field: encodeTag('image'), representation: encodeTag('ipfs'), value: toHex(locator) },
89
+ ],
90
+ contractFields: [],
91
+ };
92
+ const { txHash } = await deployOneOfOne(send, publicClient, { factory, params, salt });
93
+
94
+ // 3. Mint — deploy deferred it (mintTo was the zero address), so mint explicitly.
95
+ await runPrepared([prepareMint({ contract: clone, to: account.address, chainId: 84532 })], send);
96
+
97
+ // 4. Read — straight from chain, no indexer required.
98
+ const listing = await listTokens(publicClient, clone); // owners, seeds, params
99
+ const state = await reconstructProject(publicClient, { // full protocol state
100
+ address: clone, fromBlock: (await publicClient.getBlockNumber()) - 100n,
101
+ });
102
+ ```
103
+
104
+ `encodeTag`/`decodeTag` (from the same package) turn a field name like `"image"` into the
105
+ `bytes32` tag the contract expects — spelled out above only so the snippet is self-contained.
106
+ Selling through the shared fixed-price minter is `prepareConfigureSale` + `preparePurchase` +
107
+ `readSaleConfig(publicClient, minter, clone)` — see the [SDK reference](https://docs.abx.io/docs/reference/sdk)
108
+ for the full surface (Series, code/generative projects, on-chain content staging, ERC-721C, and more).
109
+
110
+ ## Browser use
111
+
112
+ The package's main entry (`.`) has **no Node-only imports** — it's bundled under
113
+ `platform: 'browser'` and asserted clean of `node:*` resolution on every change. In a browser:
114
+
115
+ - Pass `rpcUrls: [...]` explicitly to `makePublicClient`/`makeWalletClient` — there's no `process.env`
116
+ to fall back to, and the SDK never assumes one.
117
+ - Sign with a connected wallet (build the `SendTx` yourself around it) rather than `makeHotSender`,
118
+ which expects a local `WalletClient` backed by a key.
119
+ - **Never** import `@artblocks/abx-sdk/node` — that subpath is the *only* place `.env` loading lives
120
+ (`loadDotEnv`, needs `node:fs`/`node:path`) and it will break a browser bundle. A host (a CLI, a
121
+ server) calls `loadDotEnv()` once at startup; the SDK core just reads whatever's already in
122
+ `process.env` via a tiny `readEnv` that's a no-op outside Node.
123
+
124
+ The only signing-key env var the SDK ever reads is `ABX_DEPLOYER_PK` (via `makeWalletClient`/
125
+ `envSigningKey`) — and only as a *fallback* when you don't pass `privateKey`/`rpcUrls` explicitly.
126
+
127
+ ## More
128
+
129
+ Full API documentation by task (deploy, sell, operate, read, embed in a browser, talk to a resolver)
130
+ is in the [SDK reference](https://docs.abx.io/docs/reference/sdk).