diff --git a/js/packages/cli/src/cli.ts b/js/packages/cli/src/cli.ts index 5482fb7..cd46a2d 100755 --- a/js/packages/cli/src/cli.ts +++ b/js/packages/cli/src/cli.ts @@ -17,13 +17,11 @@ import { SYSVAR_RENT_PUBKEY, TransactionInstruction, } from '@solana/web3.js'; -import { token } from '@project-serum/anchor/dist/utils'; const CACHE_PATH = './.cache'; const PAYMENT_WALLET = new anchor.web3.PublicKey( 'HvwC9QSAzvGXhhVrgPmauVwFWcYZhne3hVot9EbHuFTm', ); -const ENV = 'devnet'; const CANDY_MACHINE = 'candy_machine'; const programId = new anchor.web3.PublicKey( @@ -196,7 +194,6 @@ const createConfig = async function ( const config = anchor.web3.Keypair.generate(); const uuid = config.publicKey.toBase58().slice(0, 6); - return { config: config.publicKey, uuid, @@ -250,10 +247,12 @@ program .option('-s, --start-with', 'Image index to start with', '0') .option('-n, --number', 'Number of images to upload', '10000') .option('-c, --cache-name ', 'Cache file name') + .option('-e, --env ', 'Environment') .action(async (files: string[], options, cmd) => { const extension = '.png'; const { startWith, keypair } = cmd.opts(); const cacheName = program.getOptionValue('cacheName') || 'temp'; + const ENV = program.getOptionValue('env') || 'devnet'; const cachePath = path.join(CACHE_PATH, cacheName); const savedContent = fs.existsSync(cachePath) ? JSON.parse(fs.readFileSync(cachePath).toString()) @@ -512,7 +511,9 @@ program .option('-k, --keypair ', 'Solana wallet') .option('-c, --cache-name ', 'Cache file name') .option('-d, --date ', 'timestamp - eg "04 Dec 1995 00:12:00 GMT"') + .option('-e, --env ', 'Environment') .action(async (directory, cmd) => { + const ENV = program.getOptionValue('env') || 'devnet'; const solConnection = new anchor.web3.Connection( `https://api.${ENV}.solana.com/`, ); @@ -559,7 +560,9 @@ program .option('-k, --keypair ', 'Solana wallet') .option('-c, --cache-name ', 'Cache file name') .option('-p, --price ', 'SOL price') + .option('-e, --env ', 'Environment') .action(async (directory, cmd) => { + const ENV = program.getOptionValue('env') || 'devnet'; const solConnection = new anchor.web3.Connection( `https://api.${ENV}.solana.com/`, ); @@ -618,7 +621,9 @@ program .command('mint_one_token') .option('-k, --keypair ', `The purchaser's wallet key`) .option('-c, --cache-name ', 'Cache file name') + .option('-e, --env ', 'Environment') .action(async (directory, cmd) => { + const ENV = program.getOptionValue('env') || 'devnet'; const solConnection = new anchor.web3.Connection( `https://api.${ENV}.solana.com/`, ); @@ -710,7 +715,9 @@ program program .command('verify') .option('-c, --cache-name ', 'Cache file name') + .option('-e, --env ', 'Environment') .action(async (directory, second, options) => { + const ENV = program.getOptionValue('env') || 'devnet'; const solConnection = new anchor.web3.Connection( `https://api.${ENV}.solana.com/`, );