@zoralabs/protocol-sdk 0.5.16 → 0.5.17

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.d.ts CHANGED
@@ -9,4 +9,5 @@ export * from "./create/1155-create-helper";
9
9
  export * from "./mints/mints-queries";
10
10
  export * from "./mints/mints-contracts";
11
11
  export * from "./mints/mints-eth-unwrapper-and-caller";
12
+ export { type ContractCreationConfigWithOptionalAdditionalAdmins, type ContractCreationConfigOrAddress, type ContractCreationConfigAndAddress, } from "./premint/contract-types";
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,yBAAyB,CAAC;AAExC,cAAc,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AAEtC,cAAc,yBAAyB,CAAC;AAExC,cAAc,wCAAwC,CAAC;AAEvD,OAAO,EACL,KAAK,kDAAkD,EACvD,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACtC,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  // src/premint/premint-client.ts
2
2
  import { decodeEventLog, zeroAddress as zeroAddress2 } from "viem";
3
- import { zoraCreator1155PremintExecutorImplABI as zoraCreator1155PremintExecutorImplABI2 } from "@zoralabs/protocol-deployments";
3
+ import {
4
+ encodePremintConfig,
5
+ zoraCreator1155PremintExecutorImplABI as zoraCreator1155PremintExecutorImplABI2
6
+ } from "@zoralabs/protocol-deployments";
4
7
 
5
8
  // src/premint/preminter.ts
