@artblocks/abx-sdk 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (139) hide show
  1. package/README.md +131 -0
  2. package/dist/abi/generated.d.ts +8502 -129
  3. package/dist/abi/generated.d.ts.map +1 -1
  4. package/dist/abi/generated.js +40 -22
  5. package/dist/abi/generated.js.map +1 -1
  6. package/dist/abi/index.d.ts +2645 -168
  7. package/dist/abi/index.d.ts.map +1 -1
  8. package/dist/abi/index.js +34 -7
  9. package/dist/abi/index.js.map +1 -1
  10. package/dist/anchors.d.ts +266 -0
  11. package/dist/anchors.d.ts.map +1 -0
  12. package/dist/anchors.js +653 -0
  13. package/dist/anchors.js.map +1 -0
  14. package/dist/chains.d.ts +15 -9
  15. package/dist/chains.d.ts.map +1 -1
  16. package/dist/chains.js +19 -15
  17. package/dist/chains.js.map +1 -1
  18. package/dist/chunks.d.ts +53 -23
  19. package/dist/chunks.d.ts.map +1 -1
  20. package/dist/chunks.js +68 -6
  21. package/dist/chunks.js.map +1 -1
  22. package/dist/clients.d.ts +23 -11
  23. package/dist/clients.d.ts.map +1 -1
  24. package/dist/clients.js +17 -18
  25. package/dist/clients.js.map +1 -1
  26. package/dist/create2.d.ts +85 -1
  27. package/dist/create2.d.ts.map +1 -1
  28. package/dist/create2.js +159 -2
  29. package/dist/create2.js.map +1 -1
  30. package/dist/creator-token.d.ts +132 -0
  31. package/dist/creator-token.d.ts.map +1 -0
  32. package/dist/creator-token.js +183 -0
  33. package/dist/creator-token.js.map +1 -0
  34. package/dist/deploy.d.ts +234 -14
  35. package/dist/deploy.d.ts.map +1 -1
  36. package/dist/deploy.js +289 -111
  37. package/dist/deploy.js.map +1 -1
  38. package/dist/deployments.d.ts +12 -0
  39. package/dist/deployments.d.ts.map +1 -1
  40. package/dist/deployments.js +155 -28
  41. package/dist/deployments.js.map +1 -1
  42. package/dist/deps.d.ts +122 -5
  43. package/dist/deps.d.ts.map +1 -1
  44. package/dist/deps.js +248 -6
  45. package/dist/deps.js.map +1 -1
  46. package/dist/env.d.ts.map +1 -1
  47. package/dist/env.js +8 -0
  48. package/dist/env.js.map +1 -1
  49. package/dist/errors.d.ts +94 -0
  50. package/dist/errors.d.ts.map +1 -0
  51. package/dist/errors.js +126 -0
  52. package/dist/errors.js.map +1 -0
  53. package/dist/execute.d.ts +115 -0
  54. package/dist/execute.d.ts.map +1 -0
  55. package/dist/execute.js +142 -0
  56. package/dist/execute.js.map +1 -0
  57. package/dist/gateways.d.ts +79 -0
  58. package/dist/gateways.d.ts.map +1 -0
  59. package/dist/gateways.js +156 -0
  60. package/dist/gateways.js.map +1 -0
  61. package/dist/generator-document.d.ts +58 -0
  62. package/dist/generator-document.d.ts.map +1 -0
  63. package/dist/generator-document.js +124 -0
  64. package/dist/generator-document.js.map +1 -0
  65. package/dist/generator.d.ts +43 -1
  66. package/dist/generator.d.ts.map +1 -1
  67. package/dist/generator.js +29 -0
  68. package/dist/generator.js.map +1 -1
  69. package/dist/index.d.ts +17 -3
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +17 -3
  72. package/dist/index.js.map +1 -1
  73. package/dist/inspect.d.ts +48 -0
  74. package/dist/inspect.d.ts.map +1 -0
  75. package/dist/inspect.js +295 -0
  76. package/dist/inspect.js.map +1 -0
  77. package/dist/migrate.d.ts +41 -0
  78. package/dist/migrate.d.ts.map +1 -0
  79. package/dist/migrate.js +140 -0
  80. package/dist/migrate.js.map +1 -0
  81. package/dist/mime.d.ts +11 -0
  82. package/dist/mime.d.ts.map +1 -0
  83. package/dist/mime.js +40 -0
  84. package/dist/mime.js.map +1 -0
  85. package/dist/node.d.ts +10 -0
  86. package/dist/node.d.ts.map +1 -0
  87. package/dist/node.js +24 -0
  88. package/dist/node.js.map +1 -0
  89. package/dist/onchain-uri.d.ts +110 -0
  90. package/dist/onchain-uri.d.ts.map +1 -0
  91. package/dist/onchain-uri.js +273 -0
  92. package/dist/onchain-uri.js.map +1 -0
  93. package/dist/ops.d.ts +507 -14
  94. package/dist/ops.d.ts.map +1 -1
  95. package/dist/ops.js +848 -32
  96. package/dist/ops.js.map +1 -1
  97. package/dist/probe.d.ts +29 -0
  98. package/dist/probe.d.ts.map +1 -1
  99. package/dist/probe.js +104 -9
  100. package/dist/probe.js.map +1 -1
  101. package/dist/reconstruct.d.ts +92 -2
  102. package/dist/reconstruct.d.ts.map +1 -1
  103. package/dist/reconstruct.js +378 -93
  104. package/dist/reconstruct.js.map +1 -1
  105. package/dist/resume.d.ts +96 -0
  106. package/dist/resume.d.ts.map +1 -0
  107. package/dist/resume.js +95 -0
  108. package/dist/resume.js.map +1 -0
  109. package/dist/script-chunks.d.ts +24 -0
  110. package/dist/script-chunks.d.ts.map +1 -0
  111. package/dist/script-chunks.js +63 -0
  112. package/dist/script-chunks.js.map +1 -0
  113. package/dist/service.d.ts +188 -9
  114. package/dist/service.d.ts.map +1 -1
  115. package/dist/service.js +228 -18
  116. package/dist/service.js.map +1 -1
  117. package/dist/spine.d.ts +31 -4
  118. package/dist/spine.d.ts.map +1 -1
  119. package/dist/spine.js +0 -0
  120. package/dist/spine.js.map +1 -1
  121. package/dist/staging.d.ts +124 -0
  122. package/dist/staging.d.ts.map +1 -0
  123. package/dist/staging.js +134 -0
  124. package/dist/staging.js.map +1 -0
  125. package/dist/tokendata.d.ts +62 -2
  126. package/dist/tokendata.d.ts.map +1 -1
  127. package/dist/tokendata.js +79 -17
  128. package/dist/tokendata.js.map +1 -1
  129. package/dist/tokens.d.ts +94 -0
  130. package/dist/tokens.d.ts.map +1 -0
  131. package/dist/tokens.js +296 -0
  132. package/dist/tokens.js.map +1 -0
  133. package/dist/types.d.ts +60 -3
  134. package/dist/types.d.ts.map +1 -1
  135. package/dist/util.d.ts +74 -0
  136. package/dist/util.d.ts.map +1 -0
  137. package/dist/util.js +106 -0
  138. package/dist/util.js.map +1 -0
  139. package/package.json +10 -2
