@zoralabs/protocol-sdk 0.12.2 → 0.13.0
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 +7 -7
- package/CHANGELOG.md +6 -0
- package/dist/create/types.d.ts +1 -1
- package/dist/create/types.d.ts.map +1 -1
- package/dist/fixtures/contract-setup.d.ts.map +1 -1
- package/dist/index.cjs +2 -405
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -430
- package/dist/index.js.map +1 -1
- package/dist/premint/premint-api-client.d.ts +0 -2
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +11 -86
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +3 -84
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/sdk.d.ts +0 -2
- package/dist/sdk.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/comments/comments.test.ts +18 -10
- package/src/create/create-client.test.ts +9 -5
- package/src/create/create-client.ts +2 -2
- package/src/create/types.ts +1 -1
- package/src/fixtures/contract-setup.ts +14 -11
- package/src/mint/mint-client.test.ts +5 -1
- package/src/premint/premint-api-client.ts +0 -29
- package/src/premint/premint-client.test.ts +17 -197
- package/src/premint/premint-client.ts +11 -324
- package/src/premint/preminter.test.ts +1 -158
- package/src/premint/preminter.ts +2 -273
- package/src/sdk.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -1928,19 +1928,9 @@ import {
|
|
|
1928
1928
|
import {
|
|
1929
1929
|
zoraCreator1155PremintExecutorImplABI as preminterAbi,
|
|
1930
1930
|
zoraCreator1155PremintExecutorImplABI,
|
|
1931
|
-
zoraCreator1155PremintExecutorImplAddress
|
|
1932
|
-
zoraCreatorFixedPriceSaleStrategyAddress,
|
|
1933
|
-
premintTypedDataDefinition
|
|
1931
|
+
zoraCreator1155PremintExecutorImplAddress
|
|
1934
1932
|
} from "@zoralabs/protocol-deployments";
|
|
1935
|
-
import {
|
|
1936
|
-
recoverTypedDataAddress,
|
|
1937
|
-
zeroAddress,
|
|
1938
|
-
hashDomain,
|
|
1939
|
-
keccak256,
|
|
1940
|
-
concat,
|
|
1941
|
-
recoverAddress,
|
|
1942
|
-
parseEther as parseEther2
|
|
1943
|
-
} from "viem";
|
|
1933
|
+
import { zeroAddress, parseEther as parseEther2 } from "viem";
|
|
1944
1934
|
|
|
1945
1935
|
// src/apis/chain-constants.ts
|
|
1946
1936
|
import {
|
|
@@ -2231,126 +2221,6 @@ async function isAuthorizedToCreatePremint({
|
|
|
2231
2221
|
]
|
|
2232
2222
|
});
|
|
2233
2223
|
}
|
|
2234
|
-
async function recoverPremintSigner({
|
|
2235
|
-
signature,
|
|
2236
|
-
...rest
|
|
2237
|
-
}) {
|
|
2238
|
-
return await recoverTypedDataAddress({
|
|
2239
|
-
...premintTypedDataDefinition(rest),
|
|
2240
|
-
signature
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
async function tryRecoverPremintSigner(params) {
|
|
2244
|
-
try {
|
|
2245
|
-
return await recoverPremintSigner(params);
|
|
2246
|
-
} catch (error) {
|
|
2247
|
-
console.error(error);
|
|
2248
|
-
return void 0;
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
async function isValidSignature({
|
|
2252
|
-
signature,
|
|
2253
|
-
publicClient,
|
|
2254
|
-
collection,
|
|
2255
|
-
collectionAddress,
|
|
2256
|
-
chainId,
|
|
2257
|
-
...premintConfigAndVersion
|
|
2258
|
-
}) {
|
|
2259
|
-
const recoveredAddress = await tryRecoverPremintSigner({
|
|
2260
|
-
...premintConfigAndVersion,
|
|
2261
|
-
signature,
|
|
2262
|
-
verifyingContract: collectionAddress,
|
|
2263
|
-
chainId
|
|
2264
|
-
});
|
|
2265
|
-
if (!recoverAddress) {
|
|
2266
|
-
return {
|
|
2267
|
-
isAuthorized: false
|
|
2268
|
-
};
|
|
2269
|
-
}
|
|
2270
|
-
const isAuthorized = await isAuthorizedToCreatePremint({
|
|
2271
|
-
signer: recoveredAddress,
|
|
2272
|
-
additionalAdmins: collection?.additionalAdmins,
|
|
2273
|
-
contractAdmin: collection?.contractAdmin,
|
|
2274
|
-
collectionAddress,
|
|
2275
|
-
publicClient
|
|
2276
|
-
});
|
|
2277
|
-
return {
|
|
2278
|
-
isAuthorized,
|
|
2279
|
-
recoveredAddress
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2282
|
-
function migratePremintConfigToV2({
|
|
2283
|
-
premintConfig,
|
|
2284
|
-
createReferral = zeroAddress
|
|
2285
|
-
}) {
|
|
2286
|
-
return {
|
|
2287
|
-
...premintConfig,
|
|
2288
|
-
tokenConfig: {
|
|
2289
|
-
tokenURI: premintConfig.tokenConfig.tokenURI,
|
|
2290
|
-
maxSupply: premintConfig.tokenConfig.maxSupply,
|
|
2291
|
-
maxTokensPerAddress: premintConfig.tokenConfig.maxTokensPerAddress,
|
|
2292
|
-
pricePerToken: premintConfig.tokenConfig.pricePerToken,
|
|
2293
|
-
mintStart: premintConfig.tokenConfig.mintStart,
|
|
2294
|
-
mintDuration: premintConfig.tokenConfig.mintDuration,
|
|
2295
|
-
payoutRecipient: premintConfig.tokenConfig.royaltyRecipient,
|
|
2296
|
-
royaltyBPS: premintConfig.tokenConfig.royaltyBPS,
|
|
2297
|
-
fixedPriceMinter: premintConfig.tokenConfig.fixedPriceMinter,
|
|
2298
|
-
createReferral
|
|
2299
|
-
}
|
|
2300
|
-
};
|
|
2301
|
-
}
|
|
2302
|
-
var recoverCreatorFromCreatorAttribution = async ({
|
|
2303
|
-
creatorAttribution: { version, domainName, structHash, signature },
|
|
2304
|
-
chainId,
|
|
2305
|
-
tokenContract
|
|
2306
|
-
}) => {
|
|
2307
|
-
const hashedDomain = hashDomain({
|
|
2308
|
-
domain: {
|
|
2309
|
-
chainId,
|
|
2310
|
-
name: domainName,
|
|
2311
|
-
verifyingContract: tokenContract,
|
|
2312
|
-
version
|
|
2313
|
-
},
|
|
2314
|
-
types: {
|
|
2315
|
-
EIP712Domain: [
|
|
2316
|
-
{ name: "name", type: "string" },
|
|
2317
|
-
{ name: "version", type: "string" },
|
|
2318
|
-
{
|
|
2319
|
-
name: "chainId",
|
|
2320
|
-
type: "uint256"
|
|
2321
|
-
},
|
|
2322
|
-
{
|
|
2323
|
-
name: "verifyingContract",
|
|
2324
|
-
type: "address"
|
|
2325
|
-
}
|
|
2326
|
-
]
|
|
2327
|
-
}
|
|
2328
|
-
});
|
|
2329
|
-
const parts = ["0x1901", hashedDomain, structHash];
|
|
2330
|
-
const hashedTypedData = keccak256(concat(parts));
|
|
2331
|
-
return await recoverAddress({
|
|
2332
|
-
hash: hashedTypedData,
|
|
2333
|
-
signature
|
|
2334
|
-
});
|
|
2335
|
-
};
|
|
2336
|
-
var supportedPremintVersions = async ({
|
|
2337
|
-
tokenContract,
|
|
2338
|
-
publicClient
|
|
2339
|
-
}) => {
|
|
2340
|
-
return await publicClient.readContract({
|
|
2341
|
-
abi: preminterAbi,
|
|
2342
|
-
address: getPremintExecutorAddress(),
|
|
2343
|
-
functionName: "supportedPremintSignatureVersions",
|
|
2344
|
-
args: [tokenContract]
|
|
2345
|
-
});
|
|
2346
|
-
};
|
|
2347
|
-
var supportsPremintVersion = async ({
|
|
2348
|
-
version,
|
|
2349
|
-
tokenContract,
|
|
2350
|
-
publicClient
|
|
2351
|
-
}) => {
|
|
2352
|
-
return (await supportedPremintVersions({ tokenContract, publicClient })).includes(version);
|
|
2353
|
-
};
|
|
2354
2224
|
async function getPremintCollectionAddress({
|
|
2355
2225
|
publicClient,
|
|
2356
2226
|
contract: collection,
|
|
@@ -2371,35 +2241,6 @@ async function getPremintCollectionAddress({
|
|
|
2371
2241
|
}
|
|
2372
2242
|
return collectionAddress;
|
|
2373
2243
|
}
|
|
2374
|
-
function applyUpdateToPremint({
|
|
2375
|
-
uid,
|
|
2376
|
-
version,
|
|
2377
|
-
tokenConfig,
|
|
2378
|
-
tokenConfigUpdates
|
|
2379
|
-
}) {
|
|
2380
|
-
const updatedTokenConfig = {
|
|
2381
|
-
...tokenConfig,
|
|
2382
|
-
...tokenConfigUpdates
|
|
2383
|
-
};
|
|
2384
|
-
const result = {
|
|
2385
|
-
deleted: false,
|
|
2386
|
-
uid,
|
|
2387
|
-
version: version + 1,
|
|
2388
|
-
tokenConfig: updatedTokenConfig
|
|
2389
|
-
};
|
|
2390
|
-
return result;
|
|
2391
|
-
}
|
|
2392
|
-
function makeNewPremint({
|
|
2393
|
-
tokenConfig,
|
|
2394
|
-
uid
|
|
2395
|
-
}) {
|
|
2396
|
-
return {
|
|
2397
|
-
deleted: false,
|
|
2398
|
-
uid,
|
|
2399
|
-
version: 0,
|
|
2400
|
-
tokenConfig
|
|
2401
|
-
};
|
|
2402
|
-
}
|
|
2403
2244
|
async function getPremintMintFee({
|
|
2404
2245
|
tokenContract,
|
|
2405
2246
|
publicClient
|
|
@@ -2465,9 +2306,6 @@ function makeMintRewardsRecipient({
|
|
|
2465
2306
|
}) {
|
|
2466
2307
|
return [mintReferral, platformReferral];
|
|
2467
2308
|
}
|
|
2468
|
-
function getDefaultFixedPriceMinterAddress(chainId) {
|
|
2469
|
-
return zoraCreatorFixedPriceSaleStrategyAddress[chainId];
|
|
2470
|
-
}
|
|
2471
2309
|
var emptyContractCreationConfig = () => ({
|
|
2472
2310
|
contractAdmin: zeroAddress,
|
|
2473
2311
|
contractURI: "",
|
|
@@ -2500,7 +2338,7 @@ var toContractCreationConfigOrAddress = ({
|
|
|
2500
2338
|
// src/premint/premint-client.ts
|
|
2501
2339
|
import {
|
|
2502
2340
|
PremintConfigVersion as PremintConfigVersion2,
|
|
2503
|
-
premintTypedDataDefinition
|
|
2341
|
+
premintTypedDataDefinition
|
|
2504
2342
|
} from "@zoralabs/protocol-deployments";
|
|
2505
2343
|
|
|
2506
2344
|
// src/utils.ts
|
|
@@ -2522,82 +2360,6 @@ var getApiNetworkConfigForChain = (chainId) => {
|
|
|
2522
2360
|
};
|
|
2523
2361
|
|
|
2524
2362
|
// src/premint/premint-client.ts
|
|
2525
|
-
var defaultTokenConfigV1MintArguments = () => ({
|
|
2526
|
-
maxSupply: OPEN_EDITION_MINT_SIZE,
|
|
2527
|
-
maxTokensPerAddress: 0n,
|
|
2528
|
-
pricePerToken: 0n,
|
|
2529
|
-
mintDuration: 0n,
|
|
2530
|
-
mintStart: 0n,
|
|
2531
|
-
royaltyMintSchedule: 0,
|
|
2532
|
-
royaltyBPS: 1e3
|
|
2533
|
-
// 10%,
|
|
2534
|
-
});
|
|
2535
|
-
var pickTokenConfigV1 = (tokenConfig) => ({
|
|
2536
|
-
maxSupply: tokenConfig.maxSupply,
|
|
2537
|
-
maxTokensPerAddress: tokenConfig.maxTokensPerAddress,
|
|
2538
|
-
pricePerToken: tokenConfig.pricePerToken,
|
|
2539
|
-
mintDuration: tokenConfig.mintDuration,
|
|
2540
|
-
mintStart: tokenConfig.mintStart,
|
|
2541
|
-
royaltyBPS: tokenConfig.royaltyBPS,
|
|
2542
|
-
tokenURI: tokenConfig.tokenURI,
|
|
2543
|
-
royaltyRecipient: tokenConfig.payoutRecipient
|
|
2544
|
-
});
|
|
2545
|
-
var pickTokenConfigV2 = (tokenConfig) => ({
|
|
2546
|
-
maxSupply: tokenConfig.maxSupply,
|
|
2547
|
-
maxTokensPerAddress: tokenConfig.maxTokensPerAddress,
|
|
2548
|
-
pricePerToken: tokenConfig.pricePerToken,
|
|
2549
|
-
mintDuration: tokenConfig.mintDuration,
|
|
2550
|
-
mintStart: tokenConfig.mintStart,
|
|
2551
|
-
royaltyBPS: tokenConfig.royaltyBPS,
|
|
2552
|
-
tokenURI: tokenConfig.tokenURI,
|
|
2553
|
-
payoutRecipient: tokenConfig.payoutRecipient,
|
|
2554
|
-
createReferral: tokenConfig.createReferral || zeroAddress2
|
|
2555
|
-
});
|
|
2556
|
-
var tokenConfigV1WithDefault = (tokenConfig, fixedPriceMinter) => ({
|
|
2557
|
-
...pickTokenConfigV1(tokenConfig),
|
|
2558
|
-
...defaultTokenConfigV1MintArguments(),
|
|
2559
|
-
fixedPriceMinter
|
|
2560
|
-
});
|
|
2561
|
-
var tokenConfigV2WithDefault = (tokenConfig, fixedPriceMinter) => ({
|
|
2562
|
-
...pickTokenConfigV2(tokenConfig),
|
|
2563
|
-
...defaultTokenConfigV2MintArguments(),
|
|
2564
|
-
fixedPriceMinter
|
|
2565
|
-
});
|
|
2566
|
-
var defaultTokenConfigV2MintArguments = () => ({
|
|
2567
|
-
maxSupply: OPEN_EDITION_MINT_SIZE,
|
|
2568
|
-
maxTokensPerAddress: 0n,
|
|
2569
|
-
pricePerToken: 0n,
|
|
2570
|
-
mintDuration: 0n,
|
|
2571
|
-
mintStart: 0n,
|
|
2572
|
-
royaltyBPS: 1e3
|
|
2573
|
-
// 10%,
|
|
2574
|
-
});
|
|
2575
|
-
var makeTokenConfigWithDefaults = ({
|
|
2576
|
-
chainId,
|
|
2577
|
-
tokenCreationConfig,
|
|
2578
|
-
supportedPremintVersions: supportedPremintVersions2
|
|
2579
|
-
}) => {
|
|
2580
|
-
const fixedPriceMinter = getDefaultFixedPriceMinterAddress(chainId);
|
|
2581
|
-
if (!supportedPremintVersions2.includes(PremintConfigVersion2.V2)) {
|
|
2582
|
-
if (tokenCreationConfig.createReferral) {
|
|
2583
|
-
throw new Error("Contract does not support create referral");
|
|
2584
|
-
}
|
|
2585
|
-
return {
|
|
2586
|
-
premintConfigVersion: PremintConfigVersion2.V1,
|
|
2587
|
-
tokenConfig: tokenConfigV1WithDefault(
|
|
2588
|
-
tokenCreationConfig,
|
|
2589
|
-
fixedPriceMinter
|
|
2590
|
-
)
|
|
2591
|
-
};
|
|
2592
|
-
}
|
|
2593
|
-
return {
|
|
2594
|
-
premintConfigVersion: PremintConfigVersion2.V2,
|
|
2595
|
-
tokenConfig: tokenConfigV2WithDefault(
|
|
2596
|
-
tokenCreationConfig,
|
|
2597
|
-
fixedPriceMinter
|
|
2598
|
-
)
|
|
2599
|
-
};
|
|
2600
|
-
};
|
|
2601
2363
|
function getPremintedLogFromReceipt(receipt) {
|
|
2602
2364
|
for (const data of receipt.logs) {
|
|
2603
2365
|
try {
|
|
@@ -2626,20 +2388,6 @@ var PremintClient = class {
|
|
|
2626
2388
|
getDataFromPremintReceipt(receipt, blockExplorerUrl) {
|
|
2627
2389
|
return getDataFromPremintReceipt(receipt, this.chainId, blockExplorerUrl);
|
|
2628
2390
|
}
|
|
2629
|
-
/**
|
|
2630
|
-
* Prepares data for updating a premint
|
|
2631
|
-
*
|
|
2632
|
-
* @param parameters - Parameters for updating the premint {@link UpdatePremintParams}
|
|
2633
|
-
* @returns A PremintReturn. {@link PremintReturn}
|
|
2634
|
-
*/
|
|
2635
|
-
async updatePremint(args) {
|
|
2636
|
-
return await updatePremint({
|
|
2637
|
-
...args,
|
|
2638
|
-
apiClient: this.apiClient,
|
|
2639
|
-
publicClient: this.publicClient,
|
|
2640
|
-
chainId: this.chainId
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2643
2391
|
/**
|
|
2644
2392
|
* Prepares data for deleting a premint
|
|
2645
2393
|
*
|
|
@@ -2654,20 +2402,6 @@ var PremintClient = class {
|
|
|
2654
2402
|
chainId: this.chainId
|
|
2655
2403
|
});
|
|
2656
2404
|
}
|
|
2657
|
-
/**
|
|
2658
|
-
* Prepares data for creating a premint
|
|
2659
|
-
*
|
|
2660
|
-
* @param parameters - Parameters for creating the premint {@link CreatePremintParameters}
|
|
2661
|
-
* @returns A PremintReturn. {@link PremintReturn}
|
|
2662
|
-
*/
|
|
2663
|
-
async createPremint(parameters) {
|
|
2664
|
-
return createPremint({
|
|
2665
|
-
...parameters,
|
|
2666
|
-
publicClient: this.publicClient,
|
|
2667
|
-
apiClient: this.apiClient,
|
|
2668
|
-
chainId: this.chainId
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
2405
|
/**
|
|
2672
2406
|
* Fetches given premint data from the ZORA API.
|
|
2673
2407
|
*
|
|
@@ -2755,7 +2489,7 @@ function makePremintReturn({
|
|
|
2755
2489
|
...collectionAndAddress
|
|
2756
2490
|
}) {
|
|
2757
2491
|
const { collection, collectionAddress } = collectionAndAddress;
|
|
2758
|
-
const typedDataDefinition =
|
|
2492
|
+
const typedDataDefinition = premintTypedDataDefinition({
|
|
2759
2493
|
verifyingContract: collectionAddress,
|
|
2760
2494
|
premintConfig,
|
|
2761
2495
|
premintConfigVersion,
|
|
@@ -2840,105 +2574,6 @@ async function signPremint({
|
|
|
2840
2574
|
signerAccount: account
|
|
2841
2575
|
};
|
|
2842
2576
|
}
|
|
2843
|
-
async function createPremint({
|
|
2844
|
-
token: tokenCreationConfig,
|
|
2845
|
-
uid,
|
|
2846
|
-
publicClient,
|
|
2847
|
-
apiClient,
|
|
2848
|
-
chainId,
|
|
2849
|
-
...collectionOrAddress
|
|
2850
|
-
}) {
|
|
2851
|
-
const {
|
|
2852
|
-
premintConfig,
|
|
2853
|
-
premintConfigVersion,
|
|
2854
|
-
collectionAddress: collectionAddressToUse
|
|
2855
|
-
} = await prepareCreatePremintConfig({
|
|
2856
|
-
...collectionOrAddress,
|
|
2857
|
-
tokenCreationConfig,
|
|
2858
|
-
uid,
|
|
2859
|
-
publicClient,
|
|
2860
|
-
apiClient,
|
|
2861
|
-
chainId
|
|
2862
|
-
});
|
|
2863
|
-
return makePremintReturn({
|
|
2864
|
-
premintConfig,
|
|
2865
|
-
premintConfigVersion,
|
|
2866
|
-
collectionAddress: collectionAddressToUse,
|
|
2867
|
-
collection: collectionOrAddress.contract,
|
|
2868
|
-
publicClient,
|
|
2869
|
-
apiClient,
|
|
2870
|
-
chainId
|
|
2871
|
-
});
|
|
2872
|
-
}
|
|
2873
|
-
async function prepareCreatePremintConfig({
|
|
2874
|
-
tokenCreationConfig,
|
|
2875
|
-
uid,
|
|
2876
|
-
publicClient,
|
|
2877
|
-
apiClient,
|
|
2878
|
-
chainId,
|
|
2879
|
-
...collectionOrAddress
|
|
2880
|
-
}) {
|
|
2881
|
-
const newContractAddress = await getPremintCollectionAddress({
|
|
2882
|
-
publicClient,
|
|
2883
|
-
...collectionOrAddress
|
|
2884
|
-
});
|
|
2885
|
-
let uidToUse = uid;
|
|
2886
|
-
if (typeof uidToUse !== "number") {
|
|
2887
|
-
uidToUse = await apiClient.getNextUID(newContractAddress);
|
|
2888
|
-
}
|
|
2889
|
-
const supportedVersions = await supportedPremintVersions({
|
|
2890
|
-
tokenContract: newContractAddress,
|
|
2891
|
-
publicClient
|
|
2892
|
-
});
|
|
2893
|
-
const tokenConfigAndVersion = makeTokenConfigWithDefaults({
|
|
2894
|
-
tokenCreationConfig,
|
|
2895
|
-
chainId,
|
|
2896
|
-
supportedPremintVersions: supportedVersions
|
|
2897
|
-
});
|
|
2898
|
-
const premintConfig = makeNewPremint({
|
|
2899
|
-
...tokenConfigAndVersion,
|
|
2900
|
-
uid: uidToUse
|
|
2901
|
-
});
|
|
2902
|
-
const premintConfigAndVersion = {
|
|
2903
|
-
premintConfig,
|
|
2904
|
-
premintConfigVersion: tokenConfigAndVersion.premintConfigVersion
|
|
2905
|
-
};
|
|
2906
|
-
return {
|
|
2907
|
-
...premintConfigAndVersion,
|
|
2908
|
-
collectionAddress: newContractAddress
|
|
2909
|
-
};
|
|
2910
|
-
}
|
|
2911
|
-
async function updatePremint({
|
|
2912
|
-
uid,
|
|
2913
|
-
collection,
|
|
2914
|
-
tokenConfigUpdates,
|
|
2915
|
-
apiClient,
|
|
2916
|
-
publicClient,
|
|
2917
|
-
chainId
|
|
2918
|
-
}) {
|
|
2919
|
-
const {
|
|
2920
|
-
premint: { premintConfig, premintConfigVersion },
|
|
2921
|
-
collection: collectionCreationConfig
|
|
2922
|
-
} = await apiClient.get({
|
|
2923
|
-
collectionAddress: collection,
|
|
2924
|
-
uid
|
|
2925
|
-
});
|
|
2926
|
-
const updatedPremint = applyUpdateToPremint({
|
|
2927
|
-
uid: premintConfig.uid,
|
|
2928
|
-
version: premintConfig.version,
|
|
2929
|
-
tokenConfig: premintConfig.tokenConfig,
|
|
2930
|
-
tokenConfigUpdates
|
|
2931
|
-
});
|
|
2932
|
-
return makePremintReturn({
|
|
2933
|
-
premintConfig: updatedPremint,
|
|
2934
|
-
premintConfigVersion,
|
|
2935
|
-
collectionAddress: collection,
|
|
2936
|
-
collection: collectionCreationConfig,
|
|
2937
|
-
publicClient,
|
|
2938
|
-
apiClient,
|
|
2939
|
-
chainId
|
|
2940
|
-
});
|
|
2941
|
-
}
|
|
2942
2577
|
async function deletePremint({
|
|
2943
2578
|
uid,
|
|
2944
2579
|
collection,
|
|
@@ -3198,15 +2833,6 @@ var postSignature = async ({
|
|
|
3198
2833
|
}) => retries2(
|
|
3199
2834
|
() => post2(`${ZORA_API_BASE}premint/signature`, data)
|
|
3200
2835
|
);
|
|
3201
|
-
var getNextUID = async ({
|
|
3202
|
-
chainId,
|
|
3203
|
-
collection_address,
|
|
3204
|
-
httpClient: { retries: retries2, get: get2 } = httpClient
|
|
3205
|
-
}) => retries2(
|
|
3206
|
-
() => get2(
|
|
3207
|
-
`${ZORA_API_BASE}premint/signature/${getApiNetworkConfigForChain(chainId).zoraBackendChainName}/${collection_address}/next_uid`
|
|
3208
|
-
)
|
|
3209
|
-
);
|
|
3210
2836
|
var getSignature = async ({
|
|
3211
2837
|
collectionAddress,
|
|
3212
2838
|
uid,
|
|
@@ -3250,11 +2876,6 @@ var PremintAPIClient = class {
|
|
|
3250
2876
|
httpClient: this.httpClient
|
|
3251
2877
|
});
|
|
3252
2878
|
};
|
|
3253
|
-
this.getNextUID = async (collectionAddress) => (await getNextUID({
|
|
3254
|
-
collection_address: collectionAddress.toLowerCase(),
|
|
3255
|
-
chainId: this.chainId,
|
|
3256
|
-
httpClient: this.httpClient
|
|
3257
|
-
})).next_uid;
|
|
3258
2879
|
this.get = async ({ collectionAddress, uid }) => {
|
|
3259
2880
|
return getSignature({
|
|
3260
2881
|
collectionAddress,
|
|
@@ -3730,7 +3351,7 @@ import {
|
|
|
3730
3351
|
} from "viem";
|
|
3731
3352
|
import {
|
|
3732
3353
|
erc20MinterABI,
|
|
3733
|
-
zoraCreator1155ImplABI
|
|
3354
|
+
zoraCreator1155ImplABI,
|
|
3734
3355
|
zoraTimedSaleStrategyABI,
|
|
3735
3356
|
callerAndCommenterABI,
|
|
3736
3357
|
callerAndCommenterAddress
|
|
@@ -3957,7 +3578,7 @@ function makeEthMintCall({
|
|
|
3957
3578
|
}
|
|
3958
3579
|
if (contractSupportsNewMintFunction(salesConfigAndTokenInfo.contractVersion)) {
|
|
3959
3580
|
return makeContractParameters({
|
|
3960
|
-
abi:
|
|
3581
|
+
abi: zoraCreator1155ImplABI,
|
|
3961
3582
|
functionName: "mint",
|
|
3962
3583
|
account: minterAccount,
|
|
3963
3584
|
value: mintValue,
|
|
@@ -4388,7 +4009,7 @@ async function mint({
|
|
|
4388
4009
|
import {
|
|
4389
4010
|
zoraCreator1155FactoryImplABI as zoraCreator1155FactoryImplABI2,
|
|
4390
4011
|
zoraCreator1155FactoryImplAddress as zoraCreator1155FactoryImplAddress2,
|
|
4391
|
-
zoraCreator1155ImplABI as
|
|
4012
|
+
zoraCreator1155ImplABI as zoraCreator1155ImplABI5
|
|
4392
4013
|
} from "@zoralabs/protocol-deployments";
|
|
4393
4014
|
import { decodeEventLog as decodeEventLog2 } from "viem";
|
|
4394
4015
|
|
|
@@ -4397,7 +4018,7 @@ import {
|
|
|
4397
4018
|
contracts1155,
|
|
4398
4019
|
zoraCreator1155FactoryImplABI,
|
|
4399
4020
|
zoraCreator1155FactoryImplAddress,
|
|
4400
|
-
zoraCreator1155ImplABI as
|
|
4021
|
+
zoraCreator1155ImplABI as zoraCreator1155ImplABI2
|
|
4401
4022
|
} from "@zoralabs/protocol-deployments";
|
|
4402
4023
|
function new1155ContractVersion(chainId) {
|
|
4403
4024
|
const address = contracts1155.addresses[chainId];
|
|
@@ -4433,7 +4054,7 @@ async function getNewContractMintFee({
|
|
|
4433
4054
|
}) {
|
|
4434
4055
|
const implAddress = contracts1155.addresses[chainId].CONTRACT_1155_IMPL;
|
|
4435
4056
|
return await publicClient.readContract({
|
|
4436
|
-
abi:
|
|
4057
|
+
abi: zoraCreator1155ImplABI2,
|
|
4437
4058
|
address: implAddress,
|
|
4438
4059
|
functionName: "mintFee"
|
|
4439
4060
|
});
|
|
@@ -4441,7 +4062,7 @@ async function getNewContractMintFee({
|
|
|
4441
4062
|
|
|
4442
4063
|
// src/create/token-setup.ts
|
|
4443
4064
|
var semver2 = __toESM(require_semver2(), 1);
|
|
4444
|
-
import { zoraCreator1155ImplABI as
|
|
4065
|
+
import { zoraCreator1155ImplABI as zoraCreator1155ImplABI4 } from "@zoralabs/protocol-deployments";
|
|
4445
4066
|
import { encodeFunctionData as encodeFunctionData2, zeroAddress as zeroAddress5 } from "viem";
|
|
4446
4067
|
|
|
4447
4068
|
// src/create/minter-defaults.ts
|
|
@@ -4533,9 +4154,9 @@ var getSalesConfigWithDefaults = (salesConfig, contractName) => {
|
|
|
4533
4154
|
import {
|
|
4534
4155
|
erc20MinterABI as erc20MinterABI2,
|
|
4535
4156
|
erc20MinterAddress as erc20MinterAddresses,
|
|
4536
|
-
zoraCreator1155ImplABI as
|
|
4157
|
+
zoraCreator1155ImplABI as zoraCreator1155ImplABI3,
|
|
4537
4158
|
zoraCreatorFixedPriceSaleStrategyABI,
|
|
4538
|
-
zoraCreatorFixedPriceSaleStrategyAddress
|
|
4159
|
+
zoraCreatorFixedPriceSaleStrategyAddress,
|
|
4539
4160
|
zoraCreatorMerkleMinterStrategyABI,
|
|
4540
4161
|
zoraCreatorMerkleMinterStrategyAddress,
|
|
4541
4162
|
zoraTimedSaleStrategyABI as zoraTimedSaleStrategyABI2,
|
|
@@ -4559,7 +4180,7 @@ function setupErc20Minter({
|
|
|
4559
4180
|
if (!erc20MinterAddress)
|
|
4560
4181
|
throw new Error(`ERC20Minter not deployed on chainId ${chainId}`);
|
|
4561
4182
|
const erc20MinterApproval = encodeFunctionData({
|
|
4562
|
-
abi:
|
|
4183
|
+
abi: zoraCreator1155ImplABI3,
|
|
4563
4184
|
functionName: "addPermission",
|
|
4564
4185
|
args: [BigInt(nextTokenId), erc20MinterAddress, PERMISSION_BITS.MINTER]
|
|
4565
4186
|
});
|
|
@@ -4579,7 +4200,7 @@ function setupErc20Minter({
|
|
|
4579
4200
|
]
|
|
4580
4201
|
});
|
|
4581
4202
|
const callSale = encodeFunctionData({
|
|
4582
|
-
abi:
|
|
4203
|
+
abi: zoraCreator1155ImplABI3,
|
|
4583
4204
|
functionName: "callSale",
|
|
4584
4205
|
args: [BigInt(nextTokenId), erc20MinterAddress, saleData]
|
|
4585
4206
|
});
|
|
@@ -4597,9 +4218,9 @@ function setupFixedPriceMinter({
|
|
|
4597
4218
|
maxTokensPerAddress: mintLimit,
|
|
4598
4219
|
fundsRecipient
|
|
4599
4220
|
}) {
|
|
4600
|
-
const fixedPriceStrategyAddress =
|
|
4221
|
+
const fixedPriceStrategyAddress = zoraCreatorFixedPriceSaleStrategyAddress[chainId];
|
|
4601
4222
|
const fixedPriceApproval = encodeFunctionData({
|
|
4602
|
-
abi:
|
|
4223
|
+
abi: zoraCreator1155ImplABI3,
|
|
4603
4224
|
functionName: "addPermission",
|
|
4604
4225
|
args: [
|
|
4605
4226
|
BigInt(nextTokenId),
|
|
@@ -4622,7 +4243,7 @@ function setupFixedPriceMinter({
|
|
|
4622
4243
|
]
|
|
4623
4244
|
});
|
|
4624
4245
|
const callSale = encodeFunctionData({
|
|
4625
|
-
abi:
|
|
4246
|
+
abi: zoraCreator1155ImplABI3,
|
|
4626
4247
|
functionName: "callSale",
|
|
4627
4248
|
args: [BigInt(nextTokenId), fixedPriceStrategyAddress, saleData]
|
|
4628
4249
|
});
|
|
@@ -4642,7 +4263,7 @@ function setupTimedSaleMinter({
|
|
|
4642
4263
|
}) {
|
|
4643
4264
|
const minterAddress = zoraTimedSaleStrategyAddress[chainId];
|
|
4644
4265
|
const minterApproval = encodeFunctionData({
|
|
4645
|
-
abi:
|
|
4266
|
+
abi: zoraCreator1155ImplABI3,
|
|
4646
4267
|
functionName: "addPermission",
|
|
4647
4268
|
args: [BigInt(tokenId), minterAddress, PERMISSION_BITS.MINTER]
|
|
4648
4269
|
});
|
|
@@ -4661,7 +4282,7 @@ function setupTimedSaleMinter({
|
|
|
4661
4282
|
]
|
|
4662
4283
|
});
|
|
4663
4284
|
const callSale = encodeFunctionData({
|
|
4664
|
-
abi:
|
|
4285
|
+
abi: zoraCreator1155ImplABI3,
|
|
4665
4286
|
functionName: "callSale",
|
|
4666
4287
|
args: [BigInt(tokenId), minterAddress, saleData]
|
|
4667
4288
|
});
|
|
@@ -4678,7 +4299,7 @@ function setupAllowListMinter({
|
|
|
4678
4299
|
}) {
|
|
4679
4300
|
const merkleSaleStrategyAddress = zoraCreatorMerkleMinterStrategyAddress[chainId];
|
|
4680
4301
|
const merkleApproval = encodeFunctionData({
|
|
4681
|
-
abi:
|
|
4302
|
+
abi: zoraCreator1155ImplABI3,
|
|
4682
4303
|
functionName: "addPermission",
|
|
4683
4304
|
args: [nextTokenId, merkleSaleStrategyAddress, PERMISSION_BITS.MINTER]
|
|
4684
4305
|
});
|
|
@@ -4697,7 +4318,7 @@ function setupAllowListMinter({
|
|
|
4697
4318
|
]
|
|
4698
4319
|
});
|
|
4699
4320
|
const callSaleMerkle = encodeFunctionData({
|
|
4700
|
-
abi:
|
|
4321
|
+
abi: zoraCreator1155ImplABI3,
|
|
4701
4322
|
functionName: "callSale",
|
|
4702
4323
|
args: [BigInt(nextTokenId), merkleSaleStrategyAddress, saleData]
|
|
4703
4324
|
});
|
|
@@ -4754,7 +4375,7 @@ function buildSetupNewToken({
|
|
|
4754
4375
|
}) {
|
|
4755
4376
|
if (contractSupportsMintRewards(contractVersion, "ERC1155")) {
|
|
4756
4377
|
return encodeFunctionData2({
|
|
4757
|
-
abi:
|
|
4378
|
+
abi: zoraCreator1155ImplABI4,
|
|
4758
4379
|
functionName: "setupNewTokenWithCreateReferral",
|
|
4759
4380
|
args: [tokenURI, BigInt(maxSupply), createReferral]
|
|
4760
4381
|
});
|
|
@@ -4765,7 +4386,7 @@ function buildSetupNewToken({
|
|
|
4765
4386
|
);
|
|
4766
4387
|
}
|
|
4767
4388
|
return encodeFunctionData2({
|
|
4768
|
-
abi:
|
|
4389
|
+
abi: zoraCreator1155ImplABI4,
|
|
4769
4390
|
functionName: "setupNewToken",
|
|
4770
4391
|
args: [tokenURI, BigInt(maxSupply)]
|
|
4771
4392
|
});
|
|
@@ -4777,7 +4398,7 @@ function setupRoyaltyConfig({
|
|
|
4777
4398
|
}) {
|
|
4778
4399
|
if (royaltyBPS > 0 && royaltyRecipient != zeroAddress5) {
|
|
4779
4400
|
return encodeFunctionData2({
|
|
4780
|
-
abi:
|
|
4401
|
+
abi: zoraCreator1155ImplABI4,
|
|
4781
4402
|
functionName: "updateRoyaltiesForToken",
|
|
4782
4403
|
args: [
|
|
4783
4404
|
nextTokenId,
|
|
@@ -4800,7 +4421,7 @@ function makeAdminMintCall({
|
|
|
4800
4421
|
return null;
|
|
4801
4422
|
}
|
|
4802
4423
|
return encodeFunctionData2({
|
|
4803
|
-
abi:
|
|
4424
|
+
abi: zoraCreator1155ImplABI4,
|
|
4804
4425
|
functionName: "adminMint",
|
|
4805
4426
|
args: [ownerAddress, nextTokenId, BigInt(mintQuantity), zeroAddress5]
|
|
4806
4427
|
});
|
|
@@ -4819,7 +4440,7 @@ function constructCreate1155TokenCalls(props) {
|
|
|
4819
4440
|
props.contractName
|
|
4820
4441
|
);
|
|
4821
4442
|
const verifyTokenIdExpected = encodeFunctionData2({
|
|
4822
|
-
abi:
|
|
4443
|
+
abi: zoraCreator1155ImplABI4,
|
|
4823
4444
|
functionName: "assumeLastTokenIdMatches",
|
|
4824
4445
|
args: [nextTokenId - 1n]
|
|
4825
4446
|
});
|
|
@@ -5026,7 +4647,7 @@ var getTokenIdFromCreateReceipt = (receipt) => {
|
|
|
5026
4647
|
for (const data of receipt.logs) {
|
|
5027
4648
|
try {
|
|
5028
4649
|
const decodedLog = decodeEventLog2({
|
|
5029
|
-
abi:
|
|
4650
|
+
abi: zoraCreator1155ImplABI5,
|
|
5030
4651
|
eventName: "SetupNewToken",
|
|
5031
4652
|
...data
|
|
5032
4653
|
});
|
|
@@ -5092,7 +4713,7 @@ function makeCreateTokenCall({
|
|
|
5092
4713
|
tokenSetupActions
|
|
5093
4714
|
}) {
|
|
5094
4715
|
return makeContractParameters({
|
|
5095
|
-
abi:
|
|
4716
|
+
abi: zoraCreator1155ImplABI5,
|
|
5096
4717
|
functionName: "multicall",
|
|
5097
4718
|
account,
|
|
5098
4719
|
address: contractAddress,
|
|
@@ -5172,7 +4793,7 @@ async function create1155({
|
|
|
5172
4793
|
prepareMint,
|
|
5173
4794
|
contractAddress,
|
|
5174
4795
|
contractVersion,
|
|
5175
|
-
|
|
4796
|
+
tokenId: nextTokenId
|
|
5176
4797
|
};
|
|
5177
4798
|
}
|
|
5178
4799
|
function prepareNew1155ContractAndToken({
|
|
@@ -5278,7 +4899,7 @@ async function createNew1155Token({
|
|
|
5278
4899
|
return {
|
|
5279
4900
|
...preparedToken,
|
|
5280
4901
|
prepareMint,
|
|
5281
|
-
|
|
4902
|
+
tokenId: nextTokenId,
|
|
5282
4903
|
contractVersion
|
|
5283
4904
|
};
|
|
5284
4905
|
}
|
|
@@ -5914,7 +5535,7 @@ var RewardsClient = class {
|
|
|
5914
5535
|
import { encodeAbiParameters as encodeAbiParameters2 } from "viem";
|
|
5915
5536
|
import {
|
|
5916
5537
|
secondarySwapAddress,
|
|
5917
|
-
zoraCreator1155ImplABI as
|
|
5538
|
+
zoraCreator1155ImplABI as zoraCreator1155ImplABI6,
|
|
5918
5539
|
safeTransferSwapAbiParameters,
|
|
5919
5540
|
secondarySwapABI,
|
|
5920
5541
|
callerAndCommenterABI as callerAndCommenterABI2,
|
|
@@ -6406,7 +6027,7 @@ async function makeSell({
|
|
|
6406
6027
|
}) {
|
|
6407
6028
|
const accountAddress = addressOrAccountAddress(account);
|
|
6408
6029
|
const tokenCount = await publicClient.readContract({
|
|
6409
|
-
abi:
|
|
6030
|
+
abi: zoraCreator1155ImplABI6,
|
|
6410
6031
|
address: contract,
|
|
6411
6032
|
functionName: "balanceOf",
|
|
6412
6033
|
args: [accountAddress, tokenId]
|
|
@@ -6428,7 +6049,7 @@ async function makeSell({
|
|
|
6428
6049
|
const chainId = publicClient.chain.id;
|
|
6429
6050
|
return {
|
|
6430
6051
|
parameters: makeContractParameters({
|
|
6431
|
-
abi:
|
|
6052
|
+
abi: zoraCreator1155ImplABI6,
|
|
6432
6053
|
address: contract,
|
|
6433
6054
|
functionName: "safeTransferFrom",
|
|
6434
6055
|
account,
|
|
@@ -6548,8 +6169,6 @@ function createCreatorClient(clientConfig) {
|
|
|
6548
6169
|
rewardsGetter: clientConfig.rewardsGetter || new SubgraphRewardsGetter(clientConfig.chainId)
|
|
6549
6170
|
});
|
|
6550
6171
|
return {
|
|
6551
|
-
createPremint: (p) => premintClient.createPremint(p),
|
|
6552
|
-
updatePremint: (p) => premintClient.updatePremint(p),
|
|
6553
6172
|
deletePremint: (p) => premintClient.deletePremint(p),
|
|
6554
6173
|
create1155: (p) => create1155CreatorClient.createNew1155(p),
|
|
6555
6174
|
create1155OnExistingContract: (p) => create1155CreatorClient.createNew1155OnExistingContract(p),
|
|
@@ -7830,10 +7449,8 @@ export {
|
|
|
7830
7449
|
SubgraphContractGetter,
|
|
7831
7450
|
SubgraphMintGetter,
|
|
7832
7451
|
ZORA_API_BASE,
|
|
7833
|
-
applyUpdateToPremint,
|
|
7834
7452
|
buildPremintMintCall,
|
|
7835
7453
|
buy1155OnSecondary,
|
|
7836
|
-
collectPremint,
|
|
7837
7454
|
collectPremintV2WithMintsParams,
|
|
7838
7455
|
collectWithMintsParams,
|
|
7839
7456
|
convertCollectionFromApi,
|
|
@@ -7847,8 +7464,6 @@ export {
|
|
|
7847
7464
|
createNew1155Token,
|
|
7848
7465
|
decodeCallFailedError,
|
|
7849
7466
|
defaultAdditionalAdmins,
|
|
7850
|
-
defaultTokenConfigV1MintArguments,
|
|
7851
|
-
defaultTokenConfigV2MintArguments,
|
|
7852
7467
|
emptyContractCreationConfig,
|
|
7853
7468
|
encodeCollectOnManager,
|
|
7854
7469
|
encodePostSignatureInput,
|
|
@@ -7857,7 +7472,6 @@ export {
|
|
|
7857
7472
|
generateTextNftMetadataFiles,
|
|
7858
7473
|
getContractAddressFromReceipt,
|
|
7859
7474
|
getDataFromPremintReceipt,
|
|
7860
|
-
getDefaultFixedPriceMinterAddress,
|
|
7861
7475
|
getMintsAccountBalanceWithPriceQuery,
|
|
7862
7476
|
getMintsEthPrice,
|
|
7863
7477
|
getPremintCollectionAddress,
|
|
@@ -7865,8 +7479,6 @@ export {
|
|
|
7865
7479
|
getPremintMintCosts,
|
|
7866
7480
|
getPremintMintCostsWithUnknownTokenPrice,
|
|
7867
7481
|
getPremintMintFee,
|
|
7868
|
-
getPremintPricePerToken,
|
|
7869
|
-
getPremintedLogFromReceipt,
|
|
7870
7482
|
getRewardsBalances,
|
|
7871
7483
|
getSecondaryInfo,
|
|
7872
7484
|
getSignature,
|
|
@@ -7878,35 +7490,26 @@ export {
|
|
|
7878
7490
|
isOnChainMint,
|
|
7879
7491
|
isPremintConfigV1,
|
|
7880
7492
|
isPremintConfigV2,
|
|
7881
|
-
isValidSignature,
|
|
7882
7493
|
makeCreateContractAndTokenCall,
|
|
7883
7494
|
makeCreateTokenCall,
|
|
7884
7495
|
makeMediaTokenMetadata,
|
|
7885
7496
|
makeMintRewardsRecipient,
|
|
7886
|
-
makeNewPremint,
|
|
7887
7497
|
makeOnchainPrepareMintFromCreate,
|
|
7888
7498
|
makePermitToCollectPremintOrNonPremint,
|
|
7889
7499
|
makePermitTransferBatchAndTypeData,
|
|
7890
7500
|
makePermitTransferTypeData,
|
|
7891
7501
|
makeTextTokenMetadata,
|
|
7892
|
-
makeUrls,
|
|
7893
|
-
migratePremintConfigToV2,
|
|
7894
7502
|
mint,
|
|
7895
7503
|
mintWithEthParams,
|
|
7896
7504
|
mintsBalanceOfAccountParams,
|
|
7897
7505
|
new1155ContractVersion,
|
|
7898
7506
|
parseAndFilterTokenQueryResult,
|
|
7899
7507
|
prepareSetupActions,
|
|
7900
|
-
recoverCreatorFromCreatorAttribution,
|
|
7901
|
-
recoverPremintSigner,
|
|
7902
7508
|
selectMintsToCollectWithFromQueryResult,
|
|
7903
7509
|
sell1155OnSecondary,
|
|
7904
7510
|
sumBalances,
|
|
7905
|
-
supportedPremintVersions,
|
|
7906
|
-
supportsPremintVersion,
|
|
7907
7511
|
toContractCreationConfigOrAddress,
|
|
7908
7512
|
toMintableReturn,
|
|
7909
|
-
tryRecoverPremintSigner,
|
|
7910
7513
|
withdrawRewards
|
|
7911
7514
|
};
|
|
7912
7515
|
//# sourceMappingURL=index.js.map
|