|
1 | 1 | #!/usr/bin/env node
|
2 | 2 | import {Command} from 'commander';
|
3 | 3 |
|
4 |
| -import {verify, deploy, verifyMulti} from './index.js'; |
5 | 4 | import {
|
6 |
| - instanceSizes, |
7 | 5 | getPackageJson,
|
8 |
| - formatBytes, |
9 |
| - MAX_POST_SIZE, |
10 |
| - DEFAULT_CONFIG, |
11 | 6 | } from './src/utils.js';
|
12 | 7 |
|
13 |
| -const program = new Command(); |
14 |
| - |
15 |
| -program |
16 |
| - .name('circuitscan') |
17 |
| - .description('CLI tool to verify verifier contracts by their circom sources') |
18 |
| - .version(getPackageJson().version); |
| 8 | +import circomCommands from './src/circom/index.js'; |
| 9 | +import circomMultiCommands from './src/circomMulti/index.js'; |
19 | 10 |
|
20 |
| -program |
21 |
| - .command('verify:circom <mainCircomFile> <chainId> <verifierContractAddress>') |
22 |
| - .description('Verify verifier contracts by their circom sources. Can also specify chain by name.') |
23 |
| - .option('-p, --protocol <protocol>', 'Specify the protocol: groth16 (default), fflonk, plonk (overrides circomkit.json if available)') |
24 |
| - .option('-k, --proving-key <provingKey>', `Specify the proving key filename or url (optional, for Groth16 trusted setups). Must be https hosted if >${formatBytes(MAX_POST_SIZE)}`) |
25 |
| - .option('-t, --ptau <ptauSize>', 'Force a specific Powers of Tau size (8-28 or url to download specific file)') |
26 |
| - .option('-v, --circom-version <circomVersion>', 'Specify the Circom version (e.g. "v2.1.8")') |
27 |
| - .option('-s, --snarkjs-version <snarkjsVersion>', 'Specify the SnarkJS version (e.g. "0.7.3")') |
28 |
| - .option('-i, --instance <memorySize>', `Specify the memory (GB) of compiler instance: ${Object.keys(instanceSizes).join(', ')} (default: 10GB lambda, faster init for small circuits)`) |
29 |
| - .option('-r, --resume <requestId>', 'In case of errors during compilation, reattach to a job and attempt a new deploy. Overrides all other options.') |
30 |
| - .option('-c, --config <configUrl>', `Specify a different configuration file (default: ${DEFAULT_CONFIG})`) |
31 |
| - .option('-a, --api-key <apiKey>', `Specify your API Key as a command line argument`) |
32 |
| - .action(verify); |
| 11 | +const program = new Command(); |
33 | 12 |
|
34 | 13 | program
|
35 |
| - .command('deploy:circom <mainCircomFile> [chainId]') |
36 |
| - .description('Deploy verifier contract by their circom sources. Can also specify chain by name.') |
37 |
| - .option('-p, --protocol <protocol>', 'Specify the protocol: groth16 (default), fflonk, plonk (overrides circomkit.json if available)') |
38 |
| - .option('-k, --proving-key <provingKey>', `Specify the proving key filename or url (optional, for Groth16 trusted setups). Must be https hosted if >${formatBytes(MAX_POST_SIZE)}`) |
39 |
| - .option('-t, --ptau <ptauSize>', 'Force a specific Powers of Tau size (8-28 or url to download specific file)') |
40 |
| - .option('-v, --circom-version <circomVersion>', 'Specify the Circom version (e.g. "v2.1.8")') |
41 |
| - .option('-s, --snarkjs-version <snarkjsVersion>', 'Specify the SnarkJS version (e.g. "0.7.3")') |
42 |
| - .option('-i, --instance <memorySize>', `Specify the memory (GB) of compiler instance: ${Object.keys(instanceSizes).join(', ')} (default: 10GB lambda, faster init for small circuits)`) |
43 |
| - .option('-r, --resume <requestId>', 'In case of errors during compilation, reattach to a job and attempt a new deploy. Overrides all other options.') |
44 |
| - .option('-c, --config <configUrl>', `Specify a different configuration file (default: ${DEFAULT_CONFIG})`) |
45 |
| - .option('-a, --api-key <apiKey>', `Specify your API Key as a command line argument`) |
46 |
| - .option('-b, --browser-wallet', 'Send transaction in browser instead of by passing private key env var (overrides chainId argument)') |
47 |
| - .action(deploy); |
| 14 | + .name('circuitscan') |
| 15 | + .description('CLI tool to verify verifier contracts by their circom sources') |
| 16 | + .version(getPackageJson().version); |
48 | 17 |
|
49 |
| -program |
50 |
| - .command('verify:circom-multi <jsonFile>') |
51 |
| - .description('Verify a Groth16 multi-verifier using a JSON specification. See docs website for details.') |
52 |
| - .option('-c, --config <configUrl>', `Specify a different configuration file (default: ${DEFAULT_CONFIG})`) |
53 |
| - .action(verifyMulti); |
| 18 | +// Each pipeline adds its commands |
| 19 | +circomCommands(program); |
| 20 | +circomMultiCommands(program); |
54 | 21 |
|
55 | 22 | program.parse(process.argv);
|
0 commit comments