package/dist/clients.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { createPublicClient, createWalletClient, fallback, http, } from 'viem';
2
2
  import { privateKeyToAccount } from 'viem/accounts';
3
3
  import { DEFAULT_CHAIN_KEY, resolveChain, resolveRpcUrls, rpcEnvVar } from './chains.js';
4
- import { loadDotEnv } from './env.js';
4
+ import { readEnv } from './util.js';
5
+ import { MissingSigningKeyError } from './errors.js';
5
6
  /**
6
7
  * A transport over one or more endpoints. With several, a viem `fallback` fails
7
8
  * over on error — so a request one endpoint rejects (e.g. a too-wide `eth_getLogs`)
@@ -11,7 +12,7 @@ import { loadDotEnv } from './env.js';
11
12
  function makeTransport(opts) {
12
13
  if (opts.rpcUrl)
13
14
  return http(opts.rpcUrl);
14
- const urls = resolveRpcUrls(opts.chainKey);
15
+ const urls = resolveRpcUrls(opts.chainKey, opts.rpcUrls);
15
16
  if (urls.length <= 1)
16
17
  return http(urls[0]);
17
18
  return fallback(urls.map((u) => http(u, { retryCount: 0 })));
@@ -55,18 +56,17 @@ export async function assertChainId(chainKey = DEFAULT_CHAIN_KEY, opts = {}) {
55
56
  verifiedChains.add(chainKey);
56
57
  }
57
58
  /**
58
- * A signing client, backed by a private key from the environment. The SDK never
59
- * takes custody of keys beyond reading them from the operator's own env — there
60
- * is no key storage, no prompt, no remote signer here.
59
+ * A signing client, backed by a private key. The SDK never takes custody of keys beyond
60
+ * reading them from the operator's own env (or an explicit override) — there is no key
61
+ * storage, no prompt, no remote signer here.
61
62
  *
62
- * Key precedence: `ABX_DEPLOYER_PK` → `SEPOLIA_FUNDED_PK` → `SEPOLIA_WALLET_PK`.
63
+ * Key resolution: `opts.privateKey` → `ABX_DEPLOYER_PK`. That is the ONLY env name read —
64
+ * `SEPOLIA_FUNDED_PK` / `SEPOLIA_WALLET_PK` (earlier alphas) are no longer consulted.
63
65
  */
