@zoralabs/protocol-sdk 0.5.12 → 0.5.13
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs +70 -235
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -184
- package/dist/index.js.map +1 -1
- package/dist/mints/mints-contracts.d.ts +3 -128
- package/dist/mints/mints-contracts.d.ts.map +1 -1
- package/dist/mints/mints-eth-unwrapper-and-caller.d.ts +1 -24
- package/dist/mints/mints-eth-unwrapper-and-caller.d.ts.map +1 -1
- package/dist/premint/contract-types.d.ts +0 -93
- package/dist/premint/contract-types.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/preminter.d.ts +1 -1
- package/package.json +1 -1
- package/src/mints/mints-contracts.ts +14 -126
- package/src/premint/contract-types.ts +0 -52
- package/src/premint/preminter.ts +12 -20
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,9 +7,9 @@ $ tsup
|
|
|
7
7
|
[34mCLI[39m Cleaning output folder
|
|
8
8
|
[34mCJS[39m Build start
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m1.06 MB[39m
|
|
11
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.43 MB[39m
|
|
12
|
-
[32mCJS[39m ⚡️ Build success in 866ms
|
|
13
10
|
[32mESM[39m [1mdist/index.js [22m[32m1.05 MB[39m
|
|
14
11
|
[32mESM[39m [1mdist/index.js.map [22m[32m1.43 MB[39m
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 793ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m1.05 MB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.43 MB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 814ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @zoralabs/protocol-sdk
|
|
2
2
|
|
|
3
|
+
## 0.5.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 16deff0c: Moved typed data definitions from protocol-sdk to protocol-deployments
|
|
8
|
+
- Updated dependencies [16deff0c]
|
|
9
|
+
- @zoralabs/protocol-deployments@0.1.10
|
|
10
|
+
|
|
3
11
|
## 0.5.12
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -6791,7 +6791,6 @@ __export(src_exports, {
|
|
|
6791
6791
|
MintAPIClient: () => MintAPIClient,
|
|
6792
6792
|
PremintAPIClient: () => PremintAPIClient,
|
|
6793
6793
|
PremintConfigVersion: () => PremintConfigVersion,
|
|
6794
|
-
PreminterDomain: () => PreminterDomain,
|
|
6795
6794
|
ZORA_API_BASE: () => ZORA_API_BASE,
|
|
6796
6795
|
applyUpdateToPremint: () => applyUpdateToPremint,
|
|
6797
6796
|
collectPremintV2WithMintsParams: () => collectPremintV2WithMintsParams,
|
|
@@ -6832,8 +6831,6 @@ __export(src_exports, {
|
|
|
6832
6831
|
migratePremintConfigToV2: () => migratePremintConfigToV2,
|
|
6833
6832
|
mintWithEthParams: () => mintWithEthParams,
|
|
6834
6833
|
mintsBalanceOfAccountParams: () => mintsBalanceOfAccountParams,
|
|
6835
|
-
permitBatchTypedDataDefinition: () => permitBatchTypedDataDefinition,
|
|
6836
|
-
permitTransferTypedDataDefinition: () => permitTransferTypedDataDefinition,
|
|
6837
6834
|
premintTypedDataDefinition: () => premintTypedDataDefinition,
|
|
6838
6835
|
recoverCreatorFromCreatorAttribution: () => recoverCreatorFromCreatorAttribution,
|
|
6839
6836
|
recoverPremintSigner: () => recoverPremintSigner,
|
|
@@ -6842,70 +6839,19 @@ __export(src_exports, {
|
|
|
6842
6839
|
supportedPremintVersions: () => supportedPremintVersions,
|
|
6843
6840
|
supportsPremintVersion: () => supportsPremintVersion,
|
|
6844
6841
|
tryRecoverPremintSigner: () => tryRecoverPremintSigner,
|
|
6845
|
-
unwrapAndForwardEthPermitAndTypedDataDefinition: () => unwrapAndForwardEthPermitAndTypedDataDefinition
|
|
6846
|
-
v1Types: () => v1Types,
|
|
6847
|
-
v2Types: () => v2Types
|
|
6842
|
+
unwrapAndForwardEthPermitAndTypedDataDefinition: () => unwrapAndForwardEthPermitAndTypedDataDefinition
|
|
6848
6843
|
});
|
|
6849
6844
|
module.exports = __toCommonJS(src_exports);
|
|
6850
6845
|
|
|
6851
6846
|
// src/premint/premint-client.ts
|
|
6852
6847
|
var import_viem4 = require("viem");
|
|
6853
|
-
var
|
|
6848
|
+
var import_protocol_deployments3 = require("@zoralabs/protocol-deployments");
|
|
6854
6849
|
|
|
6855
6850
|
// src/premint/preminter.ts
|
|
6856
6851
|
var import_protocol_deployments = require("@zoralabs/protocol-deployments");
|
|
6857
6852
|
var import_viem = require("viem");
|
|
6858
6853
|
|
|
6859
6854
|
// src/premint/contract-types.ts
|
|
6860
|
-
var v1Types = {
|
|
6861
|
-
CreatorAttribution: [
|
|
6862
|
-
{ name: "tokenConfig", type: "TokenCreationConfig" },
|
|
6863
|
-
// unique id scoped to the contract and token to create.
|
|
6864
|
-
// ensure that a signature can be replaced, as long as the replacement
|
|
6865
|
-
// has the same uid, and a newer version.
|
|
6866
|
-
{ name: "uid", type: "uint32" },
|
|
6867
|
-
{ name: "version", type: "uint32" },
|
|
6868
|
-
// if this update should result in the signature being deleted.
|
|
6869
|
-
{ name: "deleted", type: "bool" }
|
|
6870
|
-
],
|
|
6871
|
-
TokenCreationConfig: [
|
|
6872
|
-
{ name: "tokenURI", type: "string" },
|
|
6873
|
-
{ name: "maxSupply", type: "uint256" },
|
|
6874
|
-
{ name: "maxTokensPerAddress", type: "uint64" },
|
|
6875
|
-
{ name: "pricePerToken", type: "uint96" },
|
|
6876
|
-
{ name: "mintStart", type: "uint64" },
|
|
6877
|
-
{ name: "mintDuration", type: "uint64" },
|
|
6878
|
-
{ name: "royaltyMintSchedule", type: "uint32" },
|
|
6879
|
-
{ name: "royaltyBPS", type: "uint32" },
|
|
6880
|
-
{ name: "royaltyRecipient", type: "address" },
|
|
6881
|
-
{ name: "fixedPriceMinter", type: "address" }
|
|
6882
|
-
]
|
|
6883
|
-
};
|
|
6884
|
-
var v2Types = {
|
|
6885
|
-
CreatorAttribution: [
|
|
6886
|
-
{ name: "tokenConfig", type: "TokenCreationConfig" },
|
|
6887
|
-
// unique id scoped to the contract and token to create.
|
|
6888
|
-
// ensure that a signature can be replaced, as long as the replacement
|
|
6889
|
-
// has the same uid, and a newer version.
|
|
6890
|
-
{ name: "uid", type: "uint32" },
|
|
6891
|
-
{ name: "version", type: "uint32" },
|
|
6892
|
-
// if this update should result in the signature being deleted.
|
|
6893
|
-
{ name: "deleted", type: "bool" }
|
|
6894
|
-
],
|
|
6895
|
-
TokenCreationConfig: [
|
|
6896
|
-
{ name: "tokenURI", type: "string" },
|
|
6897
|
-
{ name: "maxSupply", type: "uint256" },
|
|
6898
|
-
{ name: "maxTokensPerAddress", type: "uint64" },
|
|
6899
|
-
{ name: "pricePerToken", type: "uint96" },
|
|
6900
|
-
{ name: "mintStart", type: "uint64" },
|
|
6901
|
-
{ name: "mintDuration", type: "uint64" },
|
|
6902
|
-
{ name: "royaltyBPS", type: "uint32" },
|
|
6903
|
-
{ name: "payoutRecipient", type: "address" },
|
|
6904
|
-
{ name: "fixedPriceMinter", type: "address" },
|
|
6905
|
-
{ name: "createReferral", type: "address" }
|
|
6906
|
-
]
|
|
6907
|
-
};
|
|
6908
|
-
var PreminterDomain = "Preminter";
|
|
6909
6855
|
var PremintConfigVersion = /* @__PURE__ */ ((PremintConfigVersion2) => {
|
|
6910
6856
|
PremintConfigVersion2["V1"] = "1";
|
|
6911
6857
|
PremintConfigVersion2["V2"] = "2";
|
|
@@ -6913,6 +6859,7 @@ var PremintConfigVersion = /* @__PURE__ */ ((PremintConfigVersion2) => {
|
|
|
6913
6859
|
})(PremintConfigVersion || {});
|
|
6914
6860
|
|
|
6915
6861
|
// src/premint/preminter.ts
|
|
6862
|
+
var import_protocol_deployments2 = require("@zoralabs/protocol-deployments");
|
|
6916
6863
|
var getPremintExecutorAddress = () => import_protocol_deployments.zoraCreator1155PremintExecutorImplAddress[999];
|
|
6917
6864
|
var premintTypedDataDefinition = ({
|
|
6918
6865
|
verifyingContract,
|
|
@@ -6920,26 +6867,18 @@ var premintTypedDataDefinition = ({
|
|
|
6920
6867
|
premintConfigVersion: version,
|
|
6921
6868
|
premintConfig
|
|
6922
6869
|
}) => {
|
|
6923
|
-
const domain = {
|
|
6924
|
-
chainId,
|
|
6925
|
-
name: PreminterDomain,
|
|
6926
|
-
version,
|
|
6927
|
-
verifyingContract
|
|
6928
|
-
};
|
|
6929
6870
|
if (version === "1" /* V1 */)
|
|
6930
|
-
return {
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
message: premintConfig
|
|
6934
|
-
|
|
6935
|
-
};
|
|
6871
|
+
return (0, import_protocol_deployments2.premintV1TypedDataDefinition)({
|
|
6872
|
+
chainId,
|
|
6873
|
+
creator1155Contract: verifyingContract,
|
|
6874
|
+
message: premintConfig
|
|
6875
|
+
});
|
|
6936
6876
|
if (version === "2" /* V2 */) {
|
|
6937
|
-
return {
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
message: premintConfig
|
|
6941
|
-
|
|
6942
|
-
};
|
|
6877
|
+
return (0, import_protocol_deployments2.premintV2TypedDataDefinition)({
|
|
6878
|
+
chainId,
|
|
6879
|
+
creator1155Contract: verifyingContract,
|
|
6880
|
+
message: premintConfig
|
|
6881
|
+
});
|
|
6943
6882
|
}
|
|
6944
6883
|
throw new Error(`Invalid version ${version}`);
|
|
6945
6884
|
};
|
|
@@ -7623,7 +7562,7 @@ function getPremintedLogFromReceipt(receipt) {
|
|
|
7623
7562
|
for (const data of receipt.logs) {
|
|
7624
7563
|
try {
|
|
7625
7564
|
const decodedLog = (0, import_viem4.decodeEventLog)({
|
|
7626
|
-
abi:
|
|
7565
|
+
abi: import_protocol_deployments3.zoraCreator1155PremintExecutorImplABI,
|
|
7627
7566
|
eventName: "PremintedV2",
|
|
7628
7567
|
...data
|
|
7629
7568
|
});
|
|
@@ -7935,7 +7874,7 @@ var PremintClient = class {
|
|
|
7935
7874
|
if (premintConfigVersion === "1" /* V1 */) {
|
|
7936
7875
|
return makeSimulateContractParamaters({
|
|
7937
7876
|
account: minterAccount,
|
|
7938
|
-
abi:
|
|
7877
|
+
abi: import_protocol_deployments3.zoraCreator1155PremintExecutorImplABI,
|
|
7939
7878
|
functionName: "premintV1",
|
|
7940
7879
|
value,
|
|
7941
7880
|
address: getPremintExecutorAddress(),
|
|
@@ -7950,7 +7889,7 @@ var PremintClient = class {
|
|
|
7950
7889
|
} else if (premintConfigVersion === "2" /* V2 */) {
|
|
7951
7890
|
return makeSimulateContractParamaters({
|
|
7952
7891
|
account: minterAccount,
|
|
7953
|
-
abi:
|
|
7892
|
+
abi: import_protocol_deployments3.zoraCreator1155PremintExecutorImplABI,
|
|
7954
7893
|
functionName: "premintV2",
|
|
7955
7894
|
value,
|
|
7956
7895
|
address: getPremintExecutorAddress(),
|
|
@@ -8039,7 +7978,7 @@ async function signAndSubmitPremint({
|
|
|
8039
7978
|
|
|
8040
7979
|
// src/mint/mint-client.ts
|
|
8041
7980
|
var import_viem5 = require("viem");
|
|
8042
|
-
var
|
|
7981
|
+
var import_protocol_deployments4 = require("@zoralabs/protocol-deployments");
|
|
8043
7982
|
var MintError = class extends Error {
|
|
8044
7983
|
};
|
|
8045
7984
|
var MintInactiveError = class extends Error {
|
|
@@ -8151,14 +8090,14 @@ async function makePrepareMint1155TokenParams({
|
|
|
8151
8090
|
quantityToMint: mintQuantity
|
|
8152
8091
|
}).totalCost;
|
|
8153
8092
|
return makeSimulateContractParamaters({
|
|
8154
|
-
abi:
|
|
8093
|
+
abi: import_protocol_deployments4.zoraCreator1155ImplABI,
|
|
8155
8094
|
functionName: "mintWithRewards",
|
|
8156
8095
|
account: minterAccount,
|
|
8157
8096
|
value: mintValue,
|
|
8158
8097
|
address: tokenAddress,
|
|
8159
8098
|
/* args: minter, tokenId, quantity, minterArguments, mintReferral */
|
|
8160
8099
|
args: [
|
|
8161
|
-
salesConfigAndTokenInfo?.fixedPrice.address ||
|
|
8100
|
+
salesConfigAndTokenInfo?.fixedPrice.address || import_protocol_deployments4.zoraCreatorFixedPriceSaleStrategyAddress[999],
|
|
8162
8101
|
BigInt(tokenId),
|
|
8163
8102
|
mintQuantity,
|
|
8164
8103
|
(0, import_viem5.encodeAbiParameters)((0, import_viem5.parseAbiParameters)("address, string"), [
|
|
@@ -8171,7 +8110,7 @@ async function makePrepareMint1155TokenParams({
|
|
|
8171
8110
|
}
|
|
8172
8111
|
|
|
8173
8112
|
// src/create/1155-create-helper.ts
|
|
8174
|
-
var
|
|
8113
|
+
var import_protocol_deployments5 = require("@zoralabs/protocol-deployments");
|
|
8175
8114
|
var import_viem6 = require("viem");
|
|
8176
8115
|
var SALE_END_FOREVER = 18446744073709551615n;
|
|
8177
8116
|
var ROYALTY_BPS_DEFAULT = 1e3;
|
|
@@ -8216,32 +8155,32 @@ function create1155TokenSetupArgs({
|
|
|
8216
8155
|
};
|
|
8217
8156
|
const setupActions = [
|
|
8218
8157
|
(0, import_viem6.encodeFunctionData)({
|
|
8219
|
-
abi:
|
|
8158
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8220
8159
|
functionName: "assumeLastTokenIdMatches",
|
|
8221
8160
|
args: [nextTokenId - 1n]
|
|
8222
8161
|
}),
|
|
8223
8162
|
createReferral ? (0, import_viem6.encodeFunctionData)({
|
|
8224
|
-
abi:
|
|
8163
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8225
8164
|
functionName: "setupNewTokenWithCreateReferral",
|
|
8226
8165
|
args: [tokenMetadataURI, maxSupply, createReferral]
|
|
8227
8166
|
}) : (0, import_viem6.encodeFunctionData)({
|
|
8228
|
-
abi:
|
|
8167
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8229
8168
|
functionName: "setupNewToken",
|
|
8230
8169
|
args: [tokenMetadataURI, maxSupply]
|
|
8231
8170
|
}),
|
|
8232
8171
|
(0, import_viem6.encodeFunctionData)({
|
|
8233
|
-
abi:
|
|
8172
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8234
8173
|
functionName: "addPermission",
|
|
8235
8174
|
args: [0n, fixedPriceMinterAddress, PERMISSION_BIT_MINTER]
|
|
8236
8175
|
}),
|
|
8237
8176
|
(0, import_viem6.encodeFunctionData)({
|
|
8238
|
-
abi:
|
|
8177
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8239
8178
|
functionName: "callSale",
|
|
8240
8179
|
args: [
|
|
8241
8180
|
nextTokenId,
|
|
8242
8181
|
fixedPriceMinterAddress,
|
|
8243
8182
|
(0, import_viem6.encodeFunctionData)({
|
|
8244
|
-
abi:
|
|
8183
|
+
abi: import_protocol_deployments5.zoraCreatorFixedPriceSaleStrategyABI,
|
|
8245
8184
|
functionName: "setSale",
|
|
8246
8185
|
args: [nextTokenId, salesConfigWithDefaults]
|
|
8247
8186
|
})
|
|
@@ -8251,7 +8190,7 @@ function create1155TokenSetupArgs({
|
|
|
8251
8190
|
if (mintToCreatorCount) {
|
|
8252
8191
|
setupActions.push(
|
|
8253
8192
|
(0, import_viem6.encodeFunctionData)({
|
|
8254
|
-
abi:
|
|
8193
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8255
8194
|
functionName: "adminMint",
|
|
8256
8195
|
args: [account, nextTokenId, mintToCreatorCount, "0x"]
|
|
8257
8196
|
})
|
|
@@ -8260,7 +8199,7 @@ function create1155TokenSetupArgs({
|
|
|
8260
8199
|
if (royaltySettings) {
|
|
8261
8200
|
setupActions.push(
|
|
8262
8201
|
(0, import_viem6.encodeFunctionData)({
|
|
8263
|
-
abi:
|
|
8202
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8264
8203
|
functionName: "updateRoyaltiesForToken",
|
|
8265
8204
|
args: [
|
|
8266
8205
|
nextTokenId,
|
|
@@ -8279,7 +8218,7 @@ var getTokenIdFromCreateReceipt = (receipt) => {
|
|
|
8279
8218
|
for (const data of receipt.logs) {
|
|
8280
8219
|
try {
|
|
8281
8220
|
const decodedLog = (0, import_viem6.decodeEventLog)({
|
|
8282
|
-
abi:
|
|
8221
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8283
8222
|
eventName: "SetupNewToken",
|
|
8284
8223
|
...data
|
|
8285
8224
|
});
|
|
@@ -8295,9 +8234,9 @@ async function getContractExists(publicClient, contract, account) {
|
|
|
8295
8234
|
let contractExists = false;
|
|
8296
8235
|
if (typeof contract !== "string") {
|
|
8297
8236
|
contractAddress = await publicClient.readContract({
|
|
8298
|
-
abi:
|
|
8237
|
+
abi: import_protocol_deployments5.zoraCreator1155FactoryImplABI,
|
|
8299
8238
|
// Since this address is deterministic we can hardcode a chain id safely here.
|
|
8300
|
-
address:
|
|
8239
|
+
address: import_protocol_deployments5.zoraCreator1155FactoryImplAddress[999],
|
|
8301
8240
|
functionName: "deterministicContractAddress",
|
|
8302
8241
|
args: [
|
|
8303
8242
|
account,
|
|
@@ -8308,7 +8247,7 @@ async function getContractExists(publicClient, contract, account) {
|
|
|
8308
8247
|
});
|
|
8309
8248
|
try {
|
|
8310
8249
|
await publicClient.readContract({
|
|
8311
|
-
abi:
|
|
8250
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8312
8251
|
address: contractAddress,
|
|
8313
8252
|
functionName: "contractVersion"
|
|
8314
8253
|
});
|
|
@@ -8344,14 +8283,14 @@ function create1155CreatorClient({
|
|
|
8344
8283
|
let nextTokenId = 1n;
|
|
8345
8284
|
if (contractExists) {
|
|
8346
8285
|
nextTokenId = await publicClient.readContract({
|
|
8347
|
-
abi:
|
|
8286
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8348
8287
|
functionName: "nextTokenId",
|
|
8349
8288
|
address: contractAddress
|
|
8350
8289
|
});
|
|
8351
8290
|
}
|
|
8352
8291
|
const fixedPriceMinterAddress = await publicClient.readContract({
|
|
8353
|
-
abi:
|
|
8354
|
-
address:
|
|
8292
|
+
abi: import_protocol_deployments5.zoraCreator1155FactoryImplABI,
|
|
8293
|
+
address: import_protocol_deployments5.zoraCreator1155FactoryImplAddress[999],
|
|
8355
8294
|
functionName: "fixedPriceMinter"
|
|
8356
8295
|
});
|
|
8357
8296
|
let tokenSetupActions = create1155TokenSetupArgs({
|
|
@@ -8376,10 +8315,10 @@ function create1155CreatorClient({
|
|
|
8376
8315
|
}
|
|
8377
8316
|
if (!contractExists && typeof contract !== "string") {
|
|
8378
8317
|
const request = makeSimulateContractParamaters({
|
|
8379
|
-
abi:
|
|
8318
|
+
abi: import_protocol_deployments5.zoraCreator1155FactoryImplABI,
|
|
8380
8319
|
functionName: "createContractDeterministic",
|
|
8381
8320
|
account,
|
|
8382
|
-
address:
|
|
8321
|
+
address: import_protocol_deployments5.zoraCreator1155FactoryImplAddress[999],
|
|
8383
8322
|
args: [
|
|
8384
8323
|
contract.uri,
|
|
8385
8324
|
contract.name,
|
|
@@ -8401,7 +8340,7 @@ function create1155CreatorClient({
|
|
|
8401
8340
|
};
|
|
8402
8341
|
} else if (contractExists) {
|
|
8403
8342
|
const request = makeSimulateContractParamaters({
|
|
8404
|
-
abi:
|
|
8343
|
+
abi: import_protocol_deployments5.zoraCreator1155ImplABI,
|
|
8405
8344
|
functionName: "multicall",
|
|
8406
8345
|
account,
|
|
8407
8346
|
address: contractAddress,
|
|
@@ -11740,7 +11679,7 @@ var sumBalances = (mintAccountBalances) => {
|
|
|
11740
11679
|
};
|
|
11741
11680
|
|
|
11742
11681
|
// src/mints/mints-contracts.ts
|
|
11743
|
-
var
|
|
11682
|
+
var import_protocol_deployments6 = require("@zoralabs/protocol-deployments");
|
|
11744
11683
|
var import_viem7 = require("viem");
|
|
11745
11684
|
var addressOrAccountAddress = (address) => typeof address === "string" ? address : address.address;
|
|
11746
11685
|
var mintWithEthParams = ({
|
|
@@ -11750,8 +11689,8 @@ var mintWithEthParams = ({
|
|
|
11750
11689
|
pricePerMint,
|
|
11751
11690
|
account
|
|
11752
11691
|
}) => makeSimulateContractParamaters({
|
|
11753
|
-
abi:
|
|
11754
|
-
address:
|
|
11692
|
+
abi: import_protocol_deployments6.zoraMintsManagerImplConfig.abi,
|
|
11693
|
+
address: import_protocol_deployments6.zoraMintsManagerImplConfig.address[chainId],
|
|
11755
11694
|
functionName: "mintWithEth",
|
|
11756
11695
|
args: [quantity, recipient || addressOrAccountAddress(account)],
|
|
11757
11696
|
value: pricePerMint * quantity,
|
|
@@ -11766,8 +11705,8 @@ var mintsBalanceOfAccountParams = ({
|
|
|
11766
11705
|
account,
|
|
11767
11706
|
chainId
|
|
11768
11707
|
}) => ({
|
|
11769
|
-
abi:
|
|
11770
|
-
address:
|
|
11708
|
+
abi: import_protocol_deployments6.zoraMints1155Config.abi,
|
|
11709
|
+
address: import_protocol_deployments6.zoraMints1155Config.address[chainId],
|
|
11771
11710
|
functionName: "balanceOfAccount",
|
|
11772
11711
|
args: [account]
|
|
11773
11712
|
});
|
|
@@ -11777,7 +11716,7 @@ var encodeCollectOnManager = ({
|
|
|
11777
11716
|
zoraCreator1155TokenId,
|
|
11778
11717
|
mintArguments
|
|
11779
11718
|
}) => (0, import_viem7.encodeFunctionData)({
|
|
11780
|
-
abi:
|
|
11719
|
+
abi: import_protocol_deployments6.zoraMintsManagerImplConfig.abi,
|
|
11781
11720
|
functionName: "collect",
|
|
11782
11721
|
args: [
|
|
11783
11722
|
zoraCreator1155Contract,
|
|
@@ -11806,8 +11745,8 @@ function collectWithMintsParams({
|
|
|
11806
11745
|
mintArguments
|
|
11807
11746
|
});
|
|
11808
11747
|
return makeSimulateContractParamaters({
|
|
11809
|
-
abi:
|
|
11810
|
-
address:
|
|
11748
|
+
abi: import_protocol_deployments6.zoraMints1155Config.abi,
|
|
11749
|
+
address: import_protocol_deployments6.zoraMints1155Config.address[chainId],
|
|
11811
11750
|
functionName: "transferBatchToManagerAndCall",
|
|
11812
11751
|
args: [tokenIds, quantities, call],
|
|
11813
11752
|
// if it is a paid mint, the aadditional value will be sent to the manager contract and forwarded to the creator 1155 contract
|
|
@@ -11820,12 +11759,12 @@ function getMintsEthPrice({
|
|
|
11820
11759
|
publicClient
|
|
11821
11760
|
}) {
|
|
11822
11761
|
const chainId = publicClient.chain?.id;
|
|
11823
|
-
if (!chainId || !
|
|
11762
|
+
if (!chainId || !import_protocol_deployments6.zoraMintsManagerImplAddress[chainId]) {
|
|
11824
11763
|
throw new Error(`Chain id ${chainId} not supported`);
|
|
11825
11764
|
}
|
|
11826
11765
|
return publicClient.readContract({
|
|
11827
|
-
abi:
|
|
11828
|
-
address:
|
|
11766
|
+
abi: import_protocol_deployments6.zoraMintsManagerImplABI,
|
|
11767
|
+
address: import_protocol_deployments6.zoraMintsManagerImplAddress[chainId],
|
|
11829
11768
|
functionName: "getEthPrice"
|
|
11830
11769
|
});
|
|
11831
11770
|
}
|
|
@@ -11848,11 +11787,13 @@ function makePermitTransferBatchAndTypeData({
|
|
|
11848
11787
|
nonce,
|
|
11849
11788
|
safeTransferData
|
|
11850
11789
|
};
|
|
11851
|
-
const typedData =
|
|
11852
|
-
|
|
11853
|
-
|
|
11790
|
+
const typedData = {
|
|
11791
|
+
...(0, import_protocol_deployments6.mintsSafeTransferBatchTypedDataDefinition)({
|
|
11792
|
+
chainId,
|
|
11793
|
+
message: permit
|
|
11794
|
+
}),
|
|
11854
11795
|
account: mintsOwner
|
|
11855
|
-
}
|
|
11796
|
+
};
|
|
11856
11797
|
return {
|
|
11857
11798
|
permit,
|
|
11858
11799
|
typedData
|
|
@@ -11877,11 +11818,13 @@ function makePermitTransferTypeData({
|
|
|
11877
11818
|
nonce,
|
|
11878
11819
|
safeTransferData
|
|
11879
11820
|
};
|
|
11880
|
-
const typedData =
|
|
11881
|
-
|
|
11882
|
-
|
|
11821
|
+
const typedData = {
|
|
11822
|
+
...(0, import_protocol_deployments6.mintsSafeTransferTypedDataDefinition)({
|
|
11823
|
+
chainId,
|
|
11824
|
+
message: permit
|
|
11825
|
+
}),
|
|
11883
11826
|
account: mintsOwner
|
|
11884
|
-
}
|
|
11827
|
+
};
|
|
11885
11828
|
return {
|
|
11886
11829
|
permit,
|
|
11887
11830
|
typedData
|
|
@@ -11894,7 +11837,7 @@ var encodePremintOnManager = ({
|
|
|
11894
11837
|
mintArguments,
|
|
11895
11838
|
signerContract = import_viem7.zeroAddress
|
|
11896
11839
|
}) => (0, import_viem7.encodeFunctionData)({
|
|
11897
|
-
abi:
|
|
11840
|
+
abi: import_protocol_deployments6.zoraMintsManagerImplConfig.abi,
|
|
11898
11841
|
functionName: "collectPremintV2",
|
|
11899
11842
|
args: [
|
|
11900
11843
|
contractCreationConfig,
|
|
@@ -11933,7 +11876,7 @@ var makePermitToCollectPremintOrNonPremint = ({
|
|
|
11933
11876
|
nonce,
|
|
11934
11877
|
deadline,
|
|
11935
11878
|
safeTransferData,
|
|
11936
|
-
to:
|
|
11879
|
+
to: import_protocol_deployments6.zoraMintsManagerImplConfig.address[chainId]
|
|
11937
11880
|
});
|
|
11938
11881
|
};
|
|
11939
11882
|
function collectPremintV2WithMintsParams({
|
|
@@ -11948,136 +11891,33 @@ function collectPremintV2WithMintsParams({
|
|
|
11948
11891
|
...rest
|
|
11949
11892
|
});
|
|
11950
11893
|
return makeSimulateContractParamaters({
|
|
11951
|
-
abi:
|
|
11952
|
-
address:
|
|
11894
|
+
abi: import_protocol_deployments6.zoraMints1155Config.abi,
|
|
11895
|
+
address: import_protocol_deployments6.zoraMints1155Config.address[chainId],
|
|
11953
11896
|
functionName: "transferBatchToManagerAndCall",
|
|
11954
11897
|
args: [tokenIds, quantities, call],
|
|
11955
11898
|
value: getPaidMintValue(quantities, paidMintPricePerToken),
|
|
11956
11899
|
account
|
|
11957
11900
|
});
|
|
11958
11901
|
}
|
|
11959
|
-
function makeTypeData(args) {
|
|
11960
|
-
return args;
|
|
11961
|
-
}
|
|
11962
|
-
function permitBatchTypedDataDefinition({
|
|
11963
|
-
permit,
|
|
11964
|
-
chainId,
|
|
11965
|
-
account
|
|
11966
|
-
}) {
|
|
11967
|
-
return makeTypeData({
|
|
11968
|
-
primaryType: "Permit",
|
|
11969
|
-
types: {
|
|
11970
|
-
Permit: [
|
|
11971
|
-
{
|
|
11972
|
-
name: "owner",
|
|
11973
|
-
type: "address"
|
|
11974
|
-
},
|
|
11975
|
-
{
|
|
11976
|
-
name: "to",
|
|
11977
|
-
type: "address"
|
|
11978
|
-
},
|
|
11979
|
-
{
|
|
11980
|
-
name: "tokenIds",
|
|
11981
|
-
type: "uint256[]"
|
|
11982
|
-
},
|
|
11983
|
-
{
|
|
11984
|
-
name: "quantities",
|
|
11985
|
-
type: "uint256[]"
|
|
11986
|
-
},
|
|
11987
|
-
{
|
|
11988
|
-
name: "safeTransferData",
|
|
11989
|
-
type: "bytes"
|
|
11990
|
-
},
|
|
11991
|
-
{
|
|
11992
|
-
name: "nonce",
|
|
11993
|
-
type: "uint256"
|
|
11994
|
-
},
|
|
11995
|
-
{
|
|
11996
|
-
name: "deadline",
|
|
11997
|
-
type: "uint256"
|
|
11998
|
-
}
|
|
11999
|
-
]
|
|
12000
|
-
},
|
|
12001
|
-
message: permit,
|
|
12002
|
-
domain: {
|
|
12003
|
-
chainId,
|
|
12004
|
-
name: "Mints",
|
|
12005
|
-
version: "1",
|
|
12006
|
-
verifyingContract: import_protocol_deployments5.zoraMints1155Config.address[chainId]
|
|
12007
|
-
},
|
|
12008
|
-
// signing account must be permit owner
|
|
12009
|
-
account
|
|
12010
|
-
});
|
|
12011
|
-
}
|
|
12012
|
-
function permitTransferTypedDataDefinition({
|
|
12013
|
-
permit,
|
|
12014
|
-
chainId,
|
|
12015
|
-
account
|
|
12016
|
-
}) {
|
|
12017
|
-
return makeTypeData({
|
|
12018
|
-
primaryType: "PermitSafeTransfer",
|
|
12019
|
-
types: {
|
|
12020
|
-
PermitSafeTransfer: [
|
|
12021
|
-
{
|
|
12022
|
-
name: "owner",
|
|
12023
|
-
type: "address"
|
|
12024
|
-
},
|
|
12025
|
-
{
|
|
12026
|
-
name: "to",
|
|
12027
|
-
type: "address"
|
|
12028
|
-
},
|
|
12029
|
-
{
|
|
12030
|
-
name: "tokenId",
|
|
12031
|
-
type: "uint256"
|
|
12032
|
-
},
|
|
12033
|
-
{
|
|
12034
|
-
name: "quantity",
|
|
12035
|
-
type: "uint256"
|
|
12036
|
-
},
|
|
12037
|
-
{
|
|
12038
|
-
name: "safeTransferData",
|
|
12039
|
-
type: "bytes"
|
|
12040
|
-
},
|
|
12041
|
-
{
|
|
12042
|
-
name: "nonce",
|
|
12043
|
-
type: "uint256"
|
|
12044
|
-
},
|
|
12045
|
-
{
|
|
12046
|
-
name: "deadline",
|
|
12047
|
-
type: "uint256"
|
|
12048
|
-
}
|
|
12049
|
-
]
|
|
12050
|
-
},
|
|
12051
|
-
message: permit,
|
|
12052
|
-
domain: {
|
|
12053
|
-
chainId,
|
|
12054
|
-
name: "Mints",
|
|
12055
|
-
version: "1",
|
|
12056
|
-
verifyingContract: import_protocol_deployments5.zoraMints1155Config.address[chainId]
|
|
12057
|
-
},
|
|
12058
|
-
// signing account must be permit owner
|
|
12059
|
-
account
|
|
12060
|
-
});
|
|
12061
|
-
}
|
|
12062
11902
|
function decodeCallFailedError(error) {
|
|
12063
11903
|
if (error.data?.errorName !== "CallFailed")
|
|
12064
11904
|
throw new Error("Not a CallFailed error");
|
|
12065
11905
|
const internalErrorData = error.data?.args?.[0];
|
|
12066
11906
|
return (0, import_viem7.decodeErrorResult)({
|
|
12067
|
-
abi:
|
|
11907
|
+
abi: import_protocol_deployments6.zoraMintsManagerImplABI,
|
|
12068
11908
|
data: internalErrorData
|
|
12069
11909
|
});
|
|
12070
11910
|
}
|
|
12071
11911
|
|
|
12072
11912
|
// src/mints/mints-eth-unwrapper-and-caller.ts
|
|
12073
|
-
var
|
|
11913
|
+
var import_protocol_deployments7 = require("@zoralabs/protocol-deployments");
|
|
12074
11914
|
var import_viem8 = require("viem");
|
|
12075
11915
|
var makeCallWithEthSafeTransferData = ({
|
|
12076
11916
|
address: addressToCall,
|
|
12077
11917
|
call: functionToCall,
|
|
12078
11918
|
value: valueToSend
|
|
12079
11919
|
}) => (0, import_viem8.encodeFunctionData)({
|
|
12080
|
-
abi:
|
|
11920
|
+
abi: import_protocol_deployments7.iUnwrapAndForwardActionABI,
|
|
12081
11921
|
functionName: "callWithEth",
|
|
12082
11922
|
args: [addressToCall, functionToCall, valueToSend]
|
|
12083
11923
|
});
|
|
@@ -12097,7 +11937,7 @@ var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
|
|
|
12097
11937
|
tokenIds,
|
|
12098
11938
|
quantities,
|
|
12099
11939
|
safeTransferData: safeTransferData || makeCallWithEthSafeTransferData(callWithEth),
|
|
12100
|
-
to:
|
|
11940
|
+
to: import_protocol_deployments7.mintsEthUnwrapperAndCallerAddress[chainId],
|
|
12101
11941
|
nonce
|
|
12102
11942
|
});
|
|
12103
11943
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -12107,7 +11947,6 @@ var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
|
|
|
12107
11947
|
MintAPIClient,
|
|
12108
11948
|
PremintAPIClient,
|
|
12109
11949
|
PremintConfigVersion,
|
|
12110
|
-
PreminterDomain,
|
|
12111
11950
|
ZORA_API_BASE,
|
|
12112
11951
|
applyUpdateToPremint,
|
|
12113
11952
|
collectPremintV2WithMintsParams,
|
|
@@ -12148,8 +11987,6 @@ var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
|
|
|
12148
11987
|
migratePremintConfigToV2,
|
|
12149
11988
|
mintWithEthParams,
|
|
12150
11989
|
mintsBalanceOfAccountParams,
|
|
12151
|
-
permitBatchTypedDataDefinition,
|
|
12152
|
-
permitTransferTypedDataDefinition,
|
|
12153
11990
|
premintTypedDataDefinition,
|
|
12154
11991
|
recoverCreatorFromCreatorAttribution,
|
|
12155
11992
|
recoverPremintSigner,
|
|
@@ -12158,8 +11995,6 @@ var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
|
|
|
12158
11995
|
supportedPremintVersions,
|
|
12159
11996
|
supportsPremintVersion,
|
|
12160
11997
|
tryRecoverPremintSigner,
|
|
12161
|
-
unwrapAndForwardEthPermitAndTypedDataDefinition
|
|
12162
|
-
v1Types,
|
|
12163
|
-
v2Types
|
|
11998
|
+
unwrapAndForwardEthPermitAndTypedDataDefinition
|
|
12164
11999
|
});
|
|
12165
12000
|
//# sourceMappingURL=index.cjs.map
|