@zoralabs/protocol-sdk 0.3.4 → 0.3.5

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.
package/dist/index.cjs CHANGED
@@ -25,75 +25,277 @@ __export(src_exports, {
25
25
  Errors: () => Errors,
26
26
  MintAPIClient: () => MintAPIClient,
27
27
  PremintAPIClient: () => PremintAPIClient,
28
+ PremintConfigVersion: () => PremintConfigVersion,
29
+ PreminterDomain: () => PreminterDomain,
28
30
  ZORA_API_BASE: () => ZORA_API_BASE,
29
31
  convertCollection: () => convertCollection,
30
- convertPremint: () => convertPremint,
32
+ convertPremintV1: () => convertPremintV1,
31
33
  create1155CreatorClient: () => create1155CreatorClient,
32
34
  create1155TokenSetupArgs: () => create1155TokenSetupArgs,
33
35
  createMintClient: () => createMintClient,
34
36
  createPremintClient: () => createPremintClient,
35
37
  encodePremintForAPI: () => encodePremintForAPI,
36
- get1155MintCosts: () => get1155MintCosts,
38
+ encodePremintV1ForAPI: () => encodePremintV1ForAPI,
39
+ encodePremintV2ForAPI: () => encodePremintV2ForAPI,
37
40
  getApiNetworkConfigForChain: () => getApiNetworkConfigForChain,
41
+ getMintCosts: () => getMintCosts,
42
+ getPremintCollectionAddress: () => getPremintCollectionAddress,
43
+ getPremintExecutorAddress: () => getPremintExecutorAddress,
38
44
  getPremintedLogFromReceipt: () => getPremintedLogFromReceipt,
39
45
  getTokenIdFromCreateReceipt: () => getTokenIdFromCreateReceipt,
40
- preminterTypedDataDefinition: () => preminterTypedDataDefinition
46
+ isAuthorizedToCreatePremint: () => isAuthorizedToCreatePremint,
47
+ isValidSignature: () => isValidSignature,
48
+ migratePremintConfigToV2: () => migratePremintConfigToV2,
49
+ premintTypedDataDefinition: () => premintTypedDataDefinition,
50
+ recoverCreatorFromCreatorAttribution: () => recoverCreatorFromCreatorAttribution,
51
+ recoverPremintSigner: () => recoverPremintSigner,
52
+ supportsPremintVersion: () => supportsPremintVersion,
53
+ tryRecoverPremintSigner: () => tryRecoverPremintSigner
41
54
  });
42
55
  module.exports = __toCommonJS(src_exports);
43
56
 
44
57
  // src/premint/premint-client.ts
45
- var import_viem2 = require("viem");
46
- var import_protocol_deployments = require("@zoralabs/protocol-deployments");
58
+ var import_viem4 = require("viem");
59
+ var import_protocol_deployments2 = require("@zoralabs/protocol-deployments");
47
60
 
48
61
  // src/premint/preminter.ts