64
66
  export function makeWalletClient(opts = {}) {
65
- loadDotEnv();
66
- const pk = process.env.ABX_DEPLOYER_PK ?? process.env.SEPOLIA_FUNDED_PK ?? process.env.SEPOLIA_WALLET_PK;
67
- if (!pk) {
68
- throw new Error('No signing key found. Set ABX_DEPLOYER_PK, SEPOLIA_FUNDED_PK, or SEPOLIA_WALLET_PK in your .env.');
69
- }
67
+ const pk = opts.privateKey ?? readEnv('ABX_DEPLOYER_PK');
68
+ if (!pk)
69
+ throw new MissingSigningKeyError();
70
70
  const account = privateKeyToAccount(normalizePk(pk));
71
71
  const chain = resolveChain(opts.chainKey);
72
72
  const wallet = createWalletClient({ account, chain, transport: makeTransport(opts) });
@@ -77,14 +77,13 @@ function normalizePk(pk) {
77
77
  return (trimmed.startsWith('0x') ? trimmed : `0x${trimmed}`);
78
78
  }
79
79
  /**
80
- * The env signing key (0x-normalized), same precedence as {@link makeWalletClient}
81
- * (`ABX_DEPLOYER_PK` → `SEPOLIA_FUNDED_PK` → `SEPOLIA_WALLET_PK`), or `undefined` if none is set.
82
- * For reusing the hot key as a *storage* signing identity (an Ethereum Turbo identity) without
83
- * constructing a wallet client. Never throws.
80
+ * The signing key (0x-normalized), same resolution as {@link makeWalletClient}
81
+ * (`override` → `ABX_DEPLOYER_PK`), or `undefined` if none is set. For reusing the hot key as
82
+ * a *storage* signing identity (an Ethereum Turbo identity) without constructing a wallet
83
+ * client. Never throws.
84
84
  */
85
- export function envSigningKey() {
86
- loadDotEnv();
87
- const pk = process.env.ABX_DEPLOYER_PK ?? process.env.SEPOLIA_FUNDED_PK ?? process.env.SEPOLIA_WALLET_PK;
85
+ export function envSigningKey(override) {
86
+ const pk = override ?? readEnv('ABX_DEPLOYER_PK');
88
87
  return pk ? normalizePk(pk) : undefined;
89
88
  }
90
89
  //# sourceMappingURL=clients.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clients.js","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,IAAI,GAKL,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;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CAAC;AAC/B,CAAC;AASD;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA4B,EAAE;IAI7D,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,sBAAsB,EAAE,CAAC;IAC5C,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC;IACpF,OAAO,EAAC,MAAM,EAAE,OAAO,EAAC,CAAC;AAC3B,CAAC;AAED,SAAS,WAAW,CAAC,EAAU;IAC7B,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAC1B,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAkB,CAAC;AAChF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,QAAc;IAC1C,MAAM,EAAE,GAAG,QAAQ,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC"}
package/dist/create2.d.ts CHANGED
@@ -11,7 +11,9 @@ import { type Address, type Hex } from 'viem';
11
11
  /** The keyless CREATE2 proxy (Arachnid deterministic-deployment-proxy). Same address on every chain. */
12
12
  export declare const CREATE2_PROXY: Address;
13
13
  /** Canonical salt strings — MUST stay byte-identical to `contracts/script/AbxSalts.sol`, since the
14
- * deterministic address is `keccak256(0xff ++ proxy ++ keccak256(salt) ++ keccak256(initcode))`. */
14
+ * deterministic address is `keccak256(0xff ++ proxy ++ keccak256(salt) ++ keccak256(initcode))`.
15
+ * `test/create2-salts.test.ts` diffs this table against that file, both ways, so drift can't be
16
+ * quiet: the two halves have to be one fact. */
15
17
  export declare const ABX_SALT: {
16
18
  readonly oneOfOneFactory: "abx.factory.one-of-one.v1";
17
19
  readonly seriesFactory: "abx.factory.series.v1";
@@ -21,6 +23,14 @@ export declare const ABX_SALT: {
21
23
  readonly fixedPriceMinter: "abx.minter.fixed-price.v1";
22
24
  readonly seedSource: "abx.seed-source.v1";
23
25
  readonly generator: "abx.generator.v1";
26
+ readonly oneOfOneEditionFactory: "abx.one-of-one-edition-factory.v1";
27
+ readonly editionFactory: "abx.edition-factory.v1";
28
+ readonly editionCodeFactory: "abx.edition-code-factory.v1";
29
+ readonly fixedPriceMinter1155: "abx.fixed-price-minter-1155.v1";
30
+ readonly paramsLib: "abx.lib.params.v1";
31
+ readonly codeLib: "abx.lib.code.v1";
32
+ readonly editionLib: "abx.lib.edition.v1";
33
+ readonly metadataLib: "abx.lib.metadata.v1";
24
34
  };
25
35
  /** The 32-byte salt a CREATE2 deploy uses (`keccak256` of the canonical string). */
26
36
  export declare const saltHash: (salt: string) => Hex;
@@ -39,4 +49,78 @@ export declare const predictFixedPriceMinter: () => Address;
39
49
  * (`DeploySeedSource.s.sol`) so it compiles at the default profile — bundling it with the
40
50
  * SeriesCode factory's `clone-impl` unit yields a different, non-canonical bytecode + address. */
41
51
  export declare const predictSeedSource: () => Address;
52
+ /** The canonical (cross-chain-identical) `OneOfOneImageFactory` address for the current bytecode —
53
+ * the 721 1/1 trust anchor. */
54
+ export declare const predictFactory: () => Address;
55
+ /** The canonical (cross-chain-identical) `SeriesImageFactory` address for the current bytecode —
56
+ * the 721 multi-token trust anchor. */
57
+ export declare const predictSeriesFactory: () => Address;
58
+ /** The canonical (cross-chain-identical) `AbxFixedPriceMinter1155` address for the current
59
+ * bytecode — the shared, ownerless edition sale singleton. */
60
+ export declare const predictFixedPriceMinter1155: () => Address;
61
+ /** Fully-qualified library names (solc's link keys — path-sensitive, so they must match how the
62
+ * contracts are compiled: `src/libraries/…` as `foundry.toml` sees them). */
63
+ export declare const LIB_FQN: {
64
+ readonly paramsLib: "src/libraries/AbxParamsLib.sol:AbxParamsLib";
65
+ readonly codeLib: "src/libraries/AbxCodeLib.sol:AbxCodeLib";
66
+ readonly editionLib: "src/libraries/AbxEditionLib.sol:AbxEditionLib";
67
+ readonly metadataLib: "src/libraries/AbxMetadataLib.sol:AbxMetadataLib";
68
+ };
69
+ /** The solc link placeholder for a fully-qualified library name: `__$<keccak(fqn)[0:34]>$__`. */
70
+ export declare const libPlaceholder: (fullyQualified: string) => string;
71
+ /**
72
+ * Link `bytecode` against deployed libraries — the post-compile placeholder substitution `forge`
73
+ * does at build time, done here so a sandbox / fresh chain needs no forge. Throws if any
74
+ * placeholder is left over, since an unlinked `__$…$__` is not valid hex and the RPC would reject
75
+ * the transaction with an opaque `Invalid byte sequence`.
76
+ */
77
+ export declare function linkLibraries(bytecode: Hex, links: ReadonlyArray<readonly [fqn: string, address: Address]>): Hex;
78
+ /** The canonical (cross-chain-identical) `AbxParamsLib` address — the params write path both code
79
+ * token types delegatecall. */
80
+ export declare const predictParamsLib: () => Address;
81
+ /** The canonical (cross-chain-identical) `AbxCodeLib` address — the script/code write path. */
82
+ export declare const predictCodeLib: () => Address;
83
+ /** The canonical (cross-chain-identical) `AbxEditionLib` address — the 1155 uri / creator-token /
84
+ * edition-supply write path that **all three** edition token types (`OneOfOneEdition`,
85
+ * `EditionImage`, `EditionCode`) delegatecall.
86
+ * `AbxEditionLib` itself delegatecalls `AbxParamsLib`, so it is linked before it is deployed: the
87
+ * one library here whose own initcode depends on another library's address. */
88
+ export declare const predictEditionLib: () => Address;
89
+ /** The canonical `AbxMetadataLib` address. Linked by ALL SIX token types — the metadata field store
90
+ * was inlined into every one of them until the 2026-08-14 audit asked for EIP-170 headroom before
91
+ * further remediation, so externalizing it is what made even the plainest 721 factory
92
+ * library-linked. It links nothing itself, so it is deployed first. */
93
+ export declare const predictMetadataLib: () => Address;
94
+ /** `AbxEditionLib`'s canonical initcode: its shipped bytecode linked against `AbxParamsLib`. */
95
+ export declare const linkEditionLib: () => Hex;
96
+ /** `OneOfOneEditionFactory`'s canonical initcode: linked against `AbxEditionLib` (the only library
97
+ * its embedded `OneOfOneEdition` implementation delegates into). `AbxEditionLib`'s own address
98
+ * already accounts for its `AbxParamsLib` link — see {@link predictEditionLib}. */
99
+ export declare const linkOneOfOneEditionFactory: () => Hex;
100
+ /** `EditionImageFactory`'s canonical initcode: linked against `AbxEditionLib`, the sibling of
101
+ * {@link linkOneOfOneEditionFactory}. */
102
+ export declare const linkEditionFactory: () => Hex;
103
+ /** `SeriesCodeFactory`'s canonical initcode: linked against the two write-path libraries. */
104
+ export declare const linkSeriesCodeFactory: () => Hex;
105
+ /** `EditionCodeFactory`'s canonical initcode: linked against all three write-path libraries. */
106
+ export declare const linkEditionCodeFactory: () => Hex;
107
+ /** The two ERC-721 image factories' canonical initcode. They linked NOTHING until the metadata
108
+ * field store was externalized; now every token type is library-linked. */
109
+ export declare const linkFactory: () => Hex;
110
+ export declare const linkSeriesFactory: () => Hex;
111
+ /** The canonical (cross-chain-identical) `SeriesCodeFactory` address — the code-project trust
112
+ * anchor. Predictable because its libraries are (see the section note above). */
113
+ export declare const predictSeriesCodeFactory: () => Address;
114
+ /** The canonical (cross-chain-identical) `EditionCodeFactory` address — the code-project EDITION
115
+ * trust anchor. */
116
+ export declare const predictEditionCodeFactory: () => Address;
117
+ /** The canonical (cross-chain-identical) `OneOfOneEditionFactory` address — the 1/1-edition trust
118
+ * anchor. Predicted from LINKED initcode: `OneOfOneEdition` delegates its uri / creator-token /
119
+ * edition-supply bodies into `AbxEditionLib`, so the shipped factory bytecode carries a link
120
+ * placeholder (hashing it unlinked yields a plausible-looking address for a trust anchor that
121
+ * nothing can ever be deployed to — see the section note). */
122
+ export declare const predictOneOfOneEditionFactory: () => Address;
123
+ /** The canonical (cross-chain-identical) `EditionImageFactory` address — the multi-work edition
124
+ * trust anchor, the sibling of {@link predictOneOfOneEditionFactory} (same single library link). */
125
+ export declare const predictEditionFactory: () => Address;
42
126
  //# sourceMappingURL=create2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create2.d.ts","sourceRoot":"","sources":["../src/create2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,OAAO,EAAE,KAAK,GAAG,EAAC,MAAM,MAAM,CAAC;AAQ5F;;;;;;;;GAQG;AAEH,wGAAwG;AACxG,eAAO,MAAM,aAAa,EAAE,OAAsD,CAAC;AAEnF;qGACqG;AACrG,eAAO,MAAM,QAAQ;;;;;;;;;CASX,CAAC;AAEX,oFAAoF;AACpF,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,GAA+B,CAAC;AAExE;6CAC6C;AAC7C,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAE1E;AAED,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,GAAG,CAEhE;AAED,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,QAAO,OAA4E,CAAC;AAElH,kGAAkG;AAClG,eAAO,MAAM,eAAe,QAAO,OAAgF,CAAC;AAEpH,kGAAkG;AAClG,eAAO,MAAM,uBAAuB,QAAO,OACoC,CAAC;AAEhF;;mGAEmG;AACnG,eAAO,MAAM,iBAAiB,QAAO,OAA4E,CAAC"}
1
+ {"version":3,"file":"create2.d.ts","sourceRoot":"","sources":["../src/create2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,OAAO,EAAE,KAAK,GAAG,EAAC,MAAM,MAAM,CAAC;AAmB5F;;;;;;;;GAQG;AAEH,wGAAwG;AACxG,eAAO,MAAM,aAAa,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AAEzG;;;;gFAIgF;AAChF,eAAO,MAAM,iBAAiB,QAAO,OACyB,CAAC;AAE/D;;;wEAGwE;AACxE,eAAO,MAAM,kBAAkB,QAAO,OAC+B,CAAC;AAEtE,gGAAgG;AAChG,eAAO,MAAM,cAAc,QAAO,GAC+C,CAAC;AAElF;;oFAEoF;AACpF,eAAO,MAAM,0BAA0B,QAAO,GAI1C,CAAC;AAEL;0CAC0C;AAC1C,eAAO,MAAM,kBAAkB,QAAO,GAIlC,CAAC;AAEL,6FAA6F;AAC7F,eAAO,MAAM,qBAAqB,QAAO,GAKrC,CAAC;AAEL,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,QAAO,GAMtC,CAAC;AAEL;4EAC4E;AAC5E,eAAO,MAAM,WAAW,QAAO,GAC6D,CAAC;AAE7F,eAAO,MAAM,iBAAiB,QAAO,GACqD,CAAC;AAE3F;kFACkF;AAClF,eAAO,MAAM,wBAAwB,QAAO,OACgC,CAAC;AAE7E;oBACoB;AACpB,eAAO,MAAM,yBAAyB,QAAO,OACiC,CAAC;AAE/E;;;;+DAI+D;AAC/D,eAAO,MAAM,6BAA6B,QAAO,OACqC,CAAC;AAEvF;qGACqG;AACrG,eAAO,MAAM,qBAAqB,QAAO,OAC6B,CAAC"}
package/dist/create2.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { concat, getContractAddress, keccak256, toBytes } from 'viem';
2
- import { abxChunkStoreBytecode, abxFixedPriceMinterBytecode, abxMetadataRendererBytecode, abxSeedSourceBytecode, } from './abi/index.js';
2
+ import { abxChunkStoreBytecode, abxCodeLibBytecode, abxEditionLibBytecode, abxMetadataLibBytecode, abxFixedPriceMinterBytecode, abxFixedPriceMinter1155Bytecode, abxMetadataRendererBytecode, abxParamsLibBytecode, abxSeedSourceBytecode, editionCodeFactoryBytecode, editionImageFactoryBytecode, oneOfOneEditionFactoryBytecode, oneOfOneImageFactoryBytecode, seriesCodeFactoryBytecode, seriesImageFactoryBytecode, } from './abi/index.js';
3
3
  /**
4
4
  * Keyless CREATE2 deployment — the TS twin of `contracts/script/AbxSalts.sol`.
5
5
  *
@@ -12,7 +12,9 @@ import { abxChunkStoreBytecode, abxFixedPriceMinterBytecode, abxMetadataRenderer
12
12
  /** The keyless CREATE2 proxy (Arachnid deterministic-deployment-proxy). Same address on every chain. */
13
13
  export const CREATE2_PROXY = '0x4e59b44847b379578588920cA78FbF26c0B4956C';
14
14
  /** Canonical salt strings — MUST stay byte-identical to `contracts/script/AbxSalts.sol`, since the
15
- * deterministic address is `keccak256(0xff ++ proxy ++ keccak256(salt) ++ keccak256(initcode))`. */
15
+ * deterministic address is `keccak256(0xff ++ proxy ++ keccak256(salt) ++ keccak256(initcode))`.
16
+ * `test/create2-salts.test.ts` diffs this table against that file, both ways, so drift can't be
17
+ * quiet: the two halves have to be one fact. */
16
18
  export const ABX_SALT = {
17
19
  oneOfOneFactory: 'abx.factory.one-of-one.v1',
18
20
  seriesFactory: 'abx.factory.series.v1',
@@ -22,6 +24,17 @@ export const ABX_SALT = {
22
24
  fixedPriceMinter: 'abx.minter.fixed-price.v1',
23
25
  seedSource: 'abx.seed-source.v1',
24
26
  generator: 'abx.generator.v1',
27
+ // ERC-1155 editions (twins of the above; naming follows the parity plan verbatim).
28
+ oneOfOneEditionFactory: 'abx.one-of-one-edition-factory.v1',
29
+ editionFactory: 'abx.edition-factory.v1',
30
+ editionCodeFactory: 'abx.edition-code-factory.v1',
31
+ fixedPriceMinter1155: 'abx.fixed-price-minter-1155.v1',
32
+ // Delegatecalled write-path libraries — CREATE2 like everything else here (see the
33
+ // "delegatecalled write-path libraries" note below, and `DeployLibraries.s.sol`).
34
+ paramsLib: 'abx.lib.params.v1',
35
+ codeLib: 'abx.lib.code.v1',
36
+ editionLib: 'abx.lib.edition.v1',
37
+ metadataLib: 'abx.lib.metadata.v1',
25
38
  };
26
39
  /** The 32-byte salt a CREATE2 deploy uses (`keccak256` of the canonical string). */
27
40
  export const saltHash = (salt) => keccak256(toBytes(salt));
@@ -44,4 +57,148 @@ export const predictFixedPriceMinter = () => predictCreate2Address(ABX_SALT.fixe
44
57
  * (`DeploySeedSource.s.sol`) so it compiles at the default profile — bundling it with the
45
58
  * SeriesCode factory's `clone-impl` unit yields a different, non-canonical bytecode + address. */
46
59
  export const predictSeedSource = () => predictCreate2Address(ABX_SALT.seedSource, abxSeedSourceBytecode);
60
+ // ── ERC-1155 editions ──────────────────────────────────────────────────────────
61
+ //
62
+ // `DeployOneOfOneEdition.s.sol` / `DeployEdition.s.sol` / `DeployMinter1155.s.sol` each deploy
63
+ // their contract with a fixed `AbxSalts` salt and NO constructor args, so the salt + this build's
64
+ // bytecode fix the address before any deploy. `AbxFixedPriceMinter1155` is a plain singleton and is
65
+ // predicted right below; the two edition IMAGE factories are not — `OneOfOneEdition`/`EditionImage`
66
+ // both delegate bodies into `AbxEditionLib`, so their factories carry a link placeholder and their
67
+ // predictions live with the library-linked factories in the write-path-library section below
68
+ // (`predictOneOfOneEditionFactory`/`predictEditionFactory`), next to the two code factories.
69
+ /** The canonical (cross-chain-identical) `OneOfOneImageFactory` address for the current bytecode —
70
+ * the 721 1/1 trust anchor. */
71
+ export const predictFactory = () => predictCreate2Address(ABX_SALT.oneOfOneFactory, linkFactory());
72
+ /** The canonical (cross-chain-identical) `SeriesImageFactory` address for the current bytecode —
73
+ * the 721 multi-token trust anchor. */
74
+ export const predictSeriesFactory = () => predictCreate2Address(ABX_SALT.seriesFactory, linkSeriesFactory());
75
+ /** The canonical (cross-chain-identical) `AbxFixedPriceMinter1155` address for the current
76
+ * bytecode — the shared, ownerless edition sale singleton. */
77
+ export const predictFixedPriceMinter1155 = () => predictCreate2Address(ABX_SALT.fixedPriceMinter1155, abxFixedPriceMinter1155Bytecode);
78
+ // ── delegatecalled write-path libraries ────────────────────────────────────────
79
+ //
80
+ // A `public` library function is compiled as a `delegatecall` to a SEPARATELY deployed copy of the
81
+ // library, and solc leaves a `__$<id>$__` placeholder in the caller's bytecode where that copy's
82
+ // address goes. Linking is the substitution of an address into that placeholder.
83
+ //
84
+ // **Linking does not cost determinism.** These libraries are deployed through the same keyless
85
+ // CREATE2 proxy at the canonical salts above (`DeployLibraries.s.sol` is the forge twin), so a
86
+ // library's address is `f(proxy, salt, creation bytecode)` and nothing else — the deployer's nonce
87
+ // is not an input to a CREATE2 address (it is an input to plain `CREATE`, which is where the
88
+ // confusion came from). Predict the libraries, substitute them, and the linked factory's initcode
89
+ // is fixed too — hence the FOUR `predict*Factory` helpers at the bottom of this section.
90
+ //
91
+ // Worth stating plainly, because the opposite belief was load-bearing: two ERC-1155 token types
92
+ // (`OneOfOneEdition`/`EditionImage`) were held library-free and an EIP-170 size floor was relaxed to
93
+ // avoid "losing" a factory's deterministic address. What was actually true was narrower and
94
+ // self-inflicted — the SDK deployed its libraries with a plain EOA `CREATE` (`to: null`) by its own
95
+ // choice, so *it* could not predict them, and that local limitation was written up as a property of
96
+ // libraries in general. It isn't one. The broadcast artifacts always said so: every recorded library
97
+ // deploy went through the keyless proxy, and `AbxParamsLib` landed at ONE address on Sepolia and
98
+ // Base Sepolia from deployer nonces 215 apart. Both of those token types now delegate into
99
+ // `AbxEditionLib` exactly as `EditionCode` does, so FOUR factories here are library-linked, not two.
100
+ //
101
+ // **Losing track of that is a bug class, not a footnote.** Three separate times a contract became
102
+ // library-linked and this file went on hashing its UNLINKED bytecode, and the failure is silent:
103
+ // viem does not reject a `__$…$__` placeholder, it UTF-8-encodes it — so the prediction is a
104
+ // real-looking address that is the hash of ASCII garbage, for the addresses platforms allowlist, and
105
+ // the same bytes would go out as initcode. `link.test.ts`'s "nothing deployable carries a
106
+ // placeholder" guard derives its subject set from the exported bytecodes rather than a list of
107
+ // names, precisely so the next contract to become library-linked cannot escape the same way.
108
+ //
109
+ // **The real trap is compile-time linking, not linking.** Substituting into the placeholder happens
110
+ // AFTER compilation, so it cannot change the library's own creation bytecode. Handing solc the
111
+ // addresses at build time instead (`forge build/script --libraries src/…:Lib:0x…`) writes the
112
+ // library map into `settings.libraries` in every artifact's metadata, and the metadata hash is
113
+ // appended to the creation bytecode — so the library's own address moves, and so does the linked
114
+ // factory's. Optimizer settings do the same (the code tokens compile at `optimizer_runs = 200`,
115
+ // everything else at 1,000,000). One canonical bytecode per library, therefore: the one
116
+ // `sync-abis` reads from a plain `forge build`, which is what these predictions use.
117
+ /** Fully-qualified library names (solc's link keys — path-sensitive, so they must match how the
118
+ * contracts are compiled: `src/libraries/…` as `foundry.toml` sees them). */
119
+ export const LIB_FQN = {
120
+ paramsLib: 'src/libraries/AbxParamsLib.sol:AbxParamsLib',
121
+ codeLib: 'src/libraries/AbxCodeLib.sol:AbxCodeLib',
122
+ editionLib: 'src/libraries/AbxEditionLib.sol:AbxEditionLib',
123
+ metadataLib: 'src/libraries/AbxMetadataLib.sol:AbxMetadataLib',
124
+ };
125
+ /** The solc link placeholder for a fully-qualified library name: `__$<keccak(fqn)[0:34]>$__`. */
126
+ export const libPlaceholder = (fullyQualified) => `__$${keccak256(toBytes(fullyQualified)).slice(2, 36)}$__`;
127
+ /**
128
+ * Link `bytecode` against deployed libraries — the post-compile placeholder substitution `forge`
129
+ * does at build time, done here so a sandbox / fresh chain needs no forge. Throws if any
130
+ * placeholder is left over, since an unlinked `__$…$__` is not valid hex and the RPC would reject
131
+ * the transaction with an opaque `Invalid byte sequence`.
132
+ */
133
+ export function linkLibraries(bytecode, links) {
134
+ let out = bytecode;
135
+ for (const [fqn, address] of links)
136
+ out = out.split(libPlaceholder(fqn)).join(address.slice(2).toLowerCase());
137
+ if (out.includes('__$'))
138
+ throw new Error(`unlinked library placeholder remains: ${/__\$[0-9a-f]{34}\$__/.exec(out)?.[0]}`);
139
+ return out;
140
+ }
141
+ /** The canonical (cross-chain-identical) `AbxParamsLib` address — the params write path both code
142
+ * token types delegatecall. */
143
+ export const predictParamsLib = () => predictCreate2Address(ABX_SALT.paramsLib, abxParamsLibBytecode);
144
+ /** The canonical (cross-chain-identical) `AbxCodeLib` address — the script/code write path. */
145
+ export const predictCodeLib = () => predictCreate2Address(ABX_SALT.codeLib, abxCodeLibBytecode);
146
+ /** The canonical (cross-chain-identical) `AbxEditionLib` address — the 1155 uri / creator-token /
147
+ * edition-supply write path that **all three** edition token types (`OneOfOneEdition`,
148
+ * `EditionImage`, `EditionCode`) delegatecall.
149
+ * `AbxEditionLib` itself delegatecalls `AbxParamsLib`, so it is linked before it is deployed: the
150
+ * one library here whose own initcode depends on another library's address. */
151
+ export const predictEditionLib = () => predictCreate2Address(ABX_SALT.editionLib, linkEditionLib());
152
+ /** The canonical `AbxMetadataLib` address. Linked by ALL SIX token types — the metadata field store
153
+ * was inlined into every one of them until the 2026-08-14 audit asked for EIP-170 headroom before
154
+ * further remediation, so externalizing it is what made even the plainest 721 factory
155
+ * library-linked. It links nothing itself, so it is deployed first. */
156
+ export const predictMetadataLib = () => predictCreate2Address(ABX_SALT.metadataLib, abxMetadataLibBytecode);
157
+ /** `AbxEditionLib`'s canonical initcode: its shipped bytecode linked against `AbxParamsLib`. */
158
+ export const linkEditionLib = () => linkLibraries(abxEditionLibBytecode, [[LIB_FQN.paramsLib, predictParamsLib()]]);
159
+ /** `OneOfOneEditionFactory`'s canonical initcode: linked against `AbxEditionLib` (the only library
160
+ * its embedded `OneOfOneEdition` implementation delegates into). `AbxEditionLib`'s own address
161
+ * already accounts for its `AbxParamsLib` link — see {@link predictEditionLib}. */
162
+ export const linkOneOfOneEditionFactory = () => linkLibraries(oneOfOneEditionFactoryBytecode, [
163
+ [LIB_FQN.editionLib, predictEditionLib()],
164
+ [LIB_FQN.metadataLib, predictMetadataLib()],
165
+ ]);
166
+ /** `EditionImageFactory`'s canonical initcode: linked against `AbxEditionLib`, the sibling of
167
+ * {@link linkOneOfOneEditionFactory}. */
168
+ export const linkEditionFactory = () => linkLibraries(editionImageFactoryBytecode, [
169
+ [LIB_FQN.editionLib, predictEditionLib()],
170
+ [LIB_FQN.metadataLib, predictMetadataLib()],
171
+ ]);
172
+ /** `SeriesCodeFactory`'s canonical initcode: linked against the two write-path libraries. */
173
+ export const linkSeriesCodeFactory = () => linkLibraries(seriesCodeFactoryBytecode, [
174
+ [LIB_FQN.paramsLib, predictParamsLib()],
175
+ [LIB_FQN.codeLib, predictCodeLib()],
176
+ [LIB_FQN.metadataLib, predictMetadataLib()],
177
+ ]);
178
+ /** `EditionCodeFactory`'s canonical initcode: linked against all three write-path libraries. */
179
+ export const linkEditionCodeFactory = () => linkLibraries(editionCodeFactoryBytecode, [
180
+ [LIB_FQN.paramsLib, predictParamsLib()],
181
+ [LIB_FQN.codeLib, predictCodeLib()],
182
+ [LIB_FQN.editionLib, predictEditionLib()],
183
+ [LIB_FQN.metadataLib, predictMetadataLib()],
184
+ ]);
185
+ /** The two ERC-721 image factories' canonical initcode. They linked NOTHING until the metadata
186
+ * field store was externalized; now every token type is library-linked. */
187
+ export const linkFactory = () => linkLibraries(oneOfOneImageFactoryBytecode, [[LIB_FQN.metadataLib, predictMetadataLib()]]);
188
+ export const linkSeriesFactory = () => linkLibraries(seriesImageFactoryBytecode, [[LIB_FQN.metadataLib, predictMetadataLib()]]);
189
+ /** The canonical (cross-chain-identical) `SeriesCodeFactory` address — the code-project trust
190
+ * anchor. Predictable because its libraries are (see the section note above). */
191
+ export const predictSeriesCodeFactory = () => predictCreate2Address(ABX_SALT.seriesCodeFactory, linkSeriesCodeFactory());
192
+ /** The canonical (cross-chain-identical) `EditionCodeFactory` address — the code-project EDITION
193
+ * trust anchor. */
194
+ export const predictEditionCodeFactory = () => predictCreate2Address(ABX_SALT.editionCodeFactory, linkEditionCodeFactory());
195
+ /** The canonical (cross-chain-identical) `OneOfOneEditionFactory` address — the 1/1-edition trust
196
+ * anchor. Predicted from LINKED initcode: `OneOfOneEdition` delegates its uri / creator-token /
197
+ * edition-supply bodies into `AbxEditionLib`, so the shipped factory bytecode carries a link
198
+ * placeholder (hashing it unlinked yields a plausible-looking address for a trust anchor that
199
+ * nothing can ever be deployed to — see the section note). */
200
+ export const predictOneOfOneEditionFactory = () => predictCreate2Address(ABX_SALT.oneOfOneEditionFactory, linkOneOfOneEditionFactory());
201
+ /** The canonical (cross-chain-identical) `EditionImageFactory` address — the multi-work edition
202
+ * trust anchor, the sibling of {@link predictOneOfOneEditionFactory} (same single library link). */
203
+ export const predictEditionFactory = () => predictCreate2Address(ABX_SALT.editionFactory, linkEditionFactory());
47
204
  //# sourceMappingURL=create2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create2.js","sourceRoot":"","sources":["../src/create2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,EAAyB,MAAM,MAAM,CAAC;AAC5F,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;GAQG;AAEH,wGAAwG;AACxG,MAAM,CAAC,MAAM,aAAa,GAAY,4CAA4C,CAAC;AAEnF;qGACqG;AACrG,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,eAAe,EAAE,2BAA2B;IAC5C,aAAa,EAAE,uBAAuB;IACtC,iBAAiB,EAAE,4BAA4B;IAC/C,QAAQ,EAAE,iBAAiB;IAC3B,UAAU,EAAE,oBAAoB;IAChC,gBAAgB,EAAE,2BAA2B;IAC7C,UAAU,EAAE,oBAAoB;IAChC,SAAS,EAAE,kBAAkB;CACrB,CAAC;AAEX,oFAAoF;AACpF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAO,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAExE;6CAC6C;AAC7C,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,QAAa;IAC/D,OAAO,kBAAkB,CAAC,EAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAC,CAAC,CAAC;AACtG,CAAC;AAED,0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GAAY,EAAE,CACjD,qBAAqB,CAAC,QAAQ,CAAC,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * ERC-721C creator-token support — the opt-in transfer-validation surface.
3
+ *
4
+ * An ABX token enrolls at deploy, permanently, by passing a non-zero `transferValidator` in
5
+ * its InitParams (see `deploy.ts`); zero leaves a plain ERC-721 forever, indistinguishable
6
+ * from a pre-721C token (ERC-165 and the extension beacon both branch on enrollment). Within
7
+ * an enrolled token the owner re-points the validator freely or suspends enforcement with
8
+ * zero — never un-enrolls. Every transfer that isn't a mint/burn (or the validator's own)
9
+ * staticcalls `validateTransfer(caller, from, to, tokenId)` on the validator; a policy
10
+ * violation reverts and bubbles.
11
+ *
12
+ * **`setTransferValidator` is owner-only only while the collection has an owner.** Once
13
+ * `owner() == address(0)` the contract opens one asymmetric door: **anyone** may suspend
14
+ * enforcement by passing `zeroAddress`, and nobody — including that caller — may ever arm a
15
+ * validator again. That is the dead-man release for the worst reachable state (a validator that
16
+ * reverts every transfer on a collection with nobody left to re-point it, which would otherwise
17
+ * strand every collector's token forever). An integrator building for collectors should expose
18
+ * that suspension path on a renounced collection rather than gating it behind an owner check that
19
+ * can no longer be satisfied — see {@link prepareSetTransferValidator}.
20
+ */
21
+ import { type Address, type PublicClient } from 'viem';
22
+ import type { PreparedTx } from './ops.js';
23
+ /** ERC-165 id of `ICreatorToken` — advertised (with the legacy id) only when enrolled. */
24
+ export declare const CREATOR_TOKEN_INTERFACE_ID: "0xad0d7f6c";
25
+ /** ERC-165 id of `ICreatorTokenLegacy` — the subset older marketplaces probe for. */
26
+ export declare const CREATOR_TOKEN_LEGACY_INTERFACE_ID: "0xa07d229a";
27
+ /** keccak256("abx.extension.creator-token") — `extensionVersion(id)` is 1 only when enrolled. */
28
+ export declare const CREATOR_TOKEN_EXTENSION_ID: "0x0839e7ed7fc1f5db3f253851d61b10f852045c5520c2936138b121b73e7e27c0";
29
+ /**
30
+ * The recommended transfer validator per chain — OpenSea's
31
+ * **StrictAuthorizedTransferSecurityRegistry**, the validator their creator-fee-enforcement
32
+ * doc recommends for enforcement eligibility (docs.opensea.io "Creator Fee Enforcement",
33
+ * checked 2026-08; the named alternative is Limit Break's CreatorTokenTransferValidator
34
+ * 0x721C0078c2328597Ca70F5451ffF5A7B38D4E947). Verified empirically against the LIVE
35
+ * contracts on 2026-08-04 (`cast call --from <collection>` on the 4-arg
36
+ * `validateTransfer(address,address,address,uint256)` overload, both chains):
37
+ * an owner-initiated (OTC) transfer succeeds; an unauthorized operator reverts
38
+ * `StrictAuthorizedTransferSecurityRegistry__UnauthorizedTransfer()`.
39
+ *
40
+ * CREATE2-style vanity address, identical on both shipped chains — kept per-chain anyway
41
+ * (keyed like `deployments.ts`) because presence-on-chain is the fact that matters, and a
42
+ * future chain may recommend a different validator.
43
+ */
44
+ export declare const RECOMMENDED_TRANSFER_VALIDATOR: Record<number, Address>;
45
+ /** The recommended validator for a chain (undefined if none is known — never guess one). */
46
+ export declare function resolveRecommendedTransferValidator(chainId: number): Address | undefined;
47
+ /** A token's creator-token (ERC-721C) status, read from chain. */
48
+ export interface CreatorTokenStatus {
49
+ /** True iff the token enrolled at deploy (permanent). False = plain ERC-721, forever. */
50
+ enrolled: boolean;
51
+ /** The active validator (`zeroAddress` when unenrolled, or enrolled-but-suspended). */
52
+ validator: Address;
53
+ }
54
+ /**
55
+ * Read whether `contract` is an enrolled ERC-721C creator token, and its active validator.
56
+ * Enrollment comes from ERC-165 (`ICreatorToken`, which the token advertises only when
57
+ * enrolled); the validator from `getTransferValidator()`. Both reads are defensive — a
58
+ * pre-721C ABX token has neither branch (no `getTransferValidator` selector at all), and
59
+ * must read as `{enrolled: false, validator: zeroAddress}`, not as an error.
60
+ */
61
+ export declare function readCreatorTokenStatus(client: PublicClient, contract: Address): Promise<CreatorTokenStatus>;
62
+ /** What {@link probeTransferValidator} found. Only `ok` may be written to a live collection.
63
+ *
64
+ * - `ok` — the address has code and refuses a selector no validator implements,
65
+ * which is what every live validator does (see the probe's doc).
66
+ * - `no-code` — nothing deployed at this address on this chain. Enforcement would read
67
+ * as ON everywhere and check nothing.
68
+ * - `permissive-fallback` — it has code, but it answers an unknown selector *successfully*. A
69
+ * Safe, an uninitialised proxy, or a 7702-delegated EOA does this, and
70
+ * because `validateTransfer` returns nothing there is no ABI decode to
71
+ * fail — so every transfer would silently pass validation.
72
+ * - `unreachable` — the RPC didn't answer. Says nothing about the address; retry.
73
+ */
74
+ export type TransferValidatorVerdict = 'ok' | 'no-code' | 'permissive-fallback' | 'unreachable';
75
+ /** The result of {@link probeTransferValidator} — verdict plus what was observed, for a message. */
76
+ export interface TransferValidatorProbe {
77
+ verdict: TransferValidatorVerdict;
78
+ address: Address;
79
+ /** First line of the revert/transport error, when there was one. */
80
+ error?: string;
81
+ }
82
+ /**
83
+ * Ask a candidate transfer validator a question no validator can answer, and require it to FAIL.
84
+ *
85
+ * **`code.length > 0` is not enough**, which is why this exists and why the on-chain guard was
86
+ * rewritten to match. Two shapes enforce nothing while every read surface — ERC-165,
87
+ * `getTransferValidator()`, the extension beacon — reports enforcement as on: no code at all, and a
88
+ * *permissive fallback* that succeeds for any selector. `validateTransfer` returns nothing, so
89
+ * there is no ABI decode to fail; a Safe (its `FallbackManager.fallback()` returns empty when no
90
+ * handler is set), an uninitialised proxy, and an EIP-7702-delegated EOA all pass a has-code check
91
+ * and then wave every transfer through. A creator pasting their own Safe is the likely real case.
92
+ *
93
+ * So the probe inverts the question: a real validator **reverts** here (verified against OpenSea's
94
+ * SATSR and three Limit Break deployments on mainnet and Sepolia), and a permissive one returns
95
+ * empty success. This mirrors the contract exactly — the same selector, the same "must fail" rule —
96
+ * so an address that passes here is an address the token will accept, and the CLI stops reporting
97
+ * "no code on this chain" for an address that plainly has code.
98
+ *
99
+ * An ERC-165 gate was measured and rejected: none of those four live validators advertises
100
+ * `ITransferValidator`/`ITransferValidator1155`, so requiring an id would refuse the entire
101
+ * ecosystem, including the validator ABX itself recommends.
102
+ *
103
+ * **A misconfiguration guard, not a security boundary** — a contract can always be written to pass
104
+ * this and enforce nothing. It catches the honest mistake. Never throws for an on-chain reason:
105
+ * every failure is a verdict (mirrors `probeSeedSource`).
106
+ */
107
+ export declare function probeTransferValidator(client: PublicClient, validator: Address,
108
+ /** The enrolling/enrolled token, when known — the probe is made as the token, because that is
109
+ * the `msg.sender` the contract's own staticcall presents. */
110
+ opts?: {
111
+ as?: Address;
112
+ }): Promise<TransferValidatorProbe>;
113
+ /**
114
+ * Re-point an enrolled token's transfer validator, or suspend enforcement with
115
+ * `zeroAddress` (the token stays enrolled). Reverts `NotCreatorToken()` on a token that didn't
116
+ * enroll at deploy — enrollment can never be added later — and `InvalidTransferValidator()` on a
117
+ * validator the chain's own probe refuses (no code on this chain, **or** a permissive fallback that
118
+ * would enforce nothing); call {@link probeTransferValidator} first and refuse those before gas.
119
+ *
120
+ * **Who may sign:** the owner, while there is one. On a collection whose `owner()` is
121
+ * `address(0)`, **any** signer may send this with `validator = zeroAddress` to suspend enforcement
122
+ * permanently — the dead-man release described in this module's header. Arming a validator is still
123
+ * owner-only, so an ownerless collection can only move toward transferability, never back. A UX for
124
+ * collectors should offer that suspension when it sees a renounced, enforcing collection; gating it
125
+ * on `owner()` would hide the one recovery a stranded holder has.
126
+ */
127
+ export declare function prepareSetTransferValidator(args: {
128
+ contract: Address;
129
+ validator: Address;
130
+ chainId: number;
131
+ }): PreparedTx;
132
+ //# sourceMappingURL=creator-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creator-token.d.ts","sourceRoot":"","sources":["../src/creator-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAkC,KAAK,OAAO,EAAY,KAAK,YAAY,EAAC,MAAM,MAAM,CAAC;AAEhG,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEzC,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B,EAAG,Y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