6
9
  import {
@@ -21,22 +24,21 @@ import {
21
24
  } from "viem";
22
25
  var getPremintExecutorAddress = () => zoraCreator1155PremintExecutorImplAddress[999];
23
26
  async function isAuthorizedToCreatePremint({
24
- collection,
27
+ contractAdmin = zeroAddress,
28
+ additionalAdmins = [],
25
29
  collectionAddress,
26
30
  publicClient,
27
31
  signer
28
32
  }) {
29
- if (collection.additionalAdmins.length > 0)
30
- throw new Error("additionalAdmins not supported yet.");
31
33
  return await publicClient.readContract({
32
34
  abi: preminterAbi,
33
35
  address: getPremintExecutorAddress(),
34
36
  functionName: "isAuthorizedToCreatePremintWithAdditionalAdmins",
35
37
  args: [
36
- signer,
37
- collection.contractAdmin,
38
+ typeof signer === "string" ? signer : signer.address,
39
+ contractAdmin,
38
40
  collectionAddress,
39
- collection.additionalAdmins
41
+ additionalAdmins
40
42
  ]
41
43
  });
42
44
  }
@@ -61,17 +63,14 @@ async function isValidSignature({
61
63
  signature,
62
64
  publicClient,
63
65
  collection,
66
+ collectionAddress,
64
67
  chainId,
65
68
  ...premintConfigAndVersion
66
69
  }) {
67
- const tokenContract = await getPremintCollectionAddress({
68
- collection,
69
- publicClient
70
- });
71
70
  const recoveredAddress = await tryRecoverPremintSigner({
72
71
  ...premintConfigAndVersion,
73
72
  signature,
74
- verifyingContract: tokenContract,
73
+ verifyingContract: collectionAddress,
75
74
  chainId
76
75
  });
77
76
  if (!recoverAddress) {
@@ -81,8 +80,9 @@ async function isValidSignature({
81
80
  }
82
81
  const isAuthorized = await isAuthorizedToCreatePremint({
83
82
  signer: recoveredAddress,
84
- collection,
85
- collectionAddress: tokenContract,
83
+ additionalAdmins: collection?.additionalAdmins,
84
+ contractAdmin: collection?.contractAdmin,
85
+ collectionAddress,
86
86
  publicClient
87
87
  });
88
88
  return {
@@ -163,15 +163,24 @@ var supportsPremintVersion = async ({
163
163
  return (await supportedPremintVersions({ tokenContract, publicClient })).includes(version);
164
164
  };
165
165
  async function getPremintCollectionAddress({
166
+ publicClient,
166
167
  collection,
167
- publicClient
168
+ collectionAddress
168
169
  }) {
169
- return publicClient.readContract({
170
- address: getPremintExecutorAddress(),
171
- abi: zoraCreator1155PremintExecutorImplABI,
172
- functionName: "getContractAddress",
173
- args: [collection]
174
- });
170
+ if (typeof collection !== "undefined") {
171
+ return publicClient.readContract({
172
+ address: getPremintExecutorAddress(),
173
+ abi: zoraCreator1155PremintExecutorImplABI,
174
+ functionName: "getContractWithAdditionalAdminsAddress",
175
+ args: [
176
+ {
177
+ ...collection,
178
+ additionalAdmins: collection.additionalAdmins || []
179
+ }
180
+ ]
181
+ });
182
+ }
183
+ return collectionAddress;
175
184
  }
176
185
  function applyUpdateToPremint({
177
186
  uid,
@@ -240,6 +249,34 @@ function makeMintRewardsRecipient({
240
249
  function getDefaultFixedPriceMinterAddress(chainId) {
241
250
  return zoraCreatorFixedPriceSaleStrategyAddress[chainId];
242
251
  }
252
+ var emptyContractCreationConfig = () => ({
253
+ contractAdmin: zeroAddress,
254
+ contractURI: "",
255
+ contractName: "",
256
+ additionalAdmins: []
257
+ });
258
+ function defaultAdditionalAdmins(collection) {
259
+ return {
260
+ ...collection,
261
+ additionalAdmins: collection.additionalAdmins || []
262
+ };
263
+ }
264
+ var toContractCreationConfigOrAddress = ({
265
+ collection,
266
+ collectionAddress
267
+ }) => {
268
+ if (typeof collection !== "undefined") {
269
+ return {
270
+ collection
271
+ };
272
+ }
273
+ if (typeof collectionAddress !== "undefined") {
274
+ return {
275
+ collectionAddress
276
+ };
277
+ }
278
+ throw new Error("Must provide either a collection or a collection address");
279
+ };
243
280
 
244
281
  // src/premint/premint-client.ts
245
282
  import {
@@ -539,11 +576,16 @@ var MintAPIClient = class {
539
576
  import {
540
577
  PremintConfigVersion
541
578
  } from "@zoralabs/protocol-deployments";
542
- var convertCollectionFromApi = (collection) => ({
543
- ...collection,
544
- contractAdmin: collection.contractAdmin,
545
- additionalAdmins: []
546
- });
579
+ var convertCollectionFromApi = (collection) => {
580
+ if (!collection)
581
+ return void 0;
582
+ return {
583
+ additionalAdmins: collection.additionalAdmins || [],
584
+ contractAdmin: collection.contractAdmin,
585
+ contractName: collection.contractName,
586
+ contractURI: collection.contractURI
587
+ };
588
+ };
547
589
  var convertPremintFromApi = (premint) => {
548
590
  if (premint.config_version === PremintConfigVersion.V1 || !premint.config_version) {
549
591
  const tokenConfig = premint.tokenConfig;
@@ -591,6 +633,7 @@ var convertPremintFromApi = (premint) => {
591
633
  var convertGetPremintApiResponse = (response) => ({
592
634
  ...convertPremintFromApi(response.premint),
593
635
  collection: convertCollectionFromApi(response.collection),
636
+ collectionAddress: response.collection_address,
594
637
  signature: response.signature
595
638
  });
596
639
  var encodePremintV1ForAPI = ({
@@ -637,6 +680,7 @@ var encodePremintForAPI = ({
637
680
  };
638
681
  var encodePostSignatureInput = ({
639
682
  collection,
683
+ collectionAddress,
640
684
  premintConfigVersion,
641
685
  premintConfig,
642
686
  signature,
@@ -648,6 +692,7 @@ var encodePostSignatureInput = ({
648
692
  }),
649
693
  signature,
650
694
  collection,
695
+ collection_address: collectionAddress,
651
696
  chain_name: networkConfigByChain[chainId].zoraBackendChainName
652
697
  });
653
698
 
@@ -683,13 +728,11 @@ var getSignature = async ({
683
728
  var PremintAPIClient = class {
684
729
  constructor(chainId, httpClient2) {
685
730
  this.postSignature = async ({
686
- collection,
687
731
  signature,
688
- ...premintConfigAndVersion
732
+ ...rest
689
733
  }) => {
690
734
  const data = encodePostSignatureInput({
691
- collection,
692
- ...premintConfigAndVersion,
735
+ ...rest,
693
736
  chainId: this.networkConfig.chainId,
694
737
  signature
695
738
  });
@@ -746,6 +789,37 @@ var defaultTokenConfigV1MintArguments = () => ({
746
789
  royaltyBPS: 1e3
747
790
  // 10%,
748
791
  });
792
+ var pickTokenConfigV1 = (tokenConfig) => ({
793
+ maxSupply: tokenConfig.maxSupply,
794
+ maxTokensPerAddress: tokenConfig.maxTokensPerAddress,
795
+ pricePerToken: tokenConfig.pricePerToken,
796
+ mintDuration: tokenConfig.mintDuration,
797
+ mintStart: tokenConfig.mintStart,
798
+ royaltyBPS: tokenConfig.royaltyBPS,
799
+ tokenURI: tokenConfig.tokenURI,
800
+ royaltyRecipient: tokenConfig.payoutRecipient
801
+ });
802
+ var pickTokenConfigV2 = (tokenConfig) => ({
803
+ maxSupply: tokenConfig.maxSupply,
804
+ maxTokensPerAddress: tokenConfig.maxTokensPerAddress,
805
+ pricePerToken: tokenConfig.pricePerToken,
806
+ mintDuration: tokenConfig.mintDuration,
807
+ mintStart: tokenConfig.mintStart,
808
+ royaltyBPS: tokenConfig.royaltyBPS,
809
+ tokenURI: tokenConfig.tokenURI,
810
+ payoutRecipient: tokenConfig.payoutRecipient,
811
+ createReferral: tokenConfig.createReferral || zeroAddress2
812
+ });
813
+ var tokenConfigV1WithDefault = (tokenConfig, fixedPriceMinter) => ({
814
+ ...pickTokenConfigV1(tokenConfig),
815
+ ...defaultTokenConfigV1MintArguments(),
816
+ fixedPriceMinter
817
+ });
818
+ var tokenConfigV2WithDefault = (tokenConfig, fixedPriceMinter) => ({
819
+ ...pickTokenConfigV2(tokenConfig),
820
+ ...defaultTokenConfigV2MintArguments(),
821
+ fixedPriceMinter
822
+ });
749
823
  var defaultTokenConfigV2MintArguments = () => ({
750
824
  maxSupply: OPEN_EDITION_MINT_SIZE,
751
825
  maxTokensPerAddress: 0n,
@@ -758,32 +832,29 @@ var defaultTokenConfigV2MintArguments = () => ({
758
832
  });
759
833
  var makeTokenConfigWithDefaults = ({
760
834
  chainId,
761
- premintConfigVersion,
762
835
  tokenCreationConfig,
763
- payoutRecipient
836
+ supportedPremintVersions: supportedPremintVersions2
764
837
  }) => {
765
- if (premintConfigVersion === PremintConfigVersion2.V3) {
766
- throw new Error("PremintV3 not supported in SDK");
767
- }
768
- const fixedPriceMinter = tokenCreationConfig.fixedPriceMinter || getDefaultFixedPriceMinterAddress(chainId);
769
- if (premintConfigVersion === PremintConfigVersion2.V1) {
770
- return {
771
- fixedPriceMinter,
772
- ...defaultTokenConfigV1MintArguments(),
773
- royaltyRecipient: payoutRecipient,
774
- ...tokenCreationConfig
775
- };
776
- } else if (premintConfigVersion === PremintConfigVersion2.V2) {
838
+ const fixedPriceMinter = getDefaultFixedPriceMinterAddress(chainId);
839
+ if (!supportedPremintVersions2.includes(PremintConfigVersion2.V2)) {
840
+ if (tokenCreationConfig.createReferral) {
841
+ throw new Error("Contract does not support create referral");
842
+ }
777
843
  return {
778
- fixedPriceMinter,
779
- ...defaultTokenConfigV2MintArguments(),
780
- payoutRecipient,
781
- createReferral: zeroAddress2,
782
- ...tokenCreationConfig
844
+ premintConfigVersion: PremintConfigVersion2.V1,
845
+ tokenConfig: tokenConfigV1WithDefault(
846
+ tokenCreationConfig,
847
+ fixedPriceMinter
848
+ )
783
849
  };
784
- } else {
785
- throw new Error(`Invalid premint config version ${premintConfigVersion}`);
786
850
  }
851
+ return {
852
+ premintConfigVersion: PremintConfigVersion2.V2,
853
+ tokenConfig: tokenConfigV2WithDefault(
854
+ tokenCreationConfig,
855
+ fixedPriceMinter
856
+ )
857
+ };
787
858
  };
788
859
  function getPremintedLogFromReceipt(receipt) {
789
860
  for (const data of receipt.logs) {
@@ -893,17 +964,22 @@ var PremintClient = class {
893
964
  */
894
965
  async isValidSignature({
895
966
  signature,
896
- collection,
897
967
  premintConfig,
898
- premintConfigVersion
968
+ premintConfigVersion,
969
+ ...collectionAndOrAddress
899
970
  }) {
971
+ const collectionAddressToUse = await getPremintCollectionAddress({
972
+ ...collectionAndOrAddress,
973
+ publicClient: this.publicClient
974
+ });
900
975
  const { isAuthorized, recoveredAddress } = await isValidSignature({
901
976
  chainId: this.chain.id,
902
977
  signature,
903
- collection,
904
978
  publicClient: this.publicClient,
905
979
  premintConfig,
906
- premintConfigVersion: premintConfigVersion || PremintConfigVersion2.V1
980
+ premintConfigVersion: premintConfigVersion || PremintConfigVersion2.V1,
981
+ collectionAddress: collectionAddressToUse,
982
+ collection: collectionAndOrAddress.collection
907
983
  });
908
984
  return { isValid: isAuthorized, recoveredSigner: recoveredAddress };
909
985
  }
@@ -953,12 +1029,12 @@ function createPremintClient(clientConfig) {
953
1029
  function makePremintReturn({
954
1030
  premintConfig,
955
1031
  premintConfigVersion,
956
- collectionAddress,
957
- collection,
958
1032
  publicClient,
959
1033
  apiClient,
960
- chainId
1034
+ chainId,
1035
+ ...collectionAndAddress
961
1036
  }) {
1037
+ const { collection, collectionAddress } = collectionAndAddress;
962
1038
  const typedDataDefinition = premintTypedDataDefinition2({
963
1039
  verifyingContract: collectionAddress,
964
1040
  premintConfig,
@@ -991,20 +1067,19 @@ function makePremintReturn({
991
1067
  signerAccount
992
1068
  }) => {
993
1069
  if (checkSignature) {
994
- await validateSignature({
995
- collection: {
996
- ...collection,
997
- additionalAdmins: []
998
- },
1070
+ const isAuthorized = await isAuthorizedToCreatePremint({
1071
+ collectionAddress,
1072
+ additionalAdmins: collection?.additionalAdmins,
1073
+ contractAdmin: collection?.contractAdmin,
999
1074
  publicClient,
1000
- signerAccount
1075
+ signer: signerAccount
1001
1076
  });
1077
+ if (!isAuthorized) {
1078
+ throw new Error("Not authorized to create premint");
1079
+ }
1002
1080
  }
1003
1081
  await apiClient.postSignature({
1004
- collection: {
1005
- ...collection,
1006
- additionalAdmins: []
1007
- },
1082
+ ...toContractCreationConfigOrAddress(collectionAndAddress),
1008
1083
  signature,
1009
1084
  premintConfig,
1010
1085
  premintConfigVersion
@@ -1039,43 +1114,21 @@ async function signPremint({
1039
1114
  signerAccount: account
1040
1115
  };
1041
1116
  }
1042
- var validateSignature = async ({
1043
- collection,
1044
- publicClient,
1045
- signerAccount
1046
- }) => {
1047
- const isAuthorized = await isAuthorizedToCreatePremint({
1048
- collection,
1049
- publicClient,
1050
- signer: typeof signerAccount === "string" ? signerAccount : signerAccount.address,
1051
- collectionAddress: await getPremintCollectionAddress({
1052
- collection,
1053
- publicClient
1054
- })
1055
- });
1056
- if (!isAuthorized) {
1057
- throw new Error("Not authorized to create premint");
1058
- }
1059
- };
1060
1117
  async function createPremint({
1061
- payoutRecipient: creatorAccount,
1062
- collection,
1063
1118
  tokenCreationConfig,
1064
- premintConfigVersion,
1065
1119
  uid,
1066
1120
  publicClient,
1067
1121
  apiClient,
1068
- chainId
1122
+ chainId,
1123
+ ...collectionOrAddress
1069
1124
  }) {
1070
1125
  const {
1071
1126
  premintConfig,
1072
- premintConfigVersion: actualVersion,
1073
- collectionAddress
1127
+ premintConfigVersion,
1128
+ collectionAddress: collectionAddressToUse
1074
1129
  } = await prepareCreatePremintConfig({
1075
- payoutRecipient: creatorAccount,
1076
- collection,
1130
+ ...collectionOrAddress,
1077
1131
  tokenCreationConfig,
1078
- premintConfigVersion,
1079
1132
  uid,
1080
1133
  publicClient,
1081
1134
  apiClient,
@@ -1083,59 +1136,49 @@ async function createPremint({
1083
1136
  });
1084
1137
  return makePremintReturn({
1085
1138
  premintConfig,
1086
- premintConfigVersion: actualVersion,
1087
- collectionAddress,
1088
- collection,
1139
+ premintConfigVersion,
1140
+ collectionAddress: collectionAddressToUse,
1141
+ collection: collectionOrAddress.collection,
1089
1142
  publicClient,
1090
1143
  apiClient,
1091
1144
  chainId
1092
1145
  });
1093
1146
  }
1094
1147
  async function prepareCreatePremintConfig({
1095
- payoutRecipient,
1096
- collection,
1097
1148
  tokenCreationConfig,
1098
- premintConfigVersion,
1099
1149
  uid,
1100
1150
  publicClient,
1101
1151
  apiClient,
1102
- chainId
1152
+ chainId,
1153
+ ...collectionOrAddress
1103
1154
  }) {
1104
- const collectionWithAdditionalAdmins = {
1105
- ...collection,
1106
- additionalAdmins: collection.additionalAdmins || []
1107
- };
1108
1155
  const newContractAddress = await getPremintCollectionAddress({
1109
1156
  publicClient,
1110
- collection: collectionWithAdditionalAdmins
1157
+ ...collectionOrAddress
1111
1158
  });
1112
1159
  let uidToUse = uid;
1113
1160
  if (typeof uidToUse !== "number") {
1114
1161
  uidToUse = await apiClient.getNextUID(newContractAddress);
1115
1162
  }
1116
- const actualVersion = premintConfigVersion || PremintConfigVersion2.V1;
1117
- if (!await supportsPremintVersion({
1118
- version: actualVersion,
1119
- publicClient,
1120
- tokenContract: newContractAddress
1121
- })) {
1122
- throw new Error(
1123
- `Premint version ${actualVersion} not supported by contract`
1124
- );
1125
- }
1163
+ const supportedVersions = await supportedPremintVersions({
1164
+ tokenContract: newContractAddress,
1165
+ publicClient
1166
+ });
1167
+ const tokenConfigAndVersion = makeTokenConfigWithDefaults({
1168
+ tokenCreationConfig,
1169
+ chainId,
1170
+ supportedPremintVersions: supportedVersions
1171
+ });
1126
1172
  const premintConfig = makeNewPremint({
1127
- tokenConfig: makeTokenConfigWithDefaults({
1128
- // @ts-ignore
1129
- premintConfigVersion: actualVersion,
1130
- tokenCreationConfig,
1131
- payoutRecipient: typeof payoutRecipient === "string" ? payoutRecipient : payoutRecipient.address,
1132
- chainId
1133
- }),
1173
+ ...tokenConfigAndVersion,
1134
1174
  uid: uidToUse
1135
1175
  });
1136
- return {
1176
+ const premintConfigAndVersion = {
1137
1177
  premintConfig,
1138
- premintConfigVersion: actualVersion,
1178
+ premintConfigVersion: tokenConfigAndVersion.premintConfigVersion
1179
+ };
1180
+ return {
1181
+ ...premintConfigAndVersion,
1139
1182
  collectionAddress: newContractAddress
1140
1183
  };
1141
1184
  }
@@ -1181,7 +1224,8 @@ async function deletePremint({
1181
1224
  const {
1182
1225
  premintConfig,
1183
1226
  premintConfigVersion,
1184
- collection: collectionCreationConfig
1227
+ collection: collectionCreationConfig,
1228
+ collectionAddress
1185
1229
  } = await apiClient.getSignature({
1186
1230
  collectionAddress: collection,
1187
1231
  uid
@@ -1194,7 +1238,7 @@ async function deletePremint({
1194
1238
  return makePremintReturn({
1195
1239
  premintConfig: deletedPremint,
1196
1240
  premintConfigVersion,
1197
- collectionAddress: collection,
1241
+ collectionAddress,
1198
1242
  collection: collectionCreationConfig,
1199
1243
  publicClient,
1200
1244
  apiClient,
@@ -1206,6 +1250,7 @@ async function makeMintParameters({
1206
1250
  tokenContract,
1207
1251
  minterAccount,
1208
1252
  mintArguments,
1253
+ firstMinter,
1209
1254
  apiClient,
1210
1255
  publicClient
1211
1256
  }) {
@@ -1215,7 +1260,13 @@ async function makeMintParameters({
1215
1260
  if (!minterAccount) {
1216
1261
  throw new Error("Wallet not passed in");
1217
1262
  }
1218
- const { premintConfig, premintConfigVersion, collection, signature } = await apiClient.getSignature({
1263
+ const {
1264
+ premintConfig,
1265
+ premintConfigVersion,
1266
+ collection,
1267
+ collectionAddress,
1268
+ signature
1269
+ } = await apiClient.getSignature({
1219
1270
  collectionAddress: tokenContract,
1220
1271
  uid
1221
1272
  });
@@ -1236,38 +1287,29 @@ async function makeMintParameters({
1236
1287
  mintReferral: mintArguments?.mintReferral
1237
1288
  })
1238
1289
  };
1239
- if (premintConfigVersion === PremintConfigVersion2.V1) {
1240
- return makeSimulateContractParamaters({
1241
- account: minterAccount,
1242
- abi: zoraCreator1155PremintExecutorImplABI2,
1243
- functionName: "premintV1",
1244
- value,
1245
- address: getPremintExecutorAddress(),
1246
- args: [
1247
- collection,
1248
- premintConfig,
1249
- signature,
1250
- numberToMint,
1251
- mintArgumentsContract
1252
- ]
1253
- });
1254
- } else if (premintConfigVersion === PremintConfigVersion2.V2) {
1255
- return makeSimulateContractParamaters({
1256
- account: minterAccount,
1257
- abi: zoraCreator1155PremintExecutorImplABI2,
1258
- functionName: "premintV2",
1259
- value,
1260
- address: getPremintExecutorAddress(),
1261
- args: [
1262
- collection,
1290
+ const collectionOrEmpty = collection ? defaultAdditionalAdmins(collection) : emptyContractCreationConfig();
1291
+ const collectionAddressToSubmit = collection ? zeroAddress2 : collectionAddress;
1292
+ const firstMinterToSubmit = firstMinter || (typeof minterAccount === "string" ? minterAccount : minterAccount.address);
1293
+ return makeSimulateContractParamaters({
1294
+ account: minterAccount,
1295
+ abi: zoraCreator1155PremintExecutorImplABI2,
1296
+ functionName: "premint",
1297
+ value,
1298
+ address: getPremintExecutorAddress(),
1299
+ args: [
1300
+ collectionOrEmpty,
1301
+ collectionAddressToSubmit,
1302
+ encodePremintConfig({
1263
1303
  premintConfig,
1264
- signature,
1265
- numberToMint,
1266
- mintArgumentsContract
1267
- ]
1268
- });
1269
- }
1270
- throw new Error(`Invalid premint config version ${premintConfigVersion}`);
1304
+ premintConfigVersion
1305
+ }),
1306
+ signature,
1307
+ numberToMint,
1308
+ mintArgumentsContract,
1309
+ firstMinterToSubmit,
1310
+ zeroAddress2
1311
+ ]
1312
+ });
1271
1313
  }
1272
1314
  function makeUrls({
1273
1315
  uid,
@@ -1288,7 +1330,9 @@ function makeUrls({
1288
1330
  }
1289
1331
 
1290
1332
  // src/premint/contract-types.ts
1291
- import { PremintConfigVersion as PremintConfigVersionOrig } from "@zoralabs/protocol-deployments";
1333
+ import {
1334
+ PremintConfigVersion as PremintConfigVersionOrig
1335
+ } from "@zoralabs/protocol-deployments";
1292
1336
  var PremintConfigVersion3 = ((PremintConfigVersion4) => {
1293
1337
  PremintConfigVersion4[PremintConfigVersion4["V1"] = PremintConfigVersionOrig.V1] = "V1";
1294
1338
  PremintConfigVersion4[PremintConfigVersion4["V2"] = PremintConfigVersionOrig.V2] = "V2";
@@ -2064,8 +2108,10 @@ export {
2064
2108
  createMintClient,
2065
2109
  createPremintClient,
2066
2110
  decodeCallFailedError,
2111
+ defaultAdditionalAdmins,
2067
2112
  defaultTokenConfigV1MintArguments,
2068
2113
  defaultTokenConfigV2MintArguments,
2114
+ emptyContractCreationConfig,
2069
2115
  encodeCollectOnManager,
2070
2116
  encodePostSignatureInput,
2071
2117
  encodePremintForAPI,
@@ -2098,6 +2144,7 @@ export {
2098
2144
  sumBalances,
2099
2145
  supportedPremintVersions,
2100
2146
  supportsPremintVersion,
2147
+ toContractCreationConfigOrAddress,
2101
2148
  tryRecoverPremintSigner,
2102
2149
  unwrapAndForwardEthPermitAndTypedDataDefinition
2103
2150
  };