@@ -14,6 +14,7 @@ import {
1414 encryptDecrypt ,
1515 isEncryptDecryptSupported ,
1616} from "../../__generated__/IDelayedReveal/read/encryptDecrypt.js" ;
17+ import { nextTokenIdToMint } from "../../__generated__/IERC721Enumerable/read/nextTokenIdToMint.js" ;
1718import {
1819 lazyMint as generatedLazyMint ,
1920 isLazyMintSupported ,
@@ -80,16 +81,29 @@ export function createDelayedRevealBatch(
8081 return generatedLazyMint ( {
8182 contract : options . contract ,
8283 asyncParams : async ( ) => {
83- const placeholderUris = await upload ( {
84- client : options . contract . client ,
85- files : Array ( options . metadata . length ) . fill ( options . placeholderMetadata ) ,
86- } ) ;
84+ const [ placeholderUris , startFileNumber ] = await Promise . all ( [
85+ upload ( {
86+ client : options . contract . client ,
87+ files : Array ( options . metadata . length ) . fill (
88+ options . placeholderMetadata ,
89+ ) ,
90+ } ) ,
91+ nextTokenIdToMint ( {
92+ contract : options . contract ,
93+ } ) ,
94+ ] ) ;
8795 const placeholderUri = getBaseUriFromBatch ( placeholderUris ) ;
8896
8997 const uris = await upload ( {
9098 client : options . contract . client ,
9199 files : options . metadata ,
100+ // IMPORTANT: File number has to be calculated properly otherwise the whole batch will break
101+ // e.g: If you are uploading a second batch, the file name should never start from `0`
102+ rewriteFileNames : {
103+ fileStartNumber : Number ( startFileNumber ) ,
104+ } ,
92105 } ) ;
106+ console . log ( { uris } ) ;
93107 const baseUri = getBaseUriFromBatch ( uris ) ;
94108 const baseUriId = await getBaseURICount ( {
95109 contract : options . contract ,
0 commit comments