49
- var preminterTypedDataDefinition = ({
62
+ var import_protocol_deployments = require("@zoralabs/protocol-deployments");
63
+ var import_viem = require("viem");
64
+ var v1Types = {
65
+ CreatorAttribution: [
66
+ { name: "tokenConfig", type: "TokenCreationConfig" },
67
+ // unique id scoped to the contract and token to create.
68
+ // ensure that a signature can be replaced, as long as the replacement
69
+ // has the same uid, and a newer version.
70
+ { name: "uid", type: "uint32" },
71
+ { name: "version", type: "uint32" },
72
+ // if this update should result in the signature being deleted.
73
+ { name: "deleted", type: "bool" }
74
+ ],
75
+ TokenCreationConfig: [
76
+ { name: "tokenURI", type: "string" },
77
+ { name: "maxSupply", type: "uint256" },
78
+ { name: "maxTokensPerAddress", type: "uint64" },
79
+ { name: "pricePerToken", type: "uint96" },
80
+ { name: "mintStart", type: "uint64" },
81
+ { name: "mintDuration", type: "uint64" },
82
+ { name: "royaltyMintSchedule", type: "uint32" },
83
+ { name: "royaltyBPS", type: "uint32" },
84
+ { name: "royaltyRecipient", type: "address" },
85
+ { name: "fixedPriceMinter", type: "address" }
86
+ ]
87
+ };
88
+ var v2Types = {
89
+ CreatorAttribution: [
90
+ { name: "tokenConfig", type: "TokenCreationConfig" },
91
+ // unique id scoped to the contract and token to create.
92
+ // ensure that a signature can be replaced, as long as the replacement
93
+ // has the same uid, and a newer version.
94
+ { name: "uid", type: "uint32" },
95
+ { name: "version", type: "uint32" },
96
+ // if this update should result in the signature being deleted.
97
+ { name: "deleted", type: "bool" }
98
+ ],
99
+ TokenCreationConfig: [
100
+ { name: "tokenURI", type: "string" },
101
+ { name: "maxSupply", type: "uint256" },
102
+ { name: "maxTokensPerAddress", type: "uint64" },
103
+ { name: "pricePerToken", type: "uint96" },
104
+ { name: "mintStart", type: "uint64" },
105
+ { name: "mintDuration", type: "uint64" },
106
+ { name: "royaltyBPS", type: "uint32" },
107
+ { name: "payoutRecipient", type: "address" },
108
+ { name: "fixedPriceMinter", type: "address" },
109
+ { name: "createReferral", type: "address" }
110
+ ]
111
+ };
112
+ var PreminterDomain = "Preminter";
113
+ var PremintConfigVersion = {
114
+ V1: "1",
115
+ V2: "2"
116
+ };
117
+ var getPremintExecutorAddress = () => import_protocol_deployments.zoraCreator1155PremintExecutorImplAddress[999];
118
+ var premintTypedDataDefinition = ({
50
119
  verifyingContract,
51
- premintConfig,
52
- chainId
120
+ chainId,
121
+ premintConfigVersion: version,
122
+ premintConfig
53
123
  }) => {
54
- const { tokenConfig, uid, version, deleted } = premintConfig;
55
- const types = {
56
- CreatorAttribution: [
57
- { name: "tokenConfig", type: "TokenCreationConfig" },
58
- // unique id scoped to the contract and token to create.
59
- // ensure that a signature can be replaced, as long as the replacement
60
- // has the same uid, and a newer version.
61
- { name: "uid", type: "uint32" },
62
- { name: "version", type: "uint32" },
63
- // if this update should result in the signature being deleted.
64
- { name: "deleted", type: "bool" }
65
- ],
66
- TokenCreationConfig: [
67
- { name: "tokenURI", type: "string" },
68
- { name: "maxSupply", type: "uint256" },
69
- { name: "maxTokensPerAddress", type: "uint64" },
70
- { name: "pricePerToken", type: "uint96" },
71
- { name: "mintStart", type: "uint64" },
72
- { name: "mintDuration", type: "uint64" },
73
- { name: "royaltyMintSchedule", type: "uint32" },
74
- { name: "royaltyBPS", type: "uint32" },
75
- { name: "royaltyRecipient", type: "address" },
76
- { name: "fixedPriceMinter", type: "address" }
77
- ]
124
+ const domain = {
125
+ chainId,
126
+ name: PreminterDomain,
127
+ version,
128
+ verifyingContract
78
129
  };
79
- const result = {
130
+ if (version === PremintConfigVersion.V1)
131
+ return {
132
+ domain,
133
+ types: v1Types,
134
+ message: premintConfig,
135
+ primaryType: "CreatorAttribution"
136
+ };
137
+ if (version === PremintConfigVersion.V2) {
138
+ return {
139
+ domain,
140
+ types: v2Types,
141
+ message: premintConfig,
142
+ primaryType: "CreatorAttribution"
143
+ };
144
+ }
145
+ throw new Error(`Invalid version ${version}`);
146
+ };
147
+ async function isAuthorizedToCreatePremint({
148
+ collection,
149
+ collectionAddress,
150
+ publicClient,
151
+ premintConfig,
152
+ premintConfigVersion,
153
+ signature,
154
+ signer
155
+ }) {
156
+ if (premintConfigVersion === PremintConfigVersion.V1) {
157
+ const [isValidSignature2] = await publicClient.readContract({
158
+ abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
159
+ address: getPremintExecutorAddress(),
160
+ functionName: "isValidSignature",
161
+ args: [collection, premintConfig, signature]
162
+ });
163
+ return isValidSignature2;
164
+ }
165
+ return await publicClient.readContract({
166
+ abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
167
+ address: getPremintExecutorAddress(),
168
+ functionName: "isAuthorizedToCreatePremint",
169
+ args: [signer, collection.contractAdmin, collectionAddress]
170
+ });
171
+ }
172
+ async function recoverPremintSigner({
173
+ signature,
174
+ ...rest
175
+ }) {
176
+ const typedData = premintTypedDataDefinition(rest);
177
+ return await (0, import_viem.recoverTypedDataAddress)({
178
+ ...typedData,
179
+ signature
180
+ });
181
+ }
182
+ async function tryRecoverPremintSigner(params) {
183
+ try {
184
+ return await recoverPremintSigner(params);
185
+ } catch (error) {
186
+ console.error(error);
187
+ return void 0;
188
+ }
189
+ }
190
+ async function isValidSignature({
191
+ signature,
192
+ publicClient,
193
+ collection,
194
+ chainId,
195
+ ...premintConfigAndVersion
196
+ }) {
197
+ const tokenContract = await getPremintCollectionAddress({
198
+ collection,
199
+ publicClient
200
+ });
201
+ const recoveredAddress = await tryRecoverPremintSigner({
202
+ ...premintConfigAndVersion,
203
+ signature,
204
+ verifyingContract: tokenContract,
205
+ chainId
206
+ });
207
+ if (!import_viem.recoverAddress) {
208
+ return {
209
+ isAuthorized: false
210
+ };
211
+ }
212
+ const isAuthorized = await isAuthorizedToCreatePremint({
213
+ signer: recoveredAddress,
214
+ collection,
215
+ collectionAddress: tokenContract,
216
+ publicClient,
217
+ signature,
218
+ ...premintConfigAndVersion
219
+ });
220
+ return {
221
+ isAuthorized,
222
+ recoveredAddress
223
+ };
224
+ }
225
+ function migratePremintConfigToV2({
226
+ premintConfig,
227
+ createReferral = import_viem.zeroAddress
228
+ }) {
229
+ return {
230
+ ...premintConfig,
231
+ tokenConfig: {
232
+ tokenURI: premintConfig.tokenConfig.tokenURI,
233
+ maxSupply: premintConfig.tokenConfig.maxSupply,
234
+ maxTokensPerAddress: premintConfig.tokenConfig.maxTokensPerAddress,
235
+ pricePerToken: premintConfig.tokenConfig.pricePerToken,
236
+ mintStart: premintConfig.tokenConfig.mintStart,
237
+ mintDuration: premintConfig.tokenConfig.mintDuration,
238
+ payoutRecipient: premintConfig.tokenConfig.royaltyRecipient,
239
+ royaltyBPS: premintConfig.tokenConfig.royaltyBPS,
240
+ fixedPriceMinter: premintConfig.tokenConfig.fixedPriceMinter,
241
+ createReferral
242
+ }
243
+ };
244
+ }
245
+ var recoverCreatorFromCreatorAttribution = async ({
246
+ creatorAttribution: { version, domainName, structHash, signature },
247
+ chainId,
248
+ tokenContract
249
+ }) => {
250
+ const hashedDomain = (0, import_viem.hashDomain)({
80
251
  domain: {
81
252
  chainId,
82
- name: "Preminter",
83
- version: "1",
84
- verifyingContract
253
+ name: domainName,
254
+ verifyingContract: tokenContract,
255
+ version
85
256
  },
86
- types,
87
- message: {
88
- tokenConfig,
89
- uid,
90
- version,
91
- deleted
92
- },
93
- primaryType: "CreatorAttribution"
94
- };
95
- return result;
257
+ types: {
258
+ EIP712Domain: [
259
+ { name: "name", type: "string" },
260
+ { name: "version", type: "string" },
261
+ {
262
+ name: "chainId",
263
+ type: "uint256"
264
+ },
265
+ {
266
+ name: "verifyingContract",
267
+ type: "address"
268
+ }
269
+ ]
270
+ }
271
+ });
272
+ const parts = ["0x1901", hashedDomain, structHash];
273
+ const hashedTypedData = (0, import_viem.keccak256)((0, import_viem.concat)(parts));
274
+ return await (0, import_viem.recoverAddress)({
275
+ hash: hashedTypedData,
276
+ signature
277
+ });
96
278
  };
279
+ var supportsPremintVersion = async (version, tokenContract, publicClient) => {
280
+ const supportedPremintSignatureVersions = await publicClient.readContract({
281
+ abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
282
+ address: getPremintExecutorAddress(),
283
+ functionName: "supportedPremintSignatureVersions",
284
+ args: [tokenContract]
285
+ });
286
+ return supportedPremintSignatureVersions.includes(version);
287
+ };
288
+ async function getPremintCollectionAddress({
289
+ collection,
290
+ publicClient
291
+ }) {
292
+ return publicClient.readContract({
293
+ address: getPremintExecutorAddress(),
294
+ abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
295
+ functionName: "getContractAddress",
296
+ args: [collection]
297
+ });
298
+ }
97
299
 
98
300
  // src/apis/http-api-base.ts
99
301
  var BadResponseError = class extends Error {
@@ -170,17 +372,22 @@ var httpClient = {
170
372
  };
171
373
 
172
374
  // src/constants.ts
375
+ var import_viem2 = require("viem");
173
376
  var ZORA_API_BASE = "https://api.zora.co/";
174
377
  var OPEN_EDITION_MINT_SIZE = BigInt("18446744073709551615");
175
378
  var SUBGRAPH_CONFIG_BASE = "https://api.goldsky.com/api/public/project_clhk16b61ay9t49vm6ntn4mkz/subgraphs";
176
379
  function getSubgraph(name, version) {
177
380
  return `${SUBGRAPH_CONFIG_BASE}/${name}/${version}/gn`;
178
381
  }
382
+ var zora721Abi = (0, import_viem2.parseAbi)([
383
+ "function mintWithRewards(address recipient, uint256 quantity, string calldata comment, address mintReferral) external payable",
384
+ "function zoraFeeForAmount(uint256 amount) public view returns (address, uint256)"
385
+ ]);
179
386
 
180
387
  // src/apis/chain-constants.ts
181
388
  var import_chains = require("viem/chains");
182
- var import_viem = require("viem");
183
- var REWARD_PER_TOKEN = (0, import_viem.parseEther)("0.000777");
389
+ var import_viem3 = require("viem");
390
+ var REWARD_PER_TOKEN = (0, import_viem3.parseEther)("0.000777");
184
391
  var BackendChainNamesLookup = {
185
392
  ZORA_MAINNET: "ZORA-MAINNET",
186
393
  ZORA_GOERLI: "ZORA-GOERLI",
@@ -258,9 +465,6 @@ var networkConfigByChain = {
258
465
  };
259
466
 
260
467
  // src/mint/mint-api-client.ts
261
- function encodeQueryParameters(params) {
262
- return new URLSearchParams(params).toString();
263
- }
264
468
  var getApiNetworkConfigForChain = (chainId) => {
265
469
  if (!networkConfigByChain[chainId]) {
266
470
  throw new Error(`chain id ${chainId} network not configured `);
@@ -272,59 +476,64 @@ var MintAPIClient = class {
272
476
  this.httpClient = httpClient2 || httpClient;
273
477
  this.networkConfig = getApiNetworkConfigForChain(chainId);
274
478
  }
275
- async getMintable(path, query) {
276
- const httpClient2 = this.httpClient;
277
- return httpClient2.retries(() => {
278
- return httpClient2.get(
279
- `${ZORA_API_BASE}discover/mintables/${path.chain_name}/${path.collection_address}${query?.token_id ? `?${encodeQueryParameters(query)}` : ""}`
280
- );
281
- });
282
- }
283
- async getSalesConfigFixedPrice({
284
- contractAddress,
479
+ async getSalesConfigAndTokenInfo({
480
+ tokenAddress,
285
481
  tokenId
286
482
  }) {
287
483
  const { retries: retries2, post: post2 } = this.httpClient;
288
484
  return retries2(async () => {
289
485
  const response = await post2(this.networkConfig.subgraphUrl, {
290
- query: `query ($id: ID!) {
291
- zoraCreateToken(id: $id) {
292
- id
293
- salesStrategies(where: {type: "FIXED_PRICE"}) {
294
- type
295
- fixedPrice {
296
- address
297
- pricePerToken
298
- saleEnd
299
- saleStart
300
- maxTokensPerAddress
486
+ query: `
487
+ fragment SaleStrategy on SalesStrategyConfig {
488
+ type
489
+ fixedPrice {
490
+ address
491
+ pricePerToken
492
+ saleEnd
493
+ saleStart
494
+ maxTokensPerAddress
495
+ }
496
+ }
497
+
498
+ query ($id: ID!) {
499
+ zoraCreateToken(id: $id) {
500
+ id
501
+ contract {
502
+ mintFeePerQuantity
503
+ salesStrategies(where: {type: "FIXED_PRICE"}) {
504
+ ...SaleStrategy
505
+ }
506
+ }
507
+ salesStrategies(where: {type: "FIXED_PRICE"}) {
508
+ ...SaleStrategy
301
509
  }
302
510
  }
303
511
  }
304
- }`,
512
+ `,
305
513
  variables: {
306
- id: `${contractAddress.toLowerCase()}-${tokenId.toString()}`
514
+ id: tokenId !== void 0 ? (
515
+ // Generic Token ID types all stringify down to the base numeric equivalent.
516
+ `${tokenAddress.toLowerCase()}-${tokenId}`
517
+ ) : `${tokenAddress.toLowerCase()}-0`
307
518
  }
308
519
  });
309
- const fixedPrice = response.data?.zoraCreateToken?.salesStrategies?.find(() => true)?.fixedPrice;
520
+ const token = response.data?.zoraCreateToken;
521
+ if (!token) {
522
+ throw new Error("Cannot find a token to mint");
523
+ }
524
+ const saleStrategies = tokenId !== void 0 ? token.salesStrategies : token.contract.salesStrategies;
525
+ const fixedPrice = saleStrategies?.sort(
526
+ (a, b) => BigInt(a.fixedPrice.saleEnd) > BigInt(b.fixedPrice.saleEnd) ? 1 : -1
527
+ )?.find(() => true)?.fixedPrice;
528
+ if (!fixedPrice) {
529
+ throw new Error("Cannot find fixed price sale strategy");
530
+ }
310
531
  return {
311
- address: fixedPrice.address,
312
- pricePerToken: BigInt(fixedPrice.pricePerToken)
532
+ fixedPrice,
533
+ mintFeePerQuantity: BigInt(token.contract.mintFeePerQuantity)
313
534
  };
314
535
  });
315
536
  }
316
- async getMintableForToken({
317
- tokenContract,
318
- tokenId
319
- }) {
320
- return await this.getMintable(
321
- {
322
- chain_name: this.networkConfig.zoraBackendChainName,
323
- collection_address: tokenContract
324
- },
325
- { token_id: tokenId?.toString() }
326
- );
327
- }
328
537
  };
329
538
 
330
539
  // src/premint/premint-api-client.ts
@@ -394,8 +603,8 @@ var DefaultMintArguments = {
394
603
  function getPremintedLogFromReceipt(receipt) {
395
604
  for (const data of receipt.logs) {
396
605
  try {
397
- const decodedLog = (0, import_viem2.decodeEventLog)({
398
- abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
606
+ const decodedLog = (0, import_viem4.decodeEventLog)({
607
+ abi: import_protocol_deployments2.zoraCreator1155PremintExecutorImplABI,
399
608
  eventName: "Preminted",
400
609
  ...data
401
610
  });
@@ -406,7 +615,7 @@ function getPremintedLogFromReceipt(receipt) {
406
615
  }
407
616
  }
408
617
  }
409
- var convertPremint = (premint) => ({
618
+ var convertPremintV1 = (premint) => ({
410
619
  ...premint,
411
620
  tokenConfig: {
412
621
  ...premint.tokenConfig,
@@ -423,7 +632,7 @@ var convertCollection = (collection) => ({
423
632
  ...collection,
424
633
  contractAdmin: collection.contractAdmin
425
634
  });
426
- var encodePremintForAPI = ({
635
+ var encodePremintV1ForAPI = ({
427
636
  tokenConfig,
428
637
  ...premint
429
638
  }) => ({
@@ -437,20 +646,37 @@ var encodePremintForAPI = ({
437
646
  maxTokensPerAddress: tokenConfig.maxTokensPerAddress.toString()
438
647
  }
439
648
  });
649
+ var encodePremintV2ForAPI = ({
650
+ tokenConfig,
651
+ ...premint
652
+ }) => ({
653
+ ...premint,
654
+ tokenConfig: {
655
+ ...tokenConfig,
656
+ maxSupply: tokenConfig.maxSupply.toString(),
657
+ pricePerToken: tokenConfig.pricePerToken.toString(),
658
+ mintStart: tokenConfig.mintStart.toString(),
659
+ mintDuration: tokenConfig.mintDuration.toString(),
660
+ maxTokensPerAddress: tokenConfig.maxTokensPerAddress.toString()
661
+ }
662
+ });
663
+ var encodePremintForAPI = ({
664
+ premintConfig,
665
+ premintConfigVersion
666
+ }) => {
667
+ if (premintConfigVersion === PremintConfigVersion.V1) {
668
+ return encodePremintV1ForAPI(premintConfig);
669
+ }
670
+ if (premintConfigVersion === PremintConfigVersion.V2) {
671
+ return encodePremintV2ForAPI(premintConfig);
672
+ }
673
+ throw new Error(`Invalid premint config version ${premintConfigVersion}`);
674
+ };
440
675
  var PremintClient = class {
441
676
  constructor(chain, publicClient, httpClient2) {
442
677
  this.chain = chain;
443
678
  this.apiClient = new PremintAPIClient(chain.id, httpClient2);
444
- this.publicClient = publicClient || (0, import_viem2.createPublicClient)({ chain, transport: (0, import_viem2.http)() });
445
- }
446
- /**
447
- * The premint executor address is deployed to the same address across all chains.
448
- * Can be overridden as needed by making a parent class.
449
- *
450
- * @returns Executor address for premints
451
- */
452
- getExecutorAddress() {
453
- return import_protocol_deployments.zoraCreator1155PremintExecutorImplAddress[999];
679
+ this.publicClient = publicClient || (0, import_viem4.createPublicClient)({ chain, transport: (0, import_viem4.http)() });
454
680
  }
455
681
  /**
456
682
  * The fixed price minter address is the same across all chains for our current
@@ -460,7 +686,7 @@ var PremintClient = class {
460
686
  * @returns Fixed price sale strategy
461
687
  */
462
688
  getFixedPriceMinterAddress() {
463
- return import_protocol_deployments.zoraCreatorFixedPriceSaleStrategyAddress[999];
689
+ return import_protocol_deployments2.zoraCreatorFixedPriceSaleStrategyAddress[999];
464
690
  }
465
691
  getDataFromPremintReceipt(receipt) {
466
692
  const premintedLog = getPremintedLogFromReceipt(receipt);
@@ -501,7 +727,7 @@ var PremintClient = class {
501
727
  collection_address: collection.toLowerCase(),
502
728
  uid
503
729
  });
504
- const convertedPremint = convertPremint(signatureResponse.premint);
730
+ const convertedPremint = convertPremintV1(signatureResponse.premint);
505
731
  const signerData = {
506
732
  ...signatureResponse,
507
733
  premint: {
@@ -522,7 +748,8 @@ var PremintClient = class {
522
748
  ...signerData.collection,
523
749
  contractAdmin: signerData.collection.contractAdmin
524
750
  },
525
- premintConfig: signerData.premint
751
+ premintConfig: signerData.premint,
752
+ premintConfigVersion: PremintConfigVersion.V1
526
753
  });
527
754
  }
528
755
  /**
@@ -553,7 +780,7 @@ var PremintClient = class {
553
780
  ...signatureResponse,
554
781
  collection: convertCollection(signatureResponse.collection),
555
782
  premint: {
556
- ...convertPremint(signatureResponse.premint),
783
+ ...convertPremintV1(signatureResponse.premint),
557
784
  deleted: true
558
785
  }
559
786
  };
@@ -564,7 +791,8 @@ var PremintClient = class {
564
791
  verifyingContract: collection,
565
792
  uid,
566
793
  collection: signerData.collection,
567
- premintConfig: signerData.premint
794
+ premintConfig: signerData.premint,
795
+ premintConfigVersion: PremintConfigVersion.V1
568
796
  });
569
797
  }
570
798
  /**
@@ -576,11 +804,11 @@ var PremintClient = class {
576
804
  async signAndSubmitPremint({
577
805
  walletClient,
578
806
  verifyingContract,
579
- premintConfig,
580
807
  uid,
581
808
  account,
582
809
  checkSignature,
583
- collection
810
+ collection,
811
+ ...premintConfigAndVersion
584
812
  }) {
585
813
  if (!account) {
586
814
  account = walletClient.account;
@@ -590,26 +818,32 @@ var PremintClient = class {
590
818
  }
591
819
  const signature = await walletClient.signTypedData({
592
820
  account,
593
- ...preminterTypedDataDefinition({
821
+ ...premintTypedDataDefinition({
594
822
  verifyingContract,
595
- premintConfig,
823
+ ...premintConfigAndVersion,
596
824
  chainId: this.chain.id
597
825
  })
598
826
  });
599
827
  if (checkSignature) {
600
- const [isValidSignature] = await this.publicClient.readContract({
601
- abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
602
- address: this.getExecutorAddress(),
603
- functionName: "isValidSignature",
604
- args: [convertCollection(collection), premintConfig, signature]
828
+ const convertedCollection = convertCollection(collection);
829
+ const isAuthorized = await isAuthorizedToCreatePremint({
830
+ collection: convertCollection(collection),
831
+ signature,
832
+ publicClient: this.publicClient,
833
+ signer: typeof account === "string" ? account : account.address,
834
+ collectionAddress: await this.getCollectionAddress(convertedCollection),
835
+ ...premintConfigAndVersion
605
836
  });
606
- if (!isValidSignature) {
607
- throw new Error("Invalid signature");
837
+ if (!isAuthorized) {
838
+ throw new Error("Not authorized to create premint");
608
839
  }
609
840
  }
841
+ if (premintConfigAndVersion.premintConfigVersion === PremintConfigVersion.V2) {
842
+ throw new Error("premint config v2 not supported yet");
843
+ }
610
844
  const apiData = {
611
845
  collection,
612
- premint: encodePremintForAPI(premintConfig),
846
+ premint: encodePremintV1ForAPI(premintConfigAndVersion.premintConfig),
613
847
  signature
614
848
  };
615
849
  const premint = await this.apiClient.postSignature(apiData);
@@ -643,11 +877,9 @@ var PremintClient = class {
643
877
  executionSettings,
644
878
  checkSignature = false
645
879
  }) {
646
- const newContractAddress = await this.publicClient.readContract({
647
- address: this.getExecutorAddress(),
648
- abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
649
- functionName: "getContractAddress",
650
- args: [convertCollection(collection)]
880
+ const newContractAddress = await getPremintCollectionAddress({
881
+ publicClient: this.publicClient,
882
+ collection: convertCollection(collection)
651
883
  });
652
884
  const tokenConfig = {
653
885
  ...DefaultMintArguments,
@@ -676,6 +908,7 @@ var PremintClient = class {
676
908
  uid,
677
909
  verifyingContract: newContractAddress,
678
910
  premintConfig,
911
+ premintConfigVersion: PremintConfigVersion.V1,
679
912
  checkSignature,
680
913
  account,
681
914
  walletClient,
@@ -698,26 +931,37 @@ var PremintClient = class {
698
931
  uid
699
932
  });
700
933
  }
934
+ /**
935
+ * Gets the deterministic contract address for a premint collection
936
+ * @param collection Collection to get the address for
937
+ * @returns deterministic contract address
938
+ */
939
+ async getCollectionAddress(collection) {
940
+ return await getPremintCollectionAddress({
941
+ collection,
942
+ publicClient: this.publicClient
943
+ });
944
+ }
701
945
  /**
702
946
  * Check user signature for v1
703
947
  *
704
948
  * @param data Signature data from the API
705
- * @returns isValid = signature is valid or not, contractAddress = assumed contract address, recoveredSigner = signer from contract
949
+ * @returns isValid = signature is valid or not, recoveredSigner = signer from contract
706
950
  */
707
951
  async isValidSignature({
708
- data
952
+ signature,
953
+ premint,
954
+ collection
709
955
  }) {
710
- const [isValid, contractAddress, recoveredSigner] = await this.publicClient.readContract({
711
- abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
712
- address: this.getExecutorAddress(),
713
- functionName: "isValidSignature",
714
- args: [
715
- convertCollection(data.collection),
716
- convertPremint(data.premint),
717
- data.signature
718
- ]
956
+ const { isAuthorized, recoveredAddress } = await isValidSignature({
957
+ chainId: this.chain.id,
958
+ signature,
959
+ premintConfig: convertPremintV1(premint),
960
+ premintConfigVersion: PremintConfigVersion.V1,
961
+ collection: convertCollection(collection),
962
+ publicClient: this.publicClient
719
963
  });
720
- return { isValid, contractAddress, recoveredSigner };
964
+ return { isValid: isAuthorized, recoveredSigner: recoveredAddress };
721
965
  }
722
966
  makeUrls({
723
967
  uid,
@@ -755,11 +999,10 @@ var PremintClient = class {
755
999
  if (mintArguments && mintArguments?.quantityToMint < 1) {
756
1000
  throw new Error("Quantity to mint cannot be below 1");
757
1001
  }
758
- const targetAddress = this.getExecutorAddress();
759
1002
  const numberToMint = BigInt(mintArguments?.quantityToMint || 1);
760
1003
  const args = [
761
1004
  convertCollection(data.collection),
762
- convertPremint(data.premint),
1005
+ convertPremintV1(data.premint),
763
1006
  data.signature,
764
1007
  numberToMint,
765
1008
  mintArguments?.mintComment || ""
@@ -770,10 +1013,10 @@ var PremintClient = class {
770
1013
  const value = numberToMint * REWARD_PER_TOKEN;
771
1014
  const request = {
772
1015
  account,
773
- abi: import_protocol_deployments.zoraCreator1155PremintExecutorImplABI,
1016
+ abi: import_protocol_deployments2.zoraCreator1155PremintExecutorImplABI,
774
1017
  functionName: "premint",
775
1018
  value,
776
- address: targetAddress,
1019
+ address: getPremintExecutorAddress(),
777
1020
  args
778
1021
  };
779
1022
  return request;
@@ -788,8 +1031,8 @@ function createPremintClient({
788
1031
  }
789
1032
 
790
1033
  // src/mint/mint-client.ts
791
- var import_viem3 = require("viem");
792
- var import_protocol_deployments2 = require("@zoralabs/protocol-deployments");
1034
+ var import_viem5 = require("viem");
1035
+ var import_protocol_deployments3 = require("@zoralabs/protocol-deployments");
793
1036
  var MintError = class extends Error {
794
1037
  };
795
1038
  var MintInactiveError = class extends Error {
@@ -798,29 +1041,10 @@ var Errors = {
798
1041
  MintError,
799
1042
  MintInactiveError
800
1043
  };
801
- var zora721Abi = (0, import_viem3.parseAbi)([
802
- "function mintWithRewards(address recipient, uint256 quantity, string calldata comment, address mintReferral) external payable",
803
- "function zoraFeeForAmount(uint256 amount) public view returns (address, uint256)"
804
- ]);
805
1044
  var MintClient = class {
806
1045
  constructor(chain, publicClient, httpClient2) {
807
1046
  this.apiClient = new MintAPIClient(chain.id, httpClient2);
808
- this.publicClient = publicClient || (0, import_viem3.createPublicClient)({ chain, transport: (0, import_viem3.http)() });
809
- }
810
- /**
811
- * Gets mintable information for a given token
812
- * @param param0.tokenContract The contract address of the token to mint.
813
- * @param param0.tokenId The token id to mint.
814
- * @returns
815
- */
816
- async getMintable({
817
- tokenContract,
818
- tokenId
819
- }) {
820
- return await this.apiClient.getMintableForToken({
821
- tokenContract,
822
- tokenId: tokenId?.toString()
823
- });
1047
+ this.publicClient = publicClient || (0, import_viem5.createPublicClient)({ chain, transport: (0, import_viem5.http)() });
824
1048
  }
825
1049
  /**
826
1050
  * Returns the parameters needed to prepare a transaction mint a token.
@@ -838,36 +1062,6 @@ var MintClient = class {
838
1062
  publicClient: this.publicClient
839
1063
  });
840
1064
  }
841
- /**
842
- * Returns the mintFee, sale fee, and total cost of minting x quantities of a token.
843
- * @param param0.mintable The mintable token to mint.
844
- * @param param0.quantityToMint The quantity of tokens to mint.
845
- * @returns
846
- */
847
- async getMintCosts({
848
- mintable,
849
- quantityToMint
850
- }) {
851
- const mintContextType = validateMintableAndGetContextType(mintable);
852
- if (mintContextType === "zora_create_1155") {
853
- return await get1155MintCosts({
854
- mintable,
855
- price: BigInt(mintable.cost.native_price.raw),
856
- publicClient: this.publicClient,
857
- quantityToMint: BigInt(quantityToMint)
858
- });
859
- }
860
- if (mintContextType === "zora_create") {
861
- return await get721MintCosts({
862
- mintable,
863
- publicClient: this.publicClient,
864
- quantityToMint: BigInt(quantityToMint)
865
- });
866
- }
867
- throw new MintError(
868
- `Mintable type ${mintContextType} is currently unsupported.`
869
- );
870
- }
871
1065
  };
872
1066
  function createMintClient({
873
1067
  chain,
@@ -876,91 +1070,44 @@ function createMintClient({
876
1070
  }) {
877
1071
  return new MintClient(chain, publicClient, httpClient2);
878
1072
  }
879
- function validateMintableAndGetContextType(mintable) {
880
- if (!mintable) {
881
- throw new MintError("No mintable found");
882
- }
883
- if (!mintable.is_active) {
884
- throw new MintInactiveError("Minting token is inactive");
885
- }
886
- if (!mintable.mint_context) {
887
- throw new MintError("No minting context data from zora API");
888
- }
889
- if (!["zora_create", "zora_create_1155"].includes(
890
- mintable.mint_context?.mint_context_type
891
- )) {
892
- throw new MintError(
893
- `Mintable type ${mintable.mint_context.mint_context_type} is currently unsupported.`
894
- );
895
- }
896
- return mintable.mint_context.mint_context_type;
897
- }
898
1073
  async function makePrepareMintTokenParams({
899
1074
  publicClient,
900
- mintable,
901
1075
  apiClient,
1076
+ tokenId,
1077
+ tokenAddress,
902
1078
  ...rest
903
1079
  }) {
904
- const mintContextType = validateMintableAndGetContextType(mintable);
905
- const thisPublicClient = publicClient;
906
- if (mintContextType === "zora_create_1155") {
907
- return makePrepareMint1155TokenParams({
908
- apiClient,
909
- publicClient: thisPublicClient,
910
- mintable,
911
- mintContextType,
912
- ...rest
913
- });
914
- }
915
- if (mintContextType === "zora_create") {
1080
+ const salesConfigAndTokenInfo = await apiClient.getSalesConfigAndTokenInfo({
1081
+ tokenId,
1082
+ tokenAddress
1083
+ });
1084
+ if (tokenId === void 0) {
916
1085
  return makePrepareMint721TokenParams({
917
- publicClient: thisPublicClient,
918
- mintable,
919
- mintContextType,
1086
+ salesConfigAndTokenInfo,
1087
+ tokenAddress,
920
1088
  ...rest
921
1089
  });
922
1090
  }
923
- throw new MintError(
924
- `Mintable type ${mintContextType} is currently unsupported.`
925
- );
926
- }
927
- async function get721MintCosts({
928
- mintable,
929
- publicClient,
930
- quantityToMint
931
- }) {
932
- const address = mintable.collection.address;
933
- const [_, mintFee] = await publicClient.readContract({
934
- abi: zora721Abi,
935
- address,
936
- functionName: "zoraFeeForAmount",
937
- args: [BigInt(quantityToMint)]
1091
+ return makePrepareMint1155TokenParams({
1092
+ salesConfigAndTokenInfo,
1093
+ tokenAddress,
1094
+ tokenId,
1095
+ ...rest
938
1096
  });
939
- const tokenPurchaseCost = BigInt(mintable.cost.native_price.raw) * quantityToMint;
940
- return {
941
- mintFee,
942
- tokenPurchaseCost,
943
- totalCost: mintFee + tokenPurchaseCost
944
- };
945
1097
  }
946
1098
  async function makePrepareMint721TokenParams({
947
- publicClient,
1099
+ tokenAddress,
1100
+ salesConfigAndTokenInfo,
948
1101
  minterAccount,
949
- mintable,
950
- mintContextType,
951
1102
  mintArguments
952
1103
  }) {
953
- if (mintContextType !== "zora_create") {
954
- throw new Error("Minted token type must be for 1155");
955
- }
956
- const mintValue = (await get721MintCosts({
957
- mintable,
958
- publicClient,
1104
+ const mintValue = getMintCosts({
1105
+ salesConfigAndTokenInfo,
959
1106
  quantityToMint: BigInt(mintArguments.quantityToMint)
960
- })).totalCost;
1107
+ }).totalCost;
961
1108
  const result = {
962
1109
  abi: zora721Abi,
963
- address: mintable.contract_address,
1110
+ address: tokenAddress,
964
1111
  account: minterAccount,
965
1112
  functionName: "mintWithRewards",
966
1113
  value: mintValue,
@@ -968,34 +1115,17 @@ async function makePrepareMint721TokenParams({
968
1115
  mintArguments.mintToAddress,
969
1116
  BigInt(mintArguments.quantityToMint),
970
1117
  mintArguments.mintComment || "",
971
- mintArguments.mintReferral || import_viem3.zeroAddress
1118
+ mintArguments.mintReferral || import_viem5.zeroAddress
972
1119
  ]
973
1120
  };
974
1121
  return result;
975
1122
  }
976
- async function get1155MintFee({
977
- collectionAddress,
978
- publicClient
979
- }) {
980
- return await publicClient.readContract({
981
- abi: import_protocol_deployments2.zoraCreator1155ImplABI,
982
- functionName: "mintFee",
983
- address: collectionAddress
984
- });
985
- }
986
- async function get1155MintCosts({
987
- mintable,
988
- price,
989
- publicClient,
1123
+ function getMintCosts({
1124
+ salesConfigAndTokenInfo,
990
1125
  quantityToMint
991
1126
  }) {
992
- const address = mintable.collection.address;
993
- const mintFee = await get1155MintFee({
994
- collectionAddress: address,
995
- publicClient
996
- });
997
- const mintFeeForTokens = mintFee * quantityToMint;
998
- const tokenPurchaseCost = price * quantityToMint;
1127
+ const mintFeeForTokens = salesConfigAndTokenInfo.mintFeePerQuantity * quantityToMint;
1128
+ const tokenPurchaseCost = BigInt(salesConfigAndTokenInfo.fixedPrice.pricePerToken) * quantityToMint;
999
1129
  return {
1000
1130
  mintFee: mintFeeForTokens,
1001
1131
  tokenPurchaseCost,
@@ -1003,56 +1133,45 @@ async function get1155MintCosts({
1003
1133
  };
1004
1134
  }
1005
1135
  async function makePrepareMint1155TokenParams({
1006
- apiClient,
1007
- publicClient,
1136
+ tokenId,
1137
+ salesConfigAndTokenInfo,
1008
1138
  minterAccount,
1009
- mintable,
1010
- mintContextType,
1139
+ tokenAddress,
1011
1140
  mintArguments
1012
1141
  }) {
1013
- if (mintContextType !== "zora_create_1155") {
1014
- throw new Error("Minted token type must be for 1155");
1015
- }
1016
1142
  const mintQuantity = BigInt(mintArguments.quantityToMint);
1017
- const address = mintable.collection.address;
1018
- const tokenFixedPriceMinter = await apiClient.getSalesConfigFixedPrice({
1019
- contractAddress: address,
1020
- tokenId: BigInt(mintable.token_id)
1021
- });
1022
- const mintValue = (await get1155MintCosts({
1023
- mintable,
1024
- price: tokenFixedPriceMinter?.pricePerToken || BigInt(mintable.cost.native_price.raw),
1025
- publicClient,
1143
+ const mintValue = getMintCosts({
1144
+ salesConfigAndTokenInfo,
1026
1145
  quantityToMint: mintQuantity
1027
- })).totalCost;
1146
+ }).totalCost;
1028
1147
  const result = {
1029
- abi: import_protocol_deployments2.zoraCreator1155ImplABI,
1148
+ abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1030
1149
  functionName: "mintWithRewards",
1031
1150
  account: minterAccount,
1032
1151
  value: mintValue,
1033
- address,
1152
+ address: tokenAddress,
1034
1153
  /* args: minter, tokenId, quantity, minterArguments, mintReferral */
1035
1154
  args: [
1036
- tokenFixedPriceMinter?.address || import_protocol_deployments2.zoraCreatorFixedPriceSaleStrategyAddress[999],
1037
- BigInt(mintable.token_id),
1155
+ salesConfigAndTokenInfo?.fixedPrice.address || import_protocol_deployments3.zoraCreatorFixedPriceSaleStrategyAddress[999],
1156
+ BigInt(tokenId),
1038
1157
  mintQuantity,
1039
- (0, import_viem3.encodeAbiParameters)((0, import_viem3.parseAbiParameters)("address, string"), [
1158
+ (0, import_viem5.encodeAbiParameters)((0, import_viem5.parseAbiParameters)("address, string"), [
1040
1159
  mintArguments.mintToAddress,
1041
1160
  mintArguments.mintComment || ""
1042
1161
  ]),
1043
- mintArguments.mintReferral || import_viem3.zeroAddress
1162
+ mintArguments.mintReferral || import_viem5.zeroAddress
1044
1163
  ]
1045
1164
  };
1046
1165
  return result;
1047
1166
  }
1048
1167
 
1049
1168
  // src/create/1155-create-helper.ts
1050
- var import_protocol_deployments3 = require("@zoralabs/protocol-deployments");
1051
- var import_viem4 = require("viem");
1169
+ var import_protocol_deployments4 = require("@zoralabs/protocol-deployments");
1170
+ var import_viem6 = require("viem");
1052
1171
  var SALE_END_FOREVER = 18446744073709551615n;
1053
1172
  var ROYALTY_BPS_DEFAULT = 1e3;
1054
1173
  var DEFAULT_SALE_SETTINGS = {
1055
- fundsRecipient: import_viem4.zeroAddress,
1174
+ fundsRecipient: import_viem6.zeroAddress,
1056
1175
  // Free Mint
1057
1176
  pricePerToken: 0n,
1058
1177
  // Sale start time – defaults to beginning of unix time
@@ -1091,33 +1210,33 @@ function create1155TokenSetupArgs({
1091
1210
  ...salesConfig
1092
1211
  };
1093
1212
  const setupActions = [
1094
- (0, import_viem4.encodeFunctionData)({
1095
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1213
+ (0, import_viem6.encodeFunctionData)({
1214
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1096
1215
  functionName: "assumeLastTokenIdMatches",
1097
1216
  args: [nextTokenId - 1n]
1098
1217
  }),
1099
- createReferral ? (0, import_viem4.encodeFunctionData)({
1100
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1218
+ createReferral ? (0, import_viem6.encodeFunctionData)({
1219
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1101
1220
  functionName: "setupNewTokenWithCreateReferral",
1102
1221
  args: [tokenMetadataURI, maxSupply, createReferral]
1103
- }) : (0, import_viem4.encodeFunctionData)({
1104
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1222
+ }) : (0, import_viem6.encodeFunctionData)({
1223
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1105
1224
  functionName: "setupNewToken",
1106
1225
  args: [tokenMetadataURI, maxSupply]
1107
1226
  }),
1108
- (0, import_viem4.encodeFunctionData)({
1109
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1227
+ (0, import_viem6.encodeFunctionData)({
1228
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1110
1229
  functionName: "addPermission",
1111
1230
  args: [0n, fixedPriceMinterAddress, PERMISSION_BIT_MINTER]
1112
1231
  }),
1113
- (0, import_viem4.encodeFunctionData)({
1114
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1232
+ (0, import_viem6.encodeFunctionData)({
1233
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1115
1234
  functionName: "callSale",
1116
1235
  args: [
1117
1236
  nextTokenId,
1118
1237
  fixedPriceMinterAddress,
1119
- (0, import_viem4.encodeFunctionData)({
1120
- abi: import_protocol_deployments3.zoraCreatorFixedPriceSaleStrategyABI,
1238
+ (0, import_viem6.encodeFunctionData)({
1239
+ abi: import_protocol_deployments4.zoraCreatorFixedPriceSaleStrategyABI,
1121
1240
  functionName: "setSale",
1122
1241
  args: [nextTokenId, salesConfigWithDefaults]
1123
1242
  })
@@ -1126,8 +1245,8 @@ function create1155TokenSetupArgs({
1126
1245
  ];
1127
1246
  if (mintToCreatorCount) {
1128
1247
  setupActions.push(
1129
- (0, import_viem4.encodeFunctionData)({
1130
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1248
+ (0, import_viem6.encodeFunctionData)({
1249
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1131
1250
  functionName: "adminMint",
1132
1251
  args: [account, nextTokenId, mintToCreatorCount, "0x"]
1133
1252
  })
@@ -1135,8 +1254,8 @@ function create1155TokenSetupArgs({
1135
1254
  }
1136
1255
  if (royaltySettings) {
1137
1256
  setupActions.push(
1138
- (0, import_viem4.encodeFunctionData)({
1139
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1257
+ (0, import_viem6.encodeFunctionData)({
1258
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1140
1259
  functionName: "updateRoyaltiesForToken",
1141
1260
  args: [
1142
1261
  nextTokenId,
@@ -1154,8 +1273,8 @@ function create1155TokenSetupArgs({
1154
1273
  var getTokenIdFromCreateReceipt = (receipt) => {
1155
1274
  for (const data of receipt.logs) {
1156
1275
  try {
1157
- const decodedLog = (0, import_viem4.decodeEventLog)({
1158
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1276
+ const decodedLog = (0, import_viem6.decodeEventLog)({
1277
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1159
1278
  eventName: "SetupNewToken",
1160
1279
  ...data
1161
1280
  });
@@ -1171,9 +1290,9 @@ async function getContractExists(publicClient, contract, account) {
1171
1290
  let contractExists = false;
1172
1291
  if (typeof contract !== "string") {
1173
1292
  contractAddress = await publicClient.readContract({
1174
- abi: import_protocol_deployments3.zoraCreator1155FactoryImplABI,
1293
+ abi: import_protocol_deployments4.zoraCreator1155FactoryImplABI,
1175
1294
  // Since this address is deterministic we can hardcode a chain id safely here.
1176
- address: import_protocol_deployments3.zoraCreator1155FactoryImplAddress[999],
1295
+ address: import_protocol_deployments4.zoraCreator1155FactoryImplAddress[999],
1177
1296
  functionName: "deterministicContractAddress",
1178
1297
  args: [
1179
1298
  account,
@@ -1184,7 +1303,7 @@ async function getContractExists(publicClient, contract, account) {
1184
1303
  });
1185
1304
  try {
1186
1305
  await publicClient.readContract({
1187
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1306
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1188
1307
  address: contractAddress,
1189
1308
  functionName: "contractVersion"
1190
1309
  });
@@ -1219,14 +1338,14 @@ function create1155CreatorClient({
1219
1338
  let nextTokenId = 1n;
1220
1339
  if (contractExists) {
1221
1340
  nextTokenId = await publicClient.readContract({
1222
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1341
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1223
1342
  functionName: "nextTokenId",
1224
1343
  address: contractAddress
1225
1344
  });
1226
1345
  }
1227
1346
  const fixedPriceMinterAddress = await publicClient.readContract({
1228
- abi: import_protocol_deployments3.zoraCreator1155FactoryImplABI,
1229
- address: import_protocol_deployments3.zoraCreator1155FactoryImplAddress[999],
1347
+ abi: import_protocol_deployments4.zoraCreator1155FactoryImplABI,
1348
+ address: import_protocol_deployments4.zoraCreator1155FactoryImplAddress[999],
1230
1349
  functionName: "fixedPriceMinter"
1231
1350
  });
1232
1351
  let tokenSetupActions = create1155TokenSetupArgs({
@@ -1250,10 +1369,10 @@ function create1155CreatorClient({
1250
1369
  }
1251
1370
  if (!contractExists && typeof contract !== "string") {
1252
1371
  const request = {
1253
- abi: import_protocol_deployments3.zoraCreator1155FactoryImplABI,
1372
+ abi: import_protocol_deployments4.zoraCreator1155FactoryImplABI,
1254
1373
  functionName: "createContractDeterministic",
1255
1374
  account,
1256
- address: import_protocol_deployments3.zoraCreator1155FactoryImplAddress[999],
1375
+ address: import_protocol_deployments4.zoraCreator1155FactoryImplAddress[999],
1257
1376
  args: [
1258
1377
  contract.uri,
1259
1378
  contract.name,
@@ -1275,7 +1394,7 @@ function create1155CreatorClient({
1275
1394
  };
1276
1395
  } else if (contractExists) {
1277
1396
  const request = {
1278
- abi: import_protocol_deployments3.zoraCreator1155ImplABI,
1397
+ abi: import_protocol_deployments4.zoraCreator1155ImplABI,
1279
1398
  functionName: "multicall",
1280
1399
  account,
1281
1400
  address: contractAddress,
@@ -1299,18 +1418,31 @@ function create1155CreatorClient({
1299
1418
  Errors,
1300
1419
  MintAPIClient,
1301
1420
  PremintAPIClient,
1421
+ PremintConfigVersion,
1422
+ PreminterDomain,
1302
1423
  ZORA_API_BASE,
1303
1424
  convertCollection,
1304
- convertPremint,
1425
+ convertPremintV1,
1305
1426
  create1155CreatorClient,
1306
1427
  create1155TokenSetupArgs,
1307
1428
  createMintClient,
1308
1429
  createPremintClient,
1309
1430
  encodePremintForAPI,
1310
- get1155MintCosts,
1431
+ encodePremintV1ForAPI,
1432
+ encodePremintV2ForAPI,
1311
1433
  getApiNetworkConfigForChain,
1434
+ getMintCosts,
1435
+ getPremintCollectionAddress,
1436
+ getPremintExecutorAddress,
1312
1437
  getPremintedLogFromReceipt,
1313
1438
  getTokenIdFromCreateReceipt,
1314
- preminterTypedDataDefinition
1439
+ isAuthorizedToCreatePremint,
1440
+ isValidSignature,
1441
+ migratePremintConfigToV2,
1442
+ premintTypedDataDefinition,
1443
+ recoverCreatorFromCreatorAttribution,
1444
+ recoverPremintSigner,
1445
+ supportsPremintVersion,
1446
+ tryRecoverPremintSigner
1315
1447
  });
1316
1448
  //# sourceMappingURL=index.cjs.map