@zoralabs/protocol-sdk 0.5.15 → 0.5.16

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/premint/premint-client.ts
2
- import { createPublicClient, decodeEventLog, http, zeroAddress as zeroAddress2 } from "viem";
2
+ import { decodeEventLog, zeroAddress as zeroAddress2 } from "viem";
3
3
  import { zoraCreator1155PremintExecutorImplABI as zoraCreator1155PremintExecutorImplABI2 } from "@zoralabs/protocol-deployments";
4
4
 
5
5
  // src/premint/preminter.ts
@@ -721,7 +721,18 @@ var PremintAPIClient = class {
721
721
  };
722
722
 
723
723
  // src/utils.ts
724
+ import {
725
+ createPublicClient,
726
+ http
727
+ } from "viem";
724
728
  var makeSimulateContractParamaters = (args) => args;
729
+ function setupClient({ chain, httpClient: httpClient2, publicClient }) {
730
+ return {
731
+ chain,
732
+ httpClient: httpClient2 || httpClient,
733
+ publicClient: publicClient || createPublicClient({ chain, transport: http() })
734
+ };
735
+ }
725
736
 
726
737
  // src/premint/premint-client.ts
727
738
  var defaultTokenConfigV1MintArguments = () => ({
@@ -749,7 +760,7 @@ var makeTokenConfigWithDefaults = ({
749
760
  chainId,
750
761
  premintConfigVersion,
751
762
  tokenCreationConfig,
752
- creatorAccount
763
+ payoutRecipient
753
764
  }) => {
754
765
  if (premintConfigVersion === PremintConfigVersion2.V3) {
755
766
  throw new Error("PremintV3 not supported in SDK");
@@ -759,14 +770,14 @@ var makeTokenConfigWithDefaults = ({
759
770
  return {
760
771
  fixedPriceMinter,
761
772
  ...defaultTokenConfigV1MintArguments(),
762
- royaltyRecipient: creatorAccount,
773
+ royaltyRecipient: payoutRecipient,
763
774
  ...tokenCreationConfig
764
775
  };
765
776
  } else if (premintConfigVersion === PremintConfigVersion2.V2) {
766
777
  return {
767
778
  fixedPriceMinter,
768
779
  ...defaultTokenConfigV2MintArguments(),
769
- payoutRecipient: creatorAccount,
780
+ payoutRecipient,
770
781
  createReferral: zeroAddress2,
771
782
  ...tokenCreationConfig
772
783
  };
@@ -793,7 +804,7 @@ var PremintClient = class {
793
804
  constructor(chain, publicClient, httpClient2) {
794
805
  this.chain = chain;
795
806
  this.apiClient = new PremintAPIClient(chain.id, httpClient2);
796
- this.publicClient = publicClient || createPublicClient({ chain, transport: http() });
807
+ this.publicClient = publicClient;
797
808
  }
798
809
  getDataFromPremintReceipt(receipt) {
799
810
  const premintedLog = getPremintedLogFromReceipt(receipt);
@@ -806,174 +817,45 @@ var PremintClient = class {
806
817
  };
807
818
  }
808
819
  /**
809
- * Update existing premint given collection address and UID of existing premint.
810
- *
811
- * 1. Loads existing premint token
812
- * 2. Updates with settings passed into function
813
- * 3. Increments the version field
814
- * 4. Re-signs the premint
815
- * 5. Uploads the premint to the ZORA API
816
- *
817
- * Updates existing premint
818
- * @param settings Settings for the new premint
819
- * @param settings.account Account to sign the premint update from. Taken from walletClient if none passed in.
820
- * @param settings.collection Collection information for the mint
821
- * @param settings.walletClient viem wallet client to use to sign
822
- * @param settings.uid UID
823
- * @param settings.token Mint argument settings, optional settings are overridden with sensible defaults.
820
+ * Prepares data for updating a premint
824
821
  *
822
+ * @param parameters - Parameters for updating the premint {@link UpdatePremintParams}
823
+ * @returns A PremintReturn. {@link PremintReturn}
825
824
  */
826
- async updatePremint({
827
- walletClient,
828
- uid,
829
- collection,
830
- account,
831
- tokenConfigUpdates
832
- }) {
833
- const {
834
- premintConfig,
835
- collection: collectionCreationConfig,
836
- premintConfigVersion
837
- } = await this.apiClient.getSignature({
838
- collectionAddress: collection,
839
- uid
840
- });
841
- const updatedPremint = applyUpdateToPremint({
842
- uid: premintConfig.uid,
843
- version: premintConfig.version,
844
- tokenConfig: premintConfig.tokenConfig,
845
- tokenConfigUpdates
846
- });
847
- return await this.signAndSubmitPremint({
848
- walletClient,
849
- account,
850
- checkSignature: true,
851
- verifyingContract: collection,
852
- collection: collectionCreationConfig,
853
- premintConfig: updatedPremint,
854
- premintConfigVersion
855
- });
856
- }
857
- /**
858
- * Delete premint.
859
- *
860
- * 1. Loads current premint from collection address with UID
861
- * 2. Increments version and marks as deleted
862
- * 3. Signs new premint version
863
- * 4. Sends to ZORA Premint API
864
- *
865
- * Deletes existing premint
866
- * @param settings.collection collection address
867
- * @param settings.uid UID
868
- * @param settings.walletClient viem wallet client to use to sign
869
- *
870
- */
871
- async deletePremint({
872
- walletClient,
873
- uid,
874
- account,
875
- collection
876
- }) {
877
- const {
878
- premintConfig,
879
- premintConfigVersion,
880
- collection: collectionCreationConfig
881
- } = await this.apiClient.getSignature({
882
- collectionAddress: collection,
883
- uid
884
- });
885
- const deletedPremint = {
886
- ...premintConfig,
887
- version: premintConfig.version + 1,
888
- deleted: true
889
- };
890
- return await this.signAndSubmitPremint({
891
- walletClient,
892
- account,
893
- checkSignature: false,
894
- verifyingContract: collection,
895
- collection: collectionCreationConfig,
896
- premintConfig: deletedPremint,
897
- premintConfigVersion
825
+ async updatePremint(args) {
826
+ return await updatePremint({
827
+ ...args,
828
+ apiClient: this.apiClient,
829
+ publicClient: this.publicClient,
830
+ chainId: this.chain.id
898
831
  });
899
832
  }
900
833
  /**
901
- * Internal function to sign and submit a premint request.
834
+ * Prepares data for deleting a premint
902
835
  *
903
- * @param premintArguments Arguments to premint
904
- * @returns
836
+ * @param parameters - Parameters for deleting the premint {@link DeletePremintParams}
837
+ * @returns A PremintReturn. {@link PremintReturn}
905
838
  */
906
- async signAndSubmitPremint(params) {
907
- const { verifyingContract } = await signAndSubmitPremint({
839
+ async deletePremint(params) {
840
+ return deletePremint({
908
841
  ...params,
909
- chainId: this.chain.id,
910
842
  apiClient: this.apiClient,
911
- publicClient: this.publicClient
843
+ publicClient: this.publicClient,
844
+ chainId: this.chain.id
912
845
  });
913
- const uid = params.premintConfig.uid;
914
- return {
915
- urls: this.makeUrls({ address: verifyingContract, uid }),
916
- uid,
917
- verifyingContract
918
- };
919
846
  }
920
847
  /**
921
- * Create premint
848
+ * Prepares data for creating a premint
922
849
  *
923
- * @param settings Settings for the new premint
924
- * @param settings.account Account to sign the premint with. Taken from walletClient if none passed in.
925
- * @param settings.collection Collection information for the mint
926
- * @param settings.tokenCreationConfig Mint argument settings, optional settings are overridden with sensible defaults.
927
- * @param setings.premintConfigVersion Premint config version to use, defaults to V2
928
- * @param settings.uid the UID to use – optional and retrieved as a fresh UID from ZORA by default.
929
- * @param settings.checkSignature if the signature should have a pre-flight check. Not required but helpful for debugging.
930
- * @returns premint url, uid, newContractAddress, and premint object
850
+ * @param parameters - Parameters for creating the premint {@link CreatePremintParameters}
851
+ * @returns A PremintReturn. {@link PremintReturn}
931
852
  */
932
- async createPremint({
933
- creatorAccount,
934
- collection,
935
- tokenCreationConfig,
936
- premintConfigVersion,
937
- walletClient,
938
- uid,
939
- checkSignature = false
940
- }) {
941
- const newContractAddress = await getPremintCollectionAddress({
942
- publicClient: this.publicClient,
943
- collection
944
- });
945
- let uidToUse = uid;
946
- if (typeof uidToUse !== "number") {
947
- uidToUse = await this.apiClient.getNextUID(newContractAddress);
948
- }
949
- const actualVersion = premintConfigVersion || PremintConfigVersion2.V1;
950
- if (!await supportsPremintVersion({
951
- version: actualVersion,
853
+ async createPremint(parameters) {
854
+ return createPremint({
855
+ ...parameters,
952
856
  publicClient: this.publicClient,
953
- tokenContract: newContractAddress
954
- })) {
955
- throw new Error(
956
- `Premint version ${actualVersion} not supported by contract`
957
- );
958
- }
959
- const premintConfig = makeNewPremint({
960
- tokenConfig: makeTokenConfigWithDefaults({
961
- // @ts-ignore
962
- premintConfigVersion: actualVersion,
963
- tokenCreationConfig,
964
- creatorAccount: typeof creatorAccount === "string" ? creatorAccount : creatorAccount.address,
965
- chainId: this.chain.id
966
- }),
967
- uid: uidToUse
968
- });
969
- return await this.signAndSubmitPremint({
970
- verifyingContract: newContractAddress,
971
- premintConfig,
972
- premintConfigVersion: actualVersion,
973
- checkSignature,
974
- account: creatorAccount,
975
- walletClient,
976
- collection
857
+ apiClient: this.apiClient,
858
+ chainId: this.chain.id
977
859
  });
978
860
  }
979
861
  /**
@@ -1050,91 +932,342 @@ var PremintClient = class {
1050
932
  });
1051
933
  }
1052
934
  /**
1053
- * Execute premint on-chain
935
+ * Prepares the parameters to collect a premint; it brings the contract and token onchain, then collects
936
+ * tokens on that contract for the mint recipient.
1054
937
  *
1055
- * @param settings.data Data from the API for the mint
1056
- * @param settings.account Optional account (if omitted taken from wallet client) for the account executing the premint.
1057
- * @param settings.walletClient WalletClient to send execution from.
1058
- * @param settings.mintArguments User minting arguments.
1059
- * @param settings.mintArguments.quantityToMint Quantity to mint, optional, defaults to 1.
1060
- * @param settings.mintArguments.mintComment Optional mint comment, optional, omits when not included.
1061
- * @param settings.publicClient Optional public client for preflight checks.
938
+ * @param parameters - Parameters for collecting the Premint {@link MakeMintParametersArguments}
1062
939
  * @returns receipt, log, zoraURL
1063
940
  */
1064
- async makeMintParameters({
1065
- uid,
1066
- tokenContract,
1067
- minterAccount,
1068
- mintArguments
1069
- }) {
1070
- if (mintArguments && mintArguments?.quantityToMint < 1) {
1071
- throw new Error("Quantity to mint cannot be below 1");
1072
- }
1073
- if (!minterAccount) {
1074
- throw new Error("Wallet not passed in");
1075
- }
1076
- const { premintConfig, premintConfigVersion, collection, signature } = await this.getPremintSignature({
1077
- address: tokenContract,
1078
- uid
941
+ async makeMintParameters(parameters) {
942
+ return await makeMintParameters({
943
+ ...parameters,
944
+ apiClient: this.apiClient,
945
+ publicClient: this.publicClient
1079
946
  });
1080
- const numberToMint = BigInt(mintArguments?.quantityToMint || 1);
1081
- if (premintConfigVersion === PremintConfigVersion2.V3) {
1082
- throw new Error("PremintV3 not supported in premint SDK");
1083
- }
1084
- const value = (await getPremintMintCosts({
1085
- tokenContract,
1086
- quantityToMint: numberToMint,
1087
- publicClient: this.publicClient,
1088
- tokenPrice: premintConfig.tokenConfig.pricePerToken
1089
- })).totalCost;
1090
- const mintArgumentsContract = {
1091
- mintComment: mintArguments?.mintComment || "",
1092
- mintRecipient: mintArguments?.mintRecipient || (typeof minterAccount === "string" ? minterAccount : minterAccount.address),
1093
- mintRewardsRecipients: makeMintRewardsRecipient({
1094
- mintReferral: mintArguments?.mintReferral,
1095
- platformReferral: mintArguments?.platformReferral
1096
- })
947
+ }
948
+ };
949
+ function createPremintClient(clientConfig) {
950
+ const { chain, httpClient: httpClient2, publicClient } = setupClient(clientConfig);
951
+ return new PremintClient(chain, publicClient, httpClient2);
952
+ }
953
+ function makePremintReturn({
954
+ premintConfig,
955
+ premintConfigVersion,
956
+ collectionAddress,
957
+ collection,
958
+ publicClient,
959
+ apiClient,
960
+ chainId
961
+ }) {
962
+ const typedDataDefinition = premintTypedDataDefinition2({
963
+ verifyingContract: collectionAddress,
964
+ premintConfig,
965
+ premintConfigVersion,
966
+ chainId
967
+ });
968
+ const signAndSubmit = async ({
969
+ walletClient,
970
+ account,
971
+ checkSignature
972
+ }) => {
973
+ const { signature, signerAccount } = await signPremint({
974
+ account,
975
+ walletClient,
976
+ typedDataDefinition
977
+ });
978
+ await submit({
979
+ signature,
980
+ checkSignature,
981
+ signerAccount
982
+ });
983
+ return {
984
+ signature,
985
+ signerAccount
1097
986
  };
1098
- if (premintConfigVersion === PremintConfigVersion2.V1) {
1099
- return makeSimulateContractParamaters({
1100
- account: minterAccount,
1101
- abi: zoraCreator1155PremintExecutorImplABI2,
1102
- functionName: "premintV1",
1103
- value,
1104
- address: getPremintExecutorAddress(),
1105
- args: [
1106
- collection,
1107
- premintConfig,
1108
- signature,
1109
- numberToMint,
1110
- mintArgumentsContract
1111
- ]
1112
- });
1113
- } else if (premintConfigVersion === PremintConfigVersion2.V2) {
1114
- return makeSimulateContractParamaters({
1115
- account: minterAccount,
1116
- abi: zoraCreator1155PremintExecutorImplABI2,
1117
- functionName: "premintV2",
1118
- value,
1119
- address: getPremintExecutorAddress(),
1120
- args: [
1121
- collection,
1122
- premintConfig,
1123
- signature,
1124
- numberToMint,
1125
- mintArgumentsContract
1126
- ]
987
+ };
988
+ const submit = async ({
989
+ signature,
990
+ checkSignature,
991
+ signerAccount
992
+ }) => {
993
+ if (checkSignature) {
994
+ await validateSignature({
995
+ collection: {
996
+ ...collection,
997
+ additionalAdmins: []
998
+ },
999
+ publicClient,
1000
+ signerAccount
1127
1001
  });
1128
1002
  }
1129
- throw new Error(`Invalid premint config version ${premintConfigVersion}`);
1003
+ await apiClient.postSignature({
1004
+ collection: {
1005
+ ...collection,
1006
+ additionalAdmins: []
1007
+ },
1008
+ signature,
1009
+ premintConfig,
1010
+ premintConfigVersion
1011
+ });
1012
+ };
1013
+ return {
1014
+ premintConfig,
1015
+ premintConfigVersion,
1016
+ typedDataDefinition,
1017
+ collectionAddress,
1018
+ signAndSubmit,
1019
+ submit
1020
+ };
1021
+ }
1022
+ async function signPremint({
1023
+ account,
1024
+ walletClient,
1025
+ typedDataDefinition
1026
+ }) {
1027
+ if (!account) {
1028
+ account = walletClient.account;
1029
+ }
1030
+ if (!account) {
1031
+ throw new Error("No account provided");
1032
+ }
1033
+ const signature = await walletClient.signTypedData({
1034
+ account,
1035
+ ...typedDataDefinition
1036
+ });
1037
+ return {
1038
+ signature,
1039
+ signerAccount: account
1040
+ };
1041
+ }
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");
1130
1058
  }
1131
1059
  };
1132
- function createPremintClient({
1133
- chain,
1134
- httpClient: httpClient2,
1060
+ async function createPremint({
1061
+ payoutRecipient: creatorAccount,
1062
+ collection,
1063
+ tokenCreationConfig,
1064
+ premintConfigVersion,
1065
+ uid,
1066
+ publicClient,
1067
+ apiClient,
1068
+ chainId
1069
+ }) {
1070
+ const {
1071
+ premintConfig,
1072
+ premintConfigVersion: actualVersion,
1073
+ collectionAddress
1074
+ } = await prepareCreatePremintConfig({
1075
+ payoutRecipient: creatorAccount,
1076
+ collection,
1077
+ tokenCreationConfig,
1078
+ premintConfigVersion,
1079
+ uid,
1080
+ publicClient,
1081
+ apiClient,
1082
+ chainId
1083
+ });
1084
+ return makePremintReturn({
1085
+ premintConfig,
1086
+ premintConfigVersion: actualVersion,
1087
+ collectionAddress,
1088
+ collection,
1089
+ publicClient,
1090
+ apiClient,
1091
+ chainId
1092
+ });
1093
+ }
1094
+ async function prepareCreatePremintConfig({
1095
+ payoutRecipient,
1096
+ collection,
1097
+ tokenCreationConfig,
1098
+ premintConfigVersion,
1099
+ uid,
1100
+ publicClient,
1101
+ apiClient,
1102
+ chainId
1103
+ }) {
1104
+ const collectionWithAdditionalAdmins = {
1105
+ ...collection,
1106
+ additionalAdmins: collection.additionalAdmins || []
1107
+ };
1108
+ const newContractAddress = await getPremintCollectionAddress({
1109
+ publicClient,
1110
+ collection: collectionWithAdditionalAdmins
1111
+ });
1112
+ let uidToUse = uid;
1113
+ if (typeof uidToUse !== "number") {
1114
+ uidToUse = await apiClient.getNextUID(newContractAddress);
1115
+ }
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
+ }
1126
+ 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
+ }),
1134
+ uid: uidToUse
1135
+ });
1136
+ return {
1137
+ premintConfig,
1138
+ premintConfigVersion: actualVersion,
1139
+ collectionAddress: newContractAddress
1140
+ };
1141
+ }
1142
+ async function updatePremint({
1143
+ uid,
1144
+ collection,
1145
+ tokenConfigUpdates,
1146
+ apiClient,
1147
+ publicClient,
1148
+ chainId
1149
+ }) {
1150
+ const {
1151
+ premintConfig,
1152
+ collection: collectionCreationConfig,
1153
+ premintConfigVersion
1154
+ } = await apiClient.getSignature({
1155
+ collectionAddress: collection,
1156
+ uid
1157
+ });
1158
+ const updatedPremint = applyUpdateToPremint({
1159
+ uid: premintConfig.uid,
1160
+ version: premintConfig.version,
1161
+ tokenConfig: premintConfig.tokenConfig,
1162
+ tokenConfigUpdates
1163
+ });
1164
+ return makePremintReturn({
1165
+ premintConfig: updatedPremint,
1166
+ premintConfigVersion,
1167
+ collectionAddress: collection,
1168
+ collection: collectionCreationConfig,
1169
+ publicClient,
1170
+ apiClient,
1171
+ chainId
1172
+ });
1173
+ }
1174
+ async function deletePremint({
1175
+ uid,
1176
+ collection,
1177
+ publicClient,
1178
+ apiClient,
1179
+ chainId
1180
+ }) {
1181
+ const {
1182
+ premintConfig,
1183
+ premintConfigVersion,
1184
+ collection: collectionCreationConfig
1185
+ } = await apiClient.getSignature({
1186
+ collectionAddress: collection,
1187
+ uid
1188
+ });
1189
+ const deletedPremint = {
1190
+ ...premintConfig,
1191
+ version: premintConfig.version + 1,
1192
+ deleted: true
1193
+ };
1194
+ return makePremintReturn({
1195
+ premintConfig: deletedPremint,
1196
+ premintConfigVersion,
1197
+ collectionAddress: collection,
1198
+ collection: collectionCreationConfig,
1199
+ publicClient,
1200
+ apiClient,
1201
+ chainId
1202
+ });
1203
+ }
1204
+ async function makeMintParameters({
1205
+ uid,
1206
+ tokenContract,
1207
+ minterAccount,
1208
+ mintArguments,
1209
+ apiClient,
1135
1210
  publicClient
1136
1211
  }) {
1137
- return new PremintClient(chain, publicClient, httpClient2);
1212
+ if (mintArguments && mintArguments?.quantityToMint < 1) {
1213
+ throw new Error("Quantity to mint cannot be below 1");
1214
+ }
1215
+ if (!minterAccount) {
1216
+ throw new Error("Wallet not passed in");
1217
+ }
1218
+ const { premintConfig, premintConfigVersion, collection, signature } = await apiClient.getSignature({
1219
+ collectionAddress: tokenContract,
1220
+ uid
1221
+ });
1222
+ const numberToMint = BigInt(mintArguments?.quantityToMint || 1);
1223
+ if (premintConfigVersion === PremintConfigVersion2.V3) {
1224
+ throw new Error("PremintV3 not supported in premint SDK");
1225
+ }
1226
+ const value = (await getPremintMintCosts({
1227
+ tokenContract,
1228
+ quantityToMint: numberToMint,
1229
+ publicClient,
1230
+ tokenPrice: premintConfig.tokenConfig.pricePerToken
1231
+ })).totalCost;
1232
+ const mintArgumentsContract = {
1233
+ mintComment: mintArguments?.mintComment || "",
1234
+ mintRecipient: mintArguments?.mintRecipient || (typeof minterAccount === "string" ? minterAccount : minterAccount.address),
1235
+ mintRewardsRecipients: makeMintRewardsRecipient({
1236
+ mintReferral: mintArguments?.mintReferral
1237
+ })
1238
+ };
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,
1263
+ premintConfig,
1264
+ signature,
1265
+ numberToMint,
1266
+ mintArgumentsContract
1267
+ ]
1268
+ });
1269
+ }
1270
+ throw new Error(`Invalid premint config version ${premintConfigVersion}`);
1138
1271
  }
1139
1272
  function makeUrls({
1140
1273
  uid,
@@ -1153,52 +1286,6 @@ function makeUrls({
1153
1286
  zoraManage: `https://${network.isTestnet ? "testnet." : ""}zora.co/collect/${network.zoraCollectPathChainName}:${address}/${zoraTokenPath}`
1154
1287
  };
1155
1288
  }
1156
- async function signAndSubmitPremint({
1157
- walletClient,
1158
- verifyingContract,
1159
- account,
1160
- checkSignature,
1161
- collection,
1162
- chainId,
1163
- publicClient,
1164
- apiClient,
1165
- ...premintConfigAndVersion
1166
- }) {
1167
- if (!account) {
1168
- account = walletClient.account;
1169
- }
1170
- if (!account) {
1171
- throw new Error("No account provided");
1172
- }
1173
- const signature = await walletClient.signTypedData({
1174
- account,
1175
- ...premintTypedDataDefinition2({
1176
- verifyingContract,
1177
- ...premintConfigAndVersion,
1178
- chainId
1179
- })
1180
- });
1181
- if (checkSignature) {
1182
- const isAuthorized = await isAuthorizedToCreatePremint({
1183
- collection,
1184
- publicClient,
1185
- signer: typeof account === "string" ? account : account.address,
1186
- collectionAddress: await getPremintCollectionAddress({
1187
- collection,
1188
- publicClient
1189
- })
1190
- });
1191
- if (!isAuthorized) {
1192
- throw new Error("Not authorized to create premint");
1193
- }
1194
- }
1195
- const premint = await apiClient.postSignature({
1196
- collection,
1197
- signature,
1198
- ...premintConfigAndVersion
1199
- });
1200
- return { premint, verifyingContract };
1201
- }
1202
1289
 
1203
1290
  // src/premint/contract-types.ts
1204
1291
  import { PremintConfigVersion as PremintConfigVersionOrig } from "@zoralabs/protocol-deployments";
@@ -1211,11 +1298,9 @@ var PremintConfigVersion3 = ((PremintConfigVersion4) => {
1211
1298
 
1212
1299
  // src/mint/mint-client.ts
1213
1300
  import {
1214
- createPublicClient as createPublicClient2,
1215
1301
  encodeAbiParameters,
1216
1302
  parseAbiParameters,
1217
- zeroAddress as zeroAddress3,
1218
- http as http2
1303
+ zeroAddress as zeroAddress3
1219
1304
  } from "viem";
1220
1305
  import {
1221
1306
  erc20MinterABI,
@@ -1234,30 +1319,24 @@ var Errors = {
1234
1319
  var MintClient = class {
1235
1320
  constructor(chain, publicClient, httpClient2) {
1236
1321
  this.apiClient = new MintAPIClient(chain.id, httpClient2);
1237
- this.publicClient = publicClient || createPublicClient2({ chain, transport: http2() });
1322
+ this.publicClient = publicClient;
1238
1323
  }
1239
1324
  /**
1240
1325
  * Returns the parameters needed to prepare a transaction mint a token.
1241
- * @param param0.minterAccount The account that will mint the token.
1242
- * @param param0.mintable The mintable token to mint.
1243
- * @param param0.mintArguments The arguments for the mint (mint recipient, comment, mint referral, quantity to mint)
1244
- * @returns
1326
+ *
1327
+ * @param parameters - Parameters for collecting the token {@link MintTokenParams}
1328
+ * @returns Parameters for simulating/executing the mint transaction
1245
1329
  */
1246
- async makePrepareMintTokenParams({
1247
- ...rest
1248
- }) {
1330
+ async makePrepareMintTokenParams(parameters) {
1249
1331
  return makePrepareMintTokenParams({
1250
- ...rest,
1332
+ ...parameters,
1251
1333
  apiClient: this.apiClient,
1252
1334
  publicClient: this.publicClient
1253
1335
  });
1254
1336
  }
1255
1337
  };
1256
- function createMintClient({
1257
- chain,
1258
- publicClient,
1259
- httpClient: httpClient2
1260
- }) {
1338
+ function createMintClient(clientConfig) {
1339
+ const { chain, publicClient, httpClient: httpClient2 } = setupClient(clientConfig);
1261
1340
  return new MintClient(chain, publicClient, httpClient2);
1262
1341
  }
1263
1342
  async function makePrepareMintTokenParams({
@@ -1539,9 +1618,8 @@ async function getContractExists(publicClient, contract, account) {
1539
1618
  contractAddress: contract
1540
1619
  };
1541
1620
  }
1542
- function create1155CreatorClient({
1543
- publicClient
1544
- }) {
1621
+ function create1155CreatorClient(clientConfig) {
1622
+ const { publicClient } = setupClient(clientConfig);
1545
1623
  async function createNew1155Token({
1546
1624
  contract,
1547
1625
  tokenMetadataURI,
@@ -2010,6 +2088,7 @@ export {
2010
2088
  makePermitToCollectPremintOrNonPremint,
2011
2089
  makePermitTransferBatchAndTypeData,
2012
2090
  makePermitTransferTypeData,
2091
+ makeUrls,
2013
2092
  migratePremintConfigToV2,
2014
2093
  mintWithEthParams,
2015
2094
  mintsBalanceOfAccountParams,