Merge branch 'master' of github.com:stegaBOB/metaplex
This commit is contained in:
commit
71fc66e77a
|
@ -35,7 +35,6 @@ programCommand('upload')
|
||||||
.option('-n, --number <number>', 'Number of images to upload')
|
.option('-n, --number <number>', 'Number of images to upload')
|
||||||
.action(async (files: string[], options, cmd) => {
|
.action(async (files: string[], options, cmd) => {
|
||||||
const {number, keypair, env, cacheName} = cmd.opts();
|
const {number, keypair, env, cacheName} = cmd.opts();
|
||||||
const parsedNumber = parseInt(number);
|
|
||||||
|
|
||||||
const pngFileCount = files.filter(it => {
|
const pngFileCount = files.filter(it => {
|
||||||
return it.endsWith(EXTENSION_PNG);
|
return it.endsWith(EXTENSION_PNG);
|
||||||
|
@ -44,18 +43,23 @@ programCommand('upload')
|
||||||
return it.endsWith(EXTENSION_JSON);
|
return it.endsWith(EXTENSION_JSON);
|
||||||
}).length;
|
}).length;
|
||||||
|
|
||||||
|
const parsedNumber = parseInt(number);
|
||||||
|
const elemCount = parsedNumber ? parsedNumber : pngFileCount;
|
||||||
|
|
||||||
if (pngFileCount !== jsonFileCount) {
|
if (pngFileCount !== jsonFileCount) {
|
||||||
throw new Error(`number of png files (${pngFileCount}) is different than the number of json files (${jsonFileCount})`);
|
throw new Error(`number of png files (${pngFileCount}) is different than the number of json files (${jsonFileCount})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parsedNumber < pngFileCount) {
|
if (elemCount < pngFileCount) {
|
||||||
throw new Error(`max number (${parsedNumber})cannot be smaller than the number of elements in the source folder (${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();
|
const startMs = Date.now();
|
||||||
log.info("started at: " + startMs.toString())
|
log.info("started at: " + startMs.toString())
|
||||||
for (; ;) {
|
for (; ;) {
|
||||||
const successful = await upload(files, cacheName, env, keypair, parsedNumber);
|
const successful = await upload(files, cacheName, env, keypair, elemCount);
|
||||||
if (successful) {
|
if (successful) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -148,6 +148,6 @@ export async function loadAnchorProgram(walletKeyPair: Keypair, env: string) {
|
||||||
const idl = await anchor.Program.fetchIdl(CANDY_MACHINE_PROGRAM_ID, provider);
|
const idl = await anchor.Program.fetchIdl(CANDY_MACHINE_PROGRAM_ID, provider);
|
||||||
|
|
||||||
const program = new anchor.Program(idl, 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;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue