diff --git a/js/packages/cli/src/cli.ts b/js/packages/cli/src/cli.ts index 65f542a..4241d32 100755 --- a/js/packages/cli/src/cli.ts +++ b/js/packages/cli/src/cli.ts @@ -35,7 +35,6 @@ programCommand('upload') .option('-n, --number ', 'Number of images to upload') .action(async (files: string[], options, cmd) => { const {number, keypair, env, cacheName} = cmd.opts(); - const parsedNumber = parseInt(number); const pngFileCount = files.filter(it => { return it.endsWith(EXTENSION_PNG); @@ -44,18 +43,23 @@ programCommand('upload') return it.endsWith(EXTENSION_JSON); }).length; + const parsedNumber = parseInt(number); + const elemCount = parsedNumber ? parsedNumber : pngFileCount; + if (pngFileCount !== jsonFileCount) { throw new Error(`number of png files (${pngFileCount}) is different than the number of json files (${jsonFileCount})`); } - if (parsedNumber < pngFileCount) { - throw new Error(`max number (${parsedNumber})cannot be smaller than the number of elements in the source folder (${pngFileCount})`); + if (elemCount < pngFileCount) { + throw new Error(`max number (${elemCount})cannot be smaller than the number of elements in the source folder (${pngFileCount})`); } + log.info(`Beginning the upload for ${elemCount} (png+json) pairs`) + const startMs = Date.now(); log.info("started at: " + startMs.toString()) for (; ;) { - const successful = await upload(files, cacheName, env, keypair, parsedNumber); + const successful = await upload(files, cacheName, env, keypair, elemCount); if (successful) { break; } else { diff --git a/js/packages/cli/src/helpers/accounts.ts b/js/packages/cli/src/helpers/accounts.ts index 9fb21e3..ec27c59 100644 --- a/js/packages/cli/src/helpers/accounts.ts +++ b/js/packages/cli/src/helpers/accounts.ts @@ -148,6 +148,6 @@ export async function loadAnchorProgram(walletKeyPair: Keypair, env: string) { const idl = await anchor.Program.fetchIdl(CANDY_MACHINE_PROGRAM_ID, provider); const program = new anchor.Program(idl, CANDY_MACHINE_PROGRAM_ID, provider); - log.info("program id from anchor", program.programId.toBase58()); + log.debug("program id from anchor", program.programId.toBase58()); return program; }